I have to move some NSSlider
by hardware midi controller, I have programmed a midi learn procedure to assign hardware cursor to NSSlider
(sub class of), and up there it's all right. Inside MIDIReadProc
, I handle moving NSSlider
wich depends from incoming control and value, but now when I move hardware cursor, Sliders can be move one for time, it is like moving cursor stop the others.
My question is, what is best strategy to handle cursor moving concurrently ?
1 . Should I have to handle with a separated thread ?
2 . Should I have one FIFO
data structure of MIDIPacket
and processing that out of MIDIReadProc
(with some concurrency separated process) ?
I'm sorry for my english. Thanks for attention.
a.
You should not do any UI synchronisation inside
MIDIReadProc
callback.This callback is called from a high priority realtime thread so you must avoid doing anything that could be "too long" in it.
As you said you can use a FIFO and treat that in another thread (for instance the main thread).