Skip to content

Commit

Permalink
Fixed some silly DMX bugs and auto-formatted the file. (YARC-Official…
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFatBastid authored Mar 20, 2024
1 parent ef9e354 commit a76a095
Showing 1 changed file with 40 additions and 37 deletions.
77 changes: 40 additions & 37 deletions Assets/Script/Integration/Sacn/SacnController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ namespace YARG.Integration.Sacn
public enum CueEnum
{
NoCue = 0,
KeyframeNext = 5,
KeyframePrevious = 6,
KeyframeFirst = 7,
Menu = 10,
Score = 20,
Intro = 30,
Expand Down Expand Up @@ -90,39 +93,39 @@ private void HandleLightingTypeChange(LightingType newType)
{
_cueValue = newType switch
{
LightingType.Chorus => (byte)CueEnum.Chorus,
LightingType.Default => (byte)CueEnum.Default,
LightingType.Dischord => (byte)CueEnum.Dischord,
LightingType.Frenzy => (byte)CueEnum.Frenzy,
LightingType.Harmony => (byte)CueEnum.Harmony,
LightingType.Intro => (byte)CueEnum.Intro,
LightingType.Menu => (byte)CueEnum.Menu,
LightingType.Score => (byte)CueEnum.Score,
LightingType.Silhouettes => (byte)CueEnum.Silhouettes,
LightingType.Silhouettes_Spotlight => (byte)CueEnum.SilhouettesSpotlight,
LightingType.Sweep => (byte)CueEnum.Sweep,
LightingType.Searchlights => (byte)CueEnum.Searchlights,
LightingType.Stomp => (byte)CueEnum.Stomp,
LightingType.Verse => (byte)CueEnum.Verse,
LightingType.Blackout_Fast => (byte)CueEnum.BlackoutFast,
LightingType.Blackout_Slow => (byte)CueEnum.BlackoutSlow,
LightingType.Blackout_Spotlight => (byte)CueEnum.BlackoutSpotlight,
LightingType.Cool_Automatic => (byte)CueEnum.CoolLoop,
LightingType.Cool_Manual => (byte)CueEnum.CoolManual,
LightingType.Flare_Fast => (byte)CueEnum.FlareFast,
LightingType.Flare_Slow => (byte)CueEnum.FlareSlow,
LightingType.Keyframe_First => (byte)CueEnum.Default,
LightingType.Keyframe_Next => (byte)CueEnum.Default,
LightingType.Keyframe_Previous => (byte)CueEnum.Default,
LightingType.Strobe_Fast => (byte)CueEnum.StrobeFast,
LightingType.Strobe_Fastest => (byte)CueEnum.StrobeFastest,
LightingType.Strobe_Medium => (byte)CueEnum.StrobeMedium,
LightingType.Strobe_Off => (byte)CueEnum.StrobeOff,
LightingType.Strobe_Slow => (byte)CueEnum.StrobeSlow,
LightingType.Warm_Automatic => (byte)CueEnum.WarmLoop,
LightingType.Warm_Manual => (byte)CueEnum.WarmManual,
LightingType.BigRockEnding => (byte)CueEnum.BigRockEnding,
_ => (byte)CueEnum.NoCue,
LightingType.Chorus => (byte) CueEnum.Chorus,
LightingType.Default => (byte) CueEnum.Default,
LightingType.Dischord => (byte) CueEnum.Dischord,
LightingType.Frenzy => (byte) CueEnum.Frenzy,
LightingType.Harmony => (byte) CueEnum.Harmony,
LightingType.Intro => (byte) CueEnum.Intro,
LightingType.Menu => (byte) CueEnum.Menu,
LightingType.Score => (byte) CueEnum.Score,
LightingType.Silhouettes => (byte) CueEnum.Silhouettes,
LightingType.Silhouettes_Spotlight => (byte) CueEnum.SilhouettesSpotlight,
LightingType.Sweep => (byte) CueEnum.Sweep,
LightingType.Searchlights => (byte) CueEnum.Searchlights,
LightingType.Stomp => (byte) CueEnum.Stomp,
LightingType.Verse => (byte) CueEnum.Verse,
LightingType.Blackout_Fast => (byte) CueEnum.BlackoutFast,
LightingType.Blackout_Slow => (byte) CueEnum.BlackoutSlow,
LightingType.Blackout_Spotlight => (byte) CueEnum.BlackoutSpotlight,
LightingType.Cool_Automatic => (byte) CueEnum.CoolLoop,
LightingType.Cool_Manual => (byte) CueEnum.CoolManual,
LightingType.Flare_Fast => (byte) CueEnum.FlareFast,
LightingType.Flare_Slow => (byte) CueEnum.FlareSlow,
LightingType.Keyframe_First => (byte) CueEnum.KeyframeFirst,
LightingType.Keyframe_Next => (byte) CueEnum.KeyframeNext,
LightingType.Keyframe_Previous => (byte) CueEnum.KeyframePrevious,
LightingType.Strobe_Fast => (byte) CueEnum.StrobeFast,
LightingType.Strobe_Fastest => (byte) CueEnum.StrobeFastest,
LightingType.Strobe_Medium => (byte) CueEnum.StrobeMedium,
LightingType.Strobe_Off => (byte) CueEnum.StrobeOff,
LightingType.Strobe_Slow => (byte) CueEnum.StrobeSlow,
LightingType.Warm_Automatic => (byte) CueEnum.WarmLoop,
LightingType.Warm_Manual => (byte) CueEnum.WarmManual,
LightingType.BigRockEnding => (byte) CueEnum.BigRockEnding,
_ => (byte) CueEnum.NoCue,
};

_dataPacket[_cueChangeChannel - 1] = _cueValue;
Expand All @@ -135,7 +138,7 @@ private void HandleStageEffectChange(StageEffect newEffect)
StageEffect.FogOn => (byte) CueEnum.FogOn,
StageEffect.FogOff => (byte) CueEnum.FogOff,
StageEffect.BonusFx => (byte) CueEnum.BonusEffect,
_ => (byte)CueEnum.NoCue,
_ => (byte) CueEnum.NoCue,
};

_dataPacket[_cueChangeChannel - 1] = _cueValue;
Expand Down Expand Up @@ -165,11 +168,11 @@ private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
break;

case (int) SceneIndex.Score:
_cueValue = (byte)CueEnum.Score;
HandleLightingTypeChange(LightingType.Score);
break;

case (int) SceneIndex.Menu:
_cueValue = (byte)CueEnum.Menu;
HandleLightingTypeChange(LightingType.Menu);
break;

default:
Expand Down Expand Up @@ -267,7 +270,7 @@ private void HandleStrobeEvent(StageKitStrobeSpeed value)
StageKitStrobeSpeed.Medium => 127,
StageKitStrobeSpeed.Fast => 191,
StageKitStrobeSpeed.Fastest => 255,
_ => throw new Exception("Unreachable.")
_ => throw new Exception("Unreachable.")
};
}

Expand Down

0 comments on commit a76a095

Please sign in to comment.