Sound Player Manager - Horizon-NTH/HorizonGUI GitHub Wiki
SoundPlayerManager
Overview
The SoundPlayerManager
class, located in the hgui
namespace, provides a convenient way to
manage SoundPlayers
in your graphical application.
The class can be found inside the header file SoundPlayerManager.h
.
Member Functions
std::shared_ptr<kernel::SoundPlayer> create(const std::shared_ptr<kernel::Audio>& audio)
: Creates a newSoundPlayer
by specifying anAudio
object.
Example Usage
#include <hgui/header/SoundPlayerManager.h>
{ // Example Usage of SoundPlayerManager
std::shared_ptr<hgui::kernel::Audio> audio = /* initialize Audio object */;
std::shared_ptr<hgui::kernel::SoundPlayer> customSoundPlayer = hgui::SoundPlayerManager::create(audio);
// Use the sound player as needed
customSoundPlayer->play(); // Play audio track
// (Play, pause, or stop the audio here)
} // Here the custom sound player is destroyed and the audio track is automatically stopped
Note: In the "Example Usage" section, we demonstrate how to create a custom sound player with the
SoundPlayerManager
class.