summaryrefslogtreecommitdiff
path: root/liveengine/src
diff options
context:
space:
mode:
Diffstat (limited to 'liveengine/src')
-rwxr-xr-xliveengine/src/testApp.cpp38
-rwxr-xr-xliveengine/src/testApp.h69
2 files changed, 92 insertions, 15 deletions
diff --git a/liveengine/src/testApp.cpp b/liveengine/src/testApp.cpp
index 9ecb92f..86bbad6 100755
--- a/liveengine/src/testApp.cpp
+++ b/liveengine/src/testApp.cpp
@@ -54,7 +54,18 @@ void testApp::setup(){
// midiIn.addListener(84,this);
// to debug
- // midiIn.setVerbose(true);
+ // midiIn.setVerbose(true);
+
+ controllers=new unsigned char[NUM_CONTROLLERS];
+ memset(controllers,NUM_CONTROLLERS,0);
+ note=START_NOTE;
+
+ controller_colours=new ofColor[NUM_CONTROLLERS];
+ for (int i=0;i<NUM_CONTROLLERS;i++) controller_colours[i]=ofColor::fromHsb(ofRandom(255), 255, 255);
+
+ grab.allocate(ofGetWidth(), ofGetHeight(),OF_IMAGE_COLOR);
+ grab.setUseTexture(true);
+
showFPS=false;
}
@@ -65,10 +76,21 @@ void testApp::update(){
//--------------------------------------------------------------
void testApp::draw(){
- ofBackground(0,0,0);
+ grab.grabScreen( 0, 0, ofGetWidth(), ofGetHeight() );
+ grab.update();
+ ofBackground(0,0,0);
+ grab.draw( 1,1,ofGetWidth(), ofGetHeight());
+
+ float notewidth=ofGetWidth()/NUM_NOTES;
+ float noteheight=ofGetHeight()/NUM_CONTROLLERS;
+
+ for (int i=0;i<NUM_CONTROLLERS;i++){
+ ofSetColor(ofColor((controller_colours[i].r*controllers[i])>>7,(controller_colours[i].g*controllers[i])>>7,(controller_colours[i].b*controllers[i])>>7));
+ ofRect(note*notewidth,i*noteheight,notewidth,noteheight);
+ }
//for (int i=0;i<numLayers;i++) layers[i]->draw();
-
+ ofSetColor(255,255,255);
if (showFPS) ofDrawBitmapString(ofToString(ofGetFrameRate(), 2),20,20);
}
@@ -147,18 +169,20 @@ void testApp::newMidiMessage(ofxMidiEventArgs& eventArgs){
if ((midiChannel==0)||(eventArgs.channel==midiChannel)) {
switch(eventArgs.status) {
- case 144: //noteon-off
+ case 144: //noteon-off channel 0
noteOn=(eventArgs.byteTwo==0?false:true);
//for (int i=0;i<numLayers;i++){
// if (layers[i]->note==eventArgs.byteOne) layers[i]->setActive(noteOn);
//}
- printf("note: %i %i\n",eventArgs.byteOne,eventArgs.byteTwo);
+ printf("note: %i %i\n",eventArgs.byteOne,eventArgs.byteTwo);
+ note=eventArgs.byteOne-START_NOTE;
break;
- case 176: //control change
+ case 176: //control change channel 0
//for (int i=0;i<numLayers;i++){
// if (layers[i]->mix==eventArgs.byteOne) layers[i]->setMixAmt(((float)eventArgs.byteTwo)/127.0f);
//}
- printf("cc: %i %i\ n",eventArgs.byteOne,eventArgs.byteTwo);
+ printf("cc: %i %i\n",eventArgs.byteOne,eventArgs.byteTwo);
+ controllers[eventArgs.byteOne-START_CONTROLLER]=eventArgs.byteTwo;
}
}
}
diff --git a/liveengine/src/testApp.h b/liveengine/src/testApp.h
index 9b07764..e4bb2bc 100755
--- a/liveengine/src/testApp.h
+++ b/liveengine/src/testApp.h
@@ -1,10 +1,55 @@
#pragma once
#include "ofMain.h"
-#include "ofxXmlSettings.h"
-
-#define OF_ADDON_USING_OFXMIDIIN
-
+#include "ofxXmlSettings.h"
+
+/*
+modprobe snd-virmidi
+have had problems with it not being recognised - rebuild seemed to fix it
+
+
+6 controllers
+each note switches in 6 new visuals which are at the same strengths
+as the previous bunch
+
+is it necessary to represent them seperately?
+
+maybe take them all in, but initially modulate one picture on the strength of the strongest
+
+maybe each object is a plugin and the 6 controllers affect 6 parameters of it
+ie speed, matting type, colour tweak
+
+object that plays when a note is received can be called a track, a sample, a bank, a layer?
+
+object remembers playback head/ heads
+
+initial footage set for each track: program change?
+(does this leave any room for creative input) or set via gui?
+
+creative input - alter layers live via AVS compatible system which also allows local MIDI control,
+scripting, manipulating layers etc
+
+probably pretty tricky to create a .ape loader - difficulty in recreating the windows GUI
+
+probably a lot easier to think about a way of making a modular editor that can be manipulated live
+nice to think about making scripted layers - using nseel or other
+
+initially - divide screen into grid - play notes with fade
+
+
+
+*/
+
+
+
+#define OF_ADDON_USING_OFXMIDIIN
+
+#define NUM_NOTES 64
+#define START_NOTE 36
+#define NUM_CONTROLLERS 6
+#define START_CONTROLLER 102
+
+
#include "ofxMidi.h"
class testApp : public ofBaseApp, public ofxMidiListener{
@@ -28,10 +73,18 @@ class testApp : public ofBaseApp, public ofxMidiListener{
void toggleFPS();
bool showFPS;
- ofxXmlSettings XML;
-
- int midiChannel;
- ofxMidiIn midiIn;
+ ofxXmlSettings XML;
+
+ unsigned char* controllers;
+ unsigned char note;
+ ofColor* controller_colours;
+
+ ofImage grab;
+
+ int midiChannel;
+
+ ofxMidiIn midiIn;
+
void newMidiMessage(ofxMidiEventArgs& eventArgs);
};