JUCE v8.0.9
JUCE API
 
Loading...
Searching...
No Matches
juce::AudioFormatWriterOptions Class Referencefinal

Options that affect the output data format produced by an AudioFormatWriter. More...

#include <juce_AudioFormatWriterOptions.h>

Collaboration diagram for juce::AudioFormatWriterOptions:

Public Types

enum class  SampleFormat {
  automatic ,
  integral ,
  floatingPoint
}
 Used to provide a hint to the AudioFormatWriter for the output sample format. More...
 

Public Member Functions

auto getBitsPerSample () const
 
auto getChannelLayout () const
 
auto getMetadataValues () const
 
auto getNumChannels () const
 
auto getQualityOptionIndex () const
 
auto getSampleFormat () const
 
auto getSampleRate () const
 
AudioFormatWriterOptions withBitsPerSample (int x) const
 Returns a copy of these options with the specified bit size per sample.
 
AudioFormatWriterOptions withChannelLayout (const AudioChannelSet &x) const
 Returns a copy of these options with the specified channel set.
 
AudioFormatWriterOptions withMetadata (const String &key, const String &value) const
 Returns a copy of these options with the specified metadata added.
 
AudioFormatWriterOptions withMetadataValues (const std::unordered_map< String, String > &x) const
 Returns a copy of these options with the specified metadata container.
 
AudioFormatWriterOptions withNumChannels (int x) const
 Returns a copy of these options with the specified number of channels.
 
AudioFormatWriterOptions withQualityOptionIndex (int x) const
 Returns a copy of these options with the specified quality option index.
 
AudioFormatWriterOptions withSampleFormat (SampleFormat x) const
 Returns a copy of these options with the specified sample format.
 
AudioFormatWriterOptions withSampleRate (double x) const
 Returns a copy of these options with the specified sample rate.
 

Private Attributes

int bitsPerSample = 16
 
std::optional< AudioChannelSetchannelLayout = std::nullopt
 
std::unordered_map< String, StringmetadataValues
 
int numChannels = 1
 
int qualityOptionIndex = 0
 
SampleFormat sampleFormat = SampleFormat::automatic
 
double sampleRate = 48000.0
 

Detailed Description

Options that affect the output data format produced by an AudioFormatWriter.

Format specific writers may ignore some of these options.

See also
AudioFormat::createWriterFor(), AudioFormatWriter

@tags{Audio}

Member Enumeration Documentation

◆ SampleFormat

Used to provide a hint to the AudioFormatWriter for the output sample format.

Use automatic for the old behaviour. The values integral and floatingPoint can be used with the WavAudioFormat when using a bit depth of 32. Other formats are not affected by this setting.

Enumerator
automatic 

Lets the writer decide the format based on the other parameter values.

integral 

Integral format, e.g. PCM in case of the WavAudioFormat.

floatingPoint 

IEEE floating point format.

Member Function Documentation

◆ getBitsPerSample()

auto juce::AudioFormatWriterOptions::getBitsPerSample ( ) const
inline

◆ getChannelLayout()

auto juce::AudioFormatWriterOptions::getChannelLayout ( ) const
inline

◆ getMetadataValues()

auto juce::AudioFormatWriterOptions::getMetadataValues ( ) const
inline

◆ getNumChannels()

auto juce::AudioFormatWriterOptions::getNumChannels ( ) const
inline

◆ getQualityOptionIndex()

auto juce::AudioFormatWriterOptions::getQualityOptionIndex ( ) const
inline

◆ getSampleFormat()

auto juce::AudioFormatWriterOptions::getSampleFormat ( ) const
inline

◆ getSampleRate()

auto juce::AudioFormatWriterOptions::getSampleRate ( ) const
inline

◆ withBitsPerSample()

AudioFormatWriterOptions juce::AudioFormatWriterOptions::withBitsPerSample ( int  x) const
inline

Returns a copy of these options with the specified bit size per sample.

This must be one of the values returned by AudioFormat::getPossibleBitDepths().

References juce::withMember().

◆ withChannelLayout()

AudioFormatWriterOptions juce::AudioFormatWriterOptions::withChannelLayout ( const AudioChannelSet x) const
inline

Returns a copy of these options with the specified channel set.

Setting this option will supersede the value passed into withNumChannels().

You should prefer to use withChannelLayout(), if specifying an AudioChannelSet is applicable, and withNumChannels() otherwise.

References juce::withMember().

◆ withMetadata()

AudioFormatWriterOptions juce::AudioFormatWriterOptions::withMetadata ( const String key,
const String value 
) const
inline

Returns a copy of these options with the specified metadata added.

Subsequent calls of this function adds new metadata values, while also preserving the previously added ones.

Here you can specify metadata values that the writer should try to write to the stream. Exactly what these are depends on the format, and the subclass doesn't actually have to do anything with them if it doesn't want to. Have a look at the specific format implementation classes to see possible values that can be used.

◆ withMetadataValues()

AudioFormatWriterOptions juce::AudioFormatWriterOptions::withMetadataValues ( const std::unordered_map< String, String > &  x) const
inline

Returns a copy of these options with the specified metadata container.

As an alternative to this function, you can specify the key-value pairs one-by-one using the withMetadata function.

Subsequent calls of this function overwrites all previously added metadata.

This parameter is a set of metadata values that the writer should try to write to the stream. Exactly what these are depends on the format, and the subclass doesn't actually have to do anything with them if it doesn't want to. Have a look at the specific format implementation classes to see possible values that can be used.

References juce::withMember().

◆ withNumChannels()

AudioFormatWriterOptions juce::AudioFormatWriterOptions::withNumChannels ( int  x) const
inline

Returns a copy of these options with the specified number of channels.

This is meant as a fallback for specifying the channel layout. Setting this option will have no effect if the channel layout is specified.

See also
withChannelLayout()

References juce::withMember().

◆ withQualityOptionIndex()

AudioFormatWriterOptions juce::AudioFormatWriterOptions::withQualityOptionIndex ( int  x) const
inline

Returns a copy of these options with the specified quality option index.

The index of one of the items returned by the AudioFormat::getQualityOptions() method.

References juce::withMember().

◆ withSampleFormat()

AudioFormatWriterOptions juce::AudioFormatWriterOptions::withSampleFormat ( SampleFormat  x) const
inline

Returns a copy of these options with the specified sample format.

See also
SampleFormat

References juce::withMember().

◆ withSampleRate()

AudioFormatWriterOptions juce::AudioFormatWriterOptions::withSampleRate ( double  x) const
inline

Returns a copy of these options with the specified sample rate.

This specifies the sample rate for the file, which must be one of the ones returned by AudioFormat::getPossibleSampleRates().

References juce::withMember().

Member Data Documentation

◆ bitsPerSample

int juce::AudioFormatWriterOptions::bitsPerSample = 16
private

◆ channelLayout

std::optional<AudioChannelSet> juce::AudioFormatWriterOptions::channelLayout = std::nullopt
private

◆ metadataValues

std::unordered_map<String, String> juce::AudioFormatWriterOptions::metadataValues
private

◆ numChannels

int juce::AudioFormatWriterOptions::numChannels = 1
private

◆ qualityOptionIndex

int juce::AudioFormatWriterOptions::qualityOptionIndex = 0
private

◆ sampleFormat

SampleFormat juce::AudioFormatWriterOptions::sampleFormat = SampleFormat::automatic
private

◆ sampleRate

double juce::AudioFormatWriterOptions::sampleRate = 48000.0
private

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