ANN: TclMixer 1.0.0

From: Googie (googie_at_no.spam.org)
Date: 02/27/05


Date: Sun, 27 Feb 2005 01:23:02 +0100

INTRO
-----
I've started with TclGame (SDL bindings) but I came to point, that in
Tcl better is to use [canvas] or - much better - TkZinc for 2D
graphics. Only thing that is missing in Tcl to make nice 2D games is
bad support for audio.

Yes, I know, there is Snack package, but it was designed for different
targets, than simple playback. It's quiet slow (latency), has too many
options, which aren't used recently in simple playback.

DESCRIPTION
-----------
So, here's TclMixer, SDL_mixer bindings for Tcl. It allows to play
multiple sounds at the same time using built-in software mixer. It
supports following sound formats: WAV/RIFF, MP3, OGG, MID (midi), MOD
(including standart MOD modules, but also S3M, IT, XM). There are
basic effects implemented, which would be very useful, such as 3D
sound positioning, stereo balance, fading in/out and sound source
distance. All these goodies closed in well known, simple Tcl syntax.
To make this extension work, end-user has to got installed SDL (in
version 1.2.x) and SDL_mixer (in version 1.2.x), which are quiet
famous and presents on most Unix desktop machines (in future
tclmixer.so could be linked statically with these libraries to takes
dependencies off).

Didn't tried to compile it on Windows yet, but should be fine, since
SDL and SDL_mixer works nice on Windows.

LICENCE
-------
It's LGPL (same as SDL).

WHERE TO GET IT?
----------------
http://scripts.one.pl/tclmixer/
There is also online documentation.

HOW TO START / CHECK IT OUT?
----------------------------
Get some supported sound file. If it's some effect (gun shot, or
explosion or sth) load it as short sound:

#!/usr/bin/env wish
load tclmixer.so
set snd [tclmixer::sound file.<mp3|wav|ogg>]
tclmixer::play $snd

if file is big, then load it as long sound, to prevent loading it into
memory:

#!/usr/bin/env wish
load tclmixer.so
set music [tclmixer::music file.<mp3|wav|ogg|mid|mod>]
tclmixer::play $music

There is 'wish' used, not 'tclsh', becouse we need some event loop,
since SDL_mixer hasn't its own. If you want to use 'tclsh', you can
use CALLBACK mechanism:

#!/usr/bin/env tclsh
load tclmixer.so
set sleep 0
proc musicFinished {} {
    global sleep
    set sleep 1
}
tclmixer::setCallback MUSIC musicFinished
set music [tclmixer::music file.<mp3|wav|ogg|mid|mod>]
tclmixer::play $music
while {$sleep} {after 1000}

See documentation for more.

-- 
Pozdrawiam (Greetings)!
Googie


Relevant Pages

  • Redhat 9.0 SDL Sound Delay
    ... uses the SDL libraries, that the sound lag is huge. ... re-compile from the src rpm to get sound at all), ... ready to compile from the ... In most installations it should compile no problem. ...
    (linux.redhat)
  • nexuiz game always crashes: segmentation fault (core dumped)
    ... Trying to load library... ... Initializing client ... Failed to init SDL joystick subsystem: ... CDAudio_Init: No CD in player. ...
    (Ubuntu)
  • Re: SDLThrust game release
    ... On Nov 23, 9:48 pm, Chris Bazley wrote: ... RISC OS 3.6 or above.It's rather slow on my StrongARM Risc PC, so I suspect it would be ... Do you think that is a problem with SDL or the game itself? ... I wrote the sound code it's using in the SDL port so it's probably ...
    (comp.sys.acorn.games)
  • Re: Tracking the sound problem.
    ... have you tried running the sound card configurator ... The above line gives the same errors line without the -ao sdl ... Group: System Environment/Libraries Source RPM: ...
    (Fedora)
  • Re: real time sound
    ... >> I mostly pipe everything through SDL. ... >> hear the shooting sound about a second later. ... Look at the logs, there sould ... When I click the run with realtime priority ...
    (Fedora)