IEnumerator AddMidiEventWithTimeBoundaries(MidiEvent e, float startSeconds, float endSeconds) { yield return new WaitForSeconds(startSeconds); mevent = e; endValidTime = Time.time + (endSeconds - startSeconds); }
void HandleMidiEvent(MidiEvent e) { if (outputEnabled) { MidiEventListener[] listeners = FindObjectsOfType<MidiEventListener> (); foreach (MidiEventListener l in listeners) { if (l.RespondsToMidiEvent (e, this)) l.HandleMidiEvent (e, lookaheadSeconds, this); } } }
IEnumerator UpdateColorForMidiEventWithDelay(MidiEvent e, float lookahead, MIDICounter source) { yield return new WaitForSeconds (lookahead); SynchronizedMIDISwapper swapper = GameObject.Find ("MidiManager").GetComponent<SynchronizedMIDISwapper> (); if (swapper.ActiveMIDICounter () == source) { SongData.BeatType beatType = SongData.BeatType.None; if (e.data1 == onBeatNote) beatType = SongData.BeatType.OnBeat; else if (e.data1 == offBeatNote) beatType = SongData.BeatType.OffBeat; else if (e.data1 == syncoBeatNote) beatType = SongData.BeatType.SyncoBeat; Color c = ShipViewModel.ColorForBeatType (beatType); gameObject.GetComponent<SpriteRenderer> ().material.color = c; } }
public override bool RespondsToMidiEvent(MidiEvent e, MIDICounter source) { return e.status == 144; }
public override void HandleMidiEvent(MidiEvent e, float lookaheadSeconds, MIDICounter source) { StartCoroutine(UpdateColorForMidiEventWithDelay (e, lookaheadSeconds, source)); }
public DeltaEventPair(int delta, MidiEvent midiEvent) { this.delta = delta; this.midiEvent = midiEvent; }
public void AddEvent(int delta, MidiEvent midiEvent) { sequence.Add (new DeltaEventPair (delta, midiEvent)); }
public void AddEvent(int delta, MidiEvent midiEvent) { sequence.Add(new DeltaEventPair(delta, midiEvent)); }
public abstract bool RespondsToMidiEvent(MidiEvent e, MIDICounter source);
public abstract void HandleMidiEvent(MidiEvent e, float lookaheadSeconds, MIDICounter source);
public override void HandleMidiEvent(MidiEvent e, float lookaheadSeconds, MIDICounter source) { currentCoroutine = AddMidiEventWithTimeBoundaries (e, lookaheadSeconds - leadingCushionSeconds, lookaheadSeconds + trailingCushionSeconds); StartCoroutine (currentCoroutine); }