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.