forked from MrBesen/soundboard
fixed audio file max length playback
This commit is contained in:
parent
b9c1f7c463
commit
c8220e2b8d
|
@ -60,7 +60,7 @@ void SoundDevice::sound_callback(void* outbuffer, ma_uint32 frameCount) {
|
|||
|
||||
// if a end frame is set, make sure to not read over it
|
||||
ma_uint32 shouldReadCount = frameCount;
|
||||
if(pb->currentFrame + frameCount > pb->endFrame) {
|
||||
if((pb->currentFrame + frameCount) > pb->endFrame) {
|
||||
shouldReadCount = pb->endFrame - pb->currentFrame;
|
||||
}
|
||||
|
||||
|
@ -70,10 +70,12 @@ void SoundDevice::sound_callback(void* outbuffer, ma_uint32 frameCount) {
|
|||
read = readDecoderandAdd(pDecoder, volume, streamDivider, shouldReadCount, outbuffer);
|
||||
|
||||
//decoder fertig -> nicht mehr verwenden
|
||||
if (read < shouldReadCount) {
|
||||
if (read < frameCount) {
|
||||
pb->isDone = true;
|
||||
--data.decoderCount;
|
||||
}
|
||||
|
||||
pb->currentFrame += read;
|
||||
}
|
||||
|
||||
ma_mutex_unlock(data.mutex);
|
||||
|
|
Loading…
Reference in New Issue