static void effects_preset_show_cb(proto_t *proto) { char *state_str = NULL; if (effects_preset_show(proto->list[1], &state_str) == SUCCESS) { if (state_str) { protocol_response(state_str, proto); lilv_free(state_str); return; } } protocol_response("", proto); }
static void load_cb(proto_t *proto) { FILE *fp; fp = fopen(proto->list[1], "r"); if (fp) { char line[1024]; msg_t msg; msg.sender_id = STDOUT_FILENO; while (fgets(line, sizeof(line), fp)) { printf("%s", line); /* removes the \n at end of line */ line[strlen(line)-1] = 0; /* fills the message struct and parse it */ msg.data = line; msg.data_size = strlen(line); protocol_parse(&msg); printf("\n"); } fclose(fp); } else { protocol_response("error: can't open the file", proto); } }
static void cpu_load_cb(proto_t *proto) { float value = effects_jack_cpu_load(); char buffer[128]; sprintf(buffer, "resp 0 %.04f", value); protocol_response(buffer, proto); }
static void quit_cb(proto_t *proto) { protocol_response("resp 0", proto); protocol_remove_commands(); socket_finish(); effects_finish(1); exit(EXIT_SUCCESS); }
static void midi_unmap_cb(proto_t *proto) { int resp; resp = !effects_midi_unmap(atoi(proto->list[1]), proto->list[2]); char buffer[128]; sprintf(buffer, "resp %i", resp); protocol_response(buffer, proto); }
static void effects_bypass_cb(proto_t *proto) { int resp; resp = effects_bypass(atoi(proto->list[1]), atoi(proto->list[2])); char buffer[128]; sprintf(buffer, "resp %i", resp); protocol_response(buffer, proto); }
static void effects_disconnect_cb(proto_t *proto) { int resp; resp = effects_disconnect(proto->list[1], proto->list[2]); char buffer[128]; sprintf(buffer, "resp %i", resp); protocol_response(buffer, proto); }
static void effects_preset_load_cb(proto_t *proto) { int resp; resp = effects_preset_load(atoi(proto->list[1]), proto->list[2]); char buffer[128]; sprintf(buffer, "resp %i", resp); protocol_response(buffer, proto); }
static void effects_set_param_cb(proto_t *proto) { int resp; resp = effects_set_parameter(atoi(proto->list[1]), proto->list[2], atof(proto->list[3])); char buffer[128]; sprintf(buffer, "resp %i", resp); protocol_response(buffer, proto); }
static void monitor_addr_set_cb(proto_t *proto) { int resp; if (atoi(proto->list[3]) == 1) resp = monitor_start(proto->list[1], atoi(proto->list[2])); else resp = monitor_stop(); char buffer[128]; sprintf(buffer, "resp %i", resp); protocol_response(buffer, proto); }
static void effects_monitor_param_cb(proto_t *proto) { int resp; if (monitor_status()) resp = effects_monitor_parameter(atoi(proto->list[1]), proto->list[2], proto->list[3], atof(proto->list[4])); else resp = -1; char buffer[128]; sprintf(buffer, "resp %i", resp); protocol_response(buffer, proto); }
static void effects_get_param_cb(proto_t *proto) { int resp; float value; resp = effects_get_parameter(atoi(proto->list[1]), proto->list[2], &value); char buffer[128]; if (resp >= 0) sprintf(buffer, "resp %i %.04f", resp, value); else sprintf(buffer, "resp %i", resp); protocol_response(buffer, proto); }
static void save_cb(proto_t *proto) { HIST_ENTRY *entry; if (history_length > 0) { /* removes the save command from history */ entry = remove_history(history_length-1); free_history_entry(entry); /* saves the history in the file */ write_history(proto->list[1]); protocol_response("resp 0", proto); } }
static void bundle_remove(proto_t *proto) { effects_bundle_remove(proto->list[1]); protocol_response("resp 0", proto); }