(self, initlength)
| 639 | return self._format == WAVE_FORMAT_IEEE_FLOAT |
| 640 | |
| 641 | def _write_header(self, initlength): |
| 642 | assert not self._headerwritten |
| 643 | self._file.write(b'RIFF') |
| 644 | if not self._nframes: |
| 645 | self._nframes = initlength // (self._nchannels * self._sampwidth) |
| 646 | self._datalength = self._nframes * self._nchannels * self._sampwidth |
| 647 | try: |
| 648 | self._form_length_pos = self._file.tell() |
| 649 | except (AttributeError, OSError): |
| 650 | self._form_length_pos = None |
| 651 | has_fact = self._needs_fact_chunk() |
| 652 | header_overhead = 36 + (12 if has_fact else 0) |
| 653 | self._file.write(struct.pack('<L4s4sLHHLLHH', |
| 654 | header_overhead + self._datalength, b'WAVE', b'fmt ', 16, |
| 655 | self._format, self._nchannels, self._framerate, |
| 656 | self._nchannels * self._framerate * self._sampwidth, |
| 657 | self._nchannels * self._sampwidth, |
| 658 | self._sampwidth * 8)) |
| 659 | if has_fact: |
| 660 | self._file.write(b'fact') |
| 661 | self._file.write(struct.pack('<L', 4)) |
| 662 | try: |
| 663 | self._fact_sample_count_pos = self._file.tell() |
| 664 | except (AttributeError, OSError): |
| 665 | self._fact_sample_count_pos = None |
| 666 | self._file.write(struct.pack('<L', self._nframes)) |
| 667 | self._file.write(b'data') |
| 668 | if self._form_length_pos is not None: |
| 669 | self._data_length_pos = self._file.tell() |
| 670 | self._file.write(struct.pack('<L', self._datalength)) |
| 671 | self._headerwritten = True |
| 672 | |
| 673 | def _patchheader(self): |
| 674 | assert self._headerwritten |
no test coverage detected