76 template <
class SampleFormatType>
static inline float getAsFloat (SampleFormatType& s)
noexcept {
return s.getAsFloatBE(); }
77 template <
class SampleFormatType>
static inline void setAsFloat (SampleFormatType& s,
float newValue)
noexcept { s.setAsFloatBE (newValue); }
78 template <
class SampleFormatType>
static inline int32 getAsInt32 (SampleFormatType& s)
noexcept {
return s.getAsInt32BE(); }
79 template <
class SampleFormatType>
static inline void setAsInt32 (SampleFormatType& s, int32 newValue)
noexcept { s.setAsInt32BE (newValue); }
80 template <
class SourceType,
class DestType>
static inline void copyFrom (DestType& dest, SourceType& source)
noexcept { dest.copyFromBE (source); }
81 enum { isBigEndian = 1 };
87 template <
class SampleFormatType>
static inline float getAsFloat (SampleFormatType& s)
noexcept {
return s.getAsFloatLE(); }
88 template <
class SampleFormatType>
static inline void setAsFloat (SampleFormatType& s,
float newValue)
noexcept { s.setAsFloatLE (newValue); }
89 template <
class SampleFormatType>
static inline int32 getAsInt32 (SampleFormatType& s)
noexcept {
return s.getAsInt32LE(); }
90 template <
class SampleFormatType>
static inline void setAsInt32 (SampleFormatType& s, int32 newValue)
noexcept { s.setAsInt32LE (newValue); }
91 template <
class SourceType,
class DestType>
static inline void copyFrom (DestType& dest, SourceType& source)
noexcept { dest.copyFromLE (source); }
92 enum { isBigEndian = 0 };
96 class NativeEndian :
public BigEndian {};
98 class NativeEndian :
public LittleEndian {};
105 inline Int8 (
void* d) noexcept : data (
static_cast<int8*
> (d)) {}
107 inline void advance()
noexcept { ++data; }
108 inline void skip (
int numSamples)
noexcept { data += numSamples; }
109 inline float getAsFloatLE()
const noexcept {
return (
float) (*data * (1.0 / (1.0 + maxValue))); }
110 inline float getAsFloatBE()
const noexcept {
return getAsFloatLE(); }
111 inline void setAsFloatLE (
float newValue)
noexcept { *data = (int8) jlimit ((
int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))); }
112 inline void setAsFloatBE (
float newValue)
noexcept { setAsFloatLE (newValue); }
113 inline int32 getAsInt32LE()
const noexcept {
return (
int) (*((uint8*) data) << 24); }
114 inline int32 getAsInt32BE()
const noexcept {
return getAsInt32LE(); }
115 inline void setAsInt32LE (
int newValue)
noexcept { *data = (int8) (newValue >> 24); }
116 inline void setAsInt32BE (
int newValue)
noexcept { setAsInt32LE (newValue); }
117 inline void clear()
noexcept { *data = 0; }
118 inline void clearMultiple (
int num)
noexcept { zeromem (data, (
size_t) (num * bytesPerSample)) ;}
119 template <
class SourceType>
inline void copyFromLE (SourceType& source)
noexcept { setAsInt32LE (source.getAsInt32()); }
120 template <
class SourceType>
inline void copyFromBE (SourceType& source)
noexcept { setAsInt32BE (source.getAsInt32()); }
121 inline void copyFromSameType (Int8& source)
noexcept { *data = *source.data; }
124 enum { bytesPerSample = 1, maxValue = 0x7f, resolution = (1 << 24), isFloat = 0 };
130 inline UInt8 (
void* d) noexcept : data (
static_cast<uint8*
> (d)) {}
132 inline void advance()
noexcept { ++data; }
133 inline void skip (
int numSamples)
noexcept { data += numSamples; }
134 inline float getAsFloatLE()
const noexcept {
return (
float) ((*data - 128) * (1.0 / (1.0 + maxValue))); }
135 inline float getAsFloatBE()
const noexcept {
return getAsFloatLE(); }
136 inline void setAsFloatLE (
float newValue)
noexcept { *data = (uint8) jlimit (0, 255, 128 + roundToInt (newValue * (1.0 + maxValue))); }
137 inline void setAsFloatBE (
float newValue)
noexcept { setAsFloatLE (newValue); }
138 inline int32 getAsInt32LE()
const noexcept {
return (
int) (((uint8) (*data - 128)) << 24); }
139 inline int32 getAsInt32BE()
const noexcept {
return getAsInt32LE(); }
140 inline void setAsInt32LE (
int newValue)
noexcept { *data = (uint8) (128 + (newValue >> 24)); }
141 inline void setAsInt32BE (
int newValue)
noexcept { setAsInt32LE (newValue); }
142 inline void clear()
noexcept { *data = 128; }
143 inline void clearMultiple (
int num)
noexcept { memset (data, 128, (
size_t) num) ;}
144 template <
class SourceType>
inline void copyFromLE (SourceType& source)
noexcept { setAsInt32LE (source.getAsInt32()); }
145 template <
class SourceType>
inline void copyFromBE (SourceType& source)
noexcept { setAsInt32BE (source.getAsInt32()); }
146 inline void copyFromSameType (UInt8& source)
noexcept { *data = *source.data; }
149 enum { bytesPerSample = 1, maxValue = 0x7f, resolution = (1 << 24), isFloat = 0 };
155 inline Int16 (
void* d) noexcept : data (
static_cast<uint16*
> (d)) {}
157 inline void advance()
noexcept { ++data; }
158 inline void skip (
int numSamples)
noexcept { data += numSamples; }
159 inline float getAsFloatLE()
const noexcept {
return (
float) ((1.0 / (1.0 + maxValue)) * (int16) ByteOrder::swapIfBigEndian (*data)); }
160 inline float getAsFloatBE()
const noexcept {
return (
float) ((1.0 / (1.0 + maxValue)) * (int16) ByteOrder::swapIfLittleEndian (*data)); }
161 inline void setAsFloatLE (
float newValue)
noexcept { *data = ByteOrder::swapIfBigEndian ((uint16) jlimit ((
int) -maxValue, (
int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
162 inline void setAsFloatBE (
float newValue)
noexcept { *data = ByteOrder::swapIfLittleEndian ((uint16) jlimit ((
int) -maxValue, (
int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
163 inline int32 getAsInt32LE()
const noexcept {
return (int32) (ByteOrder::swapIfBigEndian ((uint16) *data) << 16); }
164 inline int32 getAsInt32BE()
const noexcept {
return (int32) (ByteOrder::swapIfLittleEndian ((uint16) *data) << 16); }
165 inline void setAsInt32LE (int32 newValue)
noexcept { *data = ByteOrder::swapIfBigEndian ((uint16) (newValue >> 16)); }
166 inline void setAsInt32BE (int32 newValue)
noexcept { *data = ByteOrder::swapIfLittleEndian ((uint16) (newValue >> 16)); }
167 inline void clear()
noexcept { *data = 0; }
168 inline void clearMultiple (
int num)
noexcept { zeromem (data, (
size_t) (num * bytesPerSample)) ;}
169 template <
class SourceType>
inline void copyFromLE (SourceType& source)
noexcept { setAsInt32LE (source.getAsInt32()); }
170 template <
class SourceType>
inline void copyFromBE (SourceType& source)
noexcept { setAsInt32BE (source.getAsInt32()); }
171 inline void copyFromSameType (Int16& source)
noexcept { *data = *source.data; }
174 enum { bytesPerSample = 2, maxValue = 0x7fff, resolution = (1 << 16), isFloat = 0 };
180 inline Int24 (
void* d) noexcept : data (
static_cast<char*
> (d)) {}
182 inline void advance()
noexcept { data += 3; }
183 inline void skip (
int numSamples)
noexcept { data += 3 * numSamples; }
184 inline float getAsFloatLE()
const noexcept {
return (
float) (ByteOrder::littleEndian24Bit (data) * (1.0 / (1.0 + maxValue))); }
185 inline float getAsFloatBE()
const noexcept {
return (
float) (ByteOrder::bigEndian24Bit (data) * (1.0 / (1.0 + maxValue))); }
186 inline void setAsFloatLE (
float newValue)
noexcept { ByteOrder::littleEndian24BitToChars (jlimit ((
int) -maxValue, (
int) maxValue, roundToInt (newValue * (1.0 + maxValue))), data); }
187 inline void setAsFloatBE (
float newValue)
noexcept { ByteOrder::bigEndian24BitToChars (jlimit ((
int) -maxValue, (
int) maxValue, roundToInt (newValue * (1.0 + maxValue))), data); }
188 inline int32 getAsInt32LE()
const noexcept {
return (int32) (((
unsigned int) ByteOrder::littleEndian24Bit (data)) << 8); }
189 inline int32 getAsInt32BE()
const noexcept {
return (int32) (((
unsigned int) ByteOrder::bigEndian24Bit (data)) << 8); }
190 inline void setAsInt32LE (int32 newValue)
noexcept { ByteOrder::littleEndian24BitToChars (newValue >> 8, data); }
191 inline void setAsInt32BE (int32 newValue)
noexcept { ByteOrder::bigEndian24BitToChars (newValue >> 8, data); }
192 inline void clear()
noexcept { data[0] = 0; data[1] = 0; data[2] = 0; }
193 inline void clearMultiple (
int num)
noexcept { zeromem (data, (
size_t) (num * bytesPerSample)) ;}
194 template <
class SourceType>
inline void copyFromLE (SourceType& source)
noexcept { setAsInt32LE (source.getAsInt32()); }
195 template <
class SourceType>
inline void copyFromBE (SourceType& source)
noexcept { setAsInt32BE (source.getAsInt32()); }
196 inline void copyFromSameType (Int24& source)
noexcept { data[0] = source.data[0]; data[1] = source.data[1]; data[2] = source.data[2]; }
199 enum { bytesPerSample = 3, maxValue = 0x7fffff, resolution = (1 << 8), isFloat = 0 };
205 inline Int32 (
void* d) noexcept : data (
static_cast<uint32*
> (d)) {}
207 inline void advance()
noexcept { ++data; }
208 inline void skip (
int numSamples)
noexcept { data += numSamples; }
209 inline float getAsFloatLE()
const noexcept {
return (
float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
210 inline float getAsFloatBE()
const noexcept {
return (
float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
211 inline void setAsFloatLE (
float newValue)
noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) (int32) (maxValue * jlimit (-1.0, 1.0, (
double) newValue))); }
212 inline void setAsFloatBE (
float newValue)
noexcept { *data = ByteOrder::swapIfLittleEndian ((uint32) (int32) (maxValue * jlimit (-1.0, 1.0, (
double) newValue))); }
213 inline int32 getAsInt32LE()
const noexcept {
return (int32) ByteOrder::swapIfBigEndian (*data); }
214 inline int32 getAsInt32BE()
const noexcept {
return (int32) ByteOrder::swapIfLittleEndian (*data); }
215 inline void setAsInt32LE (int32 newValue)
noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) newValue); }
216 inline void setAsInt32BE (int32 newValue)
noexcept { *data = ByteOrder::swapIfLittleEndian ((uint32) newValue); }
217 inline void clear()
noexcept { *data = 0; }
218 inline void clearMultiple (
int num)
noexcept { zeromem (data, (
size_t) (num * bytesPerSample)) ;}
219 template <
class SourceType>
inline void copyFromLE (SourceType& source)
noexcept { setAsInt32LE (source.getAsInt32()); }
220 template <
class SourceType>
inline void copyFromBE (SourceType& source)
noexcept { setAsInt32BE (source.getAsInt32()); }
221 inline void copyFromSameType (Int32& source)
noexcept { *data = *source.data; }
224 enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = 1, isFloat = 0 };
228 class Int24in32 :
public Int32
231 inline Int24in32 (
void* d) noexcept : Int32 (d) {}
233 inline float getAsFloatLE()
const noexcept {
return (
float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
234 inline float getAsFloatBE()
const noexcept {
return (
float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
235 inline void setAsFloatLE (
float newValue)
noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) (maxValue * jlimit (-1.0, 1.0, (
double) newValue))); }
236 inline void setAsFloatBE (
float newValue)
noexcept { *data = ByteOrder::swapIfLittleEndian ((uint32) (maxValue * jlimit (-1.0, 1.0, (
double) newValue))); }
237 inline int32 getAsInt32LE()
const noexcept {
return (int32) ByteOrder::swapIfBigEndian (*data) << 8; }
238 inline int32 getAsInt32BE()
const noexcept {
return (int32) ByteOrder::swapIfLittleEndian (*data) << 8; }
239 inline void setAsInt32LE (int32 newValue)
noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) newValue >> 8); }
240 inline void setAsInt32BE (int32 newValue)
noexcept { *data = ByteOrder::swapIfLittleEndian ((uint32) newValue >> 8); }
241 template <
class SourceType>
inline void copyFromLE (SourceType& source)
noexcept { setAsInt32LE (source.getAsInt32()); }
242 template <
class SourceType>
inline void copyFromBE (SourceType& source)
noexcept { setAsInt32BE (source.getAsInt32()); }
243 inline void copyFromSameType (Int24in32& source)
noexcept { *data = *source.data; }
245 enum { bytesPerSample = 4, maxValue = 0x7fffff, resolution = (1 << 8), isFloat = 0 };
251 inline Float32 (
void* d) noexcept : data (
static_cast<float*
> (d)) {}
253 inline void advance()
noexcept { ++data; }
254 inline void skip (
int numSamples)
noexcept { data += numSamples; }
256 inline float getAsFloatBE()
const noexcept {
return *data; }
257 inline void setAsFloatBE (
float newValue)
noexcept { *data = newValue; }
258 inline float getAsFloatLE()
const noexcept {
union { uint32 asInt;
float asFloat; } n; n.asInt = ByteOrder::swap (*(uint32*) data);
return n.asFloat; }
259 inline void setAsFloatLE (
float newValue)
noexcept {
union { uint32 asInt;
float asFloat; } n; n.asFloat = newValue; *(uint32*) data = ByteOrder::swap (n.asInt); }
261 inline float getAsFloatLE()
const noexcept {
return *data; }
262 inline void setAsFloatLE (
float newValue)
noexcept { *data = newValue; }
263 inline float getAsFloatBE()
const noexcept {
union { uint32 asInt;
float asFloat; } n; n.asInt = ByteOrder::swap (*(uint32*) data);
return n.asFloat; }
264 inline void setAsFloatBE (
float newValue)
noexcept {
union { uint32 asInt;
float asFloat; } n; n.asFloat = newValue; *(uint32*) data = ByteOrder::swap (n.asInt); }
266 inline int32 getAsInt32LE()
const noexcept {
return (int32) roundToInt (jlimit (-1.0, 1.0, (
double) getAsFloatLE()) * (
double) maxValue); }
267 inline int32 getAsInt32BE()
const noexcept {
return (int32) roundToInt (jlimit (-1.0, 1.0, (
double) getAsFloatBE()) * (
double) maxValue); }
268 inline void setAsInt32LE (int32 newValue)
noexcept { setAsFloatLE ((
float) (newValue * (1.0 / (1.0 + maxValue)))); }
269 inline void setAsInt32BE (int32 newValue)
noexcept { setAsFloatBE ((
float) (newValue * (1.0 / (1.0 + maxValue)))); }
270 inline void clear()
noexcept { *data = 0; }
271 inline void clearMultiple (
int num)
noexcept { zeromem (data, (
size_t) (num * bytesPerSample)) ;}
272 template <
class SourceType>
inline void copyFromLE (SourceType& source)
noexcept { setAsFloatLE (source.getAsFloat()); }
273 template <
class SourceType>
inline void copyFromBE (SourceType& source)
noexcept { setAsFloatBE (source.getAsFloat()); }
274 inline void copyFromSameType (Float32& source)
noexcept { *data = *source.data; }
277 enum { bytesPerSample = 4, maxValue = 0x7fffffff, resolution = (1 << 8), isFloat = 1 };
284 inline NonInterleaved() =
default;
285 inline NonInterleaved (
const NonInterleaved&) =
default;
286 inline NonInterleaved (
const int)
noexcept {}
287 inline void copyFrom (
const NonInterleaved&)
noexcept {}
288 template <
class SampleFormatType>
inline void advanceData (SampleFormatType& s)
noexcept { s.advance(); }
289 template <
class SampleFormatType>
inline void advanceDataBy (SampleFormatType& s,
int numSamples)
noexcept { s.skip (numSamples); }
290 template <
class SampleFormatType>
inline void clear (SampleFormatType& s,
int numSamples)
noexcept { s.clearMultiple (numSamples); }
291 template <
class SampleFormatType>
inline static int getNumBytesBetweenSamples (
const SampleFormatType&)
noexcept {
return SampleFormatType::bytesPerSample; }
293 enum { isInterleavedType = 0, numInterleavedChannels = 1 };
299 inline Interleaved()
noexcept {}
300 inline Interleaved (
const Interleaved& other) =
default;
301 inline Interleaved (
const int numInterleavedChans) noexcept : numInterleavedChannels (numInterleavedChans) {}
302 inline void copyFrom (
const Interleaved& other)
noexcept { numInterleavedChannels = other.numInterleavedChannels; }
303 template <
class SampleFormatType>
inline void advanceData (SampleFormatType& s)
noexcept { s.skip (numInterleavedChannels); }
304 template <
class SampleFormatType>
inline void advanceDataBy (SampleFormatType& s,
int numSamples)
noexcept { s.skip (numInterleavedChannels * numSamples); }
305 template <
class SampleFormatType>
inline void clear (SampleFormatType& s,
int numSamples)
noexcept {
while (--numSamples >= 0) { s.clear(); s.skip (numInterleavedChannels); } }
306 template <
class SampleFormatType>
inline int getNumBytesBetweenSamples (
const SampleFormatType&)
const noexcept {
return numInterleavedChannels * SampleFormatType::bytesPerSample; }
307 int numInterleavedChannels = 1;
308 enum { isInterleavedType = 1 };
315 using VoidType = void;
316 static inline void* toVoidPtr (VoidType* v)
noexcept {
return v; }
317 enum { isConst = 0 };
323 using VoidType =
const void;
324 static inline void* toVoidPtr (VoidType* v)
noexcept {
return const_cast<void*
> (v); }
325 enum { isConst = 1 };
354 template <
typename SampleFormat,
356 typename InterleavingType,
366 Pointer (
typename Constness::VoidType* sourceData) noexcept
367 : data (Constness::toVoidPtr (sourceData))
371 static_assert (InterleavingType::isInterleavedType == 0,
"Incorrect constructor for interleaved data");
377 Pointer (
typename Constness::VoidType* sourceData,
int numInterleaved) noexcept
378 : InterleavingType (numInterleaved), data (Constness::toVoidPtr (sourceData))
384 : InterleavingType (other), data (other.data)
390 InterleavingType::operator= (other);
400 inline float getAsFloat() const noexcept {
return Endianness::getAsFloat (data); }
412 static_assert (Constness::isConst == 0,
"Attempt to write to a const pointer");
413 Endianness::setAsFloat (data, newValue);
422 inline int32
getAsInt32() const noexcept {
return Endianness::getAsInt32 (data); }
430 static_assert (Constness::isConst == 0,
"Attempt to write to a const pointer");
431 Endianness::setAsInt32 (data, newValue);
441 Pointer& operator+= (
int samplesToJump)
noexcept { this->advanceDataBy (data, samplesToJump);
return *
this; }
449 static_assert (Constness::isConst == 0,
"Attempt to write to a const pointer");
451 for (
Pointer dest (*
this); --numSamples >= 0;)
453 dest.data.copyFromSameType (source.data);
462 template <
class OtherPo
interType>
466 static_assert (Constness::isConst == 0,
"Attempt to write to a const pointer");
470 if (source.getRawData() != getRawData() || source.getNumBytesBetweenSamples() >= getNumBytesBetweenSamples())
472 while (--numSamples >= 0)
474 Endianness::copyFrom (dest.data, source);
482 source += numSamples;
484 while (--numSamples >= 0)
485 Endianness::copyFrom ((--dest).data, --source);
493 dest.clear (dest.data, numSamples);
504 if (isFloatingPoint())
510 while (--numSamples > 0)
526 while (--numSamples > 0)
535 return Range<float> (mn * (
float) (1.0 / (1.0 + Int32::maxValue)),
536 mx * (
float) (1.0 / (1.0 + Int32::maxValue)));
540 void findMinAndMax (
size_t numSamples,
float& minValue,
float& maxValue)
const noexcept
551 static bool isBigEndian() noexcept {
return (
bool) Endianness::isBigEndian; }
570 const void*
getRawData() const noexcept {
return data.data; }
576 inline void advance() noexcept { this->advanceData (data); }
578 Pointer operator++ (
int);
579 Pointer operator-- (
int);
597 virtual void convertSamples (
void* destSamples,
const void* sourceSamples,
int numSamples)
const = 0;
604 const void* sourceSamples,
int sourceSubChannel,
int numSamples)
const = 0;
616 template <
class SourceSampleType,
class DestSampleType>
621 : sourceChannels (numSourceChannels), destChannels (numDestChannels)
624 void convertSamples (
void* dest,
const void* source,
int numSamples)
const override
626 SourceSampleType s (source, sourceChannels);
627 DestSampleType d (dest, destChannels);
628 d.convertSamples (s, numSamples);
632 const void* source,
int sourceSubChannel,
int numSamples)
const override
634 jassert (destSubChannel < destChannels && sourceSubChannel < sourceChannels);
636 SourceSampleType s (addBytesToPointer (source, sourceSubChannel * SourceSampleType::getBytesPerSample()), sourceChannels);
637 DestSampleType d (addBytesToPointer (dest, destSubChannel * DestSampleType::getBytesPerSample()), destChannels);
638 d.convertSamples (s, numSamples);
644 const int sourceChannels, destChannels;
664 static void convertFloatToInt16LE (
const float* source,
void* dest,
int numSamples,
int destBytesPerSample = 2);
665 static void convertFloatToInt16BE (
const float* source,
void* dest,
int numSamples,
int destBytesPerSample = 2);
667 static void convertFloatToInt24LE (
const float* source,
void* dest,
int numSamples,
int destBytesPerSample = 3);
668 static void convertFloatToInt24BE (
const float* source,
void* dest,
int numSamples,
int destBytesPerSample = 3);
670 static void convertFloatToInt32LE (
const float* source,
void* dest,
int numSamples,
int destBytesPerSample = 4);
671 static void convertFloatToInt32BE (
const float* source,
void* dest,
int numSamples,
int destBytesPerSample = 4);
673 static void convertFloatToFloat32LE (
const float* source,
void* dest,
int numSamples,
int destBytesPerSample = 4);
674 static void convertFloatToFloat32BE (
const float* source,
void* dest,
int numSamples,
int destBytesPerSample = 4);
677 static void convertInt16LEToFloat (
const void* source,
float* dest,
int numSamples,
int srcBytesPerSample = 2);
678 static void convertInt16BEToFloat (
const void* source,
float* dest,
int numSamples,
int srcBytesPerSample = 2);
680 static void convertInt24LEToFloat (
const void* source,
float* dest,
int numSamples,
int srcBytesPerSample = 3);
681 static void convertInt24BEToFloat (
const void* source,
float* dest,
int numSamples,
int srcBytesPerSample = 3);
683 static void convertInt32LEToFloat (
const void* source,
float* dest,
int numSamples,
int srcBytesPerSample = 4);
684 static void convertInt32BEToFloat (
const void* source,
float* dest,
int numSamples,
int srcBytesPerSample = 4);
686 static void convertFloat32LEToFloat (
const void* source,
float* dest,
int numSamples,
int srcBytesPerSample = 4);
687 static void convertFloat32BEToFloat (
const void* source,
float* dest,
int numSamples,
int srcBytesPerSample = 4);
702 static void convertFloatToFormat (DataFormat destFormat,
703 const float* source,
void* dest,
int numSamples);
705 static void convertFormatToFloat (DataFormat sourceFormat,
706 const void* source,
float* dest,
int numSamples);
709 static void interleaveSamples (
const float** source,
float* dest,
710 int numSamples,
int numChannels);
712 static void deinterleaveSamples (
const float* source,
float** dest,
713 int numSamples,
int numChannels);
A set of routines to convert buffers of 32-bit floating point data to and from various integer format...
A class that converts between two templated AudioData::Pointer types, and which implements the AudioD...
void convertSamples(void *dest, const void *source, int numSamples) const override
Converts a sequence of samples from the converter's source format into the dest format.
void convertSamples(void *dest, int destSubChannel, const void *source, int sourceSubChannel, int numSamples) const override
Converts a sequence of samples from the converter's source format into the dest format.
A base class for objects that are used to convert between two different sample formats.
virtual void convertSamples(void *destSamples, int destSubChannel, const void *sourceSamples, int sourceSubChannel, int numSamples) const =0
Converts a sequence of samples from the converter's source format into the dest format.
virtual void convertSamples(void *destSamples, const void *sourceSamples, int numSamples) const =0
Converts a sequence of samples from the converter's source format into the dest format.
Used as a template parameter for AudioData::Pointer.
int getNumBytesBetweenSamples() const noexcept
Returns the number of bytes between the start address of each sample.
void setAsInt32(int32 newValue) noexcept
Sets the value of the first sample as a 32-bit integer.
void clearSamples(int numSamples) const noexcept
Sets a number of samples to zero.
static int getBytesPerSample() noexcept
Returns the number of bytes in each sample (ignoring the number of interleaved channels).
const void * getRawData() const noexcept
Returns a pointer to the underlying data.
void convertSamples(OtherPointerType source, int numSamples) const noexcept
Writes a stream of samples into this pointer from another pointer.
int getNumInterleavedChannels() const noexcept
Returns the number of interleaved channels in the format.
Pointer(const Pointer &other) noexcept
Creates a copy of another pointer.
void convertSamples(Pointer source, int numSamples) const noexcept
Writes a stream of samples into this pointer from another pointer.
int32 getAsInt32() const noexcept
Returns the value of the first sample as a 32-bit integer.
void setAsFloat(float newValue) noexcept
Sets the value of the first sample as a floating point value.
Range< float > findMinAndMax(size_t numSamples) const noexcept
Scans a block of data, returning the lowest and highest levels as floats.
Pointer & operator--() noexcept
Moves the pointer back to the previous sample.
Pointer(typename Constness::VoidType *sourceData, int numInterleaved) noexcept
Creates a pointer from some raw data in the appropriate format with the specified number of interleav...
Pointer & operator++() noexcept
Moves the pointer along to the next sample.
static bool isFloatingPoint() noexcept
Returns true if the pointer is using a floating-point format.
float getAsFloat() const noexcept
Returns the value of the first sample as a floating point value.
Pointer(typename Constness::VoidType *sourceData) noexcept
Creates a non-interleaved pointer from some raw data in the appropriate format.
void findMinAndMax(size_t numSamples, float &minValue, float &maxValue) const noexcept
Scans a block of data, returning the lowest and highest levels as floats.
static int get32BitResolution() noexcept
Returns the accuracy of this format when represented as a 32-bit integer.
static bool isBigEndian() noexcept
Returns true if the format is big-endian.
A general-purpose range object, that simply represents any linear range with a start and end point.
JUCE_CONSTEXPR ValueType getStart() const noexcept
Returns the start of the range.
JUCE_CONSTEXPR ValueType getEnd() const noexcept
Returns the end of the range.
This class a container which holds all the classes pertaining to the AudioData::Pointer audio sample ...
#define JUCE_API
This macro is added to all JUCE public class declarations.