[SDL] Possible SDL_mixer bug

John Popplewell john at johnnypops.demon.co.uk
Fri Jan 24 06:25:01 PST 2003


Hi,

Testing on Win98. OK apart from the SDL_PARACHUTE!
These lines are wrong:

    SDL_TimerID *id;
    ...
    *id = SDL_AddTimer(300, timer_callback, chunk); /* writes where? */

should be:

    SDL_TimerID id;
    ...
    id = SDL_AddTimer(300, timer_callback, chunk);

It played audio on channels 0-4, but the code is a bit strange.
This is just a test program, right?

cheers,
John.


----- Original Message -----
From: "P. M." <polymorphic_messiah at hotmail.com>
To: <sdl at libsdl.org>
Sent: Thursday, January 23, 2003 8:56 AM
Subject: Re: [SDL] Possible SDL_mixer bug


> This simple test case allocates 5 channels for playing.  As i stated
> earlier, every channel between the allocated channel boundaries, in this
> case 0-4, plays the wav sample fine except channel 2.
>
> #include <iostream.h>
> #include <SDL.h>
> #include <SDL_mixer.h>
> #include <stdlib.h>
>
> Uint32 timer_callback(Uint32 interval, void *p)
> {
>   Mix_Chunk *chnk_obj = (Mix_Chunk *) p;
>
>   cout << "Num of allocated channels is : " << Mix_AllocateChannels(-1) <<
> endl;
>   if(Mix_PlayChannel(3,chnk_obj,0) == -1) //channel 2 dont work
>      cout << "ERROR: Couldnt play wav" << endl;
>   return interval;
> }
>
> int main(int argc, char **argv)
> {
>   Mix_Chunk *chunk;
>   SDL_TimerID *id;
>
>   if(SDL_Init(SDL_INIT_AUDIO | SDL_INIT_TIMER) == -1) {
>     cout << "ERROR: Couldnt initialize sub-systems" << endl;
>     exit(-1);
>   }
>   cout << "Sub-systems intialized successfully....." << endl;
>
>   int freq = 44100;
>   Uint16 fmt = AUDIO_S16;
>   int channels = 2;
>   int chnk_size = 1024;
>
>   if(Mix_OpenAudio(freq, fmt, channels, chnk_size)) {
>     cout << "ERROR: Unable to open audio device" << endl;
>     exit(-1);
>   }
>   cout << "Audio device opened succesfully......" << endl;
>
>   Mix_AllocateChannels(5); //using 5 independent channels for testing
> purposes
>   if((chunk = Mix_LoadWAV("beep.wav")) == NULL) {
>     cout << "ERROR: Couldnt load wav" << endl;
>     exit(-1);
>   }
>
>   cout << "Playing wav file........."  << endl;
>   *id = SDL_AddTimer(300, timer_callback, chunk);
>   SDL_Delay(3 * 1000);
>
>   return 0;
> }
>
> >From: Sam Lantinga <slouken at devolution.com>
> >Reply-To: sdl at libsdl.org
> >To: sdl at libsdl.org
> >Subject: Re: [SDL] Possible SDL_mixer bug
> >Date: Wed, 22 Jan 2003 22:09:09 -0800
> >
> > > Im not certain whether this is a bug or my mistake.
> > > Im using Mix_AllocateChannels(8) to obviously produce 8 independent
> > > channels.
> > > When i play a wav sample via channel 2 using
Mix_PlayChannel(2,sample,0)
> >i
> > > get no sound.  When i play the sample via any other channel ie
> >0,1,3,4,5,6,7
> > > i hear the sample.  Any help would be appreciated.
> >
> >Can you put together a simple complete test case, and post it to the
list?
> >
> >Thanks,
> > -Sam Lantinga, Software Engineer, Blizzard Entertainment
> >
> >_______________________________________________
> >SDL mailing list
> >SDL at libsdl.org
> >http://www.libsdl.org/mailman/listinfo/sdl
>
>
> _________________________________________________________________
> Tired of spam? Get advanced junk mail protection with MSN 8.
> http://join.msn.com/?page=features/junkmail
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl





More information about the SDL mailing list