add docs about 3D audio
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
18c02a5173
commit
d66c492229
|
@ -46,3 +46,25 @@ jumpSoundEffectInstance.Pitch = -0.25f;
|
|||
jumpSoundEffectInstance.Pan = -0.5f;
|
||||
jumpSoundEffectInstance.Play();
|
||||
```
|
||||
|
||||
### 3D Audio
|
||||
|
||||
MoonWorks has support for 3-dimensional audio.
|
||||
To use it, you must create an AudioListener, and any sounds that are emitted in 3-dimensional space should use an AudioEmitter.
|
||||
Emitters and listeners use position, orientation, and velocity to determine audio playback.
|
||||
Then you can call `Apply3D` on a sound effect instance and provide the emitter and listener.
|
||||
|
||||
```cs
|
||||
var audioEmitter = new AudioEmitter(AudioDevice);
|
||||
var audioListener = new AudioListener(AudioDevice);
|
||||
|
||||
audioEmitter.Position = thingPosition;
|
||||
audioEmitter.Forward = thingForward;
|
||||
audioEmitter.Up = thingUp;
|
||||
|
||||
audioListener.Position = cameraPosition;
|
||||
audioListener.Forward = cameraForward;
|
||||
audioListener.Up = cameraUp;
|
||||
|
||||
thingSound.Apply3D(audioListener, audioEmitter);
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue