Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Flag patches requiring stimulus and exclude them from simple mode

  • Loading branch information...
commit 96091d51bcb133b3da96992eba7967fbcfa96dd8 1 parent 5109cd4
@sbourdeauducq sbourdeauducq authored
View
6 src/compiler/compiler.c
@@ -118,7 +118,6 @@ static void pfv_update_patch_requires(struct compiler_sc *sc, int pfv)
sc->p->require |= REQUIRE_DMX;
if(pfv >= pfv_osc1 && pfv <= pfv_osc4)
sc->p->require |= REQUIRE_OSC;
- // TODO: MIDI detection
if(pfv == pfv_video_a)
sc->p->require |= REQUIRE_VIDEO;
}
@@ -197,6 +196,8 @@ static void pfv_bind_callback(void *_sc, struct fpvm_sym *sym, int reg)
pfv_update_patch_requires(sc, pfv);
sc->p->pfv_allocation[pfv] = reg;
}
+ if(s->stim != NULL)
+ sc->p->require |= REQUIRE_STIM;
for(r = s->stim; r; r = r->next)
r->regs->pfv = sc->p->perframe_regs+reg;
}
@@ -263,7 +264,6 @@ static void pvv_update_patch_requires(struct compiler_sc *sc, int pvv)
sc->p->require |= REQUIRE_DMX;
if(pvv >= pvv_osc1 && pvv <= pvv_osc4)
sc->p->require |= REQUIRE_OSC;
- // TODO: MIDI detection
}
static void pvv_bind_callback(void *_sc, struct fpvm_sym *sym, int reg)
@@ -278,6 +278,8 @@ static void pvv_bind_callback(void *_sc, struct fpvm_sym *sym, int reg)
pvv_update_patch_requires(sc, pvv);
sc->p->pvv_allocation[pvv] = reg;
}
+ if(s->stim != NULL)
+ sc->p->require |= REQUIRE_STIM;
for(r = s->stim; r; r = r->next)
r->regs->pvv = sc->p->pervertex_regs+reg;
}
View
4 src/compiler/compiler.h
@@ -201,7 +201,7 @@ enum {
#define REQUIRE_DMX (1 << 0)
#define REQUIRE_OSC (1 << 1)
-#define REQUIRE_MIDI (1 << 2)
+#define REQUIRE_STIM (1 << 2)
#define REQUIRE_VIDEO (1 << 3)
struct image {
@@ -235,7 +235,7 @@ struct patch {
float pervertex_regs[PFPU_REG_COUNT]; /* PFPU initial per-vertex
regf */
/* meta */
- unsigned int require; /* bitmask: dmx, osc, midi, video */
+ unsigned int require; /* bitmask: dmx, osc, stim, video */
void *original; /* original patch (with initial register
values) */
int ref; /* reference count */
View
24 src/gui/midi.c
@@ -159,7 +159,6 @@ static int midistr(const char *str)
static int appid;
static struct filedialog *browse_dlg;
-static int learn = -1;
static int w_open;
@@ -246,25 +245,31 @@ static void selchange_callback(mtk_event *e, void *arg)
}
}
-static void note_event(int code)
+static void note_event(int chan, int code)
{
char note[16];
+ chan++;
+
strmidi(note, code);
- mtk_cmdf(appid, "e_note.set(-text \"%s\")", note);
+ if(chan == mtk_req_i(appid, "e_channel.text")) {
+ mtk_cmdf(appid, "e_note.set(-text \"%s\")", note);
+ mtk_cmdf(appid, "l_lastctl.set(-text \"\e%d = %s\")",
+ chan, note);
+ } else {
+ mtk_cmdf(appid, "l_lastctl.set(-text \"\e(%d = %s)\")",
+ chan, note);
+ }
}
static void controller_event(int chan, int controller, int value)
{
chan++;
if(chan == mtk_req_i(appid, "e_channel.text")) {
- mtk_cmdf(appid, "l_lastctl.set(-text \"%d.%d = %d\")",
+ mtk_cmdf(appid, "l_lastctl.set(-text \"\e%d.%d = %d\")",
chan, controller, value);
- if(learn != -1)
- mtk_cmdf(appid, "e_midi%d.set(-text \"%d\")",
- learn, controller);
} else {
- mtk_cmdf(appid, "l_lastctl.set(-text \"(%d.%d = %d)\")",
+ mtk_cmdf(appid, "l_lastctl.set(-text \"\e(%d.%d = %d)\")",
chan, controller, value);
}
}
@@ -277,8 +282,7 @@ static void midi_event(mtk_event *e, int count)
chan = (e[i].press.code & 0x0f0000) >> 16;
switch(e[i].type) {
case EVENT_TYPE_MIDI_NOTEON:
- if(chan == mtk_req_i(appid, "e_channel.text")-1)
- note_event(e[i].press.code & 0x7f);
+ note_event(chan, e[i].press.code & 0x7f);
break;
case EVENT_TYPE_MIDI_CONTROLLER:
controller_event(chan,
View
2  src/gui/performance.c
@@ -426,7 +426,7 @@ static int suitable_for_simple(struct patch *p)
suitable = 1;
if(p->require & REQUIRE_DMX) suitable = 0;
if(p->require & REQUIRE_OSC) suitable = 0;
- if(p->require & REQUIRE_MIDI) suitable = 0;
+ if(p->require & REQUIRE_STIM) suitable = 0;
if((p->require & REQUIRE_VIDEO) && !input_video) suitable = 0;
return suitable;
}
Please sign in to comment.
Something went wrong with that request. Please try again.