diff --git a/UnityProject/Assembly-CSharp.csproj b/UnityProject/Assembly-CSharp.csproj
index 5c2b8ee..8a10f9a 100644
--- a/UnityProject/Assembly-CSharp.csproj
+++ b/UnityProject/Assembly-CSharp.csproj
@@ -105,13 +105,13 @@
+
-
diff --git a/UnityProject/Assets/Scenes/Examples/Qlist/scripts/TimelineController.cs b/UnityProject/Assets/Scenes/Examples/Qlist/scripts/TimelineController.cs
index f111a5a..efc5bd1 100644
--- a/UnityProject/Assets/Scenes/Examples/Qlist/scripts/TimelineController.cs
+++ b/UnityProject/Assets/Scenes/Examples/Qlist/scripts/TimelineController.cs
@@ -10,7 +10,7 @@ namespace cylvester
[SerializeField] private PlayableDirector playableDirector;
[SerializeField] private StateManager stateManager;
- [SerializeField] private float initTransitionFactor = 8f;
+ [SerializeField] private float initTransitionFactor = 1f;
private IList qlistMarkers_;
@@ -48,10 +48,15 @@ namespace cylvester
return;
var nextState = stateManager.NextState.Value;
- if (notification.id == nextState.Title)
+ var prevState = stateManager.PreviousState.Value; //ToDO this is the same as nextState???
+
+ Debug.Log("next State " + prevState.Title);
+ Debug.Log("prev State " + prevState.Title);
+
+ if (notification.id == nextState.Title || notification.id == prevState.Title)
{
playableDirector.Pause(); // reaches the next state (marker) in timeline
- playableDirector.playableGraph.GetRootPlayable(0).SetSpeed(initTransitionFactor);
+ playableDirector.playableGraph.GetRootPlayable(0).SetSpeed(initTransitionFactor); // Max added this instead of .Stop
}
}
}
diff --git a/UnityProject/Assets/Scripts/PdConnection/MidiTransitionController.cs b/UnityProject/Assets/Scripts/PdConnection/CylMidiTransitionController.cs
similarity index 62%
rename from UnityProject/Assets/Scripts/PdConnection/MidiTransitionController.cs
rename to UnityProject/Assets/Scripts/PdConnection/CylMidiTransitionController.cs
index 98388e5..0870bb2 100644
--- a/UnityProject/Assets/Scripts/PdConnection/MidiTransitionController.cs
+++ b/UnityProject/Assets/Scripts/PdConnection/CylMidiTransitionController.cs
@@ -5,25 +5,33 @@ using UnityEngine.Playables;
namespace cylvester
{
-
+
public enum CYL_Command
- {
- OneBarLoopButton = 86,
- FourBarLoopButton = 94,
+ {
+ //these are the midi CCs coming from the CYL_Axoloti box
+ OneBarLoopButton = 94,
+ FourBarLoopButton = 86,
NextScelectedScene = 18,
CurrentSelectedScene = 17,
- instaTrig = 2
+ instaTrig = 2,
}
- public class MidiTransitionController : MonoBehaviour
+ public enum Timeline_Command
+ {
+ Forwards = 1,
+ Backwards = -1
+ }
+
+ public class CylMidiTransitionController : MonoBehaviour
{
[SerializeField] private PlayableDirector playableDirector;
[SerializeField, Range(1, 16)] private int channel = 1;
[SerializeField] StateManager stateManager;
+ [SerializeField] float instaTransitionSpeed = 10;
- private const int oneBarLoopLength = 96;
- private const int fourBarLoopLength = 384;
+ private const int oneBarTrigger = 96;
+ private const int fourBarTrigger = 384;
private bool instaChangeActive;
@@ -58,23 +66,32 @@ namespace cylvester
case (byte) CYL_Command.CurrentSelectedScene:
currentSelectedScene = mes.Data2; //Get current selected Scene
- if (instaChangeActive)
+ if (instaChangeActive) //This triggers instant Switch between states
{
stateManager.SelectedState = currentSelectedScene;
- playableDirector.playableGraph.GetRootPlayable(0).SetSpeed(10);
+ playableDirector.playableGraph.GetRootPlayable(0).SetSpeed(instaTransitionSpeed);
instaChangeActive = false;
}
break;
case (byte) CYL_Command.FourBarLoopButton:
- RestTime(fourBarLoopLength - currentTick % fourBarLoopLength);
- TimelinePlaybackSpeed();
+ if (nextSelectedScene > currentSelectedScene)
+ {
+ RestTime(fourBarTrigger - currentTick % fourBarTrigger);
+ TimelinePlaybackSpeed((int) Timeline_Command.Forwards);
stateManager.SelectedState = nextSelectedScene;
- break;
+ }
+ else
+ {
+ RestTime(fourBarTrigger - currentTick % fourBarTrigger);
+ TimelinePlaybackSpeed((int)Timeline_Command.Backwards);
+ stateManager.SelectedState = nextSelectedScene + 2;
+ }
+ break;
case (byte) CYL_Command.OneBarLoopButton:
- RestTime(oneBarLoopLength - currentTick % oneBarLoopLength);
- TimelinePlaybackSpeed();
+ RestTime(oneBarTrigger - currentTick % oneBarTrigger);
+ TimelinePlaybackSpeed((int) Timeline_Command.Forwards);
stateManager.SelectedState = nextSelectedScene;
break;
}
@@ -86,10 +103,10 @@ namespace cylvester
restTimeS = restTick / 24.0f / stateManager.CurrentState.Bpm * 60;
}
- public void TimelinePlaybackSpeed()
+ public void TimelinePlaybackSpeed(int direction)
{
float timelinePlaybackSpeed = transitionLength / Mathf.Clamp(restTimeS, 0.001f, transitionLength);
- playableDirector.playableGraph.GetRootPlayable(0).SetSpeed(timelinePlaybackSpeed); //set playbackspeed of Timeline
+ playableDirector.playableGraph.GetRootPlayable(0).SetSpeed(timelinePlaybackSpeed * direction); //set playbackspeed of Timeline
}
}
}
\ No newline at end of file
diff --git a/UnityProject/Assets/Scripts/PdConnection/MidiTransitionController.cs.meta b/UnityProject/Assets/Scripts/PdConnection/CylMidiTransitionController.cs.meta
similarity index 100%
rename from UnityProject/Assets/Scripts/PdConnection/MidiTransitionController.cs.meta
rename to UnityProject/Assets/Scripts/PdConnection/CylMidiTransitionController.cs.meta