ofxMidi questions

is there something not complete with the ofxMidi addon? When I compiled the code, it says that there is issue linking with some code in coreMIDI i think. The error message that I got was:

cd /Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest
setenv MACOSX_DEPLOYMENT_TARGET 10.4
/Developer/usr/bin/g+±4.0 -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -L/Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/bin -L/Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/…/…/…/libs/freeimage/lib -L/Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/…/…/…/libs/fmodex/lib -L/Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/…/…/…/libs/freetype/lib -L/Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/…/…/…/libs/GLee/lib -L/Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/…/…/…/libs/poco/lib -L/Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/…/…/…/libs/rtAudio/lib -L/Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/…/…/…/addons/ofxCppGlue/libs/Poco/lib/osx -L/Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/…/…/…/addons/ofxCppGlue/libs/Poco/lib/osx -L/Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/…/…/…/addons/ofxCppGlue/libs/Poco/lib/osx -F/Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/bin -filelist /Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/build/openFrameworks.build/Debug/openFrameworks.build/Objects-normal/i386/openFrameworksDebug.LinkFileList -mmacosx-version-min=10.4 -Wl,-dead_strip /Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/…/…/…/libs/freeimage/lib/freeimage.a -lfmodex /Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/…/…/…/libs/freetype/lib/freetype.a /Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/…/…/…/libs/GLee/lib/GLee.a /Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/…/…/…/libs/rtAudio/lib/rtAudio.a -framework AGL -framework ApplicationServices -framework AudioToolbox -framework Carbon -framework CoreAudio -framework CoreFoundation -framework CoreServices -framework GLUT -framework OpenGL -framework QuickTime -lCppUnit -lPocoFoundation -lPocoNet -lPocoUtil -lPocoXML -o /Users/macbookpro/Documents/Programming/of_preRelease_v0.06_xcode_FAT/apps/proj/miditest/bin//openFrameworksDebug.app/Contents/MacOS/openFrameworksDebug
Undefined symbols:
“_MIDIEndpointGetEntity”, referenced from:
EndpointName(OpaqueMIDIEndpoint*, bool) in RtMidi.o
“_MIDIDeviceGetNumberOfEntities”, referenced from:
EndpointName(OpaqueMIDIEndpoint*, bool) in RtMidi.o
“_MIDIGetSource”, referenced from:
RtMidiIn::openPort(unsigned int, std::basic_string<char, std::char_traits, std::allocator >)in RtMidi.o
RtMidiIn::getPortName(unsigned int)in RtMidi.o
“_MIDIClientDispose”, referenced from:
RtMidiIn::openPort(unsigned int, std::basic_string<char, std::char_traits, std::allocator >)in RtMidi.o
RtMidiIn::openPort(unsigned int, std::basic_string<char, std::char_traits, std::allocator >)in RtMidi.o
RtMidiIn::openPort(unsigned int, std::basic_string<char, std::char_traits, std::allocator >)in RtMidi.o
RtMidiIn::~RtMidiIn()in RtMidi.o
RtMidiIn::~RtMidiIn()in RtMidi.o
“_MIDIEntityGetDevice”, referenced from:
EndpointName(OpaqueMIDIEndpoint*, bool) in RtMidi.o
“_MIDIEndpointDispose”, referenced from:
RtMidiIn::~RtMidiIn()in RtMidi.o
RtMidiIn::~RtMidiIn()in RtMidi.o
“_kMIDIPropertyName”, referenced from:
_kMIDIPropertyName$non_lazy_ptr in RtMidi.o
“_MIDIObjectGetStringProperty”, referenced from:
EndpointName(OpaqueMIDIEndpoint*, bool) in RtMidi.o
EndpointName(OpaqueMIDIEndpoint*, bool) in RtMidi.o
EndpointName(OpaqueMIDIEndpoint*, bool) in RtMidi.o
ConnectedEndpointName(OpaqueMIDIEndpoint*) in RtMidi.o
“_MIDIDestinationCreate”, referenced from:
RtMidiIn::openVirtualPort(std::basic_string<char, std::char_traits, std::allocator >)in RtMidi.o
“_MIDIInputPortCreate”, referenced from:
RtMidiIn::openPort(unsigned int, std::basic_string<char, std::char_traits, std::allocator >)in RtMidi.o
“_MIDIObjectGetDataProperty”, referenced from:
ConnectedEndpointName(OpaqueMIDIEndpoint*) in RtMidi.o
“_MIDIClientCreate”, referenced from:
RtMidiIn::initialize(std::basic_string<char, std::char_traits, std::allocator > const&)in RtMidi.o
“_MIDIGetNumberOfSources”, referenced from:
RtMidiIn::openPort(unsigned int, std::basic_string<char, std::char_traits, std::allocator >)in RtMidi.o
RtMidiIn::getPortCount() in RtMidi.o
RtMidiIn::getPortName(unsigned int)in RtMidi.o
“_MIDIPortDispose”, referenced from:
RtMidiIn::openPort(unsigned int, std::basic_string<char, std::char_traits, std::allocator >)in RtMidi.o
RtMidiIn::openPort(unsigned int, std::basic_string<char, std::char_traits, std::allocator >)in RtMidi.o
RtMidiIn::closePort() in RtMidi.o
“_MIDIObjectFindByUniqueID”, referenced from:
ConnectedEndpointName(OpaqueMIDIEndpoint*) in RtMidi.o
“_kMIDIPropertyConnectionUniqueID”, referenced from:
_kMIDIPropertyConnectionUniqueID$non_lazy_ptr in RtMidi.o
“_MIDIPortConnectSource”, referenced from:
RtMidiIn::openPort(unsigned int, std::basic_string<char, std::char_traits, std::allocator >)in RtMidi.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I checked that xcode was able to link up with coreMIDI and load up the definition for me. So I am not sure what I am doing wrong when compiling the code.

Any advice would be great.

do you have the latest version?

http://addons.openframeworks.cc/version-…-ment-id=56

rtMidi has some platform dependent ifdefs that you needed to manually define in previous versions, in the latest one this should be solved.

yea. i am using the latest code. I just downloaded the addon today.

Have you added CoreMIDI.framework to your project? It your code is compiling but not linking. To add CoreMIDI.framework to your project, right click on the icon at the top of the “Groups & Files” section on the left, Add > Existing Frameworks… Navigate to /System/Library/Frameworks/CoreMIDI.framework

Hope that helps!

oo… that is exactly what i was missing… Thanks.

I am trying to write a class that would listen to my midi controller pad. However, I have not been very successful. Is there any example of how to implement the entire ofxMidiIn class to a point where I can listen to the midi coming in?

Yes, there’s a file called ofxMidiEvents.h. I haven’t used it, but it should be pretty straight forward. You need to add ofxMidiListener as a superclass of your testApp, then implement newMidiMessage() as defined in ofxMidiEvents.h, then have an ofxMidiIn object (say, called midiIn) in your testApp and in your setup you have to do midiIn.addListener(this); Then newMidiMessage() will be called every time you get a new midi message, where you can read the raw bytes of the midi message.

thanks for the info.

I have also found this update on another post.
http://forum.openframeworks.cc/t/ofxmidi-updates/2435/12">ofxMidi updates]http://forum.openframeworks.cc/t/ofxmidi-updates/2435/12

just in case anyone is reading this and have trouble understanding what actually needs to be done.