Changing music tracks in SDL_Mixer

I’m trying to use SDL_Mixer to handle audio in a game I’m writing. SFX work
fine, but unfortunately, it’s being quite ornery on the subject of
soundtrack management. I can’t get it to switch tracks. I load various
songs into an array during initialization with Mix_LoadMUS, and the first
one I play works just fine. But after that, if I try to switch tracks, no
other song will play. I call Mix_HaltMusic, then Mix_PlayMusic with the
other song’s pointer, then Mix_HookMusicFinished. No music actually plays,
but after the appropriate amount of time, the callback routine does get
called, as if it had been playing silently all along. After this, I’m able
to play the original song again with no trouble, but switching to other
songs just doesn’t work.

Does anyone know what the step is I’m missing? Such an all-around
well-designed library simply can’t have fallen flat on its face on this
one crucial feature, so I must be missing a step somewhere. Can anyone tell
me what it is?

Mason–
View this message in context: http://www.nabble.com/Changing-music-tracks-in-SDL_Mixer-tf4704537.html#a13447451
Sent from the SDL mailing list archive at Nabble.com.

Hi,

I would be helpful to us if you stated what music file format you are
using…

I personally like the “.MOD" music format, but last I checked it was
not 100% in SDL_Mixer.
I am currently using Ogg Vorbis "
.OGG” music file format which is
similar to MP3.

Jesse "JeZ+Lee"
Silent Hero Productions®
Video Game Design Studio
http://www.SilentHeroProductions.com

masonwheeler wrote:> I’m trying to use SDL_Mixer to handle audio in a game I’m writing. SFX work

fine, but unfortunately, it’s being quite ornery on the subject of
soundtrack management. I can’t get it to switch tracks. I load various
songs into an array during initialization with Mix_LoadMUS, and the first
one I play works just fine. But after that, if I try to switch tracks, no
other song will play. I call Mix_HaltMusic, then Mix_PlayMusic with the
other song’s pointer, then Mix_HookMusicFinished. No music actually plays,
but after the appropriate amount of time, the callback routine does get
called, as if it had been playing silently all along. After this, I’m able
to play the original song again with no trouble, but switching to other
songs just doesn’t work.

Does anyone know what the step is I’m missing? Such an all-around
well-designed library simply can’t have fallen flat on its face on this
one crucial feature, so I must be missing a step somewhere. Can anyone tell
me what it is?

Mason

Oh, all right. I’d heard that file format and other technical details don’t
matter with SDL because it takes care of all that stuff for you, but the
songs are all in MIDI format, and I’m running under Windows XP.

Mason

Jesse P. wrote:>

Hi,

I would be helpful to us if you stated what music file format you are
using…

I personally like the “.MOD" music format, but last I checked it was
not 100% in SDL_Mixer.
I am currently using Ogg Vorbis "
.OGG” music file format which is
similar to MP3.

Jesse "JeZ+Lee"
Silent Hero Productions®
Video Game Design Studio
http://www.SilentHeroProductions.com


View this message in context: http://www.nabble.com/Changing-music-tracks-in-SDL_Mixer-tf4704537.html#a13447696
Sent from the SDL mailing list archive at Nabble.com.

Keep in mind that SDL is typically acting as an abstraction layer for OS
APIs or other libraries, so it could be whatever MIDI stuff SDL_Mixer is
using is falling flat on its face.

Out of curiosity, have you thrown MP3, Ogg Vorbis or MOD files at it, to
see if it fails in the same way?

-bill!
(and I think that’s all I can offer as help for this problem :wink: )On Sat, Oct 27, 2007 at 02:38:44PM -0700, masonwheeler wrote:

Oh, all right. I’d heard that file format and other technical details don’t
matter with SDL because it takes care of all that stuff for you, but the
songs are all in MIDI format, and I’m running under Windows XP.

You might consider looking up RW_ops to store your files in memory and load them
from memory instead of loading them all in with Mix_LoadMus.

Sam Crow <samuraileumas yahoo.com> writes:

You might consider looking up RW_ops to store your files in memory and load
them from memory instead of loading them all in with Mix_LoadMus.

Never mind, RW_ops only works with samples.