Audio Manager

Discussion in 'Job Offers' started by Martin Beukes, Jun 20, 2019.

  1. Martin Beukes

    Martin Beukes Member Licensed User

    Hi,

    I think this is a quick and easyish one. I need to be able to get info from the audio manager and select the output manually.

    This post covers most of what I think I need: https://stackoverflow.com/questions/31909040/android-force-hdmi-audio

    Code:
    AudioManager manager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);   
    Log.d(TAG, "ATTACHED: " + manager.getParameters("attached_output_devices"));
    Log.d(TAG, "DEFAULT: " + manager.getParameters("default_output_device"));
    Log.d(TAG, "PRE: " + manager.getParameters("audio_devices_out_active"));       
    manager.setParameters(
    "audio_devices_out_active=AUDIO_DEVICE_OUT_AUX_DIGITAL");
    Log.d(TAG, "POST: " + manager.getParameters("audio_devices_out_active"));

     audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
        audioManager.setParameters(
    "audio_devices_out_active=AUDIO_CODEC");
        // 
    or
        audioManager.setParameters(
    "audio_devices_out_active=AUDIO_HDMI");
        // 
    or
        audioManager.setParameters(
    "audio_devices_out_active=AUDIO_HDMI,AUDIO_CODEC");
    Basically, I want to be able to check the connection of the audio outputs and then to force it out on the headphones on hdmi as required.

    Thanks
    Martin
     
  2. Martin Beukes

    Martin Beukes Member Licensed User

    Taken
     
    somed3v3loper likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice