Browse Source

Fix + Return if attempting to seek on a module format (#2008)

Uneven Prankster 3 years ago
parent
commit
7fa521fae4
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/raudio.c

+ 4 - 0
src/raudio.c

@@ -1659,6 +1659,9 @@ void StopMusicStream(Music music)
 // Seek music to a certain position (in seconds)
 // Seek music to a certain position (in seconds)
 void SeekMusicStream(Music music, float position)
 void SeekMusicStream(Music music, float position)
 {
 {
+    // Seeking is not supported in module formats
+    if(music.ctxType == MUSIC_MODULE_XM || music.ctxType == MUSIC_MODULE_MOD) return;
+
     unsigned int positionInFrames = (unsigned int)(position * music.stream.sampleRate);
     unsigned int positionInFrames = (unsigned int)(position * music.stream.sampleRate);
     switch (music.ctxType)
     switch (music.ctxType)
     {
     {
@@ -1676,6 +1679,7 @@ void SeekMusicStream(Music music, float position)
 #endif
 #endif
         default: break;
         default: break;
     }
     }
+    music.stream.buffer->framesProcessed = positionInFrames;
 }
 }
 
 
 // Update (re-fill) music buffers if data already processed
 // Update (re-fill) music buffers if data already processed