Playwave
Contents
Playwave : CObj
The Playwave
class is a convenient way to play back one or more wave items with the optional use of a dialog for user interaction.
Playwave Member Functions
The Playwave
class has the following member functions. See CObj Member Functions for a list of functions implemented in the parent class.
Construct
Initializes the playback instance. If mode equals DIALOG
a playback dialog box is created and displayed which contains a playback progress bar, a stop button and a pause button. If the wave item count is greater than one, also buttons to select the next/previous wave item and to repeat playback of the current wave item are displayed.
Usage:
construct mode ; count
Parameters:
- mode
- The dialog mode. The following values are supported:
DIALOG
- A dialog displays the playback progress.
NODIALOG
- Playback uses no visual aid.
- count
- The number of wave items.
Result:
0 for success and 1 for error
Destruct
Deletes the playback dialog (if created) and cleans up the internal items.
Usage:
Destruct
Result:
none
DoDialog
See the Playwave
member function DoPlay
for details.
DoPlay
Plays the specified wave item wave. If the dialog was created, the playback progress is displayed and the dialog can be used to stop playback and select the next or previous wave item, or repeat the current one. The user of the Playwave
class must then act upon the returned index and play back the corresponding wave item with another call to DoPlay
.
Usage:
DoPlay wave ; index ; text
DoDialog wave ; index ; title
Parameters:
- wave
- The name of the wave item to be played.
- index
- The index of this wave item (0 <= index < count).
- title
- The dialog window caption.
Result:
The index of the next wave item to be played or -1
for error / end.
Playwave Static Functions
The PlayWave
class supports the following static functions:
PlayWave
Playback one or more WAVE
or XWAVE
items. Note that a dialog is displayed during playback.
Usage:
PlayWave waveItem|xWaveObject ; text
Parameters:
- waveItem
- The wave item to play. See the shell item WAVE for details.
- xWaveObject
- The xWaveObject to play. See XWAVE for details.
- text
- The text to display in the play dialog.
Usage:
PlayWave simpleTable
Parameters:
- simpleTable
- A simple shell table. Each entry with the following format is then played:
waveItem|xWaveObject ; text
Examples:
Playback a wave signal from disk.
#xwave := xwave 'd:\data\audio\test.wav' if '$#xwave[?]' != 'instance' em -1 ; Failed to create the xwave item. PlayWave $#xwave
Note that in the case of an XWAVE
object, the XWAVE
member function play
can be used instead.
#xwave := xwave 'd:\data\audio\test.wav' if '$#xwave[?]' != 'instance' em -1 ; Failed to create the xwave item. $#xwave play