82 lines
1.8 KiB
C#
82 lines
1.8 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace DMX2
|
|
{
|
|
public partial class MidiEventProvider : IEventProvider, IDisposable
|
|
{
|
|
|
|
IntPtr midi_seq_handle = IntPtr.Zero;
|
|
int midiport;
|
|
|
|
public MidiEventProvider ()
|
|
{
|
|
snd_seq_open(out midi_seq_handle, "default",SND_SEQ_OPEN_INPUT,0);
|
|
snd_seq_set_client_name(midi_seq_handle,"DMX2");
|
|
midiport = snd_seq_create_simple_port(midi_seq_handle,"dmx_ctrl",
|
|
SND_SEQ_PORT_CAP_WRITE + SND_SEQ_PORT_CAP_SUBS_WRITE,
|
|
SND_SEQ_PORT_TYPE_APPLICATION);
|
|
|
|
Info.Publish(string.Format("Midi port {0}",midiport));
|
|
}
|
|
|
|
public void Process ()
|
|
{
|
|
int i= snd_seq_event_input_pending(midi_seq_handle,1);
|
|
if( i!=0)Info.Publish(string.Format("i={0}",i));
|
|
IntPtr ev;
|
|
|
|
/*
|
|
while (snd_seq_event_input_pending(midi_seq_handle,1)>0) {
|
|
|
|
|
|
snd_seq_event_t evS =(snd_seq_event_t) Marshal.PtrToStructure(ev,typeof(snd_seq_event_t));
|
|
|
|
Info.Publish(evS.data_control_value.ToString());
|
|
|
|
snd_seq_free_event(ev);
|
|
}*/
|
|
|
|
}
|
|
|
|
#region IDisposable implementation
|
|
public void Dispose ()
|
|
{
|
|
snd_seq_close(midi_seq_handle);
|
|
}
|
|
#endregion
|
|
|
|
#region IEventProvider implementation
|
|
string[] IEventProvider.GetEventList ()
|
|
{
|
|
throw new System.NotImplementedException ();
|
|
}
|
|
|
|
bool IEventProvider.Bind (string eventId, IEventTarget target)
|
|
{
|
|
throw new System.NotImplementedException ();
|
|
}
|
|
|
|
void IEventProvider.Unbind (string eventId, IEventTarget target)
|
|
{
|
|
throw new System.NotImplementedException ();
|
|
}
|
|
|
|
Gtk.Menu IEventProvider.GetProviderSubMenu (Gtk.ButtonPressEventHandler handler)
|
|
{
|
|
throw new System.NotImplementedException ();
|
|
}
|
|
|
|
string IEventProvider.MenuName {
|
|
get {
|
|
throw new System.NotImplementedException ();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|