MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / Aifc_read

Class Aifc_read

tools/python-3.11.9-amd64/Lib/aifc.py:276–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274
275
276class Aifc_read:
277 # Variables used in this class:
278 #
279 # These variables are available to the user though appropriate
280 # methods of this class:
281 # _file -- the open file with methods read(), close(), and seek()
282 # set through the __init__() method
283 # _nchannels -- the number of audio channels
284 # available through the getnchannels() method
285 # _nframes -- the number of audio frames
286 # available through the getnframes() method
287 # _sampwidth -- the number of bytes per audio sample
288 # available through the getsampwidth() method
289 # _framerate -- the sampling frequency
290 # available through the getframerate() method
291 # _comptype -- the AIFF-C compression type ('NONE' if AIFF)
292 # available through the getcomptype() method
293 # _compname -- the human-readable AIFF-C compression type
294 # available through the getcomptype() method
295 # _markers -- the marks in the audio file
296 # available through the getmarkers() and getmark()
297 # methods
298 # _soundpos -- the position in the audio stream
299 # available through the tell() method, set through the
300 # setpos() method
301 #
302 # These variables are used internally only:
303 # _version -- the AIFF-C version number
304 # _decomp -- the decompressor from builtin module cl
305 # _comm_chunk_read -- 1 iff the COMM chunk has been read
306 # _aifc -- 1 iff reading an AIFF-C file
307 # _ssnd_seek_needed -- 1 iff positioned correctly in audio
308 # file for readframes()
309 # _ssnd_chunk -- instantiation of a chunk class for the SSND chunk
310 # _framesize -- size of one frame in the file
311
312 _file = None # Set here since __del__ checks it
313
314 def initfp(self, file):
315 self._version = 0
316 self._convert = None
317 self._markers = []
318 self._soundpos = 0
319 self._file = file
320 chunk = Chunk(file)
321 if chunk.getname() != b'FORM':
322 raise Error('file does not start with FORM id')
323 formdata = chunk.read(4)
324 if formdata == b'AIFF':
325 self._aifc = 0
326 elif formdata == b'AIFC':
327 self._aifc = 1
328 else:
329 raise Error('not an AIFF or AIFF-C file')
330 self._comm_chunk_read = 0
331 self._ssnd_chunk = None
332 while 1:
333 self._ssnd_seek_needed = 1

Callers 1

openFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected