We are about to switch to a new forum software. Until then we have removed the registration on this forum.
What I'm trying to make:
I have app, that works as I wanted on Processing display. But what I see on Syphon incoming signal [in other app] is missing these images. I think it might be connected to way that I display these images.
Here is how it looks like in Processing app:
https://www.monosnap.com/image/HN8crWfkUpJvc5CZnFFrFRTgZ
Here is how it looks in Syphon (no change from initial state):
https://www.monosnap.com/image/Mq4RujuW3uQlYeAq4uGVn8JbY
Here is my code:
PImage img;
import themidibus.*; //Import the library
MidiBus myBus; // The MidiBus
import codeanticode.syphon.*;
PGraphics canvas;
SyphonServer server;
int notes = 13; // number of masks
int firstNotePitch = 24; // shifting notes to take C0
int knobsNum = 8;
PImage pi[] = new PImage[notes];
boolean notesOn[] = new boolean[100];
float knobValues[] = new float[knobsNum+1];
void setup() {
MidiBus.list(); // List all available Midi devices on STDOUT. This will show each device's index and name.
myBus = new MidiBus(this, 0, 2); // Create a new MidiBus using the device index to select the Midi input and output devices respectively.
size(1280, 720, P3D);
canvas = createGraphics(1280, 720, P3D);
for(int i=0; i<notes; i++) {
pi[i] = loadImage("mask"+i+".png");
}
frameRate(30);
// Create syphon server to send frames out.
server = new SyphonServer(this, "MIDI masks2");
}
// I BELIEVE THAT MY PROBLEMS ARE HERE
void draw() {
canvas.background(#ff9900);
for(int i=0; i<notes; i++) {
if (notesOn[i]) {
image(pi[i], 0, 0);
}
}
server.sendImage(canvas);
}
void noteOn(int channel, int pitch, int velocity) {
println("Pitch:"+pitch);
int pitchShifted = pitch - firstNotePitch;
notesOn[pitchShifted] = true;
}
void noteOff(int channel, int pitch, int velocity) {
// Receive a noteOff
int pitchShifted = pitch - firstNotePitch;
notesOn[pitchShifted] = false;
}
void controllerChange(int channel, int number, int value) {
// Receive new value on knob modification
knobValues[number] = value/127.000;
}
I guess, that problem is the way I put images into scene. What is proper way to do that?
Thank you in advance!
Answers
solution is here http://forum.processing.org/two/discussion/comment/3810#Comment_3810
my final code is: PImage img; import themidibus.*; //Import the library MidiBus myBus; // The MidiBus
and class SDF in separate file