From 99e28a38756e61fc2f6ab38e18751906e9fcc995 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 26 Jul 2003 22:47:55 +0000 Subject: [PATCH] Rename RageMusic to RageSounds. --- stepmania/src/Makefile.am | 2 +- stepmania/src/RageMusic.h | 18 ----------- stepmania/src/RageSoundManager.cpp | 8 ++--- .../src/{RageMusic.cpp => RageSounds.cpp} | 26 +++++++++++----- stepmania/src/RageSounds.h | 31 +++++++++++++++++++ stepmania/src/StepMania.cpp | 6 ++-- stepmania/src/StepMania.dsp | 4 +-- stepmania/src/StepMania.vcproj | 12 +++---- 8 files changed, 66 insertions(+), 41 deletions(-) delete mode 100644 stepmania/src/RageMusic.h rename stepmania/src/{RageMusic.cpp => RageSounds.cpp} (67%) create mode 100644 stepmania/src/RageSounds.h diff --git a/stepmania/src/Makefile.am b/stepmania/src/Makefile.am index 91699bdddd..e577243328 100644 --- a/stepmania/src/Makefile.am +++ b/stepmania/src/Makefile.am @@ -55,7 +55,7 @@ RageTexture.cpp RageTexture.h RageTextureManager.cpp RageTextureManager.h RageTh RageTimer.cpp RageTimer.h RageTypes.h RageUtil_FileDB.cpp RageUtil_FileDB.h RageUtil.cpp RageUtil.h \ RageUtil_CharConversions.cpp RageUtil_CharConversions.h RageSoundReader_Preload.cpp RageSoundReader_Preload.h \ RageSoundResampler.cpp RageSoundResampler.h RageSoundReader_Resample.cpp RageSoundReader_Resample.h RageSoundReader_FileReader.h \ -RageMusic.cpp RageMusic.h +RageSounds.cpp RageSounds.h DataStructures = \ CodeDetector.cpp CodeDetector.h Course.cpp Course.h Font.cpp Font.h FontCharAliases.cpp FontCharAliases.h \ diff --git a/stepmania/src/RageMusic.h b/stepmania/src/RageMusic.h deleted file mode 100644 index 37b7c6fbfe..0000000000 --- a/stepmania/src/RageMusic.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef RAGE_MUSIC_H - -class RageSound; -class RageMusic -{ - RageSound *music; - -public: - RageMusic(); - ~RageMusic(); - - void Play(CString file, bool force_loop = false, float start_sec = -1, float length_sec = -1, float fade_len = 0); - void Stop() { Play(""); } - CString GetPath() const; -}; - -extern RageMusic *MUSIC; -#endif diff --git a/stepmania/src/RageSoundManager.cpp b/stepmania/src/RageSoundManager.cpp index c51125412e..03dae3f646 100644 --- a/stepmania/src/RageSoundManager.cpp +++ b/stepmania/src/RageSoundManager.cpp @@ -10,7 +10,7 @@ #include "RageLog.h" #include "RageTimer.h" -#include "RageMusic.h" +#include "RageSounds.h" #include "arch/arch.h" #include "arch/Sound/RageSoundDriver.h" @@ -260,16 +260,16 @@ void RageSoundManager::MixAudio(Sint16 *dst, const Sint16 *src, Uint32 len, floa void RageSoundManager::PlayMusic(CString file, bool force_loop, float start_sec, float length_sec, float fade_len) { - MUSIC->Play(file, force_loop, start_sec, length_sec, fade_len); + SOUND->PlayMusic(file, force_loop, start_sec, length_sec, fade_len); } void RageSoundManager::StopMusic() { - MUSIC->Stop(); + SOUND->StopMusic(); } CString RageSoundManager::GetMusicPath() const { - return MUSIC->GetPath(); + return SOUND->GetMusicPath(); } void RageSoundManager::SetPrefs(float MixVol) diff --git a/stepmania/src/RageMusic.cpp b/stepmania/src/RageSounds.cpp similarity index 67% rename from stepmania/src/RageMusic.cpp rename to stepmania/src/RageSounds.cpp index 1854d2e17d..e0c8fb8142 100644 --- a/stepmania/src/RageMusic.cpp +++ b/stepmania/src/RageSounds.cpp @@ -1,27 +1,29 @@ -/* This is just a simple wrapper to handle a single music track conveniently. */ #include "global.h" -#include "RageMusic.h" +#include "RageSoundManager.h" +#include "RageSounds.h" #include "RageSound.h" -RageMusic *MUSIC = NULL; +RageSounds *SOUND = NULL; -RageMusic::RageMusic() +RageSounds::RageSounds() { + /* Init RageSoundMan first: */ + ASSERT( SOUNDMAN ); music = new RageSound; } -RageMusic::~RageMusic() +RageSounds::~RageSounds() { delete music; } -CString RageMusic::GetPath() const +CString RageSounds::GetMusicPath() const { return music->GetLoadedFilePath(); } -void RageMusic::Play(CString file, bool force_loop, float start_sec, float length_sec, float fade_len) +void RageSounds::PlayMusic(CString file, bool force_loop, float start_sec, float length_sec, float fade_len) { // LOG->Trace("play '%s' (current '%s')", file.c_str(), music->GetLoadedFilePath().c_str()); if(music->IsPlaying()) @@ -58,6 +60,16 @@ void RageMusic::Play(CString file, bool force_loop, float start_sec, float lengt music->StartPlaying(); } +void RageSounds::PlayOnce( CString sPath ) +{ + SOUNDMAN->PlayOnce( sPath ); +} + +void RageSounds::PlayOnceFromDir( CString PlayOnceFromDir ) +{ + SOUNDMAN->PlayOnceFromDir( PlayOnceFromDir ); +} + /* ----------------------------------------------------------------------------- Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved. diff --git a/stepmania/src/RageSounds.h b/stepmania/src/RageSounds.h new file mode 100644 index 0000000000..a7ac03ccb1 --- /dev/null +++ b/stepmania/src/RageSounds.h @@ -0,0 +1,31 @@ +#ifndef RAGE_MUSIC_H + +/* This contains all of the generally useful user-level SOUNDMAN calls, as well + * as some other simple helper stuff. Don't include RageSoundManager for normal + * use; it's only for drivers and sound code. This file should be very lightweight. */ + */ +class RageSound; +class RageSounds +{ + RageSound *music; + +public: + RageSounds(); + ~RageSounds(); + + void PlayMusic(CString file, bool force_loop = false, float start_sec = -1, float length_sec = -1, float fade_len = 0); + void StopMusic() { PlayMusic(""); } + CString GetMusicPath() const; + + void PlayOnce( CString sPath ); + void PlayOnceFromDir( CString sDir ); +}; + +extern RageSounds *SOUND; +#endif +/* +----------------------------------------------------------------------------- + Copyright (c) 2002-2003 by the person(s) listed below. All rights reserved. + Glenn Maynard +----------------------------------------------------------------------------- +*/ diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 2a021ded13..5f429ee9cc 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -18,7 +18,7 @@ #include "RageLog.h" #include "RageTextureManager.h" #include "RageSoundManager.h" -#include "RageMusic.h" +#include "RageSounds.h" #include "RageInput.h" #include "RageTimer.h" #include "RageException.h" @@ -486,7 +486,7 @@ int main(int argc, char* argv[]) NOTESKIN = new NoteSkinManager; SOUNDMAN = new RageSoundManager(PREFSMAN->m_sSoundDrivers); SOUNDMAN->SetPrefs(PREFSMAN->m_fSoundVolume); - MUSIC = new RageMusic; + SOUND = new RageSounds; ANNOUNCER = new AnnouncerManager; INPUTFILTER = new InputFilter; INPUTMAPPER = new InputMapper; @@ -572,7 +572,7 @@ int main(int argc, char* argv[]) SAFE_DELETE( NOTESKIN ); SAFE_DELETE( THEME ); SAFE_DELETE( ANNOUNCER ); - SAFE_DELETE( MUSIC ); + SAFE_DELETE( SOUND ); SAFE_DELETE( SOUNDMAN ); SAFE_DELETE( FONT ); SAFE_DELETE( TEXTUREMAN ); diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 4290cd5885..707add090f 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -543,7 +543,7 @@ SOURCE=.\RageMath.h # End Source File # Begin Source File -SOURCE=.\RageMusic.cpp +SOURCE=.\RageSounds.cpp !IF "$(CFG)" == "StepMania - Win32 Debug" @@ -558,7 +558,7 @@ SOURCE=.\RageMusic.cpp # End Source File # Begin Source File -SOURCE=.\RageMusic.h +SOURCE=.\RageSounds.h # End Source File # Begin Source File diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 1bf48f7c49..e9864b266b 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -1527,12 +1527,6 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ - - - - @@ -1575,6 +1569,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + +