Difference between revisions of "Unit Audio"

From Ultibo.org
Jump to: navigation, search
Line 207: Line 207:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Called only during system startup
 
| Called only during system startup
 
|-
 
|-
Line 222: Line 222:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Audio'''
+
! Audio
 
| The Audio device to get properties from
 
| The Audio device to get properties from
 
|-
 
|-
! '''Properties'''
+
! Properties
 
| Pointer to a TAudioProperties structure to fill in
 
| Pointer to a TAudioProperties structure to fill in
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 240: Line 240:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Return'''
+
! Return
 
| Pointer to new Audio device entry or nil if Audio device could not be created
 
| Pointer to new Audio device entry or nil if Audio device could not be created
 
|-
 
|-
Line 252: Line 252:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Size'''
+
! Size
 
| Size in bytes to allocate for new Audio device (Including the Audio device entry)
 
| Size in bytes to allocate for new Audio device (Including the Audio device entry)
 
|-
 
|-
! '''Return'''
+
! Return
 
| Pointer to new Audio device entry or nil if Audio device could not be created
 
| Pointer to new Audio device entry or nil if Audio device could not be created
 
|-
 
|-
Line 267: Line 267:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 279: Line 279:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 291: Line 291:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 303: Line 303:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 315: Line 315:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 327: Line 327:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 339: Line 339:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 351: Line 351:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 366: Line 366:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 378: Line 378:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 390: Line 390:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 402: Line 402:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 414: Line 414:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 426: Line 426:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 438: Line 438:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 450: Line 450:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 462: Line 462:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-

Revision as of 00:39, 20 April 2018

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; inline;
Description: Get the current Audio device count
Note None documented


function AudioDeviceGetDefault:PAudioDevice; inline;
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