Posted By

publicbroadcast on 06/24/09


Tagged

getMicrophone


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Pingpongbal


getMicrophone()


 / Published in: ActionScript 3
 

  1. var deviceArray:Array = Microphone.names;
  2. trace("Available sound input devices:");
  3. for (var i:int = 0; i < deviceArray.length; i++)
  4. {
  5. trace(" " + deviceArray[i]);
  6. }
  7.  
  8. var mic:Microphone = Microphone.getMicrophone();
  9. mic.gain = 60;
  10. mic.rate = 11;
  11. mic.setUseEchoSuppression(true);
  12. mic.setLoopBack(true);
  13. mic.setSilenceLevel(5, 1000);
  14.  
  15. mic.addEventListener(ActivityEvent.ACTIVITY, this.onMicActivity);
  16. mic.addEventListener(StatusEvent.STATUS, this.onMicStatus);
  17.  
  18. var micDetails:String = "Sound input device name: " + mic.name + '\n';
  19. micDetails += "Gain: " + mic.gain + '\n';
  20. micDetails += "Rate: " + mic.rate + " kHz" + '\n';
  21. micDetails += "Muted: " + mic.muted + '\n';
  22. micDetails += "Silence level: " + mic.silenceLevel + '\n';
  23. micDetails += "Silence timeout: " + mic.silenceTimeout + '\n';
  24. micDetails += "Echo suppression: " + mic.useEchoSuppression + '\n';
  25. micText1.text = micDetails;
  26.  
  27. function onMicActivity(evt:ActivityEvent):void
  28. {
  29. trace("activating=" + evt.activating + ", activityLevel=" + mic.activityLevel);
  30. meter_mc.mask_mc.scaleX = mic.activityLevel
  31. }
  32.  
  33. function onMicStatus(evt:StatusEvent):void
  34. {
  35. trace("status: level=" + evt.level + ", code=" + evt.code);
  36. }

Report this snippet  

You need to login to post a comment.