Commit Graph

64 Commits

Author SHA1 Message Date
Lars Immisch
44ccbf839d Fix sphinx warning 2024-05-07 19:07:47 +02:00
Lars Immisch
2c2e43d3d1 Add type hints & docs 2024-05-07 19:07:47 +02:00
Ville Viinikka
436c31f9fd Add nominal_bits and physical_bits info
Adds the information discussed in pull request #144
2024-03-13 10:59:11 +01:00
Lars Immisch
0aba948277 Whitespace cleanup.
I ended up using Visual Studio Code and did a global regex replace
` +\n` -> `\n` (StackOverflow)
2024-02-20 18:08:09 +01:00
Oswald Buddenhagen
9b7b767594 fix docu typo 2024-02-06 00:39:15 +01:00
Oswald Buddenhagen
db87f2ced5 document new avail() and polldescriptors_revents() PCM functions
amends 43a94b3 and 5221311.
2024-02-06 00:39:15 +01:00
Oswald Buddenhagen
f179db2d9b de-duplicate PCM.info() documentation
... and move the dumpinfo() docu.

amends 4e098da - clearly, i'm blind.
2024-02-06 00:39:15 +01:00
Oswald Buddenhagen
420b538321 improve documentation of PCM c'tor and info() method
reformulate and redistribute the information, somewhat inspired by text
provided by Ronald van Elburg in response to issue #110.
2024-02-06 00:39:15 +01:00
Oswald Buddenhagen
8fb33ddd49 improve write() underrun handling, take 2
we *really* should not paper over underruns, as they require attention.
however, the previous attempt (c2a6b6e) caused an exception to be thrown
(see #130), which was a bit excessive, and was consequently reverted
(438e52e).

so instead we make the handling consistent with what we do in read():
return the verbatim -EPIPE in this case. this can be simply ignored, and
the next write will resume the stream, so this is mostly backwards-
compatible (the failing write will be discarded and would need
repeating, but that will just cause a skip after the interruption,
which does not seem particularly relevant).

as a drive-by, again stop using snd_pcm_recover(), as it still just
obfuscates the snd_pcm_prepare() call it does in the end.
2024-02-05 23:01:30 +01:00
Oswald Buddenhagen
7d9c16618b slightly clarify docu of read() wrt. underrun 2024-02-05 23:01:30 +01:00
Oswald Buddenhagen
946694d263 add PCM.state() and associated enum values
in principle, the state is already available from info(), but that's a
rather heavy function for something one might want to query often.

a practical use case might be checking whether a playback stream is done
draining, for example.
2023-03-02 00:41:01 +01:00
Oswald Buddenhagen
574f78939d add PCM.drain()
for playback, this allows making sure that all written frames are
played, without using an external delay.

in principle, it's also usable for capture, but there isn't really a
practical reason to do so, as simply discarding excess captured frames
has no real cost.
2023-03-02 00:41:01 +01:00
Oswald Buddenhagen
17d171c1a5 make period count configurable
the period count is just as important for playback latency as the period
size, so it makes no sense to have only one of them configurable.

as a drive-by, fix up the handling of periods in info() & dumpinfo().
2023-03-02 00:41:01 +01:00
Oswald Buddenhagen
b05efa0ad6 add some best practices to the docu
addresses #110, among other things.
2023-03-02 00:41:01 +01:00
Oswald Buddenhagen
4e098da908 add missing and update incorrect/outdated documentation
for clarity, this includes docs which were previously omitted
(presumably) intentionally, but mark them as comments.

the getrec() and getmute() functions' docs are moved around, so they
appear in pairs with their set*() counterparts, like the *volume() ones
already did.

notably, this also fixes the docu of PCM_FORMAT_U8, which closes #104.
2023-03-02 00:41:01 +01:00
Oswald Buddenhagen
c266d302e0 improve terminology document
mention xruns, and rework the definition of periods: concentrate on
relevant information, and remove the misinformation about period size
reduction being not that bad (pedantically, an application could run
somewhat asynchronously to the interrupts by using some timer, and
therefore actually save some of the overhead, but why would one use a
small period size in the first place then?).

also, language and formatting fixes.
2023-03-02 00:41:01 +01:00
Oswald Buddenhagen
b094ac096b formatting/language fixes in introduction document 2023-03-02 00:41:01 +01:00
Oswald Buddenhagen
46b91980e0 unify line spacing in .rst files
one empty line, except for high-level sections, which get two.

while at it, trim whitespace on otherwise empty lines.
2023-03-02 00:41:01 +01:00
Oswald Buddenhagen
9ab4f721d6 remove bogus markup from the documentation
the poll objects are linked properly in a different way, and the
footnote appears outdated.
2023-03-02 00:41:01 +01:00
Oswald Buddenhagen
a967b7db78 drop some pointless comments from the tex => sphinx conversion
amends 5c2a00655.
2023-03-02 00:41:01 +01:00
Ronald van Elburg
19c9ba3ed9 Fix issue #104 : Update description of PCM_FORMAT_U8: Unsigned 8 bit samples for each channel 2022-11-27 01:56:36 +01:00
Ronald van Elburg
b2f0466dd2 First version documentation PCM.info() method. (#119)
* First version documentation PCM.info() method.

* Add reference to documentation to docstring for PCM.info() method.

* Add extra fields to info dict:
  card_no                      *index of card*                   integer  (negative indicates device not associable with a card)
   device_no                    *index of PCM device*             integer
   subdevice_no                 *index of PCM subdevice*          integer
and update documentation accordingly.

Co-authored-by: Ronald van Elburg <Ronald@SoundAppraisal.eu>
2022-11-26 19:08:32 +01:00
Chris Diamand
3f6fb9844d Support decibel, percentage, and raw volumes in getvolume, setvolume, and getrange (#109)
* 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
2022-03-28 21:46:40 +02:00
Ronald van Elburg
c8f3916337 On phys_from_sound: Small memory management fixes and code simplification. And add documentation on new functionality. 2021-04-11 15:16:03 +02:00
Lars Immisch
4018ab4f6c Fix copypasta. 2020-07-16 23:36:12 +02:00
Lars Immisch
d83e829de1 Formatting and fixed upload description. 2020-07-13 22:18:32 +02:00
Lars Immisch
62e5515341 Document the release process. 2020-07-13 22:00:44 +02:00
Lars Immisch
0224c8a308 Inline documentation (and .gitignore) 2020-07-10 00:54:24 +02:00
Lars Immisch
f07627543c Update documentation 2020-07-10 00:45:57 +02:00
Lars Immisch
2a21bf6c42 Support all essential parameters in alsapcm_new. 2020-07-08 22:39:46 +02:00
Peter Ericson
1695066c11 Update pyalsaaudio.rst 2018-11-16 16:51:05 +08:00
Michał Šrajer
40a1219dac Support 24bit audio
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
2017-08-29 19:09:54 +02:00
Lars Immisch
f9685e0b30 Correct capitalization
as suggested by Ben Loveridge
2017-07-09 13:32:08 +02:00
Lars Immisch
b4a670c50d Doc fixes. 2017-03-31 00:29:19 +02:00
Lars Immisch
370a4b6249 Regenerated doc. 2017-03-31 00:25:00 +02:00
Lars Immisch
eca217dff9 Document PCM.polldescriptors.
Closes #32
2017-03-30 23:20:22 +02:00
Lars Immisch
65d3c4a283 Typo. 2017-03-17 20:42:02 +01:00
Lars Immisch
adc0d800e1 Document EPIPE 2017-03-17 20:40:40 +01:00
Lars Immisch
02cf16d10d Improve documentation 2017-02-25 01:32:54 +01:00
Lars Immisch
dc51fa75b5 Make tests more robust, use devices or card indices. 2017-02-22 23:55:17 +01:00
Lars Immisch
88f38284bb Update documentation. Closes #18
Make sure no other setup.py from `sys.path` is accidentally loaded
2017-02-22 19:41:57 +01:00
Paul Donohue
891a30eb08 Add Mixer.handleevents() to acknowledge events identified by select.poll 2016-10-21 12:21:14 -04:00
Lars Immisch
8daa39deae Minor improvements 2015-05-14 00:02:14 +02:00
Lars Immisch
8de9c92791 Undo the argument name/order incompatibility
(Most of it, anyway - the mixers functions have slightly different
defaults now)

Improve the documentation
2015-05-12 09:24:11 +02:00
Lars Immisch
2112840b4d Improve Readme 2015-05-11 22:18:19 +02:00
Lars Immisch
526bd05eaf Take version from git tag 2015-05-11 22:13:02 +02:00
Lars Immisch
369b202e04 Unify handling of pcmtype/direction 2015-05-10 02:07:15 +02:00
Lars Immisch
cb6fc6231c Add pcms function, unify arguments.
Also, fix some memory leaks in error cases
2015-05-09 21:39:00 +02:00
Lars Immisch
7e2e99d072 Better (but not 100% backward compatible) device selection for mixers/PCM 2015-05-09 05:52:50 +00:00
Lars Immisch
9188071945 Allow card index or device name for mixers.
This change breaks API compatibility. Sorry.
2015-05-04 21:13:15 +00:00