From ee9819390008b29ee2cfc1bc45fac3e3b1530529 Mon Sep 17 00:00:00 2001 From: tim Date: Fri, 18 Apr 2014 03:15:31 +0100 Subject: phew --- liveengineUnmapped/bin/data/american_football.xml | 68 -------- liveengineUnmapped/bin/data/barcelona.xml | 40 ----- liveengineUnmapped/bin/data/belgard-img.xml | 32 ---- liveengineUnmapped/bin/data/belgard-imgseq.xml | 16 -- liveengineUnmapped/bin/data/belgard.xml | 16 -- liveengineUnmapped/bin/data/birds.xml | 68 -------- liveengineUnmapped/bin/data/computers.xml | 68 -------- liveengineUnmapped/bin/data/crests.xml | 68 -------- liveengineUnmapped/bin/data/cricket.xml | 68 -------- liveengineUnmapped/bin/data/dancing.xml | 68 -------- liveengineUnmapped/bin/data/food.xml | 68 -------- liveengineUnmapped/bin/data/glissando-01.xml | 4 - .../bin/data/glissando-02-funfair.xml | 4 - liveengineUnmapped/bin/data/glissando-03-ars.xml | 4 - liveengineUnmapped/bin/data/glissando-04-trees.xml | 4 - .../bin/data/glissando-05-sunsets.xml | 4 - .../bin/data/glissando-06-cranes.xml | 4 - liveengineUnmapped/bin/data/insects.xml | 67 -------- liveengineUnmapped/bin/data/licking_power.xml | 68 -------- liveengineUnmapped/bin/data/mil_historic.xml | 68 -------- liveengineUnmapped/bin/data/mil_knights.xml | 68 -------- liveengineUnmapped/bin/data/military_ethnic.xml | 68 -------- liveengineUnmapped/bin/data/military_ladies.xml | 68 -------- liveengineUnmapped/bin/data/organs.xml | 68 -------- liveengineUnmapped/bin/data/panel.xml | 4 - liveengineUnmapped/bin/data/recreation_indoor.xml | 68 -------- liveengineUnmapped/bin/data/renaissance.xml | 5 - liveengineUnmapped/bin/data/reptiles.xml | 68 -------- liveengineUnmapped/bin/data/tai_chi.xml | 67 -------- liveengineUnmapped/bin/data/teamsports.xml | 67 -------- liveengineUnmapped/bin/data/teamsports1.xml | 67 -------- liveengineUnmapped/bin/data/tools.xml | 68 -------- liveengineUnmapped/bin/data/trainers.xml | 68 -------- liveengineUnmapped/bin/data/women_ethnic.xml | 68 -------- liveengineUnmapped/bin/data/women_historical.xml | 68 -------- liveengineUnmapped/bin/data/yoga.xml | 68 -------- liveengineUnmapped/src/layers.cpp | 152 +++++++++--------- liveengineUnmapped/src/layers.h | 97 ++++++------ liveengineUnmapped/src/playlist.cpp | 76 ++++----- liveengineUnmapped/src/testApp.cpp | 173 +++------------------ liveengineUnmapped/src/testApp.h | 4 +- 41 files changed, 187 insertions(+), 2080 deletions(-) delete mode 100755 liveengineUnmapped/bin/data/american_football.xml delete mode 100755 liveengineUnmapped/bin/data/barcelona.xml delete mode 100755 liveengineUnmapped/bin/data/belgard-img.xml delete mode 100755 liveengineUnmapped/bin/data/belgard-imgseq.xml delete mode 100755 liveengineUnmapped/bin/data/belgard.xml delete mode 100755 liveengineUnmapped/bin/data/birds.xml delete mode 100755 liveengineUnmapped/bin/data/computers.xml delete mode 100755 liveengineUnmapped/bin/data/crests.xml delete mode 100755 liveengineUnmapped/bin/data/cricket.xml delete mode 100755 liveengineUnmapped/bin/data/dancing.xml delete mode 100755 liveengineUnmapped/bin/data/food.xml delete mode 100755 liveengineUnmapped/bin/data/glissando-01.xml delete mode 100755 liveengineUnmapped/bin/data/glissando-02-funfair.xml delete mode 100755 liveengineUnmapped/bin/data/glissando-03-ars.xml delete mode 100755 liveengineUnmapped/bin/data/glissando-04-trees.xml delete mode 100755 liveengineUnmapped/bin/data/glissando-05-sunsets.xml delete mode 100755 liveengineUnmapped/bin/data/glissando-06-cranes.xml delete mode 100755 liveengineUnmapped/bin/data/insects.xml delete mode 100644 liveengineUnmapped/bin/data/licking_power.xml delete mode 100755 liveengineUnmapped/bin/data/mil_historic.xml delete mode 100755 liveengineUnmapped/bin/data/mil_knights.xml delete mode 100755 liveengineUnmapped/bin/data/military_ethnic.xml delete mode 100755 liveengineUnmapped/bin/data/military_ladies.xml delete mode 100755 liveengineUnmapped/bin/data/organs.xml delete mode 100755 liveengineUnmapped/bin/data/panel.xml delete mode 100755 liveengineUnmapped/bin/data/recreation_indoor.xml delete mode 100755 liveengineUnmapped/bin/data/renaissance.xml delete mode 100755 liveengineUnmapped/bin/data/reptiles.xml delete mode 100755 liveengineUnmapped/bin/data/tai_chi.xml delete mode 100755 liveengineUnmapped/bin/data/teamsports.xml delete mode 100755 liveengineUnmapped/bin/data/teamsports1.xml delete mode 100755 liveengineUnmapped/bin/data/tools.xml delete mode 100755 liveengineUnmapped/bin/data/trainers.xml delete mode 100755 liveengineUnmapped/bin/data/women_ethnic.xml delete mode 100755 liveengineUnmapped/bin/data/women_historical.xml delete mode 100755 liveengineUnmapped/bin/data/yoga.xml (limited to 'liveengineUnmapped') diff --git a/liveengineUnmapped/bin/data/american_football.xml b/liveengineUnmapped/bin/data/american_football.xml deleted file mode 100755 index 9eaf201..0000000 --- a/liveengineUnmapped/bin/data/american_football.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/barcelona.xml b/liveengineUnmapped/bin/data/barcelona.xml deleted file mode 100755 index 29d0a81..0000000 --- a/liveengineUnmapped/bin/data/barcelona.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/belgard-img.xml b/liveengineUnmapped/bin/data/belgard-img.xml deleted file mode 100755 index da7ed18..0000000 --- a/liveengineUnmapped/bin/data/belgard-img.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/belgard-imgseq.xml b/liveengineUnmapped/bin/data/belgard-imgseq.xml deleted file mode 100755 index d117be7..0000000 --- a/liveengineUnmapped/bin/data/belgard-imgseq.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/belgard.xml b/liveengineUnmapped/bin/data/belgard.xml deleted file mode 100755 index 32604a3..0000000 --- a/liveengineUnmapped/bin/data/belgard.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/birds.xml b/liveengineUnmapped/bin/data/birds.xml deleted file mode 100755 index 8ffd4d6..0000000 --- a/liveengineUnmapped/bin/data/birds.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/computers.xml b/liveengineUnmapped/bin/data/computers.xml deleted file mode 100755 index d9be7e8..0000000 --- a/liveengineUnmapped/bin/data/computers.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/crests.xml b/liveengineUnmapped/bin/data/crests.xml deleted file mode 100755 index 6f5103c..0000000 --- a/liveengineUnmapped/bin/data/crests.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/cricket.xml b/liveengineUnmapped/bin/data/cricket.xml deleted file mode 100755 index b6f1123..0000000 --- a/liveengineUnmapped/bin/data/cricket.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/dancing.xml b/liveengineUnmapped/bin/data/dancing.xml deleted file mode 100755 index 74901dd..0000000 --- a/liveengineUnmapped/bin/data/dancing.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/food.xml b/liveengineUnmapped/bin/data/food.xml deleted file mode 100755 index 44c1514..0000000 --- a/liveengineUnmapped/bin/data/food.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/glissando-01.xml b/liveengineUnmapped/bin/data/glissando-01.xml deleted file mode 100755 index edb8076..0000000 --- a/liveengineUnmapped/bin/data/glissando-01.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/liveengineUnmapped/bin/data/glissando-02-funfair.xml b/liveengineUnmapped/bin/data/glissando-02-funfair.xml deleted file mode 100755 index 9b6ed46..0000000 --- a/liveengineUnmapped/bin/data/glissando-02-funfair.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/liveengineUnmapped/bin/data/glissando-03-ars.xml b/liveengineUnmapped/bin/data/glissando-03-ars.xml deleted file mode 100755 index f8c0f3c..0000000 --- a/liveengineUnmapped/bin/data/glissando-03-ars.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/liveengineUnmapped/bin/data/glissando-04-trees.xml b/liveengineUnmapped/bin/data/glissando-04-trees.xml deleted file mode 100755 index 0aa1a50..0000000 --- a/liveengineUnmapped/bin/data/glissando-04-trees.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/liveengineUnmapped/bin/data/glissando-05-sunsets.xml b/liveengineUnmapped/bin/data/glissando-05-sunsets.xml deleted file mode 100755 index 71602b0..0000000 --- a/liveengineUnmapped/bin/data/glissando-05-sunsets.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/liveengineUnmapped/bin/data/glissando-06-cranes.xml b/liveengineUnmapped/bin/data/glissando-06-cranes.xml deleted file mode 100755 index e861b7e..0000000 --- a/liveengineUnmapped/bin/data/glissando-06-cranes.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/liveengineUnmapped/bin/data/insects.xml b/liveengineUnmapped/bin/data/insects.xml deleted file mode 100755 index 0d78831..0000000 --- a/liveengineUnmapped/bin/data/insects.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/licking_power.xml b/liveengineUnmapped/bin/data/licking_power.xml deleted file mode 100644 index 95e4888..0000000 --- a/liveengineUnmapped/bin/data/licking_power.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/mil_historic.xml b/liveengineUnmapped/bin/data/mil_historic.xml deleted file mode 100755 index 20101c3..0000000 --- a/liveengineUnmapped/bin/data/mil_historic.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/mil_knights.xml b/liveengineUnmapped/bin/data/mil_knights.xml deleted file mode 100755 index ef6dd72..0000000 --- a/liveengineUnmapped/bin/data/mil_knights.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/military_ethnic.xml b/liveengineUnmapped/bin/data/military_ethnic.xml deleted file mode 100755 index 01486b8..0000000 --- a/liveengineUnmapped/bin/data/military_ethnic.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/military_ladies.xml b/liveengineUnmapped/bin/data/military_ladies.xml deleted file mode 100755 index c2ea7ba..0000000 --- a/liveengineUnmapped/bin/data/military_ladies.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/organs.xml b/liveengineUnmapped/bin/data/organs.xml deleted file mode 100755 index 3b1c530..0000000 --- a/liveengineUnmapped/bin/data/organs.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/panel.xml b/liveengineUnmapped/bin/data/panel.xml deleted file mode 100755 index ee87c83..0000000 --- a/liveengineUnmapped/bin/data/panel.xml +++ /dev/null @@ -1,4 +0,0 @@ -0 -0 -1 -0 diff --git a/liveengineUnmapped/bin/data/recreation_indoor.xml b/liveengineUnmapped/bin/data/recreation_indoor.xml deleted file mode 100755 index 3b784f7..0000000 --- a/liveengineUnmapped/bin/data/recreation_indoor.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/renaissance.xml b/liveengineUnmapped/bin/data/renaissance.xml deleted file mode 100755 index b027226..0000000 --- a/liveengineUnmapped/bin/data/renaissance.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/liveengineUnmapped/bin/data/reptiles.xml b/liveengineUnmapped/bin/data/reptiles.xml deleted file mode 100755 index ca38f60..0000000 --- a/liveengineUnmapped/bin/data/reptiles.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/tai_chi.xml b/liveengineUnmapped/bin/data/tai_chi.xml deleted file mode 100755 index dc0bfbe..0000000 --- a/liveengineUnmapped/bin/data/tai_chi.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/teamsports.xml b/liveengineUnmapped/bin/data/teamsports.xml deleted file mode 100755 index 0d16db2..0000000 --- a/liveengineUnmapped/bin/data/teamsports.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/teamsports1.xml b/liveengineUnmapped/bin/data/teamsports1.xml deleted file mode 100755 index fa0cb35..0000000 --- a/liveengineUnmapped/bin/data/teamsports1.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/tools.xml b/liveengineUnmapped/bin/data/tools.xml deleted file mode 100755 index 7cca131..0000000 --- a/liveengineUnmapped/bin/data/tools.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/trainers.xml b/liveengineUnmapped/bin/data/trainers.xml deleted file mode 100755 index 51520c6..0000000 --- a/liveengineUnmapped/bin/data/trainers.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/women_ethnic.xml b/liveengineUnmapped/bin/data/women_ethnic.xml deleted file mode 100755 index 629ce55..0000000 --- a/liveengineUnmapped/bin/data/women_ethnic.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/women_historical.xml b/liveengineUnmapped/bin/data/women_historical.xml deleted file mode 100755 index cbfa6cd..0000000 --- a/liveengineUnmapped/bin/data/women_historical.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/bin/data/yoga.xml b/liveengineUnmapped/bin/data/yoga.xml deleted file mode 100755 index 1fe9793..0000000 --- a/liveengineUnmapped/bin/data/yoga.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liveengineUnmapped/src/layers.cpp b/liveengineUnmapped/src/layers.cpp index a0fb213..36de3b1 100755 --- a/liveengineUnmapped/src/layers.cpp +++ b/liveengineUnmapped/src/layers.cpp @@ -1,60 +1,60 @@ #include "layers.h" -svglayer::svglayer() { - xo=0;yo=0; +svglayer::svglayer() { + xo=0;yo=0; } svglayer::svglayer(string _f) { load(_f); } -void svglayer::load(string _f){ +void svglayer::load(string _f){ //check if files exits svg.load(_f); printf("%s: %i paths\n",_f.c_str(),svg.getNumPath()); - for (int i=0;i0); } void svglayer::getCentre(int cx,int cy) { if (svg.getNumPath()>0) { - xo=(cx-svg.getWidth())/2; - yo=(cy-svg.getHeight())/2; + xo=cx-256; //(cx-svg.getWidth())/2; + yo=cy-256; //(cy-svg.getHeight())/2; } } void svglayer::draw(float a,int cx,int cy,float colShift) { - getCentre(cx,cy); + getCentre(cx,cy); for (int i=0;i0.0f) { c.setHue(fmod(c.getHue()+colShift,255.0f)); //printf ("shift from %f to %f\n",c.getHue(),c.getHue()+colShift); - } - svg.getPathAt(i).setFillColor(c); - svg.getPathAt(i).draw(xo,yo); + } + svg.getPathAt(i).setFillColor(c); + svg.getPathAt(i).draw(xo,yo); } -} -/* +} +/* void svglayer::draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack,float colShift) { - getCentre(cx,cy); + getCentre(cx,cy); //draw layers tinted by controllers - for (int i=0;i0.1) { - svg.getPathAt(i).draw(xo,yo); - } + for (int i=0;i0.1) { + svg.getPathAt(i).draw(xo,yo); + } } } */ @@ -65,42 +65,42 @@ void svglayer::draw(float a,unsigned char* controllers,int cx,int cy,bool transp float layerspercontroller=((float)svg.getNumPath())/6.0f; for (int i=0;i<6;i++) { - //for (int j=(int)((i+1)*layerspercontroller)-1;j>(int)(i*layerspercontroller);j--) { + //for (int j=(int)((i+1)*layerspercontroller)-1;j>(int)(i*layerspercontroller);j--) { for (int j=(int)(i*layerspercontroller);j<(int)((i+1)*layerspercontroller);j++) { svg.getPathAt(j).setFillColor(fills[j]*a*(((float)controllers[5-i])/127.0f)); //try to reverse order of these if (!transparentBlack||((a*controllers[5-i])/127.0f)>0.1) { svg.getPathAt(j).draw(xo,yo); } } - } + } //printf("counted %i layers of %i\n",(int)(6*layerspercontroller),svg.getNumPath()); -} +} svglayer::~svglayer() { //dtor -} - -//------------------------------------------------------------------------ -imglayer::imglayer() { - //sprite.setUseTexture(false); +} + +//------------------------------------------------------------------------ +imglayer::imglayer() { + //sprite.setUseTexture(false); } imglayer::imglayer(string _filename,int _frames,int _start,float _rate,int n, int e){ load(_filename,_frames,_start,_rate,n,e); } -void imglayer::load(string _filename,int _frames,int _start,float _rate,int n, int e){ - startNote=n; +void imglayer::load(string _filename,int _frames,int _start,float _rate,int n, int e){ + startNote=n; endNote=e; sprite.load(_filename,_frames,_start); sprite.setFrameRate(_rate); } - -void imglayer::draw(float a,int cx,int cy,float colShift) { + +void imglayer::draw(float a,int cx,int cy,float colShift) { //if (sprite.isAllocated()) if (!sprite.isUsingTexture()) sprite.setUseTexture(true); //has to be done from the main thread? still doesn't work - + sprite.update(); int x,y,w,h; if ((((float)cx)/cy)<(((float)sprite.getWidth())/sprite.getHeight())){ @@ -115,25 +115,25 @@ void imglayer::draw(float a,int cx,int cy,float colShift) { w=((float)cy)*(((float)sprite.getWidth())/sprite.getHeight()); x=(cx-w)/2; } - ofEnableAlphaBlending(); + ofEnableAlphaBlending(); sprite.draw(x,y,w,h); ofDisableAlphaBlending(); -} - -void imglayer::draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack=false,float colShift=0.0f) { +} + +void imglayer::draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack=false,float colShift=0.0f) { imglayer::draw(a,cx,cy,colShift); } void imglayer::setNote(int note) -{ - //is called rerpeatedly no startNote,endNote +{ + //is called rerpeatedly no startNote,endNote //printf("note %i (%i - %i)\n",note,startNote,endNote); if ((startNote<=note)&&(endNote>=note)) { if (!sprite.getIsPlaying()) { sprite.play(); - } + } //printf("triggered frame %i of %i\n",(int)(((((float)note-startNote)/((float)endNote-startNote)))*sprite.getTotalFrames()),sprite.getTotalFrames()); sprite.setCurrentFrame((int)(((((float)note-startNote)/((float)endNote-startNote)))*sprite.getTotalFrames())); //printf("movie %i (%i - %i) frame: %i\n",note,startNote,endNote,(int)(((((float)note-startNote)/((float)endNote-startNote)))*mov.getTotalNumFrames())); @@ -144,20 +144,20 @@ void imglayer::setNote(int note) } } -}; +}; imglayer::~imglayer() { //sprite.setUseTexture(false); //free texture -} -//------------------------------------------------------------------------ -videolayer::videolayer() { - //sprite.setUseTexture(false); +} +//------------------------------------------------------------------------ +videolayer::videolayer() { + //sprite.setUseTexture(false); } videolayer::videolayer(string _f,int n,int e,float s) -{ - startNote=n; +{ + startNote=n; endNote=e; speed=s; load(_f); @@ -174,8 +174,8 @@ void videolayer::load(string _f){ printf("%s %s %i bpp\n",success?"loaded":"not loaded",_f.c_str(),success?mov.getPixelsRef().getBytesPerPixel():0); } -void videolayer::draw(float a,int cx,int cy,float colShift) { - if (mov.isPlaying()) { +void videolayer::draw(float a,int cx,int cy,float colShift) { + if (mov.isPlaying()) { mov.update(); //unsigned char *pix=mov.getPixels(); //for (int i=0;i>2)+(pix[i+1]>>1)+(pix[i+2]>>2); @@ -194,34 +194,34 @@ void videolayer::draw(float a,int cx,int cy,float colShift) { } ofEnableAlphaBlending(); mov.draw(x,y,w,h); - ofDisableAlphaBlending(); + ofDisableAlphaBlending(); } -} - -void videolayer::draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack=false,float colShift=0.0f) { +} + +void videolayer::draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack=false,float colShift=0.0f) { draw(a,cx,cy,colShift); -} - -void videolayer::setNote(int note) +} + +void videolayer::setNote(int note) { - - if ((startNote<=note)&&(endNote>=note)) { + + if ((startNote<=note)&&(endNote>=note)) { if (!mov.isPlaying()) { //printf("starting movie!\n"); mov.setUseTexture(true); mov.play(); mov.setSpeed(speed); - } + } mov.setFrame((int)(((((float)note-startNote)/((float)endNote-startNote)))*mov.getTotalNumFrames())); - //printf("movie %i (%i - %i) frame: %i\n",note,startNote,endNote,(int)(((((float)note-startNote)/((float)endNote-startNote)))*mov.getTotalNumFrames())); - } - else { - if (mov.isPlaying()) { - mov.stop(); - } - } - -}; + //printf("movie %i (%i - %i) frame: %i\n",note,startNote,endNote,(int)(((((float)note-startNote)/((float)endNote-startNote)))*mov.getTotalNumFrames())); + } + else { + if (mov.isPlaying()) { + mov.stop(); + } + } + +}; videolayer::~videolayer() diff --git a/liveengineUnmapped/src/layers.h b/liveengineUnmapped/src/layers.h index f8ed650..0ddca29 100755 --- a/liveengineUnmapped/src/layers.h +++ b/liveengineUnmapped/src/layers.h @@ -1,7 +1,7 @@ #ifndef SVGLAYER_H #define SVGLAYER_H -#include "ofxSVGTiny.h" +#include "ofxSVGTiny.h" #include "ofMain.h" #include "ofxSprite.h" @@ -12,13 +12,13 @@ class layer layer(string _f) {load(_f);}; virtual ~layer(){}; virtual void load(string _f){}; - virtual void draw(float a,int cx,int cy,float colShift){}; - virtual void draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack=false,float colShift=0.0f){ draw(a,cx,cy,colShift);}; - bool getLoaded() {return isLoaded;}; + virtual void draw(float a,int cx,int cy,float colShift){}; + virtual void draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack=false,float colShift=0.0f){ draw(a,cx,cy,colShift);}; + bool getLoaded() {return isLoaded;}; virtual void setNote(int note) {}; string name; int startNote,endNote; - protected: + protected: bool isLoaded; private: @@ -31,31 +31,31 @@ class svglayer: public layer svglayer(string _f); virtual ~svglayer(); void load(string _f); - void draw(float a,int cx,int cy,float colShift); + void draw(float a,int cx,int cy,float colShift); void draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack=false,float colShift=0.0f); void getCentre(int cx,int cy); protected: private: - ofxSVGTiny svg; - vector fills; - vector strokes; + ofxSVGTiny svg; + vector fills; + vector strokes; float xo,yo; }; - -class sunkenSprite: public ofxSprite { - public: + +class sunkenSprite: public ofxSprite { + public: float playhead,frameRate; - void setFrameRate(float frameRate) { this->frameRate = frameRate;}; - void play() { - startTime=ofGetElapsedTimef(); - ofxSprite::play(); - } - void update() { + void setFrameRate(float frameRate) { this->frameRate = frameRate;}; + void play() { + startTime=ofGetElapsedTimef(); + ofxSprite::play(); + } + void update() { if (!getIsPlaying()) return; - playhead=fmod(speed * frameRate * (ofGetElapsedTimef()-startTime),(float)getTotalFrames()); - ofxSprite::setCurrentFrame(playhead); - - } + playhead=fmod(speed * frameRate * (ofGetElapsedTimef()-startTime),(float)getTotalFrames()); + ofxSprite::setCurrentFrame(playhead); + + } void setCurrentFrame(float frame) { //this idea doesn't work - fucks up when frameRate is 0 - //need to rethink @@ -64,7 +64,7 @@ class sunkenSprite: public ofxSprite { //this still might not be not entirely correct if (frameRate>0) startTime-=(frame-pos) / ((float)(frameRate * speed )); //printf("sunkensprite setting frame %i of %i\n",(int)frame,getTotalFrames()); - //printf("1 checking frame %i of %i\n",(int)frame,getTotalFrames()); + //printf("1 checking frame %i of %i\n",(int)frame,getTotalFrames()); ofxSprite::setCurrentFrame(frame); /* pos = frame; @@ -75,28 +75,29 @@ class sunkenSprite: public ofxSprite { while (pos>=totalFrames) pos -= totalFrames; } else { pos = totalFrames-.00001f; isPlaying=false; } printf("set movie frame %i of %i\n",(int)pos,totalFrames); - */ - } - void draw(int x,int y,int w,int h) { - - int f=playhead; - float fr=fmod(playhead,1.0); - ofSetColor(255,255,255,(1.0-fr)*255); - //not always? - getImageAtFrame(f).setUseTexture(true); + */ + } + void draw(int x,int y,int w,int h) { + + int f=playhead; + float fr=fmod(playhead,1.0); + ofSetColor(255,255,255,(1.0-fr)*255); + //not always? + getImageAtFrame(f).setUseTexture(true); getImageAtFrame(f).reloadTexture(); - getImageAtFrame(f).draw(x,y,w,h); + getImageAtFrame(f).draw(x,y,w,h); ofSetColor(255,255,255,fr*255); - f=(f+1)%getTotalFrames(); + f=(f+1)%getTotalFrames(); getImageAtFrame(f).setUseTexture(true); getImageAtFrame(f).reloadTexture(); - getImageAtFrame(f).draw(x,y,w,h); - } - - private: - float startTime; - -}; + getImageAtFrame(f).draw(x,y,w,h); + } + + private: + float startTime; + float speed,pos; //will this override the base class speed correctly? + +}; class imglayer: public layer { @@ -105,14 +106,14 @@ class imglayer: public layer imglayer(string _f,int _frames=1,int _start=1,float _rate=0,int note=0,int endnote=0); virtual ~imglayer(); void load(string _filename,int _frames=1,int _start=1,float _rate=0.0,int note=0,int endnote=0); - void draw(float a,int cx,int cy,float colShift); + void draw(float a,int cx,int cy,float colShift); void draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack,float colShift); void setNote(int n); protected: private: sunkenSprite sprite; -}; - +}; + class videolayer: public layer { public: @@ -120,11 +121,11 @@ class videolayer: public layer videolayer(string _f,int n,int e,float s); virtual ~videolayer(); void load(string _f); - void draw(float a,int cx,int cy,float colShift); - void draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack,float colShift); - void setNote(int n); + void draw(float a,int cx,int cy,float colShift); + void draw(float a,unsigned char* controllers,int cx,int cy,bool transparentBlack,float colShift); + void setNote(int n); protected: - private: + private: float speed; ofVideoPlayer mov; }; diff --git a/liveengineUnmapped/src/playlist.cpp b/liveengineUnmapped/src/playlist.cpp index 61987d1..ce3beba 100755 --- a/liveengineUnmapped/src/playlist.cpp +++ b/liveengineUnmapped/src/playlist.cpp @@ -1,18 +1,18 @@ -#include "playlist.h" - -playlist::playlist() +#include "playlist.h" + +playlist::playlist() { name=""; thumbnail.allocate(128,128,GL_RGB); - thumbnailed=false; + thumbnailed=false; } void playlist::load(string _name){ //printf("loading %s\n",_name.c_str()); - if( !XML.loadFile(_name) ){ - printf("unable to load %s check data/ folder\n",_name.c_str()); + if( !XML.loadFile(_name) ){ + printf("unable to load %s check data/ folder\n",_name.c_str()); }else { //printf("starting loader thread\n"); loadimg(); //how to do this from the worker thread??? @@ -29,38 +29,38 @@ void playlist::threadedFunction(){ unlock(); printf("unlocking thread\n"); } -} +} void playlist::loadLayers(){ int numLayers=0; layers.clear(); name=XML.getAttribute("playlist", "name", ""); float speed=XML.getAttribute("playlist", "speed", 0); - if(XML.pushTag("playlist")) { - numLayers=XML.getNumTags("svglayer"); - if(numLayers) { - for (int i=0;inote) { for (int j=note+1;jsetup(); guiWin->setParent(this); - debug=false; + //debug=true; + } @@ -205,6 +202,8 @@ void testApp::update(){ //-------------------------------------------------------------- void testApp::draw(){ + + float lambda=max(0.0f,1.0f-((ofGetElapsedTimef()-lastnoteTime)/decayTime)); int ft=255-(fadetime*((float)fadeScale)*0.1f); @@ -223,135 +222,6 @@ void testApp::draw(){ ofSetColor(255,255,255); if (showFPS) ofDrawBitmapString(ofToString(ofGetFrameRate(), 2),20,20); - /* - rb1.begin(); - - - // can this work? - //grab.setAnchorPoint(xshift,yshift); - //grab.setTextureWrap( GL_WRAP_BORDER, GL_WRAP_BORDER); - //grab.draw(0,0); // xshift,yshift); - - ofSetColor(255-fadetime,255-fadetime,255-fadetime); - for (int i=(xshift>0?xshift-rb1.getWidth():xshift);i0?yshift-rb1.getHeight():yshift);j0) { - switch(mode) { - case BLOCKS: - for (int i=0;i>7,(controller_colours[i].g*controllers[i])>>7,(controller_colours[i].b*controllers[i])>>7)); - ofRect((note-START_NOTE)*notewidth,i*noteheight,notewidth,noteheight); - } - break; - case LIST: - if (list.lock()) { //if playlist is loaded - ofPushMatrix(); - ofTranslate(rb1.getWidth()/2,rb1.getHeight()/2); - ofScale(scale,scale,scale); - ofRotate(rotate); - ofTranslate(-rb1.getWidth()/2,-rb1.getHeight()/2); - if (list.layers.find(note)!=list.layers.end()) { - if (controlColours) list.layers[note]->draw(lamda,controllers,512,384,transparentBlack); - else list.layers[note]->draw(lamda,512,384); - } - ofPopMatrix(); - list.unlock(); - } - break; - } - } - - //for (int i=0;idraw(); - ofSetColor(255,255,255); - if (showFPS) ofDrawBitmapString(ofToString(ofGetFrameRate(), 2),20,20); - - rb1.end(); - - rb2.begin(); - ofSetColor(255,255,255); - rb1.draw(0,0); - rb2.end(); - - rb2.draw(1024,0); - - rb3.begin(); //landscape - - - - ofSetColor(255-fadetime,255-fadetime,255-fadetime); - for (int i=(xshift>0?xshift-rb3.getWidth():xshift);i0?yshift-rb3.getHeight():yshift);j0) { - switch(mode) { - case BLOCKS: - for (int i=0;i>7,(controller_colours[i].g*controllers[i])>>7,(controller_colours[i].b*controllers[i])>>7)); - ofRect((note-START_NOTE)*notewidth,i*noteheight,notewidth,noteheight); - } - break; - case LIST: - if (list.lock()) { //if playlist is loaded - ofPushMatrix(); - ofTranslate(rb3.getWidth()/2,rb3.getHeight()/2); - ofScale(scale,scale,scale); - ofRotate(rotate); - ofTranslate(-rb3.getWidth()/2,-rb3.getHeight()/2); - if (list.layers.find(note)!=list.layers.end()) { - if (controlColours) list.layers[note]->draw(lamda,controllers,512,384,transparentBlack); - else list.layers[note]->draw(lamda,512,384); - } - ofPopMatrix(); - list.unlock(); - } - break; - } - } - - ofPopMatrix(); - - //for (int i=0;idraw(); - ofSetColor(255,255,255); - if (showFPS) ofDrawBitmapString(ofToString(ofGetFrameRate(), 2),20,20); - - rb3.end(); - - rb4.begin(); - ofSetColor(255,255,255); - rb3.draw(0,0); - rb4.end(); - - rb4.draw(0,0); - - */ - - /* test screen shape - ofSetColor(255,0,0); - ofRect(0,0,1024,768); - ofSetColor(0,255,0); - ofRect(1024,0,1024,768); - */ - } //-------------------------------------------------------------- @@ -467,7 +337,7 @@ void testApp::dragEvent(ofDragInfo dragInfo){ printf("got draginfo: %s\n",dragInfo.files[0].c_str()); int sta=dragInfo.files[0].find_last_of("\\/")+1; int len=(dragInfo.files[0].find_last_of(".")+4)-sta; - string filename=dragInfo.files[0].substr(sta,len); + string filename="images/"+dragInfo.files[0].substr(sta,len); printf("loading %s\n",filename.c_str()); list.load(filename); @@ -502,9 +372,9 @@ void testApp::toggleFPS(){ showFPS=!showFPS; } -void testApp::newMidiMessage(ofxMidiEventArgs& eventArgs){ +void testApp::newMidiMessage(ofxMidiMessage& eventArgs){ if ((midiChannel==0)||(eventArgs.channel==midiChannel)) { - nmidiMessage(eventArgs.status,eventArgs.byteOne,eventArgs.byteTwo); + nmidiMessage(eventArgs.status,eventArgs.bytes[0],eventArgs.bytes[1]); } } @@ -535,17 +405,17 @@ void testApp::nmidiMessage(int event,int data1, int data2) { note=data1; lastnoteTime=ofGetElapsedTimef(); - if (list.lock()&&list.layers.size()) { //if playlist is loaded - map::iterator itr; - //for(itr = list.layers.begin(); itr != list.layers.end(); ++itr){ - // list.layers[itr->first]->setNote(note); - //} - if (list.layers.find(note)!=list.layers.end()) list.layers[note]->setNote(note); - list.unlock(); - } - if (noteRandomiseColours) { - makeColours(); // - } + if (list.layers.size()&&list.lock()) { //if playlist is loaded + map::iterator itr; + //for(itr = list.layers.begin(); itr != list.layers.end(); ++itr){ + // list.layers[itr->first]->setNote(note); + //} + if (list.layers.find(note)!=list.layers.end()) list.layers[note]->setNote(note); + list.unlock(); + } + if (noteRandomiseColours) { + makeColours(); // + } randOffs=ofRandom(100.0f); break; case 176: //control change channel 0 @@ -555,5 +425,8 @@ void testApp::nmidiMessage(int event,int data1, int data2) { if (debug) printf("cc: %i %i\n",data1,data2); if (data1>=START_CONTROLLER) controllers[data1-START_CONTROLLER]=data2; } + } + + diff --git a/liveengineUnmapped/src/testApp.h b/liveengineUnmapped/src/testApp.h index 1e56c33..9dd9b62 100755 --- a/liveengineUnmapped/src/testApp.h +++ b/liveengineUnmapped/src/testApp.h @@ -71,7 +71,6 @@ option to randomise colours on each note */ - #define OF_ADDON_USING_OFXMIDIIN @@ -80,7 +79,6 @@ option to randomise colours on each note #include "ofxGui.h" - #include "viewport.h" /* @@ -163,7 +161,7 @@ class testApp : public ofxFensterListener, public ofxMidiListener{ ofxMidiIn midiIn; - void newMidiMessage(ofxMidiEventArgs& eventArgs); + void newMidiMessage(ofxMidiMessage& eventArgs); playlist list; -- cgit v1.2.3