[kde-edu]: Playing sounds ...

Albert Astals Cid aacid at kde.org
Wed Apr 12 19:13:31 CEST 2006

Just a quick note, you should NOT be using arts on KDE4 code, you should be 
using Phonon.

If it is KDE3 code then it's fine ;-)


A Dimecres 12 Abril 2006 15:40, Andreas Nicolai va escriure:
> 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

LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 

More information about the kde-edu mailing list