bastibe / SoundCard

A Pure-Python Real-Time Audio Library
https://soundcard.readthedocs.io
BSD 3-Clause "New" or "Revised" License
680 stars 69 forks source link

Channel-specification does not work on Windows / WASAPI #42

Closed jonryk closed 4 years ago

jonryk commented 5 years ago

I need a player that can play a wave-file to a specified sound-channel (e.g. channel 8), so I created this using SoundCard and python, and it works well in Linux and on Mac, but not under windows:

The issue is reported from: ...soundcard/mediafoundation.py, line 477, in init raise TypeError('Due to limitations of WASAPI, channel maps on Windows ' TypeError: Due to limitations of WASAPI, channel maps on Windows must be a combination of range(0, x).

The workaround seems to be to reprogram to send silence to any non-used channel, but would it not be better if this was handled by the library, so that the same call could be performed on any platform?

bastibe commented 5 years ago

I gotta be honest: I think I implemented this at some point last year. I might just have forgotten to remove the error check in line 477. But I don't remember. Try removing the error check and see if channel maps work as intended.