Tkwav - Asynchronous playback of WAV files.
package require tkwav ?1.0?
::tkwav::load ?object? ?filename?
?object? play
?object? loop
?object? pause
?object? isPlaying
::tkwav::destroy object ?object...?
::tkwav::cooperate ?level? ?window?
The Tkwav package provides Tcl/Tk scripts with the ability to play audio samples in WAV format using DirectX on Windows. Multiple sounds can be played simultaneously and playback of each sound can be started and stopped independantly.
Sounds are loaded using the command ::tkwav::load
. This
command loads an audio sample onto the sound card and creates a sound object that
provides operations to start, loop, pause and stop playback of the sample. Sound playback
occurs concurrently with the execution of Tcl scripts, so multiple sounds can be played at
the same time - DirectX mixes the playback of all these sounds into a single output
channel. Sound objects are destroyed by the ::tkwav::destroy
command which
frees any system resources used to hold the sound's data and removes the object's command
from the Tcl interpreter.
The ::tkwav::cooperate
command controls how the Tcl application shares the
audio device with other applications. By default, Tkwav is in normal cooperative
mode, meaning that the system hands it the audio device whenever it's main window is
activated and takes it away when the main window is deactivated. The window used to
control access to the device can be changed via the ::tkwav::cooperate
command. Changing the cooperative level to a higher priority has not been fully tested in
this release of Tkwav and is not guaranteed to work.
::tkwav::load ?object? ?filename?
?object? play
?object? loop
?object? pause
?object? isPlaying
::tkwav::destroy object ?object...?
::tkwav::cooperate ?level? ?window?
normal
.
Changing the cooperative level to a higher priority has not been fully tested in this
release of Tkwav and is not guaranteed to work.