Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(202509)

Side by Side Diff: Doc/library/ossaudiodev.rst

Issue 23001: Accept mutable bytes-like objects
Patch Set: Created 4 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 :mod:`ossaudiodev` --- Access to OSS-compatible audio devices 1 :mod:`ossaudiodev` --- Access to OSS-compatible audio devices
2 ============================================================= 2 =============================================================
3 3
4 .. module:: ossaudiodev 4 .. module:: ossaudiodev
5 :platform: Linux, FreeBSD 5 :platform: Linux, FreeBSD
6 :synopsis: Access to OSS-compatible audio devices. 6 :synopsis: Access to OSS-compatible audio devices.
7 7
8 8
9 This module allows you to access the OSS (Open Sound System) audio interface. 9 This module allows you to access the OSS (Open Sound System) audio interface.
10 OSS is available for a wide range of open-source and commercial Unices, and is 10 OSS is available for a wide range of open-source and commercial Unices, and is
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 .. method:: oss_audio_device.read(size) 141 .. method:: oss_audio_device.read(size)
142 142
143 Read *size* bytes from the audio input and return them as a Python string. 143 Read *size* bytes from the audio input and return them as a Python string.
144 Unlike most Unix device drivers, OSS audio devices in blocking mode (the 144 Unlike most Unix device drivers, OSS audio devices in blocking mode (the
145 default) will block :func:`read` until the entire requested amount of data is 145 default) will block :func:`read` until the entire requested amount of data is
146 available. 146 available.
147 147
148 148
149 .. method:: oss_audio_device.write(data) 149 .. method:: oss_audio_device.write(data)
150 150
151 Write the Python string *data* to the audio device and return the number of 151 Write a :term:`bytes-like object` *data* to the audio device and return the
152 bytes written. If the audio device is in blocking mode (the default), the 152 number of bytes written. If the audio device is in blocking mode (the
153 entire string is always written (again, this is different from usual Unix dev ice 153 default), the entire data is always written (again, this is different from
154 semantics). If the device is in non-blocking mode, some data may not be writ ten 154 usual Unix device semantics). If the device is in non-blocking mode, some
155 data may not be written
155 ---see :meth:`writeall`. 156 ---see :meth:`writeall`.
157
158 .. versionchanged: 3.5
159 Writable :term:`bytes-like object` is now accepted.
156 160
157 161
158 .. method:: oss_audio_device.writeall(data) 162 .. method:: oss_audio_device.writeall(data)
159 163
160 Write the entire Python string *data* to the audio device: waits until the au dio 164 Write a :term:`bytes-like object` *data* to the audio device: waits until
161 device is able to accept data, writes as much data as it will accept, and 165 the audio device is able to accept data, writes as much data as it will
162 repeats until *data* has been completely written. If the device is in blockin g 166 accept, and repeats until *data* has been completely written. If the device
163 mode (the default), this has the same effect as :meth:`write`; :meth:`writeal l` 167 is in blocking mode (the default), this has the same effect as
164 is only useful in non-blocking mode. Has no return value, since the amount o f 168 :meth:`write`; :meth:`writeall` is only useful in non-blocking mode. Has
165 data written is always equal to the amount of data supplied. 169 no return value, since the amount of data written is always equal to the
170 amount of data supplied.
171
172 .. versionchanged: 3.5
173 Writable :term:`bytes-like object` is now accepted.
174
166 175
167 .. versionchanged:: 3.2 176 .. versionchanged:: 3.2
168 Audio device objects also support the context management protocol, i.e. they can 177 Audio device objects also support the context management protocol, i.e. they can
169 be used in a :keyword:`with` statement. 178 be used in a :keyword:`with` statement.
170 179
171 180
172 The following methods each map to exactly one :c:func:`ioctl` system call. The 181 The following methods each map to exactly one :c:func:`ioctl` system call. The
173 correspondence is obvious: for example, :meth:`setfmt` corresponds to the 182 correspondence is obvious: for example, :meth:`setfmt` corresponds to the
174 ``SNDCTL_DSP_SETFMT`` ioctl, and :meth:`sync` to ``SNDCTL_DSP_SYNC`` (this can 183 ``SNDCTL_DSP_SETFMT`` ioctl, and :meth:`sync` to ``SNDCTL_DSP_SYNC`` (this can
175 be useful when consulting the OSS documentation). If the underlying 184 be useful when consulting the OSS documentation). If the underlying
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 440
432 .. method:: oss_mixer_device.set_recsrc(bitmask) 441 .. method:: oss_mixer_device.set_recsrc(bitmask)
433 442
434 Call this function to specify a recording source. Returns a bitmask indicati ng 443 Call this function to specify a recording source. Returns a bitmask indicati ng
435 the new recording source (or sources) if successful; raises :exc:`OSError` if an 444 the new recording source (or sources) if successful; raises :exc:`OSError` if an
436 invalid source was specified. To set the current recording source to the 445 invalid source was specified. To set the current recording source to the
437 microphone input:: 446 microphone input::
438 447
439 mixer.setrecsrc (1 << ossaudiodev.SOUND_MIXER_MIC) 448 mixer.setrecsrc (1 << ossaudiodev.SOUND_MIXER_MIC)
440 449
OLDNEW
« no previous file with comments | « Doc/library/mmap.rst ('k') | Doc/library/socket.rst » ('j') | Doc/library/socket.rst » ('J')

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+