Ejemplo n.º 1
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];
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
 IEnumerator Start()
 {
     song = MidiFileLoader.Load (sourceFile.bytes);
     yield return new WaitForSeconds (1.0f);
     ResetAndPlay ();
 }
Ejemplo n.º 3
0
 void Start()
 {
     song = MidiFileLoader.Load (midiFile.bytes);
     ResetAndPlay ();
 }