Possible SDL_mixer bug

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.

Cheers_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail

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

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

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

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: polymorphic_messiah@hotmail.com (P. M.)
To:
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
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

yeah, it was just some code fired up on the spot to indicate the problem. I
thought I dynamically allocated some mem for that timer but obvioulsy i
missed it since i received no SDL_PARACHUTE or any other errors :slight_smile: Neways
the problem on my linux box still stands with every channel between 0-4
being played except channel 2.

Cheers>From: “John Popplewell”

Reply-To: sdl at libsdl.org
To:
Subject: Re: [SDL] Possible SDL_mixer bug
Date: Fri, 24 Jan 2003 14:24:47 -0000

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.” <@P_M>
To:
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
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


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963