diff --git a/noson/src/filepicreader.cpp b/noson/src/filepicreader.cpp index 8928bec..513884d 100644 --- a/noson/src/filepicreader.cpp +++ b/noson/src/filepicreader.cpp @@ -240,7 +240,7 @@ FilePicReader::Picture * FilePicReader::ExtractFLACPicture(const std::string& fi // get last block flag. if true next loop will stop isLast = ((*buf & 0x80) != 0); // get the current block size - unsigned v = (read32be(buf) & 0xffffff) - 4; + unsigned v = (read_b32be(buf) & 0xffffff) - 4; if (v > MAX_PICTURE_SIZE) break; @@ -250,7 +250,7 @@ FilePicReader::Picture * FilePicReader::ExtractFLACPicture(const std::string& fi { DBG(DBG_PROTO, "%s: picture type (%.2x)\n", __FUNCTION__, buf[7]); // check picture type matches with requirement - if (read32be(buf + 4) == pictureType || pictureType == -1) + if (read_b32be(buf + 4) == pictureType || pictureType == -1) { unsigned mime_type_len; unsigned desc_len; @@ -258,9 +258,9 @@ FilePicReader::Picture * FilePicReader::ExtractFLACPicture(const std::string& fi char * picbuf = new char [v]; // read data block and check for sanity if (fread(picbuf, 1, v, file) != v || - (mime_type_len = read32be(picbuf)) > v - 4 || - (desc_len = read32be(picbuf + 4 + mime_type_len)) > v - 8 - mime_type_len || - (data_len = read32be(picbuf + mime_type_len + desc_len + 24)) > v - 28 - desc_len - mime_type_len) + (mime_type_len = read_b32be(picbuf)) > v - 4 || + (desc_len = read_b32be(picbuf + 4 + mime_type_len)) > v - 8 - mime_type_len || + (data_len = read_b32be(picbuf + mime_type_len + desc_len + 24)) > v - 28 - desc_len - mime_type_len) { delete [] picbuf; break; @@ -384,20 +384,20 @@ static inline void _parse_id3v2_frame_header(char * data, unsigned int version, case 2: memcpy(fh->frame_id, data, 3); fh->frame_id[3] = 0; - fh->frame_size = (unsigned)read24be(data + 3); + fh->frame_size = (unsigned)read_b24be(data + 3); fh->compression = 0; fh->data_length_indicator = 0; break; case 3: memcpy(fh->frame_id, data, 4); - fh->frame_size = (unsigned)read32be(data + 4); + fh->frame_size = (unsigned)read_b32be(data + 4); fh->compression = data[9] & 0x40; fh->data_length_indicator = 0; break; case 4: default: memcpy(fh->frame_id, data, 4); - fh->frame_size = (unsigned)read32be(data + 4); + fh->frame_size = (unsigned)read_b32be(data + 4); fh->compression = data[9] & 0x4; fh->data_length_indicator = data[9] & 0x1; break; @@ -671,7 +671,7 @@ int FilePicReader::parse_id3v2(FILE * file, long id3v2_offset, Picture ** pic, o if (fread(extended_header_data, 1, 6, file) != 6) return -1; - extended_header_size = (unsigned)read32be(extended_header_data); + extended_header_size = (unsigned)read_b32be(extended_header_data); fseek(file, extended_header_size - 6, SEEK_CUR); frame_data_pos += extended_header_size; @@ -766,8 +766,8 @@ FilePicReader::Picture * FilePicReader::ExtractOGGSPicture(const std::string& fi break; } //char stream_structure_version = read8(buf + 4); - unsigned char header_type_flag = (unsigned char)read8(buf + 5); - unsigned char number_page_segments = (unsigned char)read8(buf + 26); + unsigned char header_type_flag = (unsigned char)read_b8(buf + 5); + unsigned char number_page_segments = (unsigned char)read_b8(buf + 26); uint32_t segment_table = 0; if (fread(lacing, 1, number_page_segments, file) != number_page_segments) @@ -777,7 +777,7 @@ FilePicReader::Picture * FilePicReader::ExtractOGGSPicture(const std::string& fi } for (int i = 0; i < number_page_segments; ++i) - segment_table += (unsigned char)read8(lacing + i); + segment_table += (unsigned char)read_b8(lacing + i); // bit 0x04: this is the last page of a logical bitstream (eos) if ((header_type_flag & 0x04) == 0x04) @@ -828,7 +828,7 @@ FilePicReader::Picture * FilePicReader::ExtractOGGSPicture(const std::string& fi } // check for vorbis comment header - unsigned char block = (unsigned char)read8(packet.data); + unsigned char block = (unsigned char)read_b8(packet.data); if (block == 0x03 && packet.datalen > 7 && memcmp(packet.data + 1, "vorbis", 6) == 0) { @@ -895,12 +895,12 @@ bool FilePicReader::parse_comment(packet_t * packet, Picture ** pic, PictureType bool gotoLast = false; unsigned char * ve = packet->data + packet->datalen; unsigned char * vp = packet->data + 7; // pass magic string - vp += read32le(vp) + 4; // pass vendor string - int count = read32le(vp); // comment list length; + vp += read_b32le(vp) + 4; // pass vendor string + int count = read_b32le(vp); // comment list length; vp += 4; while (count > 0) { - int len = read32le(vp); + int len = read_b32le(vp); vp += 4; if ((vp + len) > ve) break; // buffer overflow @@ -911,15 +911,15 @@ bool FilePicReader::parse_comment(packet_t * packet, Picture ** pic, PictureType char * picbuf = nullptr; size_t lenbuf = Base64::b64decode(vp + 23, len - 23, &picbuf); // check picture type matches with requirement - if (lenbuf > 8 && (read32be(picbuf) == pictureType || pictureType == -1)) + if (lenbuf > 8 && (read_b32be(picbuf) == pictureType || pictureType == -1)) { unsigned mime_type_len; unsigned desc_len; unsigned data_len; // check for sanity - if ((mime_type_len = read32be(picbuf + 4)) > lenbuf - 8 || - (desc_len = read32be(picbuf + 8 + mime_type_len)) > lenbuf - 12 - mime_type_len || - (data_len = read32be(picbuf + mime_type_len + desc_len + 28)) > lenbuf - 32 - desc_len - mime_type_len) + if ((mime_type_len = read_b32be(picbuf + 4)) > lenbuf - 8 || + (desc_len = read_b32be(picbuf + 8 + mime_type_len)) > lenbuf - 12 - mime_type_len || + (data_len = read_b32be(picbuf + mime_type_len + desc_len + 28)) > lenbuf - 32 - desc_len - mime_type_len) { delete [] picbuf; break; @@ -1015,15 +1015,15 @@ int FilePicReader::nextChild(unsigned char * buf, uint64_t * remaining, FILE * f if (fread(buf, 1, M4A_HEADER_SIZE, fp) == M4A_HEADER_SIZE) { *remaining -= M4A_HEADER_SIZE; - *child = (unsigned)read32be(buf + 4); - *childSize = (uint32_t)read32be(buf); + *child = (unsigned)read_b32be(buf + 4); + *childSize = (uint32_t)read_b32be(buf); if (*childSize == 1) { // size of 1 means the real size follows the header in next 8 bytes (64bits) if (*remaining < 8 || fread(buf, 1, 8, fp) != 8) return -1; // error *remaining -= 8; - *childSize = (((uint64_t)read32be(buf) << 32) | (uint32_t)read32be(buf + 4)) - M4A_HEADER_SIZE - 8; + *childSize = (((uint64_t)read_b32be(buf) << 32) | (uint32_t)read_b32be(buf + 4)) - M4A_HEADER_SIZE - 8; } else { @@ -1054,7 +1054,7 @@ int FilePicReader::loadDataValue(uint64_t * remaining, FILE * fp, char ** alloc, *remaining -= size; *allocSize = size; *alloc = _alloc; - return (read32be(_alloc) & 0x00ffffff); // return datatype + return (read_b32be(_alloc) & 0x00ffffff); // return datatype } return r; } diff --git a/noson/src/flacencoder.cpp b/noson/src/flacencoder.cpp index a75bd75..4e2ea2a 100644 --- a/noson/src/flacencoder.cpp +++ b/noson/src/flacencoder.cpp @@ -180,14 +180,14 @@ int FLACEncoder::encode(const char * data, int len) m_pcm[i] = (unsigned char)(*data) - 128; break; case 16: - m_pcm[i] = read16le(data); + m_pcm[i] = read_b16le(data); break; case 24: - m_pcm[i] = read24le(data); + m_pcm[i] = read_b24le(data); break; case 32: // remove lower LSB - m_pcm[i] = (read32le(data) >> 8); + m_pcm[i] = (read_b32le(data) >> 8); break; default: m_pcm[i] = 0; diff --git a/noson/src/private/byteorder.cpp b/noson/src/private/byteorder.cpp index 21793f9..f45c070 100644 --- a/noson/src/private/byteorder.cpp +++ b/noson/src/private/byteorder.cpp @@ -23,4 +23,4 @@ static int test_endianess() { return (*((char*)(&test))) ? LITTLE_ENDIAN : BIG_ENDIAN; } -int __endianess__ = test_endianess(); +int machine_bom = test_endianess(); diff --git a/noson/src/private/byteorder.h b/noson/src/private/byteorder.h index 0cb9a0d..b248b09 100644 --- a/noson/src/private/byteorder.h +++ b/noson/src/private/byteorder.h @@ -25,8 +25,8 @@ #ifndef BYTE_ORDER #define LITTLE_ENDIAN 1234 #define BIG_ENDIAN 4321 -extern int __endianess__; -#define BYTE_ORDER __endianess__ +extern int machine_bom; +#define BYTE_ORDER machine_bom #endif #define is_big_endian (BYTE_ORDER == BIG_ENDIAN) #define is_little_endian (BYTE_ORDER == LITTLE_ENDIAN) @@ -44,24 +44,24 @@ template inline void toUnaligned(void * data, T val) memcpy(data, &val, sizeof(T)); } -static inline int8_t read8(const void * data) +static inline int8_t read_b8(const void * data) { return fromUnaligned(data); } -static inline void write8(void * data, int8_t val) +static inline void write_b8(void * data, int8_t val) { toUnaligned(data, val); } -static inline int16_t swap16(int16_t val) +static inline int16_t swap_b16(int16_t val) { return (int16_t)(0 | (((uint32_t)val & 0x00ff) << 8) | (((uint32_t)val & 0xff00) >> 8)); } -static inline int32_t swap32(int32_t val) +static inline int32_t swap_b32(int32_t val) { return (int32_t)(0 | (((uint32_t)val & 0x000000ff) << 24) | @@ -71,39 +71,39 @@ static inline int32_t swap32(int32_t val) ); } -static inline int16_t read16le(const void * data) +static inline int16_t read_b16le(const void * data) { int16_t val = fromUnaligned(data); if (is_little_endian) return val; - return swap16(val); + return swap_b16(val); } -static inline void write16le(void * data, int16_t val) +static inline void write_b16le(void * data, int16_t val) { if (is_little_endian) toUnaligned(data, val); else - toUnaligned(data, swap16(val)); + toUnaligned(data, swap_b16(val)); } -static inline int16_t read16be(const void * data) +static inline int16_t read_b16be(const void * data) { int16_t val = fromUnaligned(data); if (is_big_endian) return val; - return swap16(val); + return swap_b16(val); } -static inline void write16be(void * data, int16_t val) +static inline void write_b16be(void * data, int16_t val) { if (is_big_endian) toUnaligned(data, val); else - toUnaligned(data, swap16(val)); + toUnaligned(data, swap_b16(val)); } -static inline int32_t read24le(const void * data) +static inline int32_t read_b24le(const void * data) { const char * p = (const char*)data; int32_t val = fromUnaligned(&p[2]) << 16; @@ -114,7 +114,7 @@ static inline int32_t read24le(const void * data) return val; } -static inline int32_t read24be(const void * data) +static inline int32_t read_b24be(const void * data) { const char * p = (const char*)data; int32_t val = fromUnaligned(&p[0]) << 16; @@ -125,36 +125,36 @@ static inline int32_t read24be(const void * data) return val; } -static inline int32_t read32le(const void * data) +static inline int32_t read_b32le(const void * data) { int32_t val = fromUnaligned(data); if (is_little_endian) return val; - return swap32(val); + return swap_b32(val); } -static inline void write32le(void * data, int32_t val) +static inline void write_b32le(void * data, int32_t val) { if (is_little_endian) toUnaligned(data, val); else - toUnaligned(data, swap32(val)); + toUnaligned(data, swap_b32(val)); } -static inline int32_t read32be(const void * data) +static inline int32_t read_b32be(const void * data) { int32_t val = fromUnaligned(data); if (is_big_endian) return val; - return swap32(val); + return swap_b32(val); } -static inline void write32be(void * data, int32_t val) +static inline void write_b32be(void * data, int32_t val) { if (is_big_endian) toUnaligned(data, val); else - toUnaligned(data, swap32(val)); + toUnaligned(data, swap_b32(val)); } #endif /* BYTEORDER_H */ diff --git a/noson/src/private/pcmblankkiller.cpp b/noson/src/private/pcmblankkiller.cpp index ee01ff8..b20b7ba 100644 --- a/noson/src/private/pcmblankkiller.cpp +++ b/noson/src/private/pcmblankkiller.cpp @@ -49,8 +49,8 @@ void PCMBlankKillerU8(void * buf, int channels, int frames) p = (uint8_t*)buf; for (int c = 0; c < channels; ++c) { - write8(p + c, (int8_t)(ZEROU8 + PCM_KILLER_LEVEL)); - write8(p + channels + c, (int8_t)(ZEROU8 - PCM_KILLER_LEVEL)); + write_b8(p + c, (int8_t)(ZEROU8 + PCM_KILLER_LEVEL)); + write_b8(p + channels + c, (int8_t)(ZEROU8 - PCM_KILLER_LEVEL)); } } } @@ -62,14 +62,14 @@ void PCMBlankKillerS16LE(void * buf, int channels, int frames) int16_t * p = (int16_t*)buf; int16_t * e = p + frames * channels; int v = 0; - while (p < e) { v |= (read16le(p++) - ZEROS); } + while (p < e) { v |= (read_b16le(p++) - ZEROS); } if (v == 0) { p = (int16_t*)buf; for (int c = 0; c < channels; ++c) { - write16le(p + c, (ZEROS + (PCM_KILLER_LEVEL << 4))); - write16le(p + channels + c, (ZEROS - (PCM_KILLER_LEVEL << 4))); + write_b16le(p + c, (ZEROS + (PCM_KILLER_LEVEL << 4))); + write_b16le(p + channels + c, (ZEROS - (PCM_KILLER_LEVEL << 4))); } } } @@ -79,14 +79,14 @@ void PCMBlankKillerU16LE(void * buf, int channels, int frames) uint16_t * p = (uint16_t*)buf; uint16_t * e = p + frames * channels; int v = 0; - while (p < e) { v |= ((uint16_t)read16le(p++) - ZEROU16); } + while (p < e) { v |= ((uint16_t)read_b16le(p++) - ZEROU16); } if (v == 0) { p = (uint16_t*)buf; for (int c = 0; c < channels; ++c) { - write16le(p + c, (int16_t)(ZEROU16 + (PCM_KILLER_LEVEL << 4))); - write16le(p + channels + c, (int16_t)(ZEROU16 - (PCM_KILLER_LEVEL << 4))); + write_b16le(p + c, (int16_t)(ZEROU16 + (PCM_KILLER_LEVEL << 4))); + write_b16le(p + channels + c, (int16_t)(ZEROU16 - (PCM_KILLER_LEVEL << 4))); } } } @@ -96,15 +96,15 @@ void PCMBlankKillerS24LE(void * buf, int channels, int frames) int8_t * p = (int8_t*)buf; int8_t * e = p + 3 * frames * channels; int v = 0; - while (p < e) { v |= ((read32le(p) >> 8) - ZEROS); p += 3; } + while (p < e) { v |= ((read_b32le(p) >> 8) - ZEROS); p += 3; } if (v == 0) { p = (int8_t*)buf; for (int c = 0; c < channels; ++c) - write32le(p + 3 * c, (ZEROS + (PCM_KILLER_LEVEL << 8))); + write_b32le(p + 3 * c, (ZEROS + (PCM_KILLER_LEVEL << 8))); for (int c = 0; c < channels; ++c) - write32le(p + 3 * (channels + c), (ZEROS - (PCM_KILLER_LEVEL << 8))); - write8(p + 3 * 2 * channels, (int8_t)(ZEROS & 0xff)); + write_b32le(p + 3 * (channels + c), (ZEROS - (PCM_KILLER_LEVEL << 8))); + write_b8(p + 3 * 2 * channels, (int8_t)(ZEROS & 0xff)); } } @@ -113,15 +113,15 @@ void PCMBlankKillerU24LE(void * buf, int channels, int frames) uint8_t * p = (uint8_t*)buf; uint8_t * e = p + 3 * frames * channels; int v = 0; - while (p < e) { v |= (((uint32_t)read32le(p) >> 8) - ZEROU24); p += 3; } + while (p < e) { v |= (((uint32_t)read_b32le(p) >> 8) - ZEROU24); p += 3; } if (v == 0) { p = (uint8_t*)buf; for (int c = 0; c < channels; ++c) - write32le(p + 3 * c, (int32_t)(ZEROU24 + (PCM_KILLER_LEVEL << 8))); + write_b32le(p + 3 * c, (int32_t)(ZEROU24 + (PCM_KILLER_LEVEL << 8))); for (int c = 0; c < channels; ++c) - write32le(p + 3 * (channels + c), (int32_t)(ZEROU24 - (PCM_KILLER_LEVEL << 8))); - write8(p + 3 * 2 * channels, (int8_t)(ZEROU24 & 0xff)); + write_b32le(p + 3 * (channels + c), (int32_t)(ZEROU24 - (PCM_KILLER_LEVEL << 8))); + write_b8(p + 3 * 2 * channels, (int8_t)(ZEROU24 & 0xff)); } } @@ -130,14 +130,14 @@ void PCMBlankKillerS32LE(void * buf, int channels, int frames) int32_t * p = (int32_t*)buf; int32_t * e = p + frames * channels; int v = 0; - while (p < e) { v |= (read32le(p++) - ZEROS); } + while (p < e) { v |= (read_b32le(p++) - ZEROS); } if (v == 0) { p = (int32_t*)buf; for (int c = 0; c < channels; ++c) { - write32le(p + c, (ZEROS + (PCM_KILLER_LEVEL << 16))); - write32le(p + channels + c, (ZEROS - (PCM_KILLER_LEVEL << 16))); + write_b32le(p + c, (ZEROS + (PCM_KILLER_LEVEL << 16))); + write_b32le(p + channels + c, (ZEROS - (PCM_KILLER_LEVEL << 16))); } } } @@ -147,14 +147,14 @@ void PCMBlankKillerU32LE(void * buf, int channels, int frames) uint32_t * p = (uint32_t*)buf; uint32_t * e = p + frames * channels; int v = 0; - while (p < e) { v |= ((uint32_t)read32le(p++) - ZEROU32); } + while (p < e) { v |= ((uint32_t)read_b32le(p++) - ZEROU32); } if (v == 0) { p = (uint32_t*)buf; for (int c = 0; c < channels; ++c) { - write32le(p + c, (int32_t)(ZEROU32 + (PCM_KILLER_LEVEL << 16))); - write32le(p + channels + c, (int32_t)(ZEROU32 - (PCM_KILLER_LEVEL << 16))); + write_b32le(p + c, (int32_t)(ZEROU32 + (PCM_KILLER_LEVEL << 16))); + write_b32le(p + channels + c, (int32_t)(ZEROU32 - (PCM_KILLER_LEVEL << 16))); } } } @@ -166,14 +166,14 @@ void PCMBlankKillerS16BE(void * buf, int channels, int frames) int16_t * p = (int16_t*)buf; int16_t * e = p + frames * channels; int v = 0; - while (p < e) { v |= (read16be(p++) - ZEROS); } + while (p < e) { v |= (read_b16be(p++) - ZEROS); } if (v == 0) { p = (int16_t*)buf; for (int c = 0; c < channels; ++c) { - write16be(p + c, (ZEROS + (PCM_KILLER_LEVEL << 4))); - write16be(p + channels + c, (ZEROS - (PCM_KILLER_LEVEL << 4))); + write_b16be(p + c, (ZEROS + (PCM_KILLER_LEVEL << 4))); + write_b16be(p + channels + c, (ZEROS - (PCM_KILLER_LEVEL << 4))); } } } @@ -183,14 +183,14 @@ void PCMBlankKillerU16BE(void * buf, int channels, int frames) uint16_t * p = (uint16_t*)buf; uint16_t * e = p + frames * channels; int v = 0; - while (p < e) { v |= ((uint16_t)read16be(p++) - ZEROU16); } + while (p < e) { v |= ((uint16_t)read_b16be(p++) - ZEROU16); } if (v == 0) { p = (uint16_t*)buf; for (int c = 0; c < channels; ++c) { - write16be(p + c, (int16_t)(ZEROU16 + (PCM_KILLER_LEVEL << 4))); - write16be(p + channels + c, (int16_t)(ZEROU16 - (PCM_KILLER_LEVEL << 4))); + write_b16be(p + c, (int16_t)(ZEROU16 + (PCM_KILLER_LEVEL << 4))); + write_b16be(p + channels + c, (int16_t)(ZEROU16 - (PCM_KILLER_LEVEL << 4))); } } } @@ -200,15 +200,15 @@ void PCMBlankKillerS24BE(void * buf, int channels, int frames) int8_t * p = (int8_t*)buf; int8_t * e = p + 3 * frames * channels; int v = 0; - while (p < e) { v |= ((read32be(p) >> 8) - ZEROS); p += 3; } + while (p < e) { v |= ((read_b32be(p) >> 8) - ZEROS); p += 3; } if (v == 0) { p = (int8_t*)buf; for (int c = 0; c < channels; ++c) - write32be(p + 3 * c, (ZEROS + (PCM_KILLER_LEVEL << 8)) << 8); + write_b32be(p + 3 * c, (ZEROS + (PCM_KILLER_LEVEL << 8)) << 8); for (int c = 0; c < channels; ++c) - write32be(p + 3 * (channels + c), (uint32_t)(ZEROS - (PCM_KILLER_LEVEL << 8)) << 8); - write8(p + 3 * 2 * channels, (int8_t)((ZEROS & 0x00ff0000) >> 16)); + write_b32be(p + 3 * (channels + c), (uint32_t)(ZEROS - (PCM_KILLER_LEVEL << 8)) << 8); + write_b8(p + 3 * 2 * channels, (int8_t)((ZEROS & 0x00ff0000) >> 16)); } } @@ -217,15 +217,15 @@ void PCMBlankKillerU24BE(void * buf, int channels, int frames) uint8_t * p = (uint8_t*)buf; uint8_t * e = p + 3 * frames * channels; int v = 0; - while (p < e) { v |= (((uint32_t)read32be(p) >> 8) - ZEROU24); p += 3; } + while (p < e) { v |= (((uint32_t)read_b32be(p) >> 8) - ZEROU24); p += 3; } if (v == 0) { p = (uint8_t*)buf; for (int c = 0; c < channels; ++c) - write32be(p + 3 * c, (int32_t)(ZEROU24 + (PCM_KILLER_LEVEL << 8)) << 8); + write_b32be(p + 3 * c, (int32_t)(ZEROU24 + (PCM_KILLER_LEVEL << 8)) << 8); for (int c = 0; c < channels; ++c) - write32be(p + 3 * (channels + c), (int32_t)(ZEROU24 - (PCM_KILLER_LEVEL << 8)) << 8); - write8(p + 3 * 2 * channels, (int8_t)((ZEROU24 & 0x00ff0000) >> 16)); + write_b32be(p + 3 * (channels + c), (int32_t)(ZEROU24 - (PCM_KILLER_LEVEL << 8)) << 8); + write_b8(p + 3 * 2 * channels, (int8_t)((ZEROU24 & 0x00ff0000) >> 16)); } } @@ -234,14 +234,14 @@ void PCMBlankKillerS32BE(void * buf, int channels, int frames) int32_t * p = (int32_t*)buf; int32_t * e = p + frames * channels; int v = 0; - while (p < e) { v |= (read32be(p++) - ZEROS); } + while (p < e) { v |= (read_b32be(p++) - ZEROS); } if (v == 0) { p = (int32_t*)buf; for (int c = 0; c < channels; ++c) { - write32be(p + c, (ZEROS + (PCM_KILLER_LEVEL << 16))); - write32be(p + channels + c, (ZEROS - (PCM_KILLER_LEVEL << 16))); + write_b32be(p + c, (ZEROS + (PCM_KILLER_LEVEL << 16))); + write_b32be(p + channels + c, (ZEROS - (PCM_KILLER_LEVEL << 16))); } } } @@ -251,14 +251,14 @@ void PCMBlankKillerU32BE(void * buf, int channels, int frames) uint32_t * p = (uint32_t*)buf; uint32_t * e = p + frames * channels; int v = 0; - while (p < e) { v |= ((uint32_t)read32be(p++) - ZEROU32); } + while (p < e) { v |= ((uint32_t)read_b32be(p++) - ZEROU32); } if (v == 0) { p = (uint32_t*)buf; for (int c = 0; c < channels; ++c) { - write32be(p + c, (int32_t)(ZEROU32 + (PCM_KILLER_LEVEL << 16))); - write32be(p + channels + c, (int32_t)(ZEROU32 - (PCM_KILLER_LEVEL << 16))); + write_b32be(p + c, (int32_t)(ZEROU32 + (PCM_KILLER_LEVEL << 16))); + write_b32be(p + channels + c, (int32_t)(ZEROU32 - (PCM_KILLER_LEVEL << 16))); } } }