DevMaster.net Forums
[[ Home | Forums | 3D Engines Database | Wiki | Articles/Tutorials | Game Dev Jobs | IRC Chat Network | Contact Us ]]

Go Back   DevMaster.net Forums > Programming & Development > Sound and Music Programming
User Name
Password
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
Old 11-01-2005, 02:32 PM   #1
jeeva86
New Member
 
Join Date: Oct 2005
Posts: 4
Default Playing Multiple Sounds

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
jeeva86 is offline   Reply With Quote
Old 11-01-2005, 04:14 PM   #2
SpreeTree
Valued Member
 
SpreeTree's Avatar
 
Join Date: Jan 2004
Location: England
Posts: 265
Default Re: Playing Multiple Sounds

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
SpreeTree is offline   Reply With Quote
Old 11-02-2005, 08:01 PM   #3
jeeva86
New Member
 
Join Date: Oct 2005
Posts: 4
Default Re: Playing Multiple Sounds

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.
jeeva86 is offline   Reply With Quote
Old 11-03-2005, 02:41 AM   #4
SpreeTree
Valued Member
 
SpreeTree's Avatar
 
Join Date: Jan 2004
Location: England
Posts: 265
Default Re: Playing Multiple Sounds

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
SpreeTree is offline   Reply With Quote
Old 11-03-2005, 05:50 AM   #5
jeeva86
New Member
 
Join Date: Oct 2005
Posts: 4
Default Re: Playing Multiple Sounds

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.
jeeva86 is offline   Reply With Quote
Old 11-03-2005, 06:23 AM   #6
SpreeTree
Valued Member
 
SpreeTree's Avatar
 
Join Date: Jan 2004
Location: England
Posts: 265
Default Re: Playing Multiple Sounds

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
SpreeTree is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Forum Jump


All times are GMT -7. The time now is 08:11 AM.


Powered by vBulletin
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.