|
|
@@ -1,45 +0,0 @@ |
|
|
|
#include "MidiProbe.h" |
|
|
|
#include <QErrorMessage> |
|
|
|
#include <string> |
|
|
|
|
|
|
|
MidiProbe::MidiProbe() |
|
|
|
{ |
|
|
|
midiin = new RtMidiIn(); |
|
|
|
portCount = midiin->getPortCount(); |
|
|
|
} |
|
|
|
|
|
|
|
unsigned int MidiProbe::getPort() |
|
|
|
{ |
|
|
|
QString selectedPort = ""; |
|
|
|
unsigned int i=0; |
|
|
|
if(portCount==0) |
|
|
|
{ |
|
|
|
QErrorMessage * message = new QErrorMessage(); |
|
|
|
message->setWindowTitle("Fehler!"); |
|
|
|
message->setWindowFlags(message->windowFlags()^Qt::WindowContextHelpButtonHint); |
|
|
|
message->setModal(true); |
|
|
|
message->showMessage("Keine MIDI-Geräte erkannt!"); |
|
|
|
} |
|
|
|
else if(portCount == 1) //automatically select port 0 if it is the only one |
|
|
|
{ |
|
|
|
return(0); |
|
|
|
} |
|
|
|
else if(portCount == 2) // let user select port |
|
|
|
{ |
|
|
|
for(i=0; i<portCount; i++) |
|
|
|
midiDevices.push_back(QString::fromStdString(midiin->getPortName(i))); |
|
|
|
|
|
|
|
QInputDialog * dialog = new QInputDialog(); |
|
|
|
dialog->setWindowFlags(dialog->windowFlags()^Qt::WindowContextHelpButtonHint); |
|
|
|
dialog->setModal(true); |
|
|
|
|
|
|
|
selectedPort = dialog->getItem(nullptr, "Bitte ein Midi-Gerät auswählen:", "Midi-Geräte:", midiDevices, 0, true); |
|
|
|
for(i=0; i<portCount; i++) |
|
|
|
if(selectedPort==midiDevices.at(i)) return i; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
return 100; |
|
|
|
} |
|
|
|
|
|
|
|
|