Skip to content

Commit

Permalink
Little fix for GH inharmonic vocals
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteAsian123 committed Apr 4, 2023
1 parent cd2b29a commit 2028521
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 14 additions & 6 deletions Assets/Script/Serialization/Parser/MidiParser.Vocals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,18 @@ private List<LyricInfo> ParseRealLyrics(List<EventIR> eventIR, TrackChunk trackC
continue;
}

// Get end time
var (endTime, noteName, octave) = GetLyricInfo(trackChunk, totalDelta);
bool inharmonic = false;

// Get lyric information
var lyricInfo = GetLyricInfo(trackChunk, totalDelta);
long endTime = totalDelta + 80;
NoteName noteName = NoteName.C;
int octave = 3;
if (!lyricInfo.HasValue) {
inharmonic = true;
} else {
(endTime, noteName, octave) = lyricInfo.Value;
}

// Convert to seconds
var lyricTime = (float) TimeConverter.ConvertTo<MetricTimeSpan>(totalDelta, tempo).TotalSeconds;
Expand Down Expand Up @@ -165,8 +175,6 @@ private List<LyricInfo> ParseRealLyrics(List<EventIR> eventIR, TrackChunk trackC
continue;
}

bool inharmonic = false;

// Set inharmonic
if (l.EndsWith("#") || l.EndsWith("^") || l.EndsWith("*")) {
inharmonic = true;
Expand Down Expand Up @@ -216,7 +224,7 @@ private List<LyricInfo> ParseRealLyrics(List<EventIR> eventIR, TrackChunk trackC
return lyrics;
}

private (long endTime, NoteName note, int octave) GetLyricInfo(TrackChunk trackChunk, long tick) {
private (long endTime, NoteName note, int octave)? GetLyricInfo(TrackChunk trackChunk, long tick) {
foreach (var note in trackChunk.GetNotes()) {
// Skip meta-data notes
if (note.Octave >= 7) {
Expand All @@ -231,7 +239,7 @@ private List<LyricInfo> ParseRealLyrics(List<EventIR> eventIR, TrackChunk trackC
return (note.EndTime, note.NoteName, note.Octave);
}

return (tick, NoteName.C, 3);
return null;
}
}
}
2 changes: 2 additions & 0 deletions Assets/Script/Util/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ public static string SourceToGameName(string source) {
"ghwt" or "ghwtdlc" => "Guitar Hero World Tour",
"ghm" => "Guitar Hero Metallica",
"ghwor" or "ghwordlc" => "Guitar Hero: Warriors of Rock",
"ghvh" => "Guitar Hero: Van Halen",

"rb1" or "rb1dlc" => "Rock Band 1",
"rb2" or "rb2dlc" => "Rock Band 2",
"rb3" or "rb3dlc" => "Rock Band 3",
"rb4" or "rb4dlc" => "Rock Band 4",
"tbrb" or "tbrbdlc" => "The Beatles Rock Band",
"rbacdc" => "Rock Band AC/DC",
"gdrb" => "Green Day Rock Band",
Expand Down

0 comments on commit 2028521

Please sign in to comment.