OpenShot Library | OpenShotAudio  0.2.2
juce::WavAudioFormatWriter Class Reference
+ Inheritance diagram for juce::WavAudioFormatWriter:

Public Member Functions

 WavAudioFormatWriter (OutputStream *const out, const double rate, const AudioChannelSet &channelLayoutToUse, const unsigned int bits, const StringPairArray &metadataValues)
 
bool write (const int **data, int numSamples) override
 Writes a set of samples to the audio stream. More...
 
bool flush () override
 Some formats may support a flush operation that makes sure the file is in a valid state before carrying on. More...
 
- Public Member Functions inherited from juce::AudioFormatWriter
virtual ~AudioFormatWriter ()
 Destructor. More...
 
const StringgetFormatName () const noexcept
 Returns a description of what type of format this is. More...
 
bool writeFromAudioReader (AudioFormatReader &reader, int64 startSample, int64 numSamplesToRead)
 Reads a section of samples from an AudioFormatReader, and writes these to the output. More...
 
bool writeFromAudioSource (AudioSource &source, int numSamplesToRead, int samplesPerBlock=2048)
 Reads some samples from an AudioSource, and writes these to the output. More...
 
bool writeFromAudioSampleBuffer (const AudioBuffer< float > &source, int startSample, int numSamples)
 Writes some samples from an AudioBuffer. More...
 
bool writeFromFloatArrays (const float *const *channels, int numChannels, int numSamples)
 Writes some samples from a set of float data channels. More...
 
double getSampleRate () const noexcept
 Returns the sample rate being used. More...
 
int getNumChannels () const noexcept
 Returns the number of channels being written. More...
 
int getBitsPerSample () const noexcept
 Returns the bit-depth of the data being written. More...
 
bool isFloatingPoint () const noexcept
 Returns true if it's a floating-point format, false if it's fixed-point. More...
 

Additional Inherited Members

- Protected Member Functions inherited from juce::AudioFormatWriter
 AudioFormatWriter (OutputStream *destStream, const String &formatName, double sampleRate, unsigned int numberOfChannels, unsigned int bitsPerSample)
 Creates an AudioFormatWriter object. More...
 
 AudioFormatWriter (OutputStream *destStream, const String &formatName, double sampleRate, const AudioChannelSet &audioChannelLayout, unsigned int bitsPerSample)
 Creates an AudioFormatWriter object. More...
 
- Protected Attributes inherited from juce::AudioFormatWriter
double sampleRate
 The sample rate of the stream. More...
 
unsigned int numChannels
 The number of channels being written to the stream. More...
 
unsigned int bitsPerSample
 The bit depth of the file. More...
 
bool usesFloatingPointData
 True if it's a floating-point format, false if it's fixed-point. More...
 
AudioChannelSet channelLayout
 The audio channel layout that the writer should use.
 
OutputStreamoutput
 The output stream for use by subclasses. More...
 

Detailed Description

Definition at line 1297 of file juce_WavAudioFormat.cpp.

Member Function Documentation

◆ 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.

Definition at line 1335 of file juce_WavAudioFormat.cpp.

◆ 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.

Definition at line 1370 of file juce_WavAudioFormat.cpp.

References juce::AudioChannelSet::getChannelTypes(), juce::MemoryBlock::getSize(), juce::AudioChannelSet::isDiscreteLayout(), juce::AudioChannelSet::mono(), and juce::AudioChannelSet::stereo().


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