write method
Write a WAVE file header.
@param out {@link java.io.OutputStream} to receive the header. @return number of bytes written. @throws IOException
Implementation
int write(EventSink<List<int>> out) {
/* RIFF header */
writeId(out, 'RIFF');
writeInt(out, 36 + mNumBytes);
writeId(out, 'WAVE');
/* fmt chunk */
writeId(out, 'fmt ');
writeInt(out, 16);
writeint(out, mFormat);
writeint(out, mNumChannels);
writeInt(out, mSampleRate);
writeInt(out, (mNumChannels * mSampleRate * mBitsPerSample / 8).floor());
writeint(out, (mNumChannels * mBitsPerSample / 8).floor());
writeint(out, mBitsPerSample);
/* data chunk */
writeId(out, 'data');
writeInt(out, mNumBytes);
return headerLength;
}