Audio Switcher - easily change audio device via context menu (using remote key) | Page 4

Discussion in 'MediaPortal 1 Plugins' started by Rick164, April 24, 2016.

  1. Sebastiii
    • Team MediaPortal

    Sebastiii Development Group

    Joined:
    November 12, 2007
    Messages:
    16,256
    Likes Received:
    6,210
    Gender:
    Male
    Location:
    France
    Ratings:
    +10,211 / 9
    Home Country:
    France France
    Show System Specs
    I think we have mp enable bool to tell us that it's ready but need to look the code for to be sure :)


     
    • Thank You! Thank You! x 1
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Virtual

    Virtual Portal Member

    Joined:
    January 6, 2017
    Messages:
    22
    Likes Received:
    6
    Gender:
    Male
    Ratings:
    +8 / 0
    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 ...
     
  4. Virtual

    Virtual Portal Member

    Joined:
    January 6, 2017
    Messages:
    22
    Likes Received:
    6
    Gender:
    Male
    Ratings:
    +8 / 0
    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();
     
  5. Rick164
    • Super User

    Rick164 Super User

    Joined:
    January 7, 2006
    Messages:
    1,335
    Likes Received:
    918
    Ratings:
    +1,359 / 0
    Home Country:
    Netherlands Netherlands
    Show System Specs
    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.
     
  6. Virtual

    Virtual Portal Member

    Joined:
    January 6, 2017
    Messages:
    22
    Likes Received:
    6
    Gender:
    Male
    Ratings:
    +8 / 0
    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). :)
     
  7. Rick164
    • Super User

    Rick164 Super User

    Joined:
    January 7, 2006
    Messages:
    1,335
    Likes Received:
    918
    Ratings:
    +1,359 / 0
    Home Country:
    Netherlands Netherlands
    Show System Specs
    @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: January 6, 2017
    • Like Like x 1
  8. Rick164
    • Super User

    Rick164 Super User

    Joined:
    January 7, 2006
    Messages:
    1,335
    Likes Received:
    918
    Ratings:
    +1,359 / 0
    Home Country:
    Netherlands Netherlands
    Show System Specs
    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.
     

    Attached Files:

  9. Virtual

    Virtual Portal Member

    Joined:
    January 6, 2017
    Messages:
    22
    Likes Received:
    6
    Gender:
    Male
    Ratings:
    +8 / 0
    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)
     
    • Like Like x 1
  10. Rick164
    • Super User

    Rick164 Super User

    Joined:
    January 7, 2006
    Messages:
    1,335
    Likes Received:
    918
    Ratings:
    +1,359 / 0
    Home Country:
    Netherlands Netherlands
    Show System Specs
    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 (Text):
    1.  
    2.     private void SetPlaybackDevice(CoreAudioDevice device)
    3.     {
    4.       try
    5.       {
    6.         Log.Debug($"Audio Switcher - setting default playback device to: {device.FullName}");
    7.         device.SetAsDefault();
    8.          Log.Debug($"Devices audio connected: {GUIGraphicsContext.DeviceAudioConnected}");
    9.  
    10.         if (Settings.LAVbitstreamPerDevice)
    11.         {
    12.           SetLavBitstreamSettings(device.FullName);
    13.         }
    14.  
    15.         Log.Debug("Resetting volume control");
    16.         Thread.Sleep(1000);
    17.         VolumeHandler.Dispose();
    18.         Thread.Sleep(1000);
    19.         VolumeHandler.CreateInstance();
    20.         Log.Debug("Volume control reset");
    21.  
    22.       }
    23.       catch (Exception ex)
    24.       {
    25.         Log.Error("Error occured during SetPlaybackDevice()");
    26.         Log.Error(ex.Message);
    27.       }
    28.     }
    29.  
     
    • Like Like x 1
  11. Virtual

    Virtual Portal Member

    Joined:
    January 6, 2017
    Messages:
    22
    Likes Received:
    6
    Gender:
    Male
    Ratings:
    +8 / 0
    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 :(
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  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
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!