Bop Refactor + Tweaks/Fixes (#582)

* blue bear tweaks

* OnBeatPulse callback added

* Fixing humming bug in BM + Metronome fix + Some games conversion to onbeatpulse

* clappy trio to drumming practice

* rest of the games converted

* two minor changes
This commit is contained in:
Rapandrasmus
2023-11-23 17:19:39 +01:00
committed by GitHub
parent a96879db8b
commit 9c37ec4216
36 changed files with 365 additions and 374 deletions

View File

@ -76,12 +76,10 @@ namespace HeavenStudio
// Conductor is currently paused, but not fully stopped
public bool isPaused;
// Last reported beat based on song position
private double lastReportedBeat = 0f;
// Metronome tick sound enabled
public bool metronome = false;
Util.Sound metronomeSound;
private int _metronomeTally = 0;
// pitch values
private float timelinePitch = 1f;
@ -204,6 +202,7 @@ namespace HeavenStudio
songPosBeat = GetBeatFromSongPos(time);
startBeat = songPosBeat;
_metronomeTally = 0;
startTime = DateTime.Now;
absTimeAdjust = 0;
@ -363,13 +362,10 @@ namespace HeavenStudio
{
if (metronome && isPlaying)
{
if (ReportBeat(ref lastReportedBeat))
if (songPositionInBeatsAsDouble >= Math.Ceiling(startBeat) + _metronomeTally)
{
metronomeSound = Util.SoundByte.PlayOneShot("metronome", lastReportedBeat);
}
else if (songPositionInBeats < lastReportedBeat)
{
lastReportedBeat = Mathf.Round(songPositionInBeats);
metronomeSound = Util.SoundByte.PlayOneShot("metronome", Math.Ceiling(startBeat) + _metronomeTally);
_metronomeTally++;
}
}
else
@ -382,6 +378,7 @@ namespace HeavenStudio
}
}
[Obsolete("Conductor.ReportBeat is deprecated. Please use the OnBeatPulse callback instead.")]
public bool ReportBeat(ref double lastReportedBeat, double offset = 0, bool shiftBeatToOffset = true)
{
bool result = songPositionInBeats + (shiftBeatToOffset ? offset : 0f) >= (lastReportedBeat) + 1f;