Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set any 0 bpm segments to the previous segment's bpm #1296

Merged
merged 15 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/Etterna/Models/Misc/TimingData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1409,8 +1409,6 @@ TimingData::BuildAndGetEtaner(const std::vector<int>& nerv)
event_row = bpms[i]->GetRow();
time_to_next_event = NoteRowToBeat(event_row - lastbpmrow) / bps;
const auto next_event_time = last_time + time_to_next_event;
if (bps <= 0)
Locator::getLogger()->fatal("Found {} bps in file {} - Very likely to crash.", bps, m_sFile);
while (idx < nerv.size() && nerv[idx] <= event_row) {
const auto perc = static_cast<float>(nerv[idx] - lastbpmrow) /
static_cast<float>(event_row - lastbpmrow);
Expand Down
7 changes: 4 additions & 3 deletions src/Etterna/Models/NoteLoaders/NotesLoaderSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,9 @@ SMLoader::ParseBPMs(std::vector<pair<float, float>>& out,
const auto fBeat = RowToBeat(arrayBPMChangeValues[0], rowsPerBeat);
const auto fNewBPM = StringToFloat(arrayBPMChangeValues[1]);
if (fNewBPM == 0) {
// LOG->UserLog(
// "Song file", this->GetSongTitle(), "has a zero BPM; ignored.");
// continue;
Locator::getLogger()->error("Song file \"{}\" has a zero BPM. Ignored",
this->GetChartPath());
continue;
}

out.emplace_back(std::make_pair(fBeat, fNewBPM));
Expand Down Expand Up @@ -1163,6 +1163,7 @@ SMLoader::LoadFromSimfile(const std::string& sPath, Song& out, bool bFromCache)

out.m_SongTiming.m_sFile = sPath;
out.m_sSongFileName = sPath;
this->chartPath = sPath;

SMSongTagInfo reused_song_info(&*this, &out, sPath);

Expand Down
7 changes: 7 additions & 0 deletions src/Etterna/Models/NoteLoaders/NotesLoaderSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ struct SMLoader
* @return the file extension. */
std::string GetFileExtension() const { return fileExt; }

/**
* @brief Get the chart path.
* @return the chart path. */
std::string GetChartPath() const { return chartPath; }

public:
// SetSongTitle and GetSongTitle changed to public to allow the functions
// used by the parser helper to access them. -Kyz
Expand All @@ -241,6 +246,8 @@ struct SMLoader
const std::string fileExt;
/** @brief The song title that is being processed. */
std::string songTitle;
/** @brief The path of the chart that is being processed. */
std::string chartPath;
};

#endif
Loading