[LAD] opinions wanted on a couple of architecture questions

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-audio-dev@...>
Date: Friday, December 9, 2011 - 7:54 pm

--20cf303a31b10a59f504b3ae2679
Content-Type: text/plain; charset=ISO-8859-1

As I slowly figure out audio architecture, I've gotten to here:

main()
- sets up jack, instantiates and Engine class and a Controller class

Engine
- the engine is passed to the jack audio callback, and has a .tick() to
calculate audio
- engine will receive messages over ToEngineQueue ( with a ringbuffer )
- engine will send messages back to controller over a second queue,
ToControllerQueue

Controller
- started in main thread
- will handle all input and output and instantiate any guis
- sends messages to engine over queue
- receives messages from engine over the ToControllerQueue

Message
- struct for passing messages, holds simple numbers, keeping individual
messages of known size for now

I've seen a few ways now in tutorials of handling some things and would
love opinions.

- Should the ToEnqineQueue be a part of Engine? ie, do we pass messages to
engine
with engine->newMessage( msg );
- or should the queue's be instantiated in main and should Engine and
Controller each get pointers to the queues?
- I think the stk examples do the former and SuperCollider the second

- is it a bad idea to have both engine and controller need pointers to each
other?
- is this an example of an undesired circular dependency?
- is avoiding that by having them each only depend on Queue and Message a
good plan?
- or should I avoid it by using an ABC for MessageReceivingComponent and
allow them each to have pointers
of type MessageReceivingComponent?

- how should one handle memory management of the messages? Is it ok for
Engine to allocate memory for new
messages and have them destroyed on receipt,
- or should I have queue delete the memory and return by value when
messages are fetched?
- what is the crustimony proceedcake for allocated memory from an engine?

thanks to anyone who feels like they have the time to answer these!
iain

--20cf303a31b10a59f504b3ae2679
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

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

--20cf303a31b10a59f504b3ae2679--

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAD] opinions wanted on a couple of architecture questions, Iain Duncan, (Fri Dec 9, 7:54 pm)