Can anyone help Ben, with this SDL_Mixer question…
— Orginal Message —
I’m having problems with playing a lot of sounds at once, as I seem
to have access to only 8 channels (0…7).
I copied some sound playing methods from an existing example that
came with the SDL toolkit (Aliens) and so far I haven’t found any
good material on how to build a proper sound engine with it (which
is why I’m asking my question here ).
So for anyone who has some experience with this, here’s my method.
Please tell me if this is the right way or not.
some GLOBAL/BRIEF code
I initialise thus…
(SDL_Init(SDL_INIT_AUDIO);
(Mix_OpenAudio(44100, AUDIO_U16, 2, 2048);
the playsound function has the following code…
playSound( char * soundPath );
Mix_FreeChunk( aPMix_Chunk )
aPMix_Chunk = Mix_LoadWAV( soundPath );
Mix_PlayChannel( aChannel, aPMix_Chunk, 0 );
And I shut down bu calling…
Mix_CloseAudio();
<<<<<<<
*** -> here I use the channel that is 1 lower than the last used
channel (if not < 0, else channel becomes 7).
This is very globally the idea I use in my implementation.
Can anyone help me out with this? I mean to use more than 8 sounds
at a time and I’m stuck with it.
Can anyone help Ben, with this SDL_Mixer question…
[…]
Can anyone help me out with this? I mean to use more than 8 sounds
at a time and I’m stuck with it.
I don’t have any experience with SDL_mixer, looking at the code, it seems
like Mix_AllocateChannels() is what you’re looking for.
//David Olofson — Programmer, Reologica Instruments AB
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia | ----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Tuesday 17 September 2002 10:31, Dominique Louis wrote:
I’m having problems with playing a lot of sounds at once, as I seem
to have access to only 8 channels (0…7).
/* Dynamically change the number of channels managed by the mixer.
If decreasing the number of channels, the upper channels are
stopped.
This function returns the new number of allocated channels.
*/
extern DECLSPEC int SDLCALL Mix_AllocateChannels(int numchans);
Ryan C. Gordon wrote:>>I’m having problems with playing a lot of sounds at once, as I seem
to have access to only 8 channels (0…7).
/* Dynamically change the number of channels managed by the mixer.
If decreasing the number of channels, the upper channels are
stopped.
This function returns the new number of allocated channels.
*/
extern DECLSPEC int SDLCALL Mix_AllocateChannels(int numchans);