dheijl / swyh-rs

Stream What You Hear written in rust, inspired by SWYH.
MIT License
348 stars 15 forks source link

Cannot stream audio from applications using wasapi #52

Open RenEH01 opened 2 years ago

RenEH01 commented 2 years ago

My current set up is Kodi playing audio with wasapi and hifi cable and having that audio streamed via airplay using a similar software to yours called tuneblade. Unfortunately, airplay is limited to only 41.1khz sample rate and all movies need to be downsampled.

I've gotten your software to function in a similar manner, but only if Kodi is using direct sound and not wasapi. There seems to be a noticeable decrease is quality using direct sound with my stereo set up. The timing for audio/video seems to always be a few milliseconds off and is not a consistent amount delayed every time a video is launched. Is there a way for swyh-rs to be able to stream audio from applications using wasapi? Thanks again for your time and this software!

dheijl commented 2 years ago

swyh-rs can only capture audio using wasapi. The problem is that Kodi insists on opening wasapi in exclusive mode instead of in shared mode, and this prevents swyh-rs opening wasapi for sound capture... Foobar2000 has the same problem. If you disable exclusive mode in the sound config control panel Foobar2000 refuses to open wasapi. VLC for instance can stream without problems to HiFi Cable, as do Spotify and many others.

And a delay between video and sound is inevitable if you capture the audio and stream it to another audio device, there is a (minimal) amount of buffering in the application and a device-dependent amount of buffering in the dlna-renderer (often configurable).

VLC can fix this by sending the audio ahead of the video, using the "J" key, or in the audio preferences (sync compensation).