summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorveins1 <[email protected]>2023-10-31 19:48:24 +0500
committerGitHub <[email protected]>2023-10-31 15:48:24 +0100
commit68420127485990746eab874a4f9d7b08e5acfd13 (patch)
tree115f4b1faee9b4e03d3a05dc5195122c931d129d /src
parent0d186a0557a3c74d34ddce1daa7a66ae0fc1e699 (diff)
downloadraylib-68420127485990746eab874a4f9d7b08e5acfd13.tar.gz
raylib-68420127485990746eab874a4f9d7b08e5acfd13.zip
Fix QOA seeking (#3494)
Diffstat (limited to 'src')
-rw-r--r--src/raudio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/raudio.c b/src/raudio.c
index dcc9f706..47667604 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;