#include <C4MusicSystem.h>
Public Member Functions | |
C4MusicSystem () | |
~C4MusicSystem () | |
void | Clear () |
void | ClearGame () |
void | UpdateVolume () |
void | Execute (bool force_buffer_checks=false) |
void | NotifySuccess () |
bool | Init (const char *PlayList=nullptr) |
bool | InitForScenario (C4Group &hGroup) |
bool | Play (const char *szSongname=nullptr, bool fLoop=false, int fadetime_ms=0, double max_resume_time=0.0, bool allow_break=false) |
bool | Play (C4MusicFile *NewFile, bool fLoop, double max_resume_time) |
bool | Stop () |
void | FadeOut (int fadeout_ms) |
int | SetPlayList (const char *szPlayList, bool fForceSwitch=false, int fadetime_ms=0, double max_resume_time=0.0) |
bool | ToggleOnOff () |
void | SelectContext () |
ALCcontext * | GetContext () const |
ALCdevice * | GetDevice () const |
bool | IsMODInitialized () |
void | CompileFunc (class StdCompiler *comp) |
void | SetMusicBreakMin (int32_t val) |
void | SetMusicBreakMax (int32_t val) |
void | SetMusicBreakChance (int32_t val) |
void | SetMusicMaxPositionMemory (int32_t val) |
int32_t | SetGameMusicLevel (int32_t val) |
Protected Member Functions | |
void | LoadDir (const char *szPath) |
void | Load (const char *szFile) |
void | LoadMoreMusic () |
void | ClearSongs () |
bool | GrpContainsMusic (C4Group &rGrp) |
bool | ScheduleWaitTime () |
bool | InitializeMOD () |
void | DeinitializeMOD () |
Protected Attributes | |
C4MusicFile * | Songs {nullptr} |
int | SongCount {0} |
int | ASongCount |
int | SCounter |
C4MusicFile * | PlayMusicFile {nullptr} |
int | Volume {100} |
bool | Loop |
C4MusicFile * | FadeMusicFile {nullptr} |
C4MusicFile * | upcoming_music_file {nullptr} |
C4TimeMilliseconds | FadeTimeStart |
C4TimeMilliseconds | FadeTimeEnd |
bool | is_waiting {false} |
C4TimeMilliseconds | wait_time_end |
bool | MODInitialized |
Friends | |
class | C4SoundEffect |
class | C4SoundInstance |
class | C4SoundSystem |
Definition at line 29 of file C4MusicSystem.h.
C4MusicSystem::C4MusicSystem | ( | ) |
Definition at line 29 of file C4MusicSystem.cpp.
C4MusicSystem::~C4MusicSystem | ( | ) |
Definition at line 36 of file C4MusicSystem.cpp.
References Clear().
void C4MusicSystem::Clear | ( | ) |
Definition at line 311 of file C4MusicSystem.cpp.
References ClearSongs(), DeinitializeMOD(), and MODInitialized.
Referenced by C4Application::Clear(), and ~C4MusicSystem().
void C4MusicSystem::ClearGame | ( | ) |
Definition at line 321 of file C4MusicSystem.cpp.
References is_waiting, SetPlayList(), and upcoming_music_file.
Referenced by C4Game::Clear(), and C4Game::Default().
|
protected |
Definition at line 297 of file C4MusicSystem.cpp.
References FadeMusicFile, PlayMusicFile, C4MusicFile::pNext, SongCount, Songs, Stop(), and upcoming_music_file.
Referenced by Clear(), Init(), InitForScenario(), and LoadMoreMusic().
void C4MusicSystem::CompileFunc | ( | class StdCompiler * | comp | ) |
Definition at line 761 of file C4MusicSystem.cpp.
References StdStrBuf::getData(), StdCompiler::isDeserializer(), mkNamingAdapt(), SetGameMusicLevel(), SetPlayList(), and StdCompiler::Value().
|
protected |
Definition at line 97 of file C4MusicSystem.cpp.
References MODInitialized.
Referenced by Clear().
void C4MusicSystem::Execute | ( | bool | force_buffer_checks = false | ) |
Definition at line 332 of file C4MusicSystem.cpp.
References C4MusicFile::CheckIfPlaying(), FadeMusicFile, FadeTimeEnd, FadeTimeStart, Game, is_waiting, C4Game::IsPaused(), C4Game::IsRunning, C4Game::iTick35, C4TimeMilliseconds::Now(), Play(), PlayMusicFile, C4MusicFile::SetVolume(), C4MusicFile::Stop(), upcoming_music_file, Volume, and wait_time_end.
Referenced by C4GraphicsSystem::DoSaveScreenshot(), and C4Application::GameTick().
void C4MusicSystem::FadeOut | ( | int | fadeout_ms | ) |
Definition at line 606 of file C4MusicSystem.cpp.
References FadeMusicFile, FadeTimeEnd, FadeTimeStart, C4TimeMilliseconds::Now(), PlayMusicFile, and C4MusicFile::Stop().
Referenced by C4Game::Clear().
|
inline |
Definition at line 89 of file C4MusicSystem.h.
|
inline |
Definition at line 90 of file C4MusicSystem.h.
Referenced by C4SoundModifierList::Init().
|
protected |
Definition at line 661 of file C4MusicSystem.cpp.
References C4Group::FindEntry().
Referenced by InitForScenario().
bool C4MusicSystem::Init | ( | const char * | PlayList = nullptr | ) |
Definition at line 114 of file C4MusicSystem.cpp.
References C4Config::AtSystemDataPath(), C4Config::AtUserDataPath(), C4CFN_Music, ClearSongs(), Config, InitializeMOD(), LoadDir(), LoadMoreMusic(), MODInitialized, SCounter, SetPlayList(), and UpdateVolume().
Referenced by C4Application::PreInit().
bool C4MusicSystem::InitForScenario | ( | C4Group & | hGroup | ) |
Definition at line 135 of file C4MusicSystem.cpp.
References StdStrBuf::Append(), StdStrBuf::AppendChar(), C4CFN_Music, C4GSCnt_Music, ClearSongs(), DirectorySeparator, C4GroupSet::FindGroup(), Game, StdStrBuf::getData(), C4Group::GetFullName(), C4Game::GroupSet, GrpContainsMusic(), LoadDir(), LoadResStr(), LogF(), C4Game::ScenarioFile, SetPlayList(), SongCount, and StdStrBuf::Take().
|
protected |
Definition at line 48 of file C4MusicSystem.cpp.
References LogF(), and MODInitialized.
Referenced by C4SoundSystem::Init(), and Init().
|
inline |
|
protected |
Definition at line 177 of file C4MusicSystem.cpp.
References GetExtension(), GetMusicFileTypeByExtension(), C4MusicFile::Init(), MUSICTYPE_UNKNOWN, C4MusicFile::pNext, SEqualNoCase(), SongCount, and Songs.
Referenced by LoadDir().
|
protected |
Definition at line 204 of file C4MusicSystem.cpp.
References _MAX_FNAME, _MAX_FNAME_LEN, DirectorySeparator, C4Group::FindNextEntry(), GetFilename(), Load(), LogF(), C4Group::Open(), C4Group::ResetSearch(), SCopy(), sprintf, and SSearch().
Referenced by Init(), InitForScenario(), and LoadMoreMusic().
|
protected |
Definition at line 265 of file C4MusicSystem.cpp.
References C4Config::AtUserDataPath(), C4CFN_MoreMusic, ClearSongs(), Config, StdStrBuf::getMData(), LoadDir(), StdStrBuf::LoadFromFile(), SCopyUntil(), and SEqual().
Referenced by Init().
void C4MusicSystem::NotifySuccess | ( | ) |
Definition at line 567 of file C4MusicSystem.cpp.
References Loop, C4MusicFile::Play(), PlayMusicFile, ScheduleWaitTime(), and Stop().
Referenced by C4MusicFileSDL::CheckIfPlaying(), and ConsoleDlgProc().
bool C4MusicSystem::Play | ( | C4MusicFile * | NewFile, |
bool | fLoop, | ||
double | max_resume_time | ||
) |
Definition at line 544 of file C4MusicSystem.cpp.
References C4MusicFile::Announce(), Config, StdStrBuf::getData(), C4MusicFile::GetDebugInfo(), C4MusicFile::HasBeenAnnounced(), C4MusicFile::LastPlayed, LogF(), Loop, C4MusicFile::Play(), PlayMusicFile, SCounter, C4MusicFile::SetVolume(), C4Config::Sound, C4ConfigSound::Verbose, and Volume.
bool C4MusicSystem::Play | ( | const char * | szSongname = nullptr , |
bool | fLoop = false , |
||
int | fadetime_ms = 0 , |
||
double | max_resume_time = 0.0 , |
||
bool | allow_break = false |
||
) |
Definition at line 390 of file C4MusicSystem.cpp.
References _MAX_FNAME_LEN, ASongCount, Config, DefaultExtension(), FadeMusicFile, FadeTimeEnd, FadeTimeStart, C4ConfigSound::FEMusic, C4MusicFile::FileName, Game, GetFilename(), C4MusicFile::GetRemainingTime(), C4MusicFile::HasResumePos(), is_waiting, C4MusicFile::IsLooping(), C4Game::IsRunning, C4MusicFile::LastPlayed, LogF(), C4TimeMilliseconds::Now(), PlayMusicFile, C4MusicFile::pNext, C4ConfigSound::RXMusic, ScheduleWaitTime(), SCopy(), SCounter, SEqual(), C4MusicFile::SetVolume(), Songs, C4Config::Sound, Stop(), C4MusicFile::Stop(), UnsyncedRandom(), upcoming_music_file, C4ConfigSound::Verbose, and wait_time_end.
Referenced by Execute(), C4Application::PreInit(), SetPlayList(), and ToggleOnOff().
|
protected |
Definition at line 581 of file C4MusicSystem.cpp.
References Config, is_waiting, LogF(), C4TimeMilliseconds::Now(), C4MusicFile::pNext, SCounter, Songs, C4Config::Sound, UnsyncedRandom(), C4ConfigSound::Verbose, and wait_time_end.
Referenced by NotifySuccess(), and Play().
void C4MusicSystem::SelectContext | ( | ) |
Definition at line 42 of file C4MusicSystem.cpp.
Referenced by C4SoundModifier::C4SoundModifier(), C4SoundSystem::Execute(), C4SoundModifierList::Init(), C4SoundEffect::Load(), C4SoundLoaders::WavLoader::ReadInfo(), C4SoundInstance::Start(), C4SoundModifierReverb::Update(), C4SoundModifierEcho::Update(), and C4SoundModifierEqualizer::Update().
int32_t C4MusicSystem::SetGameMusicLevel | ( | int32_t | val | ) |
Definition at line 778 of file C4MusicSystem.cpp.
References UpdateVolume().
Referenced by CompileFunc().
|
inline |
Definition at line 115 of file C4MusicSystem.h.
|
inline |
Definition at line 114 of file C4MusicSystem.h.
|
inline |
Definition at line 113 of file C4MusicSystem.h.
|
inline |
Definition at line 116 of file C4MusicSystem.h.
int C4MusicSystem::SetPlayList | ( | const char * | szPlayList, |
bool | fForceSwitch = false , |
||
int | fadetime_ms = 0 , |
||
double | max_resume_time = 0.0 |
||
) |
Definition at line 675 of file C4MusicSystem.cpp.
References _MAX_FNAME, _MAX_FNAME_LEN, ASongCount, Config, StdStrBuf::Copy(), C4MusicFile::FileName, GetFilename(), C4MusicFile::HasCategory(), is_waiting, LogF(), C4MusicFile::NoPlay, C4TimeMilliseconds::Now(), Play(), PlayMusicFile, C4MusicFile::pNext, SGetModule(), Songs, C4Config::Sound, C4ConfigSound::Verbose, wait_time_end, and WildcardMatch().
Referenced by ClearGame(), CompileFunc(), Init(), and InitForScenario().
bool C4MusicSystem::Stop | ( | ) |
Definition at line 619 of file C4MusicSystem.cpp.
References FadeMusicFile, PlayMusicFile, and C4MusicFile::Stop().
Referenced by ClearSongs(), NotifySuccess(), Play(), and ToggleOnOff().
bool C4MusicSystem::ToggleOnOff | ( | ) |
Definition at line 740 of file C4MusicSystem.cpp.
References Config, C4ConfigSound::FEMusic, C4GraphicsSystem::FlashMessageOnOff(), Game, GraphicsSystem, C4Game::IsRunning, LoadResStr(), Play(), C4ConfigSound::RXMusic, C4Config::Sound, and Stop().
Referenced by C4Game::InitKeyboard(), C4StartupOptionsDlg::KeyMusicToggle(), and C4MainMenu::MenuCommand().
void C4MusicSystem::UpdateVolume | ( | ) |
Definition at line 634 of file C4MusicSystem.cpp.
References Config, C4ConfigSound::MusicVolume, PlayMusicFile, C4MusicFile::SetVolume(), C4Config::Sound, and Volume.
Referenced by Init(), and SetGameMusicLevel().
|
friend |
Definition at line 31 of file C4MusicSystem.h.
|
friend |
Definition at line 32 of file C4MusicSystem.h.
|
friend |
Definition at line 33 of file C4MusicSystem.h.
|
protected |
Definition at line 56 of file C4MusicSystem.h.
Referenced by Play(), and SetPlayList().
|
protected |
Definition at line 63 of file C4MusicSystem.h.
Referenced by ClearSongs(), Execute(), FadeOut(), Play(), and Stop().
|
protected |
Definition at line 64 of file C4MusicSystem.h.
|
protected |
Definition at line 64 of file C4MusicSystem.h.
|
protected |
Definition at line 67 of file C4MusicSystem.h.
Referenced by ClearGame(), Execute(), Play(), ScheduleWaitTime(), and SetPlayList().
|
protected |
Definition at line 60 of file C4MusicSystem.h.
Referenced by NotifySuccess(), and Play().
|
protected |
Definition at line 80 of file C4MusicSystem.h.
Referenced by Clear(), DeinitializeMOD(), C4SoundSystem::Init(), Init(), InitializeMOD(), IsMODInitialized(), C4SoundInstance::Playing(), and C4SoundInstance::Start().
|
protected |
Definition at line 59 of file C4MusicSystem.h.
Referenced by ClearSongs(), Execute(), FadeOut(), NotifySuccess(), Play(), SetPlayList(), Stop(), and UpdateVolume().
|
protected |
Definition at line 56 of file C4MusicSystem.h.
Referenced by Init(), Play(), and ScheduleWaitTime().
|
protected |
Definition at line 56 of file C4MusicSystem.h.
Referenced by ClearSongs(), InitForScenario(), and Load().
|
protected |
Definition at line 55 of file C4MusicSystem.h.
Referenced by ClearSongs(), Load(), Play(), ScheduleWaitTime(), and SetPlayList().
|
protected |
Definition at line 63 of file C4MusicSystem.h.
Referenced by ClearGame(), ClearSongs(), Execute(), and Play().
|
protected |
Definition at line 60 of file C4MusicSystem.h.
Referenced by Execute(), Play(), and UpdateVolume().
|
protected |
Definition at line 68 of file C4MusicSystem.h.
Referenced by Execute(), Play(), ScheduleWaitTime(), and SetPlayList().