Newbie having difficulties with Processing app! Help much appreciated :)
in
Integration and Hardware
•
2 years ago
Hi guys,
I am new to using Processing and I am using it for my final year project at college. I'm developing piano tutorial software using Java/ Processing/ MIDI within the Eclipse IDE. I am having quite a few problems with some things, and still haven't resolved them after reading a lot of online resources, so I thought I'd try asking here :) Ok, here is a list of things that I can't figure out, and if anyone can help I'd be really grateful:
1. I currently have a Processing applet which represents a virtual piano. This Piano PApplet needs to be embedded into another PApplet if possible... I have tried this already, and it 'works' in a sense, but the graphics are freezing/ being temperamental. Below is code in setup() of a Lesson PApplet which adds the Piano PApplet to a JPanel (Swing), and the JPanel is then added to the current PApplet. I know this is probably a terrible approach, but I couldn't figure out another way to do it... Do I need to use threads- main thread to handle piano display & functionality, and another thread to handle displaying general lesson content?
3. The computer keyboard is used to play the virtual piano. When the user presses a computer key, the relevant piano key is highlighted in colour and should then return to its original colour upon the release of the key. I have written the code in keyPressed() and keyReleased() in such a way that it does work, but the key does not stay highlighted for long enough (just a flicker). Or sometimes, if you press it for too long, it seems to infinitely loop! Is this to do with the loop()/ noLoop() thing I've read about? Problem is, I need draw() to keep looping to keep checking for both 'button' click and keyPressed() events... Help! :(
4. Loading one PApplet from another? My software has a lot of 'pages'/ windows... Do I have to use JFrames or is there actually a way to do it without embedding all of the PApplets into Swing containers?
Anyway, if anyone has any suggestions, please feel free to tell me :) If you need any more information/ more source code, etc. let me know. Thanks :)
I am new to using Processing and I am using it for my final year project at college. I'm developing piano tutorial software using Java/ Processing/ MIDI within the Eclipse IDE. I am having quite a few problems with some things, and still haven't resolved them after reading a lot of online resources, so I thought I'd try asking here :) Ok, here is a list of things that I can't figure out, and if anyone can help I'd be really grateful:
1. I currently have a Processing applet which represents a virtual piano. This Piano PApplet needs to be embedded into another PApplet if possible... I have tried this already, and it 'works' in a sense, but the graphics are freezing/ being temperamental. Below is code in setup() of a Lesson PApplet which adds the Piano PApplet to a JPanel (Swing), and the JPanel is then added to the current PApplet. I know this is probably a terrible approach, but I couldn't figure out another way to do it... Do I need to use threads- main thread to handle piano display & functionality, and another thread to handle displaying general lesson content?
- piano.init();
panel.setBounds(0, height-270, width, 270);
panel.add(piano);
this.add(panel);
3. The computer keyboard is used to play the virtual piano. When the user presses a computer key, the relevant piano key is highlighted in colour and should then return to its original colour upon the release of the key. I have written the code in keyPressed() and keyReleased() in such a way that it does work, but the key does not stay highlighted for long enough (just a flicker). Or sometimes, if you press it for too long, it seems to infinitely loop! Is this to do with the loop()/ noLoop() thing I've read about? Problem is, I need draw() to keep looping to keep checking for both 'button' click and keyPressed() events... Help! :(
4. Loading one PApplet from another? My software has a lot of 'pages'/ windows... Do I have to use JFrames or is there actually a way to do it without embedding all of the PApplets into Swing containers?
Anyway, if anyone has any suggestions, please feel free to tell me :) If you need any more information/ more source code, etc. let me know. Thanks :)
1