Ancestor classes for all input and output components.
| ACS_Classes | Ancestor classes for all input and output components. |
| TAuFileStream | TFileStream analog that handles Unicode. |
| TAuThread | Custom TThread descendant that does something. |
| TAuInput | The ancestor class for all input components. |
| Functions | |
| GetData | This method retrieves input data. |
| CopyData | Writes no more than BufferSize data into Buffer |
| FillBuffer | The same as CopyData but tries to fill the Buffer. |
| Init | This method prepares input component for reading data. |
| Flush | This method closes the current input (opened with Init), clearing up all temporary structures allocated during data transfer. |
| Properties | |
| BitsPerSample | The number of bits per sample in the input stream. |
| 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. |
| Size | A read only property which returns input data size in bytes. |
| TotalSamples | A read only property which returns number of samples (frames) in the input stream. |
| TotalTime | A read only property which returns input playback time in seconds. |
| TAuOutput | The ancestor class for all output components. |
| Functions | |
| Pause | Pauses the output. |
| Resume | Resumes previously paused output. |
| Run | After an input component has been assigned, call Run to start the audio processing chain. |
| BlockingRun | In some situations, such as console programs or DUnit test units, background processing is not desirable. |
| Stop | Stops the busy component or does nothing if the component is idle. |
| 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. |
| Status | This read only property indicates the output component’s current status. |
| TimeElapsed | The time in seconds that has passed since the playback was started. |
| ExceptionMessage | Most exceptions that may occur during NewAC operation are suppressed. |
| Input | This property allows you to set the input component for the output component. |
| OnDone | Raised when the component has finished its job or was stopped asynchronously. |
| OnProgress | OnProgress event is raised periodically to indicate output progress. |
| OnThreadException | This event is raised if an exception has occurred. |
| TAuStreamedInput | A descendant of TAuInput to deal with streams. |
| Functions | |
| SeekInternal | This abstract method should be overridden with an implementation dependong on whether your input component is seekable or not. |
| Properties | |
| EndSample | Set this property’s value to the sample (frame) you want the input to stop playing at. |
| Loop | If set to True, the input loops (i.e. |
| StartSample | Set this property’s value to the sample (frame) you want the input to start playing from. |
| 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. |
| Functions | |
| Seek | This method allows you to change the current playing position in the the input component. |
| TAuStreamedOutput | A descendant of TAuOutput to deal with streams. |
| TAuFileIn | A descendant of TAuStreamedInput to deal with files and streams. |
| Functions | |
| OpenFile | Opens the file or stream if it is not already open. |
| CloseFile | Closes the file opened with OpenFile. |
| SetStartTime | This function is a wrapper around StartSample property, provided for convenience. |
| SetEndTime | This function is a wrapper around EndSample property, provided for convenience. |
| Jump | This method, being a wrapper around <Seek>, simpifies navigation in the input stream. |
| Properties | |
| Valid | Read this property to determine if the file is valid. |
| WideFileName | Allows you to handle file names in Unicode. |
| Filename | File name in 8-bit encoding. |
| 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. |
| Properties | |
| FileMode | This property can take one of two values foRewrite (default) and foAppend. |
| WideFileName | Allows you to handle file names in Unicode. |
| Filename | File name in 8-bit encoding. |
| 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. |
| Properties | |
| Input | Like the output components, converters can be assigned an input. |
| TAudioTap | This is the base class for all “audio tap components”. |
| Functions | |
| StartRecord | Call this method to start recording audio data passing through an audio tap. |
| StopRecord | Call this method to stop recording. |
| PauseRecord | Call this method to pause recording. |
| ResumeRecord | Call this method to resume paused recording. |
| Properties | |
| Status | Read this property to get the component status. |
| WideFileName | Use this proeprty to set or get the file name the data is written to in Unicode charset. |
| FileName | Use this proeprty to set or get the file name the data is written to in 8-bit charset. |
The ancestor class for all input components.
| Functions | |
| GetData | This method retrieves input data. |
| CopyData | Writes no more than BufferSize data into Buffer |
| FillBuffer | The same as CopyData but tries to fill the Buffer. |
| Init | This method prepares input component for reading data. |
| Flush | This method closes the current input (opened with Init), clearing up all temporary structures allocated during data transfer. |
| Properties | |
| BitsPerSample | The number of bits per sample in the input stream. |
| 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. |
| Size | A read only property which returns input data size in bytes. |
| TotalSamples | A read only property which returns number of samples (frames) in the input stream. |
| TotalTime | A read only property which returns input playback time in seconds. |
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.
| Buffer | This 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. |
| Bytes | When 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. |
Usually you should not call this method directly.
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.
| Buffer: Pointer | the buffer to write to |
| BufferSize: Integer | the number of bytes to write |
| var EOF: Boolean | set to True if end of data was reached while filling the buffer. |
| Integer | Number of bytes written |
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;
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;
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
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.
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.
The ancestor class for all output components.
| Functions | |
| Pause | Pauses the output. |
| Resume | Resumes previously paused output. |
| Run | After an input component has been assigned, call Run to start the audio processing chain. |
| BlockingRun | In some situations, such as console programs or DUnit test units, background processing is not desirable. |
| Stop | Stops the busy component or does nothing if the component is idle. |
| 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. |
| Status | This read only property indicates the output component’s current status. |
| TimeElapsed | The time in seconds that has passed since the playback was started. |
| ExceptionMessage | Most exceptions that may occur during NewAC operation are suppressed. |
| Input | This property allows you to set the input component for the output component. |
| OnDone | Raised when the component has finished its job or was stopped asynchronously. |
| OnProgress | OnProgress event is raised periodically to indicate output progress. |
| OnThreadException | This event is raised if an exception has occurred. |
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.
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.
procedure Stop( Async : Boolean = True )
Stops the busy component or does nothing if the component is idle.
| Async: Boolean = True | If 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. |
This read only property indicates the output component’s current status. Possible values are:
| tosPlaying | the component is performing its task; |
| tosPaused | the component is paused (the Pause method was called) |
| tosIdle | the component is idle |
The time in seconds that has passed since the playback was started. Useful for real time components like TDXAudioOut.
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.
This property allows you to set the input component for the output component. The valid input components must be descendants of TAuInput.
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.
This event is raised if an exception has occurred. Exception string is stored in ExceptionMessage.
A descendant of TAuInput to deal with streams.
| Functions | |
| SeekInternal | This abstract method should be overridden with an implementation dependong on whether your input component is seekable or not. |
| Properties | |
| EndSample | Set this property’s value to the sample (frame) you want the input to stop playing at. |
| Loop | If set to True, the input loops (i.e. |
| StartSample | Set this property’s value to the sample (frame) you want the input to start playing from. |
| 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. |
| Functions | |
| Seek | This method allows you to change the current playing position in the the input component. |
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.
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.
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.
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.
| SampleNum | The number of sample (frame) to play from. This number is set relative to the value of StartSample. |
| Boolean | A 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. |
A descendant of TAuOutput to deal with streams.
A descendant of TAuStreamedInput to deal with files and streams. All the components that read files descend from this class.
| Functions | |
| OpenFile | Opens the file or stream if it is not already open. |
| CloseFile | Closes the file opened with OpenFile. |
| SetStartTime | This function is a wrapper around StartSample property, provided for convenience. |
| SetEndTime | This function is a wrapper around EndSample property, provided for convenience. |
| Jump | This method, being a wrapper around <Seek>, simpifies navigation in the input stream. |
| Properties | |
| Valid | Read this property to determine if the file is valid. |
| WideFileName | Allows you to handle file names in Unicode. |
| Filename | File name in 8-bit encoding. |
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.
This method is called internally by TAuInput.Init, you should never call it directly.
procedure CloseFile; virtual; abstract
Closes the file opened with OpenFile. Sets the FOpened constant to 0.
This method is called internally by TAuInput.Flush, you should never call it directly.
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.
| Minutes : LongWord | Minutes |
| Seconds : LongWord | Seconds |
SetStartTime(1, 30);
and
SetStartTime(0, 90);
are both allowed.
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.
| Offs | the 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.
Use <Seek> for more exact positioning.
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.
File name in 8-bit encoding. Setting this property’s value overrides the value set to WideFileName.
Descends from TAuFileIn, this class is an ancestor of the file input components that use ID3V* tags.
A descendant of TAuStreamedOutput to deal with files and streams.
| Properties | |
| FileMode | This property can take one of two values foRewrite (default) and foAppend. |
| WideFileName | Allows you to handle file names in Unicode. |
| Filename | File name in 8-bit encoding. |
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.
File name in 8-bit encoding. Setting this property’s value overrides the value set to WideFileName.
Descends from TAuFileOut, this class is an ancestor of the file output components that use Id3v* tags.
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.
| Properties | |
| Input | Like the output components, converters can be assigned an input. |
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.
| Functions | |
| StartRecord | Call this method to start recording audio data passing through an audio tap. |
| StopRecord | Call this method to stop recording. |
| PauseRecord | Call this method to pause recording. |
| ResumeRecord | Call this method to resume paused recording. |
| Properties | |
| Status | Read this property to get the component status. |
| WideFileName | Use this proeprty to set or get the file name the data is written to in Unicode charset. |
| FileName | 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. The value assigned to this prperty overrides 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
This method retrieves input data.
procedure GetData( var Buffer : Pointer; var Bytes : LongWord ); virtual
Writes no more than BufferSize data into Buffer
function CopyData( Buffer : Pointer; BufferSize : Integer ) : LongWord
The same as CopyData but tries to fill the Buffer.
function FillBuffer( Buffer : Pointer; BufferSize : LongWord; var EOF : Boolean ) : LongWord
This method prepares input component for reading data.
procedure Init
This method closes the current input (opened with Init), clearing up all temporary structures allocated during data transfer.
procedure Flush
Pauses the output.
procedure Pause
Resumes previously paused output.
procedure Resume
After an input component has been assigned, call Run to start the audio processing chain.
procedure Run
In some situations, such as console programs or DUnit test units, background processing is not desirable.
procedure BlockingRun
Stops the busy component or does nothing if the component is idle.
procedure Stop( Async : Boolean = True )
This abstract method should be overridden with an implementation dependong on whether your input component is seekable or not.
function SeekInternal( var SampleNum : Int64 ) : Boolean; virtual; abstract
This method allows you to change the current playing position in the the input component.
function Seek( SampleNum : Int64 ) : Boolean
Opens the file or stream if it is not already open.
procedure OpenFile; virtual; abstract
Closes the file opened with OpenFile.
procedure CloseFile; virtual; abstract
This function is a wrapper around StartSample property, provided for convenience.
function SetStartTime( Minutes, Seconds : LongWord ) : Boolean
This function is a wrapper around EndSample property, provided for convenience.
function SetEndTime( Minutes, Seconds : LongWord ) : Boolean
Call this method to start recording audio data passing through an audio tap.
procedure StartRecord
Call this method to stop recording.
procedure StopRecord
Call this method to pause recording.
procedure PauseRecord
Call this method to resume paused recording.
procedure ResumeRecord