The spotify.audiosink module provides audio sink wrappers for different audio sinks like ALSA, OSS, and PortAudio.
Try to import each audio sink until one is successfully imported.
The audio_sinks parameter specificies what audio sinks to import, in the given order. If audio_sinks is not provided, the list spotify.audiosink.AUDIO_SINKS will be used.
| Parameters: | audio_sinks (list of two-tuples of (modulename, classname)) – audio sinks to try to import |
|---|---|
| Returns: | the first audio sink that was successfully imported |
| Return type: | class |
| Raise : | ImportError if no audio sinks can be imported |
BaseAudioSink provides the interface which is implemented by all audio sink wrappers in the spotify.audiosink module.
The interface is a perfect match for the spotify.manager.SpotifySessionManager.music_delivery() method, making it easy to play audio data received from Spotify.
To use one of the bundled audio controllers in a Spotify client you develop, just call this method every time you get audio data from Spotify, e.g. from your implementation of spotify.manager.SpotifySessionManager.music_delivery().
| Parameters: |
|
|---|---|
| Returns: | number of frames consumed |
| Return type: | int |
Should be called when audio output starts.
This is a hook for the audio sink to do work just before the audio starts.
Should be called when audio output stops.
This is a hook for the audio sink to do work just after the audio stops.
Should be called when audio output is paused.
This is a hook for the audio sink to do work when the audio is paused.
Implementations of the BaseAudioSink interface include:
Requires a system using ALSA, which includes most Linux systems, and the pyalsaaudio library.
Requires a system using OSS or with an OSS emulation, typically a Linux or BSD system. Uses the ossaudiodev module from the Python standard library.