Functions | Variables
soundmanager.cpp File Reference


#include "soundmanager.h"
#include "configuration.h"
#include "being/localplayer.h"
#include "fs/virtfs/fs.h"
#include "resources/sdlmusic.h"
#include "resources/soundeffect.h"
#include "resources/loaders/musicloader.h"
#include "resources/loaders/soundloader.h"
#include "resources/resourcemanager/resourcemanager.h"
#include "utils/checkutils.h"
#include "utils/sdlmusichelper.h"
#include <SDL.h>
#include "debug.h"

Go to the source code of this file.


static void fadeOutCallBack ()
static SDLMusicloadMusic (const std::string &fileName, const SkipError skipError)


SoundManager soundManager
static bool sFadingOutEnded = false

Function Documentation

◆ fadeOutCallBack()

static void fadeOutCallBack ( )

Callback used at end of fadeout. It is called by Mix_MusicFadeFinished().

Definition at line 67 of file soundmanager.cpp.

68 {
69  sFadingOutEnded = true;
70 }
static bool sFadingOutEnded

References sFadingOutEnded.

Referenced by SoundManager::SoundManager().

◆ loadMusic()

static SDLMusic* loadMusic ( const std::string &  fileName,
const SkipError  skipError 

Definition at line 338 of file soundmanager.cpp.

340 {
341  const std::string path = pathJoin(paths.getStringValue("music"),
342  fileName);
343  if (!VirtFs::exists(path))
344  {
345  if (skipError == SkipError_false)
346  reportAlways("Music file not found: %s", fileName.c_str())
347  return nullptr;
348  }
349  return Loader::getMusic(path);
350 }
#define reportAlways(...)
Definition: checkutils.h:253
std::string getStringValue(const std::string &key) const
Configuration paths
SDLMusic * getMusic(const std::string &idPath)
Definition: musicloader.cpp:74
bool exists(std::string name)
Definition: fs.cpp:124
const bool SkipError_false
Definition: skiperror.h:30
std::string pathJoin(std::string str1, const std::string &str2)
std::string fileName
Definition: testmain.cpp:39

References VirtFs::exists(), fileName, Loader::getMusic(), Configuration::getStringValue(), pathJoin(), paths, reportAlways, and SkipError_false.

Referenced by SoundManager::playMusic().

Variable Documentation

◆ sFadingOutEnded

bool sFadingOutEnded = false

This will be set to true, when a music can be freed after a fade out Currently used by fadeOutCallBack()

Definition at line 61 of file soundmanager.cpp.

Referenced by fadeOutCallBack(), SoundManager::fadeOutMusic(), SoundManager::logic(), and SoundManager::SoundManager().

◆ soundManager

SoundManager soundManager