From fd0f0ba9c9b457612974df63f88ad057c0a8deca Mon Sep 17 00:00:00 2001 From: Hanspeter Portner Date: Sun, 29 Nov 2015 10:00:40 +0100 Subject: [PATCH] update static groups attributes. --- config/config.c | 73 ++++++++++++++++++++++++----------------------- scsynth/scsynth.c | 6 ++-- 2 files changed, 41 insertions(+), 38 deletions(-) diff --git a/config/config.c b/config/config.c index e798f43..b0f8a49 100644 --- a/config/config.c +++ b/config/config.c @@ -240,45 +240,48 @@ Config config = { } }, - .scsynth_groups = { - [0] = { - .name = {'g', 'r', 'o', 'u', 'p', '0', '\0'}, - .sid = 1000, - .group = 0, - .out = 0, - .arg = 0, - .alloc = 1, - .gate = 1, - .add_action = SCSYNTH_ADD_TO_HEAD, - .is_group = 0 - }, - [1] = { - .name = {'g', 'r', 'o', 'u', 'p', '1', '\0'}, - .sid = 1000, - .group = 1, - .out = 1, - .arg = 0, - .alloc = 1, - .gate = 1, - .add_action = SCSYNTH_ADD_TO_HEAD, - .is_group = 0 +#define SYNTH_DEF(C, N) \ + { \ + .name = {'s', 'y', 'n', 't', 'h', '_', C, '\0'}, \ + .sid = 200, \ + .group = 100 + N, \ + .out = N, \ + .arg = 0, \ + .alloc = 1, \ + .gate = 1, \ + .add_action = SCSYNTH_ADD_TO_HEAD, \ + .is_group = 0 \ } + .scsynth_groups = { + [0] = SYNTH_DEF('0', 0), + [1] = SYNTH_DEF('1', 1), + [2] = SYNTH_DEF('2', 2), + [3] = SYNTH_DEF('3', 3), + [4] = SYNTH_DEF('4', 4), + [5] = SYNTH_DEF('5', 5), + [6] = SYNTH_DEF('6', 6), + [7] = SYNTH_DEF('7', 7) }, - - .oscmidi_groups = { - [0] = { - .mapping = OSC_MIDI_MAPPING_CONTROL_CHANGE, - .control = 0x07, - .offset = MIDI_BOT, - .range = MIDI_RANGE - }, - [1] = { - .mapping = OSC_MIDI_MAPPING_CONTROL_CHANGE, - .control = 0x07, - .offset = MIDI_BOT, - .range = MIDI_RANGE +#undef SYNTH_DEF + +#define MIDI_DEF \ + { \ + .mapping = OSC_MIDI_MAPPING_CONTROL_CHANGE, \ + .control = 0x07, \ + .offset = MIDI_BOT, \ + .range = MIDI_RANGE \ } + .oscmidi_groups = { + [0] = MIDI_DEF, + [1] = MIDI_DEF, + [2] = MIDI_DEF, + [3] = MIDI_DEF, + [4] = MIDI_DEF, + [5] = MIDI_DEF, + [6] = MIDI_DEF, + [7] = MIDI_DEF } +#undef MIDI_DEF }; uint16_t diff --git a/scsynth/scsynth.c b/scsynth/scsynth.c index 9be4c64..3e95135 100644 --- a/scsynth/scsynth.c +++ b/scsynth/scsynth.c @@ -46,7 +46,7 @@ static const char *set_fmt [2] = { [1] = "iiiffff" // derivatives }; -static const char *default_fmt = "group%02i"; +static const char *default_fmt = "synth_%i"; static OSC_Timetag tt; @@ -260,8 +260,8 @@ _scsynth_reset(const char *path, const char *fmt, uint_fast8_t argc, osc_data_t { SCSynth_Group *group = &scsynth_groups[i]; sprintf(group->name, default_fmt, i); - group->sid = 1000; - group->group = i; + group->sid = 200; + group->group = 100 + i; group->out = i; group->arg = 0; group->alloc = 1; -- 2.38.5