Runtime Audio Importer is an open-source plugin to import audio files of MP3, WAV and FLAC formats into the game at runtime.
It's easy to use in both C++ and Blueprints.
Plugin does not require any static libraries and external dependencies.
How to install
There're two ways to install the plugin:
- Through the marketplace.
- Manual installation. Open this GitHub Repository, extract the "RuntimeAudioImporter" folder into your plugins project folder to get the following path: "[ProjectName] / Plugins / RuntimeAudioImporter".
How to use
When importing, audio data is transcoded to Interleaved 32-bit IEEE floating point PCM, which in turn is divided into frames (by default, usually 2048 frames per request), which are transferred to the audio render thread, where this data is processed. These iterations happen very often.
Description of structures and enumerators
Here are descriptions of structures and enumerators that are used in the plugin as input and output parameters of certain functions.
AudioFormat enumerator. Needed to specify the format of the audio data.
- Determine format automatically. Select it if you want to automatically detect the audio format based on the audio file extension.
- MP3. Select if you are sure that the audio file contains MP3 data.
- WAV. Select if you are sure that the audio file contains WAV data.
- FLAC. Select if you are sure that the audio file contains FLAC data.
RAWAudioFormat enumerator. Needed to specify the format of the RAW audio data.
- Signed 16-bit PCM. Audio data from -32768 to 32767.
- Signed 32-bit PCM. Audio data from -2147483648 to 2147483647.
- Unsigned 8-bit PCM. Audio data from 0 to 255.
- 32-bit float. Audio data from -1 to 1. Recommended, maximum importing speed (since no transcoding).
TranscodingStatus enumerator. Needed in order to know if the error occured or not. It can be get from "OnResult" delegate.
- SuccessImporting. When the import was successful.
- FailedToReadAudioDataArray. Audio data array contains invalid data.
- SoundWaveDeclarationError. Error while initializing SoundWave object.
- InvalidAudioFormat. Can't determine the format of the audio file.
- AudioDoesNotExist. The audio file does not exist.
- LoadFileToArrayError. When it is impossible to access a file.