Skip to main content
Inspiring
April 29, 2014
Answered

How do you toggle a microphone directly between enhanced and non-enhanced?

  • April 29, 2014
  • 1 reply
  • 539 views

Apparently mixing calls between Microphone.getMicrophone() and Microphone.getEnhancedMicrophone() on the same device doesn't work very well.  Take the following code:

<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

               xmlns:s="library://ns.adobe.com/flex/spark"

               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="onCreationComplete()" click="Microphone.getMicrophone().setLoopBack(true);">

    <fx:Script>

        <![CDATA[

            import mx.controls.Alert;

           

            private function onCreationComplete():void

            {

                Microphone.getEnhancedMicrophone().setLoopBack(true);

            }

        ]]>

    </fx:Script>

</s:Application>

You will be able to hear yourself speak at first, but as soon as you click the app, you will no longer be able to hear your voice.  I have also seen this sort of thing in other scenarios.

To make a long story short, if you call getEnhancedMicrophone() for one device, then try to call getMicrophone() for that same device, the device will stop providing any audio input.  The same is true vice versa.  However if you call getEnhancedMicrophone() for one device, then getMicrophone() for a different device, then come back to the first and call getMicrophone() for it, the device will work just fine.

Why?  Is there any way to just toggle between enhanced and non-enhanced settings for the same device, without reaching out to an unrelated device?  Thanks!

This topic has been closed for replies.
Correct answer sinious

On your Microphone reference you have these constants you can set your options to:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/MicrophoneEnhancedMode.html

As you can see there, MicrophoneEnhancedMode.OFF disables enhanced mode. You would set your Microphone references .mode property to equal that to disable enhanced, or use one of the other relevant options to enable it. Thus, you should always use enhanced so you can toggle it.

1 reply

sinious
siniousCorrect answer
Legend
April 29, 2014

On your Microphone reference you have these constants you can set your options to:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/MicrophoneEnhancedMode.html

As you can see there, MicrophoneEnhancedMode.OFF disables enhanced mode. You would set your Microphone references .mode property to equal that to disable enhanced, or use one of the other relevant options to enable it. Thus, you should always use enhanced so you can toggle it.

Inspiring
April 29, 2014

Wow, didn't think about that.  Thanks!

sinious
Legend
April 29, 2014

You're welcome!