Beispiel #1
0
        private void FreeSource()
        {
            if (!HasSourceId)
            {
                return;
            }

            lock (sourceMutex)
            {
                if (HasSourceId && AL.IsSource(SourceId))
                {
                    AL.SourceStop(SourceId);
                    ALHelper.CheckError("Failed to stop source.");

                    // Reset the SendFilter to 0 if we are NOT using reverb since
                    // sources are recycled
                    if (OpenALSoundController.Instance.SupportsEfx)
                    {
                        OpenALSoundController.Efx.BindSourceToAuxiliarySlot(SourceId, 0, 0, 0);
                        ALHelper.CheckError("Failed to unset reverb.");
                        AL.Source(SourceId, ALSourcei.EfxDirectFilter, 0);
                        ALHelper.CheckError("Failed to unset filter.");
                    }

                    controller.FreeSource(this);
                }
            }
        }
Beispiel #2
0
        private void PlatformStop(bool immediate)
        {
            if (HasSourceId)
            {
                if (!controller.CheckInitState())
                {
                    return;
                }
                AL.SourceStop(SourceId);
                ALHelper.CheckError("Failed to stop source.");

#if SUPPORTS_EFX
                // Reset the SendFilter to 0 if we are NOT using revert since
                // sources are recyled
                OpenALSoundController.Efx.BindSourceToAuxiliarySlot(SourceId, 0, 0, 0);
                ALHelper.CheckError("Failed to unset reverb.");
                AL.Source(SourceId, ALSourcei.EfxDirectFilter, 0);
                ALHelper.CheckError("Failed to unset filter.");
#endif
                AL.Source(SourceId, ALSourcei.Buffer, 0);
                ALHelper.CheckError("Failed to free source from buffer.");

                controller.FreeSource(this);
            }
            SoundState = SoundState.Stopped;
        }
Beispiel #3
0
        private void PlatformStop(bool immediate)
        {
            if (HasSourceId)
            {
                //Console.WriteLine ("stop " + sourceId + " : " + soundEffect.Name);


                if (!controller.CheckInitState())
                {
                    return;
                }
                AL.SourceStop(SourceId);
                ALHelper.CheckError("Failed to stop source.");

                AL.Source(SourceId, ALSourcei.Buffer, 0);
                ALHelper.CheckError("Failed to free source from buffer.");

                controller.FreeSource(this);
            }
            SoundState = SoundState.Stopped;
        }
        private void PlatformStop(bool immediate)
        {
            if (HasSourceId)
            {
                AL.SourceStop(SourceId);
                ALHelper.CheckError("Failed to stop source.");

                // Reset the SendFilter to 0 if we are NOT using reverb since
                // sources are recycled
                if (OpenALSoundController.GetInstance.SupportsEfx)
                {
                    OpenALSoundController.Efx.BindSourceToAuxiliarySlot(SourceId, 0, 0, 0);
                    ALHelper.CheckError("Failed to unset reverb.");
                    AL.Source(SourceId, ALSourcei.EfxDirectFilter, 0);
                    ALHelper.CheckError("Failed to unset filter.");
                }
                AL.Source(SourceId, ALSourcei.Buffer, 0);
                ALHelper.CheckError("Failed to free source from buffer.");

                controller.FreeSource(this);
            }
            SoundState = SoundState.Stopped;
        }