Skip to content

MagicBoombox Plugin Documentation

Introduction

MagicBoombox is a plugin designed for Unreal Engine 4/5 that provides functionality for managing and playing music files in a game. It supports features like playing random tracks, looping, and more. This documentation covers how to set up and use the MagicBoombox plugin.

Table of Contents

Installation

To install the MagicBoombox plugin, follow these steps: 1. Clone or download the plugin files. 2. Copy the MagicBoombox folder to your project's Plugins directory. 3. Add the following to your project's .uproject file to enable the plugin:

```json
"Plugins": [
    {
        "Name": "MagicBoombox",
        "Enabled": true
    }
]
```
  1. Open your project in Unreal Engine and ensure the MagicBoombox plugin is enabled.

Setup

Adding the MagicBoombox Actor

To use the MagicBoombox Actor in your level:

  1. Open your level in the Unreal Engine Editor.
  2. Drag the AMagicBoomboxActor from the Content Browser into your level.

Adding the MagicBoombox Component

To add the MagicBoombox Component to an actor:

  1. Open your actor's blueprint or class in the Unreal Engine Editor.
  2. Add the UMagicBoomboxComponent by navigating to the Components panel and clicking on Add Component.
  3. Select MagicBoombox Component.

Usage

MagicBoombox Actor

The AMagicBoomboxActor class provides functionality for playing music files using the MagicBoombox plugin.

Properties

  • MediaPlayerComponent: The media player component used for playing music.
  • MediaSoundComponent: The media sound component used to control audio playback.
  • EndPlayBehavior: The behavior to use when the end of the file is reached.
  • PlayerVolume: The initial volume of the media player.

Functions

  • CheckValidateMusic(): Check and validate music files in the MagicBoombox folder.
  • PlayRandomMusic(): Play a random music file from the available music files.
  • PlayNextMusic(): Play the next music file in the playlist.
  • PlayPreviousMusic(): Play the previous music file in the playlist.
  • PausePlayMusic(): Pause the currently playing music.
  • StopMusic(): Stop the currently playing music.
  • PlaySelectedMusic(FString InItem): Play the selected music file.
  • SetPlaybackRate(float InPlaybackRate): Set the playback speed of the media player.
  • GetVolume() -> float: Get the current volume of the media player.
  • GetTrackProgress() -> float: Get the progress of the track as a ratio of the total track length.
  • SetPlayerVolume(float InTransition, float InVolume, EAudioFaderCurve CurveType): Set the volume of the media player.

MagicBoombox Component

The UMagicBoomboxComponent class provides similar functionality to the MagicBoombox actor but as a component.

Properties

  • MediaPlayerComponent: The media player component used for playing music.
  • MediaSoundComponent: The media sound component used to control audio playback.
  • EndPlayBehavior: The behavior to use when the end of the file is reached.
  • PlayerVolume: The initial volume of the media player.
  • SoundAttenuationToUse: The sound attenuation to use for the media.

Functions

  • CheckValidateMusic(): Check and validate music files in the MagicBoombox folder.
  • PlayRandomMusic(): Play a random music file from the available music files.
  • PlayNextMusic(): Play the next music file in the playlist.
  • PlayPreviousMusic(): Play the previous music file in the playlist.
  • PausePlayMusic(): Pause the currently playing music.
  • StopMusic(): Stop the currently playing music.
  • PlaySelectedMusic(FString InItem): Play the selected music file.
  • SetPlaybackRate(float InPlaybackRate): Set the playback speed of the media player.
  • GetVolume() -> float: Get the current volume of the media player.
  • GetTrackProgress() -> float: Get the progress of the track as a ratio of the total track length.
  • SetPlayerVolume(float InTransition, float InVolume, EAudioFaderCurve CurveType): Set the volume of the media player.

Settings

The MagicBoombox plugin provides settings that you can configure through the Unreal Engine Project Settings.

General Settings

  • Searched Folder: The folder to search for music files. This is relative to the project’s content folder, plugin folder, or your game’s root folder.
  • Searched Types: The type of files to search for in the folder. Typically, .mp3 or .wav, but you can add more types.

Enums

EEndPlayBehavior

This enumeration defines the behavior to use when the end of the music file is reached.

  • NextTrack: Play the next track in the playlist.
  • PreviousTrack: Play the previous track in the playlist.
  • RandomTrack: Play a random track in the playlist.
  • Stop: Stop playing music.
  • Loop: Loop the current track.
  • PlaySelectedTrack: Play the selected track.

Functions

UMagicBoomboxSettings* GetSettings()

Retrieves the settings for the MagicBoombox plugin.

FMagicBoomboxModule* Get()

Returns the instance of the MagicBoombox module.

FString GetPluginFolder()

Returns the plugin folder path.

void FMagicBoomboxModule::StartupModule()

Called when the module is being loaded.

void FMagicBoomboxModule::ShutdownModule()

Called when the module is being unloaded.

Conclusion

The MagicBoombox plugin offers a simple yet powerful solution for managing and playing music files in Unreal Engine. With the actor and component functionalities, you have the flexibility to integrate it into your projects with ease. Configure the settings, add the actor or component, and enjoy music playback in your game.

For further assistance or questions, feel free to reach out to the developer community or consult the Unreal Engine documentation.