internal void SendMessages(OutputMidi[] om, SysRealtimeMessage CommonMessage) { foreach (int i in outMidiList) { om[i].outMIDI.Send(CommonMessage); } }
void onSysRealtimeMessageReceived(object obj, SysRealtimeMessageEventArgs e) { SysRealtimeMessage m = e.Message; if (debugPrintMIDI) { Console.WriteLine("SysRealtime Message: " + m.Message + " " + m.Status + " " + m.Timestamp); } }
private void Write(SysRealtimeMessage message) { // Escaped messages cancel running status. runningStatus = 0; // Escaped message. trackData.Add((byte)0xF7); trackData.Add((byte)message.Status); }
public virtual void Send(SysRealtimeMessage message) { #region Require if (IsDisposed) { throw new ObjectDisposedException(this.GetType().Name); } #endregion Send(message.Message); }
/// <summary> /// Determines whether two SysRealtimeMessage instances are equal. /// </summary> /// <param name="obj"> /// The SysRealtimeMessage to compare with the current SysRealtimeMessage. /// </param> /// <returns> /// <b>true</b> if the specified SysRealtimeMessage is equal to the current /// SysRealtimeMessage; otherwise, <b>false</b>. /// </returns> public override bool Equals(object obj) { #region Guard if (!(obj is SysRealtimeMessage)) { return(false); } #endregion SysRealtimeMessage message = (SysRealtimeMessage)obj; return(this.msg == message.msg); }
private void ParseSysRealtimeMessage() { SysRealtimeMessage e = null; switch ((SysRealtimeType)status) { case SysRealtimeType.ActiveSense: e = SysRealtimeMessage.ActiveSenseMessage; break; case SysRealtimeType.Clock: e = SysRealtimeMessage.ClockMessage; break; case SysRealtimeType.Continue: e = SysRealtimeMessage.ContinueMessage; break; case SysRealtimeType.Reset: e = SysRealtimeMessage.ResetMessage; break; case SysRealtimeType.Start: e = SysRealtimeMessage.StartMessage; break; case SysRealtimeType.Stop: e = SysRealtimeMessage.StopMessage; break; case SysRealtimeType.Tick: e = SysRealtimeMessage.TickMessage; break; } newTrack.Insert(ticks, e); }
private SysRealtimeMessageEventArgs(SysRealtimeMessage message) { this.message = message; }
public virtual void Send(SysRealtimeMessage message) { }
/// <summary> /// 添加mid文件到dataGridView /// </summary> /// <param name="trakInfo"></param> /// <param name="gridView"></param> private void AddTrackInfo2GridView(Sanford.Multimedia.Midi.Track trakInfo, DataGridView gridView) { //DataGridViewTextBoxColumn boxColumn = new DataGridViewTextBoxColumn(); DataGridViewTextBoxColumn ColumnEventIndex = new DataGridViewTextBoxColumn(); ColumnEventIndex.HeaderText = "Event-Num"; ColumnEventIndex.Name = "ColumnEventIndex"; ColumnEventIndex.ReadOnly = true; //ColumnEventIndex.Width = 200; DataGridViewTextBoxColumn ColumnAbsTicks = new DataGridViewTextBoxColumn(); ColumnAbsTicks.HeaderText = "Abs-Ticks"; ColumnAbsTicks.Name = "ColumnAbsTicks"; ColumnAbsTicks.ReadOnly = true; //ColumnAbsTicks.Width = 80; // // ColumnDeltaTicks // DataGridViewTextBoxColumn ColumnDeltaTicks = new DataGridViewTextBoxColumn(); ColumnDeltaTicks.HeaderText = "Dlt Ticks"; ColumnDeltaTicks.Name = "ColumnDeltaTicks"; ColumnDeltaTicks.ReadOnly = true; // // ColumnMsgStatus // DataGridViewTextBoxColumn ColumnMsgStatus = new DataGridViewTextBoxColumn(); ColumnMsgStatus.HeaderText = "MsgStatus"; ColumnMsgStatus.Name = "ColumnMsgStatus"; ColumnMsgStatus.ReadOnly = true; // // ColumnMsgType // DataGridViewTextBoxColumn ColumnMsgType = new DataGridViewTextBoxColumn(); ColumnMsgType.HeaderText = "MsgType"; ColumnMsgType.Name = "ColumnMsgType"; ColumnMsgType.ReadOnly = true; // // ColumnMsgSubType // DataGridViewTextBoxColumn ColumnMsgSubType = new DataGridViewTextBoxColumn(); ColumnMsgSubType.HeaderText = "SubType"; ColumnMsgSubType.Name = "ColumnMsgSubType"; ColumnMsgSubType.ReadOnly = true; // // ColumnMsgData1 // DataGridViewTextBoxColumn ColumnMsgData1 = new DataGridViewTextBoxColumn(); ColumnMsgData1.HeaderText = "MsgData1"; ColumnMsgData1.Name = "ColumnMsgData1"; ColumnMsgData1.ReadOnly = true; // // ColumnMsgData2 // DataGridViewTextBoxColumn ColumnMsgData2 = new DataGridViewTextBoxColumn(); ColumnMsgData2.HeaderText = "MsgData2"; ColumnMsgData2.Name = "ColumnMsgData2"; ColumnMsgData2.ReadOnly = true; // // ColumnMidiChannel // DataGridViewTextBoxColumn ColumnMidiChannel = new DataGridViewTextBoxColumn(); ColumnMidiChannel.HeaderText = "MidiChannel"; ColumnMidiChannel.Name = "ColumnMidiChannel"; ColumnMidiChannel.ReadOnly = true; // // ColumnBytes // DataGridViewTextBoxColumn ColumnBytes = new DataGridViewTextBoxColumn(); ColumnBytes.HeaderText = "Bytes"; ColumnBytes.Name = "ColumnBytes"; ColumnBytes.ReadOnly = true; gridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; gridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { ColumnEventIndex, ColumnAbsTicks, ColumnDeltaTicks, ColumnMsgStatus, ColumnMsgType, ColumnMsgSubType, ColumnMsgData1, ColumnMsgData2, ColumnMidiChannel, ColumnBytes }); for (int i = 0; i < trakInfo.Count; i++) { MidiEvent me = trakInfo.GetMidiEvent(i); //listViewTrackInfo.Items.Add(string.Format("音轨{0},EventNo = {1} Msg type = {2} , status = {3}", i, j, me.MidiMessage.MessageType, me.MidiMessage.Status)); ArrayList stuff = new ArrayList(); stuff.Add(i); stuff.Add(me.AbsoluteTicks); stuff.Add(me.DeltaTicks); stuff.Add(me.MidiMessage.Status); stuff.Add(me.MidiMessage.MessageType); switch (me.MidiMessage.MessageType) { case MessageType.Channel: ChannelMessage cm = (ChannelMessage)me.MidiMessage; stuff.Add(cm.Command); stuff.Add(cm.Data1); stuff.Add(cm.Data2); stuff.Add(cm.MidiChannel); break; case MessageType.SystemExclusive: SysExMessage sem = (SysExMessage)me.MidiMessage; stuff.Add(sem.SysExType); break; case MessageType.SystemCommon: SysCommonMessage scm = (SysCommonMessage)me.MidiMessage; stuff.Add(scm.SysCommonType); stuff.Add(scm.Data1); stuff.Add(scm.Data2); break; case MessageType.SystemRealtime: SysRealtimeMessage srm = (SysRealtimeMessage)me.MidiMessage; stuff.Add(srm.SysRealtimeType); break; case MessageType.Meta: MetaMessage mm = (MetaMessage)me.MidiMessage; stuff.Add(mm.MetaType); //if (mm.MetaType == MetaType.TrackName) //{ // stuff.Add(""); //data1 // stuff.Add(""); //data2 // stuff.Add("");//MidiChannel // byte[] bytesTrkName = mm.GetBytes(); // //UnicodeEncoding encoding = new UnicodeEncoding(); // //string trackName = encoding.GetString(mm.GetBytes()); // //stuff.Add(/*trackName*/mm.GetBytes()); //} break; } //object[] stuff = { i, j, me.MidiMessage.MessageType,me.AbsoluteTicks }; gridView.Rows.Add(stuff.ToArray()); } }