Exemple #1
0
    IEnumerator AddMidiEventWithTimeBoundaries(MidiEvent e, float startSeconds, float endSeconds)
    {
        yield return new WaitForSeconds(startSeconds);

        mevent = e;
        endValidTime = Time.time + (endSeconds - startSeconds);
    }
Exemple #2
0
 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));
 }
Exemple #6
0
 public DeltaEventPair(int delta, MidiEvent midiEvent)
 {
     this.delta = delta;
     this.midiEvent = midiEvent;
 }
Exemple #7
0
 public void AddEvent(int delta, MidiEvent midiEvent)
 {
     sequence.Add (new DeltaEventPair (delta, midiEvent));
 }
Exemple #8
0
 public void AddEvent(int delta, MidiEvent midiEvent)
 {
     sequence.Add(new DeltaEventPair(delta, midiEvent));
 }
Exemple #9
0
 public DeltaEventPair(int delta, MidiEvent midiEvent)
 {
     this.delta     = delta;
     this.midiEvent = midiEvent;
 }
 public abstract bool RespondsToMidiEvent(MidiEvent e, MIDICounter source);
 public abstract void HandleMidiEvent(MidiEvent e, float lookaheadSeconds, MIDICounter source);
Exemple #12
0
 public override void HandleMidiEvent(MidiEvent e, float lookaheadSeconds, MIDICounter source)
 {
     currentCoroutine = AddMidiEventWithTimeBoundaries (e, lookaheadSeconds - leadingCushionSeconds, lookaheadSeconds + trailingCushionSeconds);
     StartCoroutine (currentCoroutine);
 }