Contents

class

SushiDSP::WavWriter

Streaming WAV output: open, append frames, close.

Declared in
include/SushiDSP/io/WavWriter.hpp

Not real-time safe — it allocates, throws and touches the filesystem, exactly like PartitionedConvolution's constructor and WavFile; call only from the control thread.

Public types

enum class Format

Sample encoding written to the file.

Pcm16
Float32

Public member functions

WavWriter(const std::string &path, double sample_rate, std::uint32_t channels, Format format)

Opens the file and writes a placeholder header.

Parameters

path

Filesystem path to create or overwrite.

sample_rate

The file's sample rate in Hz.

channels

Number of interleaved channels.

format

Sample encoding to write.

Exceptions

std::runtime_error

if the path cannot be opened for writing.

~WavWriter()

Closes the file if the caller did not already call close().

WavWriter(const WavWriter &)=delete
WavWriter & operator=(const WavWriter &)=delete
void append(const float *const *channels, std::uint32_t frames)

Appends frames, interleaving the channels.

Does nothing once close() has run.

Parameters

channels

One pointer per channel, each with at least frames samples.

frames

Number of frames to append, per channel.

void close()

Rewrites the RIFF and data sizes and closes the file. Safe to call twice.

std::uint64_t frames_written() const

Returns the number of frames appended so far.