1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-23 00:05:17 +03:00

Fix for #197 (non audio chunks > 256 bytes)

This commit is contained in:
Bertrand Songis 2013-12-27 10:33:45 +01:00
parent f879c54f8e
commit 1be0977330

View file

@ -380,10 +380,13 @@ int AudioQueue::mixWav(AudioContext &context, AudioBuffer *buffer, int volume, u
result = FR_DENIED;
}
while (result == FR_OK && memcmp(wavSamplesPtr, "data", 4) != 0) {
result = (size < 256 ? f_read(&context.state.wav.file, wavBuffer, size+8, &read) : FR_DENIED);
if (read != size+8) result = FR_DENIED;
wavSamplesPtr = (uint32_t *)(wavBuffer + size);
size = wavSamplesPtr[1];
result = f_lseek(&context.state.wav.file, f_tell(&context.state.wav.file)+size);
if (result == FR_OK) {
result = f_read(&context.state.wav.file, wavBuffer, 8, &read);
if (read != 8) result = FR_DENIED;
wavSamplesPtr = (uint32_t *)wavBuffer;
size = wavSamplesPtr[1];
}
}
context.state.wav.size = size;
}