// Simple C++ class for writing 16-bit integer and 32 bit floating point PCM WAV // files. All error handling is by calls to RTC_CHECK(), making it unsuitable // for anything but debug code. class WavWriter final : public WavFile { public: // Opens a new WAV file for writing.
WavWriter(absl::string_view filename, int sample_rate,
size_t num_channels,
SampleFormat sample_format = SampleFormat::kInt16);
WavWriter(FileWrapper file, int sample_rate,
size_t num_channels,
SampleFormat sample_format = SampleFormat::kInt16);
// Closes the WAV file, after writing its header.
~WavWriter() override { Close(); }
// Write additional samples to the file. Each sample is in the range // [-32768.0,32767.0], and there must be the previously specified number of // interleaved channels. void WriteSamples(constfloat* samples, size_t num_samples); void WriteSamples(const int16_t* samples, size_t num_samples);
// Follows the conventions of WavWriter. class WavReader final : public WavFile { public: // Opens an existing WAV file for reading. explicit WavReader(absl::string_view filename); explicit WavReader(FileWrapper file);
// Close the WAV file.
~WavReader() override { Close(); }
// Resets position to the beginning of the file. void Reset();
// Returns the number of samples read. If this is less than requested, // verifies that the end of the file was reached.
size_t ReadSamples(size_t num_samples, float* samples);
size_t ReadSamples(size_t num_samples, int16_t* samples);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.