LMMS
Loading...
Searching...
No Matches
juce::WavAudioFormatWriter Class Reference
Inheritance diagram for juce::WavAudioFormatWriter:
juce::AudioFormatWriter

Public Member Functions

 WavAudioFormatWriter (OutputStream *const out, const double rate, const AudioChannelSet &channelLayoutToUse, const unsigned int bits, const StringPairArray &metadataValues)
 ~WavAudioFormatWriter () override
bool write (const int **data, int numSamples) override
bool flush () override
Public Member Functions inherited from juce::AudioFormatWriter
virtual ~AudioFormatWriter ()
const StringgetFormatName () const noexcept
bool writeFromAudioReader (AudioFormatReader &reader, int64 startSample, int64 numSamplesToRead)
bool writeFromAudioSource (AudioSource &source, int numSamplesToRead, int samplesPerBlock=2048)
bool writeFromAudioSampleBuffer (const AudioBuffer< float > &source, int startSample, int numSamples)
bool writeFromFloatArrays (const float *const *channels, int numChannels, int numSamples)
double getSampleRate () const noexcept
int getNumChannels () const noexcept
int getBitsPerSample () const noexcept
bool isFloatingPoint () const noexcept

Private Member Functions

void writeHeader ()
void writeChunkHeader (int chunkType, int size) const
void writeChunk (const MemoryBlock &data, int chunkType, int size=0) const

Static Private Member Functions

static size_t chunkSize (const MemoryBlock &data) noexcept
static int getChannelMaskFromChannelLayout (const AudioChannelSet &layout)

Private Attributes

MemoryBlock tempBlock
MemoryBlock bwavChunk
MemoryBlock ixmlChunk
MemoryBlock axmlChunk
MemoryBlock smplChunk
MemoryBlock instChunk
MemoryBlock cueChunk
MemoryBlock listChunk
MemoryBlock listInfoChunk
MemoryBlock acidChunk
MemoryBlock trckChunk
uint64 lengthInSamples = 0
uint64 bytesWritten = 0
int64 headerPosition = 0
bool writeFailed = false

Additional Inherited Members

Protected Member Functions inherited from juce::AudioFormatWriter
 AudioFormatWriter (OutputStream *destStream, const String &formatName, double sampleRate, unsigned int numberOfChannels, unsigned int bitsPerSample)
 AudioFormatWriter (OutputStream *destStream, const String &formatName, double sampleRate, const AudioChannelSet &audioChannelLayout, unsigned int bitsPerSample)
Protected Attributes inherited from juce::AudioFormatWriter
double sampleRate
unsigned int numChannels
unsigned int bitsPerSample
bool usesFloatingPointData
AudioChannelSet channelLayout
OutputStreamoutput

Constructor & Destructor Documentation

◆ WavAudioFormatWriter()

juce::WavAudioFormatWriter::WavAudioFormatWriter ( OutputStream *const out,
const double rate,
const AudioChannelSet & channelLayoutToUse,
const unsigned int bits,
const StringPairArray & metadataValues )
inline

◆ ~WavAudioFormatWriter()

juce::WavAudioFormatWriter::~WavAudioFormatWriter ( )
inlineoverride

Member Function Documentation

◆ chunkSize()

size_t juce::WavAudioFormatWriter::chunkSize ( const MemoryBlock & data)
inlinestaticprivatenoexcept

◆ flush()

bool juce::WavAudioFormatWriter::flush ( )
inlineoverridevirtual

Some formats may support a flush operation that makes sure the file is in a valid state before carrying on. If supported, this means that by calling flush periodically when writing data to a large file, then it should still be left in a readable state if your program crashes. It goes without saying that this method must be called from the same thread that's calling write()! If the format supports flushing and the operation succeeds, this returns true.

Reimplemented from juce::AudioFormatWriter.

◆ getChannelMaskFromChannelLayout()

int juce::WavAudioFormatWriter::getChannelMaskFromChannelLayout ( const AudioChannelSet & layout)
inlinestaticprivate

◆ write()

bool juce::WavAudioFormatWriter::write ( const int ** samplesToWrite,
int numSamples )
inlineoverridevirtual

Writes a set of samples to the audio stream.

Note that if you're trying to write the contents of an AudioBuffer, you can use writeFromAudioSampleBuffer().

Parameters
samplesToWritean array of arrays containing the sample data for each channel to write. This is a zero-terminated array of arrays, and can contain a different number of channels than the actual stream uses, and the writer should do its best to cope with this. If the format is fixed-point, each channel will be formatted as an array of signed integers using the full 32-bit range -0x80000000 to 0x7fffffff, regardless of the source's bit-depth. If it is a floating-point format, you should treat the arrays as arrays of floats, and just cast it to an (int**) to pass it into the method.
numSamplesthe number of samples to write

Implements juce::AudioFormatWriter.

◆ writeChunk()

void juce::WavAudioFormatWriter::writeChunk ( const MemoryBlock & data,
int chunkType,
int size = 0 ) const
inlineprivate

◆ writeChunkHeader()

void juce::WavAudioFormatWriter::writeChunkHeader ( int chunkType,
int size ) const
inlineprivate

◆ writeHeader()

void juce::WavAudioFormatWriter::writeHeader ( )
inlineprivate

Member Data Documentation

◆ acidChunk

MemoryBlock juce::WavAudioFormatWriter::acidChunk
private

◆ axmlChunk

MemoryBlock juce::WavAudioFormatWriter::axmlChunk
private

◆ bwavChunk

MemoryBlock juce::WavAudioFormatWriter::bwavChunk
private

◆ bytesWritten

uint64 juce::WavAudioFormatWriter::bytesWritten = 0
private

◆ cueChunk

MemoryBlock juce::WavAudioFormatWriter::cueChunk
private

◆ headerPosition

int64 juce::WavAudioFormatWriter::headerPosition = 0
private

◆ instChunk

MemoryBlock juce::WavAudioFormatWriter::instChunk
private

◆ ixmlChunk

MemoryBlock juce::WavAudioFormatWriter::ixmlChunk
private

◆ lengthInSamples

uint64 juce::WavAudioFormatWriter::lengthInSamples = 0
private

◆ listChunk

MemoryBlock juce::WavAudioFormatWriter::listChunk
private

◆ listInfoChunk

MemoryBlock juce::WavAudioFormatWriter::listInfoChunk
private

◆ smplChunk

MemoryBlock juce::WavAudioFormatWriter::smplChunk
private

◆ tempBlock

MemoryBlock juce::WavAudioFormatWriter::tempBlock
private

◆ trckChunk

MemoryBlock juce::WavAudioFormatWriter::trckChunk
private

◆ writeFailed

bool juce::WavAudioFormatWriter::writeFailed = false
private

The documentation for this class was generated from the following file: