2 #include "AudioConfig.h"
4 #define INT24_MAX 0x7FFFFF
25 memcpy(value, ptr, 3);
29 value[2] = in > 0 ? 0 : 0xFF;
30 value[1] = (in >> 8) & 0xFF;
46 #if defined(USE_INT24_FROM_INT)
54 void set(
const int32_t &in) {
55 value[2] = (in >> 16) & 0xFF;
56 value[1] = (in >> 8) & 0xFF;
70 operator int()
const {
75 int32_t temp =
toInt();
82 int32_t temp =
toInt();
90 int newInt = ((((int32_t)0xFF & value[0]) << 16) | (((int32_t)0xFF & value[1]) << 8) | ((int32_t)0xFF & value[2]));
91 if ((newInt & 0x00800000) > 0) {
104 return toInt() * INT16_MAX / INT24_MAX;
109 return toInt() * (INT32_MAX / INT24_MAX);
116 void setAndScale16(int16_t i16) {
118 int16_t *p16 = (int16_t *)&value[1];
121 int16_t getAndScale16() {
122 int16_t *p16 = (int16_t *)&value[1];
134 #ifdef USE_TYPETRAITS
137 template<>
class numeric_limits<
audio_tools::int24_3bytes_t> {