SDL_MIXER: how to get music position?

I am using SDL_Mixer to implement music in my project and one of the
requirements is the ability to pause a main tune, play another tune for
a while and then resume the original tune at the position it was left
off. Since there is no equivalent version of MIX_SetMusicPosition
(MIX_GetMusicPosition ?) I tried implementing my own version by keeping
track of playing time (taking into account pauses in music caused by
MIX_PauseMusic and MIX_ResumeMusic.

For some reason, the the time interval measured doesn’t always seem to
correspond to the position when set by MIX_SetMusicPosition and I was
unable to establish a pattern. The music is in OGG format so the
positioning should be occurring properly, that is, relative to the start
of the tune.

Has anyone experienced problems in this regard and perhaps knows of a
solution?
Regards,
Colin

P.S. I’d really like to see a MIX_GetMusicPosition function in SDL_Mixer!

Hi Colin

Forgive me for bothering you.

I have found your question posted in the SDL_Mixer forum

http://lists.libsdl.org/pipermail/sdl-libsdl.org/2005-July/050797.html

Actually I?m facing the same problem as you mention in it, did you resolve
it? Could you get the music positon using SDL_Mixer?–
oLi

Actually I?m facing the same problem as you mention in it, did you
resolve it? Could you get the music positon using SDL_Mixer?

You could use Mix_SetPostMix()…every time your callback fires, you
know how many more bytes of audio have been decoded from the music channel.

–ryan.

“Music position” can be difficult to define. For example, what’s the position
of a MOD music file that has a 7-second lead-in, then a loop that lasts for 33
seconds, and is currently 12 seconds into the fifth playthrough of the loop?________________________________
From: occhiluppo@gmail.com (Oli)
To: “sdl at lists.libsdl.org
Sent: Thu, June 2, 2011 5:21:19 AM
Subject: Re: [SDL] SDL_MIXER: how to get music position?

Hi Colin

Forgive me for bothering you.

I have found your question posted in the SDL_Mixer forum

http://lists.libsdl.org/pipermail/sdl-libsdl.org/2005-July/050797.html

Actually I?m facing the same problem as you mention in it, did you resolve it?
Could you get the music positon using SDL_Mixer?


oLi

17On Fri, Jun 3, 2011 at 3:46 PM, Mason Wheeler wrote:

“Music position” can be difficult to define. For example, what’s the
position of a MOD music file that has a 7-second lead-in, then a loop that
lasts for 33 seconds, and is currently 12 seconds into the fifth playthrough
of the loop?


From: Oli
To: “sdl at lists.libsdl.org
Sent: Thu, June 2, 2011 5:21:19 AM
Subject: Re: [SDL] SDL_MIXER: how to get music position?

Hi Colin

Forgive me for bothering you.

I have found your question posted in the SDL_Mixer forum

http://lists.libsdl.org/pipermail/sdl-libsdl.org/2005-July/050797.html

Actually I?m facing the same problem as you mention in it, did you resolve
it? Could you get the music positon using SDL_Mixer?


oLi


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

The number of milliseconds ellapsed since the beginning of playback?> ----- Original Message -----

From: Mason Wheeler [mailto:masonwheeler@yahoo.com]
Sent: Friday, June 3, 2011 04:46 PM
To: 'SDL Development List’
Subject: Re: [SDL] SDL_MIXER: how to get music position?

“Music position” can be difficult to define. For example, what’s the position of a MOD music file that has a 7-second lead-in, then a loop that lasts for 33 seconds, and is currently 12 seconds into the fifth playthrough of the loop?


From: occhiluppo@gmail.com (Oli)
To: “sdl at lists.libsdl.org
Sent: Thu, June 2, 2011 5:21:19 AM
Subject: Re: [SDL] SDL_MIXER: how to get music position?

Hi Colin

Forgive me for bothering you.

I have found your question posted in the SDL_Mixer forum

http://lists.libsdl.org/pipermail/sdl-libsdl.org/2005-July/050797.html

Actually I?m facing the same problem as you mention in it, did you resolve it? Could you get the music positon using SDL_Mixer?


oLi

I was just joking, Mason raises a good point. ;DOn Fri, Jun 3, 2011 at 3:50 PM, Patrick Baggett <@Patrick_Baggett>wrote:

17

On Fri, Jun 3, 2011 at 3:46 PM, Mason Wheeler wrote:

“Music position” can be difficult to define. For example, what’s the
position of a MOD music file that has a 7-second lead-in, then a loop that
lasts for 33 seconds, and is currently 12 seconds into the fifth playthrough
of the loop?


From: Oli
To: “sdl at lists.libsdl.org
Sent: Thu, June 2, 2011 5:21:19 AM
Subject: Re: [SDL] SDL_MIXER: how to get music position?

Hi Colin

Forgive me for bothering you.

I have found your question posted in the SDL_Mixer forum

http://lists.libsdl.org/pipermail/sdl-libsdl.org/2005-July/050797.html

Actually I?m facing the same problem as you mention in it, did you resolve
it? Could you get the music positon using SDL_Mixer?


oLi


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org