#include using namespace std; int main() { // 24 Bit data, // 3 bytes left channel, 1 byte empty // After that 3 bytes right channel, 1 byte empty // 300 values left channe + 100 empty bytes // 300 values right channel + 100 empty bytes uint8_t inputData2Channels[800] = { 29,81,231,0, 86,34,173,0, 181,232,203,0, 164,219,204,0, 173,191,176,0, 232,43,178,0, 6,153,159,0, 178,80,161,0, 160,23,183,0, 203,103,184,0, 60,30,206,0, 30,5,207,0, 214,15,229,0, 123,141,229,0, 194,156,253,0, 71,163,253,0, 196,130,24,0, 15,13,24,0, 245,6,52,0, 142,15,51,0, 125,66,79,0, 27,206,77,0, 142,118,96,0, 168,176,94,0, 12,253,72,0, 10,172,71,0, 202,214,49,0, 85,245,48,0, 221,235,26,0, 75,117,26,0, 235,42,2,0, 90,38,2,0, 169,74,231,0, 216,196,231,0, 243,179,203,0, 236,170,204,0, 248,142,176,0, 196,251,177,0, 115,120,159,0, 39,49,161,0, 53,13,183,0, 111,91,184,0, 26,58,206,0, 140,32,207,0, 155,70,229,0, 153,194,229,0, 213,237,253,0, 164,244,253,0, 173,168,24,0, 81,51,24,0, 240,4,52,0, 217,14,51,0, 1,32,79,0, 160,172,77,0, 59,62,96,0, 14,121,94,0, 7,201,72,0, 45,119,71,0, 103,182,49,0, 45,212,48,0, 88,233,26,0, 112,112,26,0, 159,50,2,0, 80,47,2,0, 79,138,231,0, 17,3,232,0, 255,1,204,0, 106,245,204,0, 89,201,176,0, 136,55,178,0, 66,130,159,0, 169,58,161,0, 17,243,182,0, 208,64,184,0, 124,1,206,0, 148,230,206,0, 109,252,228,0, 25,117,229,0, 216,198,253,0, 36,206,253,0, 224,161,24,0, 138,44,24,0, 148,36,52,0, 82,47,51,0, 99,92,79,0, 81,228,77,0, 28,128,96,0, 182,188,94,0, 8,236,72,0, 77,153,71,0, 226,200,49,0, 237,229,48,0, 145,206,26,0, 151,89,26,0, 163,31,2,0, 25,30,2,0, 125,82,231,0, 126,203,231,0, 251,209,203,0, 21,198,204,0, 139,133,0,8, 144,28,8,0, 139,133,0,8, 32,28,8,0, 0,0,0,0, 0,0,0,0, 4,1,0,0, 3,0,0,0, 64,0,0,0, 4,0,0,0, 197,126,0,8, 8,26,8,0, 0,0,0,0, 16,19,8,0, 40,3,0,0, 0,0,0,0, 2,0,0,0, 4,0,0,0, 96,25,8,0, 0,0,0,0, 0,0,0,0, 16,19,8,0, 40,3,0,0, 3,1,0,0, 16,19,8,0, 40,3,0,0, 80,11,8,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,54,110,1, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,112,16,64, 208,25,8,0, 3,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, }; uint8_t inputDataLeftChannel[300] = {0}; uint8_t inputDataRightChannel[300] = {0}; int index = 0; int offset = 0; // 3 bytes left channel, 1 byte empty // After that 3 bytes right channel, 1 byte empty for(int i=0; i<300; i++) { inputDataLeftChannel[i] = inputData2Channels[i+offset]; inputDataRightChannel[i] = inputData2Channels[i+offset+4]; index = index + 1; if(index >= 3) { offset = offset + 5; index = 0; } // cout << unsigned(inputDataLeftChannel[i]) << endl; // cout << unsigned(inputDataRightChannel[i]) << endl; } int32_t inputData32_Left[100] = {0}; int32_t inputData32_Right[100] = {0}; index = 0; for(int i=0; i<100; i++) { // 3 bytes per sample inputData32_Left[i] = (int32_t) (inputDataLeftChannel[index]|inputDataLeftChannel[index+1]<<16|inputDataLeftChannel[index+2]<<24); inputData32_Right[i] = (int32_t) (inputDataRightChannel[index]|inputDataRightChannel[index+1]<<16|inputDataRightChannel[index+2]<<24); index = index + 3; // cout << inputData32_Left[i] << endl; cout << inputData32_Right[i] << endl; } return 0; }