SiliconStudio / xenko

Old repo for Xenko Game Engine. Please use https://github.com/xenko3d/xenko instead.
http://xenko.com
1.54k stars 345 forks source link

Sounds in 3D #438

Open EmptyKeys opened 8 years ago

EmptyKeys commented 8 years ago

Looks like there are few issues with audio. I added Audio Listener Component to Camera. I added Audio Emitter Component to entity, attached sounds. I can play sound with AudioEmitterSoundController, but I think it's totally ignoring IsLooped.

On top of that I don't hear sounds localized in 3D. Something is wrong. :)

sinkingsugar commented 8 years ago

Working all fine here. Could you give us more details? (Platform, OS version) Btw next release will change many things on the workflow. For now I created a SimpleAudio sample and added the following lines in the SoundScript:

var emitter = Entity.Get<AudioEmitterComponent>();
emitter.AttachSound(SoundEffect);
var controller = emitter.GetSoundController(SoundEffect);
controller.Pitch = 2.0f;
controller.Volume = 1.5f;
controller.IsLooped = true;
controller.Play();

EDIT: Also make sure your Sound asset is marked as Spatialized.

EmptyKeys commented 8 years ago

I see. I created simple test - http://emptykeys.com/uploads/SoundTest.zip

3D sound is working fine. Think the issue is that if you are really far from emitter, you can still hear it from middle speaker. Think there should be some maximum distance. I can do that in my script for now tho.

IsLooping set to false is not working for me. Sound is still looping.

sinkingsugar commented 8 years ago

Cool, thanks! The IsLooping thing is indeed a bug :) thanks for the report!

sinkingsugar commented 7 years ago

IsLooping issue should be fixed btw.