sonixd icon indicating copy to clipboard operation
sonixd copied to clipboard

Plans for supporting audio device exclusive mode

Open ghost opened this issue 3 years ago • 9 comments

Is your feature request related to a problem? Please describe.

Hi, I really appreciate the great work here! Just wondering if you have any plans for support playing back utilizing audio device exclusive mode provided by OSes, e.g. CoreAudio Exclusive Mode on macOS and WASAPI Exclusive Mode on Windows, to achieve bit-perfect playback?

Thanks in advance! Tom

ghost avatar Dec 23 '21 23:12 ghost

I did a bit of research about this since I haven't really used it before, and I'm not sure if Electron natively supports this functionality. Do you know if there Electron apps or apps using HTML5 audio that have achieved this to reference?

jeffvli avatar Dec 24 '21 21:12 jeffvli

AFAIK Tidal uses Electron and supports Exclusive Mode, I unpacked their macOS client and there is a Electron framework inside.

ghost avatar Dec 24 '21 22:12 ghost

I think I'll probably need some additional assistance since I don't see an easy way on how to implement this. If anyone has implemented this previously, your insight is appreciated!

jeffvli avatar Dec 25 '21 09:12 jeffvli

Found this while looking around for any examples of using WASAPI or ALSA (linux exclusive driver) and it looks like it might not be possible with electronjs

daynyxx avatar Dec 31 '21 20:12 daynyxx

@daynyxx Nice find. Seems like this issue is stuck unless someone is aware of a path forwards.

jeffvli avatar Jan 01 '22 02:01 jeffvli

You could achieve this if you instruct a backend to do the actual playback. Chromium (and thus Electron) handles playback with FFmpeg internally, which is reasonable for web stuff; perhaps you'd have to use a GStreamer pipe to achieve this, or libVLC, but easily not stuff that you can do in plain JS (unless NPM proves me wrong).

NyaomiDEV avatar Jan 12 '22 14:01 NyaomiDEV

Jellyfin Desktop player did it using MPV (https://github.com/jellyfin/jellyfin-media-player/blob/b670715a5cff4249090b073032fcb7a2564a63c1/src/player/PlayerComponent.cpp)

Mavyre avatar Feb 13 '23 19:02 Mavyre

@Mavyre Perfect, the rewrite is currently using mpv as well. Looks to just be a configuration toggle to enable it. https://github.com/jeffvli/feishin

jeffvli avatar Feb 13 '23 19:02 jeffvli

Awesome @jeffvli! I'll test it out. That will allow me to play mqa.flac files through my DAC!

Mavyre avatar Feb 14 '23 08:02 Mavyre