From 68420127485990746eab874a4f9d7b08e5acfd13 Mon Sep 17 00:00:00 2001 From: veins1 <19636663+veins1@users.noreply.github.com> Date: Tue, 31 Oct 2023 19:48:24 +0500 Subject: [PATCH] Fix QOA seeking (#3494) --- src/raudio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/raudio.c b/src/raudio.c index dcc9f706a..476676049 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -1797,7 +1797,9 @@ void SeekMusicStream(Music music, float position) case MUSIC_AUDIO_MP3: drmp3_seek_to_pcm_frame((drmp3 *)music.ctxData, positionInFrames); break; #endif #if defined(SUPPORT_FILEFORMAT_QOA) - case MUSIC_AUDIO_QOA: qoaplay_seek_frame((qoaplay_desc *)music.ctxData, positionInFrames); break; + //qoaplay_seek_frame seeks to QOA frame, not PCM frame, therefore we need to compute QOA frame number and change positionInFrames + case MUSIC_AUDIO_QOA: { int qoaFrame = positionInFrames/QOA_FRAME_LEN; qoaplay_seek_frame((qoaplay_desc*)music.ctxData, qoaFrame); + positionInFrames = ((qoaplay_desc*)music.ctxData)->sample_position; break; } #endif #if defined(SUPPORT_FILEFORMAT_FLAC) case MUSIC_AUDIO_FLAC: drflac_seek_to_pcm_frame((drflac *)music.ctxData, positionInFrames); break;