Author Message

<  extend  ~  ofxMidi updates

PostPosted: Wed Aug 12, 2009 10:20 am
Site AdminJoined: Fri Mar 02, 2007 9:06 amPosts: 419Location: 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?



_________________
http://www.chrisoshea.org
Offline Profile
PostPosted: Wed Aug 12, 2009 11:11 am
Joined: Sat May 09, 2009 5:56 pmPosts: 5Location: 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.


Offline Profile
PostPosted: Wed Aug 12, 2009 3:18 pm
Joined: Fri Jun 27, 2008 4:49 amPosts: 329Location: Troy, New York
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#compiling

I'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.


Offline Profile
PostPosted: Wed Aug 12, 2009 3:32 pm
Site AdminJoined: Fri Mar 02, 2007 9:06 amPosts: 419Location: London
it would be great if anyone on mac could try the file i posted at the top and see if it compiles.



_________________
http://www.chrisoshea.org
Offline Profile
PostPosted: Wed Aug 12, 2009 9:11 pm
User avatarJoined: Thu May 31, 2007 2:32 pmPosts: 215Location: 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.



_________________
http://thefactoryfactory.com
Offline Profile
PostPosted: Thu Aug 13, 2009 10:40 am
User avatarJoined: Mon May 14, 2007 10:57 amPosts: 531Location: Prague, Czech Republic
I've successfully used PortMidi before for Midi in if that's of any interest:
http://portmedia.sourceforge.net/
Could be an alternative...



_________________
Pierre Proske - www.digitalstar.net
Offline Profile
PostPosted: Thu Aug 13, 2009 1:57 pm
User avatarJoined: Thu May 31, 2007 2:32 pmPosts: 215Location: 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.



_________________
http://thefactoryfactory.com
Offline Profile
PostPosted: Thu Aug 13, 2009 2:12 pm
Joined: Sun Aug 09, 2009 11:14 amPosts: 9Location: 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


Offline Profile
PostPosted: 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.


Offline Profile
PostPosted: Tue Sep 08, 2009 3:59 am
User avatarJoined: Mon Jan 19, 2009 7:02 amPosts: 144Location: 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.



_________________
http://julapy.com/blog
Offline Profile
PostPosted: Tue Sep 08, 2009 6:33 pm
Joined: Thu Oct 11, 2007 11:05 pmPosts: 4Location: San Francisco, CA
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.


Offline Profile
PostPosted: Wed Sep 09, 2009 1:38 pm
User avatarJoined: Mon Jan 19, 2009 7:02 amPosts: 144Location: sydney
good job, that worked!
thx, L.



_________________
http://julapy.com/blog
Offline Profile

Display posts from previous:  Sort by:

All times are UTC
Page 1 of 1
12 posts
Users browsing this forum: No registered users and 2 guests
Search for:
Post new topic  Reply to topic
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum