MCPcopy Index your code
hub / github.com/RustPython/RustPython / readframes

Method readframes

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

Source from the content-addressed store, hash-verified

358 self._data_seek_needed = 1
359
360 def readframes(self, nframes):
361 if self._data_seek_needed:
362 self._data_chunk.seek(0, 0)
363 pos = self._soundpos * self._framesize
364 if pos:
365 self._data_chunk.seek(pos, 0)
366 self._data_seek_needed = 0
367 if nframes == 0:
368 return b''
369 data = self._data_chunk.read(nframes * self._framesize)
370 if self._sampwidth != 1 and sys.byteorder == 'big':
371 data = _byteswap(data, self._sampwidth)
372 if self._convert and data:
373 data = self._convert(data)
374 self._soundpos = self._soundpos + len(data) // (self._nchannels * self._sampwidth)
375 return data
376
377 #
378 # Internal methods.

Callers 4

check_fileMethod · 0.80
test_readMethod · 0.80
test_copyMethod · 0.80

Calls 4

_byteswapFunction · 0.85
lenFunction · 0.85
seekMethod · 0.45
readMethod · 0.45

Tested by 4

check_fileMethod · 0.64
test_readMethod · 0.64
test_copyMethod · 0.64