public static void RegisterMessage(ISysExMessage sysEx) { if (!sysExMessage.Contains(sysEx)) { sysExMessage.Add(sysEx); } }
/// <summary> /// WriteSysex /// </summary> /// <returns>int count of data bytes written</returns> public int WriteSysex(ISysExMessage message) { int rc = 0; RC.WriteLine("WriteSysex"); // Guard. if(!IsOpen) return rc; // Create header. MidiLibWrap.MidiHeader header = new MidiLibWrap.MidiHeader(); // System exclusive message data. string msg = message.Message; // // Initialize header. // header.data = Marshal.StringToHGlobalAnsi(msg); header.bufferLength = msg.Length; header.flags = 0; // Prepare header. ThrowOnError(MidiLibWrap.midiOutPrepareHeader(m_MidiHandle, ref header, Marshal.SizeOf(header))); // Place header in queue to be retrieved later. m_SyncHeaderQueue.Enqueue(header); // Send message. ThrowOnError(MidiLibWrap.midiOutLongMsg(m_MidiHandle, ref header, Marshal.SizeOf(header))); return rc; }