James,

I wouldn't recommend you do any polling or timers to get the data from the
ANE to your as3.  The ANE C/C++ libraries give your the functionality to
fire Events right into the AVM (your as3 code), and you can pick those up.

When the musician presses the key, you should get a MIDI message in your C
code.  You can then store that message into a buffer of some kind, and fire
an Event to let your as3 code know you got something.  Your as3 code would
then have to call a function to pull back that buffer.

I wouldn't use a "Window Process" to collect those MIDI messages.  I would
launch a new thread on the OS to watch for those messages.  You can use a
library like gThreads to spawn a new process and dispatch those events.

-Nick

On Sat, Feb 11, 2012 at 8:11 AM, James Ong <yanlile...@gmail.com> wrote:

> Hi,
>
> I'm have been experimenting on Native Extension by invoke some C function
> from AIR application, example "Hello World return from C" was output
> on the application.
>
> In other way, have anyone tried this experiment:
> AIR <- Native Extension <- C
>
> An example, the function in C will detect when a musician depress a MIDI
> keyboard, in turn, will capture the key and invoke Native Extension so
> it will output to the application. As it will be difficult to use MIDI code
> for a start, shall anyone know how to create a "windows process" when an
> AIR
> app is launch and will monitoring any response from a computer keyboard (In
> this example, we will not using AS3 to capture the keyboard events)?
>
> Thanks.
>

Reply via email to