On 9 May 2013, at 08:12, Toby Jaguar <
tal...@gmail.com> wrote:
> It is a very big project, so you will be hearing from me.
Cool - what are your broad plans?
>
> I think developing in Overtone will give me more control than Max in the long run.
For sure :-) I've also just finished developing a graphviz viewer which will let you visualise your synth designs in a Max/MSP style. I've been amazed by how the visual form handles complex designs so poorly in comparison to text.
>
> We'll see if I can get streaming Xbee data into Overtone.
Shouldn't be too tough. You'll want to pipe your data into the event system. This is as simple as calling the fn event:
(event event-key event-data)
where event-key is a unique key for this data stream. We've recently been using vectors of keywords for this i.e.
[:xbee :data]
and where event-data is an arbitrary map i.e.
{:data 2.45 :foo 1 :bar 9}
You can then register handlers to be executed on incoming events:
(on-event [:xbee :data]
(fn [event-data] (println event-data))
::handle-xbee)
By default this will use a thread pool to handle the incoming events. This may mean the handle fns are executed in a different order to the incoming events due to multiple cores being utilised. To tackle this, you can use the on-sync-event strategy which will execute the handler on the thread of the incoming event - the downside to this is that this fn may then block that thread for long periods of time, essentially starving the event stream. To tackle that issue, you can use on-latest-event which preserves ordering, doesn't block the incoming thread but can drop some intermediate events that can't be handled in real time to minimise latency. I use on-latest-event to handle the events coming from my MIDI controllers.
Let me know if I can help any further,
Sam
---
http://sam.aaron.name