public void Step(float tickSpeed, int stepIndex, PureDataSequence sequence) { PureDataSequenceTrackStep trackStep = steps[stepIndex]; if (trackStep.patternIndex == -1) { pureData.communicator.SendBang(string.Format("utrack_pattern{0}_{1}", sequence.Id, Id)); } else { PureDataSequencePattern pattern = patterns[trackStep.patternIndex]; pureData.communicator.Send(string.Format("utrack_size{0}_{1}", sequence.Id, Id), pattern.sendSize); pureData.communicator.Send(string.Format("utrack_delay{0}_{1}", sequence.Id, Id), tickSpeed * 1000 / pattern.subdivision); pureData.communicator.Send(string.Format("utrack_pattern{0}_{1}", sequence.Id, Id), pattern.GetPattern()); } }
void ShowTrack() { trackStepsProperty = currentTrackProperty.FindPropertyRelative("steps"); // Track Rect rect = EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(" "); EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel += 1; rect = EditorGUI.IndentedRect(rect); EditorGUI.indentLevel -= 1; // Reorder Handles EditorGUI.BeginDisabledGroup(Application.isPlaying); Rect handleRect = new Rect(rect.x - 12, rect.y + 10, 12, -3); Reorderable(tracksProperty, currentTrackIndex, true, new Rect(handleRect.x - 3, handleRect.y - 11, handleRect.width + 3, Mathf.Abs(handleRect.height) + 15), OnTrackReorder); GUI.Label(handleRect, "", new GUIStyle("ColorPickerHorizThumb")); EditorGUI.EndDisabledGroup(); // Track Name rect.width = 72; rect.height = 16; if (GUI.Button(rect, currentTrack.Name, GetTrackStyle())) { currentSequenceSelection.SetTrack(currentTrackIndex); } // Grid Lines GUI.Box(new Rect(rect.x + 72, rect.y - 1, stepsProperty.arraySize * 18 - 1, 18), "", new GUIStyle("ColorPickerBox")); GUI.Box(new Rect(rect.x, rect.y - 1, 72, 18), "", new GUIStyle(currentTrack == currentSequenceSelection.Track ? "TL SelectionButton PreDropGlow" : "ColorPickerBox")); // Track Steps rect.x += rect.width; rect.width = 16; for (int i = 0; i < trackStepsProperty.arraySize; i++) { currentTrackStep = currentTrack.steps[i]; if (GUI.Button(rect, GetSequencePatternName(currentTrackStep.patternIndex), GetTrackStepStyle(i))) { currentSequenceSelection.SetStep(i); currentSequenceSelection.SetTrack(currentTrackIndex); } rect.x += rect.width + 2; } }