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:
parent
f879c54f8e
commit
1be0977330
1 changed files with 7 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue