[SDL] Some sounds not played by SDL_mixer, but channels not exhausted

Atrix Wolfe atrix2 at cox.net
Thu Jan 9 23:28:01 PST 2003


i know almost nothing about sound programming but a stab in the dark would
be that your hardware or sound driver only supports channels 0 and 1.  This
is a random guess and i appologize in advance for this question but does
channel 0 sound come out of the left speaker and channel 1 comes out of the
right?  No one else seems to be responding so i figure id throw something
out there.  Hope it helps.

----- Original Message -----
From: "Pierre Sarrazin" <sarrazip at sympatico.ca>
To: <sdl at libsdl.org>
Sent: Thursday, January 09, 2003 11:03 PM
Subject: Re: [SDL] Some sounds not played by SDL_mixer, but channels not
exhausted


> Dixit Pierre Sarrazin <sarrazip at sympatico dot ca> (2003-01-08 20:15):
> > A video game I am developing uses SDL_mixer (2.2.4) to produce sound
> > effects and sometimes, some sounds are not heard, even though there
> > are more than enough channels.
> >
> > The program calls this statement:
> >
> >     Mix_PlayChannel(-1, sample, 0)
> [...]
> > Yet it seems like whenever a sound needs to play on channel 2
> > (because 0 and 1 are already playing a sound), the problem occurs.
>
> I inserted trace code in the sources of SDL_mixer 1.2.4
> (mix_channels() in mixer.c) and saw that channel 2 always has a
> volume of 1 (instead of MIX_MAX_VOLUME (128)), while channels 0
> and 1 have a volume of MIX_MAX_VOLUME as expected.
>
> At first glance, I seem to have solved my problem with this patch
> to make sure that sounds played on channel 2 are heard:
>
>     int channelNo = Mix_PlayChannel(-1, sample, 0);
>     if (channelNo == -1)
> throw ...;
>     Mix_Volume(channelNo, MIX_MAX_VOLUME);
>
> I tried calling Mix_Volume() only once (for each allocated channel)
> after initializing the audio system, but that did not work.  It seems
> like something is constantly resetting the volume of channel 2 to 1.
>
> Does anyone understand where this situation could come from?
>
> --
> Pierre Sarrazin <sarrazip at sympatico dot ca>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>





More information about the SDL mailing list