// Start is called before the first frame update void Start() { metronome.OnTick += Tick; navigationPart = new MarkovNavigation(song.transitions); defaultSource = GetComponent <AudioSource>(); /* * // debug mode * // Creates a crappy song to test transitions * song = new Song(); * int n = clip.Length; * //song.channels = new SongChannel[n]; * song.transitions = new Graph2(n); * song.transitions.origin = new Graph2.Links[n]; * for (int s = 0; s < n; ++s) * { * song.transitions.origin[s] = new Graph2.Links(); * song.transitions.origin[s].probabilities = new float[n]; * for (int s2 = 0; s2 < n; ++s2) * { * song.transitions.origin[s].probabilities[s2] = Random.value; * } * } * currentRowIdx = song.transitions.entry; */ }
void ResetPartProgress() { partBeat = 0; currentPart = song.parts[navigationPart.current]; navigationChannel = new MarkovNavigation[currentPart.channels.Length]; channelBeat = new int[currentPart.channels.Length]; for (int c = 0; c < currentPart.channels.Length; ++c) { navigationChannel[c] = new MarkovNavigation(currentPart.channels[c].transitions); channelBeat[c] = 0; } if (currentPart.mixerSnapshot != null) { currentPart.mixerSnapshot.TransitionTo(0); } }