|
|
@ -191,12 +191,25 @@ static gboolean sampler_program_process_cmd(struct cbox_command_target *ct, stru |
|
|
|
return FALSE; |
|
|
|
for (GSList *p = program->ctrl_label_list; p; p = p->next) |
|
|
|
{ |
|
|
|
const struct sampler_ctrllabel *cin = (const struct sampler_ctrllabel *)&p->data; |
|
|
|
const struct sampler_ctrllabel *cin = (const struct sampler_ctrllabel *)p->data; |
|
|
|
if (!cbox_execute_on(fb, NULL, "/control_label", "is", error, (int)cin->controller, cin->label)) |
|
|
|
return FALSE; |
|
|
|
} |
|
|
|
return TRUE; |
|
|
|
} |
|
|
|
if (!strcmp(cmd->command, "/key_labels") && !strcmp(cmd->arg_types, "")) |
|
|
|
//Because "key" is a programming keyword as well we use "pitch" instead internally
|
|
|
|
{ |
|
|
|
if (!cbox_check_fb_channel(fb, cmd->command, error)) |
|
|
|
return FALSE; |
|
|
|
for (GSList *p = program->pitch_label_list; p; p = p->next) |
|
|
|
{ |
|
|
|
const struct sampler_pitchlabel *cin = (const struct sampler_pitchlabel *)p->data; |
|
|
|
if (!cbox_execute_on(fb, NULL, "/key_label", "is", error, (int)cin->pitch, cin->label)) |
|
|
|
return FALSE; |
|
|
|
} |
|
|
|
return TRUE; |
|
|
|
} |
|
|
|
if (!strcmp(cmd->command, "/add_control_init") && !strcmp(cmd->arg_types, "ii")) |
|
|
|
{ |
|
|
|
sampler_program_add_controller_init(program, CBOX_ARG_I(cmd, 0), CBOX_ARG_I(cmd, 1)); |
|
|
@ -280,6 +293,7 @@ struct sampler_program *sampler_program_new(struct sampler_module *m, int prog_n |
|
|
|
prg->rll = NULL; |
|
|
|
prg->ctrl_init_list = NULL; |
|
|
|
prg->ctrl_label_list = NULL; |
|
|
|
prg->pitch_label_list = NULL; |
|
|
|
prg->global = sampler_layer_new(m, prg, NULL); |
|
|
|
prg->global->default_child = sampler_layer_new(m, prg, prg->global); |
|
|
|
prg->global->default_child->default_child = sampler_layer_new(m, prg, prg->global->default_child); |
|
|
@ -506,6 +520,21 @@ static void sampler_ctrl_label_destroy(gpointer value) |
|
|
|
free(label); |
|
|
|
} |
|
|
|
|
|
|
|
void sampler_program_add_pitch_label(struct sampler_program *prg, uint16_t pitch, gchar *text) |
|
|
|
{ |
|
|
|
struct sampler_pitchlabel *label = calloc(1, sizeof(struct sampler_pitchlabel)); |
|
|
|
label->pitch = pitch; |
|
|
|
label->label = text; |
|
|
|
prg->pitch_label_list = g_slist_append(prg->pitch_label_list, label); |
|
|
|
} |
|
|
|
|
|
|
|
static void sampler_pitch_label_destroy(gpointer value) |
|
|
|
{ |
|
|
|
struct sampler_pitchlabel *label = value; |
|
|
|
free(label->label); |
|
|
|
free(label); |
|
|
|
} |
|
|
|
|
|
|
|
void sampler_program_add_controller_label(struct sampler_program *prg, uint16_t controller, gchar *text) |
|
|
|
{ |
|
|
|
struct sampler_ctrllabel *label = calloc(1, sizeof(struct sampler_ctrllabel)); |
|
|
@ -576,6 +605,7 @@ void sampler_program_destroyfunc(struct cbox_objhdr *hdr_ptr) |
|
|
|
g_slist_free(prg->all_layers); |
|
|
|
g_slist_free(prg->ctrl_init_list); |
|
|
|
g_slist_free_full(prg->ctrl_label_list, sampler_ctrl_label_destroy); |
|
|
|
g_slist_free_full(prg->pitch_label_list, sampler_pitch_label_destroy); |
|
|
|
if (prg->tarfile) |
|
|
|
cbox_tarpool_release_tarfile(app.tarpool, prg->tarfile); |
|
|
|
free(prg); |
|
|
@ -608,4 +638,3 @@ struct sampler_program *sampler_program_clone(struct sampler_program *prg, struc |
|
|
|
|
|
|
|
return newprg; |
|
|
|
} |
|
|
|
|
|
|
|