Skip to content

Commit

Permalink
Enable support for mp3 sounds and music with mp3 file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmitti committed May 8, 2022
1 parent c24241f commit 253ac52
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/C4Components.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
#define C4CFN_PlayerFiles "*.c4p"
#define C4CFN_MaterialFiles "*.c4m"
#define C4CFN_ObjectInfoFiles "*.c4i"
#define C4CFN_SoundFiles "*.wav|*.ogg"
#define C4CFN_SoundFiles "*.wav|*.ogg|*.mp3"
#define C4CFN_PNGFiles "*.png"
#define C4CFN_BitmapFiles "*.bmp"
#define C4CFN_ScenarioFiles "*.c4s"
Expand Down
3 changes: 2 additions & 1 deletion src/C4Control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,8 @@ void C4ControlMessage::Execute() const
{
if (client->isMuted()
|| StartSoundEffect(szMessage, false, 100, nullptr)
|| StartSoundEffect((szMessage + std::string{".ogg"}).c_str(), false, 100, nullptr))
|| StartSoundEffect((szMessage + std::string{".ogg"}).c_str(), false, 100, nullptr)
|| StartSoundEffect((szMessage + std::string{".mp3"}).c_str(), false, 100, nullptr))
{
if (pLobby) pLobby->OnClientSound(Game.Clients.getClientByID(iByClient));
}
Expand Down
2 changes: 1 addition & 1 deletion src/C4SoundSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void C4SoundSystem::LoadEffects(C4Group &group)
if (!Application.AudioSystem) return;

// Process segmented list of file types
for (const auto fileType : { "*.wav", "*.ogg" })
for (const auto fileType : { "*.wav", "*.ogg", "*.mp3" })
{
char filename[_MAX_FNAME + 1];
// Search all sound files in group
Expand Down

0 comments on commit 253ac52

Please sign in to comment.