![]() |
Audacity 3.2.0
|
Go to the source code of this file.
Classes | |
| class | SampleFormats |
| Two sample formats, remembering format of original source and describing stored format. More... | |
| class | SampleBuffer |
| class | GrowableSampleBuffer |
Macros | |
| #define | SAMPLE_SIZE(SampleFormat) (static_cast<unsigned>(SampleFormat) >> 16) |
| #define | SAMPLE_SIZE_DISK(SampleFormat) |
| Return the size on disk of one uncompressed sample (bytes) More... | |
Typedefs | |
| using | samplePtr = char * |
| using | constSamplePtr = const char * |
| typedef enum FillFormat | fillFormat |
| using | Floats = ArrayOf< float > |
| using | FloatBuffers = ArraysOf< float > |
| using | Doubles = ArrayOf< double > |
Enumerations | |
| enum class | sampleFormat : unsigned { undefinedSample = 0 , int16Sample = 0x00020001 , int24Sample = 0x00040001 , floatSample = 0x0004000F , narrowestSampleFormat = int16Sample , widestSampleFormat = floatSample } |
| The ordering of these values with operator < agrees with the order of increasing bit width. More... | |
| enum class | FillFormat { fillZero = 0 , fillTwo = 2 } |
Functions | |
| MATH_API TranslatableString | GetSampleFormatStr (sampleFormat format) |
| bool | operator== (SampleFormats a, SampleFormats b) |
| bool | operator!= (SampleFormats a, SampleFormats b) |
| MATH_API void | SamplesToFloats (constSamplePtr src, sampleFormat srcFormat, float *dst, size_t len, size_t srcStride=1, size_t dstStride=1) |
| Copy samples from any format into the widest format, which is 32 bit float, with no dithering. More... | |
| MATH_API void | CopySamples (constSamplePtr src, sampleFormat srcFormat, samplePtr dst, sampleFormat dstFormat, size_t len, DitherType ditherType=gHighQualityDither, unsigned int srcStride=1, unsigned int dstStride=1) |
| Copy samples from any format to any other format; apply dithering only if narrowing the format. More... | |
| MATH_API void | ClearSamples (samplePtr buffer, sampleFormat format, size_t start, size_t len) |
| MATH_API void | ReverseSamples (samplePtr buffer, sampleFormat format, int start, int len) |
| MATH_API void | InitDitherers () |
Variables | |
| MATH_API DitherType | gLowQualityDither |
| These global variables are assigned at application startup or after change of preferences. More... | |
| MATH_API DitherType | gHighQualityDither |
| constexpr sampleFormat | undefinedSample = sampleFormat::undefinedSample |
| constexpr sampleFormat | int16Sample = sampleFormat::int16Sample |
| constexpr sampleFormat | int24Sample = sampleFormat::int24Sample |
| constexpr sampleFormat | floatSample = sampleFormat::floatSample |
| constexpr sampleFormat | narrowestSampleFormat = sampleFormat::narrowestSampleFormat |
| constexpr sampleFormat | widestSampleFormat = sampleFormat::widestSampleFormat |
| #define SAMPLE_SIZE | ( | SampleFormat | ) | (static_cast<unsigned>(SampleFormat) >> 16) |
Definition at line 52 of file SampleFormat.h.
| #define SAMPLE_SIZE_DISK | ( | SampleFormat | ) |
Return the size on disk of one uncompressed sample (bytes)
Definition at line 67 of file SampleFormat.h.
| using constSamplePtr = const char * |
Definition at line 58 of file SampleFormat.h.
Definition at line 255 of file SampleFormat.h.
| typedef enum FillFormat fillFormat |
| using FloatBuffers = ArraysOf<float> |
Definition at line 254 of file SampleFormat.h.
Definition at line 253 of file SampleFormat.h.
| using samplePtr = char * |
Definition at line 57 of file SampleFormat.h.
|
strong |
| Enumerator | |
|---|---|
| fillZero | |
| fillTwo | |
Definition at line 61 of file SampleFormat.h.
|
strong |
The ordering of these values with operator < agrees with the order of increasing bit width.
These values persist in saved project files, so must not be changed in later program versions
| Enumerator | |
|---|---|
| undefinedSample | |
| int16Sample | |
| int24Sample | |
| floatSample | |
| narrowestSampleFormat | Two synonyms for previous values that might change if more values were added. |
| widestSampleFormat | |
Definition at line 30 of file SampleFormat.h.
| MATH_API void ClearSamples | ( | samplePtr | buffer, |
| sampleFormat | format, | ||
| size_t | start, | ||
| size_t | len | ||
| ) |
Definition at line 75 of file SampleFormat.cpp.
References anonymous_namespace{ExportPCM.cpp}::format, SAMPLE_SIZE, and size.
Referenced by RingBuffer::Clear(), AudioIO::DrainRecordBuffers(), Sequence::Get(), WideSampleSequence::GetFloats(), WaveTrack::GetOne(), SampleBlock::GetSamples(), RingBuffer::Put(), and Sequence::SetSamples().
| MATH_API void CopySamples | ( | constSamplePtr | src, |
| sampleFormat | srcFormat, | ||
| samplePtr | dst, | ||
| sampleFormat | dstFormat, | ||
| size_t | len, | ||
| DitherType | ditherType = gHighQualityDither, |
||
| unsigned int | srcStride = 1, |
||
| unsigned int | dstStride = 1 |
||
| ) |
Copy samples from any format to any other format; apply dithering only if narrowing the format.
| src | address of source samples |
| srcFormat | format of source samples, determines sizeof each one |
| dst | address of floating-point numbers |
| len | count of samples to copy |
| srcStride | how many samples to advance src after copying each one |
| dstString | how many samples to advance dst after copying each one |
| dstFormat | format of destination samples, determines sizeof each one |
| ditherType | choice of dithering algorithm to use if narrowing the format |
| ditherType | default is loaded from a global variable |
Definition at line 109 of file SampleFormat.cpp.
References Dither::Apply(), and gDitherAlgorithm.
Referenced by AUPImportFileHandle::AddSamples(), Sequence::Append(), Sequence::ConvertToSampleFormat(), Sequence::DoAppend(), RingBuffer::Get(), SqliteSampleBlock::GetBlob(), PCMExportProcessor::Process(), Mixer::Process(), RingBuffer::Put(), SamplesToFloats(), and Sequence::SetSamples().
| MATH_API TranslatableString GetSampleFormatStr | ( | sampleFormat | format | ) |
Definition at line 58 of file SampleFormat.cpp.
References floatSample, anonymous_namespace{ExportPCM.cpp}::format, int16Sample, int24Sample, and XO().
Referenced by FormatMenuTable::OnFormatChange(), and Sequence::Paste().
| MATH_API void InitDitherers | ( | ) |
Definition at line 51 of file SampleFormat.cpp.
References Dither::BestDitherChoice(), Dither::FastDitherChoice(), gHighQualityDither, and gLowQualityDither.
Referenced by QualityPrefs::Commit(), and AudacityApp::InitPart2().
|
inline |
Definition at line 115 of file SampleFormat.h.
|
inline |
Definition at line 109 of file SampleFormat.h.
References SampleFormats::Effective(), and SampleFormats::Stored().
| MATH_API void ReverseSamples | ( | samplePtr | buffer, |
| sampleFormat | format, | ||
| int | start, | ||
| int | len | ||
| ) |
Definition at line 82 of file SampleFormat.cpp.
References floatSample, anonymous_namespace{ExportPCM.cpp}::format, SAMPLE_SIZE, and size.
Referenced by WaveTrack::GetOne(), and ClipTimeAndPitchSource::Pull().
| MATH_API void SamplesToFloats | ( | constSamplePtr | src, |
| sampleFormat | srcFormat, | ||
| float * | dst, | ||
| size_t | len, | ||
| size_t | srcStride = 1, |
||
| size_t | dstStride = 1 |
||
| ) |
Copy samples from any format into the widest format, which is 32 bit float, with no dithering.
| src | address of source samples |
| srcFormat | format of source samples, determines sizeof each one |
| dst | address of floating-point numbers |
| len | count of samples to copy |
| srcStride | how many samples to advance src after copying each one |
| dstString | how many samples to advance dst after copying each one |
Definition at line 100 of file SampleFormat.cpp.
References CopySamples(), floatSample, and none.
Referenced by AudioIoCallback::AudioCallback(), SqliteSampleBlock::CalcSummary(), and DoSoftwarePlaythrough().
|
constexpr |
Definition at line 45 of file SampleFormat.h.
Referenced by AudacityToPortAudioSampleFormat(), audacity::cloud::audiocom::sync::DecompressBlock(), DITHER(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), EffectPreview(), audacity::cloud::audiocom::sync::anonymous_namespace{WavPackCompressor.cpp}::Exporter::Exporter(), WaveClipUtilities::GetFloatAtTime(), WaveChannelUtilities::GetFloatsFromTime(), anonymous_namespace{WaveTrack.cpp}::GetRenderedCopy(), GetSampleFormatStr(), FormatMenuTable::IdOfFormat(), anonymous_namespace{ImportMP3_MPG123.cpp}::MP3ImportFileHandle::Import(), ImportRaw(), anonymous_namespace{WaveDataCache.cpp}::MakeDefaultDataProvider(), ReverseSamples(), SamplesToFloats(), WaveChannelUtilities::SetFloatsFromTime(), WaveClipUtilities::SetFloatsFromTime(), anonymous_namespace{ImportMP3_MPG123.cpp}::MP3ImportFileHandle::SetupOutputFormat(), TEST_CASE(), and audacity::cloud::audiocom::sync::anonymous_namespace{WavPackCompressor.cpp}::Importer::Unpack().
| MATH_API DitherType gHighQualityDither |
Definition at line 23 of file SampleFormat.h.
|
extern |
These global variables are assigned at application startup or after change of preferences.
Definition at line 47 of file SampleFormat.cpp.
Referenced by InitDitherers(), and Mixer::Process().
|
constexpr |
Definition at line 43 of file SampleFormat.h.
Referenced by AudacityToPortAudioSampleFormat(), audacity::cloud::audiocom::sync::anonymous_namespace{WavPackCompressor.cpp}::Exporter::Compress(), audacity::cloud::audiocom::sync::DecompressBlock(), DITHER(), GetSampleFormatStr(), FormatMenuTable::IdOfFormat(), ImportRaw(), sf_subtype_to_effective_format(), and audacity::cloud::audiocom::sync::anonymous_namespace{WavPackCompressor.cpp}::Importer::Unpack().
|
constexpr |
Definition at line 44 of file SampleFormat.h.
Referenced by AudacityToPortAudioSampleFormat(), DITHER(), GetSampleFormatStr(), FormatMenuTable::IdOfFormat(), and sf_subtype_to_effective_format().
|
constexpr |
Definition at line 46 of file SampleFormat.h.
Referenced by anonymous_namespace{WaveTrackUtilities.cpp}::ReverseOneClip().
|
constexpr |
Definition at line 42 of file SampleFormat.h.
Referenced by audacity::cloud::audiocom::sync::anonymous_namespace{WavPackCompressor.cpp}::Importer::IsValid().
|
constexpr |
Definition at line 47 of file SampleFormat.h.
Referenced by anonymous_namespace{WaveTrack.cpp}::GetRenderedCopy(), and sf_subtype_to_effective_format().