Description | Hierarchy | Fields | Methods | Properties |
type unavclScriptor = class(tComponent)
The syntax of VC 2.5 Pro script is simple.
1) Creating a component 2) Assigning property value 3) Special commands 4) General syntax issues
———————- 1) Creating a component ———————-
To create a component, specify component's name and the base class you with to create:
<componentName> = <baseClassName>;
For example, to create a recording device component use the following operator:
myRecorder = unavclWaveInDevice;
The following base class names are supported:
// wave classes // unavclWaveInDevice - wave in device (recorder) component unavclWaveOutDevice - wave out device (playback) component
unavclWaveCodecDevice - Audio Compression Manager (ACM) codec device component unavclWaveRiff - WAVe reader and writer component unavclWaveMixer - PCM mixer device component unavclWaveResampler - PCM resampler device component
// IP classes // unavclIPClient - IP (TCP/UDP) client component unavclIPServer - IP (TCP/UDP) server component
unavclIPBroadcastClient - IP (UDP) broadcast client component unavclIPBroadcastServer - IP (UDP) broadcast server component
—————————- 2) Assigning property values —————————-
To assign a value for component's property, use the following operator:
<componentName>.<propertyName> = <value>;
Following properties are supported:
'className', // RO: string - all classes 'name', // RW: string - all classes
'availableDataLenIn', // RO: unsigned - all VC classes 'availableDataLenOut', // RO: unsigned - all VC classes 'inBytes', // RO: int64 - all VC classes 'outBytes', // RO: int64 - all VC classes
'active', // RW: bool - all VC classes 'consumer', // RW: component - all VC classes 'dumpInput', // RW: strign - all VC classes 'dumpOutput', // RW: string - all VC classes 'isFormatProvider', // RW: bool - all VC classes 'autoActivate', // RW: bool - all VC classes
'onDataAvailable', // RW: event - all VC classes
'deviceId', // RW: integer - all VC WAVE classes 'formatTag', // RW: unsigned - all VC WAVE classes 'formatTagImmunable', // RW: bool - all VC WAVE classes 'mapped', // RW: bool - all VC WAVE classes 'direct', // RW: bool - all VC WAVE classes 'overNum', // RW: unsigned - all VC WAVE classes 'realTime', // RW: bool - all VC WAVE classes 'loop', // RW: bool - all VC WAVE classes 'inputIsPcm', // RW: bool - all VC WAVE classes 'pcm_SamplesPerSec', // RW: unsigned - all VC WAVE classes 'pcm_BitsPerSample', // RW: unsigned - all VC WAVE classes 'pcm_NumChannels', // RW: unsigned - all VC WAVE classes 'calcVolume', // RW: bool - all VC WAVE classes
'addSilence', // RW: bool - TunavclMixer and TunavclResampler
'minActiveTime', // RW: unsigned - TunavclWaveInDevice 'minVolumeLevel', // RW: unsigned - TunavclWaveInDevice
'isInput', // RW: bool - TunavclWaveRiff 'fileName', // RW: string - TunavclWaveRiff
'dst_SamplesPerSec', // RW: unsigned - TunavclWaveResampler 'dst_BitsPerSample', // RW: unsigned - TunavclWaveResampler 'dst_NumChannels', // RW: unsigned - TunavclWaveResampler
'port', // RW: string - all VC IP classes
'host', // RW: string - all VC TCP/IP classes 'proto', // RW: string - all VC TCP/IP classes
'waveFormatTag', // RW: unsigned - all VC UDP BROADCAST classes 'waveSamplesPerSec', // RW: unsigned - all VC UDP BROADCAST classes 'waveNumChannels', // RW: unsigned - all VC UDP BROADCAST classes 'waveNumBits', // RW: unsigned - all VC UDP BROADCAST classes
'packetsSent', // RO: unsigned - TunavclIPBroadcastServer
'packetsLost', // RO: unsigned - TunavclIPBroadcastClient 'packetsReceived', // RO: unsigned - TunavclIPBroadcastClient 'remoteHost', // RO: unsigned - TunavclIPBroadcastClient 'remotePort' // RO: unsigned - TunavclIPBroadcastClient
To specify boolean value, use 'true' or 'false' keywords, for example:
myRecorder.active = true; // activate recorder
This assigns boolean value 'true' to the active property of myRecorder component.
To specify string value, enclose it into ' ' (single quotes). Double single quote ('') inside the string indicates one single quote.
proto property can has 'TCP' or 'UDP' values only.
You can reference the component by it's name:
myPlayback = unavclWaveOutDevice; myRecorder.consumer = myPlayback; // link recorder to payback device, making a loop
You can also use 'null' keyword to remove the consumer or destroy the component:
myRecorder.consumer = null; // assigns nil to consumer (removes consumer) myPlayback = null; // destroys myPlayback component
——————- 3) Special commands ——————-
There are also several commands which executes some special action:
<command>;
Following commands are recognized:
clear; // clears all created components pause; // pauses execution of script for 1 second
———————— 4) General syntax issues ————————
All operators, component names and keywords are NOT case sensitive.
Operators must be terminated by ";" symbol.
Comments should be enclosed in a pair of curved bracers, or started with // sequence.
destructor Destroy(); override; |
|
function executeScript(const script: string): HRESULT; |
|
function getComponentName(index: unsigned; out componentName: string): HRESULT; |
|
function getComponentProperty(const componentName, propertyName: string; out value: string): HRESULT; |
|
function getErrorCodeString(code: HRESULT): string; |
|
function setComponentProperty(const componentName, propertyName: string; const value: string): HRESULT; |
|
procedure AfterConstruction(); override; |
|
procedure Notification(component: tComponent; operation: tOperation); override; |
property componentCount: unsigned read getComponentCount; |
|
property errorLine: unsigned read f_errorLine; |
|
property onScriptExecute: tNotifyEvent read f_onSE write f_onSE; |
destructor Destroy(); override; |
|
function executeScript(const script: string): HRESULT; |
|
Executes the script.
Parameters
ReturnsS_OK if no error ocurred. |
function getComponentName(index: unsigned; out componentName: string): HRESULT; |
|
Returns component name.
Parameters
ReturnsS_OK if successfull. |
function getErrorCodeString(code: HRESULT): string; |
|
Returns error string.
Parameters
ReturnsError string for specified error code. |
procedure AfterConstruction(); override; |
|
procedure Notification(component: tComponent; operation: tOperation); override; |
|
property componentCount: unsigned read getComponentCount; |
|
Number of components. |
property errorLine: unsigned read f_errorLine; |
|
Line number where error ocurred. |
property onScriptExecute: tNotifyEvent read f_onSE write f_onSE; |
|
Fired before script is about to be executed. |
(c) 2012 Lake of Soft