Added overloads:

GenSource( out uint )
GenBuffer( out uint )
DeleteSource and DeleteBuffer changed to use 'ref' keyword to be consistent with Gen functions.
GenEffect( out uint )
DeleteEffect( ref uint )
GenFilter( out uint )
DeleteFilter( ref uint )
GenAuxiliaryEffectSlot( out uint );
DeleteAuxiliaryEffectSlot( ref uint ) (changed from previously passing by value, and removed the 's' in name )
renamed "DeleteAuxiliaryEffectSlots( int slot )" to "DeleteAuxiliaryEffectSlot( int slot )"
renamed "int GenAuxiliaryEffectSlots()" to "int GenAuxiliaryEffectSlot()"
New:
ALSourceType GetSourceType( uint sid )
ALSourceState GetSourceState( uint sid )
ALDistanceModel GetDistanceModel( )
This commit is contained in:
chrisbrandtner 2008-06-12 19:44:46 +00:00
parent c63102621f
commit b8989d5d56
2 changed files with 161 additions and 12 deletions

View file

@ -16,7 +16,7 @@ using OpenTK.Math;
/* Type Mapping
// 8-bit boolean
typedef char ALboolean;
* byte
* bool
// character
typedef char ALchar;
* byte
@ -26,7 +26,7 @@ typedef char ALbyte;
// unsigned 8-bit integer
typedef unsigned char ALubyte;
* ubyte
* byte
// signed 16-bit 2's complement integer
typedef short ALshort;
@ -67,6 +67,7 @@ namespace OpenTK.Audio
{
public static partial class AL
{
#region Constants
public const string Lib = "openal32.dll";
@ -441,6 +442,14 @@ namespace OpenTK.Audio
return (int)temp;
}
/// <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 )
{
GenSources( 1, out source );
}
#endregion GenSources()
#region DeleteSources()
@ -490,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(uint source)
public static void DeleteSource( ref uint source)
{
DeleteSources(1, ref source);
}
@ -1305,6 +1314,14 @@ namespace OpenTK.Audio
return (int)temp;
}
/// <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 )
{
GenBuffers( 1, out buffer );
}
#endregion GenBuffers
#region DeleteBuffers
@ -1355,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(uint buffer)
public static void DeleteBuffer( ref uint buffer)
{
DeleteBuffers(1, ref buffer);
}
@ -1363,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);
}
@ -1560,5 +1577,59 @@ namespace OpenTK.Audio
// AL_API void AL_APIENTRY alDistanceModel( ALenum distanceModel );
#endregion Global Parameters
#region Helpers
/// <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 )
{
int 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 )
{
int 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 )
{
int 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 )
{
int temp;
AL.GetSource( sid, ALGetSourcei.SourceType, out temp );
return (ALSourceType) temp;
}
[CLSCompliant( true )]
public static ALDistanceModel GetDistanceModel( )
{
return (ALDistanceModel) AL.Get( ALGetInteger.DistanceModel );
}
#endregion Helpers
}
}

View file

@ -17,6 +17,7 @@ namespace OpenTK.Audio
{
public partial class EffectsExtension
{
#region Helpers
#region BindEffect
@ -184,6 +185,22 @@ namespace OpenTK.Audio
return temp;
}
/// <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 )
{
unsafe
{
fixed ( uint* ptr = &effect )
{
Imported_alGenEffects( 1, ptr );
effect = *ptr;
}
}
}
#endregion alGenEffects
#region alDeleteEffects
@ -244,10 +261,21 @@ namespace OpenTK.Audio
/// <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>
public void DeleteEffect(int 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 )
{
unsafe
{
Imported_alDeleteEffects(1, (uint*)&effect);
fixed ( uint* ptr = &effect )
{
Imported_alDeleteEffects( 1, ptr );
}
}
}
@ -560,7 +588,7 @@ namespace OpenTK.Audio
}
/// <summary>This function generates only one Filter.</summary>
/// <returns>Storage UInt32 for the new filter name/handle.</returns>
/// <returns>Storage Int32 for the new filter name/handle.</returns>
public int GenFilter()
{
int filter;
@ -568,6 +596,21 @@ namespace OpenTK.Audio
return filter;
}
/// <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
{
fixed ( uint* ptr = &filter )
{
Imported_alGenFilters( 1, ptr );
filter = *ptr;
}
}
}
#endregion alGenFilters
#region alDeleteFilters
@ -632,6 +675,20 @@ namespace OpenTK.Audio
DeleteFilters(1, ref filter);
}
/// <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 )
{
unsafe
{
fixed ( uint* ptr = &filter )
{
Imported_alDeleteFilters( 1, ptr );
}
}
}
#endregion alDeleteFilters
#region alIsFilter
@ -864,14 +921,29 @@ 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>
public int GenAuxiliaryEffectSlots()
/// <returns>Storage Int32 for the new auxiliary effect slot name/handle.</returns>
public int GenAuxiliaryEffectSlot()
{
int temp;
GenAuxiliaryEffectSlots(1, out temp);
return temp;
}
/// <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 )
{
unsafe
{
fixed ( uint* ptr = &slot )
{
Imported_alGenAuxiliaryEffectSlots( 1, ptr );
slot = *ptr;
}
}
}
#endregion alGenAuxiliaryEffectSlots
#region DeleteAuxiliaryEffectSlots
@ -930,7 +1002,7 @@ 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>
public void DeleteAuxiliaryEffectSlots(int slot)
public void DeleteAuxiliaryEffectSlot(int slot)
{
DeleteAuxiliaryEffectSlots(1, ref slot);
}
@ -938,9 +1010,15 @@ 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 DeleteAuxiliaryEffectSlots(uint slot)
public void DeleteAuxiliaryEffectSlot( ref uint slot)
{
DeleteAuxiliaryEffectSlots(1, ref slot);
unsafe
{
fixed ( uint* ptr = &slot )
{
Imported_alDeleteAuxiliaryEffectSlots( 1, ptr );
}
}
}
#endregion alDeleteAuxiliaryEffectSlots