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

Virtual

Portal Member
January 6, 2017
22
12
47
Home Country
Italy Italy
lI don't have 21 playback audio device ... only 5 (3 active - all are 2 channels devices, 2 disabled)!
upload_2017-1-6_17-21-36.png


I have tried with DefaultWide skin, it's the same ... if I change the audio device the movie play with the new device but the volume still attached with the old device ... I have tried with audio mp3 (bass player in the mp configuration) and the music still play on the old device too as the volume control!
Maybe this can help you to understand or reproduce the problem on your system ... I hope ...
 

Virtual

Portal Member
January 6, 2017
22
12
47
Home Country
Italy Italy
In the v3 version ... do you leave the following lines of code to re-initialize the master volume (mixer) in MP? :)

  1. VolumeHandler.Dispose();
  2. VolumeHandler.CreateInstance();
 

Rick164

MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    Removed those but will play around with a few things now :)
    Figure it can be a few things:

    - Mediaportal only attaches OSD and skin sounds once on startup to a single device (even if it changes)
    - Library crashing something in Mediaportal internally but trying to rule that out atm by using their app.

    For the 21 devices I'll forward that to AudioSwitcher library dev as that definitely looks odd.
     

    Virtual

    Portal Member
    January 6, 2017
    22
    12
    47
    Home Country
    Italy Italy
    If this can help ... in the v3 version the skin sound follow correctly the new audio device ... it's only the volume control that doesn't refresh with the new audio device ... if you want to re-add the 2 lines of code I can try the "v4" to see if it works in my htpc ... otherwise I will try your next version (i think that the workaround to set the same volume value to all devices can solve the "volume control problem" if the MP do not permit to change the audio device and re-attach the volume control). :)
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    @Virtual Could you try the following:

    - Disable AudioSwitcher plugin in Mediaportal configuration completely.
    - Install AudioSwitcher app:

    http://audioswit.ch/download/latest

    - Start Mediaportal and make it windowed (alt+enter)
    - Check OSD + sound and make sure it works.
    - Now switch to other device from AudioSwitcher app
    - Check OSD + sound and should stop working
    - Revert back to one that worked

    So far I can confirm it's an error in the plugin as the app works fine (doesn't break OSD or volume control), not sure where the difference is as it should make the same kind of API calls.
    Gonna dig further and let you know :)

    However while it doesn't break the volume control like before it always sticks with the audio device Mediaportal started with like you noticed.
     
    Last edited:

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    Ok added re-spawn of volume handler and for now and made it non-threaded as the combination of both definitely didn't play well, this means during audio device overview loading and setting the playback device the UI will shortly "hang" depending on how many devices you have.

    Make sure to set it to Master Volume in Mediaportal configuration, also disabled some startup things in plugin for testing purposes and if this solves it for you as well will cleanup a few things and push new release out.
     

    Attachments

    • AudioSwitcher_1.1.3.6_V4.mpe1
      151.5 KB

    Virtual

    Portal Member
    January 6, 2017
    22
    12
    47
    Home Country
    Italy Italy
    The app works like the plugin ... the audio device switch correctly to the new device and the movie "sounds" with the new device.
    only the mediaportal internal volume remains attached to the old device ... if I use the "windows 10 volume bar", it works correctly with the default device ... but if i use the mediaportal volume, it changes the volume on the "old" device (i can see it on windows 10 playback devices > properties > level)
    Works all as expected except the mediaportal internal volume control the remains attached to the old default audio device (plugin or app, no differences)
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    Yeah it's because the volume handler doesn't respawn internally, V4 will force that and while looking in Windows systray can see it changing volume for the correct device depending on what I chose from the AudioSwitcher plugin in Mediaportal.
    GUI sounds I'm not sure yet how that works but volume control does so long as it's set to master volume.

    Snippet of we do now with some extra delays:

    Code:
        private void SetPlaybackDevice(CoreAudioDevice device)
        {
          try
          {
            Log.Debug($"Audio Switcher - setting default playback device to: {device.FullName}");
            device.SetAsDefault();
             Log.Debug($"Devices audio connected: {GUIGraphicsContext.DeviceAudioConnected}");
    
            if (Settings.LAVbitstreamPerDevice)
            {
              SetLavBitstreamSettings(device.FullName);
            }
    
            Log.Debug("Resetting volume control");
            Thread.Sleep(1000);
            VolumeHandler.Dispose();
            Thread.Sleep(1000);
            VolumeHandler.CreateInstance();
            Log.Debug("Volume control reset");
    
          }
          catch (Exception ex)
          {
            Log.Error("Error occured during SetPlaybackDevice()");
            Log.Error(ex.Message);
          }
        }
     

    Virtual

    Portal Member
    January 6, 2017
    22
    12
    47
    Home Country
    Italy Italy
    upload_2017-1-6_18-32-14.png


    I change the audio device, set master volume in the configuration and disabled all plugins.
    As you can see, windows show it correctly but MP still use the old device only for the volume control ... in the printscreen you can see that I have set the volume at high level but the default device in windows (device selected via plugin and used correctly when I start a movie) remains at 20%.
    I don't know why MP doesn't release the old device for its internal volume control :(
     

    Users who are viewing this thread

    Top Bottom