mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-24 16:55:28 +00:00
* Audio/*: Cleaned up whitespace.
* AudioContext.cs: Get device name specifier once a device is opened.
This commit is contained in:
parent
8a14fdb477
commit
7ab2816eee
|
@ -267,7 +267,7 @@ namespace OpenTK.Audio
|
|||
|
||||
CheckForAlcErrors();
|
||||
|
||||
device_name = device;
|
||||
device_name = Alc.GetString(device_handle, AlcGetString.DeviceSpecifier);
|
||||
|
||||
// Build the attribute list
|
||||
List<int> attributes = new List<int>();
|
||||
|
|
|
@ -444,10 +444,10 @@ namespace OpenTK.Audio
|
|||
|
||||
/// <summary>This function generates one source only. References to sources are uint values, which are used wherever a source reference is needed (in calls such as AL.DeleteSources and AL.Source with parameter ALSourcei).</summary>
|
||||
/// <param name="source">Pointer to an uint value which will store the name of the new source.</param>
|
||||
[CLSCompliant( false )]
|
||||
public static void GenSource( out uint source )
|
||||
[CLSCompliant(false)]
|
||||
public static void GenSource(out uint source)
|
||||
{
|
||||
GenSources( 1, out source );
|
||||
GenSources(1, out source);
|
||||
}
|
||||
|
||||
#endregion GenSources()
|
||||
|
@ -499,7 +499,7 @@ namespace OpenTK.Audio
|
|||
/// <summary>This function deletes one source only.</summary>
|
||||
/// <param name="source">Pointer to a source name identifying the source to be deleted.</param>
|
||||
[CLSCompliant(false)]
|
||||
public static void DeleteSource( ref uint source)
|
||||
public static void DeleteSource(ref uint source)
|
||||
{
|
||||
DeleteSources(1, ref source);
|
||||
}
|
||||
|
@ -1316,10 +1316,10 @@ namespace OpenTK.Audio
|
|||
|
||||
/// <summary>This function generates one buffer only, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
|
||||
/// <param name="buffers">Pointer to an uint value which will store the names of the new buffer.</param>
|
||||
[CLSCompliant( false )]
|
||||
public static void GenBuffer( out uint buffer )
|
||||
[CLSCompliant(false)]
|
||||
public static void GenBuffer(out uint buffer)
|
||||
{
|
||||
GenBuffers( 1, out buffer );
|
||||
GenBuffers(1, out buffer);
|
||||
}
|
||||
|
||||
#endregion GenBuffers
|
||||
|
@ -1372,7 +1372,7 @@ namespace OpenTK.Audio
|
|||
/// <summary>This function deletes one buffer only, freeing the resources used by the buffer. Buffers which are attached to a source can not be deleted. See AL.Source (ALSourcei) and AL.SourceUnqueueBuffers for information on how to detach a buffer from a source.</summary>
|
||||
/// <param name="buffer">Pointer to a buffer name identifying the buffer to be deleted.</param>
|
||||
[CLSCompliant(false)]
|
||||
public static void DeleteBuffer( ref uint buffer)
|
||||
public static void DeleteBuffer(ref uint buffer)
|
||||
{
|
||||
DeleteBuffers(1, ref buffer);
|
||||
}
|
||||
|
@ -1380,7 +1380,7 @@ namespace OpenTK.Audio
|
|||
/// <summary>This function deletes one buffer only, freeing the resources used by the buffer. Buffers which are attached to a source can not be deleted. See AL.Source (ALSourcei) and AL.SourceUnqueueBuffers for information on how to detach a buffer from a source.</summary>
|
||||
/// <param name="buffer">Pointer to a buffer name identifying the buffer to be deleted.</param>
|
||||
[CLSCompliant(true)]
|
||||
public static void DeleteBuffer( int buffer)
|
||||
public static void DeleteBuffer(int buffer)
|
||||
{
|
||||
DeleteBuffers(1, ref buffer);
|
||||
}
|
||||
|
@ -1583,51 +1583,51 @@ namespace OpenTK.Audio
|
|||
/// <summary>(Helper) Returns Source state information.</summary>
|
||||
/// <param name="sid">The source to be queried.</param>
|
||||
/// <returns>state information from OpenAL.</returns>
|
||||
[CLSCompliant( false )]
|
||||
public static ALSourceState GetSourceState( uint sid )
|
||||
[CLSCompliant(false)]
|
||||
public static ALSourceState GetSourceState(uint sid)
|
||||
{
|
||||
int temp;
|
||||
AL.GetSource( sid, ALGetSourcei.SourceState, out temp );
|
||||
return (ALSourceState) temp;
|
||||
AL.GetSource(sid, ALGetSourcei.SourceState, out temp);
|
||||
return (ALSourceState)temp;
|
||||
}
|
||||
|
||||
/// <summary>(Helper) Returns Source state information.</summary>
|
||||
/// <param name="sid">The source to be queried.</param>
|
||||
/// <returns>state information from OpenAL.</returns>
|
||||
[CLSCompliant( true )]
|
||||
public static ALSourceState GetSourceState( int sid )
|
||||
[CLSCompliant(true)]
|
||||
public static ALSourceState GetSourceState(int sid)
|
||||
{
|
||||
int temp;
|
||||
AL.GetSource( sid, ALGetSourcei.SourceState, out temp );
|
||||
return (ALSourceState) temp;
|
||||
AL.GetSource(sid, ALGetSourcei.SourceState, out temp);
|
||||
return (ALSourceState)temp;
|
||||
}
|
||||
|
||||
/// <summary>(Helper) Returns Source type information.</summary>
|
||||
/// <param name="sid">The source to be queried.</param>
|
||||
/// <returns>type information from OpenAL.</returns>
|
||||
[CLSCompliant( false )]
|
||||
public static ALSourceType GetSourceType( uint sid )
|
||||
[CLSCompliant(false)]
|
||||
public static ALSourceType GetSourceType(uint sid)
|
||||
{
|
||||
int temp;
|
||||
AL.GetSource( sid, ALGetSourcei.SourceType, out temp );
|
||||
return (ALSourceType) temp;
|
||||
AL.GetSource(sid, ALGetSourcei.SourceType, out temp);
|
||||
return (ALSourceType)temp;
|
||||
}
|
||||
|
||||
/// <summary>(Helper) Returns Source type information.</summary>
|
||||
/// <param name="sid">The source to be queried.</param>
|
||||
/// <returns>type information from OpenAL.</returns>
|
||||
[CLSCompliant( true )]
|
||||
public static ALSourceType GetSourceType( int sid )
|
||||
[CLSCompliant(true)]
|
||||
public static ALSourceType GetSourceType(int sid)
|
||||
{
|
||||
int temp;
|
||||
AL.GetSource( sid, ALGetSourcei.SourceType, out temp );
|
||||
return (ALSourceType) temp;
|
||||
AL.GetSource(sid, ALGetSourcei.SourceType, out temp);
|
||||
return (ALSourceType)temp;
|
||||
}
|
||||
|
||||
[CLSCompliant( true )]
|
||||
public static ALDistanceModel GetDistanceModel( )
|
||||
[CLSCompliant(true)]
|
||||
public static ALDistanceModel GetDistanceModel()
|
||||
{
|
||||
return (ALDistanceModel) AL.Get( ALGetInteger.DistanceModel );
|
||||
return (ALDistanceModel)AL.Get(ALGetInteger.DistanceModel);
|
||||
}
|
||||
|
||||
#endregion Helpers
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace OpenTK.Audio
|
|||
/// <summary>(Helper) Selects the Effect type used by this Effect handle.</summary>
|
||||
/// <param name="eid">Effect id returned from a successful call to GenEffects.</param>
|
||||
/// <param name="type">Effect type.</param>
|
||||
|
||||
|
||||
public void BindEffect(int eid, EfxEffectType type)
|
||||
{
|
||||
Imported_alEffecti((uint)eid, EfxEffecti.EffectType, (int)type);
|
||||
|
@ -56,7 +56,7 @@ namespace OpenTK.Audio
|
|||
/// <summary>(Helper) reroutes the output of a Source through a Filter.</summary>
|
||||
/// <param name="source">A valid Source handle.</param>
|
||||
/// <param name="filter">A valid Filter handle.</param>
|
||||
|
||||
|
||||
public void BindFilterToSource(int source, int filter)
|
||||
{
|
||||
AL.Source((uint)source, ALSourcei.EfxDirectFilter, (int)filter);
|
||||
|
@ -78,7 +78,7 @@ namespace OpenTK.Audio
|
|||
/// <summary>(Helper) Attaches an Effect to an Auxiliary Effect Slot.</summary>
|
||||
/// <param name="auxiliaryeffectslot">The slot handle to attach the Effect to.</param>
|
||||
/// <param name="effect">The Effect handle that is being attached.</param>
|
||||
|
||||
|
||||
public void BindEffectToAuxiliarySlot(int auxiliaryeffectslot, int effect)
|
||||
{
|
||||
AuxiliaryEffectSlot((uint)auxiliaryeffectslot, EfxAuxiliaryi.EffectslotEffect, (int)effect);
|
||||
|
@ -104,7 +104,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="slot">The Auxiliary Effect Slot handle that receives input from the Source.</param>
|
||||
/// <param name="slotnumber">Every Source has only a limited number of slots it can feed buffer to. The number must stay below AlcContextAttributes.EfxMaxAuxiliarySends</param>
|
||||
/// <param name="filter">Filter handle to be attached between Source ouput and Auxiliary Slot input. Use 0 or EfxFilterType.FilterNull for no filter. </param>
|
||||
|
||||
|
||||
public void BindSourceToAuxiliarySlot(int source, int slot, int slotnumber, int filter)
|
||||
{
|
||||
AL.Source((uint)source, ALSource3i.EfxAuxiliarySendFilter, (int)slot, (int)slotnumber, (int)filter);
|
||||
|
@ -171,7 +171,7 @@ namespace OpenTK.Audio
|
|||
GenEffects(n, out effects[0]);
|
||||
return effects;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Generates a single effect object.</summary>
|
||||
/// <returns>A handle to the generated effect object.</returns>
|
||||
/// <remarks>
|
||||
|
@ -188,13 +188,13 @@ namespace OpenTK.Audio
|
|||
/// <summary>Generates a single effect object.</summary>
|
||||
/// <param name="effect">A handle to the generated effect object.</param>
|
||||
[CLSCompliant(false)]
|
||||
public void GenEffect( out uint effect )
|
||||
public void GenEffect(out uint effect)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed ( uint* ptr = &effect )
|
||||
fixed (uint* ptr = &effect)
|
||||
{
|
||||
Imported_alGenEffects( 1, ptr );
|
||||
Imported_alGenEffects(1, ptr);
|
||||
effect = *ptr;
|
||||
}
|
||||
}
|
||||
|
@ -262,19 +262,19 @@ namespace OpenTK.Audio
|
|||
/// <param name="effect">Pointer to an effect name/handle identifying the Effect Object to be deleted.</param>
|
||||
public void DeleteEffect(int effect)
|
||||
{
|
||||
DeleteEffects( 1, ref effect );
|
||||
DeleteEffects(1, ref effect);
|
||||
}
|
||||
|
||||
/// <summary>This function deletes one Effect only.</summary>
|
||||
/// <param name="effect">Pointer to an effect name/handle identifying the Effect Object to be deleted.</param>
|
||||
[CLSCompliant(false)]
|
||||
public void DeleteEffect( ref uint effect )
|
||||
public void DeleteEffect(ref uint effect)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed ( uint* ptr = &effect )
|
||||
fixed (uint* ptr = &effect)
|
||||
{
|
||||
Imported_alDeleteEffects( 1, ptr );
|
||||
Imported_alDeleteEffects(1, ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ namespace OpenTK.Audio
|
|||
/// <summary>The IsEffect function is used to determine if an object identifier is a valid Effect object.</summary>
|
||||
/// <param name="eid">Effect identifier to validate.</param>
|
||||
/// <returns>True if the identifier is a valid Effect, False otherwise.</returns>
|
||||
|
||||
|
||||
public bool IsEffect(int eid)
|
||||
{
|
||||
return Imported_alIsEffect((uint)eid);
|
||||
|
@ -333,7 +333,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="eid">Effect object identifier.</param>
|
||||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="value">Integer value.</param>
|
||||
|
||||
|
||||
public void Effect(int eid, EfxEffecti param, int value)
|
||||
{
|
||||
Imported_alEffecti((uint)eid, param, value);
|
||||
|
@ -364,7 +364,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="eid">Effect object identifier.</param>
|
||||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="value">Floating point value.</param>
|
||||
|
||||
|
||||
public void Effect(int eid, EfxEffectf param, float value)
|
||||
{
|
||||
Imported_alEffectf((uint)eid, param, value);
|
||||
|
@ -401,7 +401,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="eid">Effect object identifier.</param>
|
||||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="values">Pointer to Math.Vector3.</param>
|
||||
|
||||
|
||||
public void Effect(int eid, EfxEffect3f param, ref Vector3 values)
|
||||
{
|
||||
Effect((uint)eid, param, ref values);
|
||||
|
@ -438,7 +438,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="eid">Effect object identifier.</param>
|
||||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">Address where integer value will be stored.</param>
|
||||
|
||||
|
||||
public void GetEffect(int eid, EfxEffecti pname, out int value)
|
||||
{
|
||||
GetEffect((uint)eid, pname, out value);
|
||||
|
@ -475,7 +475,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="eid">Effect object identifier.</param>
|
||||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">Address where floating point value will be stored.</param>
|
||||
|
||||
|
||||
public void GetEffect(int eid, EfxEffectf pname, out float value)
|
||||
{
|
||||
GetEffect((uint)eid, pname, out value);
|
||||
|
@ -515,7 +515,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="eid">Effect object identifier.</param>
|
||||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">A Math.Vector3 to hold the values.</param>
|
||||
|
||||
|
||||
public void GetEffect(int eid, EfxEffect3f param, out Vector3 values)
|
||||
{
|
||||
GetEffect((uint)eid, param, out values);
|
||||
|
@ -599,13 +599,13 @@ namespace OpenTK.Audio
|
|||
/// <summary>This function generates only one Filter.</summary>
|
||||
/// <param name="filter">Storage UInt32 for the new filter name/handle.</param>
|
||||
[CLSCompliant(false)]
|
||||
unsafe public void GenFilter( out uint filter )
|
||||
unsafe public void GenFilter(out uint filter)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed ( uint* ptr = &filter )
|
||||
fixed (uint* ptr = &filter)
|
||||
{
|
||||
Imported_alGenFilters( 1, ptr );
|
||||
Imported_alGenFilters(1, ptr);
|
||||
filter = *ptr;
|
||||
}
|
||||
}
|
||||
|
@ -678,13 +678,13 @@ namespace OpenTK.Audio
|
|||
/// <summary>This function deletes one Filter only.</summary>
|
||||
/// <param name="filter">Pointer to an filter name/handle identifying the Filter Object to be deleted.</param>
|
||||
[CLSCompliant(false)]
|
||||
public void DeleteFilter( ref uint filter )
|
||||
public void DeleteFilter(ref uint filter)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed ( uint* ptr = &filter )
|
||||
fixed (uint* ptr = &filter)
|
||||
{
|
||||
Imported_alDeleteFilters( 1, ptr );
|
||||
Imported_alDeleteFilters(1, ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -712,7 +712,7 @@ namespace OpenTK.Audio
|
|||
/// <summary>The IsFilter function is used to determine if an object identifier is a valid Filter object.</summary>
|
||||
/// <param name="fid">Effect identifier to validate.</param>
|
||||
/// <returns>True if the identifier is a valid Filter, False otherwise.</returns>
|
||||
|
||||
|
||||
public bool IsFilter(int fid)
|
||||
{
|
||||
return Imported_alIsFilter((uint)fid);
|
||||
|
@ -743,7 +743,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="fid">Filter object identifier.</param>
|
||||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="value">Integer value.</param>
|
||||
|
||||
|
||||
public void Filter(int fid, EfxFilteri param, int value)
|
||||
{
|
||||
Imported_alFilteri((uint)fid, param, value);
|
||||
|
@ -774,7 +774,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="fid">Filter object identifier.</param>
|
||||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="value">Floating point value.</param>
|
||||
|
||||
|
||||
public void Filter(int fid, EfxFilterf param, float value)
|
||||
{
|
||||
Imported_alFilterf((uint)fid, param, value);
|
||||
|
@ -811,7 +811,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="fid">Filter object identifier.</param>
|
||||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">Address where integer value will be stored.</param>
|
||||
|
||||
|
||||
public void GetFilter(int fid, EfxFilteri pname, out int value)
|
||||
{
|
||||
GetFilter((uint)fid, pname, out value);
|
||||
|
@ -848,7 +848,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="fid">Filter object identifier.</param>
|
||||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">Address where floating point value will be stored.</param>
|
||||
|
||||
|
||||
public void GetFilter(int fid, EfxFilterf pname, out float value)
|
||||
{
|
||||
GetFilter((uint)fid, pname, out value);
|
||||
|
@ -932,13 +932,13 @@ namespace OpenTK.Audio
|
|||
/// <summary>This function generates only one Auxiliary Effect Slot.</summary>
|
||||
/// <returns>Storage UInt32 for the new auxiliary effect slot name/handle.</returns>
|
||||
[CLSCompliant(false)]
|
||||
public void GenAuxiliaryEffectSlot( out uint slot )
|
||||
public void GenAuxiliaryEffectSlot(out uint slot)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed ( uint* ptr = &slot )
|
||||
fixed (uint* ptr = &slot)
|
||||
{
|
||||
Imported_alGenAuxiliaryEffectSlots( 1, ptr );
|
||||
Imported_alGenAuxiliaryEffectSlots(1, ptr);
|
||||
slot = *ptr;
|
||||
}
|
||||
}
|
||||
|
@ -959,7 +959,7 @@ namespace OpenTK.Audio
|
|||
[CLSCompliant(false)]
|
||||
public void DeleteAuxiliaryEffectSlots(int n, ref uint slots)
|
||||
{
|
||||
unsafe
|
||||
unsafe
|
||||
{
|
||||
fixed (uint* ptr = &slots)
|
||||
{
|
||||
|
@ -1010,13 +1010,13 @@ namespace OpenTK.Audio
|
|||
/// <summary>This function deletes one AuxiliaryEffectSlot only.</summary>
|
||||
/// <param name="slot">Pointer to an auxiliary effect slot name/handle identifying the Auxiliary Effect Slot Object to be deleted.</param>
|
||||
[CLSCompliant(false)]
|
||||
public void DeleteAuxiliaryEffectSlot( ref uint slot)
|
||||
public void DeleteAuxiliaryEffectSlot(ref uint slot)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed ( uint* ptr = &slot )
|
||||
fixed (uint* ptr = &slot)
|
||||
{
|
||||
Imported_alDeleteAuxiliaryEffectSlots( 1, ptr );
|
||||
Imported_alDeleteAuxiliaryEffectSlots(1, ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1044,7 +1044,7 @@ namespace OpenTK.Audio
|
|||
/// <summary>The IsAuxiliaryEffectSlot function is used to determine if an object identifier is a valid Auxiliary Effect Slot object.</summary>
|
||||
/// <param name="slot">Effect Slot object identifier to validate.</param>
|
||||
/// <returns>True if the identifier is a valid Auxiliary Effect Slot, False otherwise.</returns>
|
||||
|
||||
|
||||
public bool IsAuxiliaryEffectSlot(int slot)
|
||||
{
|
||||
return Imported_alIsAuxiliaryEffectSlot((uint)slot);
|
||||
|
@ -1075,7 +1075,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="asid">Auxiliary Effect Slot object identifier.</param>
|
||||
/// <param name="param">Auxiliary Effect Slot property to set.</param>
|
||||
/// <param name="value">Integer value.</param>
|
||||
|
||||
|
||||
public void AuxiliaryEffectSlot(int asid, EfxAuxiliaryi param, int value)
|
||||
{
|
||||
Imported_alAuxiliaryEffectSloti((uint)asid, param, value);
|
||||
|
@ -1106,7 +1106,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="asid">Auxiliary Effect Slot object identifier.</param>
|
||||
/// <param name="param">Auxiliary Effect Slot property to set.</param>
|
||||
/// <param name="value">Floating point value.</param>
|
||||
|
||||
|
||||
public void AuxiliaryEffectSlot(int asid, EfxAuxiliaryf param, float value)
|
||||
{
|
||||
Imported_alAuxiliaryEffectSlotf((uint)asid, param, value);
|
||||
|
@ -1143,7 +1143,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="asid">Auxiliary Effect Slot object identifier.</param>
|
||||
/// <param name="pname">Auxiliary Effect Slot property to retrieve.</param>
|
||||
/// <param name="value">Address where integer value will be stored.</param>
|
||||
|
||||
|
||||
public void GetAuxiliaryEffectSlot(int asid, EfxAuxiliaryi pname, out int value)
|
||||
{
|
||||
GetAuxiliaryEffectSlot((uint)asid, pname, out value);
|
||||
|
@ -1180,7 +1180,7 @@ namespace OpenTK.Audio
|
|||
/// <param name="asid">Auxiliary Effect Slot object identifier.</param>
|
||||
/// <param name="pname">Auxiliary Effect Slot property to retrieve.</param>
|
||||
/// <param name="value">Address where floating point value will be stored.</param>
|
||||
|
||||
|
||||
public void GetAuxiliaryEffectSlot(int asid, EfxAuxiliaryf pname, out float value)
|
||||
{
|
||||
GetAuxiliaryEffectSlot((uint)asid, pname, out value);
|
||||
|
@ -1282,4 +1282,4 @@ namespace OpenTK.Audio
|
|||
|
||||
#endregion Constructor / Extension Loading
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ namespace OpenTK.Audio
|
|||
{
|
||||
|
||||
///<summary>The X-Ram Extension is provided on the top-end Sound Blaster X-Fi solutions (Sound Blaster X-Fi Fatal1ty, Sound Blaster X-Fi Elite Pro, or later). These products feature 64MB of X-Ram that can only be used for audio purposes, which can be controlled by this Extension.</summary>
|
||||
[CLSCompliant( true )]
|
||||
[CLSCompliant(true)]
|
||||
public sealed class XRamExtension
|
||||
{
|
||||
#region Instance state
|
||||
|
@ -33,11 +33,11 @@ namespace OpenTK.Audio
|
|||
#region X-RAM Function pointer definitions
|
||||
|
||||
// [CLSCompliant(false)]
|
||||
private delegate bool Delegate_SetBufferMode( int n, ref uint buffers, int value );
|
||||
private delegate bool Delegate_SetBufferMode(int n, ref uint buffers, int value);
|
||||
//typedef ALboolean (__cdecl *EAXSetBufferMode)(ALsizei n, ALuint *buffers, ALint value);
|
||||
|
||||
// [CLSCompliant( false )]
|
||||
private delegate int Delegate_GetBufferMode( uint buffer, IntPtr value );
|
||||
private delegate int Delegate_GetBufferMode(uint buffer, IntPtr value);
|
||||
//typedef ALenum (__cdecl *EAXGetBufferMode)(ALuint buffer, ALint *value);
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -56,27 +56,27 @@ namespace OpenTK.Audio
|
|||
|
||||
#region Constructor / Extension Loading
|
||||
|
||||
public XRamExtension( )
|
||||
public XRamExtension()
|
||||
{ // Query if Extension supported and retrieve Tokens/Pointers if it is.
|
||||
_valid = false;
|
||||
if ( AL.IsExtensionPresent( "EAX-RAM" ) == false )
|
||||
if (AL.IsExtensionPresent("EAX-RAM") == false)
|
||||
return;
|
||||
|
||||
AL_EAX_RAM_SIZE = AL.GetEnumValue( "AL_EAX_RAM_SIZE" );
|
||||
AL_EAX_RAM_FREE = AL.GetEnumValue( "AL_EAX_RAM_FREE" );
|
||||
AL_STORAGE_AUTOMATIC = AL.GetEnumValue( "AL_STORAGE_AUTOMATIC" );
|
||||
AL_STORAGE_HARDWARE = AL.GetEnumValue( "AL_STORAGE_HARDWARE" );
|
||||
AL_STORAGE_ACCESSIBLE = AL.GetEnumValue( "AL_STORAGE_ACCESSIBLE" );
|
||||
AL_EAX_RAM_SIZE = AL.GetEnumValue("AL_EAX_RAM_SIZE");
|
||||
AL_EAX_RAM_FREE = AL.GetEnumValue("AL_EAX_RAM_FREE");
|
||||
AL_STORAGE_AUTOMATIC = AL.GetEnumValue("AL_STORAGE_AUTOMATIC");
|
||||
AL_STORAGE_HARDWARE = AL.GetEnumValue("AL_STORAGE_HARDWARE");
|
||||
AL_STORAGE_ACCESSIBLE = AL.GetEnumValue("AL_STORAGE_ACCESSIBLE");
|
||||
|
||||
// Console.WriteLine("RamSize: {0} RamFree: {1} StorageAuto: {2} StorageHW: {3} StorageAccess: {4}",AL_EAX_RAM_SIZE,AL_EAX_RAM_FREE,AL_STORAGE_AUTOMATIC,AL_STORAGE_HARDWARE,AL_STORAGE_ACCESSIBLE);
|
||||
|
||||
if ( AL_EAX_RAM_SIZE == 0 ||
|
||||
if (AL_EAX_RAM_SIZE == 0 ||
|
||||
AL_EAX_RAM_FREE == 0 ||
|
||||
AL_STORAGE_AUTOMATIC == 0 ||
|
||||
AL_STORAGE_HARDWARE == 0 ||
|
||||
AL_STORAGE_ACCESSIBLE == 0 )
|
||||
AL_STORAGE_ACCESSIBLE == 0)
|
||||
{
|
||||
Debug.WriteLine( "X-Ram: Token values could not be retrieved." );
|
||||
Debug.WriteLine("X-Ram: Token values could not be retrieved.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -84,11 +84,12 @@ namespace OpenTK.Audio
|
|||
|
||||
try
|
||||
{
|
||||
Imported_GetBufferMode = (Delegate_GetBufferMode) Marshal.GetDelegateForFunctionPointer( AL.GetProcAddress( "EAXGetBufferMode" ), typeof( Delegate_GetBufferMode ) );
|
||||
Imported_SetBufferMode = (Delegate_SetBufferMode) Marshal.GetDelegateForFunctionPointer( AL.GetProcAddress( "EAXSetBufferMode" ), typeof( Delegate_SetBufferMode ) );
|
||||
} catch ( Exception e )
|
||||
Imported_GetBufferMode = (Delegate_GetBufferMode)Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("EAXGetBufferMode"), typeof(Delegate_GetBufferMode));
|
||||
Imported_SetBufferMode = (Delegate_SetBufferMode)Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("EAXSetBufferMode"), typeof(Delegate_SetBufferMode));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.WriteLine( "X-Ram: Attempt to marshal function pointers with AL.GetProcAddress failed. " + e.ToString( ) );
|
||||
Debug.WriteLine("X-Ram: Attempt to marshal function pointers with AL.GetProcAddress failed. " + e.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -100,15 +101,15 @@ namespace OpenTK.Audio
|
|||
#region Public Methods
|
||||
|
||||
/// <summary>Query total amount of X-RAM in bytes.</summary>
|
||||
public int GetRamSize( )
|
||||
public int GetRamSize()
|
||||
{
|
||||
return AL.Get( (ALGetInteger) AL_EAX_RAM_SIZE );
|
||||
return AL.Get((ALGetInteger)AL_EAX_RAM_SIZE);
|
||||
}
|
||||
|
||||
/// <summary>Query free X-RAM available in bytes.</summary>
|
||||
public int GetRamFree( )
|
||||
public int GetRamFree()
|
||||
{
|
||||
return AL.Get( (ALGetInteger) AL_EAX_RAM_FREE );
|
||||
return AL.Get((ALGetInteger)AL_EAX_RAM_FREE);
|
||||
}
|
||||
|
||||
/// <summary>This enum is used to abstract the need of using AL.GetEnumValue() with the Extension. The values do NOT correspond to AL_STORAGE_* tokens!</summary>
|
||||
|
@ -127,17 +128,17 @@ namespace OpenTK.Audio
|
|||
/// <param name="buffer">An array of OpenAL Buffer handles.</param>
|
||||
/// <param name="mode">The storage mode that should be used for all the given buffers. Should be the value of one of the following enum names: XRamStorage.Automatic, XRamStorage.Hardware, XRamStorage.Accessible</param>
|
||||
/// <returns>True if all the Buffers were successfully set to the requested storage mode, False otherwise.</returns>
|
||||
[CLSCompliant( false )]
|
||||
public bool SetBufferMode( int n, ref uint buffer, XRamStorage mode )
|
||||
[CLSCompliant(false)]
|
||||
public bool SetBufferMode(int n, ref uint buffer, XRamStorage mode)
|
||||
{
|
||||
switch ( mode )
|
||||
switch (mode)
|
||||
{
|
||||
case XRamStorage.Accessible:
|
||||
return Imported_SetBufferMode( n, ref buffer, AL_STORAGE_ACCESSIBLE );
|
||||
case XRamStorage.Hardware:
|
||||
return Imported_SetBufferMode( n, ref buffer, AL_STORAGE_HARDWARE );
|
||||
default:
|
||||
return Imported_SetBufferMode( n, ref buffer, AL_STORAGE_AUTOMATIC );
|
||||
case XRamStorage.Accessible:
|
||||
return Imported_SetBufferMode(n, ref buffer, AL_STORAGE_ACCESSIBLE);
|
||||
case XRamStorage.Hardware:
|
||||
return Imported_SetBufferMode(n, ref buffer, AL_STORAGE_HARDWARE);
|
||||
default:
|
||||
return Imported_SetBufferMode(n, ref buffer, AL_STORAGE_AUTOMATIC);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,24 +147,24 @@ namespace OpenTK.Audio
|
|||
/// <param name="buffer">An array of OpenAL Buffer handles.</param>
|
||||
/// <param name="mode">The storage mode that should be used for all the given buffers. Should be the value of one of the following enum names: XRamStorage.Automatic, XRamStorage.Hardware, XRamStorage.Accessible</param>
|
||||
/// <returns>True if all the Buffers were successfully set to the requested storage mode, False otherwise.</returns>
|
||||
[CLSCompliant( true )]
|
||||
public bool SetBufferMode( int n, ref int buffer, XRamStorage mode )
|
||||
[CLSCompliant(true)]
|
||||
public bool SetBufferMode(int n, ref int buffer, XRamStorage mode)
|
||||
{
|
||||
uint temp = (uint) buffer;
|
||||
return SetBufferMode( n, ref temp, mode );
|
||||
uint temp = (uint)buffer;
|
||||
return SetBufferMode(n, ref temp, mode);
|
||||
}
|
||||
|
||||
/// <summary>This function is used to retrieve the storage Mode of a single OpenAL Buffer.</summary>
|
||||
/// <param name="buffer">The handle of an OpenAL Buffer.</param>
|
||||
/// <returns>The current Mode of the Buffer.</returns>
|
||||
[CLSCompliant( false )]
|
||||
public XRamStorage GetBufferMode( ref uint buffer )
|
||||
[CLSCompliant(false)]
|
||||
public XRamStorage GetBufferMode(ref uint buffer)
|
||||
{
|
||||
int tempresult = Imported_GetBufferMode( buffer, IntPtr.Zero ); // IntPtr.Zero due to the parameter being unused/reserved atm
|
||||
int tempresult = Imported_GetBufferMode(buffer, IntPtr.Zero); // IntPtr.Zero due to the parameter being unused/reserved atm
|
||||
|
||||
if ( tempresult == AL_STORAGE_ACCESSIBLE )
|
||||
if (tempresult == AL_STORAGE_ACCESSIBLE)
|
||||
return XRamStorage.Accessible;
|
||||
if ( tempresult == AL_STORAGE_HARDWARE )
|
||||
if (tempresult == AL_STORAGE_HARDWARE)
|
||||
return XRamStorage.Hardware;
|
||||
// default:
|
||||
return XRamStorage.Automatic;
|
||||
|
@ -172,14 +173,15 @@ namespace OpenTK.Audio
|
|||
/// <summary>This function is used to retrieve the storage Mode of a single OpenAL Buffer.</summary>
|
||||
/// <param name="buffer">The handle of an OpenAL Buffer.</param>
|
||||
/// <returns>The current Mode of the Buffer.</returns>
|
||||
[CLSCompliant( true )]
|
||||
public XRamStorage GetBufferMode( ref int buffer )
|
||||
[CLSCompliant(true)]
|
||||
public XRamStorage GetBufferMode(ref int buffer)
|
||||
{
|
||||
uint temp = (uint) buffer;
|
||||
return GetBufferMode( ref temp );
|
||||
uint temp = (uint)buffer;
|
||||
return GetBufferMode(ref temp);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue