Mercurial > hg > svcore
comparison data/midi/MIDIInput.cpp @ 1397:b0533d195c83
Update RtMidi build to v2.1.1
author | Chris Cannam |
---|---|
date | Sun, 05 Mar 2017 21:51:10 +0000 |
parents | 794b64e62e58 |
children | d2ecf0acc3e2 |
comparison
equal
deleted
inserted
replaced
1396:0bbf91b05164 | 1397:b0533d195c83 |
---|---|
18 #include "rtmidi/RtMidi.h" | 18 #include "rtmidi/RtMidi.h" |
19 | 19 |
20 #include "system/System.h" | 20 #include "system/System.h" |
21 | 21 |
22 MIDIInput::MIDIInput(QString name, FrameTimer *timer) : | 22 MIDIInput::MIDIInput(QString name, FrameTimer *timer) : |
23 m_rtmidi(), | 23 m_rtmidi(0), |
24 m_frameTimer(timer), | 24 m_frameTimer(timer), |
25 m_buffer(1023) | 25 m_buffer(1023) |
26 { | 26 { |
27 try { | 27 try { |
28 m_rtmidi = new RtMidiIn(name.toStdString()); | 28 std::vector<RtMidi::Api> apis; |
29 m_rtmidi->setCallback(staticCallback, this); | 29 RtMidi::getCompiledApi(apis); |
30 m_rtmidi->openPort(0, tr("Input").toStdString()); | 30 if (apis.empty()) { |
31 } catch (RtError e) { | 31 SVDEBUG << "MIDIInput: No RtMidi APIs compiled in" << endl; |
32 } else { | |
33 m_rtmidi = new RtMidiIn(apis[0], name.toStdString()); | |
34 m_rtmidi->setCallback(staticCallback, this); | |
35 m_rtmidi->openPort(0, tr("Input").toStdString()); | |
36 } | |
37 } catch (RtMidiError e) { | |
32 e.printMessage(); | 38 e.printMessage(); |
33 delete m_rtmidi; | 39 delete m_rtmidi; |
34 m_rtmidi = 0; | 40 m_rtmidi = 0; |
35 } | 41 } |
36 } | 42 } |