Home Units Hierarchy Routines All identifiers

Class unavclInOutWavePipe

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type unavclInOutWavePipe = class(unavclInOutPipe)

Description

Base abstract class for wave devices.

Hierarchy

Overview

Methods

Public constructor Create(AOwner: TComponent); override;
Public function getLogVolume(channel: uint = $FFFFFFFF): unsigned;
Public function getUnVolume(channel: uint = $FFFFFFFF): unsigned;
Public function getVolume(channel: uint = $FFFFFFFF): unsigned;
Protected function applyDeviceFormat(format: PWAVEFORMATEXTENSIBLE; isSrc: bool = true): bool; virtual;
Protected function applyFormat(data: pointer; len: uint; provider: unavclInOutPipe = nil; restoreActiveState: bool = false): bool; override;
Protected function doAddConsumer(consumer: unavclInOutPipe; forceNewFormat: bool = true): bool; override;
Protected function doAddProvider(provider: unavclInOutPipe): bool; override;
Protected function doGetPosition(): int64; override;
Protected function doOpen(): bool; override;
Protected function doRead(data: pointer; len: uint): uint; override;
Protected function doWrite(data: pointer; len: uint; provider: pointer = nil): uint; override;
Protected function getAvailableDataLen(index: integer): uint; override;
Protected function getChunkSize(): uint; virtual;
Protected function getDstChunkSize(): uint; virtual;
Protected function getFormatExchangeData(out data: pointer): uint; override;
Protected function isActive(): bool; override;
Public procedure AfterConstruction(); override;
Public procedure BeforeDestruction(); override;
Public procedure createDevice();
Public procedure createDriver();
Public procedure ensureFormat();
Public procedure flush();
Public procedure setVolume100(volume: unsigned = 100; channel: int = -1);
Public procedure shareASIOwith(pipe: unavclInOutWavePipe);
Protected procedure createNewDevice(); virtual;
Protected procedure destroyOldDevice(); virtual;
Protected procedure doAcmReq(req: uint; var acm: unaMsAcm); virtual;
Protected procedure doClose(); override;
Protected procedure doRemoveProvider(provider: unavclInOutPipe); override;
Protected procedure doSetAddSilence(value: boolean); virtual;
Protected procedure doSetDeviceId(value: int); virtual;
Protected procedure doSetDriver(value: unaMsAcmDriver); virtual;
Protected procedure doSetDriverLibrary(const value: wString); virtual;
Protected procedure doSetDriverMode(value: unaAcmCodecDriverMode); virtual;
Protected procedure doSetFormat(value: PWAVEFORMATEXTENSIBLE); virtual;
Protected procedure doSetFormatTag(value: unsigned); virtual;
Protected procedure doSetLoop(value: boolean); virtual;
Protected procedure doSetSamplingParam(index: int; value: unsigned); virtual;
Protected procedure initWaveParams(); virtual;
Protected procedure Loaded(); override;
Protected procedure onDriverChanged(); virtual;

Properties

Public property acm2: unaMsAcm read f_acm2;
Protected property addSilence: boolean read f_addSilence write setAddSilence default false;
Public property calcVolume: boolean read f_calcVolume write setCalcVolume default false;
Published property channelConsumeMask: int read f_channelConsumeMask write setChannelConsumeMask default -1;
Published property channelMixMask: int read f_channelMixMask write setChannelMixMask default -1;
Public property chunkSize: uint read getChunkSize;
Public property device: unaMsAcmStreamDevice read f_device;
Protected property deviceId: int read f_deviceId write setDeviceId;
Protected property deviceWasCreated: bool read f_deviceWasCreated;
Protected property direct: bool read f_direct write setDirect default false;
Public property driver: unaMsAcmDriver read f_driver write setDriver;
Protected property driverLibrary: wString read f_driverLibrary write setDriverLibrary;
Protected property driverMode: unaAcmCodecDriverMode read f_driverMode write setDriverMode default unacdm_acm;
Public property dstChunkSize: uint read getDstChunkSize;
Published property enableDataProxy;
Protected property formatTag: unsigned read f_formatTag write setFormatTag default WAVE_FORMAT_PCM;
Protected property formatTagImmunable: boolean read f_applyFormatTagImmunable write f_applyFormatTagImmunable default false;
Protected property inputIsPcm: boolean read f_inputIsPcm write setInputIsPcm default true;
Published property isFormatProvider;
Protected property loop: boolean read f_loop write setLoop default false;
Protected property mapped: bool read f_mapped write setMapped default false;
Public property minActiveTime: unsigned read getMinActiveTime write setMinActiveTime default 0;
Public property minVolumeLevel: unsigned read getMinVolLevel write setMinVolLevel default 0;
Published property onAcmReq: tunaOnAcmReq read f_onAcmReq write f_onAcmReq;
Published property onDataAvailable;
Published property onDataDSP;
Published property onFormatChangeAfter;
Published property onFormatChangeBefore;
Public property onThreshold: unaWaveOnThresholdEvent read f_onThreshold write setOnThreshold;
Published property overNum: unsigned read f_overNum write setOverNum default defOverNumValue;
Public property pcmFormatExt: PWAVEFORMATEXTENSIBLE read f_formatExt write setFormat;
Published property pcm_bitsPerSample: unsigned index 1 read getSamplingParam write setSamplingParam default c_defSamplingBitsPerSample;
Public property pcm_channelMask: unsigned index 3 read getSamplingParam write setSamplingParam default c_defSamplingChannelMask;
Published property pcm_numChannels: unsigned index 2 read getSamplingParam write setSamplingParam default c_defSamplingNumChannels;
Published property pcm_samplesPerSec: unsigned index 0 read getSamplingParam write setSamplingParam default c_defSamplingSamplesPerSec;
Protected property realTime: boolean read f_realTime write setRealTime default false;
Protected property silenceDetectionMode: unaWaveInSDMethods read f_sdmCache write setSdm default unasdm_none;
Public property startDeviceOnOpen: bool read f_sdo write f_sdo default true;
Protected property waveEngine: unaVCWaveEngine read f_waveEngine write setWaveEngine default unavcwe_MME;
Public property waveError: int read f_waveError;
Public property waveErrorAsString: string read getWaveErrorAsString;

Description

Methods

Public constructor Create(AOwner: TComponent); override;
 
Public function getLogVolume(channel: uint = $FFFFFFFF): unsigned;

Returns current volume of audio signal passing "through" wave device. Returned volume range from 0 (silence) to 100. Scale is logarithmic. Use getVolume() method to get volume in linear scale.

Parameters
channel
Channel number to return volume for. Default is $FFFFFFFF (median).
Public function getUnVolume(channel: uint = $FFFFFFFF): unsigned;

Returns unchenaged volume of audio signal passing "through" wave device. Returned volume range from 0 (silence) to 32768. Scale is linear. Use getLogVolume() method to get volume in logarithmic scale.

Parameters
channel
Channel number to return volume for. Default is $FFFFFFFF (median).
Public function getVolume(channel: uint = $FFFFFFFF): unsigned;

Returns current volume of audio signal passing "through" wave device. Returned volume range from 0 (silence) to 32768. Scale is linear. Use getLogVolume() method to get volume in logarithmic scale.

Parameters
channel
Channel number to return volume for. Default is $FFFFFFFF (median).
Protected function applyDeviceFormat(format: PWAVEFORMATEXTENSIBLE; isSrc: bool = true): bool; virtual;

Applies new data stream format for the wave device. This implementation assumes device is descendand from unaWaveDevice.

Parameters
format
New data format.
isSrc
True if format specifies input data format, False for output.
Returns

True if successfull.

Protected function applyFormat(data: pointer; len: uint; provider: unavclInOutPipe = nil; restoreActiveState: bool = false): bool; override;

Applies new data stream format on the device. First, it closes the device. Next, is assigns driverMode and driverLibrary properties. If formatTagImmunable property is False, a new format tag will be assigned. New format will be stored in pcmFormatExt. Finally, applyDeviceFormat() will be called. If device was not re-opened, it also calls checkIfFormatProvider().

Parameters
data
Usually pointer to unavclWavePipeFormatExchange record.
len
Size of format pointed by data.
provider
Provider of format.
restoreActiveState
Should the device be re-activated after applying of new format.
Returns

True if successfull.

Protected function doAddConsumer(consumer: unavclInOutPipe; forceNewFormat: bool = true): bool; override;

Adds consumer to the wave device.

Protected function doAddProvider(provider: unavclInOutPipe): bool; override;

Adds provider to the wave device.

Protected function doGetPosition(): int64; override;

Returns current position in device.

Returns

Current position in data stream (if applicable).

Protected function doOpen(): bool; override;

Creates and opens the wave device.

Returns

True if successfull.

Protected function doRead(data: pointer; len: uint): uint; override;

Reads data from the wave device.

Returns

Number of bytes read from device.

Protected function doWrite(data: pointer; len: uint; provider: pointer = nil): uint; override;

If enableDataProcessing is True, writes data into the wave device using its write() method. Otherwise passes data to onNewData() method (thus removing the component from data chain). Does nothing if device is nil.

Parameters
data
Stream data.
len
Size of data pointed by data.
Returns

Number of bytes passed to device.

Protected function getAvailableDataLen(index: integer): uint; override;

Returns available data size.

Returns

Data size available to read from the wave device.

Protected function getChunkSize(): uint; virtual;

Returns chunk size (in bytes).

Returns

Size of input data chunk in bytes.

Protected function getDstChunkSize(): uint; virtual;

Some devices (like codecs) may have different sife of input and output chunks.

Returns

Size of output data chunk in bytes.

Protected function getFormatExchangeData(out data: pointer): uint; override;

Fills format exchange data of the pipe stream.

Parameters
data
Data format. Must be deallocated by mrealloc().
Returns

Size in bytes of data buffer.

Protected function isActive(): bool; override;

Returns active state of the component.

Returns

True if wave device was open successfully.

Public procedure AfterConstruction(); override;

Creates the wave device and assigns default values for properties.

Public procedure BeforeDestruction(); override;

Destroys the wave device.

Public procedure createDevice();

Destroys previuosly created wave device, then creates new one. Assigns required callbacks for device.

Public procedure createDriver();

Creates ACM or openH323plugin driver for device (if needed).

Public procedure ensureFormat();

Refreshes the device format.

Public procedure flush();

Flushes any data panding.

Public procedure setVolume100(volume: unsigned = 100; channel: int = -1);

Changes the volume of specified channel.

Parameters
volume
100 means no volume change (100%); 50 = 50%; 200 = 200% and so on.
channel
Default value of -1 means this volume will be applied on all channels.
Public procedure shareASIOwith(pipe: unavclInOutWavePipe);

Share ASIO driver with other device.

Protected procedure createNewDevice(); virtual;

Does all the job of device creation. Should be overriten with actual implementation. Should not be called directly.

Protected procedure destroyOldDevice(); virtual;

Called when new device is about to be created.

Protected procedure doAcmReq(req: uint; var acm: unaMsAcm); virtual;

ACM reqest.

Used mostly to disable default ACM enumeration.

Protected procedure doClose(); override;

Closes the wave device.

Protected procedure doRemoveProvider(provider: unavclInOutPipe); override;

Removes provider from the wave device.

Protected procedure doSetAddSilence(value: boolean); virtual;
 
Protected procedure doSetDeviceId(value: int); virtual;

Sets new device ID and re-creates device object if needed.

Parameters
value
New device ID value.
Protected procedure doSetDriver(value: unaMsAcmDriver); virtual;
 
Protected procedure doSetDriverLibrary(const value: wString); virtual;
 
Protected procedure doSetDriverMode(value: unaAcmCodecDriverMode); virtual;
 
Protected procedure doSetFormat(value: PWAVEFORMATEXTENSIBLE); virtual;
 
Protected procedure doSetFormatTag(value: unsigned); virtual;

Sets new format tag and re-creates device and driver objects if needed.

Parameters
value
New format tag value.
Protected procedure doSetLoop(value: boolean); virtual;
 
Protected procedure doSetSamplingParam(index: int; value: unsigned); virtual;
 
Protected procedure initWaveParams(); virtual;
 
Protected procedure Loaded(); override;

Initializes the wave device.

Protected procedure onDriverChanged(); virtual;

Triggers when device driver has been changed.

Properties

Public property acm2: unaMsAcm read f_acm2;

ACM manager for the device (if any).

Protected property addSilence: boolean read f_addSilence write setAddSilence default false;

Specifies whether device should add silence when it runs out of audio data.

Public property calcVolume: boolean read f_calcVolume write setCalcVolume default false;

When True tells the component to calculate audio volume of a data stream coming into or from the component. Use the getVolume() method to get the current volume level.

This property must be also set to True if silenceDetectionMode is set to unasdm_VC.

Published property channelConsumeMask: int read f_channelConsumeMask write setChannelConsumeMask default -1;

Which channels to consume.

Published property channelMixMask: int read f_channelMixMask write setChannelMixMask default -1;

When -1 (default) all channels are included in output stream When >= 0, only one specified channel is included

Public property chunkSize: uint read getChunkSize;

Input chunk size.

Public property device: unaMsAcmStreamDevice read f_device;

Wave device associated with the pipe.

Protected property deviceId: int read f_deviceId write setDeviceId;

Specifies device ID for the wave device. Ranges from 0 to number of wave devices - 1. Default value is WAVE_MAPPER, which forces the component to use default device assigned in Control Panel.

Protected property deviceWasCreated: bool read f_deviceWasCreated;

Internal.

Protected property direct: bool read f_direct write setDirect default false;

Specifies whether wave device is direct (obsolete).

Public property driver: unaMsAcmDriver read f_driver write setDriver;

Device driver.

Protected property driverLibrary: wString read f_driverLibrary write setDriverLibrary;

Specifies driver library for device.

Protected property driverMode: unaAcmCodecDriverMode read f_driverMode write setDriverMode default unacdm_acm;

Specifies driver mode for device.

Public property dstChunkSize: uint read getDstChunkSize;

Output chunk size.

Published property enableDataProxy;
 
Protected property formatTag: unsigned read f_formatTag write setFormatTag default WAVE_FORMAT_PCM;

Specifies audio format tag for the wave device.

Protected property formatTagImmunable: boolean read f_applyFormatTagImmunable write f_applyFormatTagImmunable default false;

Specifies the device is immunable for format tag changes (usually useful for codecs).

Protected property inputIsPcm: boolean read f_inputIsPcm write setInputIsPcm default true;

Specifies whether format of input stream of the device is PCM.

Published property isFormatProvider;
 
Protected property loop: boolean read f_loop write setLoop default false;

Specifies whether wave stream should be looped from end to beginning.

Protected property mapped: bool read f_mapped write setMapped default false;

Specifies whether wave device is mapped (obsolete).

Public property minActiveTime: unsigned read getMinActiveTime write setMinActiveTime default 0;

Minimum active time for recording.

Public property minVolumeLevel: unsigned read getMinVolLevel write setMinVolLevel default 0;

Minimum volume level for recording.

Published property onAcmReq: tunaOnAcmReq read f_onAcmReq write f_onAcmReq;

Specifies whether device should not utilize ACM

Published property onDataAvailable;
 
Published property onDataDSP;
 
Published property onFormatChangeAfter;
 
Published property onFormatChangeBefore;
 
Public property onThreshold: unaWaveOnThresholdEvent read f_onThreshold write setOnThreshold;

Fired when current level of signal has crossed the "silence" mark.

Published property overNum: unsigned read f_overNum write setOverNum default defOverNumValue;

Specifies how many chunks of data (every chunk can hold 1/50 second of audio) component can store in the input or output buffer, if data cannot be processed immediately.

Set this property to 0 to disable the buffer overflow checking (this could lead to uncontrolled memory usage grow).

Public property pcmFormatExt: PWAVEFORMATEXTENSIBLE read f_formatExt write setFormat;

PCM format of the wave device.

Published property pcm_bitsPerSample: unsigned index 1 read getSamplingParam write setSamplingParam default c_defSamplingBitsPerSample;

Specifies number of bits per sample for wave device. Common values are 8 and 16.

Public property pcm_channelMask: unsigned index 3 read getSamplingParam write setSamplingParam default c_defSamplingChannelMask;

Specifies channel mask for multi-channel data streams.

Published property pcm_numChannels: unsigned index 2 read getSamplingParam write setSamplingParam default c_defSamplingNumChannels;

Specifies number of channels per sample for wave device. Common values are 1 (mono) and 2 (stereo).

Published property pcm_samplesPerSec: unsigned index 0 read getSamplingParam write setSamplingParam default c_defSamplingSamplesPerSec;

Specifies number of samples per second for wave device. Common values are 44100, 22050, 11025 and 8000.

Protected property realTime: boolean read f_realTime write setRealTime default false;

Specifies whether device is working in real-time manner.

Protected property silenceDetectionMode: unaWaveInSDMethods read f_sdmCache write setSdm default unasdm_none;

Specifies which method will be used to detect silence.

minActiveTime and minVolumeLevel properties control the silence detection behavior for unasdm_VC.

Public property startDeviceOnOpen: bool read f_sdo write f_sdo default true;

Specifies whether device should be "started" after open. Default is True. Mostly used with codecs, if data processing is done from one main thread rather than seperate codec threads.

Protected property waveEngine: unaVCWaveEngine read f_waveEngine write setWaveEngine default unavcwe_MME;

MME, ASIO or DS

Public property waveError: int read f_waveError;

Last wave error.

Public property waveErrorAsString: string read getWaveErrorAsString;

Last wave error as string.

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09