Skip to content

Commit

Permalink
Remove legacy midiX variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Bourdeauducq committed Feb 26, 2012
1 parent d1f18e8 commit dde38d1
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 183 deletions.
6 changes: 2 additions & 4 deletions src/compiler/compiler.c
Expand Up @@ -118,8 +118,7 @@ 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;
if(pfv >= pfv_midi1 && pfv <= pfv_midi8)
sc->p->require |= REQUIRE_MIDI;
// TODO: MIDI detection
if(pfv == pfv_video_a)
sc->p->require |= REQUIRE_VIDEO;
}
Expand Down Expand Up @@ -264,8 +263,7 @@ 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;
if(pvv >= pvv_midi1 && pvv <= pvv_midi8)
sc->p->require |= REQUIRE_MIDI;
// TODO: MIDI detection
}

static void pvv_bind_callback(void *_sc, struct fpvm_sym *sym, int reg)
Expand Down
18 changes: 0 additions & 18 deletions src/compiler/compiler.h
Expand Up @@ -128,15 +128,6 @@ enum {
pfv_osc3,
pfv_osc4,

pfv_midi1,
pfv_midi2,
pfv_midi3,
pfv_midi4,
pfv_midi5,
pfv_midi6,
pfv_midi7,
pfv_midi8,

pfv_video_a,

pfv_image1_a,
Expand Down Expand Up @@ -205,15 +196,6 @@ enum {
pvv_osc3,
pvv_osc4,

pvv_midi1,
pvv_midi2,
pvv_midi3,
pvv_midi4,
pvv_midi5,
pvv_midi6,
pvv_midi7,
pvv_midi8,

COMP_PVV_COUNT /* must be last */
};

Expand Down
9 changes: 0 additions & 9 deletions src/compiler/fnp.ids
Expand Up @@ -108,15 +108,6 @@ osc2 pfv_osc2 pvv_osc2 SF_LIVE
osc3 pfv_osc3 pvv_osc3 SF_LIVE
osc4 pfv_osc4 pvv_osc4 SF_LIVE

midi1 pfv_midi1 pvv_midi1 SF_LIVE
midi2 pfv_midi2 pvv_midi2 SF_LIVE
midi3 pfv_midi3 pvv_midi3 SF_LIVE
midi4 pfv_midi4 pvv_midi4 SF_LIVE
midi5 pfv_midi5 pvv_midi5 SF_LIVE
midi6 pfv_midi6 pvv_midi6 SF_LIVE
midi7 pfv_midi7 pvv_midi7 SF_LIVE
midi8 pfv_midi8 pvv_midi8 SF_LIVE

video_a pfv_video_a -1

image1_a pfv_image1_a -1
Expand Down
110 changes: 20 additions & 90 deletions src/gui/midi.c
@@ -1,6 +1,6 @@
/*
* Flickernoise
* Copyright (C) 2010, 2011 Sebastien Bourdeauducq
* Copyright (C) 2010, 2011, 2012 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -170,7 +170,6 @@ static void load_config(void)
char config_key[8];
int i;
const char *val;
int value;

mtk_cmdf(appid, "e_channel.set(-text \"%d\")",
config_read_int("midi_channel", 0)+1);
Expand All @@ -182,27 +181,13 @@ static void load_config(void)
else
midi_bindings[i][0] = 0;
}
for(i=0;i<MIDI_COUNT;i++) {
sprintf(config_key, "midi%d", i+1);
value = config_read_int(config_key, i);
mtk_cmdf(appid, "e_midi%d.set(-text \"%d\")", i, value);
}
}

static void set_config(void)
{
char config_key[16];
int i;
int value;

for(i=0;i<MIDI_COUNT;i++) {
sprintf(config_key, "e_midi%d.text", i);
value = mtk_req_i(appid, config_key);
if((value < 0) || (value > 128))
value = i;
sprintf(config_key, "midi%d", i+1);
config_write_int(config_key, value);
}

for(i=0;i<128;i++) {
sprintf(config_key, "midi_%02x", i);
if(midi_bindings[i][0] != 0)
Expand Down Expand Up @@ -302,8 +287,7 @@ static void midi_event(mtk_event *e, int count)
break;
case EVENT_TYPE_MIDI_PITCH:
/* EVENT_TYPE_MIDI_PITCH */
controller_event(chan, 128,
e[i].press.code & 0x7f);
// TODO
break;
}
}
Expand Down Expand Up @@ -366,17 +350,6 @@ static void addupdate_callback(mtk_event *e, void *arg)
mtk_cmd(appid, "e_filename.set(-text \"\")");
}

static void press_callback(mtk_event *e, void *arg)
{
learn = (int)arg;
assert(learn >= 0 && learn < MIDI_COUNT);
}

static void release_callback(mtk_event *e, void *arg)
{
learn = -1;
}

static int cmpstringp(const void *p1, const void *p2)
{
return strcmp(*(char * const *)p1, *(char * const *)p2);
Expand Down Expand Up @@ -451,29 +424,17 @@ static void autobuild_callback(mtk_event *e, void *arg)

void init_midi(void)
{
int i;

appid = mtk_init_app("MIDI");

mtk_cmd_seq(appid,
"g = new Grid()",

"g_parameters0 = new Grid()",
"l_parameters = new Label(-text \"Global parameters\" -font \"title\")",
"s_parameters1 = new Separator(-vertical no)",
"s_parameters2 = new Separator(-vertical no)",
"g_parameters0.place(s_parameters1, -column 1 -row 1)",
"g_parameters0.place(l_parameters, -column 2 -row 1)",
"g_parameters0.place(s_parameters2, -column 3 -row 1)",

"g_parameters = new Grid()",
"l_channel = new Label(-text \"Channel (1-16):\")",
"l_channel = new Label(-text \"Patch switch channel (1-16):\")",
"e_channel = new Entry()",
"g_parameters.place(l_channel, -column 1 -row 1)",
"g_parameters.place(e_channel, -column 2 -row 1)",

"g_sep = new Grid()",

"g_patch = new Grid()",
"g.place(g_parameters, -column 1 -row 0)",

"g_existing0 = new Grid()",
"l_existing = new Label(-text \"Existing bindings\" -font \"title\")",
Expand Down Expand Up @@ -512,65 +473,34 @@ void init_midi(void)
"b_addupdate = new Button(-text \"Add/update\")",
"b_autobuild = new Button(-text \"Auto build\")",

"g_patch.place(g_existing0, -column 1 -row 1)",
"g_patch.place(lst_existingf, -column 1 -row 2)",
"g_patch.rowconfig(2, -size 130)",
"g_patch.place(g_addedit0, -column 1 -row 3)",
"g_patch.place(g_addedit1, -column 1 -row 4)",
"g_patch.place(b_addupdate, -column 1 -row 5)",
"g_patch.place(b_autobuild, -column 1 -row 6)",

"g_var = new Grid()",

"g_cmap0 = new Grid()",
"l_cmap = new Label(-text \"Controller mapping\" -font \"title\")",
"s_cmap1 = new Separator(-vertical no)",
"s_cmap2 = new Separator(-vertical no)",
"g_cmap0.place(s_cmap1, -column 1 -row 1)",
"g_cmap0.place(l_cmap, -column 2 -row 1)",
"g_cmap0.place(s_cmap2, -column 3 -row 1)",

"g_vars = new Grid()",
"g_vars.columnconfig(2, -size 55)",
"g.place(g_existing0, -column 1 -row 1)",
"g.place(lst_existingf, -column 1 -row 2)",
"g.rowconfig(2, -size 130)",
"g.place(g_addedit0, -column 1 -row 3)",
"g.place(g_addedit1, -column 1 -row 4)",
"g.place(b_addupdate, -column 1 -row 5)",
"g.place(b_autobuild, -column 1 -row 6)",

"g_lastctl = new Grid()",
"l_lastctltxt = new Label(-text \"Latest active controller:\")",
"l_lastctl = new Label()",

"g_var.place(g_cmap0, -column 1 -row 1)",
"g_var.place(g_vars, -column 1 -row 2)",
"g_var.place(l_lastctltxt, -column 1 -row 3)",
"g_var.place(l_lastctl, -column 1 -row 4)",

"g_sep.place(g_patch, -column 1 -row 1)",
"sep = new Separator(-vertical yes)",
"g_sep.place(sep, -column 2 -row 1)",
"g_sep.place(g_var, -column 3 -row 1)",
"g_lastctl.place(l_lastctltxt, -column 1 -row 1)",
"g_lastctl.place(l_lastctl, -column 2 -row 1)",
"g.place(g_lastctl, -column 1 -row 7)",

"g_btn = new Grid()",
"b_ok = new Button(-text \"OK\")",
"b_cancel = new Button(-text \"Cancel\")",
"g_btn.columnconfig(1, -size 450)",
"g_btn.columnconfig(1, -size 250)",
"g_btn.place(b_ok, -column 2 -row 1)",
"g_btn.place(b_cancel, -column 3 -row 1)",

"g.place(g_parameters0, -column 1 -row 1)",
"g.place(g_parameters, -column 1 -row 2)",
"g.place(g_sep, -column 1 -row 3)",
"g.rowconfig(4, -size 10)",
"g.place(g_btn, -column 1 -row 5)",
"g.rowconfig(8, -size 10)",
"g.place(g_btn, -column 1 -row 9)",

"w = new Window(-content g -title \"MIDI settings\" -workx 10)",
0);

for(i=0;i<MIDI_COUNT;i++) {
mtk_cmdf(appid, "l_midi%d = new Label(-text \"\emidi%d\")", i, i+1);
mtk_cmdf(appid, "e_midi%d = new Entry()", i);
mtk_cmdf(appid, "g_vars.place(l_midi%d, -column 1 -row %d)", i, i);
mtk_cmdf(appid, "g_vars.place(e_midi%d, -column 2 -row %d)", i, i);
mtk_bindf(appid, "l_midi%d", "press", press_callback, (void *)i, i);
mtk_bindf(appid, "l_midi%d", "release", release_callback, NULL, i);
}

mtk_bind(appid, "lst_existing", "selchange", selchange_callback, NULL);
mtk_bind(appid, "lst_existing", "selcommit", selchange_callback, NULL);
mtk_bind(appid, "b_filename", "commit", browse_callback, NULL);
Expand Down
14 changes: 1 addition & 13 deletions src/gui/monitor.c
@@ -1,6 +1,6 @@
/*
* Flickernoise
* Copyright (C) 2010, 2011 Sebastien Bourdeauducq
* Copyright (C) 2010, 2011, 2012 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -36,7 +36,6 @@ static float bass, mid, treb;
static float bass_att, mid_att, treb_att;
static float idmx[IDMX_COUNT];
static float osc[OSC_COUNT];
static float midi[MIDI_COUNT];

static void sampler_callback(struct frame_descriptor *frd)
{
Expand All @@ -57,8 +56,6 @@ static void sampler_callback(struct frame_descriptor *frd)
idmx[i] = frd->idmx[i];
for(i=0;i<OSC_COUNT;i++)
osc[i] = frd->osc[i];
for(i=0;i<MIDI_COUNT;i++)
midi[i] = frd->midi[i];
sampler_return(frd);
}

Expand Down Expand Up @@ -88,15 +85,6 @@ static float *get_variable(const char *name)
else if(strcmp(name, "osc2") == 0) return &osc[1];
else if(strcmp(name, "osc3") == 0) return &osc[2];
else if(strcmp(name, "osc4") == 0) return &osc[3];

else if(strcmp(name, "midi1") == 0) return &midi[0];
else if(strcmp(name, "midi2") == 0) return &midi[1];
else if(strcmp(name, "midi3") == 0) return &midi[2];
else if(strcmp(name, "midi4") == 0) return &midi[3];
else if(strcmp(name, "midi5") == 0) return &midi[4];
else if(strcmp(name, "midi6") == 0) return &midi[5];
else if(strcmp(name, "midi7") == 0) return &midi[6];
else if(strcmp(name, "midi8") == 0) return &midi[7];

else return NULL;
}
Expand Down
18 changes: 0 additions & 18 deletions src/renderer/eval.c
Expand Up @@ -106,15 +106,6 @@ static void transfer_pvv_regs(struct patch *p)
write_pvv(p, pvv_osc2, read_pfv(p, pfv_osc2));
write_pvv(p, pvv_osc3, read_pfv(p, pfv_osc3));
write_pvv(p, pvv_osc4, read_pfv(p, pfv_osc4));

write_pvv(p, pvv_midi1, read_pfv(p, pfv_midi1));
write_pvv(p, pvv_midi2, read_pfv(p, pfv_midi2));
write_pvv(p, pvv_midi3, read_pfv(p, pfv_midi3));
write_pvv(p, pvv_midi4, read_pfv(p, pfv_midi4));
write_pvv(p, pvv_midi5, read_pfv(p, pfv_midi5));
write_pvv(p, pvv_midi6, read_pfv(p, pfv_midi6));
write_pvv(p, pvv_midi7, read_pfv(p, pfv_midi7));
write_pvv(p, pvv_midi8, read_pfv(p, pfv_midi8));
}

static void reinit_pfv(struct patch *p, int pfv)
Expand Down Expand Up @@ -158,15 +149,6 @@ static void set_pfv_from_frd(struct patch *p, struct frame_descriptor *frd)
write_pfv(p, pfv_osc2, frd->osc[1]);
write_pfv(p, pfv_osc3, frd->osc[2]);
write_pfv(p, pfv_osc4, frd->osc[3]);

write_pfv(p, pfv_midi1, frd->midi[0]);
write_pfv(p, pfv_midi2, frd->midi[1]);
write_pfv(p, pfv_midi3, frd->midi[2]);
write_pfv(p, pfv_midi4, frd->midi[3]);
write_pfv(p, pfv_midi5, frd->midi[4]);
write_pfv(p, pfv_midi6, frd->midi[5]);
write_pfv(p, pfv_midi7, frd->midi[6]);
write_pfv(p, pfv_midi8, frd->midi[7]);
}

static void set_frd_from_pfv(struct patch *p, struct frame_descriptor *frd)
Expand Down
4 changes: 1 addition & 3 deletions src/renderer/framedescriptor.h
@@ -1,6 +1,6 @@
/*
* Flickernoise
* Copyright (C) 2010, 2011 Sebastien Bourdeauducq
* Copyright (C) 2010, 2011, 2012 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -41,7 +41,6 @@ enum {

#define IDMX_COUNT 8
#define OSC_COUNT 4
#define MIDI_COUNT 8
#define DMX_COUNT 8
#define IMAGE_COUNT 2

Expand All @@ -55,7 +54,6 @@ struct frame_descriptor {
float bass_att, mid_att, treb_att;
float idmx[IDMX_COUNT];
float osc[OSC_COUNT];
float midi[MIDI_COUNT];

float decay;
float wave_mode;
Expand Down

0 comments on commit dde38d1

Please sign in to comment.