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

Sebastiii

Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    @Rick164
    If you're going down the path of investigating proper handling for audio device changes, I think our current code that tracks audio device connection/disconnection could do with a bit of love. Specifically:
    • Find an alternative way to enumerate audio devices at startup that doesn't require DirectShow (ie. replace -->this<--)
    • When an audio device is removed, detect whether that device was being used as the audio renderer for the playing media. Only stop playback if the device is being used. It might be possible to detect this better with a completely different method such as with DirectShow graph events (eg. this one).

    Hi :)
    If i'm not wrong the latest code didn't handle such change @Rick164 right ? :)
    It could be nice to improve it, like this it should solve some issue like detected by @Helios61 -> HERE -< or maybe not lol.
    The @Helios61 case is when the graph is builded, the audio renderer (Default DirectSound Device) can't be added because it is no more in "FilterCollection AudioRenderers" in "Filters.AudioRenderers" because it was removed then added back triggered by DRRC.
    But it will hard to debug this when we can't reproduce it lol
     

    Rick164

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

    Correct, went with the simpler approach by detecting it during playback events (before renderer) as that didn't break legacy support (WAVE devices)
    Definitely need something we can reproduce because if it's happening in renderer end we might need a bit more control in that part of the code to figure out which audio device to use :)
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Since we still run into issues with BCL (build bot doesn't like it), decided to go the NAudio route which was surprisingly easy to get working.
    Upsides are:

    - No BCL needed for NET40 builds (less deps)
    - Maintained and used by mayor companies
    - One .dll to include: "NAudio.dll"
    - Packed with features for later use:

    NAudio/README.md at master · naudio/NAudio · GitHub

    So a lot of extra features in library, thanks @Stéphane Lenclud for suggesting this one :)
    Will push to clean branch in a sec which will hopefully solve our build problems completely.

    // Update

    Pushed to re-created branch:

    GitHub - RickDB/MediaPortal-1 at MP1-4838-Rework_volume_control_management

    Hi @Rick164
    Testing again this branch (own fork for now) :p

    I was running into an issue on DEV PC (when using audio : Mute / Volume Up/Down) MP freeze for a while or freeze until i kill it.
    So i have added above branch into my fork and all is working good :p

    I think we should thinking to work with this (and handle what wasn't working for), what do you think ?
    Will read the thread to remember what was missing :p (Wave support or something from memory) :)
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Did test a lot more :) and it works pretty good, when i change from windows playback device, audio goes well to the new device / Mute and volume up/down works too :p
    And i have set Wave mode and it works too (or it fallback to master) but it rocks :p

    So maybe we can think to add it to next MP version ? :p
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Yes me too when reading back but need to test more ofc :p
    Still it's working better than before the change :)
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    @Rick164 @Stéphane Lenclud
    I have updated to Naudio 1.8.3 and has the quite same issue as without it on latest insider windows build.
    So i'm trying to switch to CScore and for video it seems to works no more issue but i need help to know if my change are correct, i will create a branch for you to be able to look the code if you can guys :p
    Thanks.
     

    Users who are viewing this thread

    Top Bottom