Integration of Jukebox Library (#451) (#457)

* add Jukebox library

todo:
- saving / loading of new format
- inferrence of unknown data like past versions
- move the temporary float casts to proper use of double
- make sound related functions take double for timing
- inform people that the Jukebox sound player was renamed to SoundByte lol

* make sound, input scheduling, and super curve use double precision

* successfully load charts

* editor works again

v1 riqs can be saved and loaded

* first tempo and volume markers are unmovable

fix loading of charts' easing values

* use gsync / freesync

* update Jukebox refs to SoundByte

* game events use double part 1

Air Rally - Glee Club converted

* don't load song if chart load fails

* finish conversion of all minigames

* remove editor waveform toggle

* timeline now respects added song offset length

clear cache files on app close
prepped notes for dsp sync

* update timeline length when offset changed

* update to latest Jukebox

* make error panel object in global game manager

* improve conductor music scheduling

* added error message box

fix first game events sometimes not playing
This commit is contained in:
minenice55
2023-06-10 15:17:06 -04:00
committed by GitHub
parent b7afd697ce
commit b1fab52ad9
176 changed files with 4868 additions and 3013 deletions

View File

@ -113,7 +113,7 @@ namespace HeavenStudio.Games
[SerializeField] private Student student;
[SerializeField] private GameObject djYellow;
private Animator djYellowAnim;
private float lastReportedBeat = 0f;
private double lastReportedBeat = 0f;
public DJYellow djYellowScript;
[Header("Properties")]
@ -121,10 +121,10 @@ namespace HeavenStudio.Games
public bool djYellowHolding;
public bool andStop;
public bool goBop;
public float beatOfInstance;
public double beatOfInstance;
private bool djYellowBopLeft;
public bool shouldBeHolding = false;
public float smileBeat = -10f;
public double smileBeat = double.MinValue;
public static DJSchool instance { get; private set; }
@ -138,26 +138,26 @@ namespace HeavenStudio.Games
}
//For inactive game purposes
static float wantBreak = Single.MinValue;
static float wantAndStop = Single.MinValue;
static float wantDJVoiceLines = Single.MinValue;
static double wantBreak = double.MinValue;
static double wantAndStop = double.MinValue;
static double wantDJVoiceLines = double.MinValue;
public override void OnGameSwitch(float beat)
public override void OnGameSwitch(double beat)
{
if (wantBreak != Single.MinValue)
if (wantBreak != double.MinValue)
{
BreakCmon(wantBreak, 0, false, false);
wantBreak = Single.MinValue;
wantBreak = double.MinValue;
}
else if(wantAndStop != Single.MinValue)
else if(wantAndStop != double.MinValue)
{
AndStop(wantAndStop, false, false);
wantAndStop = Single.MinValue;
wantAndStop = double.MinValue;
}
else if(wantDJVoiceLines != Single.MinValue)
else if(wantDJVoiceLines != double.MinValue)
{
VoiceLines(wantDJVoiceLines, 0);
wantDJVoiceLines = Single.MinValue;
wantDJVoiceLines = double.MinValue;
}
}
@ -168,7 +168,7 @@ namespace HeavenStudio.Games
//if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
//{
// if (cond.songPositionInBeats >= bop.startBeat && cond.songPositionInBeats < bop.startBeat + bop.length)
// if (cond.songPositionInBeatsAsDouble >= bop.startBeat && cond.songPositionInBeatsAsDouble < bop.startBeat + bop.length)
// {
// if (student.anim.IsAnimationNotPlaying())
// {
@ -245,9 +245,9 @@ namespace HeavenStudio.Games
}
}
else if (Conductor.instance.songPositionInBeats < lastReportedBeat)
else if (Conductor.instance.songPositionInBeatsAsDouble < lastReportedBeat)
{
lastReportedBeat = Mathf.Round(Conductor.instance.songPositionInBeats);
lastReportedBeat = Math.Round(Conductor.instance.songPositionInBeatsAsDouble);
}
if(PlayerInput.Pressed() && !IsExpectingInputNow() && !student.isHolding) //Start hold miss
@ -287,7 +287,7 @@ namespace HeavenStudio.Games
shouldBeHolding = true;
}
public void Bop(float beat, float length, bool isBopping, bool autoBop)
public void Bop(double beat, float length, bool isBopping, bool autoBop)
{
goBop = autoBop;
if (isBopping)
@ -314,7 +314,7 @@ namespace HeavenStudio.Games
}
if (!andStop && !djYellowHolding)
{
float normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f);
double normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f);
if (normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.Happy);
else if (!djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed)) djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.NeutralLeft);
djYellowScript.Reverse((normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f) || djYellowScript.HeadSpriteCheck(DJYellow.DJExpression.CrossEyed));
@ -339,7 +339,7 @@ namespace HeavenStudio.Games
}
}
public void BreakCmon(float beat, int type, bool ooh, bool doSound = true)
public void BreakCmon(double beat, int type, bool ooh, bool doSound = true)
{
if (djYellowHolding) return;
@ -404,7 +404,7 @@ namespace HeavenStudio.Games
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, student.OnHitHold, student.OnMissHold, student.OnEmpty);
}
public void AndStop(float beat, bool ooh, bool doSound = true)
public void AndStop(double beat, bool ooh, bool doSound = true)
{
if (djYellowHolding) return;
@ -427,7 +427,7 @@ namespace HeavenStudio.Games
new BeatAction.Action(beat + 0.5f, delegate
{
djYellow.GetComponent<Animator>().DoScaledAnimationAsync("BreakCmon", 0.5f);
float normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f);
double normalizedSmileBeat = Conductor.instance.GetPositionFromBeat(smileBeat, 3f);
if (normalizedSmileBeat >= 0 && normalizedSmileBeat <= 1f)
{
djYellowScript.ChangeHeadSprite(DJYellow.DJExpression.Happy);
@ -450,7 +450,7 @@ namespace HeavenStudio.Games
ScheduleInput(beat, 1.5f, InputType.STANDARD_DOWN, student.OnHitHold, student.OnMissHold, student.OnEmpty);
}
public void ScratchoHey(float beat, int type, bool remix4, bool cheer)
public void ScratchoHey(double beat, int type, bool remix4, bool cheer)
{
string[] sounds = new string[] { };
@ -539,7 +539,7 @@ namespace HeavenStudio.Games
{
Student.soundFX = toggle;
}
public static void VoiceLines(float beat, int type)
public static void VoiceLines(double beat, int type)
{
string[] sounds;
var sound = new MultiSound.Sound[] { };
@ -592,18 +592,19 @@ namespace HeavenStudio.Games
break;
case 4:
Jukebox.PlayOneShotGame("djSchool/yay", forcePlay: true);
SoundByte.PlayOneShotGame("djSchool/yay", forcePlay: true);
break;
}
}
#region Inactive Game Commands
public static void WarnBreakCmon(float beat, int type, bool ooh)
public static void WarnBreakCmon(double beat, int type, bool ooh)
{
string[] sounds = type switch {
0 => new string[] { "djSchool/breakCmon1", "djSchool/breakCmon2", "djSchool/ooh" },
1 => new string[] { "djSchool/breakCmonAlt1", "djSchool/breakCmonAlt2", "djSchool/oohAlt" },
2 => new string[] { "djSchool/breakCmonLoud1", "djSchool/breakCmonLoud2", "djSchool/oohLoud" },
_ => new string[] { "djSchool/breakCmon1", "djSchool/breakCmon2", "djSchool/ooh" },
};
List<MultiSound.Sound> sound = new List<MultiSound.Sound>()
@ -618,7 +619,7 @@ namespace HeavenStudio.Games
wantBreak = beat;
}
public static void WarnAndStop(float beat, bool ooh)
public static void WarnAndStop(double beat, bool ooh)
{
List<MultiSound.Sound> sound = new List<MultiSound.Sound>()
{

View File

@ -107,7 +107,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
missed = false;
shouldBeHolding = true;
Jukebox.PlayOneShotGame("djSchool/recordStop");
SoundByte.PlayOneShotGame("djSchool/recordStop");
anim.DoScaledAnimationAsync("Hold", 0.5f);
tableAnim.DoScaledAnimationAsync("Student_Turntable_StartHold", 0.5f);
@ -124,7 +124,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
//isHolding = true;
if (canBoo)
{
Sound booSound = Jukebox.PlayOneShotGame("djSchool/boo", -1, 1, 0.8f);
Sound booSound = SoundByte.PlayOneShotGame("djSchool/boo", -1, 1, 0.8f);
CancelInvoke();
canBoo = false;
Invoke("EnableBoo", booSound.clip.length);
@ -145,7 +145,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
missed = true;
Jukebox.PlayOneShotGame("djSchool/recordStop");
SoundByte.PlayOneShotGame("djSchool/recordStop");
anim.DoScaledAnimationAsync("Hold", 0.5f);
tableAnim.DoScaledAnimationAsync("Student_Turntable_StartHold", 0.5f);
@ -170,7 +170,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
anim.DoScaledAnimationAsync("Unhold", 0.5f);
if (canBoo)
{
Sound booSound = Jukebox.PlayOneShotGame("djSchool/boo", -1, 1, 0.8f);
Sound booSound = SoundByte.PlayOneShotGame("djSchool/boo", -1, 1, 0.8f);
CancelInvoke();
canBoo = false;
Invoke("EnableBoo", booSound.clip.length);
@ -190,7 +190,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
public void OnHitSwipeCheer(PlayerActionEvent caller, float beat)
{
OnHitSwipe(caller, beat);
Jukebox.PlayOneShotGame("djSchool/cheer", caller.timer + caller.startBeat + 1f, 1, 0.8f);
SoundByte.PlayOneShotGame("djSchool/cheer", caller.timer + caller.startBeat + 1f, 1, 0.8f);
}
public void OnHitSwipe(PlayerActionEvent caller, float beat)
{
@ -202,7 +202,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
missed = false;
shouldBeHolding = false;
Jukebox.PlayOneShotGame("djSchool/recordSwipe");
SoundByte.PlayOneShotGame("djSchool/recordSwipe");
FlashFX(false);
swiping = true;
@ -225,7 +225,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
else
{
OnMissSwipeForPlayerInput(caller.timer + caller.startBeat + 1f);
Jukebox.PlayOneShotGame("djSchool/recordSwipe");
SoundByte.PlayOneShotGame("djSchool/recordSwipe");
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { anim.Play("Swipe", 0, 0); }),
@ -249,7 +249,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f);
if (canBoo)
{
Sound booSound = Jukebox.PlayOneShotGame("djSchool/boo", caller.timer + caller.startBeat + 1f, 1, 0.8f);
Sound booSound = SoundByte.PlayOneShotGame("djSchool/boo", caller.timer + caller.startBeat + 1f, 1, 0.8f);
CancelInvoke();
canBoo = false;
Invoke("EnableBoo", booSound.clip.length);
@ -268,7 +268,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
});
}
public void OnMissSwipeForPlayerInput(float beat)
public void OnMissSwipeForPlayerInput(double beat)
{
isHolding = false;