-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMidiDevice.h
41 lines (30 loc) · 909 Bytes
/
MidiDevice.h
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
// PuppetMaster Input Library (MIDI)
// Copyright 2001 by Jon Parise <[email protected]>
//
// Based on code from:
// Copyright (c) 1999 by Niels Gorisse <[email protected]>
// Modified 2001 by Wil Paredes <[email protected]>
#ifndef __MIDI_DEVICE_H__
#define __MIDI_DEVICE_H__
#include <windows.h>
#include <mmsystem.h>
#define MIDI_BUFFERSIZE 32768
class MidiDevice
{
private:
HMIDIIN device;
unsigned long queue[MIDI_BUFFERSIZE];
unsigned int queue_read_pos;
unsigned int queue_write_pos;
void addData(unsigned long data);
static void CALLBACK midiCallback(HMIDIIN device, UINT status, DWORD instancePtr, DWORD data, DWORD timestamp);
public:
MidiDevice();
~MidiDevice();
// Device manipulation
void open(unsigned int device_id);
void close();
// Device reading
unsigned int poll(unsigned short* buf);
};
#endif /* __MIDI_DEVICE_H__ */