[kde-edu]: Playing sounds ...
Andreas Nicolai
Andreas.Nicolai at gmx.net
Wed Apr 12 15:40:07 CEST 2006
Hi there,
I was trying to implement sound in KTouch yesterday and found myself cursing
after hours of trying because the Arts KDE extension are not documented (not
even a few lines of comments in the implementation files) and the code posted
on the edu.kde.org page is outdated (doesn't compile anylonger) and is also
slightly misleading (lifetime of objects to short to actually hear a sound).
Anyway, if you want to have a somewhat more control when playing sounds (then
just doing it n a fire-and-forget way), here's what you need to do:
1. create an KArtsDispatcher and KArtsServer object for the lifetime of your
program (not like in the example, as soon as the dispatcher goes out of
scope, that's it for the sound)
2. keep you playobject factory alive and monitor the status of your play
objects
3. if you want to play the same sound (using the same playobject) again, you
need to rewind it like via play_object->seek( poTime(0,0,0,"samples") );
4. you need to link against $(LIB_ARTS) and if that doesn't work try -lartskde
(why the heck isn't LIB_ARTS working on my computer???)
Anyway, I also attached a more complex example that works and has a somewhat
better initialization routine (even though that could be improved even
further with some error checks).
Could someone with access maybe upload those files to the webpage to help
others and save them some time? I really hope that Arts becomes better
documented in future...
Bye,
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: playing_sound.tar.gz
Type: application/x-tgz
Size: 2000 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-edu/attachments/20060412/43be1e84/attachment.bin
More information about the kde-edu
mailing list