Positional Audio

Jul 21, 2012 at 12:16 AM

Do you have a an easy to follow example code for positional sound effects/music? I see the sound library but I am not sure the best way to use it. Thanks!

Coordinator
Jul 21, 2012 at 12:37 AM
Edited Jul 21, 2012 at 12:37 AM

I don’t have examples right now. Moreover, the prototype that was made in the engine show me a few things that I have to improve about the audio but I couldn’t develop them yet.

You need to have at least one audio listener component attached into a game object (normally the game object that has the main camera). And you need to add an audio emitter component for each object that produces a sound.

You need to create also the sound assets. To avoid garbage (something important on XBOX) you can pre create an arbitrary number of sound effect instances or you can let the system to create the sound instance on demand (the system will try to reuse the instance if it is possible therefore it is possible to avoid garbage without the precreation of instances). Also, you can fire and forget the sound but it is not recommended.

Music is not managed with components; you need to access the music manager directly.

Hope it helps.

Jul 21, 2012 at 9:45 PM

How do you make sound in the demo, I did not hear anything. Also, I could not make anything happen but to rotate the car.

Aug 24, 2012 at 11:50 PM

On this line of code:
public override Component AddComponent<TComponentType>()

 

I am getting an error:

Error    5    '_3DgameTest.clsObject.AddComponent<TComponentType>()': no suitable method found to override    C:\Users\Jeff\Documents\Visual Studio 2010\Projects\3DgameTest\3DgameTest\3DgameTest\clsObject.cs    145    35    3DgameTest

Coordinator
Aug 25, 2012 at 8:26 AM

Hi!!

clsObject.cs? I don't have a class named clsObject.cs.

Coordinator
Aug 28, 2012 at 11:31 AM

Hi! Any luck?

Previous mail I was asking for a little context. What is exactly clsObject.cs?

For the record I don't have any problems with my Add Component method.

Bye!!