|
|
@@ -102,9 +102,9 @@ public: |
|
|
|
|
|
|
|
|
inline void advance() noexcept { ++data; }
|
|
|
inline void advance() noexcept { ++data; }
|
|
|
inline void skip (int numSamples) noexcept { data += numSamples; }
|
|
|
inline void skip (int numSamples) noexcept { data += numSamples; }
|
|
|
inline float getAsFloatLE() const noexcept { return (float) (*data * (1.0 / (1.0 + maxValue))); }
|
|
|
|
|
|
|
|
|
inline float getAsFloatLE() const noexcept { return (float) (*data * (1.0 / (1.0 + (double) maxValue))); }
|
|
|
inline float getAsFloatBE() const noexcept { return getAsFloatLE(); }
|
|
|
inline float getAsFloatBE() const noexcept { return getAsFloatLE(); }
|
|
|
inline void setAsFloatLE (float newValue) noexcept { *data = (int8) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))); }
|
|
|
|
|
|
|
|
|
inline void setAsFloatLE (float newValue) noexcept { *data = (int8) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + (double) maxValue))); }
|
|
|
inline void setAsFloatBE (float newValue) noexcept { setAsFloatLE (newValue); }
|
|
|
inline void setAsFloatBE (float newValue) noexcept { setAsFloatLE (newValue); }
|
|
|
inline int32 getAsInt32LE() const noexcept { return (int) (*((uint8*) data) << 24); }
|
|
|
inline int32 getAsInt32LE() const noexcept { return (int) (*((uint8*) data) << 24); }
|
|
|
inline int32 getAsInt32BE() const noexcept { return getAsInt32LE(); }
|
|
|
inline int32 getAsInt32BE() const noexcept { return getAsInt32LE(); }
|
|
|
@@ -127,9 +127,9 @@ public: |
|
|
|
|
|
|
|
|
inline void advance() noexcept { ++data; }
|
|
|
inline void advance() noexcept { ++data; }
|
|
|
inline void skip (int numSamples) noexcept { data += numSamples; }
|
|
|
inline void skip (int numSamples) noexcept { data += numSamples; }
|
|
|
inline float getAsFloatLE() const noexcept { return (float) ((*data - 128) * (1.0 / (1.0 + maxValue))); }
|
|
|
|
|
|
|
|
|
inline float getAsFloatLE() const noexcept { return (float) ((*data - 128) * (1.0 / (1.0 + (double) maxValue))); }
|
|
|
inline float getAsFloatBE() const noexcept { return getAsFloatLE(); }
|
|
|
inline float getAsFloatBE() const noexcept { return getAsFloatLE(); }
|
|
|
inline void setAsFloatLE (float newValue) noexcept { *data = (uint8) jlimit (0, 255, 128 + roundToInt (newValue * (1.0 + maxValue))); }
|
|
|
|
|
|
|
|
|
inline void setAsFloatLE (float newValue) noexcept { *data = (uint8) jlimit (0, 255, 128 + roundToInt (newValue * (1.0 + (double) maxValue))); }
|
|
|
inline void setAsFloatBE (float newValue) noexcept { setAsFloatLE (newValue); }
|
|
|
inline void setAsFloatBE (float newValue) noexcept { setAsFloatLE (newValue); }
|
|
|
inline int32 getAsInt32LE() const noexcept { return (int) (((uint8) (*data - 128)) << 24); }
|
|
|
inline int32 getAsInt32LE() const noexcept { return (int) (((uint8) (*data - 128)) << 24); }
|
|
|
inline int32 getAsInt32BE() const noexcept { return getAsInt32LE(); }
|
|
|
inline int32 getAsInt32BE() const noexcept { return getAsInt32LE(); }
|
|
|
@@ -152,10 +152,10 @@ public: |
|
|
|
|
|
|
|
|
inline void advance() noexcept { ++data; }
|
|
|
inline void advance() noexcept { ++data; }
|
|
|
inline void skip (int numSamples) noexcept { data += numSamples; }
|
|
|
inline void skip (int numSamples) noexcept { data += numSamples; }
|
|
|
inline float getAsFloatLE() const noexcept { return (float) ((1.0 / (1.0 + maxValue)) * (int16) ByteOrder::swapIfBigEndian (*data)); }
|
|
|
|
|
|
inline float getAsFloatBE() const noexcept { return (float) ((1.0 / (1.0 + maxValue)) * (int16) ByteOrder::swapIfLittleEndian (*data)); }
|
|
|
|
|
|
inline void setAsFloatLE (float newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint16) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
|
|
|
|
|
|
inline void setAsFloatBE (float newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint16) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue)))); }
|
|
|
|
|
|
|
|
|
inline float getAsFloatLE() const noexcept { return (float) ((1.0 / (1.0 + (double) maxValue)) * (int16) ByteOrder::swapIfBigEndian (*data)); }
|
|
|
|
|
|
inline float getAsFloatBE() const noexcept { return (float) ((1.0 / (1.0 + (double) maxValue)) * (int16) ByteOrder::swapIfLittleEndian (*data)); }
|
|
|
|
|
|
inline void setAsFloatLE (float newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint16) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + (double) maxValue)))); }
|
|
|
|
|
|
inline void setAsFloatBE (float newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint16) jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + (double) maxValue)))); }
|
|
|
inline int32 getAsInt32LE() const noexcept { return (int32) (ByteOrder::swapIfBigEndian ((uint16) *data) << 16); }
|
|
|
inline int32 getAsInt32LE() const noexcept { return (int32) (ByteOrder::swapIfBigEndian ((uint16) *data) << 16); }
|
|
|
inline int32 getAsInt32BE() const noexcept { return (int32) (ByteOrder::swapIfLittleEndian ((uint16) *data) << 16); }
|
|
|
inline int32 getAsInt32BE() const noexcept { return (int32) (ByteOrder::swapIfLittleEndian ((uint16) *data) << 16); }
|
|
|
inline void setAsInt32LE (int32 newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint16) (newValue >> 16)); }
|
|
|
inline void setAsInt32LE (int32 newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint16) (newValue >> 16)); }
|
|
|
@@ -177,10 +177,10 @@ public: |
|
|
|
|
|
|
|
|
inline void advance() noexcept { data += 3; }
|
|
|
inline void advance() noexcept { data += 3; }
|
|
|
inline void skip (int numSamples) noexcept { data += 3 * numSamples; }
|
|
|
inline void skip (int numSamples) noexcept { data += 3 * numSamples; }
|
|
|
inline float getAsFloatLE() const noexcept { return (float) (ByteOrder::littleEndian24Bit (data) * (1.0 / (1.0 + maxValue))); }
|
|
|
|
|
|
inline float getAsFloatBE() const noexcept { return (float) (ByteOrder::bigEndian24Bit (data) * (1.0 / (1.0 + maxValue))); }
|
|
|
|
|
|
inline void setAsFloatLE (float newValue) noexcept { ByteOrder::littleEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))), data); }
|
|
|
|
|
|
inline void setAsFloatBE (float newValue) noexcept { ByteOrder::bigEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + maxValue))), data); }
|
|
|
|
|
|
|
|
|
inline float getAsFloatLE() const noexcept { return (float) (ByteOrder::littleEndian24Bit (data) * (1.0 / (1.0 + (double) maxValue))); }
|
|
|
|
|
|
inline float getAsFloatBE() const noexcept { return (float) (ByteOrder::bigEndian24Bit (data) * (1.0 / (1.0 + (double) maxValue))); }
|
|
|
|
|
|
inline void setAsFloatLE (float newValue) noexcept { ByteOrder::littleEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + (double) maxValue))), data); }
|
|
|
|
|
|
inline void setAsFloatBE (float newValue) noexcept { ByteOrder::bigEndian24BitToChars (jlimit ((int) -maxValue, (int) maxValue, roundToInt (newValue * (1.0 + (double) maxValue))), data); }
|
|
|
inline int32 getAsInt32LE() const noexcept { return (int32) (((unsigned int) ByteOrder::littleEndian24Bit (data)) << 8); }
|
|
|
inline int32 getAsInt32LE() const noexcept { return (int32) (((unsigned int) ByteOrder::littleEndian24Bit (data)) << 8); }
|
|
|
inline int32 getAsInt32BE() const noexcept { return (int32) (((unsigned int) ByteOrder::bigEndian24Bit (data)) << 8); }
|
|
|
inline int32 getAsInt32BE() const noexcept { return (int32) (((unsigned int) ByteOrder::bigEndian24Bit (data)) << 8); }
|
|
|
inline void setAsInt32LE (int32 newValue) noexcept { ByteOrder::littleEndian24BitToChars (newValue >> 8, data); }
|
|
|
inline void setAsInt32LE (int32 newValue) noexcept { ByteOrder::littleEndian24BitToChars (newValue >> 8, data); }
|
|
|
@@ -202,10 +202,10 @@ public: |
|
|
|
|
|
|
|
|
inline void advance() noexcept { ++data; }
|
|
|
inline void advance() noexcept { ++data; }
|
|
|
inline void skip (int numSamples) noexcept { data += numSamples; }
|
|
|
inline void skip (int numSamples) noexcept { data += numSamples; }
|
|
|
inline float getAsFloatLE() const noexcept { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
|
|
|
|
|
|
inline float getAsFloatBE() const noexcept { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
|
|
|
|
|
|
inline void setAsFloatLE (float newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) (int32) (maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
|
|
|
|
|
|
inline void setAsFloatBE (float newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint32) (int32) (maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
|
|
|
|
|
|
|
|
|
inline float getAsFloatLE() const noexcept { return (float) ((1.0 / (1.0 + (double) maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
|
|
|
|
|
|
inline float getAsFloatBE() const noexcept { return (float) ((1.0 / (1.0 + (double) maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
|
|
|
|
|
|
inline void setAsFloatLE (float newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) (int32) ((double) maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
|
|
|
|
|
|
inline void setAsFloatBE (float newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint32) (int32) ((double) maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
|
|
|
inline int32 getAsInt32LE() const noexcept { return (int32) ByteOrder::swapIfBigEndian (*data); }
|
|
|
inline int32 getAsInt32LE() const noexcept { return (int32) ByteOrder::swapIfBigEndian (*data); }
|
|
|
inline int32 getAsInt32BE() const noexcept { return (int32) ByteOrder::swapIfLittleEndian (*data); }
|
|
|
inline int32 getAsInt32BE() const noexcept { return (int32) ByteOrder::swapIfLittleEndian (*data); }
|
|
|
inline void setAsInt32LE (int32 newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) newValue); }
|
|
|
inline void setAsInt32LE (int32 newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) newValue); }
|
|
|
@@ -226,10 +226,10 @@ public: |
|
|
public:
|
|
|
public:
|
|
|
inline Int24in32 (void* d) noexcept : Int32 (d) {}
|
|
|
inline Int24in32 (void* d) noexcept : Int32 (d) {}
|
|
|
|
|
|
|
|
|
inline float getAsFloatLE() const noexcept { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
|
|
|
|
|
|
inline float getAsFloatBE() const noexcept { return (float) ((1.0 / (1.0 + maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
|
|
|
|
|
|
inline void setAsFloatLE (float newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) (maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
|
|
|
|
|
|
inline void setAsFloatBE (float newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint32) (maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
|
|
|
|
|
|
|
|
|
inline float getAsFloatLE() const noexcept { return (float) ((1.0 / (1.0 + (double) maxValue)) * (int32) ByteOrder::swapIfBigEndian (*data)); }
|
|
|
|
|
|
inline float getAsFloatBE() const noexcept { return (float) ((1.0 / (1.0 + (double) maxValue)) * (int32) ByteOrder::swapIfLittleEndian (*data)); }
|
|
|
|
|
|
inline void setAsFloatLE (float newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) ((double) maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
|
|
|
|
|
|
inline void setAsFloatBE (float newValue) noexcept { *data = ByteOrder::swapIfLittleEndian ((uint32) ((double) maxValue * jlimit (-1.0, 1.0, (double) newValue))); }
|
|
|
inline int32 getAsInt32LE() const noexcept { return (int32) ByteOrder::swapIfBigEndian (*data) << 8; }
|
|
|
inline int32 getAsInt32LE() const noexcept { return (int32) ByteOrder::swapIfBigEndian (*data) << 8; }
|
|
|
inline int32 getAsInt32BE() const noexcept { return (int32) ByteOrder::swapIfLittleEndian (*data) << 8; }
|
|
|
inline int32 getAsInt32BE() const noexcept { return (int32) ByteOrder::swapIfLittleEndian (*data) << 8; }
|
|
|
inline void setAsInt32LE (int32 newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) newValue >> 8); }
|
|
|
inline void setAsInt32LE (int32 newValue) noexcept { *data = ByteOrder::swapIfBigEndian ((uint32) newValue >> 8); }
|
|
|
@@ -261,8 +261,8 @@ public: |
|
|
#endif
|
|
|
#endif
|
|
|
inline int32 getAsInt32LE() const noexcept { return (int32) roundToInt (jlimit (-1.0, 1.0, (double) getAsFloatLE()) * (double) maxValue); }
|
|
|
inline int32 getAsInt32LE() const noexcept { return (int32) roundToInt (jlimit (-1.0, 1.0, (double) getAsFloatLE()) * (double) maxValue); }
|
|
|
inline int32 getAsInt32BE() const noexcept { return (int32) roundToInt (jlimit (-1.0, 1.0, (double) getAsFloatBE()) * (double) maxValue); }
|
|
|
inline int32 getAsInt32BE() const noexcept { return (int32) roundToInt (jlimit (-1.0, 1.0, (double) getAsFloatBE()) * (double) maxValue); }
|
|
|
inline void setAsInt32LE (int32 newValue) noexcept { setAsFloatLE ((float) (newValue * (1.0 / (1.0 + maxValue)))); }
|
|
|
|
|
|
inline void setAsInt32BE (int32 newValue) noexcept { setAsFloatBE ((float) (newValue * (1.0 / (1.0 + maxValue)))); }
|
|
|
|
|
|
|
|
|
inline void setAsInt32LE (int32 newValue) noexcept { setAsFloatLE ((float) (newValue * (1.0 / (1.0 + (double) maxValue)))); }
|
|
|
|
|
|
inline void setAsInt32BE (int32 newValue) noexcept { setAsFloatBE ((float) (newValue * (1.0 / (1.0 + (double) maxValue)))); }
|
|
|
inline void clear() noexcept { *data = 0; }
|
|
|
inline void clear() noexcept { *data = 0; }
|
|
|
inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;}
|
|
|
inline void clearMultiple (int num) noexcept { zeromem (data, (size_t) (num * bytesPerSample)) ;}
|
|
|
template <class SourceType> inline void copyFromLE (SourceType& source) noexcept { setAsFloatLE (source.getAsFloat()); }
|
|
|
template <class SourceType> inline void copyFromLE (SourceType& source) noexcept { setAsFloatLE (source.getAsFloat()); }
|
|
|
@@ -528,8 +528,8 @@ public: |
|
|
if (v < mn) mn = v;
|
|
|
if (v < mn) mn = v;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
return Range<float> (mn * (float) (1.0 / (1.0 + Int32::maxValue)),
|
|
|
|
|
|
mx * (float) (1.0 / (1.0 + Int32::maxValue)));
|
|
|
|
|
|
|
|
|
return Range<float> (mn * (float) (1.0 / (1.0 + (double) Int32::maxValue)),
|
|
|
|
|
|
mx * (float) (1.0 / (1.0 + (double) Int32::maxValue)));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/** Scans a block of data, returning the lowest and highest levels as floats */
|
|
|
/** Scans a block of data, returning the lowest and highest levels as floats */
|
|
|
|