public void Dispose() { // Obtain EFX entry points EffectsExtension EFX = OpenALDevice.Instance.EFX; // Delete EFX data EFX.DeleteAuxiliaryEffectSlot(Handle); EFX.DeleteEffect(effectHandle); }
public static void Main() { using (AudioContext context = new AudioContext()) { Trace.WriteLine("Testing WaveReader({0}).ReadToEnd()", filename); EffectsExtension efx = new EffectsExtension(); int buffer = AL.GenBuffer(); int source = AL.GenSource(); int state; int effect = efx.GenEffect(); int slot = efx.GenAuxiliaryEffectSlot(); efx.BindEffect(effect, EfxEffectType.Reverb); efx.Effect(effect, EfxEffectf.ReverbDecayTime, 3.0f); efx.Effect(effect, EfxEffectf.ReverbDecayHFRatio, 0.91f); efx.Effect(effect, EfxEffectf.ReverbDensity, 0.7f); efx.Effect(effect, EfxEffectf.ReverbDiffusion, 0.9f); efx.Effect(effect, EfxEffectf.ReverbRoomRolloffFactor, 3.1f); efx.Effect(effect, EfxEffectf.ReverbReflectionsGain, 0.723f); efx.Effect(effect, EfxEffectf.ReverbReflectionsDelay, 0.03f); efx.Effect(effect, EfxEffectf.ReverbGain, 0.23f); efx.AuxiliaryEffectSlot(slot, EfxAuxiliaryi.EffectslotEffect, effect); int channels, bits, rate; byte[] data = Playback.LoadWave(File.Open(filename, FileMode.Open), out channels, out bits, out rate); AL.BufferData(buffer, Playback.GetSoundFormat(channels, bits), data, data.Length, rate); AL.Source(source, ALSourcef.ConeOuterGain, 1.0f); AL.Source(source, ALSourcei.Buffer, buffer); AL.SourcePlay(source); Trace.Write("Playing"); // Query the source to find out when it stops playing. do { Thread.Sleep(250); Trace.Write("."); AL.GetSource(source, ALGetSourcei.SourceState, out state); }while ((ALSourceState)state == ALSourceState.Playing); Trace.WriteLine(""); AL.SourceStop(source); AL.DeleteSource(source); AL.DeleteBuffer(buffer); efx.DeleteEffect(effect); efx.DeleteAuxiliaryEffectSlot(slot); } }
public EfxDiagnostic() { Trace.WriteLine("--- Efx related errors ---"); EffectsExtension Efx = new EffectsExtension(); Trace.Assert(Efx.IsInitialized); #region Test for available Effects uint effect; Efx.GenEffect(out effect); AL.GetError(); foreach (EfxEffectType e in EffectNames) { Efx.BindEffect(effect, e); Effects.Add(e.ToString(), AL.GetError() == ALError.NoError); } Efx.DeleteEffect(ref effect); #endregion Test for available Effects #region Test for available Filters uint filter; Efx.GenFilter(out filter); AL.GetError(); foreach (EfxFilterType f in FilterNames) { Efx.Filter(filter, EfxFilteri.FilterType, (int)f); Filters.Add(f.ToString(), AL.GetError() == ALError.NoError); } Efx.DeleteFilter(ref filter); #endregion Test for available Filters AL.GetError(); uint[] dummy_slots = new uint[MaxAuxiliaryEffectSlotsLimit]; for (MaxAuxiliaryEffectSlots = 0; MaxAuxiliaryEffectSlots < MaxAuxiliaryEffectSlotsLimit; MaxAuxiliaryEffectSlots++) { Efx.GenAuxiliaryEffectSlot(out dummy_slots[MaxAuxiliaryEffectSlots]); if (AL.GetError() != ALError.NoError) { break; } } for (uint i = 0; i < MaxAuxiliaryEffectSlots; i++) { Efx.DeleteAuxiliaryEffectSlot(ref dummy_slots[i]); } }
public EfxDiagnostic() { Trace.WriteLine("--- Efx related errors ---"); EffectsExtension Efx = new EffectsExtension(); Trace.Assert(Efx.IsInitialized); #region Test for available Effects uint effect; Efx.GenEffect(out effect); AL.GetError(); foreach (EfxEffectType e in EffectNames) { Efx.BindEffect(effect, e); Effects.Add(e.ToString(), AL.GetError() == ALError.NoError); } Efx.DeleteEffect(ref effect); #endregion Test for available Effects #region Test for available Filters uint filter; Efx.GenFilter(out filter); AL.GetError(); foreach (EfxFilterType f in FilterNames) { Efx.Filter(filter, EfxFilteri.FilterType, (int)f); Filters.Add(f.ToString(), AL.GetError() == ALError.NoError); } Efx.DeleteFilter(ref filter); #endregion Test for available Filters AL.GetError(); uint[] dummy_slots = new uint[MaxAuxiliaryEffectSlotsLimit]; for (MaxAuxiliaryEffectSlots = 0; MaxAuxiliaryEffectSlots < MaxAuxiliaryEffectSlotsLimit; MaxAuxiliaryEffectSlots++) { Efx.GenAuxiliaryEffectSlot(out dummy_slots[MaxAuxiliaryEffectSlots]); if (AL.GetError() != ALError.NoError) break; } for (uint i = 0; i < MaxAuxiliaryEffectSlots; i++) Efx.DeleteAuxiliaryEffectSlot(ref dummy_slots[i]); }
public static void Main() { using (AudioContext context = new AudioContext()) { Trace.WriteLine("Testing WaveReader({0}).ReadToEnd()", filename); EffectsExtension efx = new EffectsExtension(); int buffer = AL.GenBuffer(); int source = AL.GenSource(); int state; int effect = efx.GenEffect(); int slot = efx.GenAuxiliaryEffectSlot(); efx.BindEffect(effect, EfxEffectType.Reverb); efx.Effect(effect, EfxEffectf.ReverbDecayTime, 3.0f); efx.Effect(effect, EfxEffectf.ReverbDecayHFRatio, 0.91f); efx.Effect(effect, EfxEffectf.ReverbDensity, 0.7f); efx.Effect(effect, EfxEffectf.ReverbDiffusion, 0.9f); efx.Effect(effect, EfxEffectf.ReverbRoomRolloffFactor, 3.1f); efx.Effect(effect, EfxEffectf.ReverbReflectionsGain, 0.723f); efx.Effect(effect, EfxEffectf.ReverbReflectionsDelay, 0.03f); efx.Effect(effect, EfxEffectf.ReverbGain, 0.23f); efx.AuxiliaryEffectSlot(slot, EfxAuxiliaryi.EffectslotEffect, effect); int channels, bits, rate; byte[] data = Playback.LoadWave(File.Open(filename, FileMode.Open), out channels, out bits, out rate); AL.BufferData(buffer, Playback.GetSoundFormat(channels, bits), data, data.Length, rate); AL.Source(source, ALSourcef.ConeOuterGain, 1.0f); AL.Source(source, ALSourcei.Buffer, buffer); AL.SourcePlay(source); Trace.Write("Playing"); // Query the source to find out when it stops playing. do { Thread.Sleep(250); Trace.Write("."); AL.GetSource(source, ALGetSourcei.SourceState, out state); } while ((ALSourceState)state == ALSourceState.Playing); Trace.WriteLine(""); AL.SourceStop(source); AL.DeleteSource(source); AL.DeleteBuffer(buffer); efx.DeleteEffect(effect); efx.DeleteAuxiliaryEffectSlot(slot); } }