Home Units Hierarchy Routines All identifiers

Unit unaMsAcmClasses

DescriptionUsesClasses, Interfaces, Objects and RecordsFunctions and ProceduresTypesConstantsVariables

Description

Contains Microsoft ACM wrapper and core VC wave device classes.

Version 2.5.2009.07: + new getUnVolume() method;

Version 2.5.2008.07: + new callback model; + SetVolume100()/GetVolume() for all wave components; + Silence detection built in into all wave components;

Version 2.5.2010.02: + new VAD mode based on 3GPP codec;

Version 2.5.2010.12: * jitter effect on WaveOut;

Version 2.5.2012.04: * ASIO;

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
record unaAcmDetails  
Class unaMMTimer Multimedia timer wrapper class.
Class unaMsAcm This class holds a list of drivers installed on the system.
Class unaMsAcmCodec This class is wrapper over Windows Multimedia streams API.
Class unaMsAcmCodecHeader This class stores the data used by MS ACM codec.
Class unaMsAcmDeviceHeader Base class for storing the wave and stream headers of wave and ACM devices.
Class unaMsAcmDriver List of installed drivers is maintained by unaMsAcm class, so usually there is no need to create/destroy the driver class explicitly.
Class unaMsAcmFilter This class stores information about the given MS ACM filter.
Class unaMsAcmFilterTag This class stores information about an ACM filter tag.
Class unaMsAcmFormat This class stores information about the given MS ACM format.
Class unaMsAcmFormatTag This class stores information about an ACM format tag.
Class unaMsAcmObject This base class is designed to store an ACM object, such as format or filter.
Class unaMsAcmObjectTag This base class is designed to store the information about an ACM object tag, such as format tag or filter tag.
Class unaMsAcmStreamDevice This is abstract class used as a base for classes dealing with audio streams (codecs, waveIn and waveOut, mixers).
Class unaRiffStream RIFF WAVE stream.
Class unaWaveDevice This abstract class is used as base for unaWaveInDevice (recorder) and unaWaveOutDevice (playback) devices.
Class unaWaveExclusiveMixerDevice This class performs exclusive mixing of input streams.
Class unaWaveInDevice Use this class to record live audio.
Class unaWaveMixerDevice This class performs software mixing of input streams.
Class unaWaveMultiStreamDevice This is base class for devices working with more than two streams.
Class unaWaveOutDevice Use this class to playback PCM audio stream.
Class unaWaveResampler This class can resample audio stream from one PCM format to another.
Class unaWaveSoftwareDevice This is base class for software devices, such as wave mixer.

Functions and Procedures

function mmNoError(errorCode: MMRESULT): bool;
function mmGetErrorCodeText(errorCode: MMRESULT): string;
function mmGetErrorCodeTextEx(errorCode: MMRESULT): string;
function formatChoose(bufW: pACMFORMATCHOOSEW; const title: wString = ''; style: unsigned = ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT; enumFlag: unsigned = 0; enumFormat: pWAVEFORMATEX = nil): MMRESULT;
function formatChooseAlloc(var format: pWAVEFORMATEX; defFormatTag: unsigned = WAVE_FORMAT_PCM; defSamplesPerSec: unsigned = c_defSamplingSamplesPerSec; const title: wString = ''; style: unsigned = ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT; enumFlag: unsigned = 0; enumFormat: pWAVEFORMATEX = nil; formatSize: unsigned = 0; wndHandle: hWnd = 0): MMRESULT;
function formatIsPCM(format: pWAVEFORMATEX): bool; overload;
function formatIsPCM(format: pWAVEFORMATEXTENSIBLE): bool; overload;
function fillPCMFormat(var format: WAVEFORMATEX; samplesPerSecond: unsigned = c_defSamplingSamplesPerSec; bitsPerSample: unsigned = c_defSamplingBitsPerSample; numChannels: unsigned = c_defSamplingNumChannels): pWAVEFORMATEX; overload;
function fillPCMFormat(samplesPerSecond: unsigned = c_defSamplingSamplesPerSec; bitsPerSample: unsigned = c_defSamplingBitsPerSample; numChannels: unsigned = c_defSamplingNumChannels): WAVEFORMATEX; overload;
function fillPCMFormatExt(var format: PWAVEFORMATEXTENSIBLE; samplesPerSecond: unsigned = c_defSamplingSamplesPerSec; containerSize: unsigned = c_defSamplingBitsPerSample; validBitsPerSample: unsigned = c_defSamplingBitsPerSample; numChannels: unsigned = c_defSamplingNumChannels; channelMask: DWORD = SPEAKER_DEFAULT): PWAVEFORMATEXTENSIBLE; overload;
function fillPCMFormatExt(var format: PWAVEFORMATEXTENSIBLE; const subtype: tGuid; samplesPerSecond: unsigned = c_defSamplingSamplesPerSec; containerSize: unsigned = c_defSamplingBitsPerSample; validBitsPerSample: unsigned = c_defSamplingBitsPerSample; numChannels: unsigned = c_defSamplingNumChannels; channelMask: DWORD = SPEAKER_DEFAULT): PWAVEFORMATEXTENSIBLE; overload;
function fillFormatExt(var format: PWAVEFORMATEXTENSIBLE; source: pWAVEFORMATEX): PWAVEFORMATEXTENSIBLE;
function waveExt2wave(format: PWAVEFORMATEXTENSIBLE; var fmt: pWAVEFORMATEX; ignoreChannelLayout: bool = false; allocSize: uint = 0): bool;
function waveExt2str(format: PWAVEFORMATEXTENSIBLE): string;
function str2waveFormatExt(const str: string; var format: PWAVEFORMATEXTENSIBLE): bool;
function waveFormatExt2str(format: PWAVEFORMATEXTENSIBLE): string;
function duplicateFormat(source: pWAVEFORMATEX; var dup: pWAVEFORMATEX; allocSize: unsigned = 0): unsigned; overload;
function duplicateFormat(source: pWAVEFORMATEX; var dup: PWAVEFORMATEXTENSIBLE; allocSize: unsigned = 0): unsigned; overload;
function duplicateFormat(source: PWAVEFORMATEXTENSIBLE; var dup: PWAVEFORMATEXTENSIBLE; allocSize: unsigned = 0): unsigned; overload;
function duplicateFormat(source: PWAVEFORMATEXTENSIBLE; var dup: pWAVEFORMATEX; allocSize: unsigned = 0): unsigned; overload;
function getFormatTagExt(fmt: PWAVEFORMATEXTENSIBLE): DWORD;
function formatEqual(const format1, format2: WAVEFORMATEX): bool;
function sampling2str(samplesPerSecond: unsigned = c_defSamplingSamplesPerSec; bitsPerSample: unsigned = c_defSamplingBitsPerSample; numChannels: unsigned = c_defSamplingNumChannels): string;
function formatTag2str(formatTag: unsigned): string;
function format2str(const format: WAVEFORMATEX): string;
function newWaveHdr(device: unaWaveDevice; size: unsigned; data: pointer = nil; prepare: bool = true): unaWaveHeader;
function removeWaveHdr(var hdr: unaWaveHeader; device: unaWaveDevice): bool;

Types

tunaAcmDetailsType = (...);
punaAcmDetails = ˆunaAcmDetails;
unaWaveDataEvent = procedure (sender: tObject; data: pointer; size: Cardinal) of object;
unaWaveOnThresholdEvent = procedure (sender: tObject; var passThrough: bool) of object;
unaWaveGetProviderFormatEvent = procedure (var f: PWAVEFORMATEXTENSIBLE) of object;
unaWaveInSDMethods = (...);
unaDspSignalData = array[byte] of pdspl_float;
unaDspSignalDataSize = array[byte] of unsigned;
unaAcmCodecDriverMode = (...);
unaWaveHeader = pWAVEHDR;
unaVCWaveEngine = (...);
unaOnRiffStreamIsDone = procedure(sender: tObject) of object;

Constants

c_defSamplingBitsPerSample = 16;
c_defSamplingChannelMask = KSAUDIO_SPEAKER_STEREO;
c_defSamplingNumChannels = 2;
c_defSamplingSamplesPerSec = 44100;
c_max_wave_headers = 200;
c_unaRiffFileType_mpeg = 2;
c_unaRiffFileType_riff = 1;
c_unaRiffFileType_unknown = 0;

Variables

c_defChunksPerSecond: unsigned = 50;
c_defRecordingChunksAheadNum: unsigned = 10;
c_waveOut_unpause_after: unsigned = 2;

Description

Functions and Procedures

function mmNoError(errorCode: MMRESULT): bool;

Returns true if specified errorCode is equal to MMSYSERR_NOERROR.

function mmGetErrorCodeText(errorCode: MMRESULT): string;

Returns text message describing the specified errorCode this is generic function, use getErrorText() instead if possible. Returns empty string if error code is unknown.

function mmGetErrorCodeTextEx(errorCode: MMRESULT): string;

Same as mmGetErrorCodeText(), but additionally prefixes the result with numeric presentation of error code. Also encloses text in ( ) pair.

function formatChoose(bufW: pACMFORMATCHOOSEW; const title: wString = ''; style: unsigned = ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT; enumFlag: unsigned = 0; enumFormat: pWAVEFORMATEX = nil): MMRESULT;

Helper function for acm_formatChoose routine. Fills cbStruct, fdwStyle and pszTitle members before calling Win API.

function formatChooseAlloc(var format: pWAVEFORMATEX; defFormatTag: unsigned = WAVE_FORMAT_PCM; defSamplesPerSec: unsigned = c_defSamplingSamplesPerSec; const title: wString = ''; style: unsigned = ACMFORMATCHOOSE_STYLEF_INITTOWFXSTRUCT; enumFlag: unsigned = 0; enumFormat: pWAVEFORMATEX = nil; formatSize: unsigned = 0; wndHandle: hWnd = 0): MMRESULT;

Displays format choose dialog. Allocates wave format if necessary.

function formatIsPCM(format: pWAVEFORMATEX): bool; overload;
 
function formatIsPCM(format: pWAVEFORMATEXTENSIBLE): bool; overload;
 
function fillPCMFormat(var format: WAVEFORMATEX; samplesPerSecond: unsigned = c_defSamplingSamplesPerSec; bitsPerSample: unsigned = c_defSamplingBitsPerSample; numChannels: unsigned = c_defSamplingNumChannels): pWAVEFORMATEX; overload;

Fills the WAVEFORMATEX structure according to the specified sampling parameters. Returns pointer on format parameter (result := @format).

function fillPCMFormat(samplesPerSecond: unsigned = c_defSamplingSamplesPerSec; bitsPerSample: unsigned = c_defSamplingBitsPerSample; numChannels: unsigned = c_defSamplingNumChannels): WAVEFORMATEX; overload;

Fills the WAVEFORMATEX structure according to the specified sampling parameters. Returns filled PCM format.

function fillPCMFormatExt(var format: PWAVEFORMATEXTENSIBLE; samplesPerSecond: unsigned = c_defSamplingSamplesPerSec; containerSize: unsigned = c_defSamplingBitsPerSample; validBitsPerSample: unsigned = c_defSamplingBitsPerSample; numChannels: unsigned = c_defSamplingNumChannels; channelMask: DWORD = SPEAKER_DEFAULT): PWAVEFORMATEXTENSIBLE; overload;

Fills the PWAVEFORMATEXTENSIBLE structure according to the specified sampling parameters. Returns pointer on format parameter (result := @format).

function fillPCMFormatExt(var format: PWAVEFORMATEXTENSIBLE; const subtype: tGuid; samplesPerSecond: unsigned = c_defSamplingSamplesPerSec; containerSize: unsigned = c_defSamplingBitsPerSample; validBitsPerSample: unsigned = c_defSamplingBitsPerSample; numChannels: unsigned = c_defSamplingNumChannels; channelMask: DWORD = SPEAKER_DEFAULT): PWAVEFORMATEXTENSIBLE; overload;
 
function fillFormatExt(var format: PWAVEFORMATEXTENSIBLE; source: pWAVEFORMATEX): PWAVEFORMATEXTENSIBLE;
 
function waveExt2wave(format: PWAVEFORMATEXTENSIBLE; var fmt: pWAVEFORMATEX; ignoreChannelLayout: bool = false; allocSize: uint = 0): bool;
 
function waveExt2str(format: PWAVEFORMATEXTENSIBLE): string;
 
function str2waveFormatExt(const str: string; var format: PWAVEFORMATEXTENSIBLE): bool;
 
function waveFormatExt2str(format: PWAVEFORMATEXTENSIBLE): string;
 
function duplicateFormat(source: pWAVEFORMATEX; var dup: pWAVEFORMATEX; allocSize: unsigned = 0): unsigned; overload;

– –

function duplicateFormat(source: pWAVEFORMATEX; var dup: PWAVEFORMATEXTENSIBLE; allocSize: unsigned = 0): unsigned; overload;
 
function duplicateFormat(source: PWAVEFORMATEXTENSIBLE; var dup: PWAVEFORMATEXTENSIBLE; allocSize: unsigned = 0): unsigned; overload;
 
function duplicateFormat(source: PWAVEFORMATEXTENSIBLE; var dup: pWAVEFORMATEX; allocSize: unsigned = 0): unsigned; overload;
 
function getFormatTagExt(fmt: PWAVEFORMATEXTENSIBLE): DWORD;
 
function formatEqual(const format1, format2: WAVEFORMATEX): bool;

Returns true if two formats are equal.

function sampling2str(samplesPerSecond: unsigned = c_defSamplingSamplesPerSec; bitsPerSample: unsigned = c_defSamplingBitsPerSample; numChannels: unsigned = c_defSamplingNumChannels): string;

Returns string representation of PCM sampling parameters.

function formatTag2str(formatTag: unsigned): string;

Returns string representation of some audio format tags, or #NNN if tag is unknown.

function format2str(const format: WAVEFORMATEX): string;

Returns string representation of audio format.

function newWaveHdr(device: unaWaveDevice; size: unsigned; data: pointer = nil; prepare: bool = true): unaWaveHeader;

Creates new wave header.

Parameters
device
Wave device assotiated with header.
size
Size of data to be put into header after creation.
data
Pointer to data buffer.
Returns

New wave header.

function removeWaveHdr(var hdr: unaWaveHeader; device: unaWaveDevice): bool;

Destroys header object.

Parameters
hdr
Wave device header to be disposed.
device
Wave device assotiated with header.
Returns

True if successfull (header is not nil).

Types

tunaAcmDetailsType = (...);

ACM Details enumeration.

Values
  • uadtUnused:  
  • uadtFilterDetails:  
  • uadtFormatDetails:  
punaAcmDetails = ˆunaAcmDetails;

ACM Details record.

unaWaveDataEvent = procedure (sender: tObject; data: pointer; size: Cardinal) of object;

This event is used to inform the class owner about new data when it becomes available. It should be used only with classes which produces the data (like unaWaveInDevice or unaMsAcmCodec).

unaWaveOnThresholdEvent = procedure (sender: tObject; var passThrough: bool) of object;

Fired when switching from silence to voice and back.

unaWaveGetProviderFormatEvent = procedure (var f: PWAVEFORMATEXTENSIBLE) of object;

Returns external provider format

unaWaveInSDMethods = (...);

Voice Activity Detection (VAD) methods

Values
  • unasdm_none: no silence detection
  • unasdm_VC: "old" method, which uses minVolumeLevel and minActiveTime
  • unasdm_DSP: uses DSP library to filter silence
  • unasdm_3GPPVAD1: "new" 3GPP method (recommended)
unaDspSignalData = array[byte] of pdspl_float;
 
unaDspSignalDataSize = array[byte] of unsigned;
 
unaAcmCodecDriverMode = (...);

– –

Values
  • unacdm_acm:  
  • unacdm_installable:  
  • unacdm_internal:  
  • unacdm_openH323plugin:  
unaWaveHeader = pWAVEHDR;
 
unaVCWaveEngine = (...);

DS is not supported yet.

Values
  • unavcwe_MME:  
  • unavcwe_ASIO:  
  • unavcwe_DS:  
unaOnRiffStreamIsDone = procedure(sender: tObject) of object;
 

Constants

c_defSamplingBitsPerSample = 16;
 
c_defSamplingChannelMask = KSAUDIO_SPEAKER_STEREO;
 
c_defSamplingNumChannels = 2;
 
c_defSamplingSamplesPerSec = 44100;
 
c_max_wave_headers = 200;

Max number of headers to utilize

c_unaRiffFileType_mpeg = 2;
 
c_unaRiffFileType_riff = 1;
 
c_unaRiffFileType_unknown = 0;
 

Variables

c_defChunksPerSecond: unsigned = 50;

Number of chunks per second (in real time mode)

Default value was changed from 20 to 25 (for 11025 rate to be handled better) AUG'03: changed to 50, for 11025 it will be 49

c_defRecordingChunksAheadNum: unsigned = 10;

Number of chunks to put into waveIn recording queue (does not afftect the latency). Default value is 10

c_waveOut_unpause_after: unsigned = 2;

Number of chunks to put into waveOut before unpausing. Default value is 2

Author

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09