* alsamixer_getvolume: Fix incorrect parenthesis
The pcmtypeobj check is overriding the pcmtype if the object is not NULL
or Py_None, making it impossible to get the playback volume. Fix the
paranthesis so that pcmtype is only overwritten when pcmtypeobj is not
set.
* Fix indentation format
Fix the indentation format to match the rest of the project.1
Co-authored-by: Portia <portia.stephens@biamp.com>
* Use `pcmtype` keyword for range
Update methods that accept a `direction` argument (i.e.
capture/playback) to get this via positional _or_ keyword arguments.
Code using keyword arguments can be more robust; however the main reason
for this change is to prepare the way for an extra `units` argument to
many of these methods.
Update documentation to consistently use `pcmtype` instead of
a mixture of that and `direction`.
* Support units
Currently, after recording audio using pyalsaaudio, the client is unable to close the device.
The reason is that PulseAudio client tries to drain the pipe to the PulseAudio server (presumably in order to prevent Broken Pipe error) on closing. That will never finish since new data will always arrive in the pipe.
Worse, the __del__ handler was auto-closing and thus auto-hanging.
Therefore, pause before de-allocating.
SND_PCM_FORMAT_S24_LE and similar are for 24bit ints packed in 4-bytes each.
There is a similar family of formats for 3-bytes packed data (as stored in 24bit wave files).
This commit:
- adds S24_3LE, S24_3BE, U24_3LE, U24_3BE PCM formats to the alsaaudio.c
- updates documentation
- updates playwav.py to correctly play typical 24Bit PCM wave files
Closes#38
The cards() method does not guarantee that the index in its return
value is the same as the actual card index. Provide a way to get this
information in the form of a card_indexes() function, returning a
list of available card indexes.
Add another method, card_name(), which, given a card index, returns
the short and long names of that card.
Add a method, setenum(), for setting the value of an enumerated mixer
element. The argument is an integer index into the list of possible
values returned by getenum().