[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    Re: Playing from a buffer using arts
From:       Stefan Westerfeld <stefan () space ! twc ! de>
Date:       2002-06-25 6:04:14
[Download RAW message or body]

   Hi!

On Mon, Jun 24, 2002 at 05:09:21PM +0100, Rob Walker wrote:
> I'm a bit stuck with arts at the moment. I'm trying to use arts to playback 
> data from a buffer in a C++ app, but I want to keep the gui responsive so the 
> user can stop/pause/skip playback etc. From the arts documentation/source, I 
> can see several ways to do this, but none seems to fit what I need:
> 
> 1) Using ByteSoundProducer as in the streamsound.cc example. I can fill in the 
> buffers with the data, but it requires that the dispatcher is in the blocking 
> run() call to play the data, leaving the gui unresponsive. Is there a 
> non-blocking equivalent?

Yes, what you want to do is using a QIOManager, which will make the dispatcher
work during the Qt mainloop, so that the call to .run() is no longer necessary.

// from kdemultimedia/arts/builder/main.cpp:
    Arts::QIOManager iomanager;
    Arts::Dispatcher dispatcher(&iomanager);

or, maybe more convenient, use KArtsDispatcher from libartskde.

> 2) Using a class derived from SynthModule that runs in the artsd process. This 
> avoids the need for the dispatcher, but how does it get access to the data 
> from the buffer in the application's address space?

Well, you could use a method declared in the idl file, such as

	void playSamples(sequence<float> samples);

or a stream to feed the data there, but the later is exactly what 1) does, so
you really only want to solve the mainloop integration.

   Cu... Stefan
-- 
  -* Stefan Westerfeld, stefan@space.twc.de (PGP!), Hamburg/Germany
     KDE Developer, project infos at http://space.twc.de/~stefan/kde *-         
_______________________________________________
kde-multimedia mailing list
kde-multimedia@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-multimedia
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic