2

I was wondering if there is a functionality in the SDL_Mixer lib to skip to a certain position in a wav file. I've found out the there is a function called Mix_SetMusicPosition but it won't work with .wav files and it won't let you choose a channel. Any suggestions would be greatly appreciated.

EDIT: I figured out how to do it. Instead of calling an additional function I just changed the start pointer of the abuf variable located in Mix_Chunk structure. I calculated how many bytes are in a second in a 16 bit .wav file playing at 44khz and changed the starting pointer of abuf with that number times how many seconds I want to skip. And then changed the length of alen, also a variable located in the Mix_Chunk struct, with the same number of bytes.

Leon_020
  • 21
  • 3

1 Answers1

1

I just read the docs for SDL Music and apparently Mix_SetMusicPosition only supports OGG, MP3 and MOD files.

Link: http://jcatki.no-ip.org:8080/SDL_mixer/SDL_mixer_65.html#SEC65

Obvious solution; convert your wav. files to your favorite previously mentioned file format.

  • Yeah I found that function too, but since I'm working with channels and `Mix_SetMusicPosition` doesn't support that I was wondering if there was another function somewhere hidden. Thanks for the effort though! – Leon_020 Feb 05 '13 at 21:33