<div>As I slowly figure out audio architecture, I've gotten to here:<br></div><div><br></div><div>main() </div><div>  - sets up jack, instantiates and Engine class and a Controller class</div><div>  </div><div>Engine</div>
<div>- the engine is passed to the jack audio callback, and has a .tick() to calculate audio</div><div>- engine will receive messages over ToEngineQueue ( with a ringbuffer )</div><div>- engine will send messages back to controller over a second queue, ToControllerQueue</div>
<div><br></div><div>Controller</div><div>- started in main thread</div><div>- will handle all input and output and instantiate any guis</div><div>- sends messages to engine over queue</div><div>- receives messages from engine over the ToControllerQueue</div>
<div><br></div><div>Message</div><div>- struct for passing messages, holds simple numbers, keeping individual messages of known size for now</div><div><br></div><div>I've seen a few ways now in tutorials of handling some things and would love opinions.</div>
<div><br></div><div>- Should the ToEnqineQueue be a part of Engine? ie, do we pass messages to engine</div><div> with engine->newMessage( msg ); </div><div>- or should the queue's be instantiated in main and should Engine and Controller each get pointers to the queues?</div>
<div>- I think the stk examples do the former and SuperCollider the second</div><div><br></div><div>- is it a bad idea to have both engine and controller need pointers to each other? </div><div>- is this an example of an undesired circular dependency?</div>
<div>- is avoiding that by having them each only depend on Queue and Message a good plan? </div><div>- or should I avoid it by using an ABC for MessageReceivingComponent and allow them each to have pointers</div><div>of type MessageReceivingComponent?</div>
<div><br></div><div>- how should one handle memory management of the messages? Is it ok for Engine to allocate memory for new</div><div>messages and have them destroyed on receipt, </div><div>- or should I have queue delete the memory and return by value when messages are fetched?</div>
<div>- what is the crustimony proceedcake for allocated memory from an engine?</div><div><br></div><div>thanks to anyone who feels like they have the time to answer these!</div><div>iain</div><div><br></div><div><br></div>