How the internal engine works?


I’ve been digging into the Rack codebase to see how it works. I found this explanation: Rack v1 development blog

So does that mean we have one worker per module ? Anyhow, I couldn’t find in the code where the engine workers and their threads are initialized. And what about the threads for GUI and audio engine ? They all seem a little obscured to me atm.

Any further explanation/detail is much appreciated. I’m a newbie.

There is one main engine thread and N-1 engine worker threads, managed in Engine_relaunchWorkers(), where N is set by Engine > Threads in the menu bar. Modules are assigned with a first-come-first-serve algorithm. The “GUI thread” is the main thread of the application. The audio thread is managed by VCV Audio-*.

Quickly looking at the code, it looks like C++11’s std::thread is used for the additional threads. The GUI/main thread exists automatically and the audio thread that handles the audio hardware I/O is likely created by the audio hardware library (RTAudio) that VCV Rack uses.

ah I saw that now. Thanks a bunch