ACS_Classes

Ancestor classes for all input and output components.

Summary
ACS_ClassesAncestor classes for all input and output components.
TAuFileStreamTFileStream analog that handles Unicode.
TAuThreadCustom TThread descendant that does something.
TAuInputThe ancestor class for all input components.
Functions
GetDataThis method retrieves input data.
CopyDataWrites no more than BufferSize data into Buffer
FillBufferThe same as CopyData but tries to fill the Buffer.
InitThis method prepares input component for reading data.
FlushThis method closes the current input (opened with Init), clearing up all temporary structures allocated during data transfer.
Properties
BitsPerSampleThe number of bits per sample in the input stream.
PositionThe current reading position in the input stream in bytes.
SampleRateThe input stream sample rate in Herz.
ChannelsThe number of channels in the input stream.
SizeA read only property which returns input data size in bytes.
TotalSamplesA read only property which returns number of samples (frames) in the input stream.
TotalTimeA read only property which returns input playback time in seconds.
TAuOutputThe ancestor class for all output components.
Functions
PausePauses the output.
ResumeResumes previously paused output.
RunAfter an input component has been assigned, call Run to start the audio processing chain.
BlockingRunIn some situations, such as console programs or DUnit test units, background processing is not desirable.
StopStops the busy component or does nothing if the component is idle.
Properties
DelaySets the delay, affects CPU usage.
ThreadPriorityThis property allows you to set the priority of the output thread.
ProgressRead Progress to get the output progress in percents.
StatusThis read only property indicates the output component’s current status.
TimeElapsedThe time in seconds that has passed since the playback was started.
ExceptionMessageMost exceptions that may occur during NewAC operation are suppressed.
InputThis property allows you to set the input component for the output component.
OnDoneRaised when the component has finished its job or was stopped asynchronously.
OnProgressOnProgress event is raised periodically to indicate output progress.
OnThreadExceptionThis event is raised if an exception has occurred.
TAuStreamedInputA descendant of TAuInput to deal with streams.
Functions
SeekInternalThis abstract method should be overridden with an implementation dependong on whether your input component is seekable or not.
Properties
EndSampleSet this property’s value to the sample (frame) you want the input to stop playing at.
LoopIf set to True, the input loops (i.e.
StartSampleSet this property’s value to the sample (frame) you want the input to start playing from.
SeekableThis read only property indicates when the input is seekable.
StreamUse this property to set the input data stream for the input component.
Functions
SeekThis method allows you to change the current playing position in the the input component.
TAuStreamedOutputA descendant of TAuOutput to deal with streams.
TAuFileInA descendant of TAuStreamedInput to deal with files and streams.
Functions
OpenFileOpens the file or stream if it is not already open.
CloseFileCloses the file opened with OpenFile.
SetStartTimeThis function is a wrapper around StartSample property, provided for convenience.
SetEndTimeThis function is a wrapper around EndSample property, provided for convenience.
JumpThis method, being a wrapper around <Seek>, simpifies navigation in the input stream.
Properties
ValidRead this property to determine if the file is valid.
WideFileNameAllows you to handle file names in Unicode.
FilenameFile name in 8-bit encoding.
TAuTaggedFileInDescends from TAuFileIn, this class is an ancestor of the file input components that use ID3V* tags.
TAuFileOutA descendant of TAuStreamedOutput to deal with files and streams.
Properties
FileModeThis property can take one of two values foRewrite (default) and foAppend.
WideFileNameAllows you to handle file names in Unicode.
FilenameFile name in 8-bit encoding.
TAuTaggedFileOutDescends from TAuFileOut, this class is an ancestor of the file output components that use Id3v* tags.
TAuConverterDescends from TAuInput, the base class for all converter components.
Properties
InputLike the output components, converters can be assigned an input.
TAudioTapThis is the base class for all “audio tap components”.
Functions
StartRecordCall this method to start recording audio data passing through an audio tap.
StopRecordCall this method to stop recording.
PauseRecordCall this method to pause recording.
ResumeRecordCall this method to resume paused recording.
Properties
StatusRead this property to get the component status.
WideFileNameUse this proeprty to set or get the file name the data is written to in Unicode charset.
FileNameUse this proeprty to set or get the file name the data is written to in 8-bit charset.

TAuFileStream

TFileStream analog that handles Unicode.

TAuThread

Custom TThread descendant that does something.

TAuInput

The ancestor class for all input components.

Summary
Functions
GetDataThis method retrieves input data.
CopyDataWrites no more than BufferSize data into Buffer
FillBufferThe same as CopyData but tries to fill the Buffer.
InitThis method prepares input component for reading data.
FlushThis method closes the current input (opened with Init), clearing up all temporary structures allocated during data transfer.
Properties
BitsPerSampleThe number of bits per sample in the input stream.
PositionThe current reading position in the input stream in bytes.
SampleRateThe input stream sample rate in Herz.
ChannelsThe number of channels in the input stream.
SizeA read only property which returns input data size in bytes.
TotalSamplesA read only property which returns number of samples (frames) in the input stream.
TotalTimeA read only property which returns input playback time in seconds.

Functions

GetData

procedure GetData(var Buffer : Pointer;
var Bytes : LongWord); virtual

This method retrieves input data.  You specify the number of bytes you want to get, but you may get less and it should not be considered as an end of input indication.  When the end of input is reached GetData sets Buffer to nil and Bytes to 0.

Parameters

BufferThis is the variable where GetData will put a pointer to a data buffer.  Unlike many other data reading functions GetData doesn’t take our buffer pointer but provides you with its own.
BytesWhen you call GetData you pass to Bytes the number of bytes you want to get.  When the method returns the Bytes variable holds the number of bytes in the Buffer.

Note

Usually you should not call this method directly.

CopyData

function CopyData(Buffer : Pointer;
BufferSize : Integer) : LongWord

Writes no more than BufferSize data into Buffer

Parameters

Buffer: Pointerthe buffer to write to
BufferSize: Integerthe number of bytes to write

FillBuffer

function FillBuffer(Buffer : Pointer;
BufferSize : LongWord;
var EOF : Boolean) : LongWord

The same as CopyData but tries to fill the Buffer.  EOF is set to True if end of data was reached while filling the buffer, the buffer itself may still contain valid data.

Parameters

Buffer: Pointerthe buffer to write to
BufferSize: Integerthe number of bytes to write
var EOF: Booleanset to True if end of data was reached while filling the buffer.

Returns

IntegerNumber of bytes written

Init

procedure Init

This method prepares input component for reading data.  Usually this method is called internally by the output or converter component to which the input component is assigned.  You can call this method if you want to get direct access to the audio stream.  In such a case the sequence of calls should look like this.

InputComponent.Init;
InputComponent.GetData(...); // in a loop
InputComponent.Flush;

Flush

procedure Flush

This method closes the current input (opened with Init), clearing up all temporary structures allocated during data transfer.  Usually this method is called internally by the output or converter component to which the input component is assigned.  You can call this method if you want to get direct access to the audio stream.  In such a case the sequence of calls should look like this.

InputComponent.Init;
InputComponent.GetData(...); // in a loop
InputComponent.Flush;

Properties

BitsPerSample

The number of bits per sample in the input stream.  Possible values are 8, 16, and 24.

Position

The current reading position in the input stream in bytes.

SampleRate

The input stream sample rate in Herz.

Channels

The number of channels in the input stream.  Possible values are 1 (mono), 2 (stereo)... and may be more.

Size

A read only property which returns input data size in bytes.  The value of this property becomes valid after Init has been called.  For some inputs (like TDXAudioIn) the data size may be not known in advance.  In this case Size returns -1

TotalSamples

A read only property which returns number of samples (frames) in the input stream.  TotalSamples value may be valid only if the Size of the input is known.

TotalTime

A read only property which returns input playback time in seconds.  TotalTime value may be valid only if the Size of the input is known.

TAuOutput

The ancestor class for all output components.

Summary
Functions
PausePauses the output.
ResumeResumes previously paused output.
RunAfter an input component has been assigned, call Run to start the audio processing chain.
BlockingRunIn some situations, such as console programs or DUnit test units, background processing is not desirable.
StopStops the busy component or does nothing if the component is idle.
Properties
DelaySets the delay, affects CPU usage.
ThreadPriorityThis property allows you to set the priority of the output thread.
ProgressRead Progress to get the output progress in percents.
StatusThis read only property indicates the output component’s current status.
TimeElapsedThe time in seconds that has passed since the playback was started.
ExceptionMessageMost exceptions that may occur during NewAC operation are suppressed.
InputThis property allows you to set the input component for the output component.
OnDoneRaised when the component has finished its job or was stopped asynchronously.
OnProgressOnProgress event is raised periodically to indicate output progress.
OnThreadExceptionThis event is raised if an exception has occurred.

Functions

Pause

procedure Pause

Pauses the output.

Resume

procedure Resume

Resumes previously paused output.

Run

procedure Run

After an input component has been assigned, call Run to start the audio processing chain.  When called, Run returns at once while the actual audio processing goes on in the different thread.  You will get OnProgress events while audio processing continues and an OnDone event when the job is done.

BlockingRun

procedure BlockingRun

In some situations, such as console programs or DUnit test units, background processing is not desirable.  In these cases, call BlockingRun to run the output component and wait until all operations are complete before returning from the method.  It is only fair to note that since there is no way to abort, pause, or stop the procedure once it has started, if used improperly this method can lock your program.  If you are unsure which method to use, use the Run method.  Under normal circumstances, call Run to allow audio processing to go on in the background while your application is free to respond to events.

Stop

procedure Stop(Async : Boolean = True)

Stops the busy component or does nothing if the component is idle.

Parameters

Async: Boolean = TrueIf this parameter value is set to True (the default), Stop is called in an asynchronous mode.  In this mode the method returns at once and OnDone event is raised when output is actually finished.  If this parameter is set to False the Stop method is called in blocking mode.  In this mode it returns only after the output is actually done.  No event is raised in this case.

Properties

Delay

Sets the delay, affects CPU usage.

ThreadPriority

This property allows you to set the priority of the output thread.

Progress

Read Progress to get the output progress in percents.  This value is meaningful only after the input component has been set and only if the input component can tell the size of its stream.

Status

This read only property indicates the output component’s current status.  Possible values are:

tosPlayingthe component is performing its task;
tosPausedthe component is paused (the Pause method was called)
tosIdlethe component is idle

TimeElapsed

The time in seconds that has passed since the playback was started.  Useful for real time components like TDXAudioOut.

ExceptionMessage

Most exceptions that may occur during NewAC operation are suppressed.  If an exception occurs, the operation is stopped and the OnThreadException event is raised.  ExceptionMessage holds the exception text.

Input

This property allows you to set the input component for the output component.  The valid input components must be descendants of TAuInput.

OnDone

Raised when the component has finished its job or was stopped asynchronously.  From this event handler you can perform any action on the output component, even remove the component itself!

OnProgress

OnProgress event is raised periodically to indicate output progress.  Use Progress property to get the progress value.  OnProgress event is sent asynchronously and you can perform any action on the output component from the event handler.

OnThreadException

This event is raised if an exception has occurred.  Exception string is stored in ExceptionMessage.

TAuStreamedInput

A descendant of TAuInput to deal with streams.

Summary
Functions
SeekInternalThis abstract method should be overridden with an implementation dependong on whether your input component is seekable or not.
Properties
EndSampleSet this property’s value to the sample (frame) you want the input to stop playing at.
LoopIf set to True, the input loops (i.e.
StartSampleSet this property’s value to the sample (frame) you want the input to start playing from.
SeekableThis read only property indicates when the input is seekable.
StreamUse this property to set the input data stream for the input component.
Functions
SeekThis method allows you to change the current playing position in the the input component.

Functions

SeekInternal

function SeekInternal(var SampleNum : Int64) : Boolean; virtual; abstract

This abstract method should be overridden with an implementation dependong on whether your input component is seekable or not.  If your component is not seekable then you can write a method like the following.

function TMyComponent.SeekInternal(var SampleNum : Int64) : Boolean;
begin
  Result := False;
end;

If you want to make your component seekable you have to implement real seeking in this function.

Properties

EndSample

Set this property’s value to the sample (frame) you want the input to stop playing at.  By default it is set to -1 which indicates “play to the end of input.”  Changing this property value has an effect only when the component is idle.

Loop

If set to True, the input loops (i.e. starts again from the beginning after it is finished).

StartSample

Set this property’s value to the sample (frame) you want the input to start playing from.  By default it is set to 0.  Calling the Seek method when the component is idle has the same effect.  Note that when you set StartSample and EndSample properties you define a subrange of the input data.  All further operations, such as playback and <Seek>ing will be performed within this subrange.  The StartSample and EndSample values also affect the <TotalSamples> and <Size> values, returned by the component.

Seekable

This read only property indicates when the input is seekable.

Stream

Use this property to set the input data stream for the input component.  Any TStream descendant may be used as a data source.  Note that if you set Stream, you own it, that is you have to create, destroy and position the stream explicitly.  In TAuFileIn descendants the value assigned to this property takes over the FileName property, i. e. if both Stream and FileName properties are assigned, the stream and not the file will be used for the actual input.  To unassign this property set it to nil.  If the stream is seekable it will be reset to the beginning at the end of the playback.

Functions

Seek

function Seek(SampleNum : Int64) : Boolean

This method allows you to change the current playing position in the the input component.  If the input component is stopped or paused, calling Seek sets the sample from which the playback will begin.  Note that not all inputs are seekable.

Parameters

SampleNumThe number of sample (frame) to play from.  This number is set relative to the value of StartSample.

Returns

BooleanA False value indicates that either a seek failed (you are seeking beyond the end of file or the EndSample value) or that the input stream is not seekable.

TAuStreamedOutput

A descendant of TAuOutput to deal with streams.

TAuFileIn

A descendant of TAuStreamedInput to deal with files and streams.  All the components that read files descend from this class.

Summary
Functions
OpenFileOpens the file or stream if it is not already open.
CloseFileCloses the file opened with OpenFile.
SetStartTimeThis function is a wrapper around StartSample property, provided for convenience.
SetEndTimeThis function is a wrapper around EndSample property, provided for convenience.
JumpThis method, being a wrapper around <Seek>, simpifies navigation in the input stream.
Properties
ValidRead this property to determine if the file is valid.
WideFileNameAllows you to handle file names in Unicode.
FilenameFile name in 8-bit encoding.

Functions

OpenFile

procedure OpenFile; virtual; abstract

Opens the file or stream if it is not already open.  For performance reasons the file is opened when any of its data is accessed the first time and is then kept open until it is done with.  The descendants’ FileOpen implementations use the FOpened constant to check if the file is already opened.

Note

This method is called internally by TAuInput.Init, you should never call it directly.

CloseFile

procedure CloseFile; virtual; abstract

Closes the file opened with OpenFile.  Sets the FOpened constant to 0.

Note

This method is called internally by TAuInput.Flush, you should never call it directly.

SetStartTime

function SetStartTime(Minutes, 
Seconds : LongWord) : Boolean

This function is a wrapper around StartSample property, provided for convenience.  It allows you to set playback start position in minutes and seconds.

Parameters

Minutes : LongWordMinutes
Seconds : LongWordSeconds

Note

SetStartTime(1, 30);

and

SetStartTime(0, 90);

are both allowed.

SetEndTime

function SetEndTime(Minutes, 
Seconds : LongWord) : Boolean

This function is a wrapper around EndSample property, provided for convenience.  It allows you to set playback stop position in minutes and seconds.

Parameters

Minutes : LongWordMinutes
Seconds : LongWordSeconds

Jump

This method, being a wrapper around <Seek>, simpifies navigation in the input stream.  Calling Jump moves you backward or forward relative to the current position.  Jump may be called either before starting playback (in this case the playback will be started from the position specified) or during the playback.

Parameters

Offsthe amount of file contents, in percent, that will be skipped.  Positive value skips forward, negative value skips backward.

For example calling Jump(-100) always sets the playing position at the beginning of the file.

Note

Use <Seek> for more exact positioning.

Properties

Valid

Read this property to determine if the file is valid.  It is a good practice to check this property before performing other operations on audio stream.  Note however that True returned by Valid doesn’t guarantee the file is fully playable.  It indicates only that the file could be opened successfully and the file headers were correct.  This property also returns False if the decoder library required to play the file cannot be loaded.

WideFileName

Allows you to handle file names in Unicode.  Setting its value overrides the value set to FileName.

Filename

File name in 8-bit encoding.  Setting this property’s value overrides the value set to WideFileName.

TAuTaggedFileIn

Descends from TAuFileIn, this class is an ancestor of the file input components that use ID3V* tags.

TAuFileOut

A descendant of TAuStreamedOutput to deal with files and streams.

Summary
Properties
FileModeThis property can take one of two values foRewrite (default) and foAppend.
WideFileNameAllows you to handle file names in Unicode.
FilenameFile name in 8-bit encoding.

Properties

FileMode

This property can take one of two values foRewrite (default) and foAppend.  In the foRewrite mode the new file overwrites the previous one (if it existed).  In the foAppend mode the new content is added to the existing.  Currently only TWaveOut and TVorbisOut components support this mode.

WideFileName

Allows you to handle file names in Unicode.  Setting its value overrides the value set to FileName.

Filename

File name in 8-bit encoding.  Setting this property’s value overrides the value set to WideFileName.

TAuTaggedFileOut

Descends from TAuFileOut, this class is an ancestor of the file output components that use Id3v* tags.

TAuConverter

Descends from TAuInput, the base class for all converter components.  Converters are laced between input and output in the audio-processing chain.  See NewAC Introduction for more information on the converters.

Summary
Properties
InputLike the output components, converters can be assigned an input.

Properties

Input

Like the output components, converters can be assigned an input.  Unlike the output components converters themselves can be input sources (for output components and other converters).

TAudioTap

This is the base class for all “audio tap components”.  Technically audio taps are converters as they sit between input and output components in the audio-processing chain.  But audio taps do not modify audio data passing trough them.  Instead they write everithing passing through into some audio file.

The main goal of audio tap components is to make the audio-processing chain to perform several tasks at once: record while you listen, save data at several formats simultaneously, etc.

Descends from TAuConverter.

Summary
Functions
StartRecordCall this method to start recording audio data passing through an audio tap.
StopRecordCall this method to stop recording.
PauseRecordCall this method to pause recording.
ResumeRecordCall this method to resume paused recording.
Properties
StatusRead this property to get the component status.
WideFileNameUse this proeprty to set or get the file name the data is written to in Unicode charset.
FileNameUse this proeprty to set or get the file name the data is written to in 8-bit charset.

Functions

StartRecord

procedure StartRecord

Call this method to start recording audio data passing through an audio tap.

StopRecord

procedure StopRecord

Call this method to stop recording.

PauseRecord

procedure PauseRecord

Call this method to pause recording.

ResumeRecord

procedure ResumeRecord

Call this method to resume paused recording.

Properties

Status

Read this property to get the component status.  The possible values are tosIdle (the component passes data through without recording), tosPlaying (the component records data) and tpsPaused.

WideFileName

Use this proeprty to set or get the file name the data is written to in Unicode charset.  The value assigned to this prperty overrides FileName

FileName

Use this proeprty to set or get the file name the data is written to in 8-bit charset.  The value assigned to this prperty overrides WideFileName

procedure GetData(var Buffer : Pointer;
var Bytes : LongWord); virtual
This method retrieves input data.
function CopyData(Buffer : Pointer;
BufferSize : Integer) : LongWord
Writes no more than BufferSize data into Buffer
function FillBuffer(Buffer : Pointer;
BufferSize : LongWord;
var EOF : Boolean) : LongWord
The same as CopyData but tries to fill the Buffer.
procedure Init
This method prepares input component for reading data.
procedure Flush
This method closes the current input (opened with Init), clearing up all temporary structures allocated during data transfer.
procedure Pause
Pauses the output.
procedure Resume
Resumes previously paused output.
procedure Run
After an input component has been assigned, call Run to start the audio processing chain.
procedure BlockingRun
In some situations, such as console programs or DUnit test units, background processing is not desirable.
procedure Stop(Async : Boolean = True)
Stops the busy component or does nothing if the component is idle.
The ancestor class for all input components.
function SeekInternal(var SampleNum : Int64) : Boolean; virtual; abstract
This abstract method should be overridden with an implementation dependong on whether your input component is seekable or not.
function Seek(SampleNum : Int64) : Boolean
This method allows you to change the current playing position in the the input component.
The ancestor class for all output components.
A descendant of TAuInput to deal with streams.
procedure OpenFile; virtual; abstract
Opens the file or stream if it is not already open.
procedure CloseFile; virtual; abstract
Closes the file opened with OpenFile.
function SetStartTime(Minutes, 
Seconds : LongWord) : Boolean
This function is a wrapper around StartSample property, provided for convenience.
function SetEndTime(Minutes, 
Seconds : LongWord) : Boolean
This function is a wrapper around EndSample property, provided for convenience.
A descendant of TAuStreamedInput to deal with files and streams.
A descendant of TAuOutput to deal with streams.
A descendant of TAuStreamedOutput to deal with files and streams.
procedure StartRecord
Call this method to start recording audio data passing through an audio tap.
procedure StopRecord
Call this method to stop recording.
procedure PauseRecord
Call this method to pause recording.
procedure ResumeRecord
Call this method to resume paused recording.
Performs audio recording from a sound card using the DirectX API.
A read only property which returns input data size in bytes.
OnProgress event is raised periodically to indicate output progress.
Raised when the component has finished its job or was stopped asynchronously.
Performs audio playback using the DirectX API.
This event is raised if an exception has occurred.
Read Progress to get the output progress in percents.
Most exceptions that may occur during NewAC operation are suppressed.
Set this property’s value to the sample (frame) you want the input to start playing from.
Set this property’s value to the sample (frame) you want the input to stop playing at.
Allows you to handle file names in Unicode.
Wave file encoder.
The Ogg Vorbis encoder component.
Allows you to handle file names in Unicode.
Descends from TAuInput, the base class for all converter components.
Use this proeprty to set or get the file name the data is written to in 8-bit charset.
Use this proeprty to set or get the file name the data is written to in Unicode charset.
Close