![]() |
| [[ Home | Forums | 3D Engines Database | Wiki | Articles/Tutorials | Game Dev Jobs | IRC Chat Network | Contact Us ]] |
|
|
#1 |
|
New Member
Join Date: Oct 2005
Posts: 4
|
Hi, I'm new to using OpenAL, and I wanted to play just a simple sinewave. But I wanted to know if it's possible toplay multiple sounds at one time. Perhaps playing more than one buffer in one source, or playing multiple sources at the same time. Any help would be greatly appreciated. Thanks in advance
|
|
|
|
|
|
#2 |
|
Valued Member
Join Date: Jan 2004
Location: England
Posts: 265
|
You can only play one buffer on a single source. To play multiple sounds at the same time means using a single buffer (which contains the sample you wish to play), and assigning it to multiple sources.
It's pretty simple to do, and the articles here on DevMaster should easily show you how to do it. Spree |
|
|
|
|
|
#3 |
|
New Member
Join Date: Oct 2005
Posts: 4
|
By playing the same buffer with multiple sources? Wouldn't that just play the same sound on top of each other? I want to play different frequencies using the alutCreateBufferWaveform function.
|
|
|
|
|
|
#4 |
|
Valued Member
Join Date: Jan 2004
Location: England
Posts: 265
|
No, this is not the case. When the source is playing a buffer, it will read the buffer, then alter it according to the properties set via the source, not the buffer.
So for example, if you have explosion.wav which has been loaded via alut. That buffer is now loaded, and unless you want to do any sound pre-processing, doesn't need to be altered in any way. Now, if you want to play 4 explosions, all with slightly different frequences to make it more varied, you play the same buffer on 4 different sources. If you want to change the frequency, you change the frequency of the source and not the buffer. This will give you four sounds, played seperatly, with varying frequences (and volumes etc.), all played off one buffer. It would only play the same sound on top of each other if you played the same sample, with no variation, at the exact same time in the program. And yes, that would sound crap. If you need more information, have a look at this tutorial... http://www.devmaster.net/articles/op...ls/lesson5.php Spree |
|
|
|
|
|
#5 |
|
New Member
Join Date: Oct 2005
Posts: 4
|
I get what you're trying to say, but just last night, I tried this and it worked. I had created 5 buffers and 5 sources. Loaded each buffer to its seperate source and played all sources. It did the job. Is it much different from what you're saying.
|
|
|
|
|
|
#6 |
|
Valued Member
Join Date: Jan 2004
Location: England
Posts: 265
|
You can do it that way if you want, but it is a total waste of memory, as your using 5x more than what you need.
Also, what happens when you think you need 3 explosions, but then another one happens? Are you going to load the sample again? It will work, but it is a very wasteful, slow and bloated way of doing things. Spree |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|