Audio Switcher - easily change audio device via context menu (using remote key) (1 Viewer)

Rick164

MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,005
    Home Country
    Netherlands Netherlands
    Country flag
    Introduction

    This allows you to easily change your active Windows audio (playback) device using a context menu which you can show by mapping it to a remote key, the current remote keys mappable are:

    Red
    Green
    Blue
    Yellow
    DVD menu
    Subpage Up / Down

    Also has a a few optional features:

    - Set default playback device on startup
    - LAV audio bit streaming on a per device basis (default off in settings)
    - Set LAV audio delay via context menu (default off in settings)


    Installation

    https://www.team-mediaportal.com/extensions/audio-switcher

    Usage

    First select the remote key you want to use from the AudioSwitcher configuration:

    audioSwitcherSetup001.png


    audioswitchersetup002.PNG



    Once selecting a remote key you need to make sure AudioSwitcher can use it first as Mediaportal by default reserves all special buttons (no pass-thru), it depends on the Remote you use but here's the example for the MCE remote and the Red button.

    - Go to Mediaportal configuration -> Remote And Input Devices section -> Mapping , now for the No condition area select Remote Red Button as the action.

    upload_2014-5-25_16-8-8-png.151019



    Optionally you can also map a keyboard key to the remote key like so:

    audioSwitcherSetup003.PNG



    Now start Mediaportal and press the remote key or keyboard key you setup in the above steps, this will bring up a new context menu menu where you can select the playback device (current one gets highlighted):

    audioSwitcherSetup004.PNG


    audioSwitcherSetup005.PNG




    Advanced features

    Bitstream settings per device

    Version 1.1.0 and up optionally supports managing the LAV audio bit stream setting per device, this allows you to specifiy which codecs your device supports and updates the LAV audio bitstream config if needed.
    This is also applied if a startup device is specified in AudioSwitcher.

    audioswitchersetup001.PNG


    LAV audio delay

    Version 1.1.3 and up optionally supports managing the LAV audio delay via the context menu, you will need to enable this setting like in the below example and afterwards new audio delay settings will be listed in the Audio Switcher context menu.
    For negative delays you can add a minus(-) sign before the delay, it will get validated afterwards so you don''t have to worry about setting invalid ones.

    LAVAudioDelay.png



    Source


    The source is located on Github:

    https://github.com/RickDB/MP1-AudioSwitcher

    Credits

    - AudioSwitcher for making an amazing and simple to use Audio API
     
    Last edited:

    joEhSuper

    MP Donator
  • Premium Supporter
  • June 2, 2011
    977
    536
    Home Country
    Austria Austria
    Country flag
    Is it right, that the mean difference between Audio Switcher and ARC (AudioRendererChancer) is, that your Audio Switcher "has" a context menu?
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,005
    Home Country
    Netherlands Netherlands
    Country flag
    Correct this is meant for easily changing the current Windows audio device thru a context menu and doesn't re-attach any graphs and recommended only when no playback is active :) , so long as Mediaportal is set to use the Default direct sound device this will work.
    Also it uses a different external library (AudioSwitcher) instead of any built-in Mediaportal functions.

    Had this problem with a new Logitech headset for a while where whenever I wanted to use it would mean minimizing Mediaportal -> change default audio device -> re-open Mediaportal as its usb audio device would always be on so no dynamic switching like you have with Bluetooth audio for instance.
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,005
    Home Country
    Netherlands Netherlands
    Country flag
    Noticed that you can live switch the audio device in some cases, tried PCM 2.0 - 5.1 / DTS without problems but it depends on a specific Mediaportal setting:

    audioSwitcher_settings.png
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,005
    Home Country
    Netherlands Netherlands
    Country flag
    New version is out (1.1.0) and has a few new features:

    - Added LAV audio bit stream per device, this allows toggling bit streaming on / off depending device
    - Added option to set a default playback device on start up
    - Additional context menu item to toggle LAV bit streaming manually (has setting to always show)

    Reasoning behind this is that not all devices support bitstreaming so if LAV has bitstreaming enabled the device would not get any audio.
    So you can set a few predefined devices and select which codec it supports for bitstreaming if any.

    LAV manages it settings in registry completely so basically what it does is just update those on the fly :)

    audioswitchersbitstreametup001-png.PNG


    // Update

    Uploaded 1.1.1 release which simplifies the manual bitstream toggle a bit and makes it work in all cases.
     
    Last edited:

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,005
    Home Country
    Netherlands Netherlands
    Country flag
    1.1.2 release adds a workaround for a AudioSwitcher API bug which affects some HDMI AVR audio setups, basically if it detects this bug it forcefully reloads the device list.
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,005
    Home Country
    Netherlands Netherlands
    Country flag
    1.1.3 was just released:

    - Added LAV audio delay options to context menu, not shown by default and can be enabled in settings.
    - Can add audio delays while video is playing and it will optionally restart the video where it left off.
    - Reads back current bitstream and audio delay settings directly from LAV registry keys and no longer relies on possible old values if for instance changed outside of Mediaportal.

    While it's a bit outside of the scope of this plugin the ability to control audio delays is lacking right now in Mediaportal because you can only add audio delays via ffdshow which is outdated and pretty much replaced by LAV filters nowadays, new features are optional of course and left the audio delay options off per default.

    Also it will read all LAV settings directly so any changes done externally or by other plugins will be read back upon opening the context menu :)
     
    Last edited:

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,005
    Home Country
    Netherlands Netherlands
    Country flag
    1.1.3.5 was just released which improves overall performance as the AudioSwitcher library now does everything much faster (async tasks) :)
     
    Last edited:

    druid9

    MP Donator
  • Premium Supporter
  • December 31, 2006
    255
    9
    61
    Country flag
    can't seem to get this to work, maybe skin related (Titanius), or the fact I am using EventGhost with Message plugin. Don't get the popup dialogue even using keyboard.

    Will post logs in the morning
     

    Users who are viewing this thread

    Similar threads

    MP1 MP2 MP 1.23 Key Mapping DE
    Ok I've spent way too much time on this but for the sake of other users that are having problems and searching for answers here is the final result. To clarify this testing has been carried out using MP 1.23 using PureVisionHD Skin and a HID keyboard with MP/Config/Remotes set to HID "full" profile - Enable HID - Use HID keyboard...
    Ok I've spent way too much time on this but for the sake of other users that are having problems and searching for answers here is...
    I recently upgraded from MP 1.14 to MP 1.23. In 1.14 I was using the InputPlugIn to map my remote keys and all was working fine. In...
    Replies
    14
    Views
    1K
    It is looking and working very well now and I am almost at the point of switching my HTPC to MP2, madvr would definitely push me over the edge for sure.;)
    It is looking and working very well now and I am almost at the point of switching my HTPC to MP2, madvr would definitely push me...
    We are proud to present MediaPortal 2.3 MediaPortal 2.3 is a full-blown media center software that addresses the most common user...
    Replies
    4
    Views
    2K
    Good work guys!
    Good work guys!
    We are proud to present MediaPortal 2.2.1 After the release of MediaPortal 2.2 Final the team focussed on improving usability and...
    Replies
    1
    Views
    3K
    Code is fine and will setup Mediaportal dev box tomorrow but see no issues with it as most of CSAudio is meant as drop-in replacement :)
    Code is fine and will setup Mediaportal dev box tomorrow but see no issues with it as most of CSAudio is meant as drop-in...
    Hi, Been debugging an issue with @Virtual in the AudioSwitcher topic and is as follows: - Start Mediaportal with volume control...
    Replies
    82
    Views
    9K
    hm. I have put back both the settings for refresh rate changer, and the prefer multi channel audio streams, but the problem has not come back. very odd. at least it's working though!
    hm. I have put back both the settings for refresh rate changer, and the prefer multi channel audio streams, but the problem has not...
    Update: more info added here LAV audio over HDMI not working until I pause then continue a video Hi I've just built a new HTPC...
    Replies
    23
    Views
    6K
    Top Bottom