Ejemplo n.º 1
0
        private InputDevice(int id)
            : base(id)
        {
            _channelEventReader = new MidiReader(_channelMessageMemoryStream);

            SetDeviceInformation();
        }
        public MidiEvent Read(MidiReader reader, ReadingSettings settings, byte currentStatusByte)
        {
            SystemCommonEvent systemCommonEvent = null;

            switch (currentStatusByte)
            {
            case EventStatusBytes.SystemCommon.MtcQuarterFrame:
                systemCommonEvent = new MidiTimeCodeEvent();
                break;

            case EventStatusBytes.SystemCommon.SongSelect:
                systemCommonEvent = new SongSelectEvent();
                break;

            case EventStatusBytes.SystemCommon.SongPositionPointer:
                systemCommonEvent = new SongPositionPointerEvent();
                break;

            case EventStatusBytes.SystemCommon.TuneRequest:
                systemCommonEvent = new TuneRequestEvent();
                break;
            }

            systemCommonEvent.Read(reader, settings, MidiEvent.UnknownContentSize);
            return(systemCommonEvent);
        }
 /// <summary>
 /// Reads content of a MIDI meta event.
 /// </summary>
 /// <param name="reader">Reader to read the content with.</param>
 /// <param name="settings">Settings according to which the event's content must be read.</param>
 /// <param name="size">Size of the event's content.</param>
 protected override void ReadContent(MidiReader reader, ReadingSettings settings, int size)
 {
     if (size >= 1)
     {
         Port = reader.ReadByte();
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Show tracks info
        /// </summary>
        public static void ShowTracksInfoHtml(string fname, ref string strHtml, int iTrack = -1)
        {
            // MIDI ファイルを読み込む
            var midiData = MidiReader.ReadFrom(fname, Encoding.GetEncoding("shift-jis"));

            // MIDI イベント数、ノート数、プログラムチェンジの数、コントロールチェンジの数、メタイベント数、エクスクルーシブイベント数
            strHtml = "<!DOCTYPE html PUBLIC \" -//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"><html><head><style type=\"text/css\">" +
                      "body{font-size: 9pt;text-align: center; padding: 0; margin: 0;}" +
                      "table{width:100%;border-collapse: collapse;border: solid 1px;}" +
                      "th{text-align: center;color: #444;background-color: #ccc;border-right: 1px solid #ccc;border-bottom: 1px solid #ccc;}" +
                      "td{background-color: #fafafa;border-right: 1px solid #ccc;border-bottom: 1px solid #ccc;}" +
                      "td.sel{background-color: #faaa8a;border-right: 1px solid #ccc;border-bottom: 1px solid #ccc;}" +
                      "</style></head><body>";
            strHtml += "<table><tr><th>Track</th><th>Event</th><th>Note</th><th>Prog</th><th>Control</th><th>Meta</th><th>Exclusive</th><th>Title</th></tr>";

            for (int i = 0; i < midiData.Tracks.Count; i++)
            {
                string strTd = "<td>";
                if (i == iTrack)
                {
                    strTd = "<td class=\"sel\">";
                }
                var track = midiData.Tracks[i];
                strHtml += "<tr>" + strTd +
                           i.ToString() + "</td>" + strTd +
                           track.GetData <MidiEvent>().Count.ToString() + "</td>" + strTd +
                           track.GetData <NoteEvent>().Count.ToString() + "</td>" + strTd +
                           track.GetData <ProgramEvent>().Count.ToString() + "</td>" + strTd +
                           track.GetData <ControlEvent>().Count.ToString() + "</td>" + strTd +
                           track.GetData <MetaEvent>().Count.ToString() + "</td>" + strTd +
                           track.GetData <ExclusiveEvent>().Count.ToString() + "</td>" + strTd +
                           track.GetTitle(i == 0) + "</td></tr>";
            }
            strHtml += "</table></body></html>";
        }
Ejemplo n.º 5
0
        public void CanCompressWithLimit(string name)
        {
            var c     = new MidiReader(name);
            var tones = c.GetTones().ToArray();

            Compress(tones, false, true, false, 256);
        }
Ejemplo n.º 6
0
        public MidiEvent Read(MidiReader reader, ReadingSettings settings, byte currentStatusByte)
        {
            SystemRealTimeEvent systemRealTimeEvent = null;

            switch (currentStatusByte)
            {
            case EventStatusBytes.SystemRealTime.ActiveSensing:
                systemRealTimeEvent = new ActiveSensingEvent();
                break;

            case EventStatusBytes.SystemRealTime.Continue:
                systemRealTimeEvent = new ContinueEvent();
                break;

            case EventStatusBytes.SystemRealTime.Reset:
                systemRealTimeEvent = new ResetEvent();
                break;

            case EventStatusBytes.SystemRealTime.Start:
                systemRealTimeEvent = new StartEvent();
                break;

            case EventStatusBytes.SystemRealTime.Stop:
                systemRealTimeEvent = new StopEvent();
                break;

            case EventStatusBytes.SystemRealTime.TimingClock:
                systemRealTimeEvent = new TimingClockEvent();
                break;
            }

            systemRealTimeEvent.Read(reader, settings, MidiEvent.UnknownContentSize);
            return(systemRealTimeEvent);
        }
Ejemplo n.º 7
0
        internal InputDevice(uint id)
            : base(id)
        {
            _channelEventReader = new MidiReader(_channelMessageMemoryStream);
            _sysExEventReader   = new MidiReader(_sysExMessageMemoryStream);

            SetDeviceInformation();
        }
            protected override void ReadContent(MidiReader reader, ReadingSettings settings, int size)
            {
                A = reader.ReadVlqNumber();

                var bLength = reader.ReadVlqNumber();

                B = reader.ReadString(bLength);

                C = reader.ReadByte();
            }
Ejemplo n.º 9
0
        /// <summary>
        /// Reads content of a MIDI meta event.
        /// </summary>
        /// <param name="reader">Reader to read the content with.</param>
        /// <param name="settings">Settings according to which the event's content must be read.</param>
        /// <param name="size">Size of the event's content.</param>
        protected override void ReadContent(MidiReader reader, ReadingSettings settings, int size)
        {
            // A shortened version can be used in format 2 MIDI files : the 2 data bytes can be omitted
            // (thus length must be 0), whereupon the sequence number is derived from the track chunk's
            // position within the file.
            if (size < 2)
            {
                return;
            }

            Number = reader.ReadWord();
        }
Ejemplo n.º 10
0
        public ImuseMidiHeader(MidiReader reader, uint size)
        {
            if (size != 8)
            {
                throw new ImuseMidiHeaderException($"Unknown MDhd chunk format, size {size}");
            }

            Version   = reader.ReadUint16();
            Priority  = reader.ReadByte();
            Volume    = reader.ReadByte();
            Pan       = reader.ReadSByte();
            Transpose = reader.ReadSByte();
            Detune    = reader.ReadSByte();
            Speed     = reader.ReadByte();
        }
Ejemplo n.º 11
0
        private static void InitDomain(string filename)
        {
            // MIDI ファイルを読み込み
            //string fname = "../../../Resources/wood.mid";// 0 | 480 1440 | 2400 2880 3360 | 4320 4800 5280 5760 | 6240 …
            string fname = filename;

            if (!File.Exists(fname))
            {
                Console.WriteLine("File does not exist");
                return;
            }
            var midiData = MidiReader.ReadFrom(fname, Encoding.GetEncoding("shift-jis"));

            // テンポマップを作成
            domain = new MidiFileDomain(midiData);
        }
Ejemplo n.º 12
0
        private void ReadMidiFile(string name, string number)
        {
            Console.WriteLine($"preparing {name}");
            var reader     = new MidiReader(name);
            var tones      = reader.GetTones().ToArray();
            var compressor = new ToneCompressor(tones, 253);

            tones = compressor.Compress();
            tones = tones
                    .Concat(new[]
            {
                new MediaToneMessage.Tone(34, 34, 34, 34, 0, 0, 0, 0, UInt16.MaxValue, 0, 0,
                                          (ushort)(tones.Length + 1)),
                new MediaToneMessage.Tone(34, 34, 34, 34, 0, 0, 0, 0, UInt16.MaxValue, 0, 0, (ushort)tones.Length)
            })
                    .ToArray();
            _audio.Add((number, tones));
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Reads content of a MIDI meta event.
 /// </summary>
 /// <param name="reader">Reader to read the content with.</param>
 /// <param name="settings">Settings according to which the event's content must be read.</param>
 /// <param name="size">Size of the event's content.</param>
 protected override void ReadContent(MidiReader reader, ReadingSettings settings, int size)
 {
 }
Ejemplo n.º 14
0
 internal override sealed void Read(MidiReader reader, ReadingSettings settings, int size)
 {
 }
Ejemplo n.º 15
0
 private void Start()
 {
     midiReader = GameObject.FindObjectOfType <MidiReader>();
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Reads content of a MIDI meta event.
 /// </summary>
 /// <param name="reader">Reader to read the content with.</param>
 /// <param name="settings">Settings according to which the event's content must be read.</param>
 /// <param name="size">Size of the event's content.</param>
 protected abstract void ReadContent(MidiReader reader, ReadingSettings settings, int size);
Ejemplo n.º 17
0
 /// <summary>
 /// Reads content of a MIDI event.
 /// </summary>
 /// <param name="reader">Reader to read the content with.</param>
 /// <param name="settings">Settings according to which the event's content must be read.</param>
 /// <param name="size">Size of the event's content.</param>
 internal sealed override void Read(MidiReader reader, ReadingSettings settings, int size)
 {
     ReadContent(reader, settings, size);
 }
Ejemplo n.º 18
0
        public ChartParser LoadMidi()
        {
            var name = "";

            name = name + new FileInfo(_fileLocation).Name + ":\n";
            try
            {
                _midiReader = MidiReader.smethod_0(_fileLocation);
            }
            catch (Exception)
            {
                throw new IOException(name + "Unknown Error: Could not parse MIDI sequence.");
            }
            foreach (var current in _midiReader.GetMidiLineList())
            {
                if (current.method_2().Equals("PART GUITAR"))
                {
                    _isPartGuitar = true;
                }
                else if (current.method_2().Equals("EVENTS"))
                {
                    _isEvents = true;
                }
            }
            if (_midiReader.GetMidiLineList().Count == 1 && !_isPartGuitar)
            {
                _midiReader.GetMidiLineList()[0].method_3("PART GUITAR");
                _isPartGuitar = true;
            }
            if (!_isPartGuitar)
            {
                throw new IOException(name + "PART GUITAR not found. No chart created.");
            }
            var chartParser = new ChartParser();

            _bpmInterpreter     = chartParser.BpmInterpreter;
            _sectionInterpreter = chartParser.SectionInterpreter;
            chartParser.DifficultyWithNotes.Add("EasySingle", _easySingle);
            chartParser.DifficultyWithNotes.Add("MediumSingle", _mediumSingle);
            chartParser.DifficultyWithNotes.Add("HardSingle", _hardSingle);
            chartParser.DifficultyWithNotes.Add("ExpertSingle", _expertSingle);
            chartParser.DifficultyWithNotes.Add("EasyDoubleGuitar", _easyDoubleGuitar);
            chartParser.DifficultyWithNotes.Add("MediumDoubleGuitar", _mediumDoubleGuitar);
            chartParser.DifficultyWithNotes.Add("HardDoubleGuitar", _hardDoubleGuitar);
            chartParser.DifficultyWithNotes.Add("ExpertDoubleGuitar", _expertDoubleGuitar);
            chartParser.DifficultyWithNotes.Add("EasyDoubleBass", _easyDoubleBass);
            chartParser.DifficultyWithNotes.Add("MediumDoubleBass", _mediumDoubleBass);
            chartParser.DifficultyWithNotes.Add("HardDoubleBass", _hardDoubleBass);
            chartParser.DifficultyWithNotes.Add("ExpertDoubleBass", _expertDoubleBass);
            chartParser.InstrumentList.Add("EasyDrums", _easyDrums);
            chartParser.InstrumentList.Add("MediumDrums", _mediumDrums);
            chartParser.InstrumentList.Add("HardDrums", _hardDrums);
            chartParser.InstrumentList.Add("ExpertDrums", _expertDrums);
            chartParser.InstrumentList.Add("EasyKeyboard", _easyKeyboard);
            chartParser.InstrumentList.Add("MediumKeyboard", _mediumKeyboard);
            chartParser.InstrumentList.Add("HardKeyboard", _hardKeyboard);
            chartParser.InstrumentList.Add("ExpertKeyboard", _expertKeyboard);
            chartParser.Constant480 = 480;
            _resolution             = 480.0 / _midiReader.method_0();
            object obj = name;

            name = string.Concat(obj, "NumTracks = ", _midiReader.GetMidiLineList().Count, "\n");
            method_1(_midiReader.GetMidiLineList()[0]);
            foreach (var midiLine in _midiReader.GetMidiLineList())
            {
                if (midiLine.method_2().Equals("PART GUITAR"))
                {
                    GetNotes(midiLine, 0);
                }
                else if (midiLine.method_2().Equals("T1 GEMS"))
                {
                    GetNotes(midiLine, 0);
                }
                else if (midiLine.method_2().Equals("PART GUITAR COOP"))
                {
                    GetNotes(midiLine, 1);
                }
                else if (midiLine.method_2().Equals("PART RHYTHM"))
                {
                    _notBass = true;
                    GetNotes(midiLine, 3);
                }
                else if (midiLine.method_2().Equals("PART BASS"))
                {
                    GetNotes(midiLine, 3);
                }
                else if (midiLine.method_2().Equals("EVENTS"))
                {
                    GetNotes(midiLine, 4);
                }
                else if (midiLine.method_2().Equals("BAND DRUMS"))
                {
                    GetNotes(midiLine, 5);
                }
                else if (midiLine.method_2().Equals("BAND KEYS"))
                {
                    GetNotes(midiLine, 7);
                }
                else
                {
                    name = name + "Track (" + midiLine.method_2() + ") ignored.\n";
                }
            }
            chartParser.Gh3SongInfo.Title   = _songTitle;
            chartParser.Gh3SongInfo.NotBass = _notBass;
            name += "Conversion Complete!";
            Console.WriteLine(name);
            chartParser.RemoveEmptyParts();
            return(chartParser);
        }
Ejemplo n.º 19
0
 protected override void ReadContent(MidiReader reader, ReadingSettings settings, uint size)
 {
     A = reader.ReadVlqNumber();
 }
Ejemplo n.º 20
0
        public static int GetMidiDataInfo(string strMidiFile, int iTrack, float keyFramePerSec, long nMMDPasteStartPos, long nPreAction, ref List <List <long> > listMidiFingering, int iReadType = 0)
        {
            if (!File.Exists(strMidiFile))
            {
                return(3);
            }

            // get tempo information
            tempoHolder myTempo = new tempoHolder(strMidiFile);

            if (myTempo == null)
            {
                return(2);
            }

            // - Reed MIDI file
            var midiData = MidiReader.ReadFrom(strMidiFile, Encoding.GetEncoding("shift-jis"));

            if (iReadType == 0)
            {
                if (iTrack >= 0)
                {
                    if (iTrack >= midiData.Tracks.Count)
                    {
                        return(1);
                    }
                    //double dMillisecToFrame = Scene.KeyFramePerSec / 1000.0;
                    double dMillisecToFrame  = keyFramePerSec / 1000.0;
                    var    track             = midiData.Tracks[iTrack];
                    int    iMidiFingeringCnt = 0;
                    // long nPreviousNoteTickCheck = 99999;
                    foreach (var note in track.GetData <NoteEvent>())
                    {
                        // - 0:frame-paste-to1, 1:frame-paste-to2, 2:note, 3:vel, 4:finger, 5:wrist center pos, 6:self array ID, 7: Polyphonic_ID
                        long nMillisec       = myTempo.GetGateOnStartTimeMilliSec(note.Tick);
                        long nFramePaste     = (long)(nMillisec * dMillisecToFrame) + nMMDPasteStartPos - nPreAction;
                        long nMillsecHold    = myTempo.GetGateOnStartTimeMilliSec(note.Tick + note.Gate);
                        long nFramePasteHold = (long)(nMillsecHold * dMillisecToFrame) + nMMDPasteStartPos + nPreAction;
                        // To correct fog sound (keyframe of on and offs).
                        nFramePasteHold -= 1;

                        listMidiFingering.Add(new List <long>()
                        {
                            nFramePaste, nFramePasteHold, note.Note, note.Velocity, 0, 0, iMidiFingeringCnt, 0, 0
                        });

                        iMidiFingeringCnt++;
                    }
                }
            }
            else
            {
                byte midiControlNumber = 0x00;
                if (iReadType == CONTROL_EVENT_HOLD)
                {
                    midiControlNumber = 0x40;
                }
                if (iReadType == CONTROL_EVENT_SUSTAIN)
                {
                    midiControlNumber = 0x42;
                }
                if (iReadType == CONTROL_EVENT_SOFT)
                {
                    midiControlNumber = 0x43;
                }
                // if iTrack is less than 0, get all tracks.
                for (int i = 0; i < midiData.Tracks.Count; i++)
                {
                    if ((iTrack >= 0) && (iTrack != i))
                    {
                        continue;
                    }
                    double dMillisecToFrame  = keyFramePerSec / 1000.0;
                    var    track             = midiData.Tracks[i];
                    int    iMidiFingeringCnt = 0;
                    foreach (var note in track.GetData <ControlEvent>())
                    {
                        if (note.Number == midiControlNumber)
                        {
                            long nMillisec   = myTempo.GetGateOnStartTimeMilliSec(note.Tick);
                            long nFramePaste = (long)(nMillisec * dMillisecToFrame) + nMMDPasteStartPos - nPreAction;
                            if (listMidiFingering.Count > 0 && listMidiFingering.Last()[CommonConstants.CSV_COL_ON_FRAME] == nFramePaste)
                            {
                                nFramePaste++;
                            }
                            long nFramePasteHold = nFramePaste + 1;
                            //listMidiFingering.Add(new List<long>() { 0, nFramePaste, nFramePasteHold, note.Value });
                            listMidiFingering.Add(new List <long>()
                            {
                                nFramePaste, nFramePasteHold, 0, note.Value, 0, 0, iMidiFingeringCnt, 0, 0
                            });

                            iMidiFingeringCnt++;
                        }
                    }
                }
            }
            // hold frame modification
            // the same key off and on, change off key one step before
            for (int iMidiCnt = 0; iMidiCnt < listMidiFingering.Count - 1; iMidiCnt++)
            {
                long note     = listMidiFingering[iMidiCnt][CommonConstants.CSV_COL_NOTE];
                long onframe  = listMidiFingering[iMidiCnt][CommonConstants.CSV_COL_ON_FRAME];
                long offframe = listMidiFingering[iMidiCnt][CommonConstants.CSV_COL_OFF_FRAME];
                for (int iNext = iMidiCnt + 1; iNext < Math.Min(iMidiCnt + 10, listMidiFingering.Count); iNext++)
                {
                    if (listMidiFingering[iNext][CommonConstants.CSV_COL_ON_FRAME] > offframe + 1)
                    {
                        continue;
                    }
                    if (listMidiFingering[iNext][CommonConstants.CSV_COL_NOTE] == note)
                    {
                        if ((offframe + 2) >= listMidiFingering[iNext][CommonConstants.CSV_COL_ON_FRAME])
                        {
                            if (onframe + 2 < offframe)
                            {
                                listMidiFingering[iMidiCnt][CommonConstants.CSV_COL_OFF_FRAME] = offframe - 2;
                            }
                            else
                            {
                                listMidiFingering[iNext][CommonConstants.CSV_COL_ON_FRAME]     = onframe;
                                listMidiFingering[iMidiCnt][CommonConstants.CSV_COL_OFF_FRAME] = listMidiFingering[iNext][CommonConstants.CSV_COL_OFF_FRAME];
                            }
                        }
                    }
                }
            }

            return(0);
        }
Ejemplo n.º 21
0
        public tempoHolder(string fname)
        {
            // MIDI ファイルを読み込む
            var midiData = MidiReader.ReadFrom(fname, Encoding.GetEncoding("shift-jis"));

            iBaseResolution = midiData.Resolution.Resolution;
            int nTrack = 0;

            if (nTrack >= midiData.Tracks.Count)
            {
                Console.WriteLine("File does not exist");
                return;
            }
#if DEBUG
            //Debug.Print("Track Evnt Note Prog Cont Meta Excl  Title");
            //Debug.Print("----- ---- ---- ---- ---- ---- ----  ----------------");
            //for (int i = 0; i < midiData.Tracks.Count; i++)
            //{
            //    var track = midiData.Tracks[i];

            //    Debug.Print("{0} {1} {2} {3} {4} {5} {6}  {7}",
            //    i.ToString().PadLeft(5),
            //    track.GetData<MidiEvent>().Count.ToString().PadLeft(4),
            //    track.GetData<NoteEvent>().Count.ToString().PadLeft(4),
            //    track.GetData<ProgramEvent>().Count.ToString().PadLeft(4),
            //    track.GetData<ControlEvent>().Count.ToString().PadLeft(4),
            //    track.GetData<MetaEvent>().Count.ToString().PadLeft(4),
            //    track.GetData<ExclusiveEvent>().Count.ToString().PadLeft(4),
            //    track.GetTitle(i == 0));
            //}
            Debug.Print("----- -------- ---- ---- ---- ----------------");
            Debug.Print("                    分母 分子");
            Debug.Print("Track Tick     Num  Note Rhyt RequireToSend");
            Debug.Print("----- -------- ---- ---- ---- ----------------");
            for (int i = 0; i < midiData.Tracks.Count; i++)
            {
                var track   = midiData.Tracks[i];
                var metaEvs = track.GetData <NextMidi.DataElement.MetaData.RhythmEvent>();
                if (metaEvs.Count > 0)
                {
                    foreach (var evs in metaEvs)
                    {
                        Debug.Print("{0} {1} {2} {3} {4} {5}",
                                    i.ToString().PadLeft(5),
                                    evs.Tick.ToString().PadLeft(8),
                                    evs.EventNumber.ToString().PadLeft(4),
                                    evs.Note.ToString().PadLeft(4),
                                    evs.Rhythm.ToString().PadLeft(4),
                                    evs.RequireToSend.ToString());
                    }
                }
            }
#endif
            // all tracks tempo search
            for (int i = 0; i < midiData.Tracks.Count; i++)
            {
                var track    = midiData.Tracks[i];
                var tempoEvs = track.GetData <TempoEvent>();
                if (tempoEvs.Count > 0)
                {
#if DEBUG
                    Debug.Print("------ ----- -------- -------------------------");
                    Debug.Print("Tick   Tempo MicroSec speed / Oh, tempo.Tempo is integer...");
                    Debug.Print("------ ----- -------- -------------------------");
#endif
                    long   nPassedTime     = 0;
                    double dPreTickSec     = 0.0;
                    long   nPreMicroSecond = 0;
                    long   nPreTick        = 0;
                    long   nPreTempo       = 0;
                    long   nPrePassedTime  = 0;
                    foreach (var tempo in tempoEvs)
                    {
                        long nContinueTick = tempo.Tick - nPreTick;
                        nPassedTime += (long)(nContinueTick * dPreTickSec);
                        dPreTickSec  = tempo.MicroSecond / 1.0 / midiData.Resolution.Resolution;
#if DEBUG
                        Debug.WriteLine("{0} {1} {2} {3}",
                                        tempo.Tick.ToString().PadLeft(6),
                                        tempo.Tempo.ToString().PadLeft(5),
                                        tempo.MicroSecond.ToString().PadLeft(8),
                                        60.0 / (tempo.MicroSecond / 1000000.0));
#endif
                        tempoEventBase _tmp = new tempoEventBase(nPreMicroSecond, nPreTick, tempo.Tick, nPrePassedTime, nPreTempo);
                        if (nPreTick != tempo.Tick)
                        {
                            tempoList.Add(_tmp);
                        }
                        nPreMicroSecond = tempo.MicroSecond;
                        nPreTick        = tempo.Tick;
                        nPreTempo       = tempo.Tempo;
                        nPrePassedTime  = nPassedTime;
                    }
                    tempoEventBase tmp = new tempoEventBase(nPreMicroSecond, nPreTick, Int32.MaxValue - 1, nPrePassedTime, nPreTempo);
                    tempoList.Add(tmp);
                }
            }
#if DEBUG
            //Debug.WriteLine("------------------------------------------------------------");
            //Debug.WriteLine("us/q-note  tick       tick       tmp passed time from top[ms]");
            //Debug.WriteLine("---------- ---------- ---------- --- -----------------------");
            //foreach (tempoEventBase _tmp in tempoList)
            //{
            //    Debug.WriteLine("{0} {1} {2} {3} {4}",
            //        _tmp.nQuoteNoteMicroSec.ToString().PadLeft(10),
            //        _tmp.nStartTick.ToString().PadLeft(10),
            //        _tmp.nNextTick.ToString().PadLeft(10),
            //        _tmp.nTempo.ToString().PadLeft(3),
            //        _tmp.nPassedTimeMicroSec / 1000);
            //}
            //Debug.WriteLine("------------------------------------------------------------");
#endif
        }
Ejemplo n.º 22
0
		public static MidiData LoadSmf(string filename)
		{
			var mfr = new MidiReader(new FileStream(filename, FileMode.Open, FileAccess.Read), Encoding.Default);
			var m = mfr.ReadFile();
			mfr.Close();
			return m;
		}
Ejemplo n.º 23
0
 protected override void ReadContent(MidiReader reader, ReadingSettings settings, uint size)
 {
     throw new System.NotImplementedException();
 }
 /// <summary>
 ///     Reads content of a MIDI meta event.
 /// </summary>
 /// <param name="reader">Reader to read the content with.</param>
 /// <param name="settings">Settings according to which the event's content must be read.</param>
 /// <param name="size">Size of the event's content.</param>
 protected override void ReadContent(MidiReader reader, ReadingSettings settings, int size)
 {
     Channel = reader.ReadByte();
 }