Hey All,
I'm looking to improve a program's design with regards to how it
communicates between the "jack" thread and its "main/gui" thread. Please
note I'm *not* looking for implementation details like what ringbuffer to
use, this has been discussed here before.
Conditions:
Gui needs to feed data trough to the jack thread (data = parameter moves
etc)
Jack thread needs to push data (buffers for waveforms & "playhead" info)
The real question:
What is a neat solution to passing various data trough a ringbuffer?
My (hacky?) solution: Create a class, call it "Event". Runtime now looks
like so:
1. Create a EventType enum, set the details
2. Write those "Events" into the ringbuffer
3. Switch based on EventType, and handle the event.
While not terribly ugly, that Event class starts to get bigger & nastier, so
I concidered sub-classing it... but I'm not sure this is going in the right
direction.
I'm very intrested how the "big" programs around have approached this
problem... Cheers, -Harry
Hey All,
I'm faced with a problem that I can't see an easy way around regarding the
use of the IR reverb plugin.
I'm running the GUI in a seperate *process*, and doing all lv2 communication
over OSC. For the most part this is easy,
the problem rears its head when one want's to use a plugin whose UI requires
"instance-access".
Basically, the IR plugin GUI needs access to the Lv2_Handle. But I can't
provide that due to the OSC communication.
So I've concidered "spoofing" a plugin on the UI side, and keeping it up to
date with what the "real" one is doing in the Engine.
Bit ugly, and if the UI has instance access, will it still call the normal
"port" events..? Because otherwise I'm lost with trying to
get at the UI data.
The other problem is that loading a "sample" into the IR convolution happens
in a pretty strange way: there's 3 Control Input ports, and together they
make up a 64bit file hash.
I understand the reasons behind this decision, and I'm not trying to
criticise the implementation, I'm just not sure how I can send a certain
file to these ports to make it work...
-Harry
On 09/02/2011 12:54 PM, Pedro Alves wrote:
> boost::function<void(void)> serves this purpose for me in jass. To
>> create and pass a functor that assigns a new auditor generator to the
>> one in the engine, and then tells it to play i do for example:
>>
>> write_blocking_command(assign(engine_.auditor_gen, p));
>> write_blocking_command(boost::bind(&engine::play_auditor,
>> boost::ref(engine_))); assign() is just a utility template to make
>> creating functors that do assignments easier.. boost::bind is used to
>> make all passed functors 0-ary (e.g for binding member functions to
>> their instance or binding arguments to the functor.. and
>> write_blocking_command is just a utility function that disables the GUI
>> until the acknowledgement from the engine has come back to the GUI,, The
>> command ringbuffer is just a ringbuffer holding
>> boost::fucntion<void(void)> objects..
>>
>> typedef ringbuffer<boost::function<void(void)> > command_ringbuffer;
>>
>> Examples from here:
>> https://github.com/fps/jass/blob/master/main_window.h
>> https://github.com/fps/jass/blob/master/assign.h
>> https://github.com/fps/jass/blob/master/engine.h Regards, Flo
> There are alternatives (even predecessors) to boost.function that
> are much faster and avoid the heap/new. See
> <http://www.codeproject.com/KB/cpp/fastdelegate2.aspx> for example.
> (I used Don's original "Fastest Possible C++ Delegates" on an embedded
> project years ago -- worked great).
>
Oh, thanks for the interesting read :D
Flo