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

Would it possible to link to non-default Pulseaudio server #99

Open zhujisheng opened 4 years ago

zhujisheng commented 4 years ago

_pa.pa_context_connect(self.context, _ffi.NULL, _pa.PA_CONTEXT_NOFLAGS, _ffi.NULL)

The second parameter is always Null, which means the default pulseaudio server in the system. Can you please let user input the server string, like unix://run/audio/pulse.sock, just pass it to the func pa_context_connect

bastibe commented 4 years ago

That's a good idea!

However, it is hard to implement, as the _pulse object is instantiated at load time, and there is no convenient place for user interaction before that. It could be implemented as an optional argument to _PulseAudio.__init__, and then manually replacing soundcard._pulse with your own instance.

If you'd like to create a pull request with this, or with a different solution, I'd be happy to merge it.

zhujisheng commented 4 years ago

I have no idea about the implement, because the structure is there. Maybe it will be a big change of the program. I think I have to change /etc/pulse/client.conf in this situation.