Ejemplo n.º 1
0
    IEnumerator AddMidiEventWithTimeBoundaries(MidiEvent e, float startSeconds, float endSeconds)
    {
        yield return new WaitForSeconds(startSeconds);

        mevent = e;
        endValidTime = Time.time + (endSeconds - startSeconds);
    }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 3
0
    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;
        }
    }
Ejemplo n.º 4
0
 public override bool RespondsToMidiEvent(MidiEvent e, MIDICounter source)
 {
     return e.status == 144;
 }
Ejemplo n.º 5
0
 public override void HandleMidiEvent(MidiEvent e, float lookaheadSeconds, MIDICounter source)
 {
     StartCoroutine(UpdateColorForMidiEventWithDelay (e, lookaheadSeconds, source));
 }
Ejemplo n.º 6
0
 public DeltaEventPair(int delta, MidiEvent midiEvent)
 {
     this.delta = delta;
     this.midiEvent = midiEvent;
 }
Ejemplo n.º 7
0
 public void AddEvent(int delta, MidiEvent midiEvent)
 {
     sequence.Add (new DeltaEventPair (delta, midiEvent));
 }
Ejemplo n.º 8
0
 public void AddEvent(int delta, MidiEvent midiEvent)
 {
     sequence.Add(new DeltaEventPair(delta, midiEvent));
 }
Ejemplo n.º 9
0
 public DeltaEventPair(int delta, MidiEvent midiEvent)
 {
     this.delta     = delta;
     this.midiEvent = midiEvent;
 }
Ejemplo n.º 10
0
 public abstract bool RespondsToMidiEvent(MidiEvent e, MIDICounter source);
Ejemplo n.º 11
0
 public abstract void HandleMidiEvent(MidiEvent e, float lookaheadSeconds, MIDICounter source);
Ejemplo n.º 12
0
 public override void HandleMidiEvent(MidiEvent e, float lookaheadSeconds, MIDICounter source)
 {
     currentCoroutine = AddMidiEventWithTimeBoundaries (e, lookaheadSeconds - leadingCushionSeconds, lookaheadSeconds + trailingCushionSeconds);
     StartCoroutine (currentCoroutine);
 }