VEGO-Engine  0.1
Loading...
Searching...
No Matches
SoundManager Class Reference

Handles music and sound. More...

#include <SoundManager.h>

Collaboration diagram for SoundManager:
[legend]

Public Member Functions

 SoundManager (SoundManager const &)=delete
 
void operator= (SoundManager const &)=delete
 
Mix_Music * loadMusic (const char *fileName)
 Loads music from a file (mp3)
 
Mix_Chunk * loadSound (const char *fileName)
 Loads sound effects from a file (wav)
 

Static Public Member Functions

static void playSound (GameInternal *game, std::string sound, bool canOverlap, int loops, int volume, int channel)
 Handles playing of sound effects.
 
static void playMusic (GameInternal *game, std::string sound, int loops, int volume, int ms)
 Handles playing of music.
 
static void setSoundVolume (int volume, int channel)
 Volume handling for sound effects (either all or on a specific channel)
 
static void setMusicVolume (int volume)
 Volume handling for music track.
 
static void pauseSound (int channel)
 Handles pausing sound effects (either all or on a specific channel)
 
static void pauseMusic ()
 Handles pausing music track.
 
static void restartSound (int channel)
 Handles resuming sound effects (either all or on a specific channel)
 
static void restartMusic ()
 Handles resuming music track.
 
static void fadeOutMusic (int ms)
 Handles fading out a music track.
 

Public Attributes

std::map< const char *, Mix_Music * > music_cache
 
std::map< const char *, Mix_Chunk * > sound_cache
 

Detailed Description

Handles music and sound.

SoundManager handles loading in music and sound effects from files, playing music and sound effects and toggling the audio volume.

Member Function Documentation

◆ loadMusic()

Mix_Music * SoundManager::loadMusic ( const char * fileName)

Loads music from a file (mp3)

Returns
a pointer to Mix_Music
See also
AssetManager::AddMusic(std::string id, const char* path)

◆ loadSound()

Mix_Chunk * SoundManager::loadSound ( const char * fileName)

Loads sound effects from a file (wav)

Returns
a pointer to Mix_Chunk
See also
AssetManager::AddSound(std::string id, const char* path)

◆ playMusic()

void SoundManager::playMusic ( GameInternal * game,
std::string sound,
int loops,
int volume,
int ms )
static

Handles playing of music.

Handles how often track can loop, as well as the volume at which the specified track should play and if it fades in.

◆ playSound()

void SoundManager::playSound ( GameInternal * game,
std::string sound,
bool canOverlap,
int loops,
int volume,
int channel )
static

Handles playing of sound effects.

Handles if sounds can overlap, how often they can loop, as well as the volume at which the specified sound effect should play and on which channel the soundeffect should play.


The documentation for this class was generated from the following files: