Skip to content

Instantly share code, notes, and snippets.

@flyingrub
Last active December 22, 2015 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flyingrub/012441d8a4693aff15f6 to your computer and use it in GitHub Desktop.
Save flyingrub/012441d8a4693aff15f6 to your computer and use it in GitHub Desktop.
OfxMidi Errors
[notice ] ofxMidiIn: 3 ports available
[notice ] ofxMidiIn: 0: Midi Through 14:0
[notice ] ofxMidiIn: 1: Steinberg UR22 24:0
[notice ] ofxMidiIn: 2: TINYCONTROL 28:0
RtApiAlsa::getDeviceInfo: snd_pcm_open error for device (hw:2,0), Device or resource busy.
RtApiAlsa::getDeviceInfo: pcm device (hw:2,0) data format not supported by RtAudio.
[notice ] ofBaseSoundStream::printDeviceList:
[0] hw:HDA Intel HDMI,3 [in:0 out:8]
[1] hw:HDA Intel HDMI,7 [in:0 out:8]
[2] hw:HDA Intel HDMI,8 [in:0 out:8]
[3] hw:HDA Intel PCH,0 [in:2 out:2]
[4] [in:2 out:0]
[5] default [in:32 out:32]
RtApiAlsa::getDeviceInfo: snd_pcm_open error for device (hw:2,0), Device or resource busy.
RtApiAlsa::getDeviceInfo: pcm device (hw:2,0) data format not supported by RtAudio.
[Finished in 10.0s]
#include "Midi.h"
//--------------------------------------------------------------
Midi::Midi() {
// print input ports to console
midiIn.listPorts(); // via instance
//ofxMidiIn::listPorts(); // via static as well
// open port by number (you may need to change this)
midiIn.openPort(2);
//midiIn.openPort("IAC Pure Data In"); // by name
//midiIn.openVirtualPort("ofxMidiIn Input"); // open a virtual port
// don't ignore sysex, timing, & active sense messages,
// these are ignored by default
midiIn.ignoreTypes(false, false, false);
// add Midi as a listener
midiIn.addListener(this);
// print received messages to the console
midiIn.setVerbose(true);
}
//--------------------------------------------------------------
void Midi::exit() {
// clean up
midiIn.closePort();
midiIn.removeListener(this);
}
//--------------------------------------------------------------
void Midi::newMidiMessage(ofxMidiMessage& msg) {
// make a copy of the latest message
value = msg.value;
control = msg.control;
printf("%s\n", value);
}
#pragma once
#include "ofxMidi.h"
#include "ofMain.h"
class Midi : public ofxMidiListener {
public:
Midi();
void exit();
void newMidiMessage(ofxMidiMessage& eventArgs);
string value;
string control;
ofxMidiIn midiIn;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment