8 #include <netinet/in.h>
28 void *status_socket = NULL;
29 void *notify_socket = NULL;
31 static lives_osc *livesOSC = NULL;
33 static char constval[OSC_CONSTLEN];
35 static boolean via_shortcut =
FALSE;
37 #define FX_MAX FX_KEYS_MAX_VIRTUAL-1
41 static boolean osc_init_generator(livespointer data) {
52 static int toInt(
const char *b) {
54 return (((
int) b[3]) & 0xff) + ((((int) b[2]) & 0xff) << 8) + ((((int) b[1]) & 0xff) << 16) +
55 ((((int) b[0]) & 0xff) << 24);
57 return (((
int) b[0]) & 0xff) + ((((int) b[1]) & 0xff) << 8) + ((((int) b[2]) & 0xff) << 16) +
58 ((((int) b[3]) & 0xff) << 24);
62 static boolean using_types;
63 static int osc_header_len;
67 static int lives_osc_get_num_arguments(
const void *vargs) {
69 const char *args = (
const char *)vargs;
70 if (args[0] != 0x2c)
return 0;
71 return strlen(args) - 1;
75 static boolean lives_osc_check_arguments(
int arglen,
const void *vargs,
const char *check_pattern,
boolean calc_header_len) {
78 const char *args = (
const char *)vargs;
85 if (arglen < 4 || args[0] != 0x2c)
return FALSE;
88 header_len =
pad4(strlen(check_pattern) + 1);
90 if (arglen < header_len)
return FALSE;
91 if (!strncmp(check_pattern, ++args, strlen(check_pattern))) {
92 if (calc_header_len) osc_header_len = header_len;
108 static void lives_osc_parse_string_argument(
const void *vargs,
char *dst) {
109 const char *args = (
char *)vargs;
110 lives_snprintf(dst, OSC_STRING_SIZE,
"%s", args + osc_header_len + offset);
111 offset +=
pad4(strlen(dst));
115 static void lives_osc_parse_int_argument(
const void *vargs,
int *arguments) {
116 const char *args = (
char *)vargs;
117 arguments[0] = toInt(args + osc_header_len + offset);
122 static void lives_osc_parse_float_argument(
const void *vargs,
float *arguments) {
123 const char *args = (
char *)vargs;
130 void *lives_osc_malloc(
int num_bytes) {
137 boolean lives_status_send(
const char *msg) {
138 if (!status_socket)
return FALSE;
141 boolean retval =
lives_stream_out(status_socket, strlen(msg) + 1, (
void *)msg);
147 boolean lives_osc_notify(
int msgnumber,
const char *msgstring) {
148 if (!notify_socket)
return FALSE;
164 boolean lives_osc_notify_success(
const char *msg) {
171 boolean lives_osc_notify_failure(
void) {
185 void lives_osc_close_status_socket(
void) {
187 status_socket = NULL;
191 void lives_osc_close_notify_socket(
void) {
193 notify_socket = NULL;
198 lives_snprintf(constval, OSC_CONSTLEN,
"%d", what);
199 return (
const char *)&constval;
203 static const char *get_omc_const(
const char *cname) {
205 if (!strcmp(cname,
"LIVES_LOOP_MODE_NONE"))
return "0";
206 if (!strcmp(cname,
"LIVES_LOOP_MODE_CONTINUOUS"))
return "1";
207 if (!strcmp(cname,
"LIVES_LOOP_MODE_FIT_AUDIO"))
return "2";
210 if (!strcmp(cname,
"LIVES_INTERFACE_MODE_CLIPEDIT"))
return "0";
211 if (!strcmp(cname,
"LIVES_INTERFACE_MODE_MULTITRACK"))
return "1";
214 if (!strcmp(cname,
"LIVES_STATUS_NOTREADY"))
return "0";
215 if (!strcmp(cname,
"LIVES_STATUS_READY"))
return "1";
216 if (!strcmp(cname,
"LIVES_STATUS_PLAYING"))
return "2";
217 if (!strcmp(cname,
"LIVES_STATUS_PROCESSING"))
return "3";
218 if (!strcmp(cname,
"LIVES_STATUS_PREVIEW"))
return "4";
221 if (!strcmp(cname,
"LIVES_PARAM_TYPE_INTEGER"))
222 return get_value_of((
const int)WEED_PARAM_INTEGER);
223 if (!strcmp(cname,
"LIVES_PARAM_TYPE_FLOAT"))
224 return get_value_of((
const int)WEED_PARAM_FLOAT);
225 if (!strcmp(cname,
"LIVES_PARAM_TYPE_BOOL"))
226 return get_value_of((
const int)WEED_PARAM_SWITCH);
227 if (!strcmp(cname,
"LIVES_PARAM_TYPE_STRING"))
228 return get_value_of((
const int)WEED_PARAM_TEXT);
229 if (!strcmp(cname,
"LIVES_PARAM_TYPE_COLOR"))
230 return get_value_of((
const int)WEED_PARAM_COLOR);
233 if (!strcmp(cname,
"LIVES_COLORSPACE_RGB_INT"))
235 if (!strcmp(cname,
"LIVES_COLORSPACE_RGBA_INT"))
237 if (!strcmp(cname,
"LIVES_COLORSPACE_RGB_FLOAT"))
239 if (!strcmp(cname,
"LIVES_COLORSPACE_RGBA_FLOAT"))
243 if (!strcmp(cname,
"LIVES_TRUE"))
return "1";
244 if (!strcmp(cname,
"LIVES_FALSE"))
return "0";
247 if (!strcmp(cname,
"LIVES_PARAM_FLAGS_REINIT_ON_VALUE_CHANGE"))
248 return get_value_of((
const int)WEED_PARAMETER_REINIT_ON_VALUE_CHANGE);
249 if (!strcmp(cname,
"LIVES_PARAM_FLAGS_VARIABLE_SIZE"))
250 return get_value_of((
const int)WEED_PARAMETER_VARIABLE_SIZE);
251 if (!strcmp(cname,
"LIVES_PARAM_FLAGS_VALUE_PER_CHANNEL"))
252 return get_value_of((
const int)WEED_PARAMETER_VALUE_PER_CHANNEL);
255 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_SUCCESS"))
257 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_FAILED"))
261 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_FRAME_SYNCH"))
263 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_PLAYBACK_STARTED"))
265 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_PLAYBACK_STOPPED"))
267 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_PLAYBACK_STOPPED_RD"))
269 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_RECORD_STARTED"))
271 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_RECORD_STOPPED"))
273 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_QUIT"))
275 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_CLIP_OPENED"))
277 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_CLIP_CLOSED"))
279 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_CLIPSET_OPENED"))
281 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_CLIPSET_SAVED"))
283 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_SUCCESS"))
285 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_FAILED"))
287 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_CANCELLED"))
289 if (!strcmp(cname,
"LIVES_OSC_NOTIFY_MODE_CHANGED"))
293 if (!strcmp(cname,
"LIVES_AUDIO_SOURCE_INTERNAL"))
295 if (!strcmp(cname,
"LIVES_AUDIO_SOURCE_EXTERNAL"))
299 if (!strcmp(cname,
"LIVES_FPS_MAX"))
300 return get_value_of((
const int)
FPS_MAX);
302 if (!strcmp(cname,
"LIVES_DEFAULT_OVERRIDDEN"))
305 IGN_RET(lives_osc_notify_failure());
311 static char *lives_osc_format_result(weed_plant_t *plant,
const char *key,
int st,
int end) {
315 char *retval = NULL, *tmp;
317 if (end == -1) end = weed_leaf_num_elements(plant, key);
319 if (end <= st)
return lives_strdup(
"");
321 stype = weed_leaf_seed_type(plant, key);
324 case WEED_SEED_INT: {
325 int *vals = weed_get_int_array(plant, key, &
error);
326 for (i = st; i < end; i++) {
338 case WEED_SEED_DOUBLE: {
339 double *vals = weed_get_double_array(plant, key, &
error);
340 for (i = st; i < end; i++) {
352 case WEED_SEED_BOOLEAN: {
353 int *vals = weed_get_boolean_array(plant, key, &
error);
354 for (i = st; i < end; i++) {
368 case WEED_SEED_STRING: {
369 char **vals = weed_get_string_array(plant, key, &
error);
371 for (i = st; i < end; i++) {
392 boolean lives_osc_cb_test(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
393 int val = lives_osc_get_num_arguments(vargs);
394 lives_printerr(
"got %d\n", val);
400 boolean lives_osc_cb_play(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
410 cfile->pointer_time);
413 if (!lives_osc_check_arguments(arglen, vargs,
"ff",
FALSE)) {
414 if (!lives_osc_check_arguments(arglen, vargs,
"f",
FALSE)) {
415 if (!lives_osc_check_arguments(arglen, vargs,
"",
FALSE)) {
416 return lives_osc_notify_failure();
419 lives_osc_check_arguments(arglen, vargs,
"f",
TRUE);
420 lives_osc_parse_float_argument(vargs, &stt);
426 lives_osc_check_arguments(arglen, vargs,
"ff",
TRUE);
427 lives_osc_parse_float_argument(vargs, &stt);
428 lives_osc_parse_float_argument(vargs, &ent);
443 boolean lives_osc_cb_playsel(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
452 boolean lives_osc_cb_play_reverse(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
456 return lives_osc_notify_failure();
458 return lives_osc_notify_success(NULL);
462 boolean lives_osc_cb_bgplay_reverse(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
466 return lives_osc_notify_failure();
470 return lives_osc_notify_success(NULL);
474 boolean lives_osc_cb_play_forward(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
484 if (
cfile->pb_fps < 0 || (
cfile->play_paused &&
cfile->freeze_fps < 0))
487 return lives_osc_notify_success(NULL);
490 return lives_osc_notify_failure();
494 boolean lives_osc_cb_play_backward(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
505 if (
cfile->pb_fps > 0 || (
cfile->play_paused &&
cfile->freeze_fps > 0))
508 return lives_osc_notify_success(NULL);
511 return lives_osc_notify_failure();
515 boolean lives_osc_cb_play_faster(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
520 return lives_osc_notify_success(NULL);
524 boolean lives_osc_cb_bgplay_faster(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
531 return lives_osc_notify_success(NULL);
535 boolean lives_osc_cb_play_slower(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
540 return lives_osc_notify_success(NULL);
544 boolean lives_osc_cb_bgplay_slower(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
551 return lives_osc_notify_success(NULL);
555 boolean lives_osc_cb_play_reset(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
560 if (
cfile->pb_fps < 0 || (
cfile->play_paused &&
565 return lives_osc_notify_success(NULL);
569 boolean lives_osc_cb_bgplay_reset(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
582 return lives_osc_notify_success(NULL);
587 boolean lives_osc_cb_stop(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
590 return lives_osc_notify_success(NULL);
591 }
else return lives_osc_notify_failure();
595 boolean lives_osc_cb_set_loop(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
598 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
599 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
600 lives_osc_parse_int_argument(vargs, &lmode);
601 }
else return lives_osc_notify_failure();
603 if (lmode == atoi(get_omc_const(
"LIVES_LOOP_MODE_NONE"))) {
607 if (lmode & atoi(get_omc_const(
"LIVES_LOOP_MODE_CONTINUOUS"))) {
611 if (lmode & atoi(get_omc_const(
"LIVES_LOOP_MODE_FIT_AUDIO"))) {
616 return lives_osc_notify_success(NULL);
620 boolean lives_osc_cb_get_loop(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
624 if (
mainw->
loop) lmode |= atoi(get_omc_const(
"LIVES_LOOP_MODE_FIT_AUDIO"));
625 if (
mainw->
loop_cont) lmode |= atoi(get_omc_const(
"LIVES_LOOP_MODE_CONTINUOUS"));
628 lives_status_send(lmodes);
634 boolean lives_osc_cb_set_pingpong(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
638 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
639 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
640 lives_osc_parse_int_argument(vargs, &lmode);
642 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) lmode =
TRUE;
644 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) lmode =
FALSE;
647 return lives_osc_notify_failure();
651 }
else return lives_osc_notify_failure();
656 return lives_osc_notify_success(NULL);
660 boolean lives_osc_cb_get_pingpong(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
661 if (
mainw->
ping_pong)
return lives_status_send(get_omc_const(
"LIVES_TRUE"));
662 return lives_status_send(get_omc_const(
"LIVES_FALSE"));
666 boolean lives_osc_cb_set_fps(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
670 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
671 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
672 lives_osc_parse_int_argument(vargs, &fpsi);
675 if (!lives_osc_check_arguments(arglen, vargs,
"f",
TRUE))
return lives_osc_notify_failure();
676 lives_osc_parse_float_argument(vargs, &fps);
680 return lives_osc_notify_success(NULL);
684 boolean lives_osc_cb_bgset_fps(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
691 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
692 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
693 lives_osc_parse_int_argument(vargs, &fpsi);
696 if (!lives_osc_check_arguments(arglen, vargs,
"f",
TRUE))
return lives_osc_notify_failure();
697 lives_osc_parse_float_argument(vargs, &fps);
701 return lives_osc_notify_success(NULL);
705 boolean lives_osc_cb_set_fps_ratio(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
709 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
710 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
711 lives_osc_parse_int_argument(vargs, &fpsi);
714 if (!lives_osc_check_arguments(arglen, vargs,
"f",
TRUE))
return lives_osc_notify_failure();
715 lives_osc_parse_float_argument(vargs, &fps);
720 return lives_osc_notify_success(NULL);
724 boolean lives_osc_cb_bgset_fps_ratio(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
725 NetworkReturnAddressPtr ra) {
732 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
733 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
734 lives_osc_parse_int_argument(vargs, &fpsi);
737 if (!lives_osc_check_arguments(arglen, vargs,
"f",
TRUE))
return lives_osc_notify_failure();
738 lives_osc_parse_float_argument(vargs, &fps);
742 return lives_osc_notify_success(NULL);
746 boolean lives_osc_cb_fx_reset(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
748 return lives_osc_notify_success(NULL);
752 boolean lives_osc_cb_fx_map_clear(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
754 return lives_osc_notify_success(NULL);
758 boolean lives_osc_cb_fx_map(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
760 char effect_name[OSC_STRING_SIZE];
762 if (!lives_osc_check_arguments(arglen, vargs,
"is",
TRUE))
return lives_osc_notify_failure();
763 lives_osc_parse_int_argument(vargs, &effect_key);
764 lives_osc_parse_string_argument(vargs, effect_name);
768 return lives_osc_notify_success(NULL);
770 return lives_osc_notify_failure();
774 boolean lives_osc_cb_fx_unmap(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
778 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
779 lives_osc_parse_int_argument(vargs, &effect_key);
780 lives_osc_parse_int_argument(vargs, &mode);
785 return lives_osc_notify_success(NULL);
787 return lives_osc_notify_failure();
791 static boolean osc_fx_on(
int effect_key) {
797 if (!filter)
return lives_osc_notify_failure();
799 if (!
LIVES_IS_PLAYING && via_shortcut && count != 0)
return lives_osc_notify_failure();
805 lives_timer_add_simple(0, osc_init_generator, LIVES_INT_TO_POINTER(effect_key));
811 return lives_osc_notify_success(NULL);
815 boolean lives_osc_cb_fx_enable(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
820 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
821 lives_osc_parse_int_argument(vargs, &effect_key);
826 return osc_fx_on(effect_key);
828 }
else return lives_osc_notify_failure();
830 return lives_osc_notify_success(NULL);
834 boolean lives_osc_cb_fx_disable(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
837 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
838 lives_osc_parse_int_argument(vargs, &effect_key);
843 return lives_osc_notify_success(NULL);
846 return lives_osc_notify_failure();
850 boolean lives_osc_cb_fx_toggle(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
854 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
855 lives_osc_parse_int_argument(vargs, &effect_key);
859 return osc_fx_on(effect_key);
864 return lives_osc_notify_success(NULL);
871 boolean lives_osc_cb_fgclip_set(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
879 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
880 lives_osc_parse_int_argument(vargs, &clip);
887 lives_osc_notify_success(msg);
893 return lives_osc_notify_failure();
897 boolean lives_osc_cb_bgclip_set(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
905 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
906 lives_osc_parse_int_argument(vargs, &clip);
912 lives_osc_notify_success(msg);
917 return lives_osc_notify_failure();
921 boolean lives_osc_cb_fgclip_select(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
928 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
929 lives_osc_parse_int_argument(vargs, &clip);
931 if (clip < 1 || !mainw->cliplist)
return lives_osc_notify_failure();
936 if (clip > lives_list_length(
mainw->
cliplist))
return lives_osc_notify_failure();
938 i = LIVES_POINTER_TO_INT(lives_list_nth_data(
mainw->
cliplist, clip - 1));
945 lives_osc_notify_success(msg);
949 return lives_osc_notify_failure();
953 boolean lives_osc_cb_bgclip_select(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
962 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
963 lives_osc_parse_int_argument(vargs, &clip);
965 if (clip < 1 || !mainw->cliplist)
return lives_osc_notify_failure();
971 if (clip > lives_list_length(
mainw->
cliplist))
return lives_osc_notify_failure();
975 i = LIVES_POINTER_TO_INT(lives_list_nth_data(
mainw->
cliplist, clip - 1));
982 lives_osc_notify_success(msg);
988 boolean lives_osc_cb_clip_resample(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
999 if (!lives_osc_check_arguments(arglen, vargs,
"f",
FALSE)) {
1000 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
1001 lives_osc_parse_int_argument(vargs, &fps);
1002 fpsd = (double)(fps * 1.);
1004 lives_osc_check_arguments(arglen, vargs,
"f",
TRUE);
1005 lives_osc_parse_float_argument(vargs, &fpsf);
1006 fpsd = (double)fpsf;
1009 if (fpsd < 1. && fpsd >
FPS_MAX)
return lives_osc_notify_failure();
1011 cfile->undo1_dbl = fpsd;
1015 return lives_osc_notify_success(NULL);
1019 boolean lives_osc_cb_clip_close(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1022 int current_file = clipno;
1031 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
1032 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
1033 lives_osc_parse_int_argument(vargs, &noaudio);
1035 return lives_osc_notify_failure();
1039 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) noaudio =
TRUE;
1041 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) noaudio =
FALSE;
1044 return lives_osc_notify_failure();
1050 return lives_osc_notify_failure();
1052 if (clipno == current_file) current_file = -1;
1057 return lives_osc_notify_success(NULL);
1061 boolean lives_osc_cb_clip_undo(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1063 int current_file = clipno;
1070 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
1071 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
1072 lives_osc_parse_int_argument(vargs, &clipno);
1073 }
else if (!lives_osc_check_arguments(arglen, vargs,
"",
TRUE)) {
1074 return lives_osc_notify_failure();
1077 if (!
IS_VALID_CLIP(clipno))
return lives_osc_notify_failure();
1087 return lives_osc_notify_success(NULL);
1091 boolean lives_osc_cb_clip_redo(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1093 int current_file = clipno;
1100 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
1101 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
1102 lives_osc_parse_int_argument(vargs, &clipno);
1103 }
else if (!lives_osc_check_arguments(arglen, vargs,
"",
TRUE)) {
1104 return lives_osc_notify_failure();
1107 if (!
IS_VALID_CLIP(clipno))
return lives_osc_notify_failure();
1117 return lives_osc_notify_success(NULL);
1121 boolean lives_osc_cb_fgclip_copy(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1124 int start, end, current_file = clipno;
1134 if (lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
1135 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
1136 lives_osc_parse_int_argument(vargs, &noaudio);
1137 lives_osc_parse_int_argument(vargs, &clipno);
1138 }
else if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
1139 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
1140 lives_osc_parse_int_argument(vargs, &noaudio);
1141 }
else if (!lives_osc_check_arguments(arglen, vargs,
"",
TRUE)) {
1142 return lives_osc_notify_failure();
1146 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) noaudio =
TRUE;
1148 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) noaudio =
FALSE;
1151 return lives_osc_notify_failure();
1156 if (!
IS_NORMAL_CLIP(clipno) || clipno == 0)
return lives_osc_notify_failure();
1159 start =
cfile->start;
1173 cfile->start = start;
1178 return lives_osc_notify_success(NULL);
1182 boolean lives_osc_cb_fgclipsel_rteapply(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
1183 NetworkReturnAddressPtr ra) {
1185 int current_file = clipno;
1192 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
1193 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
1194 lives_osc_parse_int_argument(vargs, &clipno);
1195 }
else if (!lives_osc_check_arguments(arglen, vargs,
"",
TRUE)) {
1196 return lives_osc_notify_failure();
1199 if (!
IS_NORMAL_CLIP(clipno) || clipno == 0)
return lives_osc_notify_failure();
1207 return lives_osc_notify_success(NULL);
1211 boolean lives_osc_cb_fgclipsel_copy(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1214 int current_file = clipno;
1224 if (lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
1225 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
1226 lives_osc_parse_int_argument(vargs, &noaudio);
1227 lives_osc_parse_int_argument(vargs, &clipno);
1228 }
else if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
1229 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
1230 lives_osc_parse_int_argument(vargs, &noaudio);
1231 }
else if (!lives_osc_check_arguments(arglen, vargs,
"",
TRUE)) {
1232 return lives_osc_notify_failure();
1236 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) noaudio =
TRUE;
1238 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) noaudio =
FALSE;
1241 return lives_osc_notify_failure();
1246 if (!
IS_NORMAL_CLIP(clipno) || clipno == 0)
return lives_osc_notify_failure();
1260 return lives_osc_notify_success(NULL);
1264 boolean lives_osc_cb_fgclipsel_cut(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1267 int current_file = clipno;
1278 if (lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
1279 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
1280 lives_osc_parse_int_argument(vargs, &noaudio);
1281 lives_osc_parse_int_argument(vargs, &clipno);
1282 }
else if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
1283 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
1284 lives_osc_parse_int_argument(vargs, &noaudio);
1285 }
else if (!lives_osc_check_arguments(arglen, vargs,
"",
TRUE)) {
1286 return lives_osc_notify_failure();
1290 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) noaudio =
TRUE;
1292 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) noaudio =
FALSE;
1295 return lives_osc_notify_failure();
1300 if (!
IS_NORMAL_CLIP(clipno) || clipno == 0)
return lives_osc_notify_failure();
1316 return lives_osc_notify_success(NULL);
1320 boolean lives_osc_cb_fgclipsel_delete(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
1321 NetworkReturnAddressPtr ra) {
1324 int current_file = clipno;
1335 if (lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
1336 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
1337 lives_osc_parse_int_argument(vargs, &noaudio);
1338 lives_osc_parse_int_argument(vargs, &clipno);
1339 }
else if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
1340 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
1341 lives_osc_parse_int_argument(vargs, &noaudio);
1342 }
else if (!lives_osc_check_arguments(arglen, vargs,
"",
TRUE)) {
1343 return lives_osc_notify_failure();
1347 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) noaudio =
TRUE;
1349 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) noaudio =
FALSE;
1352 return lives_osc_notify_failure();
1357 if (!
IS_NORMAL_CLIP(clipno) || clipno == 0)
return lives_osc_notify_failure();
1373 return lives_osc_notify_success(NULL);
1377 boolean lives_osc_cb_clipbd_paste(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1385 if (!
clipboard)
return lives_osc_notify_failure();
1390 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
1391 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
1392 lives_osc_parse_int_argument(vargs, &noaudio);
1393 }
else if (!lives_osc_check_arguments(arglen, vargs,
"",
TRUE)) {
1394 return lives_osc_notify_failure();
1398 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) noaudio =
TRUE;
1400 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) noaudio =
FALSE;
1403 return lives_osc_notify_failure();
1416 return lives_osc_notify_success(NULL);
1420 boolean lives_osc_cb_clipbd_insertb(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1424 int current_file = clipno;
1434 if (lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
1435 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
1436 lives_osc_parse_int_argument(vargs, &noaudio);
1437 lives_osc_parse_int_argument(vargs, ×);
1438 lives_osc_parse_int_argument(vargs, &clipno);
1439 }
else if (lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
1440 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
1441 lives_osc_parse_int_argument(vargs, &noaudio);
1442 lives_osc_parse_int_argument(vargs, ×);
1443 }
else if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
1444 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
1445 lives_osc_parse_int_argument(vargs, &noaudio);
1446 }
else if (!lives_osc_check_arguments(arglen, vargs,
"",
TRUE)) {
1447 return lives_osc_notify_failure();
1451 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) noaudio =
TRUE;
1453 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) noaudio =
FALSE;
1456 return lives_osc_notify_failure();
1461 if (!
IS_NORMAL_CLIP(clipno) || clipno == 0)
return lives_osc_notify_failure();
1463 if (times == 0 || times < -1)
return lives_osc_notify_failure();
1478 return lives_osc_notify_success(NULL);
1482 boolean lives_osc_cb_clipbd_inserta(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1486 int current_file = clipno;
1496 if (lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
1497 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
1498 lives_osc_parse_int_argument(vargs, &noaudio);
1499 lives_osc_parse_int_argument(vargs, ×);
1500 lives_osc_parse_int_argument(vargs, &clipno);
1501 }
else if (lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
1502 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
1503 lives_osc_parse_int_argument(vargs, &noaudio);
1504 lives_osc_parse_int_argument(vargs, ×);
1505 }
else if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
1506 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
1507 lives_osc_parse_int_argument(vargs, &noaudio);
1508 }
else if (!lives_osc_check_arguments(arglen, vargs,
"",
TRUE)) {
1509 return lives_osc_notify_failure();
1513 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) noaudio =
TRUE;
1515 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) noaudio =
FALSE;
1518 return lives_osc_notify_failure();
1523 if (!
IS_NORMAL_CLIP(clipno) || clipno == 0)
return lives_osc_notify_failure();
1525 if (times == 0 || times < -1)
return lives_osc_notify_failure();
1544 return lives_osc_notify_success(NULL);
1548 boolean lives_osc_cb_fgclip_retrigger(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
1549 NetworkReturnAddressPtr ra) {
1555 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
1557 lives_osc_cb_fgclip_select(context, arglen, vargs, when, ra);
1567 return lives_osc_notify_success(NULL);
1571 boolean lives_osc_cb_bgclip_retrigger(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
1572 NetworkReturnAddressPtr ra) {
1578 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
1580 lives_osc_cb_bgclip_select(context, arglen, vargs, when, ra);
1589 return lives_osc_notify_success(NULL);
1593 boolean lives_osc_cb_fgclip_select_next(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
1594 NetworkReturnAddressPtr ra) {
1601 nextclip_callback(NULL, NULL, 0, (LiVESXModifierType)0, LIVES_INT_TO_POINTER(1));
1605 lives_osc_notify_success(msg);
1609 return lives_osc_notify_failure();
1613 boolean lives_osc_cb_bgclip_select_next(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
1614 NetworkReturnAddressPtr ra) {
1622 nextclip_callback(NULL, NULL, 0, (LiVESXModifierType)0, LIVES_INT_TO_POINTER(2));
1626 lives_osc_notify_success(msg);
1630 return lives_osc_notify_failure();
1634 boolean lives_osc_cb_fgclip_select_previous(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
1635 NetworkReturnAddressPtr ra) {
1642 prevclip_callback(NULL, NULL, 0, (LiVESXModifierType)0, LIVES_INT_TO_POINTER(1));
1646 lives_osc_notify_success(msg);
1650 return lives_osc_notify_failure();
1654 boolean lives_osc_cb_bgclip_select_previous(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
1655 NetworkReturnAddressPtr ra) {
1664 prevclip_callback(NULL, NULL, 0, (LiVESXModifierType)0, LIVES_INT_TO_POINTER(2));
1668 lives_osc_notify_success(msg);
1672 return lives_osc_notify_failure();
1676 boolean lives_osc_cb_quit(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1688 boolean lives_osc_cb_getname(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1689 return lives_status_send(PACKAGE_NAME);
1693 boolean lives_osc_cb_getversion(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1694 return lives_status_send(VERSION);
1698 boolean lives_osc_cb_getstatus(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1699 if (
mainw->
go_away)
return lives_status_send(get_omc_const(
"LIVES_STATUS_NOTREADY"));
1700 if (
LIVES_IS_PLAYING)
return lives_status_send(get_omc_const(
"LIVES_STATUS_PLAYING"));
1701 if (
mainw->
is_processing)
return lives_status_send(get_omc_const(
"LIVES_STATUS_PROCESSING"));
1703 !
LIVES_IS_PLAYING))))
return lives_status_send(get_omc_const(
"LIVES_STATUS_PREVIEW"));
1704 return lives_status_send(get_omc_const(
"LIVES_STATUS_READY"));
1708 boolean lives_osc_cb_getconst(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1710 char cname[OSC_STRING_SIZE];
1712 if (!lives_osc_check_arguments(arglen, vargs,
"s",
TRUE))
return lives_osc_notify_failure();
1713 lives_osc_parse_string_argument(vargs, cname);
1714 retval = get_omc_const(cname);
1715 return lives_status_send(retval);
1719 boolean lives_osc_cb_open_status_socket(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
1720 NetworkReturnAddressPtr ra) {
1721 char host[OSC_STRING_SIZE];
1724 if (!lives_osc_check_arguments(arglen, vargs,
"si",
FALSE)) {
1725 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
1726 lives_snprintf(host, OSC_STRING_SIZE,
"localhost");
1728 lives_osc_check_arguments(arglen, vargs,
"si",
TRUE);
1729 lives_osc_parse_string_argument(vargs, host);
1731 lives_osc_parse_int_argument(vargs, &port);
1733 if (status_socket) {
1734 LIVES_INFO(
"OMC status socket already opened");
1735 return lives_osc_notify_failure();
1739 LIVES_WARN(
"Unable to open status socket !");
1740 return lives_osc_notify_failure();
1743 return lives_osc_notify_success(NULL);
1747 boolean lives_osc_cb_open_notify_socket(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
1748 NetworkReturnAddressPtr ra) {
1749 char host[OSC_STRING_SIZE];
1752 if (!lives_osc_check_arguments(arglen, vargs,
"si",
FALSE)) {
1753 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
1754 lives_snprintf(host, OSC_STRING_SIZE,
"localhost");
1756 lives_osc_check_arguments(arglen, vargs,
"si",
TRUE);
1757 lives_osc_parse_string_argument(vargs, host);
1759 lives_osc_parse_int_argument(vargs, &port);
1761 if (notify_socket) {
1762 LIVES_INFO(
"OMC notify socket already opened");
1763 return lives_osc_notify_failure();
1768 LIVES_WARN(
"Unable to open notify socket !");
1769 return lives_osc_notify_failure();
1771 return lives_osc_notify_success(NULL);
1775 boolean lives_osc_cb_close_status_socket(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
1776 NetworkReturnAddressPtr ra) {
1777 lives_osc_close_status_socket();
1778 return lives_osc_notify_success(NULL);
1782 boolean lives_osc_cb_notify_c(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1786 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
1787 lives_osc_parse_int_argument(vargs, &state);
1789 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) state =
TRUE;
1791 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) state =
FALSE;
1794 return lives_osc_notify_failure();
1799 return lives_osc_notify_success(NULL);
1803 boolean lives_osc_cb_notify_e(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1807 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
1808 lives_osc_parse_int_argument(vargs, &state);
1810 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) state =
TRUE;
1812 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) state =
FALSE;
1815 return lives_osc_notify_failure();
1820 return lives_osc_notify_success(NULL);
1824 boolean lives_osc_cb_clip_count(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1833 boolean lives_osc_cb_clip_goto(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1840 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
1841 lives_osc_parse_int_argument(vargs, &frame);
1845 cfile->last_frameno =
cfile->frameno = frame;
1852 return lives_osc_notify_success(NULL);
1856 boolean lives_osc_cb_clip_getframe(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1868 boolean lives_osc_cb_clip_getfps(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1882 boolean lives_osc_cb_clip_get_ifps(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1887 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
1888 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
1889 lives_osc_parse_int_argument(vargs, &clip);
1892 if (!
IS_VALID_CLIP(clip))
return lives_osc_notify_failure();
1903 boolean lives_osc_cb_get_fps_ratio(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1917 boolean lives_osc_cb_bgget_fps_ratio(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
1918 NetworkReturnAddressPtr ra) {
1934 boolean lives_osc_cb_bgclip_getframe(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
1935 NetworkReturnAddressPtr ra) {
1948 boolean lives_osc_cb_bgclip_getfps(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1961 boolean lives_osc_cb_get_amute(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1963 return lives_status_send(get_omc_const(
"LIVES_FALSE"));
1965 if (!
mainw->
mute)
return lives_status_send(get_omc_const(
"LIVES_FALSE"));
1966 else return lives_status_send(get_omc_const(
"LIVES_TRUE"));
1970 boolean lives_osc_cb_set_amute(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
1975 return lives_osc_notify_failure();
1978 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
1979 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
1980 lives_osc_parse_int_argument(vargs, &mute);
1982 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) mute =
TRUE;
1984 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) mute =
FALSE;
1987 return lives_osc_notify_failure();
1991 }
else return lives_osc_notify_failure();
1996 return lives_osc_notify_success(NULL);
2000 boolean lives_osc_cb_set_avol(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2003 if (lives_osc_check_arguments(arglen, vargs,
"f",
TRUE)) {
2004 lives_osc_parse_float_argument(vargs, &vol);
2005 }
else return lives_osc_notify_failure();
2007 if (vol < 0. || vol > 1.)
return lives_osc_notify_failure();
2011 return lives_osc_notify_success(NULL);
2015 boolean lives_osc_cb_get_avol(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2019 tmp = lives_strdup(
"100.00");
2020 lives_status_send(tmp);
2026 lives_status_send(tmp);
2033 boolean lives_osc_cb_getmode(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2034 if (
mainw->
multitrack)
return lives_status_send(get_omc_const(
"LIVES_MODE_MULTITRACK"));
2035 else return lives_status_send(get_omc_const(
"LIVES_MODE_CLIPEDIT"));
2039 boolean lives_osc_cb_setmode(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2042 int cliped = atoi(get_omc_const(
"LIVES_MODE_CLIPEDIT"));
2043 int mt = atoi(get_omc_const(
"LIVES_MODE_MULTITRACK"));
2048 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
2050 lives_osc_parse_int_argument(vargs, &mode);
2052 if (mode != cliped && mode != mt)
return lives_osc_notify_failure();
2059 lives_osc_notify_success(modes);
2065 boolean lives_osc_cb_clearlay(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2069 return lives_osc_notify_success(NULL);
2073 boolean lives_osc_cb_blockcount(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2079 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
2080 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
2081 lives_osc_parse_int_argument(vargs, &track);
2082 }
else if (lives_osc_check_arguments(arglen, vargs,
"",
TRUE)) {
2084 }
else return lives_osc_notify_failure();
2089 lives_status_send(tmp);
2095 boolean lives_osc_cb_blockinsert(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2096 int ins_audio, oins_audio;
2097 int ign_ins_sel, oign_ins_sel;
2110 if (!ign_ins_sel) ign_ins_sel = 0;
2111 else ign_ins_sel = 1;
2113 if (!ins_audio) ins_audio = 0;
2116 if (lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
2117 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
2118 lives_osc_parse_int_argument(vargs, &clip);
2119 lives_osc_parse_int_argument(vargs, &ign_ins_sel);
2120 lives_osc_parse_int_argument(vargs, &ins_audio);
2122 if (lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
2123 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
2124 lives_osc_parse_int_argument(vargs, &clip);
2125 lives_osc_parse_int_argument(vargs, &ign_ins_sel);
2126 }
else if (lives_osc_check_arguments(arglen, vargs,
"i",
TRUE)) {
2127 lives_osc_parse_int_argument(vargs, &clip);
2128 }
else return lives_osc_notify_failure();
2132 return lives_osc_notify_failure();
2135 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) ins_audio =
TRUE;
2137 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) ins_audio =
FALSE;
2140 return lives_osc_notify_failure();
2146 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) ign_ins_sel =
TRUE;
2148 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) ign_ins_sel =
FALSE;
2151 return lives_osc_notify_failure();
2169 lives_osc_notify_success(tmp);
2175 boolean lives_osc_cb_mtctimeset(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2182 if (lives_osc_check_arguments(arglen, vargs,
"f",
TRUE)) {
2183 lives_osc_parse_float_argument(vargs, &time);
2184 }
else return lives_osc_notify_failure();
2186 if (time < 0.)
return lives_osc_notify_failure();
2192 lives_osc_notify_success(msg);
2198 boolean lives_osc_cb_mtctimeget(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2204 lives_status_send(msg);
2210 boolean lives_osc_cb_mtctrackset(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2217 if (lives_osc_check_arguments(arglen, vargs,
"i",
TRUE)) {
2218 lives_osc_parse_int_argument(vargs, &track);
2219 }
else return lives_osc_notify_failure();
2225 lives_osc_notify_success(msg);
2228 }
else return lives_osc_notify_failure();
2232 boolean lives_osc_cb_mtctrackget(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2237 lives_status_send(msg);
2243 boolean lives_osc_cb_blockstget(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2250 if (lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
2251 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
2252 lives_osc_parse_int_argument(vargs, &track);
2253 lives_osc_parse_int_argument(vargs, &nblock);
2254 }
else if (lives_osc_check_arguments(arglen, vargs,
"i",
TRUE)) {
2256 lives_osc_parse_int_argument(vargs, &nblock);
2257 }
else return lives_osc_notify_failure();
2261 if (sttime < 0.)
return lives_osc_notify_failure();
2263 lives_status_send(tmp);
2267 return lives_osc_notify_failure();
2271 boolean lives_osc_cb_blockenget(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2278 if (lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
2279 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
2280 lives_osc_parse_int_argument(vargs, &track);
2281 lives_osc_parse_int_argument(vargs, &nblock);
2282 }
else if (lives_osc_check_arguments(arglen, vargs,
"i",
TRUE)) {
2284 lives_osc_parse_int_argument(vargs, &nblock);
2285 }
else return lives_osc_notify_failure();
2289 if (entime < 0.)
return lives_osc_notify_failure();
2291 lives_status_send(tmp);
2295 return lives_osc_notify_failure();
2299 boolean lives_osc_cb_get_playtime(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2311 boolean lives_osc_cb_bgclip_goto(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2319 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
2320 lives_osc_parse_int_argument(vargs, &frame);
2326 return lives_osc_notify_success(NULL);
2330 boolean lives_osc_cb_clip_get_current(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
2331 NetworkReturnAddressPtr ra) {
2339 boolean lives_osc_cb_bgclip_get_current(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
2340 NetworkReturnAddressPtr ra) {
2350 boolean lives_osc_cb_clip_set_start(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2354 int clip = current_file;
2365 if (lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
2366 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
2367 lives_osc_parse_int_argument(vargs, &frame);
2368 lives_osc_parse_int_argument(vargs, &clip);
2369 }
else if (lives_osc_check_arguments(arglen, vargs,
"i",
TRUE)) {
2370 lives_osc_parse_int_argument(vargs, &frame);
2371 }
else return lives_osc_notify_failure();
2373 if (frame < 1 || !
IS_NORMAL_CLIP(clip))
return lives_osc_notify_failure();
2382 if (sfile->
end < frame) sfile->
end = frame;
2383 sfile->
start = frame;
2388 lives_osc_notify_success(msg);
2395 boolean lives_osc_cb_clip_get_start(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2397 int clip = current_file;
2405 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
2406 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
2407 lives_osc_parse_int_argument(vargs, &clip);
2410 if (!
IS_VALID_CLIP(clip))
return lives_osc_notify_failure();
2420 boolean lives_osc_cb_clip_set_end(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2424 int clip = current_file;
2435 if (lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
2436 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
2437 lives_osc_parse_int_argument(vargs, &frame);
2438 lives_osc_parse_int_argument(vargs, &clip);
2439 }
else if (lives_osc_check_arguments(arglen, vargs,
"i",
TRUE)) {
2440 lives_osc_parse_int_argument(vargs, &frame);
2441 }
else return lives_osc_notify_failure();
2443 if (frame < 1 || !
IS_NORMAL_CLIP(clip))
return lives_osc_notify_failure();
2452 if (sfile->
start > frame) sfile->
start = frame;
2458 lives_osc_notify_success(msg);
2465 boolean lives_osc_cb_clip_get_end(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2467 int clip = current_file;
2475 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
2476 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
2477 lives_osc_parse_int_argument(vargs, &clip);
2480 if (!
IS_VALID_CLIP(clip))
return lives_osc_notify_failure();
2490 boolean lives_osc_cb_clip_get_size(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2492 int clip = current_file;
2499 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
2500 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
2501 lives_osc_parse_int_argument(vargs, &clip);
2504 if (!
IS_VALID_CLIP(clip))
return lives_osc_notify_failure();
2514 boolean lives_osc_cb_clip_get_name(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2516 int clip = current_file;
2522 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
2523 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
2524 lives_osc_parse_int_argument(vargs, &clip);
2527 if (!
IS_VALID_CLIP(clip))
return lives_osc_notify_failure();
2531 return lives_status_send(sfile->
name);
2535 boolean lives_osc_cb_clip_set_name(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2537 int clip = current_file;
2538 char name[OSC_STRING_SIZE];
2544 if (lives_osc_check_arguments(arglen, vargs,
"si",
FALSE)) {
2545 lives_osc_check_arguments(arglen, vargs,
"si",
TRUE);
2546 lives_osc_parse_string_argument(vargs, name);
2547 lives_osc_parse_int_argument(vargs, &clip);
2548 }
else if (lives_osc_check_arguments(arglen, vargs,
"s",
TRUE)) {
2550 lives_osc_parse_string_argument(vargs, name);
2551 }
else return lives_osc_notify_failure();
2553 if (!
IS_VALID_CLIP(clip))
return lives_osc_notify_failure();
2561 return lives_osc_notify_success(name);
2565 boolean lives_osc_cb_clip_get_frames(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
2566 NetworkReturnAddressPtr ra) {
2568 int clip = current_file;
2575 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
2576 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
2577 lives_osc_parse_int_argument(vargs, &clip);
2580 if (!
IS_VALID_CLIP(clip))
return lives_osc_notify_failure();
2590 boolean lives_osc_cb_clip_save_frame(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
2591 NetworkReturnAddressPtr ra) {
2593 int clip = current_file;
2594 int frame, width = -1, height = -1;
2595 char fname[OSC_STRING_SIZE];
2603 if (!lives_osc_check_arguments(arglen, vargs,
"is",
FALSE)) {
2604 if (!lives_osc_check_arguments(arglen, vargs,
"iis",
FALSE)) {
2605 if (!lives_osc_check_arguments(arglen, vargs,
"isii",
FALSE)) {
2606 if (!lives_osc_check_arguments(arglen, vargs,
"iisii",
TRUE)) {
2607 return lives_osc_notify_failure();
2609 lives_osc_parse_int_argument(vargs, &frame);
2610 lives_osc_parse_int_argument(vargs, &clip);
2611 lives_osc_parse_string_argument(vargs, fname);
2612 lives_osc_parse_int_argument(vargs, &width);
2613 lives_osc_parse_int_argument(vargs, &height);
2615 lives_osc_check_arguments(arglen, vargs,
"isii",
TRUE);
2617 lives_osc_parse_int_argument(vargs, &frame);
2618 lives_osc_parse_string_argument(vargs, fname);
2619 lives_osc_parse_int_argument(vargs, &width);
2620 lives_osc_parse_int_argument(vargs, &height);
2623 lives_osc_check_arguments(arglen, vargs,
"iis",
TRUE);
2624 lives_osc_parse_int_argument(vargs, &frame);
2625 lives_osc_parse_int_argument(vargs, &clip);
2626 lives_osc_parse_string_argument(vargs, fname);
2630 lives_osc_check_arguments(arglen, vargs,
"is",
TRUE);
2631 lives_osc_parse_int_argument(vargs, &frame);
2632 lives_osc_parse_string_argument(vargs, fname);
2635 if (frame < 1 || !
IS_NORMAL_CLIP(clip))
return lives_osc_notify_failure();
2639 if (frame > sfile->
frames)
return lives_osc_notify_failure();
2643 if (retval)
return lives_osc_notify_success(NULL);
2644 else return lives_osc_notify_failure();
2648 boolean lives_osc_cb_clip_select_all(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
2649 NetworkReturnAddressPtr ra) {
2661 return lives_osc_notify_success(NULL);
2665 boolean lives_osc_cb_clip_isvalid(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2668 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
2669 lives_osc_parse_int_argument(vargs, &clip);
2674 return lives_status_send(get_omc_const(
"LIVES_TRUE"));
2675 else return lives_status_send(get_omc_const(
"LIVES_FALSE"));
2679 boolean lives_osc_cb_rte_count(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2688 boolean lives_osc_cb_rteuser_count(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2697 boolean lives_osc_cb_fssepwin_enable(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
2698 NetworkReturnAddressPtr ra) {
2706 return lives_osc_notify_success(NULL);
2710 boolean lives_osc_cb_fssepwin_disable(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
2711 NetworkReturnAddressPtr ra) {
2718 return lives_osc_notify_success(NULL);
2722 boolean lives_osc_cb_op_fps_set(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2729 if (!lives_osc_check_arguments(arglen, vargs,
"f",
FALSE)) {
2730 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
2731 lives_osc_parse_int_argument(vargs, &fps);
2732 fpsd = (double)(fps * 1.);
2734 lives_osc_check_arguments(arglen, vargs,
"f",
TRUE);
2735 lives_osc_parse_float_argument(vargs, &fpsf);
2736 fpsd = (double)fpsf;
2738 if (fpsd > 0. && fpsd <=
FPS_MAX) {
2740 d_print(
_(
"Syncing to external framerate of %.8f frames per second.\n"), fpsd);
2743 else return lives_osc_notify_failure();
2746 lives_osc_notify_success(msg);
2752 boolean lives_osc_cb_pref_set_audio_source(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
2753 NetworkReturnAddressPtr ra) {
2756 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
2757 lives_osc_parse_int_argument(vargs, &val);
2760 return lives_osc_notify_success(NULL);
2764 boolean lives_osc_cb_pref_get_audio_source(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
2765 NetworkReturnAddressPtr ra) {
2767 return lives_status_send(get_omc_const(
"LIVES_AUDIO_SOURCE_INTERNAL"));
2771 boolean lives_osc_cb_freeze(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2777 return lives_osc_notify_success(NULL);
2781 boolean lives_osc_cb_op_nodrope(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2783 return lives_osc_notify_success(NULL);
2787 boolean lives_osc_cb_op_nodropd(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2789 return lives_osc_notify_success(NULL);
2793 boolean lives_osc_cb_fx_getname(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2797 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
2798 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
2799 lives_osc_parse_int_argument(vargs, &fidx);
2800 }
else return lives_osc_notify_failure();
2804 lives_status_send(retval);
2812 boolean lives_osc_cb_clip_encodeas(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2813 char fname[OSC_STRING_SIZE];
2820 if (!
cfile ||
cfile->opening)
return lives_osc_notify_failure();
2825 if (!lives_osc_check_arguments(arglen, vargs,
"siif",
FALSE)) {
2826 if (!lives_osc_check_arguments(arglen, vargs,
"sii",
FALSE)) {
2827 if (!lives_osc_check_arguments(arglen, vargs,
"sf",
FALSE)) {
2828 if (!lives_osc_check_arguments(arglen, vargs,
"s",
TRUE))
2829 return lives_osc_notify_failure();
2830 lives_osc_parse_string_argument(vargs, fname);
2832 lives_osc_check_arguments(arglen, vargs,
"sf",
TRUE);
2833 lives_osc_parse_string_argument(vargs, fname);
2836 lives_osc_check_arguments(arglen, vargs,
"sii",
TRUE);
2837 lives_osc_parse_string_argument(vargs, fname);
2842 lives_osc_check_arguments(arglen, vargs,
"siif",
TRUE);
2843 lives_osc_parse_string_argument(vargs, fname);
2849 if (
cfile->frames == 0) {
2852 return lives_osc_notify_success(NULL);
2858 return lives_osc_notify_success(NULL);
2862 boolean lives_osc_cb_rte_setmode(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2866 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
2867 lives_osc_parse_int_argument(vargs, &effect_key);
2868 lives_osc_parse_int_argument(vargs, &mode);
2873 return lives_osc_notify_success(NULL);
2877 boolean lives_osc_cb_rte_nextmode(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2880 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
2881 lives_osc_parse_int_argument(vargs, &effect_key);
2882 if (effect_key < 1 || effect_key >=
FX_KEYS_MAX_VIRTUAL)
return lives_osc_notify_failure();
2885 return lives_osc_notify_success(NULL);
2889 boolean lives_osc_cb_rte_prevmode(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
2892 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
2893 lives_osc_parse_int_argument(vargs, &effect_key);
2894 if (effect_key < 1 || effect_key >=
FX_KEYS_MAX_VIRTUAL)
return lives_osc_notify_failure();
2897 return lives_osc_notify_success(NULL);
2903 static boolean setfx(weed_plant_t *plant, weed_plant_t *tparam,
int pnum,
int nargs,
const void *vargs,
int skip) {
2907 weed_plant_t *ptmpl, *inst = NULL;
2913 int ptype, cspace = -1;
2917 int maxi_r = 255, maxi_g = 255, maxi_b = 255, maxi_a = 255, mini_r = 0, mini_g = 0, mini_b = 0, mini_a = 0, mini, maxi;
2920 double maxd_r = 1., maxd_g = 1., maxd_b = 1., maxd_a = 1., mind_r = 0., mind_g = 0., mind_b = 0., mind_a = 0., mind, maxd;
2921 char values[OSC_STRING_SIZE];
2922 const char *pattern;
2924 if (nargs <= 0)
return FALSE;
2929 ptmpl = weed_get_plantptr_value(tparam, WEED_LEAF_TEMPLATE, NULL);
2935 if (ptype == WEED_PARAM_COLOR) cspace = weed_get_int_value(ptmpl, WEED_LEAF_COLORSPACE, NULL);
2938 if (nargs > (defargs = weed_leaf_num_elements(ptmpl, WEED_LEAF_DEFAULT))) {
2939 if (!(ptype == WEED_PARAM_COLOR && defargs == 1 && ((cspace == WEED_COLORSPACE_RGB && (nargs % 3 == 0)) ||
2940 (cspace == WEED_COLORSPACE_RGBA &&
2947 pattern = (
char *)vargs + skip;
2950 case WEED_PARAM_INTEGER: {
2953 while (pattern[x] != 0) {
2954 if (pattern[x] ==
'f') {
2957 lives_osc_parse_float_argument(vargs, &valuef);
2959 }
else if (pattern[x] ==
'i') {
2960 lives_osc_parse_int_argument(vargs, &valuesi[x]);
2965 mini = weed_get_int_value(ptmpl, WEED_LEAF_MIN, NULL);
2966 maxi = weed_get_int_value(ptmpl, WEED_LEAF_MAX, NULL);
2968 if (valuesi[x] < mini) valuesi[x] = mini;
2969 if (valuesi[x] > maxi) valuesi[x] = maxi;
2981 weed_set_int_array(tparam, WEED_LEAF_VALUE, nargs, valuesi);
3000 case WEED_PARAM_SWITCH: {
3004 while (pattern[x] != 0) {
3005 if (pattern[x] ==
'i') {
3006 lives_osc_parse_int_argument(vargs, &valuesb[x]);
3011 valuesb[x] = !!valuesb[x];
3015 if (weed_plant_has_leaf(ptmpl, WEED_LEAF_GROUP))
3016 group = weed_get_int_value(ptmpl, WEED_LEAF_GROUP, NULL);
3018 if (group != 0 && valuesb[0] == WEED_FALSE)
goto grpinvalid;
3022 weed_set_boolean_array(tparam, WEED_LEAF_VALUE, nargs, valuesb);
3037 for (pnum = 0; pnum < nparams; pnum++) {
3040 if (xtparam != tparam) {
3043 if (ptype == WEED_PARAM_SWITCH) {
3046 if (weed_plant_has_leaf(ptmpl, WEED_LEAF_GROUP))
3047 xgroup = weed_get_int_value(ptmpl, WEED_LEAF_GROUP, NULL);
3049 if (xgroup == group) {
3051 weed_set_boolean_value(xtparam, WEED_LEAF_VALUE, WEED_FALSE);
3067 weed_plant_t *filter = plant, *xtparam;
3070 for (pnum = 0; pnum < nparams; pnum++) {
3073 if (xtparam != tparam) {
3075 if (ptype == WEED_PARAM_SWITCH) {
3078 if (weed_plant_has_leaf(ptmpl, WEED_LEAF_GROUP))
3079 xgroup = weed_get_int_value(ptmpl, WEED_LEAF_GROUP, NULL);
3081 if (xgroup == group) {
3094 case WEED_PARAM_FLOAT: {
3097 while (pattern[x] != 0) {
3098 if (pattern[x] ==
'i') {
3101 lives_osc_parse_int_argument(vargs, &valuei);
3102 valuesd[x] = (double)(valuei);
3103 }
else if (pattern[x] ==
'f') {
3104 lives_osc_parse_float_argument(vargs, &valuef);
3105 valuesd[x] = (double)(valuef);
3110 mind = weed_get_double_value(ptmpl, WEED_LEAF_MIN, NULL);
3111 maxd = weed_get_double_value(ptmpl, WEED_LEAF_MAX, NULL);
3113 if (valuesd[x] < mind) valuesd[x] = mind;
3114 if (valuesd[x] > maxd) valuesd[x] = maxd;
3127 weed_set_double_array(tparam, WEED_LEAF_VALUE, nargs, valuesd);
3146 case WEED_PARAM_TEXT: {
3147 char **valuess = (
char **)
lives_malloc(nargs *
sizeof(
char *));
3149 while (pattern[x] != 0) {
3150 if (pattern[x] ==
'i') {
3153 lives_osc_parse_int_argument(vargs, &valuei);
3155 }
else if (pattern[x] ==
'f') {
3158 lives_osc_parse_float_argument(vargs, &valuef);
3160 }
else if (pattern[x] ==
's') {
3161 lives_osc_parse_string_argument(vargs, values);
3162 valuess[x] = lives_strdup(values);
3164 for (i = 0; i < x; i++)
lives_free(valuess[i]);
3174 weed_set_string_array(tparam, WEED_LEAF_VALUE, nargs, valuess);
3188 for (i = 0; i < x; i++)
lives_free(valuess[i]);
3197 case WEED_PARAM_COLOR:
3199 case WEED_COLORSPACE_RGB:
3200 if (nargs % 3 != 0)
return FALSE;
3202 if (weed_leaf_seed_type(ptmpl, WEED_LEAF_DEFAULT) == WEED_SEED_INT) {
3205 int nmins = weed_leaf_num_elements(ptmpl, WEED_LEAF_MIN);
3206 int nmaxs = weed_leaf_num_elements(ptmpl, WEED_LEAF_MAX);
3207 int *minis = NULL, *maxis = NULL;
3212 mini_r = mini_g = mini_b = weed_get_int_value(ptmpl, WEED_LEAF_MIN, NULL);
3214 minis = weed_get_int_array(ptmpl, WEED_LEAF_MIN, NULL);
3224 maxi_r = maxi_g = maxi_b = weed_get_int_value(ptmpl, WEED_LEAF_MAX, NULL);
3226 maxis = weed_get_int_array(ptmpl, WEED_LEAF_MAX, NULL);
3236 while (pattern[x] != 0) {
3238 for (i = 0; i < 3; i++) {
3239 if (pattern[x + i] ==
'f') {
3241 lives_osc_parse_float_argument(vargs, &valuef);
3242 valuesi[x + i] =
myround(valuef);
3244 lives_osc_parse_int_argument(vargs, &valuesi[x + i]);
3249 if (valuesi[x] < mini_r) valuesi[x] = mini_r;
3250 if (valuesi[x + 1] < mini_g) valuesi[x + 1] = mini_g;
3251 if (valuesi[x + 2] < mini_b) valuesi[x + 2] = mini_b;
3253 if (valuesi[x] < minis[x]) valuesi[x] = minis[x];
3254 if (valuesi[x + 1] < minis[x + 1]) valuesi[x + 1] = minis[x + 1];
3255 if (valuesi[x + 2] < minis[x + 2]) valuesi[x + 2] = minis[x + 2];
3259 if (valuesi[x] > maxi_r) valuesi[x] = maxi_r;
3260 if (valuesi[x + 1] > maxi_g) valuesi[x + 1] = maxi_g;
3261 if (valuesi[x + 2] > maxi_b) valuesi[x + 2] = maxi_b;
3263 if (valuesi[x] > maxis[x + i]) valuesi[x] = maxis[x + i];
3264 if (valuesi[x + 1] > maxis[x + 1]) valuesi[x + 1] = maxis[x + 1];
3265 if (valuesi[x + 2] > maxis[x + 2]) valuesi[x + 2] = maxis[x + 2];
3280 weed_set_int_array(tparam, WEED_LEAF_VALUE, nargs, valuesi);
3300 double *valuesd = (
double *)
lives_malloc(nargs *
sizeof(
double));
3301 int nmins = weed_leaf_num_elements(ptmpl, WEED_LEAF_MIN);
3302 int nmaxs = weed_leaf_num_elements(ptmpl, WEED_LEAF_MAX);
3303 double *minds = NULL, *maxds = NULL;
3307 mind_r = mind_g = mind_b = weed_get_double_value(ptmpl, WEED_LEAF_MIN, NULL);
3309 minds = weed_get_double_array(ptmpl, WEED_LEAF_MIN, NULL);
3319 maxd_r = maxd_g = maxd_b = weed_get_double_value(ptmpl, WEED_LEAF_MAX, NULL);
3321 maxds = weed_get_double_array(ptmpl, WEED_LEAF_MAX, NULL);
3331 while (pattern[x] != 0) {
3333 for (i = 0; i < 3; i++) {
3334 if (pattern[x + i] ==
'i') {
3336 lives_osc_parse_int_argument(vargs, &valuei);
3337 valuesd[x + i] = (double)valuei;
3339 lives_osc_parse_float_argument(vargs, &valuef);
3340 valuesd[x + i] = (double)valuef;
3345 if (valuesd[x] < mind_r) valuesd[x] = mind_r;
3346 if (valuesd[x + 1] < mind_g) valuesd[x + 1] = mind_g;
3347 if (valuesd[x + 2] < mind_b) valuesd[x + 2] = mind_b;
3349 if (valuesd[x] < minds[x]) valuesd[x] = minds[x];
3350 if (valuesd[x + 1] < minds[x + 1]) valuesd[x + 1] = minds[x + 1];
3351 if (valuesd[x + 2] < minds[x + 2]) valuesd[x + 2] = minds[x + 2];
3355 if (valuesd[x] > maxd_r) valuesd[x] = maxd_r;
3356 if (valuesd[x + 1] > maxd_g) valuesd[x + 1] = maxd_g;
3357 if (valuesd[x + 2] > maxd_b) valuesd[x + 2] = maxd_b;
3359 if (valuesd[x] > maxds[x]) valuesd[x] = maxds[x];
3360 if (valuesd[x + 1] > maxds[x + 1]) valuesd[x + 1] = maxds[x + 1];
3361 if (valuesd[x + 2] > maxds[x + 2]) valuesd[x + 2] = maxds[x + 2];
3376 weed_set_double_array(tparam, WEED_LEAF_VALUE, nargs, valuesd);
3400 case WEED_COLORSPACE_RGBA:
3401 if (nargs & 3)
return FALSE;
3403 if (weed_leaf_seed_type(ptmpl, WEED_LEAF_DEFAULT) == WEED_SEED_INT) {
3406 int nmins = weed_leaf_num_elements(ptmpl, WEED_LEAF_MIN);
3407 int nmaxs = weed_leaf_num_elements(ptmpl, WEED_LEAF_MAX);
3408 int *minis = NULL, *maxis = NULL;
3413 mini_r = mini_g = mini_b = mini_a = weed_get_int_value(ptmpl, WEED_LEAF_MIN, NULL);
3415 minis = weed_get_int_array(ptmpl, WEED_LEAF_MIN, NULL);
3426 maxi_r = maxi_g = maxi_b = maxi_a = weed_get_int_value(ptmpl, WEED_LEAF_MAX, NULL);
3428 maxis = weed_get_int_array(ptmpl, WEED_LEAF_MAX, NULL);
3439 while (pattern[x] != 0) {
3441 for (i = 0; i < 4; i++) {
3442 if (pattern[x] ==
'f') {
3444 lives_osc_parse_float_argument(vargs, &valuef);
3445 valuesi[x + i] =
myround(valuef);
3447 lives_osc_parse_int_argument(vargs, &valuesi[x + i]);
3452 if (valuesi[x] < mini_r) valuesi[x] = mini_r;
3453 if (valuesi[x + 1] < mini_g) valuesi[x + 1] = mini_g;
3454 if (valuesi[x + 2] < mini_b) valuesi[x + 2] = mini_b;
3455 if (valuesi[x + 3] < mini_a) valuesi[x + 3] = mini_a;
3457 if (valuesi[x] < minis[x]) valuesi[x] = minis[x];
3458 if (valuesi[x + 1] < minis[x + 1]) valuesi[x + 1] = minis[x + 1];
3459 if (valuesi[x + 2] < minis[x + 2]) valuesi[x + 2] = minis[x + 2];
3460 if (valuesi[x + 3] < minis[x + 3]) valuesi[x + 3] = minis[x + 3];
3464 if (valuesi[x] > maxi_r) valuesi[x] = maxi_r;
3465 if (valuesi[x + 1] > maxi_g) valuesi[x + 1] = maxi_g;
3466 if (valuesi[x + 2] > maxi_b) valuesi[x + 2] = maxi_b;
3467 if (valuesi[x + 3] > maxi_a) valuesi[x + 3] = maxi_a;
3469 if (valuesi[x] > maxis[x]) valuesi[x] = maxis[x];
3470 if (valuesi[x + 1] > maxis[x + 1]) valuesi[x + 1] = maxis[x + 1];
3471 if (valuesi[x + 2] > maxis[x + 2]) valuesi[x + 2] = maxis[x + 2];
3472 if (valuesi[x + 3] > maxis[x + 3]) valuesi[x + 3] = maxis[x + 3];
3487 weed_set_int_array(tparam, WEED_LEAF_VALUE, nargs, valuesi);
3509 int nmins = weed_leaf_num_elements(ptmpl, WEED_LEAF_MIN);
3510 int nmaxs = weed_leaf_num_elements(ptmpl, WEED_LEAF_MAX);
3511 double *minds = NULL, *maxds = NULL;
3516 mind_r = mind_g = mind_b = mind_a = weed_get_double_value(ptmpl, WEED_LEAF_MIN, NULL);
3518 minds = weed_get_double_array(ptmpl, WEED_LEAF_MIN, NULL);
3529 maxd_r = maxd_g = maxd_b = mind_a = weed_get_double_value(ptmpl, WEED_LEAF_MAX, NULL);
3531 maxds = weed_get_double_array(ptmpl, WEED_LEAF_MAX, NULL);
3542 while (pattern[x] != 0) {
3544 for (i = 0; i < 4; i++) {
3545 if (pattern[x] ==
'i') {
3547 lives_osc_parse_int_argument(vargs, &valuei);
3548 valuesd[x + i] = (double)valuei;
3550 lives_osc_parse_float_argument(vargs, &valuef);
3551 valuesd[x + i] = (double)valuef;
3556 if (valuesd[x] < mind_r) valuesd[x] = mind_r;
3557 if (valuesd[x + 1] < mind_g) valuesd[x + 1] = mind_g;
3558 if (valuesd[x + 2] < mind_b) valuesd[x + 2] = mind_b;
3559 if (valuesd[x + 3] < mind_a) valuesd[x + 3] = mind_a;
3561 if (valuesd[x] < minds[x]) valuesd[x] = minds[x];
3562 if (valuesd[x + 1] < minds[x + 1]) valuesd[x + 1] = minds[x + 1];
3563 if (valuesd[x + 2] < minds[x + 2]) valuesd[x + 2] = minds[x + 2];
3564 if (valuesd[x + 3] < minds[x + 3]) valuesd[x + 3] = minds[x + 3];
3568 if (valuesd[x] > maxd_r) valuesd[x] = maxd_r;
3569 if (valuesd[x + 1] > maxd_g) valuesd[x + 1] = maxd_g;
3570 if (valuesd[x + 2] > maxd_b) valuesd[x + 2] = maxd_b;
3571 if (valuesd[x + 3] > maxd_a) valuesd[x + 3] = maxd_a;
3573 if (valuesd[x] > maxds[x]) valuesd[x] = maxds[x];
3574 if (valuesd[x + 1] > maxds[x + 1]) valuesd[x + 1] = maxds[x + 1];
3575 if (valuesd[x + 2] > maxds[x + 2]) valuesd[x + 2] = maxds[x + 2];
3576 if (valuesd[x + 3] > maxds[x + 3]) valuesd[x + 3] = maxds[x + 3];
3591 weed_set_double_array(tparam, WEED_LEAF_VALUE, nargs, valuesd);
3627 boolean lives_osc_cb_rte_getparamtype(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
3628 NetworkReturnAddressPtr ra) {
3629 weed_plant_t *filter;
3630 weed_plant_t *ptmpl;
3633 int effect_key, mode, pnum;
3639 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
3640 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
3641 lives_osc_parse_int_argument(vargs, &effect_key);
3642 lives_osc_parse_int_argument(vargs, &pnum);
3645 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
3646 lives_osc_parse_int_argument(vargs, &effect_key);
3647 lives_osc_parse_int_argument(vargs, &mode);
3648 lives_osc_parse_int_argument(vargs, &pnum);
3649 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
3653 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
3657 if (!filter)
return lives_osc_notify_failure();
3660 if (nparams == 0)
return lives_osc_notify_failure();
3661 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
3667 case WEED_PARAM_INTEGER:
3668 retval = get_omc_const(
"LIVES_PARAM_TYPE_INT");
3670 case WEED_PARAM_FLOAT:
3671 retval = get_omc_const(
"LIVES_PARAM_TYPE_FLOAT");
3673 case WEED_PARAM_TEXT:
3674 retval = get_omc_const(
"LIVES_PARAM_TYPE_STRING");
3676 case WEED_PARAM_SWITCH:
3677 retval = get_omc_const(
"LIVES_PARAM_TYPE_BOOL");
3679 case WEED_PARAM_COLOR:
3680 retval = get_omc_const(
"LIVES_PARAM_TYPE_COLOR");
3683 return lives_osc_notify_failure();
3686 return lives_status_send(retval);
3690 boolean lives_osc_cb_rte_getoparamtype(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
3691 NetworkReturnAddressPtr ra) {
3692 weed_plant_t *filter;
3693 weed_plant_t **out_ptmpls;
3694 weed_plant_t *ptmpl;
3697 int effect_key, mode, pnum;
3701 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
3702 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
3703 lives_osc_parse_int_argument(vargs, &effect_key);
3704 lives_osc_parse_int_argument(vargs, &pnum);
3707 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
3708 lives_osc_parse_int_argument(vargs, &effect_key);
3709 lives_osc_parse_int_argument(vargs, &mode);
3710 lives_osc_parse_int_argument(vargs, &pnum);
3711 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
3715 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
3719 if (!filter)
return lives_osc_notify_failure();
3721 if (!weed_plant_has_leaf(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES))
return lives_osc_notify_failure();
3722 nparams = weed_leaf_num_elements(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES);
3723 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
3725 out_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES, NULL);
3727 ptmpl = out_ptmpls[pnum];
3732 case WEED_PARAM_INTEGER:
3733 retval = get_omc_const(
"LIVES_PARAM_TYPE_INT");
3735 case WEED_PARAM_FLOAT:
3736 retval = get_omc_const(
"LIVES_PARAM_TYPE_FLOAT");
3738 case WEED_PARAM_TEXT:
3739 retval = get_omc_const(
"LIVES_PARAM_TYPE_STRING");
3741 case WEED_PARAM_SWITCH:
3742 retval = get_omc_const(
"LIVES_PARAM_TYPE_BOOL");
3744 case WEED_PARAM_COLOR:
3745 retval = get_omc_const(
"LIVES_PARAM_TYPE_COLOR");
3748 return lives_osc_notify_failure();
3751 return lives_status_send(retval);
3755 boolean lives_osc_cb_rte_getpparamtype(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
3756 NetworkReturnAddressPtr ra) {
3758 weed_plant_t *ptmpl, *param;
3766 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
3768 lives_osc_parse_int_argument(vargs, &pnum);
3779 case WEED_PARAM_INTEGER:
3780 retval = get_omc_const(
"LIVES_PARAM_TYPE_INT");
3782 case WEED_PARAM_FLOAT:
3783 retval = get_omc_const(
"LIVES_PARAM_TYPE_FLOAT");
3785 case WEED_PARAM_TEXT:
3786 retval = get_omc_const(
"LIVES_PARAM_TYPE_STRING");
3788 case WEED_PARAM_SWITCH:
3789 retval = get_omc_const(
"LIVES_PARAM_TYPE_BOOL");
3791 case WEED_PARAM_COLOR:
3792 retval = get_omc_const(
"LIVES_PARAM_TYPE_COLOR");
3795 return lives_osc_notify_failure();
3798 return lives_status_send(retval);
3802 boolean lives_osc_cb_rte_getnparamtype(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
3803 NetworkReturnAddressPtr ra) {
3804 weed_plant_t *filter;
3805 weed_plant_t **in_ptmpls;
3806 weed_plant_t *ptmpl;
3808 int effect_key, pnum, i;
3812 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
3814 lives_osc_parse_int_argument(vargs, &effect_key);
3815 lives_osc_parse_int_argument(vargs, &pnum);
3817 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
3821 if (!filter)
return lives_osc_notify_failure();
3822 if (!weed_plant_has_leaf(filter, WEED_LEAF_IN_PARAMETER_TEMPLATES))
return lives_osc_notify_failure();
3824 if (i == -1)
return lives_osc_notify_failure();
3825 in_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_IN_PARAMETER_TEMPLATES, NULL);
3826 ptmpl = in_ptmpls[i];
3832 case WEED_PARAM_INTEGER:
3833 retval = get_omc_const(
"LIVES_PARAM_TYPE_INT");
3835 case WEED_PARAM_FLOAT:
3836 retval = get_omc_const(
"LIVES_PARAM_TYPE_FLOAT");
3839 return lives_osc_notify_failure();
3842 return lives_status_send(retval);
3846 boolean lives_osc_cb_rte_getparamcspace(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
3847 NetworkReturnAddressPtr ra) {
3848 weed_plant_t *filter;
3849 weed_plant_t *ptmpl;
3852 int effect_key, mode;
3858 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
3859 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
3860 lives_osc_parse_int_argument(vargs, &effect_key);
3861 lives_osc_parse_int_argument(vargs, &pnum);
3864 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
3865 lives_osc_parse_int_argument(vargs, &effect_key);
3866 lives_osc_parse_int_argument(vargs, &mode);
3867 lives_osc_parse_int_argument(vargs, &pnum);
3868 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
3872 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
3876 if (!filter)
return lives_osc_notify_failure();
3879 if (nparams == 0)
return lives_osc_notify_failure();
3880 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
3886 if (ptype != WEED_PARAM_COLOR) {
3887 return lives_osc_notify_failure();
3889 cspace = weed_get_int_value(ptmpl, WEED_LEAF_COLORSPACE, NULL);
3891 stype = weed_leaf_seed_type(ptmpl, WEED_LEAF_DEFAULT);
3893 if (cspace == WEED_COLORSPACE_RGB) {
3894 if (stype == WEED_SEED_INT) retval = get_omc_const(
"LIVES_COLORSPACE_RGB_INT");
3895 else retval = get_omc_const(
"LIVES_COLORSPACE_RGB_FLOAT");
3897 if (stype == WEED_SEED_INT) retval = get_omc_const(
"LIVES_COLORSPACE_RGBA_INT");
3898 else retval = get_omc_const(
"LIVES_COLORSPACE_RGBA_FLOAT");
3901 return lives_status_send(retval);
3905 boolean lives_osc_cb_rte_getparamgrp(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
3906 NetworkReturnAddressPtr ra) {
3907 weed_plant_t *filter;
3908 weed_plant_t *ptmpl;
3911 int effect_key, mode, pnum, grp;
3915 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
3916 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
3917 lives_osc_parse_int_argument(vargs, &effect_key);
3918 lives_osc_parse_int_argument(vargs, &pnum);
3921 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
3922 lives_osc_parse_int_argument(vargs, &effect_key);
3923 lives_osc_parse_int_argument(vargs, &mode);
3924 lives_osc_parse_int_argument(vargs, &pnum);
3925 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
3929 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
3933 if (!filter)
return lives_osc_notify_failure();
3936 if (nparams == 0)
return lives_osc_notify_failure();
3937 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
3943 if (ptype != WEED_PARAM_SWITCH) {
3944 return lives_osc_notify_failure();
3946 grp = weed_get_int_value(ptmpl, WEED_LEAF_GROUP, NULL);
3950 lives_status_send(retval);
3957 boolean lives_osc_cb_rte_getoparamcspace(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
3958 NetworkReturnAddressPtr ra) {
3959 weed_plant_t *filter;
3960 weed_plant_t **out_ptmpls;
3961 weed_plant_t *ptmpl;
3964 int effect_key, mode, pnum, cspace;
3969 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
3970 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
3971 lives_osc_parse_int_argument(vargs, &effect_key);
3972 lives_osc_parse_int_argument(vargs, &pnum);
3975 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
3976 lives_osc_parse_int_argument(vargs, &effect_key);
3977 lives_osc_parse_int_argument(vargs, &mode);
3978 lives_osc_parse_int_argument(vargs, &pnum);
3979 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
3983 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
3987 if (!filter)
return lives_osc_notify_failure();
3989 if (pnum < 0)
return lives_osc_notify_failure();
3991 out_ptmpls = weed_get_plantptr_array_counted(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES, &nparams);
3992 if (pnum >= nparams)
return lives_osc_notify_failure();
3994 ptmpl = out_ptmpls[pnum];
3995 if (!ptmpl)
return lives_osc_notify_failure();
3999 if (ptype != WEED_PARAM_COLOR) {
4000 return lives_osc_notify_failure();
4002 cspace = weed_get_int_value(ptmpl, WEED_LEAF_COLORSPACE, NULL);
4004 stype = weed_leaf_seed_type(ptmpl, WEED_LEAF_DEFAULT);
4006 if (cspace == WEED_COLORSPACE_RGB) {
4007 if (stype == WEED_SEED_INT) retval = get_omc_const(
"LIVES_COLORSPACE_RGB_INT");
4008 else retval = get_omc_const(
"LIVES_COLORSPACE_RGB_FLOAT");
4010 if (stype == WEED_SEED_INT) retval = get_omc_const(
"LIVES_COLORSPACE_RGBA_INT");
4011 else retval = get_omc_const(
"LIVES_COLORSPACE_RGBA_FLOAT");
4014 lives_status_send(retval);
4020 boolean lives_osc_cb_rte_getpparamcspace(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4021 NetworkReturnAddressPtr ra) {
4023 weed_plant_t *ptmpl, *param;
4032 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
4033 lives_osc_parse_int_argument(vargs, &pnum);
4041 if (ptype != WEED_PARAM_COLOR) {
4042 return lives_osc_notify_failure();
4045 cspace = weed_get_int_value(ptmpl, WEED_LEAF_COLORSPACE, NULL);
4046 stype = weed_leaf_seed_type(ptmpl, WEED_LEAF_DEFAULT);
4048 if (cspace == WEED_COLORSPACE_RGB) {
4049 if (stype == WEED_SEED_INT) retval = get_omc_const(
"LIVES_COLORSPACE_RGB_INT");
4050 else retval = get_omc_const(
"LIVES_COLORSPACE_RGB_FLOAT");
4052 if (stype == WEED_SEED_INT) retval = get_omc_const(
"LIVES_COLORSPACE_RGBA_INT");
4053 else retval = get_omc_const(
"LIVES_COLORSPACE_RGBA_FLOAT");
4056 return lives_status_send(retval);
4060 boolean lives_osc_cb_rte_getparamflags(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4061 NetworkReturnAddressPtr ra) {
4062 weed_plant_t *filter;
4063 weed_plant_t *ptmpl;
4067 int pnum, flags = 0;
4071 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
4072 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
4073 lives_osc_parse_int_argument(vargs, &effect_key);
4074 lives_osc_parse_int_argument(vargs, &pnum);
4077 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
4078 lives_osc_parse_int_argument(vargs, &effect_key);
4079 lives_osc_parse_int_argument(vargs, &mode);
4080 lives_osc_parse_int_argument(vargs, &pnum);
4081 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
4085 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4089 if (!filter)
return lives_osc_notify_failure();
4092 if (nparams == 0)
return lives_osc_notify_failure();
4093 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
4097 if (weed_plant_has_leaf(ptmpl, WEED_LEAF_FLAGS))
4098 flags = weed_get_int_value(ptmpl, WEED_LEAF_FLAGS, NULL);
4101 lives_status_send(retval);
4107 boolean lives_osc_cb_rte_getpparamflags(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4108 NetworkReturnAddressPtr ra) {
4109 weed_plant_t *ptmpl, *param;
4110 int pnum, flags = 0;
4116 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
4118 lives_osc_parse_int_argument(vargs, &pnum);
4124 ptmpl = weed_get_plantptr_value(param, WEED_LEAF_TEMPLATE, NULL);
4126 if (weed_plant_has_leaf(ptmpl, WEED_LEAF_FLAGS))
4127 flags = weed_get_int_value(ptmpl, WEED_LEAF_FLAGS, NULL);
4130 lives_status_send(retval);
4136 boolean lives_osc_cb_rte_getparamname(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4137 NetworkReturnAddressPtr ra) {
4138 weed_plant_t *filter;
4139 weed_plant_t *ptmpl;
4147 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
4148 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
4149 lives_osc_parse_int_argument(vargs, &effect_key);
4150 lives_osc_parse_int_argument(vargs, &pnum);
4153 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
4154 lives_osc_parse_int_argument(vargs, &effect_key);
4155 lives_osc_parse_int_argument(vargs, &mode);
4156 lives_osc_parse_int_argument(vargs, &pnum);
4157 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
4161 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4165 if (!filter)
return lives_osc_notify_failure();
4168 if (nparams == 0)
return lives_osc_notify_failure();
4169 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
4173 retval = weed_get_string_value(ptmpl, WEED_LEAF_NAME, NULL);
4175 lives_status_send(retval);
4182 boolean lives_osc_cb_pgui_countchoices(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4183 NetworkReturnAddressPtr ra) {
4185 weed_plant_t *filter;
4186 weed_plant_t *ptmpl;
4196 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
4197 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
4198 lives_osc_parse_int_argument(vargs, &effect_key);
4199 lives_osc_parse_int_argument(vargs, &pnum);
4202 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
4203 lives_osc_parse_int_argument(vargs, &effect_key);
4204 lives_osc_parse_int_argument(vargs, &mode);
4205 lives_osc_parse_int_argument(vargs, &pnum);
4206 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
4210 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4214 if (!filter)
return lives_osc_notify_failure();
4217 if (nparams == 0)
return lives_osc_notify_failure();
4218 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
4222 if (weed_plant_has_leaf(ptmpl, WEED_LEAF_CHOICES))
4223 val = weed_leaf_num_elements(ptmpl, WEED_LEAF_CHOICES);
4227 lives_status_send(retval);
4234 boolean lives_osc_cb_pgui_getchoice(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4235 NetworkReturnAddressPtr ra) {
4236 weed_plant_t *filter;
4237 weed_plant_t *ptmpl;
4239 boolean ret =
FALSE;
4247 char *retval = lives_strdup(
"");
4249 if (!lives_osc_check_arguments(arglen, vargs,
"iiii",
FALSE)) {
4250 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE))
return lives_osc_notify_failure();
4251 lives_osc_parse_int_argument(vargs, &effect_key);
4252 lives_osc_parse_int_argument(vargs, &pnum);
4253 lives_osc_parse_int_argument(vargs, &cc);
4256 lives_osc_check_arguments(arglen, vargs,
"iiii",
TRUE);
4257 lives_osc_parse_int_argument(vargs, &effect_key);
4258 lives_osc_parse_int_argument(vargs, &mode);
4259 lives_osc_parse_int_argument(vargs, &pnum);
4260 lives_osc_parse_int_argument(vargs, &cc);
4261 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
4265 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4269 if (!filter)
return lives_osc_notify_failure();
4272 if (nparams == 0)
return lives_osc_notify_failure();
4273 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
4277 if (weed_plant_has_leaf(ptmpl, WEED_LEAF_CHOICES)) {
4278 int nc = weed_leaf_num_elements(ptmpl, WEED_LEAF_CHOICES);
4280 char **choices = weed_get_string_array(ptmpl, WEED_LEAF_CHOICES, NULL);
4282 for (i = 0; i < nc; i++) {
4285 retval = choices[i];
4293 lives_status_send(retval);
4300 boolean lives_osc_cb_rte_getoparamname(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4301 NetworkReturnAddressPtr ra) {
4302 weed_plant_t *filter;
4303 weed_plant_t **out_ptmpls;
4304 weed_plant_t *ptmpl;
4313 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
4314 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
4315 lives_osc_parse_int_argument(vargs, &effect_key);
4316 lives_osc_parse_int_argument(vargs, &pnum);
4319 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
4320 lives_osc_parse_int_argument(vargs, &effect_key);
4321 lives_osc_parse_int_argument(vargs, &mode);
4322 lives_osc_parse_int_argument(vargs, &pnum);
4323 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
4327 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4331 if (!filter)
return lives_osc_notify_failure();
4332 if (!weed_plant_has_leaf(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES))
return lives_osc_notify_failure();
4334 nparams = weed_leaf_num_elements(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES);
4335 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
4337 out_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES, NULL);
4338 ptmpl = out_ptmpls[pnum];
4340 retval = weed_get_string_value(ptmpl, WEED_LEAF_NAME, NULL);
4342 lives_status_send(retval);
4350 boolean lives_osc_cb_rte_getpparamname(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4351 NetworkReturnAddressPtr ra) {
4352 weed_plant_t *ptmpl, *param;
4359 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
4361 lives_osc_parse_int_argument(vargs, &pnum);
4367 ptmpl = weed_get_plantptr_value(param, WEED_LEAF_TEMPLATE, NULL);
4369 retval = weed_get_string_value(ptmpl, WEED_LEAF_NAME, NULL);
4371 lives_status_send(retval);
4378 boolean lives_osc_cb_rte_getnparamname(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4379 NetworkReturnAddressPtr ra) {
4380 weed_plant_t *filter;
4381 weed_plant_t **in_ptmpls;
4382 weed_plant_t *ptmpl;
4388 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
4390 lives_osc_parse_int_argument(vargs, &effect_key);
4391 lives_osc_parse_int_argument(vargs, &pnum);
4393 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4397 if (!filter)
return lives_osc_notify_failure();
4398 if (!weed_plant_has_leaf(filter, WEED_LEAF_IN_PARAMETER_TEMPLATES))
return lives_osc_notify_failure();
4401 if (i == -1)
return lives_osc_notify_failure();
4403 in_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_IN_PARAMETER_TEMPLATES, NULL);
4404 ptmpl = in_ptmpls[i];
4406 retval = weed_get_string_value(ptmpl, WEED_LEAF_NAME, NULL);
4408 lives_status_send(retval);
4416 boolean lives_osc_cb_rte_setparam(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4417 NetworkReturnAddressPtr ra) {
4418 weed_plant_t *inst, *filter;
4419 weed_plant_t *tparam;
4425 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
4427 nargs = lives_osc_get_num_arguments(vargs);
4428 if (nargs < 3)
return lives_osc_notify_failure();
4430 osc_header_len =
pad4(nargs + 1);
4432 lives_osc_parse_int_argument(vargs, &effect_key);
4433 lives_osc_parse_int_argument(vargs, &pnum);
4435 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4441 if (!inst)
return lives_osc_notify_failure();
4444 if (pnum < 0 || pnum >= nparams) {
4446 return lives_osc_notify_failure();
4452 if (!setfx(inst, tparam, pnum, nargs - 2, vargs, 3)) {
4454 return lives_osc_notify_failure();
4458 return lives_osc_notify_failure();
4475 return lives_osc_notify_success(NULL);
4479 boolean lives_osc_cb_rte_setparamdef(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4480 NetworkReturnAddressPtr ra) {
4481 weed_plant_t *filter;
4482 weed_plant_t *tptmpl;
4487 int pnum, nargs, skip;
4489 nargs = lives_osc_get_num_arguments(vargs);
4491 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
4492 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
4493 if (nargs < 3)
return lives_osc_notify_failure();
4494 osc_header_len =
pad4(nargs + 1);
4495 lives_osc_parse_int_argument(vargs, &effect_key);
4496 lives_osc_parse_int_argument(vargs, &pnum);
4500 if (nargs < 4)
return lives_osc_notify_failure();
4501 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
4502 osc_header_len =
pad4(nargs + 1);
4503 lives_osc_parse_int_argument(vargs, &effect_key);
4504 lives_osc_parse_int_argument(vargs, &mode);
4505 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
4506 lives_osc_parse_int_argument(vargs, &pnum);
4510 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4515 if (!filter)
return lives_osc_notify_failure();
4518 if (nparams == 0)
return lives_osc_notify_failure();
4519 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
4523 if (!setfx(filter, tptmpl, pnum, nargs - 2, vargs, skip)) {
4524 return lives_osc_notify_failure();
4527 return lives_osc_notify_success(NULL);
4531 boolean lives_osc_cb_rte_setpparam(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4532 NetworkReturnAddressPtr ra) {
4534 weed_plant_t *param;
4539 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
4541 nargs = lives_osc_get_num_arguments(vargs);
4542 if (nargs < 2)
return lives_osc_notify_failure();
4544 osc_header_len =
pad4(nargs + 1);
4546 lives_osc_parse_int_argument(vargs, &pnum);
4553 if (!setfx(NULL, param, pnum, nargs - 1, vargs, 2))
return lives_osc_notify_failure();
4554 }
else return lives_osc_notify_failure();
4556 return lives_osc_notify_success(NULL);
4560 boolean lives_osc_cb_rte_setnparam(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4561 NetworkReturnAddressPtr ra) {
4569 weed_plant_t *inst, *param;
4570 weed_plant_t **in_params;
4572 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
4574 nargs = lives_osc_get_num_arguments(vargs);
4575 if (nargs < 3)
return lives_osc_notify_failure();
4577 osc_header_len =
pad4(nargs + 1);
4579 lives_osc_parse_int_argument(vargs, &effect_key);
4580 lives_osc_parse_int_argument(vargs, &pnum);
4582 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4586 if (!inst)
return lives_osc_notify_failure();
4588 in_params = weed_get_plantptr_array(inst, WEED_LEAF_IN_PARAMETERS, &
error);
4592 param = in_params[i];
4595 if (!setfx(inst, param, pnum, nargs - 2, vargs, 3)) {
4597 return lives_osc_notify_failure();
4601 return lives_osc_notify_failure();
4604 return lives_osc_notify_success(NULL);
4608 boolean lives_osc_cb_rte_setnparamdef(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4609 NetworkReturnAddressPtr ra) {
4610 weed_plant_t *filter;
4611 weed_plant_t *tptmpl;
4616 int pnum, nargs, skip;
4618 nargs = lives_osc_get_num_arguments(vargs);
4620 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
4621 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
4622 if (nargs < 3)
return lives_osc_notify_failure();
4623 osc_header_len =
pad4(nargs + 1);
4624 lives_osc_parse_int_argument(vargs, &effect_key);
4625 lives_osc_parse_int_argument(vargs, &pnum);
4629 if (nargs < 4)
return lives_osc_notify_failure();
4630 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
4631 osc_header_len =
pad4(nargs + 1);
4632 lives_osc_parse_int_argument(vargs, &effect_key);
4633 lives_osc_parse_int_argument(vargs, &mode);
4634 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
4635 lives_osc_parse_int_argument(vargs, &pnum);
4639 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4644 if (!filter)
return lives_osc_notify_failure();
4647 if (nparams == 0)
return lives_osc_notify_failure();
4648 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
4652 if (!setfx(filter, tptmpl, pnum, nargs - 2, vargs, skip)) {
4653 return lives_osc_notify_failure();
4656 return lives_osc_notify_success(NULL);
4660 boolean lives_osc_cb_rte_paramcount(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
4661 int effect_key, mode;
4664 weed_plant_t *filter;
4667 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
4668 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
4669 lives_osc_parse_int_argument(vargs, &effect_key);
4672 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
4673 lives_osc_parse_int_argument(vargs, &effect_key);
4674 lives_osc_parse_int_argument(vargs, &mode);
4675 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
4679 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4683 if (!filter)
return lives_osc_notify_failure();
4688 lives_status_send(msg);
4694 boolean lives_osc_cb_rte_oparamcount(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4695 NetworkReturnAddressPtr ra) {
4696 int effect_key, mode;
4698 weed_plant_t *filter;
4701 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
4702 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
4703 lives_osc_parse_int_argument(vargs, &effect_key);
4706 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
4707 lives_osc_parse_int_argument(vargs, &effect_key);
4708 lives_osc_parse_int_argument(vargs, &mode);
4709 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
4713 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4717 if (!filter)
return lives_osc_notify_failure();
4719 if (weed_plant_has_leaf(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES)) {
4720 count = weed_leaf_num_elements(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES);
4724 lives_status_send(msg);
4730 boolean lives_osc_cb_rte_getinpal(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
4731 weed_plant_t **ctmpls, *
template;
4732 weed_plant_t *filter, *inst, *ctmpl, *chan = NULL;
4734 int effect_key, mode, cnum, count;
4737 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
4738 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
4739 lives_osc_parse_int_argument(vargs, &effect_key);
4740 lives_osc_parse_int_argument(vargs, &cnum);
4743 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
4744 lives_osc_parse_int_argument(vargs, &effect_key);
4745 lives_osc_parse_int_argument(vargs, &mode);
4746 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
4747 lives_osc_parse_int_argument(vargs, &cnum);
4751 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4756 if (!filter)
return lives_osc_notify_failure();
4760 ctmpl = weed_get_plantptr_value(chan, WEED_LEAF_TEMPLATE, NULL);
4762 if (!weed_plant_has_leaf(filter, WEED_LEAF_IN_CHANNEL_TEMPLATES))
return lives_osc_notify_failure();
4763 count = weed_leaf_num_elements(filter, WEED_LEAF_IN_CHANNEL_TEMPLATES);
4764 if (cnum >= count)
return lives_osc_notify_failure();
4765 ctmpls = weed_get_plantptr_array(filter, WEED_LEAF_IN_CHANNEL_TEMPLATES, NULL);
4766 ctmpl = ctmpls[cnum];
4770 if (weed_plant_has_leaf(ctmpl, WEED_LEAF_IS_AUDIO)) {
4773 lives_status_send(msg);
4780 msg =
lives_strdup_printf(
"%d", weed_get_int_value(chan, WEED_LEAF_CURRENT_PALETTE, NULL));
4781 lives_status_send(msg);
4786 filter_flags = weed_get_int_value(filter, WEED_LEAF_FLAGS, NULL);
4787 if ((filter_flags & WEED_FILTER_PALETTES_MAY_VARY) && weed_plant_has_leaf(ctmpl, WEED_LEAF_PALETTE_LIST)) {
4789 }
else template = filter;
4790 msg = lives_osc_format_result(
template, WEED_LEAF_PALETTE_LIST, 0, -1);
4791 lives_status_send(msg);
4797 boolean lives_osc_cb_rte_getoutpal(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
4798 weed_plant_t **ctmpls, *
template;
4799 weed_plant_t *filter, *inst, *ctmpl, *chan = NULL;
4800 int effect_key, mode, cnum, count, filter_flags;
4803 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
4804 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
4805 lives_osc_parse_int_argument(vargs, &effect_key);
4806 lives_osc_parse_int_argument(vargs, &cnum);
4809 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
4810 lives_osc_parse_int_argument(vargs, &effect_key);
4811 lives_osc_parse_int_argument(vargs, &mode);
4812 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
4813 lives_osc_parse_int_argument(vargs, &cnum);
4817 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4822 if (!filter)
return lives_osc_notify_failure();
4826 ctmpl = weed_get_plantptr_value(chan, WEED_LEAF_TEMPLATE, NULL);
4828 if (!weed_plant_has_leaf(filter, WEED_LEAF_OUT_CHANNEL_TEMPLATES))
return lives_osc_notify_failure();
4829 count = weed_leaf_num_elements(filter, WEED_LEAF_OUT_CHANNEL_TEMPLATES);
4830 if (cnum >= count)
return lives_osc_notify_failure();
4831 ctmpls = weed_get_plantptr_array(filter, WEED_LEAF_OUT_CHANNEL_TEMPLATES, NULL);
4832 ctmpl = ctmpls[cnum];
4836 if (weed_plant_has_leaf(ctmpl, WEED_LEAF_IS_AUDIO)) {
4839 lives_status_send(msg);
4846 msg =
lives_strdup_printf(
"%d", weed_get_int_value(chan, WEED_LEAF_CURRENT_PALETTE, NULL));
4847 lives_status_send(msg);
4851 filter_flags = weed_get_int_value(filter, WEED_LEAF_FLAGS, NULL);
4853 if ((filter_flags & WEED_FILTER_PALETTES_MAY_VARY) && weed_plant_has_leaf(ctmpl, WEED_LEAF_PALETTE_LIST)) {
4855 }
else template = filter;
4856 msg = lives_osc_format_result(
template, WEED_LEAF_PALETTE_LIST, 0, -1);
4857 lives_status_send(msg);
4863 boolean lives_osc_cb_rte_pparamcount(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4864 NetworkReturnAddressPtr ra) {
4870 return lives_status_send(
"0");
4876 lives_status_send(msg);
4882 boolean lives_osc_cb_rte_nparamcount(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4883 NetworkReturnAddressPtr ra) {
4890 weed_plant_t *filter;
4894 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
4895 lives_osc_parse_int_argument(vargs, &effect_key);
4897 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4901 if (!filter)
return lives_osc_notify_failure();
4908 lives_status_send(msg);
4914 boolean lives_osc_cb_rte_getnchannels(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4915 NetworkReturnAddressPtr ra) {
4916 int effect_key, mode;
4919 weed_plant_t *plant;
4923 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
4924 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
4925 lives_osc_parse_int_argument(vargs, &effect_key);
4928 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
4929 lives_osc_parse_int_argument(vargs, &effect_key);
4930 lives_osc_parse_int_argument(vargs, &mode);
4931 if (mode < 0 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
4935 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4938 if (!plant)
return lives_osc_notify_failure();
4944 lives_status_send(msg);
4950 boolean lives_osc_cb_rte_getnochannels(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4951 NetworkReturnAddressPtr ra) {
4955 weed_plant_t *plant, *orig_plant;
4959 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
4960 lives_osc_parse_int_argument(vargs, &effect_key);
4962 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
4970 if (plant)
return lives_osc_notify_failure();
4976 lives_status_send(msg);
4982 boolean lives_osc_cb_rte_getparammin(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
4983 NetworkReturnAddressPtr ra) {
4989 weed_plant_t *filter;
4990 weed_plant_t *ptmpl;
4994 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
4995 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
4996 lives_osc_parse_int_argument(vargs, &effect_key);
4997 lives_osc_parse_int_argument(vargs, &pnum);
5000 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
5001 lives_osc_parse_int_argument(vargs, &effect_key);
5002 lives_osc_parse_int_argument(vargs, &mode);
5003 lives_osc_parse_int_argument(vargs, &pnum);
5004 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
5008 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5012 if (!filter)
return lives_osc_notify_failure();
5015 if (nparams == 0)
return lives_osc_notify_failure();
5016 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
5020 if (!weed_plant_has_leaf(ptmpl, WEED_LEAF_MIN)) {
5021 return lives_osc_notify_failure();
5024 msg = lives_osc_format_result(ptmpl, WEED_LEAF_MIN, 0, -1);
5026 lives_status_send(msg);
5032 boolean lives_osc_cb_rte_getoparammin(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5033 NetworkReturnAddressPtr ra) {
5039 weed_plant_t *filter;
5040 weed_plant_t **out_ptmpls;
5041 weed_plant_t *ptmpl;
5045 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
5046 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
5047 lives_osc_parse_int_argument(vargs, &effect_key);
5048 lives_osc_parse_int_argument(vargs, &pnum);
5051 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
5052 lives_osc_parse_int_argument(vargs, &effect_key);
5053 lives_osc_parse_int_argument(vargs, &mode);
5054 lives_osc_parse_int_argument(vargs, &pnum);
5055 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
5059 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5063 if (!filter)
return lives_osc_notify_failure();
5065 if (!weed_plant_has_leaf(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES))
return lives_osc_notify_failure();
5067 nparams = weed_leaf_num_elements(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES);
5068 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
5070 out_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES, &
error);
5072 ptmpl = out_ptmpls[pnum];
5074 if (!weed_plant_has_leaf(ptmpl, WEED_LEAF_MIN)) {
5076 return lives_osc_notify_failure();
5079 msg = lives_osc_format_result(ptmpl, WEED_LEAF_MIN, 0, -1);
5081 lives_status_send(msg);
5088 boolean lives_osc_cb_rte_getohasparammin(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5089 NetworkReturnAddressPtr ra) {
5095 weed_plant_t *filter;
5096 weed_plant_t **out_ptmpls;
5097 weed_plant_t *ptmpl;
5099 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
5100 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
5101 lives_osc_parse_int_argument(vargs, &effect_key);
5102 lives_osc_parse_int_argument(vargs, &pnum);
5105 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
5106 lives_osc_parse_int_argument(vargs, &effect_key);
5107 lives_osc_parse_int_argument(vargs, &mode);
5108 lives_osc_parse_int_argument(vargs, &pnum);
5109 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
5113 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5117 if (!filter)
return lives_osc_notify_failure();
5119 if (!weed_plant_has_leaf(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES))
return lives_osc_notify_failure();
5121 nparams = weed_leaf_num_elements(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES);
5122 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
5124 out_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES, &
error);
5126 ptmpl = out_ptmpls[pnum];
5129 if (!weed_plant_has_leaf(ptmpl, WEED_LEAF_MIN))
return lives_status_send(get_omc_const(
"LIVES_FALSE"));
5130 else return lives_status_send(get_omc_const(
"LIVES_TRUE"));
5134 boolean lives_osc_cb_rte_getpparammin(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5135 NetworkReturnAddressPtr ra) {
5139 weed_plant_t *ptmpl, *param;
5145 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
5146 lives_osc_parse_int_argument(vargs, &pnum);
5152 ptmpl = weed_get_plantptr_value(param, WEED_LEAF_TEMPLATE, &
error);
5154 if (!weed_plant_has_leaf(ptmpl, WEED_LEAF_MIN)) {
5155 return lives_osc_notify_failure();
5158 msg = lives_osc_format_result(ptmpl, WEED_LEAF_MIN, 0, -1);
5160 lives_status_send(msg);
5166 boolean lives_osc_cb_rte_getparammax(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5167 NetworkReturnAddressPtr ra) {
5173 weed_plant_t *filter;
5174 weed_plant_t *ptmpl;
5178 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
5179 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
5180 lives_osc_parse_int_argument(vargs, &effect_key);
5181 lives_osc_parse_int_argument(vargs, &pnum);
5184 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
5185 lives_osc_parse_int_argument(vargs, &effect_key);
5186 lives_osc_parse_int_argument(vargs, &mode);
5187 lives_osc_parse_int_argument(vargs, &pnum);
5188 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
5192 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5196 if (!filter)
return lives_osc_notify_failure();
5199 if (nparams == 0)
return lives_osc_notify_failure();
5200 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
5204 if (!weed_plant_has_leaf(ptmpl, WEED_LEAF_MAX)) {
5205 return lives_osc_notify_failure();
5208 msg = lives_osc_format_result(ptmpl, WEED_LEAF_MAX, 0, -1);
5210 lives_status_send(msg);
5216 boolean lives_osc_cb_rte_getoparammax(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5217 NetworkReturnAddressPtr ra) {
5223 weed_plant_t *filter;
5224 weed_plant_t **out_ptmpls;
5225 weed_plant_t *ptmpl;
5229 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
5230 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
5231 lives_osc_parse_int_argument(vargs, &effect_key);
5232 lives_osc_parse_int_argument(vargs, &pnum);
5235 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
5236 lives_osc_parse_int_argument(vargs, &effect_key);
5237 lives_osc_parse_int_argument(vargs, &mode);
5238 lives_osc_parse_int_argument(vargs, &pnum);
5239 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
5243 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5247 if (!filter)
return lives_osc_notify_failure();
5249 if (!weed_plant_has_leaf(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES))
return lives_osc_notify_failure();
5250 nparams = weed_leaf_num_elements(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES);
5251 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
5253 out_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES, &
error);
5255 ptmpl = out_ptmpls[pnum];
5257 if (!weed_plant_has_leaf(ptmpl, WEED_LEAF_MAX)) {
5259 return lives_osc_notify_failure();
5262 msg = lives_osc_format_result(ptmpl, WEED_LEAF_MAX, 0, -1);
5264 lives_status_send(msg);
5271 boolean lives_osc_cb_rte_getohasparammax(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5272 NetworkReturnAddressPtr ra) {
5278 weed_plant_t *filter;
5279 weed_plant_t **out_ptmpls;
5280 weed_plant_t *ptmpl;
5282 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
5283 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
5284 lives_osc_parse_int_argument(vargs, &effect_key);
5285 lives_osc_parse_int_argument(vargs, &pnum);
5288 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
5289 lives_osc_parse_int_argument(vargs, &effect_key);
5290 lives_osc_parse_int_argument(vargs, &mode);
5291 lives_osc_parse_int_argument(vargs, &pnum);
5292 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
5296 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5300 if (!filter)
return lives_osc_notify_failure();
5302 if (!weed_plant_has_leaf(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES))
return lives_osc_notify_failure();
5303 nparams = weed_leaf_num_elements(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES);
5304 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
5306 out_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES, &
error);
5308 ptmpl = out_ptmpls[pnum];
5311 if (!weed_plant_has_leaf(ptmpl, WEED_LEAF_MAX))
return lives_status_send(get_omc_const(
"LIVES_FALSE"));
5312 else return lives_status_send(get_omc_const(
"LIVES_TRUE"));
5316 boolean lives_osc_cb_rte_getpparammax(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5317 NetworkReturnAddressPtr ra) {
5323 weed_plant_t *ptmpl, *param;
5329 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
5330 lives_osc_parse_int_argument(vargs, &pnum);
5336 ptmpl = weed_get_plantptr_value(param, WEED_LEAF_TEMPLATE, &
error);
5338 if (!weed_plant_has_leaf(ptmpl, WEED_LEAF_MAX)) {
5339 return lives_osc_notify_failure();
5342 msg = lives_osc_format_result(ptmpl, WEED_LEAF_MAX, 0, -1);
5344 lives_status_send(msg);
5351 boolean lives_osc_cb_rte_getparamdef(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5352 NetworkReturnAddressPtr ra) {
5358 weed_plant_t *filter;
5359 weed_plant_t *ptmpl;
5363 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
5364 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
5365 lives_osc_parse_int_argument(vargs, &effect_key);
5366 lives_osc_parse_int_argument(vargs, &pnum);
5369 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
5370 lives_osc_parse_int_argument(vargs, &effect_key);
5371 lives_osc_parse_int_argument(vargs, &mode);
5372 lives_osc_parse_int_argument(vargs, &pnum);
5373 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
5377 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5381 if (!filter)
return lives_osc_notify_failure();
5384 if (nparams == 0)
return lives_osc_notify_failure();
5385 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
5392 nvals = weed_leaf_num_elements(ptmpl, WEED_LEAF_DEFAULT);
5394 msg = lives_osc_format_result(ptmpl, WEED_LEAF_DEFAULT, 0, nvals);
5397 msg = lives_osc_format_result(ptmpl, WEED_LEAF_NEW_DEFAULT, 0, -1);
5401 lives_status_send(msg);
5408 boolean lives_osc_cb_rte_getoparamdef(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5409 NetworkReturnAddressPtr ra) {
5415 weed_plant_t *filter;
5416 weed_plant_t **out_ptmpls;
5417 weed_plant_t *ptmpl;
5421 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
5422 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
5423 lives_osc_parse_int_argument(vargs, &effect_key);
5424 lives_osc_parse_int_argument(vargs, &pnum);
5427 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
5428 lives_osc_parse_int_argument(vargs, &effect_key);
5429 lives_osc_parse_int_argument(vargs, &mode);
5430 lives_osc_parse_int_argument(vargs, &pnum);
5431 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
5435 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5439 if (!filter)
return lives_osc_notify_failure();
5441 if (!weed_plant_has_leaf(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES))
return lives_osc_notify_failure();
5442 nparams = weed_leaf_num_elements(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES);
5443 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
5445 out_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES, &
error);
5447 ptmpl = out_ptmpls[pnum];
5452 if (!weed_plant_has_leaf(ptmpl, WEED_LEAF_DEFAULT)) {
5454 return lives_osc_notify_failure();
5457 nvals = weed_leaf_num_elements(ptmpl, WEED_LEAF_DEFAULT);
5459 msg = lives_osc_format_result(ptmpl, WEED_LEAF_DEFAULT, 0, nvals);
5462 msg = lives_osc_format_result(ptmpl, WEED_LEAF_NEW_DEFAULT, 0, -1);
5466 lives_status_send(msg);
5474 boolean lives_osc_cb_rte_gethasparamdef(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5475 NetworkReturnAddressPtr ra) {
5481 weed_plant_t *filter;
5482 weed_plant_t *ptmpl;
5484 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
5485 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
5486 lives_osc_parse_int_argument(vargs, &effect_key);
5487 lives_osc_parse_int_argument(vargs, &pnum);
5490 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
5491 lives_osc_parse_int_argument(vargs, &effect_key);
5492 lives_osc_parse_int_argument(vargs, &mode);
5493 lives_osc_parse_int_argument(vargs, &pnum);
5494 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
5498 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5502 if (!filter)
return lives_osc_notify_failure();
5505 if (nparams == 0)
return lives_osc_notify_failure();
5506 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
5511 if (weed_leaf_num_elements(ptmpl,
WEED_LEAF_HOST_DEFAULT) == 0)
return lives_status_send(get_omc_const(
"LIVES_FALSE"));
5512 return lives_status_send(get_omc_const(
"LIVES_DEFAULT_OVERRIDDEN"));
5514 if (!weed_plant_has_leaf(ptmpl, WEED_LEAF_DEFAULT) ||
5515 weed_leaf_num_elements(ptmpl, WEED_LEAF_DEFAULT) == 0)
return lives_status_send(get_omc_const(
"LIVES_FALSE"));
5516 else return lives_status_send(get_omc_const(
"LIVES_TRUE"));
5520 boolean lives_osc_cb_rte_getohasparamdef(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5521 NetworkReturnAddressPtr ra) {
5527 weed_plant_t *filter;
5528 weed_plant_t **out_ptmpls;
5529 weed_plant_t *ptmpl;
5531 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
5532 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
5533 lives_osc_parse_int_argument(vargs, &effect_key);
5534 lives_osc_parse_int_argument(vargs, &pnum);
5537 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
5538 lives_osc_parse_int_argument(vargs, &effect_key);
5539 lives_osc_parse_int_argument(vargs, &mode);
5540 lives_osc_parse_int_argument(vargs, &pnum);
5541 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
5545 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5549 if (!filter)
return lives_osc_notify_failure();
5551 if (!weed_plant_has_leaf(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES))
return lives_osc_notify_failure();
5552 nparams = weed_leaf_num_elements(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES);
5553 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
5555 out_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES, &
error);
5557 ptmpl = out_ptmpls[pnum];
5561 !weed_plant_has_leaf(ptmpl, WEED_LEAF_DEFAULT))
return lives_status_send(get_omc_const(
"LIVES_FALSE"));
5562 else return lives_status_send(get_omc_const(
"LIVES_TRUE"));
5566 boolean lives_osc_cb_rte_getpparamdef(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5567 NetworkReturnAddressPtr ra) {
5573 weed_plant_t *param;
5574 weed_plant_t *ptmpl;
5580 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
5582 lives_osc_parse_int_argument(vargs, &pnum);
5588 ptmpl = weed_get_plantptr_value(param, WEED_LEAF_TEMPLATE, &
error);
5590 nvals = weed_leaf_num_elements(ptmpl, WEED_LEAF_DEFAULT);
5592 msg = lives_osc_format_result(ptmpl, WEED_LEAF_DEFAULT, 0, nvals);
5595 msg = lives_osc_format_result(ptmpl, WEED_LEAF_NEW_DEFAULT, 0, -1);
5598 lives_status_send(msg);
5605 boolean lives_osc_cb_rte_getparamval(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5606 NetworkReturnAddressPtr ra) {
5608 int pnum, st = 0, end = 1, ptype, cspace;
5611 weed_plant_t *inst, *filter;
5612 weed_plant_t *param, *ptmpl;
5615 if (lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
5616 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
5617 lives_osc_parse_int_argument(vargs, &effect_key);
5618 lives_osc_parse_int_argument(vargs, &pnum);
5620 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE))
return lives_osc_notify_failure();
5621 lives_osc_parse_int_argument(vargs, &effect_key);
5622 lives_osc_parse_int_argument(vargs, &pnum);
5623 lives_osc_parse_int_argument(vargs, &st);
5627 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5631 if (!filter)
return lives_osc_notify_failure();
5636 if (!inst)
return lives_osc_notify_failure();
5641 return lives_osc_notify_failure();
5643 if (pnum < 0 || pnum >= nparams) {
5645 return lives_osc_notify_failure();
5649 ptmpl = weed_get_plantptr_value(param, WEED_LEAF_TEMPLATE, &
error);
5652 if (ptype == WEED_PARAM_COLOR) {
5654 cspace = weed_get_int_value(ptmpl, WEED_LEAF_COLORSPACE, &
error);
5655 if (cspace == WEED_COLORSPACE_RGB) valsize = 3;
5660 if (end > weed_leaf_num_elements(param, WEED_LEAF_VALUE)) {
5662 return lives_osc_notify_failure();
5665 msg = lives_osc_format_result(param, WEED_LEAF_VALUE, st, end);
5668 lives_status_send(msg);
5675 boolean lives_osc_cb_rte_getoparamval(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5676 NetworkReturnAddressPtr ra) {
5678 int pnum, st = 0, end = 1, ptype, cspace;
5681 weed_plant_t *inst, *filter;
5682 weed_plant_t **out_params, **out_ptmpls;
5683 weed_plant_t *param, *ptmpl;
5686 if (lives_osc_check_arguments(arglen, vargs,
"ii",
FALSE)) {
5687 lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE);
5688 lives_osc_parse_int_argument(vargs, &effect_key);
5689 lives_osc_parse_int_argument(vargs, &pnum);
5691 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE))
return lives_osc_notify_failure();
5692 lives_osc_parse_int_argument(vargs, &effect_key);
5693 lives_osc_parse_int_argument(vargs, &pnum);
5694 lives_osc_parse_int_argument(vargs, &st);
5698 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5702 if (!filter)
return lives_osc_notify_failure();
5704 if (!weed_plant_has_leaf(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES))
return lives_osc_notify_failure();
5705 nparams = weed_leaf_num_elements(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES);
5706 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
5709 if (!inst)
return lives_osc_notify_failure();
5711 out_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_OUT_PARAMETER_TEMPLATES, &
error);
5713 ptmpl = out_ptmpls[pnum];
5715 out_params = weed_get_plantptr_array(inst, WEED_LEAF_OUT_PARAMETERS, &
error);
5717 param = out_params[pnum];
5723 if (ptype == WEED_PARAM_COLOR) {
5725 cspace = weed_get_int_value(ptmpl, WEED_LEAF_COLORSPACE, &
error);
5726 if (cspace == WEED_COLORSPACE_RGB) valsize = 3;
5731 if (end > weed_leaf_num_elements(param, WEED_LEAF_VALUE)) {
5733 return lives_osc_notify_failure();
5737 msg = lives_osc_format_result(param, WEED_LEAF_VALUE, st, end);
5740 lives_status_send(msg);
5744 return lives_osc_notify_failure();
5751 boolean lives_osc_cb_rte_getpparamval(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5752 NetworkReturnAddressPtr ra) {
5754 int pnum, st = 0, end = 1, ptype, cspace;
5757 weed_plant_t *param, *ptmpl;
5762 if (lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
5763 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
5764 lives_osc_parse_int_argument(vargs, &pnum);
5766 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
5767 lives_osc_parse_int_argument(vargs, &pnum);
5768 lives_osc_parse_int_argument(vargs, &st);
5774 ptmpl = weed_get_plantptr_value(param, WEED_LEAF_TEMPLATE, &
error);
5777 if (ptype == WEED_PARAM_COLOR) {
5779 cspace = weed_get_int_value(ptmpl, WEED_LEAF_COLORSPACE, &
error);
5780 if (cspace == WEED_COLORSPACE_RGB) valsize = 3;
5785 if (end > weed_leaf_num_elements(param, WEED_LEAF_VALUE))
return lives_osc_notify_failure();
5787 msg = lives_osc_format_result(param, WEED_LEAF_VALUE, st, end);
5789 lives_status_send(msg);
5796 boolean lives_osc_cb_rte_getnparam(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
5803 weed_plant_t *filter;
5804 weed_plant_t **in_ptmpls;
5805 weed_plant_t *ptmpl;
5813 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
5815 lives_osc_parse_int_argument(vargs, &effect_key);
5816 lives_osc_parse_int_argument(vargs, &pnum);
5818 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5822 if (!filter)
return lives_osc_notify_failure();
5826 if (i == -1)
return lives_osc_notify_failure();
5828 in_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_IN_PARAMETER_TEMPLATES, NULL);
5830 ptmpl = in_ptmpls[i];
5833 if (ptype == WEED_PARAM_INTEGER) {
5834 vali = weed_get_int_value(ptmpl, WEED_LEAF_VALUE, NULL);
5837 vald = weed_get_double_value(ptmpl, WEED_LEAF_VALUE, NULL);
5840 lives_status_send(msg);
5848 boolean lives_osc_cb_rte_getnparammin(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5849 NetworkReturnAddressPtr ra) {
5856 weed_plant_t *filter;
5857 weed_plant_t **in_ptmpls;
5858 weed_plant_t *ptmpl;
5866 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
5868 lives_osc_parse_int_argument(vargs, &effect_key);
5869 lives_osc_parse_int_argument(vargs, &pnum);
5871 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5875 if (!filter)
return lives_osc_notify_failure();
5879 if (i == -1)
return lives_osc_notify_failure();
5881 in_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_IN_PARAMETER_TEMPLATES, NULL);
5883 ptmpl = in_ptmpls[i];
5886 if (ptype == WEED_PARAM_INTEGER) {
5887 vali = weed_get_int_value(ptmpl, WEED_LEAF_MIN, NULL);
5890 vald = weed_get_double_value(ptmpl, WEED_LEAF_MIN, NULL);
5893 lives_status_send(msg);
5901 boolean lives_osc_cb_rte_getnparammax(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5902 NetworkReturnAddressPtr ra) {
5909 weed_plant_t *filter;
5910 weed_plant_t **in_ptmpls;
5911 weed_plant_t *ptmpl;
5919 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
5921 lives_osc_parse_int_argument(vargs, &effect_key);
5922 lives_osc_parse_int_argument(vargs, &pnum);
5924 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5928 if (!filter)
return lives_osc_notify_failure();
5932 if (i == -1)
return lives_osc_notify_failure();
5934 in_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_IN_PARAMETER_TEMPLATES, NULL);
5936 ptmpl = in_ptmpls[i];
5939 if (ptype == WEED_PARAM_INTEGER) {
5940 vali = weed_get_int_value(ptmpl, WEED_LEAF_MAX, NULL);
5943 vald = weed_get_double_value(ptmpl, WEED_LEAF_MAX, NULL);
5946 lives_status_send(msg);
5953 boolean lives_osc_cb_rte_getnparamdef(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
5954 NetworkReturnAddressPtr ra) {
5961 weed_plant_t *filter;
5962 weed_plant_t **in_ptmpls;
5963 weed_plant_t *ptmpl;
5971 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
5973 lives_osc_parse_int_argument(vargs, &effect_key);
5974 lives_osc_parse_int_argument(vargs, &pnum);
5976 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
5980 if (!filter)
return lives_osc_notify_failure();
5984 if (i == -1)
return lives_osc_notify_failure();
5986 in_ptmpls = weed_get_plantptr_array(filter, WEED_LEAF_IN_PARAMETER_TEMPLATES, NULL);
5988 ptmpl = in_ptmpls[i];
5991 if (ptype == WEED_PARAM_INTEGER) {
5992 if (!weed_plant_has_leaf(ptmpl,
WEED_LEAF_HOST_DEFAULT)) vali = weed_get_int_value(ptmpl, WEED_LEAF_DEFAULT, NULL);
5996 if (!weed_plant_has_leaf(ptmpl,
WEED_LEAF_HOST_DEFAULT)) vald = weed_get_double_value(ptmpl, WEED_LEAF_DEFAULT, NULL);
6001 lives_status_send(msg);
6008 boolean lives_osc_cb_rte_getnparamtrans(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
6009 NetworkReturnAddressPtr ra) {
6011 weed_plant_t *filter;
6017 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
6019 lives_osc_parse_int_argument(vargs, &effect_key);
6020 lives_osc_parse_int_argument(vargs, &pnum);
6022 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
6026 if (!filter)
return lives_osc_notify_failure();
6029 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
6032 return lives_status_send(get_omc_const(
"LIVES_FALSE"));
6036 boolean lives_osc_cb_rte_getparamtrans(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
6037 NetworkReturnAddressPtr ra) {
6039 weed_plant_t *filter;
6040 weed_plant_t *ptmpl;
6047 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
FALSE)) {
6048 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
6049 lives_osc_parse_int_argument(vargs, &effect_key);
6050 lives_osc_parse_int_argument(vargs, &pnum);
6053 lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE);
6054 lives_osc_parse_int_argument(vargs, &effect_key);
6055 lives_osc_parse_int_argument(vargs, &mode);
6056 lives_osc_parse_int_argument(vargs, &pnum);
6057 if (mode < 1 || mode >
rte_key_getmaxmode(effect_key) + 1)
return lives_osc_notify_failure();
6061 if (effect_key < 1 || effect_key > FX_MAX)
return lives_osc_notify_failure();
6065 if (!filter)
return lives_osc_notify_failure();
6068 if (nparams == 0)
return lives_osc_notify_failure();
6069 if (pnum < 0 || pnum >= nparams)
return lives_osc_notify_failure();
6073 if (weed_plant_has_leaf(ptmpl, WEED_LEAF_IS_TRANSITION) &&
6074 weed_get_boolean_value(ptmpl, WEED_LEAF_IS_TRANSITION, NULL) == WEED_TRUE)
6075 return lives_status_send(get_omc_const(
"LIVES_TRUE"));
6076 return lives_status_send(get_omc_const(
"LIVES_FALSE"));
6080 boolean lives_osc_cb_rte_getmode(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
6085 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
6086 lives_osc_parse_int_argument(vargs, &effect_key);
6088 if (effect_key < 1 || effect_key > FX_MAX) {
6089 return lives_status_send(
"0");
6098 boolean lives_osc_cb_rte_getstate(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
6102 if (!lives_osc_check_arguments(arglen, vargs,
"i",
TRUE))
return lives_osc_notify_failure();
6103 lives_osc_parse_int_argument(vargs, &effect_key);
6106 return lives_status_send(get_omc_const(
"LIVES_FALSE"));
6110 return lives_status_send(get_omc_const(
"LIVES_FALSE"));
6112 return lives_status_send(get_omc_const(
"LIVES_TRUE"));
6116 boolean lives_osc_cb_rte_get_keyfxname(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
6117 NetworkReturnAddressPtr ra) {
6122 if (!lives_osc_check_arguments(arglen, vargs,
"ii",
TRUE))
return lives_osc_notify_failure();
6123 lives_osc_parse_int_argument(vargs, &effect_key);
6124 lives_osc_parse_int_argument(vargs, &mode);
6125 if (effect_key < 1 || effect_key > FX_MAX || mode < 1 || mode >
rte_getmodespk())
return lives_osc_notify_failure();
6132 boolean lives_osc_cb_rte_getmodespk(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
6136 if (!lives_osc_check_arguments(arglen, vargs,
"i",
FALSE)) {
6137 if (lives_osc_check_arguments(arglen, vargs,
"",
TRUE)) {
6142 return lives_osc_notify_failure();
6145 lives_osc_check_arguments(arglen, vargs,
"i",
TRUE);
6146 lives_osc_parse_int_argument(vargs, &effect_key);
6149 return lives_status_send(
"0");
6159 boolean lives_osc_cb_rte_addpconnection(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
6160 NetworkReturnAddressPtr ra) {
6161 weed_plant_t *ofilter, *ifilter;
6163 int key0, mode0, pnum0;
6164 int key1, mode1, pnum1;
6167 if (!lives_osc_check_arguments(arglen, vargs,
"iiiiiii",
TRUE))
return lives_osc_notify_failure();
6168 lives_osc_parse_int_argument(vargs, &key0);
6169 lives_osc_parse_int_argument(vargs, &mode0);
6170 lives_osc_parse_int_argument(vargs, &pnum0);
6172 lives_osc_parse_int_argument(vargs, &autoscale);
6174 lives_osc_parse_int_argument(vargs, &key1);
6175 lives_osc_parse_int_argument(vargs, &mode1);
6176 lives_osc_parse_int_argument(vargs, &pnum1);
6182 if (key0 == key1)
return lives_osc_notify_failure();
6184 if (autoscale !=
TRUE && autoscale !=
FALSE)
return lives_osc_notify_failure();
6190 if (!ofilter)
return lives_osc_notify_failure();
6192 if (pnum0 >=
num_out_params(ofilter))
return lives_osc_notify_failure();
6197 }
else if (key1 == -2) {
6199 if (mode1 > 1 || pnum1 > 0)
return lives_osc_notify_failure();
6202 if (!ifilter)
return lives_osc_notify_failure();
6209 if (
pconx_check_connection(ofilter, pnum0, key1, mode1, pnum1,
FALSE, NULL, NULL, NULL, NULL,
6210 NULL))
return lives_osc_notify_failure();
6216 return lives_osc_notify_success(NULL);
6220 boolean lives_osc_cb_rte_delpconnection(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
6221 NetworkReturnAddressPtr ra) {
6222 int key0, mode0, pnum0;
6223 int key1, mode1, pnum1;
6225 if (!lives_osc_check_arguments(arglen, vargs,
"iiiiii",
TRUE))
return lives_osc_notify_failure();
6226 lives_osc_parse_int_argument(vargs, &key0);
6227 lives_osc_parse_int_argument(vargs, &mode0);
6228 lives_osc_parse_int_argument(vargs, &pnum0);
6229 lives_osc_parse_int_argument(vargs, &key1);
6230 lives_osc_parse_int_argument(vargs, &mode1);
6231 lives_osc_parse_int_argument(vargs, &pnum1);
6241 return lives_osc_notify_success(NULL);
6245 boolean lives_osc_cb_rte_listpconnection(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
6246 NetworkReturnAddressPtr ra) {
6247 int okey, omode, opnum;
6250 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE))
return lives_osc_notify_failure();
6251 lives_osc_parse_int_argument(vargs, &okey);
6252 lives_osc_parse_int_argument(vargs, &omode);
6253 lives_osc_parse_int_argument(vargs, &opnum);
6261 msg = lives_strdup(
"0 0 0 0");
6264 lives_status_send(msg);
6270 boolean lives_osc_cb_rte_addcconnection(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
6271 NetworkReturnAddressPtr ra) {
6272 int key0, mode0, cnum0;
6273 int key1, mode1, cnum1;
6274 weed_plant_t *filter;
6276 if (!lives_osc_check_arguments(arglen, vargs,
"iiiiii",
TRUE))
return lives_osc_notify_failure();
6277 lives_osc_parse_int_argument(vargs, &key0);
6278 lives_osc_parse_int_argument(vargs, &mode0);
6279 lives_osc_parse_int_argument(vargs, &cnum0);
6280 lives_osc_parse_int_argument(vargs, &key1);
6281 lives_osc_parse_int_argument(vargs, &mode1);
6282 lives_osc_parse_int_argument(vargs, &cnum1);
6288 if (key0 == key1)
return lives_osc_notify_failure();
6294 if (!filter)
return lives_osc_notify_failure();
6303 if (!filter)
return lives_osc_notify_failure();
6314 return lives_osc_notify_success(NULL);
6318 boolean lives_osc_cb_rte_delcconnection(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
6319 NetworkReturnAddressPtr ra) {
6320 int key0, mode0, cnum0;
6321 int key1, mode1, cnum1;
6323 if (!lives_osc_check_arguments(arglen, vargs,
"iiiiii",
TRUE))
return lives_osc_notify_failure();
6324 lives_osc_parse_int_argument(vargs, &key0);
6325 lives_osc_parse_int_argument(vargs, &mode0);
6326 lives_osc_parse_int_argument(vargs, &cnum0);
6327 lives_osc_parse_int_argument(vargs, &key1);
6328 lives_osc_parse_int_argument(vargs, &mode1);
6329 lives_osc_parse_int_argument(vargs, &cnum1);
6336 return lives_osc_notify_success(NULL);
6340 boolean lives_osc_cb_rte_listcconnection(
void *context,
int arglen,
const void *vargs, OSCTimeTag when,
6341 NetworkReturnAddressPtr ra) {
6342 int okey, omode, ocnum;
6345 if (!lives_osc_check_arguments(arglen, vargs,
"iii",
TRUE))
return lives_osc_notify_failure();
6346 lives_osc_parse_int_argument(vargs, &okey);
6347 lives_osc_parse_int_argument(vargs, &omode);
6348 lives_osc_parse_int_argument(vargs, &ocnum);
6356 msg = lives_strdup(
"0 0 0");
6359 lives_status_send(msg);
6365 boolean lives_osc_cb_swap(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
6368 return lives_osc_notify_success(NULL);
6372 boolean lives_osc_record_start(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
6375 return lives_osc_notify_success(NULL);
6380 boolean lives_osc_record_stop(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
6383 return lives_osc_notify_success(NULL);
6387 boolean lives_osc_record_toggle(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
6390 return lives_osc_notify_success(NULL);
6394 boolean lives_osc_cb_ping(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
6396 return lives_status_send(
"pong");
6400 boolean lives_osc_cb_getsetname(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
6405 boolean lives_osc_cb_open_file(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
6406 char filename[OSC_STRING_SIZE];
6407 float starttime = 0.;
6417 if (!lives_osc_check_arguments(arglen, vargs,
"sfi",
FALSE)) {
6419 if (!lives_osc_check_arguments(arglen, vargs,
"sf",
FALSE)) {
6421 if (!lives_osc_check_arguments(arglen, vargs,
"s",
TRUE))
return lives_osc_notify_failure();
6422 }
else lives_osc_check_arguments(arglen, vargs,
"sf",
TRUE);
6423 }
else lives_osc_check_arguments(arglen, vargs,
"sfi",
TRUE);
6425 lives_osc_parse_string_argument(vargs, filename);
6427 lives_osc_parse_float_argument(vargs, &starttime);
6429 lives_osc_parse_int_argument(vargs, &numframes);
6433 return lives_osc_notify_success(NULL);
6437 boolean lives_osc_cb_open_unicap(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
6439 char devname[OSC_STRING_SIZE];
6447 if (!lives_osc_check_arguments(arglen, vargs,
"si",
FALSE)) {
6448 if (lives_osc_check_arguments(arglen, vargs,
"s",
FALSE)) {
6449 lives_osc_parse_string_argument(vargs, devname);
6450 }
else return lives_osc_notify_failure();
6452 lives_osc_parse_string_argument(vargs, devname);
6453 lives_osc_parse_int_argument(vargs, &deint);
6455 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) deint =
TRUE;
6457 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) deint =
FALSE;
6460 return lives_osc_notify_failure();
6468 on_open_vdev_activate(NULL, (livespointer)devname);
6470 return lives_osc_notify_success(NULL);
6474 return lives_osc_notify_failure();
6478 boolean lives_osc_cb_new_audio(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
6479 char filename[OSC_STRING_SIZE];
6488 if (!lives_osc_check_arguments(arglen, vargs,
"s",
TRUE))
return lives_osc_notify_failure();
6490 lives_osc_parse_string_argument(vargs, filename);
6492 return lives_osc_notify_success(NULL);
6496 boolean lives_osc_cb_loadset(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
6497 char setname[OSC_STRING_SIZE];
6508 if (!lives_osc_check_arguments(arglen, vargs,
"s",
TRUE)) {
6509 return lives_osc_notify_failure();
6511 lives_osc_parse_string_argument(vargs, setname);
6517 return lives_osc_notify_failure();
6524 return lives_osc_notify_success(NULL);
6528 boolean lives_osc_cb_saveset(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra) {
6530 int force_append =
FALSE;
6531 char setname[OSC_STRING_SIZE];
6545 if (!lives_osc_check_arguments(arglen, vargs,
"s",
TRUE)) {
6546 if (!lives_osc_check_arguments(arglen, vargs,
"si",
TRUE)) {
6547 if (!lives_osc_check_arguments(arglen, vargs,
"",
TRUE)) {
6548 return lives_osc_notify_failure();
6551 lives_osc_parse_string_argument(vargs, setname);
6552 lives_osc_parse_int_argument(vargs, &force_append);
6554 if (!strcmp(boolstr, get_omc_const(
"LIVES_TRUE"))) force_append =
TRUE;
6556 if (!strcmp(boolstr, get_omc_const(
"LIVES_FALSE"))) force_append =
FALSE;
6559 return lives_osc_notify_failure();
6565 lives_osc_parse_string_argument(vargs, setname);
6572 if (ret)
return lives_osc_notify_success(NULL);
6573 else return lives_osc_notify_failure();
6584 if (ret)
return lives_osc_notify_success(NULL);
6585 else return lives_osc_notify_failure();
6590 return lives_osc_notify_failure();
6593 typedef void (*osc_cb)(
void *context,
int arglen,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra);
6598 void (*cb)(
void *ctx,
int len,
const void *vargs, OSCTimeTag when, NetworkReturnAddressPtr ra);
6601 {
"/record/enable",
"enable", (osc_cb)lives_osc_record_start, 3 },
6602 {
"/record/disable",
"disable", (osc_cb)lives_osc_record_stop, 3 },
6603 {
"/record/toggle",
"toggle", (osc_cb)lives_osc_record_toggle, 3 },
6605 {
"/video/selection/play",
"play", (osc_cb)lives_osc_cb_playsel, 46 },
6606 {
"/video/play/forwards",
"forwards", (osc_cb)lives_osc_cb_play_forward, 36 },
6607 {
"/video/play/backwards",
"backwards", (osc_cb)lives_osc_cb_play_backward, 36 },
6608 {
"/video/play/faster",
"faster", (osc_cb)lives_osc_cb_play_faster, 36 },
6609 {
"/clip/foreground/fps/faster",
"faster", (osc_cb)lives_osc_cb_play_faster, 61 },
6610 {
"/clip/foreground/fps/get",
"get", (osc_cb)lives_osc_cb_clip_getfps, 61 },
6611 {
"/clip/background/fps/faster",
"faster", (osc_cb)lives_osc_cb_bgplay_faster, 63 },
6612 {
"/clip/background/fps/get",
"get", (osc_cb)lives_osc_cb_bgclip_getfps, 63 },
6613 {
"/video/play/slower",
"slower", (osc_cb)lives_osc_cb_play_slower, 36 },
6614 {
"/clip/foreground/fps/slower",
"slower", (osc_cb)lives_osc_cb_play_slower, 61 },
6615 {
"/clip/background/fps/slower",
"slower", (osc_cb)lives_osc_cb_bgplay_slower, 63 },
6616 {
"/video/play/reset",
"reset", (osc_cb)lives_osc_cb_play_reset, 36 },
6617 {
"/video/play/parameter/count",
"set", (osc_cb)lives_osc_cb_rte_pparamcount, 140 },
6618 {
"/video/play/parameter/value/set",
"set", (osc_cb)lives_osc_cb_rte_setpparam, 140 },
6619 {
"/video/play/parameter/flags/get",
"get", (osc_cb)lives_osc_cb_rte_getpparamflags, 141 },
6620 {
"/video/play/parameter/min/get",
"get", (osc_cb)lives_osc_cb_rte_getpparammin, 142 },
6621 {
"/video/play/parameter/max/get",
"get", (osc_cb)lives_osc_cb_rte_getpparammax, 143 },
6622 {
"/video/play/parameter/type/get",
"get", (osc_cb)lives_osc_cb_rte_getpparamtype, 144 },
6623 {
"/video/play/parameter/name/get",
"get", (osc_cb)lives_osc_cb_rte_getpparamname, 145 },
6624 {
"/video/play/parameter/colorspace/get",
"get", (osc_cb)lives_osc_cb_rte_getpparamcspace, 146 },
6625 {
"/video/play/parameter/default/get",
"get", (osc_cb)lives_osc_cb_rte_getpparamdef, 147 },
6626 {
"/video/play/parameter/value/get",
"get", (osc_cb)lives_osc_cb_rte_getpparamval, 140 },
6627 {
"/clip/foreground/fps/reset",
"reset", (osc_cb)lives_osc_cb_play_reset, 61 },
6628 {
"/clip/background/fps/reset",
"reset", (osc_cb)lives_osc_cb_bgplay_reset, 63 },
6629 {
"/video/stop",
"stop", (osc_cb)lives_osc_cb_stop, 5 },
6630 {
"/video/fps/set",
"set", (osc_cb)lives_osc_cb_set_fps, 40 },
6631 {
"/video/fps/get",
"get", (osc_cb)lives_osc_cb_clip_getfps, 40 },
6632 {
"/video/loop/set",
"set", (osc_cb)lives_osc_cb_set_loop, 38 },
6633 {
"/video/loop/get",
"get", (osc_cb)lives_osc_cb_get_loop, 38 },
6634 {
"/video/pingpong/set",
"set", (osc_cb)lives_osc_cb_set_pingpong, 39 },
6635 {
"/video/pingpong/get",
"get", (osc_cb)lives_osc_cb_get_pingpong, 39 },
6636 {
"/lives/mode/set",
"set", (osc_cb)lives_osc_cb_setmode, 103 },
6637 {
"/lives/mode/get",
"get", (osc_cb)lives_osc_cb_getmode, 103 },
6638 {
"/video/fps/ratio/set",
"set", (osc_cb)lives_osc_cb_set_fps_ratio, 65 },
6639 {
"/video/fps/ratio/get",
"get", (osc_cb)lives_osc_cb_get_fps_ratio, 65 },
6640 {
"/video/play/time/get",
"get", (osc_cb)lives_osc_cb_get_playtime, 67 },
6641 {
"/audio/mute/get",
"get", (osc_cb)lives_osc_cb_get_amute, 300 },
6642 {
"/audio/mute/set",
"set", (osc_cb)lives_osc_cb_set_amute, 300 },
6643 {
"/audio/volume/get",
"get", (osc_cb)lives_osc_cb_get_avol, 301 },
6644 {
"/audio/volume/set",
"set", (osc_cb)lives_osc_cb_set_avol, 301 },
6645 {
"/audio/source/get",
"get", (osc_cb)lives_osc_cb_pref_get_audio_source, 302 },
6646 {
"/audio/source/set",
"set", (osc_cb)lives_osc_cb_pref_set_audio_source, 302 },
6647 {
"/clip/foreground/fps/set",
"set", (osc_cb)lives_osc_cb_set_fps, 61 },
6648 {
"/clip/background/fps/set",
"set", (osc_cb)lives_osc_cb_bgset_fps, 63 },
6649 {
"/clip/foreground/fps/ratio/set",
"set", (osc_cb)lives_osc_cb_set_fps_ratio, 64 },
6650 {
"/clip/foreground/fps/ratio/get",
"get", (osc_cb)lives_osc_cb_get_fps_ratio, 64 },
6651 {
"/clip/background/fps/ratio/set",
"set", (osc_cb)lives_osc_cb_bgset_fps_ratio, 66 },
6652 {
"/clip/background/fps/ratio/get",
"get", (osc_cb)lives_osc_cb_bgget_fps_ratio, 66 },
6653 {
"/video/play/reverse",
"reverse", (osc_cb)lives_osc_cb_play_reverse, 36 },
6654 {
"/clip/foreground/fps/reverse",
"reverse", (osc_cb)lives_osc_cb_play_reverse, 61 },
6655 {
"/clip/background/fps/reverse",
"reverse", (osc_cb)lives_osc_cb_bgplay_reverse, 63 },
6656 {
"/video/freeze/toggle",
"toggle", (osc_cb)lives_osc_cb_freeze, 37 },
6657 {
"/effects/realtime/name/get",
"get", (osc_cb)lives_osc_cb_fx_getname, 115 },
6658 {
"/effect_key/map",
"map", (osc_cb)lives_osc_cb_fx_map, 25 },
6659 {
"/effect_key/unmap",
"unmap", (osc_cb)lives_osc_cb_fx_unmap, 25 },
6660 {
"/effect_key/map/clear",
"clear", (osc_cb)lives_osc_cb_fx_map_clear, 32 },
6661 {
"/effect_key/reset",
"reset", (osc_cb)lives_osc_cb_fx_reset, 25 },
6662 {
"/effect_key/enable",
"enable", (osc_cb)lives_osc_cb_fx_enable, 25 },
6663 {
"/effect_key/disable",
"disable", (osc_cb)lives_osc_cb_fx_disable, 25 },
6664 {
"/effect_key/toggle",
"toggle", (osc_cb)lives_osc_cb_fx_toggle, 25 },
6665 {
"/effect_key/count",
"count", (osc_cb)lives_osc_cb_rte_count, 25 },
6666 {
"/effect_key/parameter/value/set",
"set", (osc_cb)lives_osc_cb_rte_setparam, 42 },
6667 {
"/effect_key/parameter/type/get",
"get", (osc_cb)lives_osc_cb_rte_getparamtype, 68 },
6668 {
"/effect_key/outparameter/type/get",
"get", (osc_cb)lives_osc_cb_rte_getoparamtype, 153 },
6669 {
"/effect_key/nparameter/type/get",
"get", (osc_cb)lives_osc_cb_rte_getnparamtype, 116 },
6670 {
"/effect_key/parameter/name/get",
"get", (osc_cb)lives_osc_cb_rte_getparamname, 71 },
6671 {
"/effect_key/outparameter/name/get",
"get", (osc_cb)lives_osc_cb_rte_getoparamname, 152 },
6672 {
"/effect_key/nparameter/name/get",
"get", (osc_cb)lives_osc_cb_rte_getnparamname, 72 },
6673 {
"/effect_key/parameter/colorspace/get",
"get", (osc_cb)lives_osc_cb_rte_getparamcspace, 73 },
6674 {
"/effect_key/outparameter/colorspace/get",
"get", (osc_cb)lives_osc_cb_rte_getoparamcspace, 154 },
6675 {
"/effect_key/parameter/flags/get",
"get", (osc_cb)lives_osc_cb_rte_getparamflags, 74 },
6676 {
"/effect_key/parameter/min/get",
"get", (osc_cb)lives_osc_cb_rte_getparammin, 75 },
6677 {
"/effect_key/parameter/max/get",
"get", (osc_cb)lives_osc_cb_rte_getparammax, 76 },
6678 {
"/effect_key/parameter/default/get",
"get", (osc_cb)lives_osc_cb_rte_getparamdef, 77 },
6679 {
"/effect_key/parameter/default/set",
"set", (osc_cb)lives_osc_cb_rte_setparamdef, 77 },
6680 {
"/effect_key/parameter/group/get",
"get", (osc_cb)lives_osc_cb_rte_getparamgrp, 78 },
6681 {
"/effect_key/parameter/gui/choices/count",
"count", (osc_cb)lives_osc_cb_pgui_countchoices, 181 },
6682 {
"/effect_key/parameter/gui/choices/get",
"get", (osc_cb)lives_osc_cb_pgui_getchoice, 181 },
6683 {
"/effect_key/outparameter/min/get",
"get", (osc_cb)lives_osc_cb_rte_getoparammin, 156 },
6684 {
"/effect_key/outparameter/max/get",
"get", (osc_cb)lives_osc_cb_rte_getoparammax, 157 },
6685 {
"/effect_key/outparameter/default/get",
"get", (osc_cb)lives_osc_cb_rte_getoparamdef, 158 },
6686 {
"/effect_key/outparameter/has_min",
"has_min", (osc_cb)lives_osc_cb_rte_getohasparammin, 150 },
6687 {
"/effect_key/outparameter/has_max",
"has_max", (osc_cb)lives_osc_cb_rte_getohasparammax, 150 },
6688 {
"/effect_key/outparameter/has_default",
"has_default", (osc_cb)lives_osc_cb_rte_getohasparamdef, 150 },
6689 {
"/effect_key/parameter/has_default",
"has_default", (osc_cb)lives_osc_cb_rte_gethasparamdef, 41 },
6690 {
"/effect_key/parameter/value/get",
"get", (osc_cb)lives_osc_cb_rte_getparamval, 42 },
6691 {
"/effect_key/outparameter/value/get",
"get", (osc_cb)lives_osc_cb_rte_getoparamval, 155 },
6692 {
"/effect_key/nparameter/count",
"count", (osc_cb)lives_osc_cb_rte_nparamcount, 91 },
6693 {
"/effect_key/parameter/count",
"count", (osc_cb)lives_osc_cb_rte_paramcount, 41 },
6694 {
"/effect_key/outparameter/count",
"count", (osc_cb)lives_osc_cb_rte_oparamcount, 150 },
6695 {
"/effect_key/nparameter/value/set",
"set", (osc_cb)lives_osc_cb_rte_setnparam, 92 },
6696 {
"/effect_key/nparameter/value/get",
"get", (osc_cb)lives_osc_cb_rte_getnparam, 92 },
6697 {
"/effect_key/nparameter/min/get",
"get", (osc_cb)lives_osc_cb_rte_getnparammin, 93 },
6698 {
"/effect_key/nparameter/max/get",
"get", (osc_cb)lives_osc_cb_rte_getnparammax, 94 },
6699 {
"/effect_key/nparameter/default/get",
"get", (osc_cb)lives_osc_cb_rte_getnparamdef, 95 },
6700 {
"/effect_key/nparameter/default/set",
"set", (osc_cb)lives_osc_cb_rte_setnparamdef, 95 },
6701 {
"/effect_key/nparameter/is_transition",
"is_transition", (osc_cb)lives_osc_cb_rte_getnparamtrans, 91 },
6702 {
"/effect_key/parameter/is_transition",
"is_transition", (osc_cb)lives_osc_cb_rte_getparamtrans, 41 },
6703 {
"/effect_key/inchannel/active/count",
"count", (osc_cb)lives_osc_cb_rte_getnchannels, 131 },
6704 {
"/effect_key/inchannel/palette/get",
"get", (osc_cb)lives_osc_cb_rte_getinpal, 132 },
6705 {
"/effect_key/outchannel/active/count",
"count", (osc_cb)lives_osc_cb_rte_getnochannels, 171 },
6706 {
"/effect_key/outchannel/palette/get",
"get", (osc_cb)lives_osc_cb_rte_getoutpal, 162 },
6707 {
"/effect_key/mode/set",
"set", (osc_cb)lives_osc_cb_rte_setmode, 43 },
6708 {
"/effect_key/mode/get",
"get", (osc_cb)lives_osc_cb_rte_getmode, 43 },
6709 {
"/effect_key/mode/next",
"next", (osc_cb)lives_osc_cb_rte_nextmode, 43 },
6710 {
"/effect_key/mode/previous",
"previous", (osc_cb)lives_osc_cb_rte_prevmode, 43 },
6711 {
"/effect_key/name/get",
"get", (osc_cb)lives_osc_cb_rte_get_keyfxname, 44 },
6712 {
"/effect_key/maxmode/get",
"get", (osc_cb)lives_osc_cb_rte_getmodespk, 45 },
6713 {
"/effect_key/state/get",
"get", (osc_cb)lives_osc_cb_rte_getstate, 56 },
6714 {
"/effect_key/outparameter/connection/add",
"add", (osc_cb)lives_osc_cb_rte_addpconnection, 151 },
6715 {
"/effect_key/outparameter/connection/delete",
"delete", (osc_cb)lives_osc_cb_rte_delpconnection, 151 },
6716 {
"/effect_key/outparameter/connection/list",
"list", (osc_cb)lives_osc_cb_rte_listpconnection, 151 },
6717 {
"/effect_key/outchannel/connection/add",
"add", (osc_cb)lives_osc_cb_rte_addcconnection, 161 },
6718 {
"/effect_key/outchannel/connection/delete",
"delete", (osc_cb)lives_osc_cb_rte_delcconnection, 161 },
6719 {
"/effect_key/outchannel/connection/list",
"list", (osc_cb)lives_osc_cb_rte_listcconnection, 161 },
6720 {
"/clip/encode_as",
"encode_as", (osc_cb)lives_osc_cb_clip_encodeas, 1 },
6721 {
"/clip/select",
"select", (osc_cb)lives_osc_cb_fgclip_select, 1 },
6722 {
"/clip/close",
"close", (osc_cb)lives_osc_cb_clip_close, 1 },
6723 {
"/clip/copy",
"copy", (osc_cb)lives_osc_cb_fgclip_copy, 1 },
6724 {
"/clip/undo",
"undo", (osc_cb)lives_osc_cb_clip_undo, 1 },
6725 {
"/clip/redo",
"redo", (osc_cb)lives_osc_cb_clip_redo, 1 },
6726 {
"/clip/selection/copy",
"copy", (osc_cb)lives_osc_cb_fgclipsel_copy, 55 },
6727 {
"/clip/selection/cut",
"cut", (osc_cb)lives_osc_cb_fgclipsel_cut, 55 },
6728 {
"/clip/selection/delete",
"delete", (osc_cb)lives_osc_cb_fgclipsel_delete, 55 },
6729 {
"/clip/selection/rte_apply",
"rte_apply", (osc_cb)lives_osc_cb_fgclipsel_rteapply, 55 },
6730 {
"/clipboard/paste",
"paste", (osc_cb)lives_osc_cb_clipbd_paste, 70 },
6731 {
"/clipboard/insert_before",
"insert_before", (osc_cb)lives_osc_cb_clipbd_insertb, 70 },
6732 {
"/clipboard/insert_after",
"insert_after", (osc_cb)lives_osc_cb_clipbd_inserta, 70 },
6733 {
"/clip/retrigger",
"retrigger", (osc_cb)lives_osc_cb_fgclip_retrigger, 1 },
6734 {
"/clip/resample",
"resample", (osc_cb)lives_osc_cb_clip_resample, 1 },
6735 {
"/clip/select/next",
"next", (osc_cb)lives_osc_cb_fgclip_select_next, 54 },
6736 {
"/clip/select/previous",
"previous", (osc_cb)lives_osc_cb_fgclip_select_previous, 54 },
6737 {
"/clip/foreground/select",
"select", (osc_cb)lives_osc_cb_fgclip_select, 47 },
6738 {
"/clip/background/select",
"select", (osc_cb)lives_osc_cb_bgclip_select, 48 },
6739 {
"/clip/foreground/retrigger",
"retrigger", (osc_cb)lives_osc_cb_fgclip_retrigger, 47 },
6740 {
"/clip/background/retrigger",
"retrigger", (osc_cb)lives_osc_cb_bgclip_retrigger, 48 },
6741 {
"/clip/foreground/set",
"set", (osc_cb)lives_osc_cb_fgclip_set, 47 },
6742 {
"/clip/background/set",
"set", (osc_cb)lives_osc_cb_bgclip_set, 48 },
6743 {
"/clip/foreground/get",
"get", (osc_cb)lives_osc_cb_clip_get_current, 47 },
6744 {
"/clip/background/get",
"get", (osc_cb)lives_osc_cb_bgclip_get_current, 48 },
6745 {
"/clip/foreground/next",
"next", (osc_cb)lives_osc_cb_fgclip_select_next, 47 },
6746 {
"/clip/background/next",
"next", (osc_cb)lives_osc_cb_bgclip_select_next, 48 },
6747 {
"/clip/foreground/previous",
"previous", (osc_cb)lives_osc_cb_fgclip_select_previous, 47 },
6748 {
"/clip/background/previous",
"previous", (osc_cb)lives_osc_cb_bgclip_select_previous, 48 },
6750 {
"/lives/version/get",
"get", (osc_cb)lives_osc_cb_getversion, 24 },
6751 {
"/lives/status/get",
"get", (osc_cb)lives_osc_cb_getstatus, 122 },
6752 {
"/lives/constant/value/get",
"get", (osc_cb)lives_osc_cb_getconst, 121 },
6754 {
"/app/name",
"name", (osc_cb)lives_osc_cb_getname, 22 },
6755 {
"/app/name/get",
"get", (osc_cb)lives_osc_cb_getname, 23 },
6756 {
"/app/version/get",
"get", (osc_cb)lives_osc_cb_getversion, 125 },
6758 {
"/reply_to",
"reply_to", (osc_cb)lives_osc_cb_open_status_socket, 2 },
6759 {
"/lives/open_status_socket",
"open_status_socket", (osc_cb)lives_osc_cb_open_status_socket, 21 },
6760 {
"/app/open_status_socket",
"open_status_socket", (osc_cb)lives_osc_cb_open_status_socket, 22 },
6761 {
"/app/ping",
"ping", (osc_cb)lives_osc_cb_ping, 22 },
6762 {
"/lives/ping",
"ping", (osc_cb)lives_osc_cb_ping, 21 },
6763 {
"/ping",
"ping", (osc_cb)lives_osc_cb_ping, 2 },
6764 {
"/notify_to",
"notify_to", (osc_cb)lives_osc_cb_open_notify_socket, 2 },
6765 {
"/lives/open_notify_socket",
"open_notify_socket", (osc_cb)lives_osc_cb_open_notify_socket, 21 },
6766 {
"/notify/confirmations/set",
"set", (osc_cb)lives_osc_cb_notify_c, 101 },
6767 {
"/notify/events/set",
"set", (osc_cb)lives_osc_cb_notify_e, 102 },
6768 {
"/clip/count",
"count", (osc_cb)lives_osc_cb_clip_count, 1 },
6771 {
"/clip/foreground/frame/get",
"get", (osc_cb)lives_osc_cb_clip_getframe, 60 },
6773 {
"/clip/background/frame/get",
"get", (osc_cb)lives_osc_cb_bgclip_getframe, 62 },
6774 {
"/clip/is_valid/get",
"get", (osc_cb)lives_osc_cb_clip_isvalid, 49 },
6775 {
"/clip/frame/count",
"count", (osc_cb)lives_osc_cb_clip_get_frames, 57 },
6776 {
"/clip/frame/save_as_image",
"save_as_image", (osc_cb)lives_osc_cb_clip_save_frame, 57 },
6777 {
"/clip/select_all",
"select_all", (osc_cb)lives_osc_cb_clip_select_all, 1 },
6778 {
"/clip/start/set",
"set", (osc_cb)lives_osc_cb_clip_set_start, 50 },
6779 {
"/clip/start/get",
"get", (osc_cb)lives_osc_cb_clip_get_start, 50 },
6780 {
"/clip/end/set",
"set", (osc_cb)lives_osc_cb_clip_set_end, 51 },
6781 {
"/clip/end/get",
"get", (osc_cb)lives_osc_cb_clip_get_end, 51 },
6782 {
"/clip/size/get",
"get", (osc_cb)lives_osc_cb_clip_get_size, 58 },
6783 {
"/clip/name/get",
"get", (osc_cb)lives_osc_cb_clip_get_name, 59 },
6784 {
"/clip/name/set",
"set", (osc_cb)lives_osc_cb_clip_set_name, 59 },
6785 {
"/clip/fps/get",
"get", (osc_cb)lives_osc_cb_clip_get_ifps, 113 },
6786 {
"/clip/open/file",
"file", (osc_cb)lives_osc_cb_open_file, 33 },
6787 {
"/clip/open/unicap",
"unicap", (osc_cb)lives_osc_cb_open_unicap, 33 },
6788 {
"/clip/audio/new",
"new", (osc_cb)lives_osc_cb_new_audio, 108 },
6789 {
"/output/fullscreen/enable",
"enable", (osc_cb)lives_osc_cb_fssepwin_enable, 28 },
6790 {
"/output/fullscreen/disable",
"disable", (osc_cb)lives_osc_cb_fssepwin_disable, 28 },
6791 {
"/output/fps/set",
"set", (osc_cb)lives_osc_cb_op_fps_set, 52 },
6792 {
"/output/nodrop/enable",
"enable", (osc_cb)lives_osc_cb_op_nodrope, 30 },
6793 {
"/output/nodrop/disable",
"disable", (osc_cb)lives_osc_cb_op_nodropd, 30 },
6794 {
"/clip/foreground/background/swap",
"swap", (osc_cb)lives_osc_cb_swap, 53 },
6795 {
"/clipset/load",
"load", (osc_cb)lives_osc_cb_loadset, 35 },
6797 {
"/clipset/name/get",
"get", (osc_cb)lives_osc_cb_getsetname, 135 },
6798 {
"/layout/clear",
"clear", (osc_cb)lives_osc_cb_clearlay, 104 },
6799 {
"/block/count",
"count", (osc_cb)lives_osc_cb_blockcount, 105 },
6800 {
"/block/insert",
"insert", (osc_cb)lives_osc_cb_blockinsert, 105 },
6801 {
"/block/start/time/get",
"get", (osc_cb)lives_osc_cb_blockstget, 111 },
6802 {
"/block/end/time/get",
"get", (osc_cb)lives_osc_cb_blockenget, 112 },
6803 {
"/mt/time/get",
"get", (osc_cb)lives_osc_cb_mtctimeget, 201 },
6804 {
"/mt/time/set",
"set", (osc_cb)lives_osc_cb_mtctimeset, 201 },
6805 {
"/mt/ctrack/get",
"get", (osc_cb)lives_osc_cb_mtctrackget, 201 },
6806 {
"/mt/ctrack/set",
"set", (osc_cb)lives_osc_cb_mtctrackset, 201 },
6807 {
"/test",
"", (osc_cb)lives_osc_cb_test, 500 },
6809 { NULL, NULL, NULL, 0 },
6819 {
"/",
"", 2, -1, 0 },
6820 {
"/video/",
"video", 5, -1, 0 },
6821 {
"/video/selection/",
"selection", 46, 5, 0 },
6822 {
"/video/fps/",
"fps", 40, 5, 0 },
6823 {
"/video/fps/ratio/",
"ratio", 65, 40, 0 },
6824 {
"/video/play/ start video playback",
"play", 36, 5, 0 },
6825 {
"/video/play/time",
"time", 67, 36, 0 },
6826 {
"/video/play/parameter",
"parameter", 69, 36, 0 },
6827 {
"/video/play/parameter/value",
"value", 140, 69, 0 },
6828 {
"/video/play/parameter/flags",
"flags", 141, 69, 0 },
6829 {
"/video/play/parameter/min",
"min", 142, 69, 0 },
6830 {
"/video/play/parameter/max",
"max", 143, 69, 0 },
6831 {
"/video/play/parameter/type",
"type", 144, 69, 0 },
6832 {
"/video/play/parameter/name",
"name", 145, 69, 0 },
6833 {
"/video/play/parameter/colorspace",
"colorspace", 146, 69, 0 },
6834 {
"/video/play/parameter/default",
"default", 147, 69, 0 },
6835 {
"/video/freeze/",
"freeze", 37, 5, 0 },
6836 {
"/video/loop/",
"loop", 38, 5, 0 },
6837 {
"/video/pingpong/",
"pingpong", 39, 5, 0 },
6838 {
"/audio/",
"audio", 6, -1, 0 },
6839 {
"/audio/mute",
"mute", 300, 6, 0 },
6840 {
"/audio/volume",
"volume", 301, 6, 0 },
6841 {
"/audio/source",
"source", 302, 6, 0 },
6842 {
"/clip/",
"clip", 1, -1, 0 },
6843 {
"/clip/fps/",
"fps", 113, 1, 0 },
6844 {
"/clip/foreground/",
"foreground", 47, 1, 0 },
6845 {
"/clip/foreground/valid/",
"valid", 80, 1, 0 },
6846 {
"/clip/foreground/background/",
"background", 53, 47, 0 },
6847 {
"/clip/foreground/frame/",
"frame", 60, 47, 0 },
6848 {
"/clip/foreground/fps/",
"fps", 61, 47, 0 },
6849 {
"/clip/foreground/fps/ratio/",
"ratio", 64, 61, 0 },
6850 {
"/clip/background/",
"background", 48, 1, 0 },
6851 {
"/clip/background/valid/",
"valid", 81, 1, 0 },
6852 {
"/clip/background/frame/",
"frame", 62, 48, 0 },
6853 {
"/clip/background/fps/",
"fps", 63, 48, 0 },
6854 {
"/clip/background/fps/ratio/",
"ratio", 66, 63, 0 },
6855 {
"/clip/is_valid/",
"is_valid", 49, 1, 0 },
6856 {
"/clip/frame/",
"frame", 57, 1, 0 },
6857 {
"/clip/start/",
"start", 50, 1, 0 },
6858 {
"/clip/end/",
"end", 51, 1, 0 },
6859 {
"/clip/select/",
"select", 54, 1, 0 },
6860 {
"/clip/selection/",
"selection", 55, 1, 0 },
6861 {
"/clip/size/",
"size", 58, 1, 0 },
6862 {
"/clip/name/",
"name", 59, 1, 0 },
6863 {
"/clip/audio/",
"audio", 108, 1, 0 },
6864 {
"/clipboard/",
"clipboard", 70, -1, 0 },
6865 {
"/record/",
"record", 3, -1, 0 },
6866 {
"/effect/",
"effects", 4, -1, 0 },
6867 {
"/effect/realtime/",
"realtime", 114, 4, 0 },
6868 {
"/effect/realtime/name/",
"name", 115, 114, 0 },
6869 {
"/effect_key/",
"effect_key", 25, -1, 0 },
6870 {
"/effect_key/inchannel/",
"inchannel", 130, 25, 0 },
6871 {
"/effect_key/inchannel/active/",
"active", 131, 130, 0 },
6872 {
"/effect_key/inchannel/palette/",
"palette", 132, 130, 0 },
6873 {
"/effect_key/parameter/",
"parameter", 41, 25, 0 },
6874 {
"/effect_key/parameter/value/",
"value", 42, 41, 0 },
6875 {
"/effect_key/parameter/type/",
"type", 68, 41, 0 },
6876 {
"/effect_key/parameter/name/",
"name", 71, 41, 0 },
6877 {
"/effect_key/parameter/colorspace/",
"colorspace", 73, 41, 0 },
6878 {
"/effect_key/parameter/flags/",
"flags", 74, 41, 0 },
6879 {
"/effect_key/parameter/min/",
"min", 75, 41, 0 },
6880 {
"/effect_key/parameter/max/",
"max", 76, 41, 0 },
6881 {
"/effect_key/parameter/default/",
"default", 77, 41, 0 },
6882 {
"/effect_key/parameter/group/",
"group", 78, 41, 0 },
6883 {
"/effect_key/parameter/gui/",
"gui", 180, 41, 0 },
6884 {
"/effect_key/parameter/gui/choices",
"choices", 181, 180, 0 },
6885 {
"/effect_key/nparameter/",
"nparameter", 91, 25, 0 },
6886 {
"/effect_key/nparameter/name/",
"name", 72, 91, 0 },
6887 {
"/effect_key/nparameter/value/",
"value", 92, 91, 0 },
6888 {
"/effect_key/nparameter/type/",
"type", 116, 91, 0 },
6889 {
"/effect_key/nparameter/min/",
"min", 93, 91, 0 },
6890 {
"/effect_key/nparameter/max/",
"max", 94, 91, 0 },
6891 {
"/effect_key/nparameter/default/",
"default", 95, 91, 0 },
6892 {
"/effect_key/map/",
"map", 32, 25, 0 },
6893 {
"/effect_key/mode/",
"mode", 43, 25, 0 },
6894 {
"/effect_key/name/",
"name", 44, 25, 0 },
6895 {
"/effect_key/maxmode/",
"maxmode", 45, 25, 0 },
6896 {
"/effect_key/state/",
"state", 56, 25, 0 },
6897 {
"/effect_key/outchannel/",
"outchannel", 160, 25, 0 },
6898 {
"/effect_key/outchannel/connection/",
"connection", 161, 160, 0 },
6899 {
"/effect_key/outchannel/palette/",
"palette", 162, 160, 0 },
6900 {
"/effect_key/outchannel/active/",
"active", 171, 160, 0 },
6901 {
"/effect_key/outparameter/",
"outparameter", 150, 25, 0 },
6902 {
"/effect_key/outparameter/connection/",
"connection", 151, 150, 0 },
6903 {
"/effect_key/outparameter/name/",
"name", 152, 150, 0 },
6904 {
"/effect_key/outparameter/type/",
"type", 153, 150, 0 },
6905 {
"/effect_key/outparameter/colorspace/",
"colorspace", 154, 150, 0 },
6906 {
"/effect_key/outparameter/value/",
"value", 155, 150, 0 },
6907 {
"/effect_key/outparameter/min/",
"min", 156, 150, 0 },
6908 {
"/effect_key/outparameter/max/",
"max", 157, 150, 0 },
6909 {
"/effect_key/outparameter/default/",
"default", 158, 150, 0 },
6910 {
"/lives/",
"lives", 21, -1, 0 },
6911 {
"/lives/version/",
"version", 24, 21, 0 },
6912 {
"/lives/mode/",
"mode", 103, 21, 0 },
6913 {
"/lives/status/",
"status", 122, 21, 0 },
6914 {
"/lives/constant/",
"constant", 120, 21, 0 },
6915 {
"/lives/constant/value/",
"value", 121, 120, 0 },
6916 {
"/clipset/",
"clipset", 35, -1, 0 },
6917 {
"/clipset/name/",
"name", 135, 35, 0 },
6918 {
"/app/",
"app", 22, -1, 0 },
6919 {
"/app/name/",
"name", 23, 22, 0 },
6920 {
"/app/version/",
"version", 125, 22, 0 },
6921 {
"/output/",
"output", 27, -1, 0 },
6922 {
"/output/fullscreen/",
"fullscreen", 28, 27, 0 },
6923 {
"/output/fps/",
"fps", 52, 27, 0 },
6924 {
"/output/nodrop/",
"nodrop", 30, 27, 0 },
6925 {
"/clip/open/",
"open", 33, 1, 0 },
6926 {
"/notify/",
"notify", 100, -1, 0 },
6927 {
"/notify/confirmations/",
"confirmations", 101, 100, 0 },
6928 {
"/notify/events/",
"events", 102, 100, 0 },
6929 {
"/layout/",
"layout", 104, -1, 0 },
6930 {
"/block/",
"block", 105, -1, 0 },
6931 {
"/block/start/",
"start", 106, 105, 0 },
6932 {
"/block/start/time/",
"time", 111, 106, 0 },
6933 {
"/block/end/",
"end", 107, 105, 0 },
6934 {
"/block/end/time/",
"time", 112, 107, 0 },
6935 {
"/mt/",
"mt", 200, -1, 0 },
6936 {
"/mt/ctime/",
"ctime", 201, 200, 0 },
6937 {
"/mt/ctrack/",
"ctrack", 202, 200, 0 },
6938 {
"/test/",
"test", 500, -1, 0 },
6939 { NULL, NULL, 0, -1, 0 },
6943 int lives_osc_build_cont(lives_osc * o) {
6946 for (i = 0; osc_cont[i].name ; i++) {
6947 if (osc_cont[i].it == 0) {
6948 o->cqinfo.comment = osc_cont[i].comment;
6951 if ((o->leaves[osc_cont[i].leave] =
6952 OSCNewContainer(osc_cont[i].name,
6953 (osc_cont[i].att == -1 ? o->container : o->leaves[osc_cont[i].att]),
6954 &(o->cqinfo))) == 0) {
6955 if (osc_cont[i].att == - 1) {
6956 lives_printerr(
"Cannot create container %d (%s) \n",
6957 i, osc_cont[i].name);
6960 lives_printerr(
"Cannot add branch %s to container %d)\n",
6961 osc_cont[i].name, osc_cont[i].att);
6968 int n = osc_cont[i].it;
6969 int base = osc_cont[i].leave;
6972 for (j = 0; j < n ; j++) {
6973 sprintf(name,
"N%d", j);
6974 sprintf(comment,
"<%d>", j);
6975 lives_printerr(
"Try cont.%d '%s', %d %d\n", j, name,
6977 o->cqinfo.comment = comment;
6978 if ((o->leaves[base + j] = OSCNewContainer(name,
6979 o->leaves[osc_cont[i].att],
6980 &(o->cqinfo))) == 0) {
6981 lives_printerr(
"Cannot auto numerate container %s \n",
6993 int lives_osc_attach_methods(lives_osc * o) {
6996 for (i = 0; osc_methods[i].name ; i++) {
6997 o->ris.description = osc_methods[i].descr;
6998 OSCNewMethod(osc_methods[i].name,
6999 o->leaves[osc_methods[i].leave],
7009 lives_osc *lives_osc_allocate(
int port_id) {
7016 o->rt.InitTimeMemoryAllocator = lives_osc_malloc;
7017 o->rt.RealTimeMemoryAllocator = lives_osc_malloc;
7018 o->rt.receiveBufferSize = 1024;
7019 o->rt.numReceiveBuffers = 100;
7020 o->rt.numQueuedObjects = 100;
7021 o->rt.numCallbackListNodes = 200;
7022 o->leaves = (OSCcontainer *)
lives_malloc(
sizeof(OSCcontainer) * 1000);
7023 o->t.initNumContainers = 1000;
7024 o->t.initNumMethods = 2000;
7025 o->t.InitTimeMemoryAllocator = lives_osc_malloc;
7026 o->t.RealTimeMemoryAllocator = lives_osc_malloc;
7028 if (!OSCInitReceive(&(o->rt))) {
7029 d_print(
_(
"Cannot initialize OSC receiver\n"));
7032 o->packet = OSCAllocPacketBuffer();
7035 o->container = OSCInitAddressSpace(&(o->t));
7037 OSCInitContainerQueryResponseInfo(&(o->cqinfo));
7038 o->cqinfo.comment =
"Video commands";
7040 if (!lives_osc_build_cont(o))
7043 OSCInitMethodQueryResponseInfo(&(o->ris));
7045 if (!lives_osc_attach_methods(o))
7047 }
else o = livesOSC;
7050 if (NetworkStartUDPServer(o->packet, port_id) !=
TRUE) {
7051 d_print(
_(
"WARNING: Cannot start OSC server at UDP port %d\n"), port_id);
7053 d_print(
_(
"Started OSC server at UDP port %d\n"), port_id);
7061 void lives_osc_dump(
void) {OSCPrintWholeAddressSpace();}
7066 static int lives_osc_get_packet(lives_osc * o) {
7072 if (NetworkPacketWaiting(o->packet)) {
7074 if (NetworkReceivePacket(o->packet)) {
7076 OSCAcceptPacket(o->packet);
7079 g_print(
"got osc msg %s\n", OSCPacketBufferGetBuffer((OSCPacketBuffer)o->packet));
7082 OSCBeProductiveWhileWaiting();
7093 static void oscbuf_to_packet(OSCbuf * obuf, OSCPacketBuffer packet) {
7094 int *psize = OSCPacketBufferGetSize(packet);
7095 int bufsize = OSC_packetSize(obuf);
7097 if (bufsize > 100) {
7101 lives_memcpy(OSCPacketBufferGetBuffer(packet), OSC_getPacket(obuf), bufsize);
7106 boolean lives_osc_act(OSCbuf * obuf) {
7109 OSCPacketBuffer packet;
7111 if (!livesOSC) lives_osc_init(0);
7113 packet = livesOSC->packet;
7115 oscbuf_to_packet(obuf, packet);
7117 OSCAcceptPacket(packet);
7119 via_shortcut =
TRUE;
7120 OSCBeProductiveWhileWaiting();
7121 via_shortcut =
FALSE;
7127 void lives_osc_free(lives_osc * c) {
7129 if (c->leaves) free(c->leaves);
7137 boolean lives_osc_init(uint32_t udp_port) {
7138 if (livesOSC && udp_port != 0) {
7144 if (NetworkStartUDPServer(livesOSC->packet, udp_port) !=
TRUE) {
7145 d_print(
_(
"Cannot start OSC/UDP server at port %d \n"), udp_port);
7148 livesOSC = lives_osc_allocate(udp_port);
7149 if (!livesOSC)
return FALSE;
7150 status_socket = NULL;
7151 notify_socket = NULL;
7157 boolean lives_osc_poll(livespointer data) {
7160 if (!
mainw->
osc_block && livesOSC) lives_osc_get_packet(livesOSC);
7165 void lives_osc_end(
void) {
7166 if (notify_socket) {
7168 lives_osc_close_notify_socket();
7170 if (status_socket) {
7171 lives_osc_close_status_socket();
7174 if (livesOSC) lives_osc_free(livesOSC);