[MP1-4838] Volume control no longer functions properly when changing audio device (1 Viewer)

Rick164

MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    @Developers for AudioSwitcher we have some new dependencies which are in a NuGet repo and kept up to date:

    • Microsoft.Bcl.Async (>= 1.0.168)
    • AudioSwitcher.AudioApi (>= 4.0.0-alpha5) <--- talked with dev for it and this is the most complete and stable even with the alpha tag, we need this for the async features as 3.0.0 lacks that.
    Build for .NET 4.0 and 4.5 so we are safe on that end, packaging wise this means we get a few extra .dlls:

    AudioSwitcher.AudioApi.dll
    AudioSwitcher.AudioApi.CoreAudio.dll
    Microsoft.Threading.Tasks.dll

    Could use ILMerge to reduce all those loose files (do that for plugins atm) but let me know if these new dependencies are ok :)
    Attached is a packaged version build against master if some want to try it out already, of course backup first but bugfix is complete and now comes down to improvements in other areas like the audio renderer detection.

    Just did some small tweaks this morning and made Mediaportal volume leading so if you change it externally the Mediaportal volume OSD / state will not follow it, one of the upsides is that we don't need to forcefully hide the Windows 10 volume OSD because the library doesn't trigger it.
    Essentially can remove the workaround from 1.15 (the hide windows OSD setting).
     

    Attachments

    • Mediaportal_1_16_AudioSwitcher_002.zip
      1.2 MB
    Last edited:

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Hey :)
    On a quick test to merge the branch for testing it :p

    So trying to merge it locally, there is a lot of end line change (so hard to see the diff when also need to resolve lol).
    I think it's needed to adapt NSIS installer to get the new files to be installed and adapt postbuild.bat to copy new files in mp bin release/debug folder.

    About ILMerge why not :) but need to have a proper process to combine etc. (get ilmerge somewhere and adapt script NSIS for it). So maybe different dll is ok too :p
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    So trying to merge it locally, there is a lot of end line change (so hard to see the diff when also need to resolve lol).

    Yeah resharper went a bit all out during changes :p , can do a clean branch with just all changes in one if you want (without auto-code corrections):)

    About ILMerge why not :) but need to have a proper process to combine etc. (get ilmerge somewhere and adapt script NSIS for it). So maybe different dll is ok too :p

    Agree, separate branch and Jira but could do that later once this one is completed (y)
    Definitely harder to do for existing setups as you need to clean out old .dll files (doing that in .mpei for plugins), so probably a lot of work for just this one extra .dll :)
     

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    Btw anyone know how we do volume control for non-standard setups in < 1.15, for example:

    - User starts video
    - Controls volume from remote
    - Which audio device did it previously pick for volume control, default Windows one or one from audio renderer setup (video / music / tv)?

    If one from audio renderer can't find the code for that which sets it (only see one mixer.open), removed a lot of old code in mixer.cs but looks to do the same as the approach we use now just with far less code.
    Could make a new hook for AddAudioRendererToGraph() however bit odd that we don't have it in there somewhere already.
     
    Last edited:

    Rick164

    MP Donator
  • Premium Supporter
  • January 7, 2006
    1,335
    1,006
    Home Country
    Netherlands Netherlands
    Trying out this solution atm which dynamically re-attaches the volume handler to the right audio renderer and restores it on playback stop:

    https://github.com/RickDB/MediaPortal-1/commit/b93a52910b9d42b1e8c7b1fc40f672dfc0ba385d

    https://github.com/RickDB/MediaPortal-1/commit/f9571b97f117f61c90fe5740a0370f2934f6910c

    Mediaportal.cs seems a bit fussy in VS2015, keeps reporting formatting errors (line endings) but even when accepting keep coming back (hench the crazy diffs) :eek:
    Think I might need to do a clean branch without ReSharper as otherwise gonna look weird on Git.


    // Update

    Few more changes, made it completely rely on Filter events now so we handle multiple cases and works great so far :)
    Will change volume of device user has setup in Mediaportal config for video / music / tv etc..

    Think this should do it but needs review / testing, @Sebastiii let me know if you would prefer a clean branch without code corrections by ReSharper for Mediaportal.cs.
     

    Attachments

    • Mediaportal_1_16_AudioSwitcher_005.zip
      1.1 MB
    Last edited:

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Yep the end of lines is a pain in as....... lol
    Could be nice to have only the change, it drive me crasy too about line ending, i'm always tell no from VS :)
     

    Users who are viewing this thread

    Top Bottom