Magnum::Audio::AnyImporter class

Any audio importer plugin.

Detects file type based on file extension, loads corresponding plugin and then tries to open the file with it. Supported formats:

  • AAC (*.aac), loaded with any plugin that provides AacAudioImporter
  • MP3 (*.mp3), loaded with any plugin that provides Mp3AudioImporter
  • OGG Vorbis (*.ogg), loaded with any plugin that provides VorbisAudioImporter
  • WAV (*.wav), loaded with WavAudioImporter or any other plugin that provides it
  • FLAC (*.flac), loaded with any plugin that provides FlacAudioImporter

Only loading from files is supported.

Usage

This plugin depends on the Audio library and is built if WITH_ANYAUDIOIMPORTER is enabled when building Magnum. To use as a dynamic plugin, load "AnyAudioImporter" via Corrade::PluginManager::Manager.

Additionally, if you're using Magnum as a CMake subproject, do the following:

set(WITH_ANYAUDIOIMPORTER ON CACHE BOOL "" FORCE)
add_subdirectory(magnum EXCLUDE_FROM_ALL)

# So the dynamically loaded plugin gets built implicitly
add_dependencies(your-app Magnum::AnyAudioImporter)

To use as a static plugin or as a dependency of another plugin with CMake, you need to request the AnyAudioImporter component of the Magnum package and link to the Magnum::AnyAudioImporter target:

find_package(Magnum REQUIRED AnyAudioImporter)

# ...
target_link_libraries(your-app PRIVATE Magnum::AnyAudioImporter)

See Downloading and building, Usage with CMake and Loading and using plugins for more information.

Interface proxying and option propagation

On a call to openFile(), a file format is detected from the extension and a corresponding plugin is loaded. After that, options set through configuration() are propagated to the concrete implementation, with a warning emitted in case given option is not present in the default configuration of the target plugin.

Calls to the format(), frequency() and data() functions are then proxied to the concrete implementation. The close() function closes and discards the internally instantiated plugin; isOpened() works as usual.

Base classes

class AbstractImporter
Base for audio importer plugins.

Constructors, destructors, conversion operators

AnyImporter(PluginManager::Manager<AbstractImporter>& manager) explicit
Constructor with access to plugin manager.
AnyImporter(PluginManager::AbstractManager& manager, const std::string& plugin) explicit
Plugin manager constructor.