LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: tylee2135 on April 08, 2004, 07:16:00

Title: Playing 2 sound files simultaneously in OpenAL..
Post by: tylee2135 on April 08, 2004, 07:16:00
Hi guys..
Ive just got started on doing OpenAL and my question is abt playing 2 sound files simultaneously.. ive been trying out the openAL source files.. Ive tried creating 2 instances of the PlayTest class.. passing in 2 diff string names.. but the sounds don play at the same time even though both instances were successfully created.. Please advise! Thanks!
Title: Playing 2 sound files simultaneously in OpenAL..
Post by: spasi on April 08, 2004, 12:43:46
I haven't used OpenAL, but from what I've heard from our sound developer, you have to create a source (alSource) for each playing sound.
Title: Playing 2 sound files simultaneously in OpenAL..
Post by: Matzon on April 09, 2004, 18:28:03
yes, 1 source per buffer playing at any one time.
Title: Playing 2 sound files simultaneously in OpenAL..
Post by: tylee2135 on April 12, 2004, 05:38:34
Im enlightened!  :)  Thanks alot for the advice.. ill go work on it..
Anyway while doing openAL i got an error that says..

OpenAL error: Invalid Enum

What is it that im not doing properly?
Title: Playing 2 sound files simultaneously in OpenAL..
Post by: tylee2135 on April 12, 2004, 06:27:07
Anyway.. ive solved the Invalid Enum error.. seems that the error was brought abt because i used the statement

AL.alSourcef(sources.get(0), AL.AL_LOOPING, AL.AL_TRUE);
instead of
AL.alSourcei(sources.get(0), AL.AL_LOOPING, AL.AL_TRUE);

ANd ive also managed to successfully play multiple sounds simultaneously.. But just one more question.. is it possible to run 2 different classes together.. i thought of doing one to manage background music and one to manage sound... Can i still play the music and sound simultaneously or do they all have to be in one class altogether?
Thanks alot for all of your help! :)