AirMicrophone is a native extension thatÂ aims to replace the Microphone class on iOS. TheÂ API’s goal is to write the same code than if using flash’s Microphone class, except that the developer willÂ include a different class. The microphone class in the ANE has someÂ methods that will not work, they are there toÂ ensure theÂ compatibility with its Flash equivalent.
The extension is able to record sounds and supports activity level monitoring.
import cc.fovea.ane.AirMicrophone.Microphone; // Initialize the microphone var mic:Microphone = (Microphone)(Microphone.getMicrophone()); // All this is ignored when using the ANE. Just here for compatibility. mic.setLoopBack(); mic.addEventListener(StatusEvent.STATUS, onMicStatus); [...] // Start recording mic.rate = 11; // (or any non-zero value) // Retrieve activity level trace(mic.activityLevel); // Stop recording mic.rate = 0;