| Author |
Message |
< extend ~ ofxMidi updates |
|
chrisoshea
|
Posted: Wed Aug 12, 2009 10:20 am |
|
|
| Site AdminJoined: Fri Mar 02, 2007 9:06 amPosts: 444Location: London |
Atruro posted an ofxMidiIn addon in this thread based on rtMidi and pcoo events. I've joined him the development, adding midi out & multiple message types over different channels. My latest file is here... http://addons.openframeworks.cc/project ... /ofxmidiin(still a few bugs and fixes to do) I've used input and output successfully on windows for this installation running all day with 6 midi channels and large volumes of data. I've just seen this thread from CongoZombie & kylemcdonald using Core Midi. Whats the difference in using Core Midi over rtMidi? Are there platform specific problems with rtMidi? Whats the status of this addon? For the sake of simplicity for new users, maybe we should make one global ofxMidi addon that works with everything. Thoughts?
|
|
Top
|
|
|
evanbbb
|
Posted: Wed Aug 12, 2009 11:11 am |
|
|
| Joined: Sat May 09, 2009 5:56 pmPosts: 8Location: London |
On a project about two months ago, I couldn't get ofxMidi to work on either a mac or an XP machine. Switched to rtMidi and worked a treat (although I didn't implement the callback function). I did have a few threading issues when using it in conjunction with the video player but got around it evenutally (something conflicting with poco if I recall).
It would be really nice to have a proper ofxMidi or at least a midi->osc convertor.
|
|
Top
|
|
|
kylemcdonald
|
Posted: Wed Aug 12, 2009 3:18 pm |
|
|
| Joined: Fri Jun 27, 2008 4:49 amPosts: 453Location: Brooklyn |
Global ofxMidi addon that is multi-platform and handles i/o: yes, this would be great. The ofxMidi I contributed to was meant as a step in this direction, but it stopped at Windows and OSX output. (Arturo developed midi input independently of it). RtMidi uses CoreAudio on OSX http://www.music.mcgill.ca/~gary/rtmidi/index.html#compilingI'm against RtMidi right now, just because I couldn't get it working when I needed it. But it seems like it's the best solution, as it's multi-platform. We'd just need to wrap it and figure out any tricks for getting compiled. It might just be a case where we need to create an example project for different IDEs rather than trying to walk people through the same setup steps each time.
|
|
Top
|
|
|
chrisoshea
|
Posted: Wed Aug 12, 2009 3:32 pm |
|
|
| Site AdminJoined: Fri Mar 02, 2007 9:06 amPosts: 444Location: London |
it would be great if anyone on mac could try the file i posted at the top and see if it compiles.
|
|
Top
|
|
|
joshuajnoble
|
Posted: Wed Aug 12, 2009 9:11 pm |
|
|
Joined: Thu May 31, 2007 2:32 pmPosts: 292Location: PDX |
Works happily for me on OSX. I'd try on Linux but that laptop is already stuck in a box, I'll check it tomorrow when I unpack.
|
|
Top
|
|
|
grimus
|
Posted: Thu Aug 13, 2009 10:40 am |
|
|
Joined: Mon May 14, 2007 10:57 amPosts: 720Location: Melbourne, Australia |
|
|
Top
|
|
|
joshuajnoble
|
Posted: Thu Aug 13, 2009 1:57 pm |
|
|
Joined: Thu May 31, 2007 2:32 pmPosts: 292Location: PDX |
Not to hijack the thread, but I'm curious what kinds of problems people have run into with rtAudio. I should check out portaudio I think, looks quite interesting.
|
|
Top
|
|
|
bernard
|
Posted: Thu Aug 13, 2009 2:12 pm |
|
|
| Joined: Sun Aug 09, 2009 11:14 amPosts: 34Location: Strasbourg / France |
> it would be great if anyone on mac could try the file i posted at the top and see if it compiles.
It works perfectly on my mac/Tiger (input and output)
Great job done ! Bernard
|
|
Top
|
|
|
hrm
|
Posted: Sat Sep 05, 2009 9:37 am |
|
|
| Joined: Fri May 29, 2009 11:51 amPosts: 7 |
I've tried to use ofxMidi on Windows with CodeBlocks, but I keep getting these errors:
obj\release\addons\ofxMidi\src\ofxMidiIn.o:ofxMidiIn.cpp:(.text+0x5e)||undefined reference to `RtMidiIn::openPort(unsigned int)'| obj\release\addons\ofxMidi\src\ofxMidiIn.o:ofxMidiIn.cpp:(.text+0x307b)||undefined reference to `RtMidiIn::RtMidiIn()'| obj\release\addons\ofxMidi\src\ofxMidiIn.o:ofxMidiIn.cpp:(.text+0x392b)||undefined reference to `RtMidiIn::RtMidiIn()'| obj\release\addons\ofxMidi\src\ofxMidiOut.o:ofxMidiOut.cpp:(.text+0x7b9)||undefined reference to `RtMidiOut::RtMidiOut()'| obj\release\addons\ofxMidi\src\ofxMidiOut.o:ofxMidiOut.cpp:(.text+0x9c9)||undefined reference to `RtMidiOut::RtMidiOut()'| obj\release\addons\ofxMidi\src\ofxMidiOut.o:ofxMidiOut.cpp:(.text+0x43)||undefined reference to `RtMidiOut::openPort(unsigned int)'|
Though I've added all ofxMidi files to my project and added the search directories too.
|
|
Top
|
|
|
julapy
|
Posted: Tue Sep 08, 2009 3:59 am |
|
|
Joined: Mon Jan 19, 2009 7:02 amPosts: 214Location: sydney |
hi, also having a lil touble compiling on mac. using the latest 0.02 download from the addons page although there was no example, so took the example source from 0.01
getting the following error:
error: cannot allocate an object of abstract type 'testApp' note: because the following virtual functions are pure within 'testApp': note: virtual void ofxMidiListener::newMidiMessage(ofxMidiEventArgs&)
the example was for 005 so probably some small change is making it freak out in 006.
anyone have it working in 006 on mac?
L.
|
|
Top
|
|
|
mikecreighton
|
Posted: Tue Sep 08, 2009 6:33 pm |
|
|
| Joined: Thu Oct 11, 2007 11:05 pmPosts: 6Location: Portland, OR |
So, I just tried my hand at compiling this latest 0.02 version of ofxMidi on Mac OS 10.5.8. Here's how I got it to work: First, before anything, make sure you've added both the ofxMidi addon's source to your project and that you've added CoreMIDI.Framework to your project as well ( you can find how to do that here.). Next, I made a class to act as my listener. I just got an M-Audio X-Session Pro controller and wanted to hook it up to my project. You'll want to make a class of your own. We'll pretend it's called MyMidiListener. You'll stick the .h and .cpp files in your project's src folder. First the header file (called MyMidiListener.h): Code: #pragma once #include "ofxMidi.h"
class MyMidiListener : public ofxMidiListener { public: MyMidiListener(); ~MyMidiListener(); void newMidiMessage(ofxMidiEventArgs& eventArgs); };
And now the actual cpp file (called MyMidiListener.cpp): Code: #include "MyMidiListener.h"
// Constructor MyMidiListener::MyMidiListener(){ }
// Destructor MyMidiListener::~MyMidiListener(){ }
// Method that receives MIDI event messages. void MyMidiListener::newMidiMessage(ofxMidiEventArgs& eventArgs){ cout << "byteOne = " << eventArgs.byteOne << endl; cout << "byteTwo[" << eventArgs. byteTwo << endl;
// Do the stuff you need to do with // the ofxMidiEventArgs instance. }
Now in your testapp.h header file, you'll need to declare a couple member variables. One for the ofxMidiIn instance, and one for the MyMidiListener instance. Make sure you have the #include directives at the top of your header file for both "ofxMidi.h" and "MyMidiListener.h". Code: ofxMidiIn midiIn; MyMidiListener midiListener;
Now in your testapp.cpp file, in the setup() method, add these lines: Code: // This outputs the various ports // and their respective IDs. midiIn.listPorts();
// Now open a port to whatever // port ID your MIDI controller is on. midiIn.openPort(0);
// Add your MyMidiListener instance // as a listener. midiIn.addListener(&midiListener);
Now, when your computer receives MIDI events, your listener's newMidiMessage method will get called. You can (and should) add some additional methods to your MyMidiListener class so that your main testapp application can actually get data from it.
|
|
Top
|
|
|
julapy
|
Posted: Wed Sep 09, 2009 1:38 pm |
|
|
Joined: Mon Jan 19, 2009 7:02 amPosts: 214Location: sydney |
good job, that worked! thx, L.
|
|
Top
|
|
|
synthetic_karma
|
Posted: Thu Feb 25, 2010 8:02 pm |
|
|
| Joined: Mon Feb 01, 2010 9:00 pmPosts: 11 |
mikecreighton wrote: So, I just tried my hand at compiling this latest 0.02 version of ofxMidi on Mac OS 10.5.8. Here's how I got it to work:
...
Now, when your computer receives MIDI events, your listener's newMidiMessage method will get called. You can (and should) add some additional methods to your MyMidiListener class so that your main testapp application can actually get data from it. Thanks for these instructions. It seems to work (im getting a list of available devices printed in the console), but Im kinda clueless what I have to do now (sorry, kinda new to this thingy  ). What kind of methods should I add? Im eager at getting mididCC messages in from one of my controllers. I tried some things but nothing worked yet... Would be nice to have some kind of working example with this actually, because now its a bit unclear how to get this working if your just beginning with oF like me..
|
|
Top
|
|
|
synthetic_karma
|
Posted: Thu Apr 08, 2010 11:33 am |
|
|
| Joined: Mon Feb 01, 2010 9:00 pmPosts: 11 |
Yay, its working! After another few attempts suddenly I got incoming midi data printed to the console (haven't got a clue why that didn't happen in the first place), and after some more days of breaking my head I figured out how to add the necessary methods for using the incoming data in my program (so now I know how to do that in general too  ).
|
|
Top
|
|
|
|