OpenTK.Audio.OpenAL.XRamExtension Class Reference

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>. More...

List of all members.

Public Types

enum  XRamStorage { Automatic = 0, Hardware = 1, Accessible = 2 }
 

This enum is used to abstract the need of using AL.GetEnumValue() with the Extension. The values do NOT correspond to AL_STORAGE_* tokens!

More...

Public Member Functions

 XRamExtension ()
 Constructs a new XRamExtension instance.
bool SetBufferMode (int n, ref uint buffer, XRamStorage mode)
 This function is used to set the storage Mode of an array of OpenAL Buffers.
bool SetBufferMode (int n, ref int buffer, XRamStorage mode)
 This function is used to set the storage Mode of an array of OpenAL Buffers.
XRamStorage GetBufferMode (ref uint buffer)
 This function is used to retrieve the storage Mode of a single OpenAL Buffer.
XRamStorage GetBufferMode (ref int buffer)
 This function is used to retrieve the storage Mode of a single OpenAL Buffer.

Properties

bool IsInitialized [get]
 Returns True if the X-Ram Extension has been found and could be initialized.
int GetRamSize [get]
 Query total amount of X-RAM in bytes.
int GetRamFree [get]
 Query free X-RAM available in bytes.

Detailed Description

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>.

Definition at line 22 of file XRamExtension.cs.


Member Enumeration Documentation

This enum is used to abstract the need of using AL.GetEnumValue() with the Extension. The values do NOT correspond to AL_STORAGE_* tokens!

Enumerator:
Automatic 

Put an Open AL Buffer into X-RAM if memory is available, otherwise use host RAM. This is the default mode.

Hardware 

Force an Open AL Buffer into X-RAM, good for non-streaming buffers.

Accessible 

Force an Open AL Buffer into 'accessible' (currently host) RAM, good for streaming buffers.

Definition at line 128 of file XRamExtension.cs.

00128                                 : byte
00129         {
00131             Automatic = 0,
00133             Hardware = 1,
00135             Accessible = 2,
00136         }


Constructor & Destructor Documentation

OpenTK.Audio.OpenAL.XRamExtension.XRamExtension (  ) 

Constructs a new XRamExtension instance.

Definition at line 65 of file XRamExtension.cs.

00066         { // Query if Extension supported and retrieve Tokens/Pointers if it is.
00067             _valid = false;
00068             if (AL.IsExtensionPresent("EAX-RAM") == false)
00069                 return;
00070 
00071             AL_EAX_RAM_SIZE = AL.GetEnumValue("AL_EAX_RAM_SIZE");
00072             AL_EAX_RAM_FREE = AL.GetEnumValue("AL_EAX_RAM_FREE");
00073             AL_STORAGE_AUTOMATIC = AL.GetEnumValue("AL_STORAGE_AUTOMATIC");
00074             AL_STORAGE_HARDWARE = AL.GetEnumValue("AL_STORAGE_HARDWARE");
00075             AL_STORAGE_ACCESSIBLE = AL.GetEnumValue("AL_STORAGE_ACCESSIBLE");
00076 
00077             // 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);
00078 
00079             if (AL_EAX_RAM_SIZE == 0 ||
00080                  AL_EAX_RAM_FREE == 0 ||
00081                  AL_STORAGE_AUTOMATIC == 0 ||
00082                  AL_STORAGE_HARDWARE == 0 ||
00083                  AL_STORAGE_ACCESSIBLE == 0)
00084             {
00085                 Debug.WriteLine("X-Ram: Token values could not be retrieved.");
00086                 return;
00087             }
00088 
00089             // Console.WriteLine("Free Ram: {0} / {1}",GetRamFree( ),GetRamSize( ));
00090 
00091             try
00092             {
00093                 Imported_GetBufferMode = (Delegate_GetBufferMode)Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("EAXGetBufferMode"), typeof(Delegate_GetBufferMode));
00094                 Imported_SetBufferMode = (Delegate_SetBufferMode)Marshal.GetDelegateForFunctionPointer(AL.GetProcAddress("EAXSetBufferMode"), typeof(Delegate_SetBufferMode));
00095             }
00096             catch (Exception e)
00097             {
00098                 Debug.WriteLine("X-Ram: Attempt to marshal function pointers with AL.GetProcAddress failed. " + e.ToString());
00099                 return;
00100             }
00101 
00102             _valid = true;
00103         }


Member Function Documentation

XRamStorage OpenTK.Audio.OpenAL.XRamExtension.GetBufferMode ( ref int  buffer  ) 

This function is used to retrieve the storage Mode of a single OpenAL Buffer.

Parameters:
buffer The handle of an OpenAL Buffer.
Returns:
The current Mode of the Buffer.

Definition at line 189 of file XRamExtension.cs.

00190         {
00191             uint temp = (uint)buffer;
00192             return GetBufferMode(ref temp);
00193         }

XRamStorage OpenTK.Audio.OpenAL.XRamExtension.GetBufferMode ( ref uint  buffer  ) 

This function is used to retrieve the storage Mode of a single OpenAL Buffer.

Parameters:
buffer The handle of an OpenAL Buffer.
Returns:
The current Mode of the Buffer.

Definition at line 173 of file XRamExtension.cs.

00174         {
00175             int tempresult = Imported_GetBufferMode(buffer, IntPtr.Zero); // IntPtr.Zero due to the parameter being unused/reserved atm
00176 
00177             if (tempresult == AL_STORAGE_ACCESSIBLE)
00178                 return XRamStorage.Accessible;
00179             if (tempresult == AL_STORAGE_HARDWARE)
00180                 return XRamStorage.Hardware;
00181             // default:
00182             return XRamStorage.Automatic;
00183         }

bool OpenTK.Audio.OpenAL.XRamExtension.SetBufferMode ( int  n,
ref int  buffer,
XRamStorage  mode 
)

This function is used to set the storage Mode of an array of OpenAL Buffers.

Parameters:
n The number of OpenAL Buffers pointed to by buffer.
buffer An array of OpenAL Buffer handles.
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
Returns:
True if all the Buffers were successfully set to the requested storage mode, False otherwise.

Definition at line 163 of file XRamExtension.cs.

00164         {
00165             uint temp = (uint)buffer;
00166             return SetBufferMode(n, ref temp, mode);
00167         }

bool OpenTK.Audio.OpenAL.XRamExtension.SetBufferMode ( int  n,
ref uint  buffer,
XRamStorage  mode 
)

This function is used to set the storage Mode of an array of OpenAL Buffers.

Parameters:
n The number of OpenAL Buffers pointed to by buffer.
buffer An array of OpenAL Buffer handles.
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
Returns:
True if all the Buffers were successfully set to the requested storage mode, False otherwise.

Definition at line 144 of file XRamExtension.cs.

00145         {
00146             switch (mode)
00147             {
00148                 case XRamStorage.Accessible:
00149                     return Imported_SetBufferMode(n, ref buffer, AL_STORAGE_ACCESSIBLE);
00150                 case XRamStorage.Hardware:
00151                     return Imported_SetBufferMode(n, ref buffer, AL_STORAGE_HARDWARE);
00152                 default:
00153                     return Imported_SetBufferMode(n, ref buffer, AL_STORAGE_AUTOMATIC);
00154             }
00155         }


Property Documentation

int OpenTK.Audio.OpenAL.XRamExtension.GetRamFree [get]

Query free X-RAM available in bytes.

Definition at line 120 of file XRamExtension.cs.

int OpenTK.Audio.OpenAL.XRamExtension.GetRamSize [get]

Query total amount of X-RAM in bytes.

Definition at line 111 of file XRamExtension.cs.

bool OpenTK.Audio.OpenAL.XRamExtension.IsInitialized [get]

Returns True if the X-Ram Extension has been found and could be initialized.

Definition at line 30 of file XRamExtension.cs.

 All Classes Functions Variables Enumerations Properties Events

Generated on Tue Mar 9 14:59:21 2010 for The Open Toolkit library by  doxygen 1.6.1