Repository navigation
Design for host that needs to support 2 threads rendering their own output from the same MIDI input? #470
|
I tried to explain my problem in the title but maybe that made it more confusing... I created a CLAP host that passes all validations of CLAP-Saw-Demo-IMGUI in the following scenario: Platform: Windows When a second render thread starts to render the same MIDI input to a file f.e. everything crashes. CLAP-Saw-Demo complains that start_processing() is called twice (which is true, each render thread calls it right before rendering starts). So, the question is which call does each thread need to make to render its own output? |
Replies: 2 comments 12 replies
|
A given instance can only have one audio thread. So I think what you need to do is either make a second instance to render with state or stop processing on the old audio thread, change your thread checker implementation to change the logical audio thread, and start processing on the other thread. No claps can render in two threads at once from one instance. The API is a single-logical-audi-thread-per-instance model. Does that help? |
|
This sounds not like a good design for your host. It also sounds like you only instantiate one instance. You could have two render threads, one instance each. But the error indicates you don't have 2 instances. |
You're loading the Plugin-DLL.
Then create an instance with
factory->create_plugin(..)You can render this instance in an audio-thread.
You can not call this instance of the plugin from two threads. This is what the error message says!
If you want to render in a second audio-thread (gui+audio1+audio2 = 3 threads), you need to create an additional instance with another call to
create_plugin.Don't forget to destroy both instances at exit.