diff --git a/Source/OpenTK/OpenAL/AlFunctions.cs b/Source/OpenTK/OpenAL/AlFunctions.cs index 2ed8eef6..91b660c8 100644 --- a/Source/OpenTK/OpenAL/AlFunctions.cs +++ b/Source/OpenTK/OpenAL/AlFunctions.cs @@ -555,7 +555,7 @@ namespace OpenTK.OpenAL /// The name of the attribute to retrieve: AL_SOURCE_RELATIVE, AL_BUFFER, AL_SOURCE_STATE, AL_BUFFERS_QUEUED, AL_BUFFERS_PROCESSED /// A pointer to the integer value being retrieved. [CLSCompliant(false),DllImport(AL.Lib,EntryPoint = "alGetSourcei",ExactSpelling = true,CallingConvention = AL.Style),SuppressUnmanagedCodeSecurity( )] - public static extern void GetSource( uint sid,Enums.ALSourceiGet param,[Out] out int value ); + public static extern void GetSource( uint sid,Enums.ALGetSourcei param,[Out] out int value ); // AL_API void AL_APIENTRY alGetSourcei( ALuint sid, ALenum param, ALint* value ); /// This function retrieves a bool property of a source. @@ -566,7 +566,7 @@ namespace OpenTK.OpenAL public static void GetSource( uint sid,Enums.ALSourceb param,[Out] out bool value ) { int result; - GetSource(sid,(Enums.ALSourceiGet) param,out result); + GetSource(sid,(Enums.ALGetSourcei) param,out result); if ( result == 1 ) value = true; else diff --git a/Source/OpenTK/OpenAL/AlTokens.cs b/Source/OpenTK/OpenAL/AlTokens.cs index 661c1ac8..f5ea2065 100644 --- a/Source/OpenTK/OpenAL/AlTokens.cs +++ b/Source/OpenTK/OpenAL/AlTokens.cs @@ -142,7 +142,7 @@ namespace OpenTK.OpenAL.Enums EfxAuxiliarySendFilter = 0x20006, } - public enum ALSourceiGet : int + public enum ALGetSourcei : int { ///The playback position, expressed in bytes. ByteOffset = 0x1026, // AL_EXT_OFFSET extension. diff --git a/Source/OpenTK/OpenAL/EfxFunctions.cs b/Source/OpenTK/OpenAL/EfxFunctions.cs index 6e561b73..93ebb9ce 100644 --- a/Source/OpenTK/OpenAL/EfxFunctions.cs +++ b/Source/OpenTK/OpenAL/EfxFunctions.cs @@ -10,6 +10,8 @@ using System; using System.Runtime.InteropServices; +using OpenTK.Math; + namespace OpenTK.OpenAL { @@ -169,6 +171,29 @@ namespace OpenTK.OpenAL #endregion alEffectf + #region alEffectfv + + [CLSCompliant(false)] + unsafe private delegate void Delegate_alEffectfv(uint eid, Enums.EfxEffect3f param, [In] float* values); + // typedef void (__cdecl *LPALEFFECTFV)( ALuint eid, ALenum param, ALfloat* values ); + + [CLSCompliant(false)] + private Delegate_alEffectfv Imported_alEffectfv; + + [CLSCompliant(false)] + public void Effect( uint eid,Enums.EfxEffect3f param,ref Vector3 values ) + { + unsafe + { + fixed ( float* ptr = &values.X ) + { + Imported_alEffectfv(eid,param,ptr); + } + } + } + + #endregion alEffectfv + #region alGetEffecti // typedef void (__cdecl *LPALGETEFFECTI)( ALuint eid, ALenum pname, ALint* value ); @@ -223,11 +248,36 @@ namespace OpenTK.OpenAL #endregion alGetEffectf + #region alGetEffectfv + + + [CLSCompliant(false)] + unsafe private delegate void Delegate_alGetEffectfv( uint eid,Enums.EfxEffect3f param,[Out] float* values ); + // typedef void (__cdecl *LPALGETEFFECTFV)( ALuint eid, ALenum pname, ALfloat* values ); + + [CLSCompliant(false)] + private Delegate_alGetEffectfv Imported_alGetEffectfv; + + [CLSCompliant(false)] + public void GetEffect( uint eid,Enums.EfxEffect3f param,out Vector3 values ) + { + unsafe + { + fixed ( float* ptr = &values.X ) + { + Imported_alGetEffectfv(eid,param,ptr); + values.X = ptr[0]; + values.Y = ptr[1]; + values.Z = ptr[2]; + } + } + } + + #endregion alGetEffectfv + // Not used: // typedef void (__cdecl *LPALEFFECTIV)( ALuint eid, ALenum param, ALint* values ); - // typedef void (__cdecl *LPALEFFECTFV)( ALuint eid, ALenum param, ALfloat* values ); // typedef void (__cdecl *LPALGETEFFECTIV)( ALuint eid, ALenum pname, ALint* values ); - // typedef void (__cdecl *LPALGETEFFECTFV)( ALuint eid, ALenum pname, ALfloat* values ); #endregion Effect Object @@ -673,8 +723,10 @@ namespace OpenTK.OpenAL Imported_alIsEffect = (Delegate_alIsEffect) Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("alIsEffect"),typeof(Delegate_alIsEffect)); Imported_alEffecti = (Delegate_alEffecti) Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("alEffecti"),typeof(Delegate_alEffecti)); Imported_alEffectf = (Delegate_alEffectf) Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("alEffectf"),typeof(Delegate_alEffectf)); + Imported_alEffectfv = (Delegate_alEffectfv) Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("alEffectfv"),typeof(Delegate_alEffectfv)); Imported_alGetEffecti = (Delegate_alGetEffecti) Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("alGetEffecti"),typeof(Delegate_alGetEffecti)); Imported_alGetEffectf = (Delegate_alGetEffectf) Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("alGetEffectf"),typeof(Delegate_alGetEffectf)); + Imported_alGetEffectfv = (Delegate_alGetEffectfv) Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("alGetEffectfv"),typeof(Delegate_alGetEffectfv)); } catch ( Exception e ) { Console.WriteLine("Failed to marshal Effect functions. " + e.ToString( )); diff --git a/Source/OpenTK/OpenAL/EfxPresets.cs b/Source/OpenTK/OpenAL/EfxPresets.cs index 8c468696..610551b5 100644 --- a/Source/OpenTK/OpenAL/EfxPresets.cs +++ b/Source/OpenTK/OpenAL/EfxPresets.cs @@ -99,71 +99,71 @@ namespace OpenTK.OpenAL } } + + public struct EfxEaxReverb + { + public float flDensity; + public float flDiffusion; + public float flGain; + public float flGainHF; + public float flGainLF; + public float flDecayTime; + public float flDecayHFRatio; + public float flDecayLFRatio; + public float flReflectionsGain; + public float flReflectionsDelay; + public Vector3 flReflectionsPan; + public float flLateReverbGain; + public float flLateReverbDelay; + public Vector3 flLateReverbPan; + public float flEchoTime; + public float flEchoDepth; + public float flModulationTime; + public float flModulationDepth; + public float flAirAbsorptionGainHF; + public float flHFReference; + public float flLFReference; + public float flRoomRolloffFactor; + public int iDecayHFLimit; + } + /* - public struct _EFXEAXREVERBPROPERTIES - { - public float flDensity; - public float flDiffusion; - public float flGain; - public float flGainHF; - public float flGainLF; - public float flDecayTime; - public float flDecayHFRatio; - public float flDecayLFRatio; - public float flReflectionsGain; - public float flReflectionsDelay; - public Vector3 flReflectionsPan; - public float flLateReverbGain; - public float flLateReverbDelay; - public Vector3 flLateReverbPan; - public float flEchoTime; - public float flEchoDepth; - public float flModulationTime; - public float flModulationDepth; - public float flAirAbsorptionGainHF; - public float flHFReference; - public float flLFReference; - public float flRoomRolloffFactor; - public int iDecayHFLimit; - } - _EFXEAXREVERBPROPERTIES EFXEAXREVERBPROPERTIES;//, *LPEFXEAXREVERBPROPERTIES; + public struct _EAXOBSTRUCTIONPROPERTIES + { + public int lObstruction; + public float flObstructionLFRatio; + } + _EAXOBSTRUCTIONPROPERTIES EAXOBSTRUCTIONPROPERTIES;//, *LPEAXOBSTRUCTIONPROPERTIES; - public struct _EAXOBSTRUCTIONPROPERTIES - { - public int lObstruction; - public float flObstructionLFRatio; - } - _EAXOBSTRUCTIONPROPERTIES EAXOBSTRUCTIONPROPERTIES;//, *LPEAXOBSTRUCTIONPROPERTIES; + public struct _EAXOCCLUSIONPROPERTIES + { + public int lOcclusion; + public float flOcclusionLFRatio; + public float flOcclusionRoomRatio; + public float flOcclusionDirectRatio; + } + _EAXOCCLUSIONPROPERTIES EAXOCCLUSIONPROPERTIES;//, *LPEAXOCCLUSIONPROPERTIES; - public struct _EAXOCCLUSIONPROPERTIES - { - public int lOcclusion; - public float flOcclusionLFRatio; - public float flOcclusionRoomRatio; - public float flOcclusionDirectRatio; - } - _EAXOCCLUSIONPROPERTIES EAXOCCLUSIONPROPERTIES;//, *LPEAXOCCLUSIONPROPERTIES; + public struct _EAXEXCLUSIONPROPERTIES + { + public int lExclusion; + public float flExclusionLFRatio; + } + _EAXEXCLUSIONPROPERTIES EAXEXCLUSIONPROPERTIES;//, *LPEAXEXCLUSIONPROPERTIES; - public struct _EAXEXCLUSIONPROPERTIES - { - public int lExclusion; - public float flExclusionLFRatio; - } - _EAXEXCLUSIONPROPERTIES EAXEXCLUSIONPROPERTIES;//, *LPEAXEXCLUSIONPROPERTIES; - - public struct _EFXLOWPASSFILTER - { - public float flGain; - public float flGainHF; - } - _EFXLOWPASSFILTER EFXLOWPASSFILTER;//, *LPEFXLOWPASSFILTER; + public struct _EFXLOWPASSFILTER + { + public float flGain; + public float flGainHF; + } + _EFXLOWPASSFILTER EFXLOWPASSFILTER;//, *LPEFXLOWPASSFILTER; - void ConvertReverbParameters(EAXREVERBPROPERTIES *pEAXProp, EFXEAXREVERBPROPERTIES *pEFXEAXReverb); - void ConvertObstructionParameters(EAXOBSTRUCTIONPROPERTIES *pObProp, EFXLOWPASSFILTER *pDirectLowPassFilter); - void ConvertExclusionParameters(EAXEXCLUSIONPROPERTIES *pExProp, EFXLOWPASSFILTER *pSendLowPassFilter); - void ConvertOcclusionParameters(EAXOCCLUSIONPROPERTIES *pOcProp, EFXLOWPASSFILTER *pDirectLowPassFilter, EFXLOWPASSFILTER *pSendLowPassFilter); - */ + void ConvertReverbParameters(EAXREVERBPROPERTIES *pEAXProp, EFXEAXREVERBPROPERTIES *pEFXEAXReverb); + void ConvertObstructionParameters(EAXOBSTRUCTIONPROPERTIES *pObProp, EFXLOWPASSFILTER *pDirectLowPassFilter); + void ConvertExclusionParameters(EAXEXCLUSIONPROPERTIES *pExProp, EFXLOWPASSFILTER *pSendLowPassFilter); + void ConvertOcclusionParameters(EAXOCCLUSIONPROPERTIES *pOcProp, EFXLOWPASSFILTER *pDirectLowPassFilter, EFXLOWPASSFILTER *pSendLowPassFilter); + */ ///EAX Reverb Presets in legacy format - use ConvertReverbParameters() to convert to EFX EAX Reverb Presets for use with the OpenAL Effects Extension. diff --git a/Source/OpenTK/OpenAL/EfxTokens.cs b/Source/OpenTK/OpenAL/EfxTokens.cs index 38fb7a7e..4238712e 100644 --- a/Source/OpenTK/OpenAL/EfxTokens.cs +++ b/Source/OpenTK/OpenAL/EfxTokens.cs @@ -144,7 +144,6 @@ namespace OpenTK.OpenAL.Enums AL_EQUALIZER_HIGH_GAIN = 0x0009, ///Equalizer Parameter. Unit: Hz Range [4000.0f .. 16000.0f] Default: 6000.0f AL_EQUALIZER_HIGH_CUTOFF = 0x000A, - ///EAXReverb effect parameters. Range [0.0f .. 1.0f] Default: 1.0f AL_EAXREVERB_DENSITY = 0x0001, ///EAXReverb effect parameters. Range [0.0f .. 1.0f] Default: 1.0f @@ -165,14 +164,11 @@ namespace OpenTK.OpenAL.Enums AL_EAXREVERB_REFLECTIONS_GAIN = 0x0009, ///EAXReverb effect parameters. Unit: Seconds Range [0.0f .. 0.3f] Default: 0.007f AL_EAXREVERB_REFLECTIONS_DELAY = 0x000A, - /// EAXReverb effect parameters. Unit: Vector3 Default: {0.0f, 0.0f, 0.0f} - AL_EAXREVERB_REFLECTIONS_PAN = 0x000B, ///EAXReverb effect parameters. Range [0.0f .. 10.0f] Default: 1.26f AL_EAXREVERB_LATE_REVERB_GAIN = 0x000C, ///EAXReverb effect parameters. Unit: Seconds Range [0.0f .. 0.1f] Default: 0.011f AL_EAXREVERB_LATE_REVERB_DELAY = 0x000D, - /// EAXReverb effect parameters. Unit: Vector3 Default: {0.0f, 0.0f, 0.0f} - AL_EAXREVERB_LATE_REVERB_PAN = 0x000E, + ///EAXReverb effect parameters. Range [0.075f .. 0.25f] Default: 0.25f AL_EAXREVERB_ECHO_TIME = 0x000F, ///EAXReverb effect parameters. Range [0.0f .. 1.0f] Default: 0.0f @@ -191,6 +187,14 @@ namespace OpenTK.OpenAL.Enums AL_EAXREVERB_ROOM_ROLLOFF_FACTOR = 0x0016, } + public enum EfxEffect3f : int + { + /// EAXReverb effect parameters. Unit: Vector3 Default: {0.0f, 0.0f, 0.0f} + EaxReverbLateReverbPan = 0x000E, + /// EAXReverb effect parameters. Unit: Vector3 Default: {0.0f, 0.0f, 0.0f} + EaxReverbReflectionsPan = 0x000B, + } + public enum EfxEffecti : int { ///Chorus Parameter. Unit: (0) Sinusoid, (1) Triangle [0 .. 1] Default: 1 @@ -306,10 +310,10 @@ namespace OpenTK.OpenAL.Enums { // Auxiliary Slot object definitions to be used with alAuxiliaryEffectSlot functions. /// This property is used to attach an Effect object to the Auxiliary Effect Slot object. After the attachment, the Auxiliary Effect Slot object will contain the effect type and have the same effect parameters that were stored in the Effect object. Any Sources feeding the Auxiliary Effect Slot will immediate feed the new effect type and new effect parameters. - AL_EFFECTSLOT_EFFECT = 0x0001, + EffectslotEffect = 0x0001, /// This property is used to enable or disable automatic send adjustments based on the physical positions of the sources and the listener. This property should be enabled when an application wishes to use a reverb effect to simulate the environment surrounding a listener or a collection of Sources. Range [False .. True] Default: True - AL_EFFECTSLOT_AUXILIARY_SEND_AUTO = 0x0003, + EffectslotAuxiliarySendAuto = 0x0003, // Value to be used as an Auxiliary Slot ID to disable a source send.. // AL_EFFECTSLOT_NULL = 0x0000, // remove, seems not to belong here. it's a target, not a token @@ -318,7 +322,7 @@ namespace OpenTK.OpenAL.Enums public enum EfxAuxiliaryf : int { /// This property is used to specify an output level for the Auxiliary Effect Slot. Setting the gain to 0.0f mutes the output. Range [0.0f .. 1.0f] Default: 1.0f - AL_EFFECTSLOT_GAIN = 0x0002, + EffectslotGain = 0x0002, } #endregion Auxiliary Effect Slot diff --git a/Source/OpenTK/OpenAL/History.txt b/Source/OpenTK/OpenAL/History.txt index fe208758..9bbafc09 100644 --- a/Source/OpenTK/OpenAL/History.txt +++ b/Source/OpenTK/OpenAL/History.txt @@ -1,7 +1,7 @@ Version History: v0.1-0.7 -- Added AL.Null for convenience when working with C Manuals. + - Alut: The following functions are not bound/imported. Issue of undoing C malloc to prevent memory leaks. "alutLoadMemoryFromFile, alutLoadMemoryFromFileImage, alutLoadMemoryHelloWorld, alutLoadMemoryWaveform" Please use Alut.CreateBuffer* functions instead, which have similar functionality and return a Buffer Handle instead. @@ -18,6 +18,12 @@ Version History: DopplerVelocity, ChannelMask are deprecated and marked. The Token AL_DATA is hidden now, as it returns a pointer to unmanaged memory where the buffer was located previously to calling AL.BufferData(). (It is usually freed after buffering) +Efx: Functions not imported: + alEffectiv, alGetEffectiv + alFilteriv, alFilterfv, alGetFilteriv, alGetFilterfv + alAuxiliaryEffectSlotiv, alAuxiliaryEffectSlotfv, alGetAuxiliaryEffectSlotiv, alGetAuxiliaryEffectSlotfv + +- Added AL.Null for convenience when working with C Manuals. - Added Function AL.GetErrorString() - Added overloads for requesting/deleting a single buffer/source at a time. - Refactored -i -fv -3f functions to be overloads e.g AL.GetSource, AL.GetListener @@ -28,6 +34,9 @@ v0.8 -added Efx tokens to AL/Alc enums. -All Efx Effect functions imported. Filter and Auxiliary missing public methods. +v0.9 +-added docu +-added alEffectfv and alGetEffectfv Todo: - EFX Extension