mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 21:47:39 +02:00
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:
@ -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;
|
||||
|
Reference in New Issue
Block a user