pyalsaaudio
pyalsaaudio copied to clipboard
Documentation does not clearly indicate types of inputs and outputs
Reading the docs, it is very difficult to be certain about the types of outputs, and even more so the expected inputs. An example is here: https://stackoverflow.com/q/49890368/2988730. The prime example is setvolume
. Does it normally accept an integer or a list? It seems to be an integer, but then how does interact with the different channels.
This is related to #48, where the meaning rather than the type of the output is in question.
This is also a problem with Type Checking done by pylint:
To reproduce, enable "strict" for Type Checking (assuming Visual Studio Code and pylint).
def setup_alsa_output_stream(self):
"""uses the python-wrapper for ALSA to setup an output stream for audio"""
output_stream = alsaaudio.PCM( # type: ignore
alsaaudio.PCM_PLAYBACK, # type: ignore
alsaaudio.PCM_NORMAL, # type: ignore
rate=self.rate,
channels=self.channels,
periodsize=int(self.frames_per_buffer / 2),
device="plug:airplay",
)
while self.audio_streams_started:
raw_data = self.output_buffer.get(self.frames_per_buffer * 2)
output_stream.write(raw_data) # type: ignore
Note the # type: ignore
at the end of too many lines.
Take a look at https://github.com/larsimmisch/pyalsaaudio/pull/136. Does this improve things?