Audacity  2.3.1
Classes | Macros | Typedefs | Enumerations | Functions
SampleFormat.h File Reference
#include "Audacity.h"
#include "MemoryX.h"
#include <wx/defs.h>
#include "audacity/Types.h"

Go to the source code of this file.

Classes

class  SampleBuffer
 
class  GrowableSampleBuffer
 

Macros

#define SAMPLE_SIZE_DISK(SampleFormat)
 Return the size on disk of one uncompressed sample (bytes) More...
 

Typedefs

using Floats = ArrayOf< float >
 
using FloatBuffers = ArraysOf< float >
 
using Doubles = ArrayOf< double >
 

Enumerations

enum  fillFormat { fillZero = 0, fillTwo = 2 }
 

Functions

const wxChar * GetSampleFormatStr (sampleFormat format)
 
void CopySamples (samplePtr src, sampleFormat srcFormat, samplePtr dst, sampleFormat dstFormat, unsigned int len, bool highQuality=true, unsigned int srcStride=1, unsigned int dstStride=1)
 
void CopySamplesNoDither (samplePtr src, sampleFormat srcFormat, samplePtr dst, sampleFormat dstFormat, unsigned int len, unsigned int srcStride=1, unsigned int dstStride=1)
 
void ClearSamples (samplePtr buffer, sampleFormat format, size_t start, size_t len)
 
void ReverseSamples (samplePtr buffer, sampleFormat format, int start, int len)
 
void InitDitherers ()
 

Macro Definition Documentation

#define SAMPLE_SIZE_DISK (   SampleFormat)
Value:
(((SampleFormat) == int24Sample) ? \
size_t{ 3 } : SAMPLE_SIZE(SampleFormat) )
#define SAMPLE_SIZE(SampleFormat)
Definition: Types.h:198

Return the size on disk of one uncompressed sample (bytes)

Definition at line 43 of file SampleFormat.h.

Referenced by AudacityProject::GetEstimatedRecordingMinsLeftOnDisk(), and SimpleBlockFile::GetSpaceUsage().

Typedef Documentation

using Doubles = ArrayOf<double>

Definition at line 155 of file SampleFormat.h.

using FloatBuffers = ArraysOf<float>

Definition at line 154 of file SampleFormat.h.

using Floats = ArrayOf<float>

Definition at line 153 of file SampleFormat.h.

Enumeration Type Documentation

enum fillFormat
Enumerator
fillZero 
fillTwo 

Definition at line 37 of file SampleFormat.h.

37  {
38  fillZero = 0,
39  fillTwo = 2
40 }fillFormat;
fillFormat
Definition: SampleFormat.h:37

Function Documentation

void ClearSamples ( samplePtr  buffer,
sampleFormat  format,
size_t  start,
size_t  len 
)
void CopySamples ( samplePtr  src,
sampleFormat  srcFormat,
samplePtr  dst,
sampleFormat  dstFormat,
unsigned int  len,
bool  highQuality = true,
unsigned int  srcStride = 1,
unsigned int  dstStride = 1 
)

Definition at line 102 of file SampleFormat.cpp.

References Dither::Apply(), gHighQualityDither, and gLowQualityDither.

Referenced by Sequence::Append(), WaveClip::Append(), ODPCMAliasBlockFile::CalcSummary(), ODDecodeBlockFile::CalcSummary(), BlockFile::CalcSummary(), BlockFile::CommonReadData(), ComputeLegacySummaryInfo(), Sequence::ConvertToSampleFormat(), DoSoftwarePlaythrough(), RingBuffer::Get(), NyquistEffect::GetCallback(), WaveClip::GetWaveDisplay(), Mixer::Process(), RingBuffer::Put(), BlockFile::Read256(), BlockFile::Read64K(), SimpleBlockFile::ReadData(), AudioIoCallback::SendVuInputMeterData(), and Sequence::SetSamples().

108 {
110  highQuality ? gHighQualityDither : gLowQualityDither,
111  src, srcFormat, dst, dstFormat, len, srcStride, dstStride);
112 }
void Apply(DitherType ditherType, const samplePtr source, sampleFormat sourceFormat, samplePtr dest, sampleFormat destFormat, unsigned int len, unsigned int sourceStride=1, unsigned int destStride=1)
Definition: Dither.cpp:236
static DitherType gHighQualityDither
static Dither gDitherAlgorithm
static DitherType gLowQualityDither
void CopySamplesNoDither ( samplePtr  src,
sampleFormat  srcFormat,
samplePtr  dst,
sampleFormat  dstFormat,
unsigned int  len,
unsigned int  srcStride = 1,
unsigned int  dstStride = 1 
)

Definition at line 114 of file SampleFormat.cpp.

References Dither::Apply(), and none.

119 {
122  src, srcFormat, dst, dstFormat, len, srcStride, dstStride);
123 }
void Apply(DitherType ditherType, const samplePtr source, sampleFormat sourceFormat, samplePtr dest, sampleFormat destFormat, unsigned int len, unsigned int sourceStride=1, unsigned int destStride=1)
Definition: Dither.cpp:236
Definition: Dither.h:18
static Dither gDitherAlgorithm
const wxChar* GetSampleFormatStr ( sampleFormat  format)

Definition at line 60 of file SampleFormat.cpp.

References _(), floatSample, int16Sample, and int24Sample.

Referenced by Sequence::Paste(), and TrackInfo::Status2DrawFunction().

61 {
62  switch(format) {
63  case int16Sample:
64  /* i18n-hint: Audio data bit depth (precision): 16-bit integers */
65  return _("16-bit PCM");
66  case int24Sample:
67  /* i18n-hint: Audio data bit depth (precision): 24-bit integers */
68  return _("24-bit PCM");
69  case floatSample:
70  /* i18n-hint: Audio data bit depth (precision): 32-bit floating point */
71  return _("32-bit float");
72  }
73  return wxT("Unknown format"); // compiler food
74 }
int format
Definition: ExportPCM.cpp:56
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void InitDitherers ( )

Definition at line 53 of file SampleFormat.cpp.

References QualityPrefs::BestDitherChoice(), QualityPrefs::FastDitherChoice(), gHighQualityDither, and gLowQualityDither.

Referenced by QualityPrefs::Commit(), and AudacityApp::OnInit().

54 {
55  // Read dither preferences
58 }
static DitherType BestDitherChoice()
static DitherType FastDitherChoice()
static DitherType gHighQualityDither
static DitherType gLowQualityDither
void ReverseSamples ( samplePtr  buffer,
sampleFormat  format,
int  start,
int  len 
)

Definition at line 84 of file SampleFormat.cpp.

References floatSample, and SAMPLE_SIZE.

Referenced by Mixer::MixSameRate(), and Mixer::MixVariableRates().

86 {
87  auto size = SAMPLE_SIZE(format);
88  samplePtr first = dst + start * size;
89  samplePtr last = dst + (start + len - 1) * size;
90  enum : size_t { fixedSize = SAMPLE_SIZE(floatSample) };
91  wxASSERT(static_cast<size_t>(size) <= fixedSize);
92  char temp[fixedSize];
93  while (first < last) {
94  memcpy(temp, first, size);
95  memcpy(first, last, size);
96  memcpy(last, temp, size);
97  first += size;
98  last -= size;
99  }
100 }
#define SAMPLE_SIZE(SampleFormat)
Definition: Types.h:198
int format
Definition: ExportPCM.cpp:56
char * samplePtr
Definition: Types.h:203