diff --git a/src/Audio/AudioDevice.cs b/src/Audio/AudioDevice.cs index 5f00e198..64699551 100644 --- a/src/Audio/AudioDevice.cs +++ b/src/Audio/AudioDevice.cs @@ -224,6 +224,11 @@ namespace MoonWorks.Audio } } + public void SyncPlay() + { + FAudio.FAudio_CommitChanges(Handle, 1); + } + internal void AddDynamicSoundInstance(StreamingSound instance) { streamingSounds.Add(new WeakReference(instance)); diff --git a/src/Audio/SoundInstance.cs b/src/Audio/SoundInstance.cs index 07d02e3a..259df3bf 100644 --- a/src/Audio/SoundInstance.cs +++ b/src/Audio/SoundInstance.cs @@ -253,6 +253,7 @@ namespace MoonWorks.Audio } public abstract void Play(); + public abstract void QueueSyncPlay(); public abstract void Pause(); public abstract void Stop(); public abstract void StopImmediate(); diff --git a/src/Audio/StaticSoundInstance.cs b/src/Audio/StaticSoundInstance.cs index f2d7549f..b497a96a 100644 --- a/src/Audio/StaticSoundInstance.cs +++ b/src/Audio/StaticSoundInstance.cs @@ -41,6 +41,16 @@ namespace MoonWorks.Audio } public override void Play() + { + PlayUsingOperationSet(0); + } + + public override void QueueSyncPlay() + { + PlayUsingOperationSet(1); + } + + private void PlayUsingOperationSet(uint operationSet) { if (State == SoundState.Playing) { @@ -66,7 +76,7 @@ namespace MoonWorks.Audio IntPtr.Zero ); - FAudio.FAudioSourceVoice_Start(Handle, 0, 0); + FAudio.FAudioSourceVoice_Start(Handle, 0, operationSet); State = SoundState.Playing; } diff --git a/src/Audio/StreamingSound.cs b/src/Audio/StreamingSound.cs index 49825446..e232fef5 100644 --- a/src/Audio/StreamingSound.cs +++ b/src/Audio/StreamingSound.cs @@ -35,6 +35,16 @@ namespace MoonWorks.Audio } public override void Play() + { + PlayUsingOperationSet(0); + } + + public override void QueueSyncPlay() + { + PlayUsingOperationSet(1); + } + + private void PlayUsingOperationSet(uint operationSet) { if (State == SoundState.Playing) { @@ -44,7 +54,7 @@ namespace MoonWorks.Audio State = SoundState.Playing; Update(); - FAudio.FAudioSourceVoice_Start(Handle, 0, 0); + FAudio.FAudioSourceVoice_Start(Handle, 0, operationSet); } public override void Pause()