Пример #1
0
 void ResetAndPlay()
 {
     audio.Play ();
     sequencers = new MidiTrackSequencer[song.tracks.Count];
     for(int i = 0; i < song.tracks.Count; ++i) {
         sequencers[i] = new MidiTrackSequencer (song.tracks [i], song.division, bpm);
         VJMidiInput.ReceiveMidiEvents(sequencers[i].Start ());
     }
 }
Пример #2
0
        public MidiMultiTrackSequencer(MidiFileContainer song, float midiFileTempo)
        {
            _sequencers = new MidiTrackSequencer[song.tracks.Count];

            info.Reset();

            for (int s = 0; s < _sequencers.Length; s++)
            {
                MidiTrackSequencer sq = new MidiTrackSequencer(song.tracks[s], song.division, midiFileTempo);
                MidiTrack          tr = sq.track;
                _sequencers[s] = sq;

                // Gather file info.
                for (int c = 0; c < 16; c++)
                {
                    if (tr.channelInfo[c].isUsed)
                    {
                        info.channelInfo[c].isUsed = true;
                    }
                    if (tr.channelInfo[c].noteKeyMin < info.channelInfo[c].noteKeyMin)
                    {
                        info.channelInfo[c].noteKeyMin = tr.channelInfo[c].noteKeyMin;
                    }
                    if (sq.track.channelInfo[c].noteKeyMax > info.channelInfo[c].noteKeyMax)
                    {
                        info.channelInfo[c].noteKeyMax = sq.track.channelInfo[c].noteKeyMax;
                    }
                    if (tr.channelInfo[c].noteVelMin < info.channelInfo[c].noteVelMin)
                    {
                        info.channelInfo[c].noteVelMin = tr.channelInfo[c].noteVelMin;
                    }
                    if (tr.channelInfo[c].noteVelMax > info.channelInfo[c].noteVelMax)
                    {
                        info.channelInfo[c].noteVelMax = tr.channelInfo[c].noteVelMax;
                    }
                    for (int cc = 0; cc < 128; cc++)
                    {
                        if (tr.channelInfo[c].controlChangeValMin[cc] < info.channelInfo[c].controlChangeValMin[cc])
                        {
                            info.channelInfo[c].controlChangeValMin[cc] = tr.channelInfo[c].controlChangeValMin[cc];
                        }
                        if (tr.channelInfo[c].controlChangeValMax[cc] > info.channelInfo[c].controlChangeValMax[cc])
                        {
                            info.channelInfo[c].controlChangeValMax[cc] = tr.channelInfo[c].controlChangeValMax[cc];
                        }
                    }
                }
            }
        }
Пример #3
0
 void ResetAndPlay()
 {
     audio.Play ();
     sequencer = new MidiTrackSequencer (song.tracks [0], song.division, 131.0f);
     ApplyMessages (sequencer.Start ());
 }
Пример #4
0
    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);
            }
        }
    }
Пример #5
0
    void StartAdvancePattern(double syncTime, double lookahead)
    {
        lookaheadSeconds = (float)lookahead;

        timeOffset = (float)syncTime;
        MidiFileContainer fileContainer = MidiFileLoader.Load (midiFile.bytes);
        midiSeq = new MidiTrackSequencer (fileContainer.tracks [0], fileContainer.division, bpm);

        StartCoroutine(AdvancePattern());
    }