Beispiel #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);
            }
        }