Skip to content

Commit

Permalink
Fix chart sample loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Drewol committed Apr 24, 2019
1 parent b319f60 commit 190c471
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
6 changes: 5 additions & 1 deletion Main/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,11 @@ Sample Application::LoadSample(const String& name, const bool& external)
if(external)
path = name;
else
path = String("skins/") + m_skin + String("/audio/") + name + ".wav";
path = String("skins/") + m_skin + String("/audio/") + name;

String ext = Path::GetExtension(path);
if (ext.empty())
path += ".wav";

Sample ret = g_audio->CreateSample(Path::Normalize(path));
assert(ret);
Expand Down
16 changes: 11 additions & 5 deletions Main/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,19 +869,25 @@ class Game_Impl : public Game
CheckedLoad(m_clickSamples[0] = g_application->LoadSample("click-01"));
CheckedLoad(m_clickSamples[1] = g_application->LoadSample("click-02"));

Vector<String> default_sfx = {
"clap",
"clap_impact",
"clap_punchy",
"snare",
"snare_lo",
};

auto samples = m_beatmap->GetSamplePaths();
m_fxSamples = new Sample[samples.size()];
for (int i = 0; i < samples.size(); i++)
{
String ext = samples[i].substr(samples[i].length() - 4, 4);
ext.ToUpper();
if (ext == ".WAV")
if (default_sfx.Contains(samples[i]))
{
CheckedLoad(m_fxSamples[i] = g_application->LoadSample(m_mapRootPath + "/" + samples[i], true));
CheckedLoad(m_fxSamples[i] = g_application->LoadSample(samples[i]));
}
else
{
CheckedLoad(m_fxSamples[i] = g_application->LoadSample(samples[i]));
CheckedLoad(m_fxSamples[i] = g_application->LoadSample(m_mapRootPath + "/" + samples[i], true));
}

}
Expand Down
Binary file added bin/skins/Default/audio/clap_impact.wav
Binary file not shown.
Binary file added bin/skins/Default/audio/clap_punchy.wav
Binary file not shown.

0 comments on commit 190c471

Please sign in to comment.