MCPcopy Index your code
hub / github.com/python/cpython / readframes

Method readframes

Lib/wave.py:368–383  ·  view source on GitHub ↗
(self, nframes)

Source from the content-addressed store, hash-verified

366 self._data_seek_needed = 1
367
368 def readframes(self, nframes):
369 if self._data_seek_needed:
370 self._data_chunk.seek(0, 0)
371 pos = self._soundpos * self._framesize
372 if pos:
373 self._data_chunk.seek(pos, 0)
374 self._data_seek_needed = 0
375 if nframes == 0:
376 return b''
377 data = self._data_chunk.read(nframes * self._framesize)
378 if self._sampwidth != 1 and sys.byteorder == 'big':
379 data = _byteswap(data, self._sampwidth)
380 if self._convert and data:
381 data = self._convert(data)
382 self._soundpos = self._soundpos + len(data) // (self._nchannels * self._sampwidth)
383 return data
384
385 #
386 # Internal methods.

Callers 4

check_fileMethod · 0.80
test_readMethod · 0.80
test_copyMethod · 0.80

Calls 3

_byteswapFunction · 0.85
seekMethod · 0.45
readMethod · 0.45

Tested by 4

check_fileMethod · 0.64
test_readMethod · 0.64
test_copyMethod · 0.64