OpenShot Audio Library | OpenShotAudio: juce::AudioFormatManager Class Reference

OpenShot Audio Library | OpenShotAudio 0.3.1

Loading...
Searching...
No Matches
Public Member Functions | List of all members
juce::AudioFormatManager Class Reference

`#include <juce_AudioFormatManager.h>`

## Public Member Functions
| AudioFormatManager ()
| ~AudioFormatManager ()
void | registerFormat (AudioFormat *newFormat, bool makeThisTheDefaultFormat)
void | registerBasicFormats ()
void | clearFormats ()
int | getNumKnownFormats () const
AudioFormat * | getKnownFormat (int index) const
AudioFormat ** | begin () noexcept
AudioFormat *const * | begin () const noexcept
AudioFormat ** | end () noexcept
AudioFormat *const * | end () const noexcept
AudioFormat * | findFormatForFileExtension (const String &fileExtension) const
AudioFormat * | getDefaultFormat () const
String | getWildcardForAllFormats () const
AudioFormatReader * | createReaderFor (const File &audioFile)
AudioFormatReader * | createReaderFor (InputStream *audioFileStream)

## Detailed Description

A class for keeping a list of available audio formats, and for deciding which one to use to open a given file.

After creating an AudioFormatManager object, you should call registerFormat() or registerBasicFormats() to give it a list of format types that it can use.

See also
  AudioFormat

Definition at line 42 of file juce_AudioFormatManager.h.

## Constructor & Destructor Documentation

## ◆ AudioFormatManager()

juce::AudioFormatManager::AudioFormatManager | ( |  | ) |

Creates an empty format manager.

Before it'll be any use, you'll need to call registerFormat() with all the formats you want it to be able to recognise.

Definition at line 30 of file juce_AudioFormatManager.cpp.

## ◆ ~AudioFormatManager()

juce::AudioFormatManager::~AudioFormatManager | ( |  | ) |

Destructor.

Definition at line 31 of file juce_AudioFormatManager.cpp.

## Member Function Documentation

## ◆ begin() [1/2]

AudioFormat *const * juce::AudioFormatManager::begin | ( |  | ) | const
| inlinenoexcept

Iterator access to the list of known formats.

Definition at line 87 of file juce_AudioFormatManager.h.

## ◆ begin() [2/2]

AudioFormat ** juce::AudioFormatManager::begin | ( |  | ) |
| inlinenoexcept

Iterator access to the list of known formats.

Definition at line 84 of file juce_AudioFormatManager.h.

## ◆ clearFormats()

void juce::AudioFormatManager::clearFormats | ( |  | ) |

Clears the list of known formats.

Definition at line 81 of file juce_AudioFormatManager.cpp.

## ◆ createReaderFor() [1/2]

AudioFormatReader * juce::AudioFormatManager::createReaderFor | ( | const File & | audioFile | ) |

Searches through the known formats to try to create a suitable reader for this file.

If none of the registered formats can open the file, it'll return nullptr. It's the caller's responsibility to delete the reader that is returned.

Definition at line 121 of file juce_AudioFormatManager.cpp.

## ◆ createReaderFor() [2/2]

AudioFormatReader * juce::AudioFormatManager::createReaderFor | ( | InputStream * | audioFileStream | ) |

Searches through the known formats to try to create a suitable reader for this stream.

The stream object that is passed-in will be deleted by this method or by the reader that is returned, so the caller should not keep any references to it.

The stream that is passed-in must be capable of being repositioned so that all the formats can have a go at opening it.

If none of the registered formats can open the stream, it'll return nullptr. If it returns a reader, it's the caller's responsibility to delete the reader.

Definition at line 136 of file juce_AudioFormatManager.cpp.

## ◆ end() [1/2]

AudioFormat *const * juce::AudioFormatManager::end | ( |  | ) | const
| inlinenoexcept

Iterator access to the list of known formats.

Definition at line 93 of file juce_AudioFormatManager.h.

## ◆ end() [2/2]

AudioFormat ** juce::AudioFormatManager::end | ( |  | ) |
| inlinenoexcept

Iterator access to the list of known formats.

Definition at line 90 of file juce_AudioFormatManager.h.

## ◆ findFormatForFileExtension()

AudioFormat * juce::AudioFormatManager::findFormatForFileExtension | ( | const String & | fileExtension | ) | const

Looks for which of the known formats is listed as being for a given file extension.

The extension may have a dot before it, so e.g. ".wav" or "wav" are both ok.

Definition at line 91 of file juce_AudioFormatManager.cpp.

Referenced by findFormatForFileExtension().

## ◆ getDefaultFormat()

AudioFormat * juce::AudioFormatManager::getDefaultFormat | ( |  | ) | const

Returns the format which has been set as the default one.

You can set a format as being the default when it is registered. It's useful when you want to write to a file, because the best format may change between platforms, e.g. AIFF is preferred on the Mac, WAV on Windows.

If none has been set as the default, this method will just return the first one in the list.

Definition at line 89 of file juce_AudioFormatManager.cpp.

## ◆ getKnownFormat()

AudioFormat * juce::AudioFormatManager::getKnownFormat | ( | int | index | ) | const

Returns one of the registered file formats.

Definition at line 88 of file juce_AudioFormatManager.cpp.

Referenced by getDefaultFormat().

## ◆ getNumKnownFormats()

int juce::AudioFormatManager::getNumKnownFormats | ( |  | ) | const

Returns the number of currently registered file formats.

Definition at line 87 of file juce_AudioFormatManager.cpp.

Referenced by createReaderFor(), and registerFormat().

## ◆ getWildcardForAllFormats()

String juce::AudioFormatManager::getWildcardForAllFormats | ( |  | ) | const

Returns a set of wildcards for file-matching that contains the extensions for all known formats.

E.g. if might return "*.wav;*.aiff" if it just knows about wavs and aiffs.

Definition at line 103 of file juce_AudioFormatManager.cpp.

## ◆ registerBasicFormats()

void juce::AudioFormatManager::registerBasicFormats | ( |  | ) |

Handy method to make it easy to register the formats that come with JUCE. This will add WAV and AIFF to the list, along with any other formats enabled in either the Projucer or your application's AppConfig.h.

Definition at line 55 of file juce_AudioFormatManager.cpp.

## ◆ registerFormat()

void juce::AudioFormatManager::registerFormat | ( | AudioFormat * | newFormat,
|  | bool | makeThisTheDefaultFormat
| ) |  |

Adds a format to the manager's list of available file types.

The object passed-in will be deleted by this object, so don't keep a pointer to it!

If makeThisTheDefaultFormat is true, then the getDefaultFormat() method will return this one when called.

Definition at line 34 of file juce_AudioFormatManager.cpp.

Referenced by registerBasicFormats().

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

- juce_AudioFormatManager.h
- juce_AudioFormatManager.cpp