예제 #1
0
        public void Stop(bool immediate)
        {
            if (handle == IntPtr.Zero)
            {
                return;
            }

            if (immediate)
            {
                FAudio.FAudioSourceVoice_Stop(handle, 0, 0);
                FAudio.FAudioSourceVoice_FlushSourceBuffers(handle);
                FAudio.FAudioVoice_DestroyVoice(handle);
                handle         = IntPtr.Zero;
                usingReverb    = false;
                INTERNAL_state = SoundState.Stopped;

                if (isDynamic)
                {
                    FrameworkDispatcher.Streams.Remove(
                        this as DynamicSoundEffectInstance
                        );
                    (this as DynamicSoundEffectInstance).ClearBuffers();
                }
            }
            else
            {
                if (isDynamic)
                {
                    throw new InvalidOperationException();
                }
                FAudio.FAudioSourceVoice_ExitLoop(handle, 0);
            }
        }
예제 #2
0
 public void Dispose()
 {
     if (ReverbVoice != IntPtr.Zero)
     {
         FAudio.FAudioVoice_DestroyVoice(ReverbVoice);
         ReverbVoice = IntPtr.Zero;
         Marshal.FreeHGlobal(reverbSends.pSends);
     }
     FAudio.FAudioVoice_DestroyVoice(MasterVoice);
     FAudio.FAudio_Release(Handle);
     Context = null;
 }