Difference between revisions of "Unit Audio"

From Ultibo.org
Jump to: navigation, search
(Created page with "Return to Unit Reference === Description === ---- ''To be documented'' === Constants === ---- ''To be documented'' === Type definitions === ---- ''To...")
 
 
(8 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
''To be documented''
+
'''Ultibo Audio Interface unit'''
 +
 
 +
This unit provides both the Audio device interface and the generic USB audio device driver.
  
 
=== Constants ===
 
=== Constants ===
 
----
 
----
  
''To be documented''
+
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Audio specific constants''' <code> AUDIO_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>AUDIO_NAME_PREFIX = 'Audio';</code>
 +
| Name prefix for Audio Devices
 +
|-
 +
|}
 +
</div></div>
 +
<br /> 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Audio device types''' <code> AUDIO_TYPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>AUDIO_TYPE_NONE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br /> 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Audio device states''' <code> AUDIO_STATE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>AUDIO_STATE_DISABLED = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>AUDIO_STATE_ENABLED = 1;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br /> 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Audio device flags''' <code> AUDIO_FLAG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>AUDIO_FLAG_NONE = $00000000;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br /> 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Audio logging''' <code> AUDIO_LOG_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>AUDIO_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG;</code>
 +
| Audio debugging messages
 +
|-
 +
| <code>AUDIO_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code>
 +
| Audio informational messages, such as a device being attached or detached
 +
|-
 +
| <code>AUDIO_LOG_LEVEL_WARN = LOG_LEVEL_WARN;</code>
 +
| Audio warning messages
 +
|-
 +
| <code>AUDIO_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code>
 +
| Audio error messages
 +
|-
 +
| <code>AUDIO_LOG_LEVEL_NONE = LOG_LEVEL_NONE;</code>
 +
| No Audio messages
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Type definitions ===
 
=== Type definitions ===
 
----
 
----
  
''To be documented''
+
 
 +
'''Audio properties'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PAudioProperties = ^TAudioProperties;</code>
 +
 
 +
<code>TAudioProperties = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Flags:LongWord;</code>
 +
| Device flags (eg AUDIO_FLAG_????)
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Audio enumeration callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TAudioEnumerate = function(Audio:PAudioDevice; Data:Pointer):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Audio notification callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TAudioNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Audio device get properties'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TAudioDeviceGetProperties = function(Audio:PAudioDevice; Properties:PAudioProperties):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Audio device'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PAudioDevice = ^TAudioDevice;</code>
 +
 
 +
<code>TAudioDevice = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Device Properties''
 +
|-
 +
| <code>Device:TDevice;</code>
 +
| The Device entry for this Audio device
 +
|-
 +
|colspan="2"|''Audio Properties''
 +
|-
 +
| <code>AudioId:LongWord;</code>
 +
| Unique Id of this Audio device in the Audio device table
 +
|-
 +
| <code>AudioState:LongWord;</code>
 +
| Audio device state (eg AUDIO_STATE_ENABLED)
 +
|-
 +
| <code>DeviceGetProperties:TAudioDeviceGetProperties;</code>
 +
| A Device specific DeviceGetProperties method implementing the standard Audio device interface (Or nil if the default method is suitable)
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>Lock:TMutexHandle;</code>
 +
| Device lock
 +
|-
 +
| <code>Properties:TAudioProperties;</code>
 +
| Device properties
 +
|-
 +
|colspan="2"|''Internal Properties''
 +
|-
 +
| <code>Prev:PAudioDevice;</code>
 +
| Previous entry in Audio device table
 +
|-
 +
| <code>Next:PAudioDevice;</code>
 +
| Next entry in Audio device table
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
  
''To be documented''
+
 
 +
'''Audio logging'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>AUDIO_DEFAULT_LOG_LEVEL:LongWord = AUDIO_LOG_LEVEL_DEBUG;</code>
 +
| style="width: 40%;"|Minimum level for Audio messages. Only messages with level greater than or equal to this will be printed.
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>AUDIO_LOG_ENABLED:Boolean; </code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
<br />
  
 
=== Function declarations ===
 
=== Function declarations ===
 
----
 
----
  
''To be documented''
 
  
 +
'''Initialization functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure AudioInit;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the Audio unit and Audio device table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Called only during system startup
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''Audio device functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioDeviceGetProperties(Audio:PAudioDevice; Properties:PAudioProperties):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the properties for the specified Audio device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Audio
 +
| The Audio device to get properties from
 +
|-
 +
! Properties
 +
| Pointer to a TAudioProperties structure to fill in
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioDeviceCreate:PAudioDevice;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new Audio device entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Return
 +
| Pointer to new Audio device entry or nil if Audio device could not be created
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioDeviceCreateEx(Size:LongWord):PAudioDevice;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create a new Audio device entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Size
 +
| Size in bytes to allocate for new Audio device (Including the Audio device entry)
 +
|-
 +
! Return
 +
| Pointer to new Audio device entry or nil if Audio device could not be created
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioDeviceDestroy(Audio:PAudioDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Destroy an existing Audio device entry</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioDeviceRegister(Audio:PAudioDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Register a new Audio device in the Audio device table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioDeviceDeregister(Audio:PAudioDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Deregister an Audio device from the Audio device table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioDeviceFind(AudioId:LongWord):PAudioDevice;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioDeviceFindByName(const Name:String):PAudioDevice; inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioDeviceFindByDescription(const Description:String):PAudioDevice; inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioDeviceEnumerate(Callback:TAudioEnumerate; Data:Pointer):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioDeviceNotification(Audio:PAudioDevice; Callback:TAudioNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''Audio helper functions'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioGetCount:LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current Audio device count</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioDeviceGetDefault:PAudioDevice;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default Audio device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioDeviceSetDefault(Audio:PAudioDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the current default Audio device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function AudioDeviceCheck(Audio:PAudioDevice):PAudioDevice;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Check if the supplied Audio device is in the Audio device table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure AudioLog(Level:LongWord; Audio:PAudioDevice; const AText:String);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure AudioLogInfo(Audio:PAudioDevice; const AText:String); inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure AudioLogWarn(Audio:PAudioDevice; const AText:String); inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure AudioLogError(Audio:PAudioDevice; const AText:String); inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure AudioLogDebug(Audio:PAudioDevice; const AText:String); inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
Return to [[Unit_Reference|Unit Reference]]
 
Return to [[Unit_Reference|Unit Reference]]

Latest revision as of 04:03, 15 December 2022

Return to Unit Reference


Description


Ultibo Audio Interface unit

This unit provides both the Audio device interface and the generic USB audio device driver.

Constants



Audio specific constants AUDIO_*
AUDIO_NAME_PREFIX = 'Audio'; Name prefix for Audio Devices


Audio device types AUDIO_TYPE_*
AUDIO_TYPE_NONE = 0;  


Audio device states AUDIO_STATE_*
AUDIO_STATE_DISABLED = 0;  
AUDIO_STATE_ENABLED = 1;  


Audio device flags AUDIO_FLAG_*
AUDIO_FLAG_NONE = $00000000;  


Audio logging AUDIO_LOG_*
AUDIO_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG; Audio debugging messages
AUDIO_LOG_LEVEL_INFO = LOG_LEVEL_INFO; Audio informational messages, such as a device being attached or detached
AUDIO_LOG_LEVEL_WARN = LOG_LEVEL_WARN; Audio warning messages
AUDIO_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR; Audio error messages
AUDIO_LOG_LEVEL_NONE = LOG_LEVEL_NONE; No Audio messages


Type definitions



Audio properties

PAudioProperties = ^TAudioProperties;

TAudioProperties = record

Flags:LongWord; Device flags (eg AUDIO_FLAG_????)

Audio enumeration callback

TAudioEnumerate = function(Audio:PAudioDevice; Data:Pointer):LongWord;

Audio notification callback

TAudioNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

Audio device get properties

TAudioDeviceGetProperties = function(Audio:PAudioDevice; Properties:PAudioProperties):LongWord;

Audio device

PAudioDevice = ^TAudioDevice;

TAudioDevice = record

Device Properties
Device:TDevice; The Device entry for this Audio device
Audio Properties
AudioId:LongWord; Unique Id of this Audio device in the Audio device table
AudioState:LongWord; Audio device state (eg AUDIO_STATE_ENABLED)
DeviceGetProperties:TAudioDeviceGetProperties; A Device specific DeviceGetProperties method implementing the standard Audio device interface (Or nil if the default method is suitable)
Driver Properties
Lock:TMutexHandle; Device lock
Properties:TAudioProperties; Device properties
Internal Properties
Prev:PAudioDevice; Previous entry in Audio device table
Next:PAudioDevice; Next entry in Audio device table


Public variables



Audio logging

AUDIO_DEFAULT_LOG_LEVEL:LongWord = AUDIO_LOG_LEVEL_DEBUG; Minimum level for Audio messages. Only messages with level greater than or equal to this will be printed.
AUDIO_LOG_ENABLED:Boolean;


Function declarations



Initialization functions

procedure AudioInit;
Description: Initialize the Audio unit and Audio device table
Note Called only during system startup


Audio device functions

function AudioDeviceGetProperties(Audio:PAudioDevice; Properties:PAudioProperties):LongWord;
Description: Get the properties for the specified Audio device
Audio The Audio device to get properties from
Properties Pointer to a TAudioProperties structure to fill in
Return ERROR_SUCCESS if completed or another error code on failure


function AudioDeviceCreate:PAudioDevice;
Description: Create a new Audio device entry
Return Pointer to new Audio device entry or nil if Audio device could not be created


function AudioDeviceCreateEx(Size:LongWord):PAudioDevice;
Description: Create a new Audio device entry
Size Size in bytes to allocate for new Audio device (Including the Audio device entry)
Return Pointer to new Audio device entry or nil if Audio device could not be created


function AudioDeviceDestroy(Audio:PAudioDevice):LongWord;
Description: Destroy an existing Audio device entry
Note None documented


function AudioDeviceRegister(Audio:PAudioDevice):LongWord;
Description: Register a new Audio device in the Audio device table
Note None documented


function AudioDeviceDeregister(Audio:PAudioDevice):LongWord;
Description: Deregister an Audio device from the Audio device table
Note None documented


function AudioDeviceFind(AudioId:LongWord):PAudioDevice;
Description: To be documented
Note None documented


function AudioDeviceFindByName(const Name:String):PAudioDevice; inline;
Description: To be documented
Note None documented


function AudioDeviceFindByDescription(const Description:String):PAudioDevice; inline;
Description: To be documented
Note None documented


function AudioDeviceEnumerate(Callback:TAudioEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note None documented


function AudioDeviceNotification(Audio:PAudioDevice; Callback:TAudioNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented
Note None documented


Audio helper functions

function AudioGetCount:LongWord;
Description: Get the current Audio device count
Note None documented


function AudioDeviceGetDefault:PAudioDevice;
Description: Get the current default Audio device
Note None documented


function AudioDeviceSetDefault(Audio:PAudioDevice):LongWord;
Description: Set the current default Audio device
Note None documented


function AudioDeviceCheck(Audio:PAudioDevice):PAudioDevice;
Description: Check if the supplied Audio device is in the Audio device table
Note None documented


procedure AudioLog(Level:LongWord; Audio:PAudioDevice; const AText:String);
Description: To be documented
Note None documented


procedure AudioLogInfo(Audio:PAudioDevice; const AText:String); inline;
Description: To be documented
Note None documented


procedure AudioLogWarn(Audio:PAudioDevice; const AText:String); inline;
Description: To be documented
Note None documented


procedure AudioLogError(Audio:PAudioDevice; const AText:String); inline;
Description: To be documented
Note None documented


procedure AudioLogDebug(Audio:PAudioDevice; const AText:String); inline;
Description: To be documented
Note None documented


Return to Unit Reference