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
- MP3 (
*.mp3), loaded with any plugin that provides
- OGG Vorbis (
*.ogg), loaded with any plugin that provides
- WAV (
*.wav), loaded with WavAudioImporter or any other plugin that provides it
- FLAC (
*.flac), loaded with any plugin that provides
Only loading from files is supported.
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::
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
find_package(Magnum REQUIRED AnyAudioImporter) # ... target_link_libraries(your-app PRIVATE Magnum::AnyAudioImporter)
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.
- class AbstractImporter
- Base for audio importer plugins.