<div>Hi, I'm sure others have tackled this and have some wisdom to share. My project is principally a monosynth step sequencer. This is nice an simple to do in real time because resolution is very limited and there can be only one note per track. So step sequenced note data is stored in simple multi-dimensional arrays, making reading and writing very easy, and messaging simple between audio and gui threads. </div>
<div><br></div><div>However, I would like to add the ability for the user to send a message and have it get executed later, where later gets figured out by the engine ( ie on the top of the next 8 bar phrase ). To do this, I need some way of storing deferred events and having the engine check on each step whether there were any deferred events stored for 'now'. I can think of a few ways to do this, and all of them raise red flags for a real time thread.<br>
</div><div><br></div><div>- I could use a hash table, hashed by time, with a linked list of all the events for that time. The engine looks up the current time and gets all the events. I don't know much about hashing so I'd prob just use Boost, is that a bad idea?</div>
<div><br></div><div>- I could make a linked list of all deferred events and iterate through them checking if time is now. There wouldn't be any hashing, but maybe this list would be really big. </div><div><br></div><div>
Anyone have any suggestions for how to safely do the above or some better alternative?</div><div><br></div><div>thanks!</div><div>iain</div>