We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › eclipse promidi integration problem
Page Index Toggle Pages: 1
eclipse promidi integration problem (Read 822 times)
eclipse promidi integration problem
Oct 21st, 2008, 8:30pm
 
Hello

I'm new to eclipse and java and am (improving both by) working on building midi sensitive processing apps to work with logic etc.

I setup the environment fine (10.5.5, processing 0152, mandolane, eclipse SDK 3.4.1, JRE 1.5.0_16-b06-284, version 1.5.0_16, jvm 1.5.0_16-133).

The PDE runs the promidi_plug fine, the warning from the unregistered (as yet) mandolane comes up, get's ok'd and my PDE window allows response from my a33 midi controller through my NI Kontrol interface fine.

Trouble is, I took the code and brought it into eclipse and although it finds the interfaces fine it looks like I've got an internal reference problem between the plug object and the class methods cos all I get is the applet window with the grey bg:

Code:

import processing.core.*;
import promidi.*;

public class promidiTstIO extends PApplet{

/**
*
*/
private static final long serialVersionUID = 1L;

MidiIO midiIO;

public void setup(){
size(128*5,128*5);
smooth();
background(50);

// get an instance of midiIO
midiIO = MidiIO.getInstance(this);

// print a list of all devices
midiIO.printDevices();

// plug all methods to handle midievents
midiIO.plug(this,"noteOn",0,1);
midiIO.plug(this,"noteOff",0,1);
//midiIO.plug(this,"controllerIn",0,1);
//midiIO.plug(this,"programChange",0,1);

println("hello");
}

public void draw(){

}

public void noteOn(Note note){
int vel = note.getVelocity();
int pit = note.getPitch();
println("<NOTE IN!>");
fill(255,vel*2,pit*2,vel*2);
stroke(255,vel);
ellipse(vel*5,pit*5,30,30);
}

public void noteOff(Note note){
int pit = note.getPitch();

fill(255,pit*2,pit*2,pit*2);
stroke(255,pit);
ellipse(pit*5,pit*5,30,30);
}
}


Code:

<< inputs: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
input 0 : In <MIn:0>
input 1 : VirtualIn <MIn:1>
input 2 : IAC Bus 1 <MIn:2>
<< outputs: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
output 0 : Out <MOut:0>
output 1 : VirtualOut <MOut:1>
output 2 : IAC Bus 1 <MOut:2>
output 3 : Java Sound Synthesizer
<<>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
hello


I'm doing something easy to fix, I'm sure, just not sure what I need to do.  I've got some big ideas, so will be using eclipse more and more.  Any help greatly appreciated.

s
Re: eclipse promidi integration problem
Reply #1 - Oct 24th, 2008, 1:48am
 
Ok, I've fixed the problem, and the best way to describe it is to examine the difference between the problem code and this code.  Not a lot of differences but hopefully it might help someone in the same problem that I was.

Couple of notes.
1. I referred back to getting promidi_plug working with my setup, rather than a simple copy of the code imported into eclipse.
2. Instead of cutting and pasting the code, importing and exported version of the code from within the PDE was crucial as it included all the references to the included libraries as processing appears to wrap up all it needs when you export a sketch.  This is useful as a starting point when working in eclipse.
3. For some reason although MIDI mon says channel 1 coming in, the code needs channel 0 specified in the code (RWMidi here I come?).
4. You are recommended to specify an arbitrary package name in eclipse (I called mine prom).
5. I cut some code out for program Change and controller functions which I've left in this example for copy/paste completeness.


Code:

package prom;

import processing.core.*;
import processing.xml.*;

import promidi.*;

import java.applet.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import java.util.zip.*;
import java.util.regex.*;

public class promidi_plug extends PApplet {

     MidiIO midiIO;

     public void setup(){
           size(128*5,128*5);
           smooth();
           background(0);

           // get an instance of midiIO
           midiIO = MidiIO.getInstance(this);

           // print a list of all devices
           midiIO.printDevices();

           // plug all methods to handle midievents
           // note last 2 arguments are 0, 0 even though midi mon says ch1!
           midiIO.plug(this,"noteOn",0,0);
           midiIO.plug(this,"noteOff",0,0);
           midiIO.plug(this,"controllerIn",0,0);
           midiIO.plug(this,"programChange",0,0);
     }

     public void draw(){

     }

     public void noteOn(Note note){
           int vel = note.getVelocity();
           int pit = note.getPitch();

           fill(255,vel*2,pit*2,vel*2);
           stroke(255,vel);
           ellipse(vel*5,pit*5,30,30);
     }

     public void noteOff(Note note){
           int pit = note.getPitch();

           fill(255,pit*2,pit*2,pit*2);
           stroke(255,pit);
           ellipse(pit*5,pit*5,30,30);
     }

     public void controllerIn(Controller controller){
           int num = controller.getNumber();
           int val = controller.getValue();

           fill(255,num*2,val*2,num*2);
           stroke(255,num);
           ellipse(num*5,val*5,30,30);
     }

     public void programChange(ProgramChange programChange){
           int num = programChange.getNumber();

           fill(255,num*2,num*2,num*2);
           stroke(255,num);
           ellipse(num*5,num*5,30,30);
     }

     static public void main(String args[]) {
           PApplet.main(new String[] { "promidi_plug" });
     }
}




s.
Re: eclipse promidi integration problem
Reply #2 - Nov 3rd, 2008, 11:58pm
 
Just noticed a load of imported libraries you'll not need - eclipse will tell you which ones.
Page Index Toggle Pages: 1