Return-Path: X-Original-To: apmail-incubator-flex-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-flex-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7E3629544 for ; Sat, 11 Feb 2012 15:25:16 +0000 (UTC) Received: (qmail 5831 invoked by uid 500); 11 Feb 2012 15:25:16 -0000 Delivered-To: apmail-incubator-flex-dev-archive@incubator.apache.org Received: (qmail 5765 invoked by uid 500); 11 Feb 2012 15:25:15 -0000 Mailing-List: contact flex-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: flex-dev@incubator.apache.org Delivered-To: mailing list flex-dev@incubator.apache.org Received: (qmail 5757 invoked by uid 99); 11 Feb 2012 15:25:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Feb 2012 15:25:15 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.214.47] (HELO mail-bk0-f47.google.com) (209.85.214.47) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Feb 2012 15:25:06 +0000 Received: by bkwq11 with SMTP id q11so2324354bkw.6 for ; Sat, 11 Feb 2012 07:24:45 -0800 (PST) MIME-Version: 1.0 Received: by 10.204.155.132 with SMTP id s4mr4142274bkw.43.1328973884904; Sat, 11 Feb 2012 07:24:44 -0800 (PST) Received: by 10.205.47.67 with HTTP; Sat, 11 Feb 2012 07:24:44 -0800 (PST) X-Originating-IP: [173.10.39.57] In-Reply-To: References: Date: Sat, 11 Feb 2012 10:24:44 -0500 Message-ID: Subject: Re: [Native Extension] Interval/Polling response from C to AIR From: Nicholas Kwiatkowski To: flex-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=00151758f83c53572404b8b1d8c8 X-Gm-Message-State: ALoCoQk4ZhKLOlVmA8LNZ8dwH+aEr5ggR8MCPQBSSmv+Uj2pO7hxLdX13yMIart2uRmf2d79Gk7b X-Virus-Checked: Checked by ClamAV on apache.org --00151758f83c53572404b8b1d8c8 Content-Type: text/plain; charset=ISO-8859-1 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 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. > --00151758f83c53572404b8b1d8c8--