Loading...
Searching...
No Matches
AudioFormatWriterOptions Class Referencefinal

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

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

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

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

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

◆ withSampleFormat()

AudioFormatWriterOptions AudioFormatWriterOptions::withSampleFormat ( SampleFormat x) const
nodiscard

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

See also
SampleFormat

References withMember(), and x.

◆ withSampleRate()

AudioFormatWriterOptions AudioFormatWriterOptions::withSampleRate ( double x) const
nodiscard

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 withMember(), and x.

◆ withChannelLayout()

AudioFormatWriterOptions AudioFormatWriterOptions::withChannelLayout ( const AudioChannelSet & x) const
nodiscard

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 withMember(), and x.

◆ withNumChannels()

AudioFormatWriterOptions AudioFormatWriterOptions::withNumChannels ( int x) const
nodiscard

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 withMember(), and x.

◆ withBitsPerSample()

AudioFormatWriterOptions AudioFormatWriterOptions::withBitsPerSample ( int x) const
nodiscard

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 withMember(), and x.

◆ withMetadataValues()

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

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 withMember(), and x.

◆ withMetadata()

AudioFormatWriterOptions AudioFormatWriterOptions::withMetadata ( const String & key,
const String & value ) const
nodiscard

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.

◆ withQualityOptionIndex()

AudioFormatWriterOptions AudioFormatWriterOptions::withQualityOptionIndex ( int x) const
nodiscard

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 withMember(), and x.

◆ getSampleRate()

auto AudioFormatWriterOptions::getSampleRate ( ) const
nodiscard

◆ getChannelLayout()

auto AudioFormatWriterOptions::getChannelLayout ( ) const
nodiscard

◆ getNumChannels()

auto AudioFormatWriterOptions::getNumChannels ( ) const
nodiscard

◆ getBitsPerSample()

auto AudioFormatWriterOptions::getBitsPerSample ( ) const
nodiscard

◆ getMetadataValues()

auto AudioFormatWriterOptions::getMetadataValues ( ) const
nodiscard

◆ getQualityOptionIndex()

auto AudioFormatWriterOptions::getQualityOptionIndex ( ) const
nodiscard

◆ getSampleFormat()

auto AudioFormatWriterOptions::getSampleFormat ( ) const
nodiscard
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram