diff --git a/CMakeLists.txt b/CMakeLists.txt index e5273bf..b77b23d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,7 @@ add_library( ${enc_dic}/ldaclib.c ) +target_link_libraries(ldac_enc_lib m) add_executable(ldac_encoder ldac_enc_test.c) add_executable(ldac_decoder ldac_dec_test.c) @@ -57,5 +58,5 @@ add_executable(auto_test auto_test.c) target_link_libraries(ldac_encoder ldac_enc_lib) -target_link_libraries(ldac_decoder ldac_dec_lib) +target_link_libraries(ldac_decoder ldac_dec_lib m) endif() diff --git a/auto_test.c b/auto_test.c index fc41a09..8da52fa 100644 --- a/auto_test.c +++ b/auto_test.c @@ -2,6 +2,10 @@ #include #include #include +#ifdef __linux__ +#include +#endif + int main() { diff --git a/ldac_dec_test.c b/ldac_dec_test.c index a0c9a4a..5ca39af 100644 --- a/ldac_dec_test.c +++ b/ldac_dec_test.c @@ -103,7 +103,7 @@ typedef char ID[4]; typedef union { struct { ID groupID; - long size; + uint32_t size; ID riffType; }; uint8_t data[0xc]; @@ -112,8 +112,8 @@ typedef union { typedef union { struct { ID chunkID; - long chunkSize; - short wFormatTag; + uint32_t chunkSize; + uint16_t wFormatTag; uint16_t wChannels; uint32_t dwSamplesPerSec; uint32_t dwAvgBytesPerSec; @@ -127,7 +127,7 @@ typedef union { typedef union { struct { ID chunkID; - long chunkSize; + uint32_t chunkSize; }; uint8_t data[8]; } DATACHUNK; @@ -254,9 +254,9 @@ int main(int argc, char *argv[]) { #if __WIN32 unsigned __int64 t0 = *( unsigned __int64 *)(0x7FFE0000 + 0x8); // like QueryUnbiasedInterruptTime + __int64 npack = 0; #endif - __int64 npack = 0; while ((streamSize - used_Stream_count) > streamUsed) { @@ -265,7 +265,9 @@ int main(int argc, char *argv[]) { frame_size, &streamUsed, &out_pcm_szie); out_pcm_count += out_pcm_szie; used_Stream_count += streamUsed; +#if __WIN32 npack += 1; +#endif } if (result != 0) { printf("%s\r\n",get_error_code_string(ldacBT_get_error_code(ldacBT_dec_handle))); diff --git a/ldac_enc_test.c b/ldac_enc_test.c index df6ef78..a189cb6 100644 --- a/ldac_enc_test.c +++ b/ldac_enc_test.c @@ -103,7 +103,7 @@ typedef char ID[4]; typedef union { struct { ID groupID; - long size; + uint32_t size; ID riffType; }; uint8_t data[0xc]; @@ -112,8 +112,8 @@ typedef union { typedef union { struct { ID chunkID; - long chunkSize; - short wFormatTag; + uint32_t chunkSize; + uint16_t wFormatTag; uint16_t wChannels; uint32_t dwSamplesPerSec; uint32_t dwAvgBytesPerSec; @@ -126,7 +126,7 @@ typedef union { typedef union { struct { ID chunkID; - long chunkSize; + uint32_t chunkSize; }; uint8_t data[8]; } DATACHUNK; @@ -255,15 +255,17 @@ int main(int argc, char *argv[]) { #if __WIN32 unsigned __int64 t0 = *( unsigned __int64 *)(0x7FFE0000 + 0x8); // like QueryUnbiasedInterruptTime -#endif __int64 npack = 0; +#endif while ((input_pcm_size - pcmUsedcount) >= pcmUsed) { result |= ldacBT_encode(ldacBT_enc_handle, input_pcm + pcmUsedcount, &pcmUsed, pStream + streamoutputcount, &streamSize, &frameNum); pcmUsedcount += pcmUsed; streamoutputcount += streamSize; +#if __WIN32 npack += 1; +#endif } // ldacBT_encode(ldacBT_enc_handle, input_pcm + 44 + pcmUsed, &pcmUsed, // pStream, &streamSize, &frameNum);