TPcxOutputStream
TPcxOutputStream sends the data from the file to the Pipe he is connected to.
To mix several streams on a pipe : you just drop several TPcxOutputStream components on the window and connect them to the same Pipe.
TPcxOutputStream.AfterPlay
AfterPlay occurs right after the execution Play method.
TPcxStreamEventResult = procedure(Sender: TObject; Success : Boolean) of
object;
property AfterPlay : TPcxStreamEventResult;
Description
Use AfterPlay to execute a particular action right after a call to the Play method.
The Success parameter returns the result of the operation :
True : the Play method has been correctly executed.
False : the Play method failed.
This event is synchronous, it is not released by a Windows message.
See also
Play, BeforePlay, BeforeStop, AfterStop

TPcxOutputStream.AfterStop
AfterStop occurs right after the Stop method execution.
TPcxStreamEventResult = procedure(Sender: TObject; Success : Boolean) of
object;
property AfterStop : TPcxStreamEventResult;
Description
Use AfterStop to execute a particular right after a call to the Stop action.
The Success parameter returns the result of the operation :
True : the Stop method has been correctly executed.
False : the Stop method failed.
This event is synchronous, it is not released by a window message.
See also
Stop, BeforeStop, AfterPlay, BeforePlay

TPcxOutputStream.Append
Example
Append adds the file FileName to the file list to be played by the stream.
function Append : Boolean; override;
Description
Append adds a file to the file list to be played by the stream.
If the stream is already playing, the file is stored on an internal waiting list, if it's not playing,
the Play method will start it immediately.
If the operation succeeds, the Append method returns True, if not as False and a call to the ToolGetLastError method returns the error code generated by PCXtools.
See also
Play, Stop, Pause

TPcxOutputStream.BeforePlay
BeforePlay occurs right before the execution of the Play method.
TPcxStreamEvent = procedure(Sender: TObject) of object;
property BeforePlay : TPcxStreamEvent;
Description
Use BeforePlay to execute a particular action right before a call to the Play method.
This event is synchronous, it is not released by a window message.
See also
Play, AfterPlay, BeforeStop, AfterStop

TPcxOutputStream.BeforeStop
BeforeStop occurs right before the execution of the Stop method.
TPcxStreamEvent = procedure(Sender: TObject) of object;
property BeforeStop : TPcxStreamEvent;
Description
Use BeforeStop to execute a particular action right before the call to the Stop method.
This event is synchronous, it is not released by a window message.
See also
Stop, AfterStop, BeforePlay, AfterPlay

TPcxOutputStream.ElapseTimeAsMS
The ElapseTimeAsMS property returns the elapsed time, in milliseconds, since the start of the stream.
property ElapseTimeAsMS : DWord;
Description
This property, in read only mode, returns the elapsed time in milliseconds since the start of the stream.
If the stream is BUSY, ElapseTimeAsMS returns a value different than 0, in all other cases this value is equal to 0.
See also
ElapseTimeAsSeconds, ElapseTimeAsSamples, RemainTimeAsMS

TPcxOutputStream.ElapseTimeAsSamples
The ElapseTimeAsSamples property returns the elapsed time as samples, since the start of the stream.
property ElapseTimeAsSamples : DWord;
Description
This property, at read only mode, returns the elapsed time as samples since the start of the stream.
If the stream is BUSY ElapseTimeAsSamples returns a value different than 0, in all other cases this value will be 0.
See also
ElapseTimeAsMS, ElapseTimeAsSeconds, RemainTimeAsSamples

TPcxOutputStream.ElapseTimeAsSeconds
The ElapseTimeAsSeconds property returns the elapsed time, as seconds, since the start of the stream.
property ElapseTimeAsSeconds : Single;
Description
This property, at read mode only, returns the elapsed time as seconds since the start of the stream.
If the stream is BUSY ElapseTimeAsSeconds returns a value different than 0, in all other cases this value will be equal to 0.
See also
ElapseTimeAsMS, ElapseTimeAsSamples, RemainTimeAsSeconds

TPcxOutputStream.EndPos
Example
EndPos specifies the position in the file where the stream must stop playing.
property EndPos : DWord;
Description
EndPos specifies the position in the file FileName where the stream must stop playing. The PosUnit property specifies the time unit used to compute the position (Milliseconds, Samples or bytes).
Note
EndPos is taken in account when calling the Playmethod.
See also
PosUnit, StartPos, LoopPos, MaxLoop

TPcxOutputStream.FileLevel
The FileLevel property specifies or returns the digital output level of the stream when starting.
property FileLevel : Single;
Description
This property specifies or returns the digital output level of the stream when starting.
The level is expressed in dB
See also
Level, SetPanLevel, GetPanLevel

TPcxOutputStream.FileName
The FileName property specifies the audio filename that must be used by the stream.
property FileName : String;
Description
This property returns or specifies the audio filename that must be loaded or played by the stream.
See also
Play, Load

TPcxOutputStream.GetInfo
GetInfo returns the info about the stream.
function GetInfo(var ElapseTime,RemainTime : DWord; var FileName : string;
LoopFlag : Boolean) : Boolean;
Description
Call GetInfo to collect most of the info available about the stream.
Elapsetime : elapsed time since the start of the stream expressed in (see ToolSetTimeUnit).
RemainTime : remaining time to be played by the stream expressed in (see ToolSetTimeUnit).
FileName : Name of the file actually read.
LoopFlag : Loop state.
True : the stream is going to loop.
False : the stream won't loop.
If the operation is successful, the GetInfo method returns True, if not it returns False and a call to the ToolGetLastError method returns the error code generated by PCXtools.
See also
Status, StatusAsString

TPcxOutputStream.GetPanLevel
GetPanLevel returns the left and right audio channel levels of the stream.
function GetPanLevel(var LeftToLeft,LeftToRight,RightToLeft,RightToRight
: Single) : Boolean;
Description
Use GetPanLevel to read the left and right audio channel levels of the stream.
LeftToLeft : audio level of the left stream channel send on the left pipe channel to which the stream is connected to.
LeftToRight : audio level of the left stream channel send on the right pipe channel to which the stream is connected to.
RightToLeft : audio level of the right stream channel send on the left pipe channel to which the stream is connected to.
RightToRight :audio level of the right stream channel send on the right pipe channel to which the stream is connected to.
All values are expressed in dB.
See also
SetPanLevel, Level

TPcxOutputStream.GetPositionAsMS
GetPositionAsMS returns the current stream position expressed in milliseconds.
function GetPositionAsMS(var ElapseTime,RemainTime : DWord) : Boolean; override;
Description
GetPositionAsMS returns the current stream position :
ElapseTime : elapsed time since the stream start.
RemainTime : remaining time till the stream stop.
If the operation is successful, the GetPositionAsMS method returns True, if not as False and a call to the ToolGetLastError function returns the error code generated by PCXtools.
See also
ElapseTimeAsMS, RemainTimeAsMS

TPcxOutputStream.GetPositionAsSamples
GetPositionAsSamples returns the current stream position expressed as samples.
function GetPositionAsSamples(var ElapseTime,RemainTime : DWord) : Boolean;
override;
Description
GetPositionAsSamples returns the current stream position :
ElapseTime : elapsed time since the stream start up.
RemainTime : remaining time before the stop of the stream.
If the operation is successful, the GetPositionAsSamples method returns True, if not as False and a call to the ToolGetLastError function returns the error code generated by PCXtools.
See also
ElapseTimeAsSamples, RemainTimeAsSamples

TPcxOutputStream.Handle
The Handle property returns the handle number of the stream.
property Handle : Stream_Type;
Description
This property is a read only feature, the value of the handle is automatically determined when connecting the stream to the pipe.
If Handle = 0, the stream is not connected to the pipe.
The value of the Handle is not determined by PCXtools, Delphi ToolBox for PCX uses an internal mechanism to attribute the stream handles.
Use this handle to call directly the API PCXtools functions.
See also
MaxStreams, OutputPipe

TPcxOutputStream.Initialized
The Initialized property returns the loading state of the stream.
property Initialized : Boolean;
Description
This property is read only, returns as True if a Load method has been executed, in other words if the stream is ready to play.
See also
Play, Stop, Load

TPcxOutputStream.Level
The Level property specifies or returns the digital level of the stream.
property Level : Single;
Description
This property specifies or returns the output digital level of the stream.
See also
TPcxStreamLevelBar

TPcxOutputStream.Load
Load opens the file specified by FileName and prepares the stream to play.
function Load : Boolean; override;
Description
Call Load to open the file specified by FileName and prepares the stream to play, this method preloads the stream buffers to make sure of an immediate start when calling the Play method.
Use the Load method when the time to access the peripheral device, where the file to be played is located, is rather long.
Example : networks, CD-ROM...
If the operation is successful, the Load method returns True, if not as False and a call to the ToolGetLastError function returns the error code generated by PCXtools.
Note
Actually Load doesn't preload the buffers, this feature will be available at the same time as PCXtools2NP.
See also
Play, Stop, Initialized, Status

TPcxOutputStream.LoopPos
The LoopPos property determines the position in the file where the stream must loop.
property LoopPos : DWord;
Description
The LoopPos property determines the position in the file where the stream must loop. If LoopPos <> 0 and if MaxLoop > 0 then the stream loops between LoopPos and EndPos as soon as it has reached the position specified by EndPos.
The PosUnit property determines the time unit used to compute the positions (Milliseconds, Samples or bytes).
Note
LoopPos is taken in account when calling the Play method.
See also
StartPos, EndPos, MaxLoop

TPcxOutputStream.MaxLoop
The MaxLoop property specifies how many loops to perform.
property MaxLoop : Smallint;
Description
The MaxLoop property specifies how many loops to perform, if MaxLoop = C_INFINITE_LOOP (-1), the stream will loop indefinitely between StartPos and EndPos.
Note
MaxLoop is taken in account when calling the Play method.
See also
StartPos, EndPos, LoopPos

TPcxOutputStream.Mute
Example
Mute returns or modifies the mute state of the stream.
property Mute : Boolean;
Description
This property returns or modifies the mute state of the stream.
If Mute = True, the stream is muted.
If Mute = False, the stream is not muted.
See also:
See also
GetPanLevel, SetPanLevel, Level

TPcxOutputStream.NotifyBeforeEnd
The NotifyBeforeEnd property determines at which moment a OnEndStream event must be released.
property NotifyBeforeEnd : DWord;
Description
The NotifyBeforeEnd property determines at which moment the OnEndStream event must be released. The release of the event is computed in relationship with the end of the stream.
Example : if NotifyBeforeEnd = 5000, the OnEndStream event will be released 5 seconds before the end of the stream.
See also
OnEndStream, PosUnit

TPcxOutputStream.OnBeginFile
OnBeginFile occurs every time that a file starts to play.
TPcxStreamEvent = procedure(Sender: TObject) of object;
property OnBeginFile : TPcxStreamEvent;
Description
Use OnBeginFile to execute a particular action at each start of a file.
This event is asynchronous, it is released by the C_TELL_BEGIN_FILE message posted by PCXtools.
Note
The mechanism for asynchronous events placed by Delphi ToolBox for PCX distributes automatically the messages to all the streams, this can't be done actually by ToolSetMsgNotify.
See also
OnEndFile, OnCloseFile, OnEndStream, OnError

TPcxOutputStream.OnCloseFile
OnCloseFile occurs every time that a file is closed.
TPcxStreamEvent = procedure(Sender: TObject) of object;
property OnCloseFile : TPcxStreamEvent;
Description
Use OnCloseFile to execute a particular action at each closure of a file.
Attention, OnCloseFile occurs when the file is closed but not ended, this means generally that OnClosefile occurs before OnEndFile.
This event is asynchronous, it is released by the C_TELL_CLOSE_FILE message posted by PCXtools.
Note
The mechanism for asynchronous events placed by Delphi ToolBox for PCX distributes automatically the messages to all the streams, this can't be done actually by ToolSetMsgNotify.
See also
OnBeginFile, OnEndFile, OnEndStream, OnError

TPcxOutputStream.OnEndFile
OnEndFile occurs every time a file ends.
TPcxStreamEvent = procedure(Sender: TObject) of object;
property OnEndFile : TPcxStreamEvent;
Description
Use OnEndFile to execute a particular action at each file end.
Attention, OnEndFile occurs when the file is ended, and when the file is closed and buffers empty.
This event is asynchronous, it is released by the C_TELL_END_FILE message posted by PCXtools.
Note
The mechanism for asynchronous events placed by Delphi ToolBox for PCX distributes automatically all the messages to all the streams, this can't be done actually by ToolSetMsgNotify.
See also
OnBeginFile, OnCloseFile, OnEndStream, OnError

TPcxOutputStream.OnEndStream
OnEndStream occurs every time that stream ends.
TPcxStreamEvent = procedure(Sender: TObject) of object;
property OnEndStream : TPcxStreamEvent;
Description
Use OnEndStream to execute a particular action at each stream ending, when the file list is finished, buffers empty and that the stream doesn't have anything more to play.
By modifying the NotifyBeforeEnd property, you are able to change the moment when this event occurs.
This event is asynchronous, it is released by the C_TELL_BEFORE_END_STREAM message posted by PCXtools.
Note
The mechanism for asynchronous events placed by Delphi ToolBox for PCX distributes automatically the messages to all the streams, this can't be done actually by ToolSetMsgNotify.
See also
NotifyBeforeEnd, OnBeginFile, OnEndFile, OnCloseFile, OnError

TPcxOutputStream.OnError
OnError occurs every time that PCXtools detects an error.
TPcxStreamEvent = procedure(Sender: TObject) of object;
property OnError : TPcxStreamEvent;
Description
Use OnError to detect the errors generated by PCXtools.
This event is asynchronous, it is released by C_TELL_ERROR_RUNTIME message posted by PCXtools.
Note
The mechanism for asynchronous events placed by Delphi ToolBox for PCX distributes automatically the messages to all the streams, this can't be done actually by ToolSetMsgNotify.
See also
OnBeginFile, OnEndFile, OnCloseFile, OnEndStream

TPcxOutputStream.OutputPipe
The OutputPipe property specifies the pipe towards the stream must send the data.
property OutputPipe : TPcxOutputPipe;
Description
This property specifies or returns, the pipe towards the stream must send the data. If the pipe is destroyed, this property returns nil.
Attention, OutputPipe modifies the value of the Handle property.
See also
Handle, TPcxOutputPipe

TPcxOutputStream.Pause
Pause stops temporarily the stream.
function Pause(Value : Boolean) : Boolean; override;
Description
Use Pause to stop temporarily the stream.
Value = True, the stream stops.
Value = False, the stream restarts.
Note that when the stream stops temporarily, the ElapseTime and RemainTime properties returns the last position before the pause, the time count will restart as soon the stream restarts.
If the operation is successful, the Pause method returns True, if not it returns False and a call to the ToolGetLastError function returns the error code generated by PCXtools.
See also
Play, Stop, Append

TPcxOutputStream.Play
Example
Play starts the stream.
function Play : Boolean; override;
Description
Use Play to start the stream.
If the stream buffers have been preloaded using the Load method, the start will be instantaneous (even on slow peripherals), on the contrary, the Play method will open the file specified by FileName and will start the stream.
If the operation is successful, the Play method returns True, if not it returns False and a call to the ToolGetLastError function returns the error code by PCXtools.
Note
Actually Load doesn't preload the buffers, this will only be available at the same time as PCXtools2NP.
See also
Stop,Load, Initialized, Status

TPcxOutputStream.PosUnit
PosUnit determines the computing unit used to express the StartPos, EndPos and LoopPos properties.
TPosUnit = (poByte,poMS,poSample);
property PosUnit : TPosUnit;
Description
PosUnit determines the computing unit used to express the StartPos, EndPos and LoopPos properties.
The available values are :
poByte : the time is computed as bytes.
poMS : the time is computed as milliseconds.
poSample : the time is computed as samples.
See also
StartPos, EndPos, LoopPos

TPcxOutputStream.RemainTimeAsMS
The RemainTimeAsMS property returns, as milliseconds, the remaining time that the stream has to play.
property RemainTimeAsMS : DWord;
Description
This property, as read only, returns, as milliseconds, the remaining time that the stream has to play.
If the stream plays, RemainTimeAsMS returns a value different than 0, in all other cases this value is equal to 0.
See also
RemainTimeAsSecondes, RemainTimeAsSample, ElapseTimeAsMS

TPcxOutputStream.RemainTimeAsSamples
The RemainTimeAsSamples property returns, as samples, the remaining time the stream has to play.
property RemainTimeAsSamples : DWord;
Description
This property, in read only mode, returns as samples the remaining time the stream has to play.
If the stream plays, RemainTimeAsSamples returns a value different than 0, in all other cases this value will be equal to 0.
See also
RemainTimeAsSecondes, RemainTimeAsMS, ElapseTimeAsSamples

TPcxOutputStream.RemainTimeAsSeconds
The RemainTimeAsSeconds property returns, as seconds, the remaining time the stream has to play.
property RemainTimeAsSecondes : DWord;
Description
This property, read only mode, returns, as seconds, the remaining time the stream has to play.
If the stream plays, RemainTimeAsSeconds returns a value different than 0, in all other cases this value will be equal to 0.
See also
RemainTimeAsMS, RemainTimeAsSamples, ElapseTimeAsSeconds

TPcxOutputStream.SetPanLevel
SetPanLevel modifies the left and right audio levels of the stream.
function SetPanLevel(LeftToLeft,LeftToRight,RightToLeft,RightToRight : Single)
: Boolean;
Description
Use SetPanLevel to modify separately the left and right audio levels of the stream.
LeftToLeft : left channel audio level to be send on the left channel of the pipe to which the stream is connected to.
LeftToRight : left channel audio level to be send on the right channel of the pipe to which the stream is connected to.
RightToLeft : right channel audio level to be send on the left channel of the pipe to which the stream is connected to.
RightToRight :right channel audio level to be send on the right channel of the pipe to which the stream is connected to.
All values are expressed as dB. Use the C_LEVEL_NO_CHANGE constant to keep an unchanged level.
Note
TPcxStreamLevelBar uses this method to modify the stream gain at each move of the cursor.
See also
GetPanLevel, Level

TPcxOutputStream.StartPos
Example
StartPos determines the starting position in the file used by the stream when starting to play.
property EndPos : DWord;
Description
StartPos determines the starting position in the file used by the stream when starting to play.
The PosUnit property determines which time will be used when computing the position (Milliseconds, Samples or Bytes).
Note
StartPos is taken in account by a call to the Play method.
See also
EndPos, LoopPos, MaxLoop, PosUnit

TPcxOutputStream.Status
Status returns the current stream status.
property Status : Integer;
Description
Status returns the following values :
C_STREAM_NOT_CONNECTED : the stream is not connected to a pipe (Attention, this state doesn't exist in PCXtools).
C_STREAM_NOT_AVAILABLE : the stream is not valid.
C_STREAM_FREE : the stream is ready and waiting for a command.
C_STREAM_INITIALIZED : the stream has been initialized by a load command.
C_STREAM_BUSY : the stream plays a sound.
C_STREAM_UNDERRUN : the stream under runs while reading. Attention, the stream status keeps this value as long it hasn't been read.
C_STREAM_PAUSED : the stream is temporarily stopped (pause).
See also
GetInfo, StatusAsString

TPcxOutputStream.StatusAsString
Status returns the current stream status as a character string (string).
property StatusAsString : string;
Description
StatusAsString returns the following messages :
'Stream not connected' : the stream is not connected to a pipe (Attention, this state doesn't exist in PCXtools).
'Stream not available' : the stream is not valid.
'Stream free' C_STREAM_FREE : the stream is ready and waiting for a command.
'Stream initialized' C_STREAM_INITIALIZED : the stream has been initialized by a Load command.
'Stream busy' : the stream plays a sound.
'Stream underrun' : the stream under runs while reading. Attention, the stream status keeps this value as long it hasn't been read.
'Stream paused' : the stream has been temporarily halted (pause).
See also
Status, GetInfo

TPcxOutputStream.Stop
Stop stops the stream.
function Stop : Boolean; override;
Description
Use the Stop method to stop the stream being read.
If the stream is already stopped, the Stop method wouldn't do anything.
If the stream buffers were preloaded by the Load method, Stop will reinitialize them, a new call to the Load method is necessary to reload them.
If the operation is successful, the Stop method returns True, if not it returns False and a call to the ToolGetLastError function returns the error code generated by PCXtools.
Note
Actually Load doesn't preload the buffers, this feature will be available at the same time as PCXtools2NP.
See also
Play, Load, StopFade, Initialized, Status

TPcxOutputStream.StopFade
StopFade stops the stream with a Fade Out.
function StopFade(Value : DWord) : Boolean; override;
Description
Call the StopFade method to stop the stream in use with a Fade Out.
If the stream is already stopped, the StopFade method won't do anything.
If the stream buffers were preloaded by the Load method, StopFade will reinitialize them, a new call to the Load method is necessary to relaod them.
Value specifies the length of the Fade Out in milliseconds.
If the operation is successful, the StopFade method returns True, if not as False and a call to the ToolGetLastError function returns the error code generated by PCXtools.
Note
Actually Load doesn't preload the buffers, this feature will be available at the same time as PCXtools2NP.
See also
Play, Load, Initialized, Status, Stop
