ㅇㅇ
gogyzzz@gmail.com
2017년 9월 7일 목요일
WaveManager: C/C++ buffer <-> PCM format wav file converter
WaveManager: C/C++ buffer <-> PCM format wav file converter === [Github repository](https://github.com/gogyzzz/cpp_butter_to_wave) ## Support buffer type short, float, double ## Support data struncture 1 dimension PCM buffer \[samplelength\] \(0ch, 1ch, 0ch, 1ch, ...\) (maximum 8channels) 2 dimension PCM buffer \[ichannel\]\[samplelength\] ## Examples ```cpp printf("************************ Test Save function ************************\n"); TYPE arr1dStatic[SAMPLESIZE]; for (int i = 0; i < SAMPLESIZE; i++) { arr1dStatic[i] = TYPE(sin(i)*0.95); } TYPE arr2dStatic[NCH][SAMPLESIZE]; for (int j = 0; j < NCH; j++) for (int i = 0; i < SAMPLESIZE; i++) { arr2dStatic[j][i] = TYPE(sin(i)*0.95); } TYPE* arr1dDyna = new TYPE[SAMPLESIZE]; for (int i = 0; i < SAMPLESIZE; i++) arr1dDyna[i] = TYPE(sin(i)*0.95); TYPE** arr2dDyna = new TYPE*[NCH]; for (int j = 0; j < NCH; j++) { arr2dDyna[j] = new TYPE[SAMPLESIZE]; for (int i = 0; i < SAMPLESIZE; i++) arr2dDyna[j][i] = TYPE(sin(i)*0.95); } wwrite("output_1d_static.wav", arr1dStatic, SAMPLESIZE); wwrite("output_2d_static.wav", arr2dStatic, SAMPLESIZE, 2); wwrite("output_1d_dynamic.wav", arr1dDyna, SAMPLESIZE); wwrite("output_2d_dynamic.wav", arr2dDyna, SAMPLESIZE, 2); printf("************************ Test Load function ************************\n"); TYPE input1dStatic[SAMPLESIZE]; int nblock = wread("output_1d_static.wav", input1dStatic); wwrite("output_1d_static_resave.wav", input1dStatic, nblock); TYPE input2dStatic[2][SAMPLESIZE]; nblock = wread("output_2d_static.wav", input2dStatic); wwrite("output_2d_static_resave.wav", input2dStatic, nblock, NCH); TYPE* input1dDyna; nblock = wread("output_1d_dynamic.wav", input1dDyna); wwrite("output_1d_dynamic_resave.wav", input1dDyna, nblock); TYPE** input2dDyna; nblock = wread("output_2d_dynamic.wav", input2dDyna); wwrite("output_2d_dynamic_resave.wav", input2dDyna, nblock, NCH); // ************************ caution ************************ // You should release memory after using pointer taken from wread. delete[] input1dDyna; for (int i = 0; i < NCH; i++) delete[] input2dDyna[i]; delete[] input2dDyna; ``` ## precautions - There are not enough safe codes. - Please do not expect "unguided" purpose.
댓글 없음:
댓글 쓰기
최근 게시물
이전 게시물
홈
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기