1234567891011121314151617181920212223242526272829303132333435 |
- #include "MidiListener.h"
- #include <vector>
- #include <QString>
- void MidiListener::start(int Port){
- midiin = new RtMidiIn(RtMidi::Api::LINUX_ALSA, "Scrjabin");
-
- try {
- midiin->openPort(Port);
- }
- catch ( RtMidiError &error ) {
- error.printMessage();
- }
- emit newMidiMessage(0,0,0);
-
- };
- void MidiListener::listen(){
- std::vector<unsigned char> message;
-
- // Don't ignore sysex, timing, or active sensing messages.
- midiin->ignoreTypes( false, false, false );
-
- midiin->getMessage( &message );
- if ( message.size() == 3 )
- emit newMidiMessage(message[0], message[1], message[2]);
- else
- emit newMidiMessage(0,0,0);
- };
- void MidiListener::stop(){
- delete midiin;
- this->disconnect();
- this->~MidiListener();
- }
- MidiListener::~MidiListener(){
-
- }
|