pm_managed.h (1064B)
1 // pm_managed.h 2 3 #pragma once 4 5 #include "portmidi.h" 6 7 using namespace System; 8 9 namespace pm_managed { 10 11 12 public ref class MpmDeviceInfo 13 { 14 public: 15 int structVersion; 16 System::String^ interf; /* underlying MIDI API, e.g. MMSystem or DirectX */ 17 System::String^ name; /* device name, e.g. USB MidiSport 1x1 */ 18 bool input; /* true iff input is available */ 19 bool output; /* true iff output is available */ 20 int opened; /* used by generic PortMidi code to do error checking on arguments */ 21 22 MpmDeviceInfo(const PmDeviceInfo* info) 23 { 24 structVersion = info->structVersion; 25 input = (info->input != 0); 26 output = (info->output != 0); 27 opened = info->opened; 28 29 interf = gcnew System::String(info->interf); 30 name = gcnew System::String(info->name); 31 } 32 }; 33 34 public ref class ManagedPortMIDI 35 { 36 public: 37 int Pm_Initialize() 38 { 39 ::Pm_Initialize(); 40 return 0; 41 } 42 43 int Pm_CountDevices() 44 { 45 return ::Pm_CountDevices(); 46 } 47 48 MpmDeviceInfo^ Pm_GetDeviceInfo(int id) 49 { 50 return gcnew MpmDeviceInfo(::Pm_GetDeviceInfo(id)); 51 } 52 }; 53 }