void LateUpdate() { if (sequencers != null) { foreach (MidiTrackSequencer seq in sequencers) { if (seq.Playing) { VJMidiInput.ReceiveMidiEvents(seq.Advance(Time.deltaTime)); } } Component[] cs = GetComponents <AudioSource> (); if (cs != null) { foreach (Component c in cs) { AudioSource a = c as AudioSource; a.volume = volume; _isPlaying = a.isPlaying; } } } }
void ResetAndPlay() { Component[] cs = GetComponents <AudioSource> (); foreach (Component c in cs) { AudioSource a = c as AudioSource; a.time = startTime; a.Play(); } foreach (MidiFileContainer song in songs) { for (int i = 0; i < song.tracks.Count; ++i) { MidiTrackSequencer s = new MidiTrackSequencer(song.tracks [i], song.division, bpm); List <MidiEvent> e = s.Start(startTime); if (receiveStartEvent) { VJMidiInput.ReceiveMidiEvents(e); } sequencers.Add(s); } } }