-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include <algorithm> | ||
|
||
#include "SoundLibrary.h" | ||
#include "../Assets/ArenaSoundName.h" | ||
|
||
#include "components/debug/Debug.h" | ||
|
||
void SoundLibrary::init() | ||
{ | ||
// @todo: remove ArenaSoundName and load from SoundDefinitions.txt instead, which would allow new VOC files | ||
const char *soundFilenames[] = | ||
{ | ||
// Combat. | ||
ArenaSoundName::ArrowFire, | ||
ArenaSoundName::ArrowHit, | ||
ArenaSoundName::Bash, | ||
ArenaSoundName::BodyFall, | ||
ArenaSoundName::Clank, | ||
ArenaSoundName::EnemyHit, | ||
ArenaSoundName::FemaleDie, | ||
ArenaSoundName::MaleDie, | ||
ArenaSoundName::NHit, | ||
ArenaSoundName::PlayerHit, | ||
ArenaSoundName::Swish, | ||
|
||
// Crime. | ||
ArenaSoundName::Halt, | ||
ArenaSoundName::StopThief, | ||
|
||
// Fanfare. | ||
ArenaSoundName::Fanfare1, | ||
ArenaSoundName::Fanfare2, | ||
|
||
// Movement. | ||
ArenaSoundName::DirtLeft, | ||
ArenaSoundName::DirtRight, | ||
ArenaSoundName::MudLeft, | ||
ArenaSoundName::MudRight, | ||
ArenaSoundName::SnowLeft, | ||
ArenaSoundName::SnowRight, | ||
ArenaSoundName::Splash, | ||
ArenaSoundName::Swim, | ||
|
||
// Spells. | ||
ArenaSoundName::Burst, | ||
ArenaSoundName::Explode, | ||
ArenaSoundName::SlowBall, | ||
|
||
// Weather. | ||
ArenaSoundName::Thunder | ||
}; | ||
|
||
for (const char *filename : soundFilenames) | ||
{ | ||
this->filenames.emplace_back(std::string(filename)); | ||
} | ||
|
||
std::sort(this->filenames.begin(), this->filenames.end()); | ||
} | ||
|
||
int SoundLibrary::getFilenameCount() const | ||
{ | ||
return static_cast<int>(this->filenames.size()); | ||
} | ||
|
||
const char *SoundLibrary::getFilename(int index) const | ||
{ | ||
DebugAssertIndex(this->filenames, index); | ||
return this->filenames[index].c_str(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef SOUND_LIBRARY_H | ||
#define SOUND_LIBRARY_H | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
#include "components/utilities/Singleton.h" | ||
|
||
// Stores all sounds available from game data. | ||
class SoundLibrary : public Singleton<SoundLibrary> | ||
{ | ||
private: | ||
std::vector<std::string> filenames; | ||
public: | ||
void init(); | ||
|
||
int getFilenameCount() const; | ||
const char *getFilename(int index) const; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters