summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/portmidi/pm_csharp/pm_managed/pm_managed.h
blob: 21898368ec8b269e1b424e8ac1735e5b213b3282 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// pm_managed.h

#pragma once

#include "portmidi.h"

using namespace System;

namespace pm_managed {


	public ref class MpmDeviceInfo
	{
	public:
		int structVersion; 
		System::String^ interf; /* underlying MIDI API, e.g. MMSystem or DirectX */
		System::String^ name;   /* device name, e.g. USB MidiSport 1x1 */
		bool input; /* true iff input is available */
		bool output; /* true iff output is available */
		int opened; /* used by generic PortMidi code to do error checking on arguments */

		MpmDeviceInfo(const PmDeviceInfo* info)
		{
			structVersion = info->structVersion;
			input = (info->input != 0);
			output = (info->output != 0);
			opened = info->opened;

			interf = gcnew System::String(info->interf);
			name = gcnew System::String(info->name);
		}
	};

	public ref class ManagedPortMIDI
	{
	public:
		int Pm_Initialize()
		{
			::Pm_Initialize();
			return 0;
		}

		int Pm_CountDevices()
		{
			return ::Pm_CountDevices();
		}

		MpmDeviceInfo^ Pm_GetDeviceInfo(int id)
		{
			return gcnew MpmDeviceInfo(::Pm_GetDeviceInfo(id));
		}
	};
}