LiVES 3.2.0
omc-learn.h
Go to the documentation of this file.
1// omc-learn.h
2// LiVES (lives-exe)
3// (c) G. Finch 2003 - 2018
4// Released under the GPL 3 or later
5// see file ../COPYING for licensing details
6
7#ifndef HAS_LIVES_OMC_LEARN_H
8#define HAS_LIVES_OMC_LEARN_H
9
10#define OMC_DEV_MIDI (1 << 0)
11#define OMC_DEV_JS (1 << 1)
12#define OMC_DEV_FORCE_RAW_MIDI (1 << 2)
13#define OMC_DEV_MIDI_DUMMY (1 << 3)
14
16#define N_OMC_MACROS 64
17
19#define OMC_FP_FIX 4
20
21// OMC device interfaces
22#if HAVE_LINUX_JOYSTICK_H
23#define OMC_JS_IMPL
24#endif
25
26#define OMC_MIDI_IMPL
27
28#define MIDI_OMNI -1
29
30#ifdef OMC_JS_IMPL
31char *js_mangle(void);
32boolean js_open(void);
33void js_close(void);
34const char *get_js_filename(void);
35#endif
36
37#ifdef OMC_MIDI_IMPL
38char *midi_mangle(void);
39const char *get_midi_filename(void);
40boolean midi_open(void);
41void midi_close(void);
42#endif
43
44/* parameter types */
45#define OMC_PARAM_INT 1
46#define OMC_PARAM_DOUBLE 2
47#define OMC_PARAM_SPECIAL 128
48
49typedef struct {
50 char *msg;
51 char *macro_text;
52 char *info_text;
53 char *stype_tags;
54
56
57 char **pname;
58
59 int *ptypes;
60 int *mini, *maxi, *vali;
61
62 double *mind, *maxd, *vald;
64
65typedef struct {
66 char *srch;
67 int macro;
68
69 int nvars;
70 int *offs0;
71 double *scale;
72 int *offs1;
73
74 int *min;
75 int *max;
76
77 boolean *matchp;
78 int *matchi;
79
80 // enumerated by number of params in target macro
81 int *map;
82 // (reverse ordered, starting from the last macro parameter)
83 int *fvali;
84 double *fvald;
85
87
88 LiVESWidget *treev1;
89 LiVESWidget *treev2;
90
91 LiVESTreeStore *gtkstore;
92 LiVESTreeStore *gtkstore2;
93
94 int *tmpvals;
96
97typedef struct {
98 LiVESWidget *dialog;
99 LiVESWidget *clear_button;
100 LiVESWidget *del_all_button;
101
104 LiVESWidget *table;
105 LiVESWidget *top_vbox;
106} omclearn_w;
107
108enum {
118
119enum {
125
126#define OMC_INTERNAL 0
127
128#define OMC_JS 1
129#define OMC_JS_AXIS 2
130#define OMC_JS_BUTTON 3
131
132#define OMC_MIDI 128
133#define OMC_MIDI_NOTE 129
134#define OMC_MIDI_NOTE_OFF 130
135#define OMC_MIDI_CONTROLLER 131
136#define OMC_MIDI_PITCH_BEND 132
137#define OMC_MIDI_PGM_CHANGE 133
138
139// get a macro
141
143void on_midi_learn_activate(LiVESMenuItem *, livespointer);
144
147boolean omc_process_string(int supertype, const char *string, boolean learn, omclearn_w *omclw);
148
149#define OMC_FILE_VSTRING "LiVES OMC map version 1.1"
150#define OMC_FILE_VSTRING_1_0 "LiVES OMC map version 1.0"
151
152boolean has_devicemap(int has_this_macro);
154void on_devicemap_save_activate(LiVESMenuItem *, livespointer);
155void on_devicemap_load_activate(LiVESMenuItem *, livespointer);
156
157#include "osc.h"
158
159#define OSC_BUF_SIZE 1024
160#define OSC_MAX_TYPETAGS 64
161
163OSCbuf *omc_learner_decode(int type, int index, const char *string);
164
165#endif // HAS_LIVES_OMC_LEARN_H
@ VALUE_COLUMN
Definition: omc-learn.h:110
@ OMC_NUM_COLUMNS
Definition: omc-learn.h:116
@ TITLE_COLUMN
Definition: omc-learn.h:109
@ RANGE_COLUMN
Definition: omc-learn.h:112
@ FILTER_COLUMN
Definition: omc-learn.h:111
@ SCALE_COLUMN
Definition: omc-learn.h:114
@ OFFS2_COLUMN
Definition: omc-learn.h:115
@ OFFS1_COLUMN
Definition: omc-learn.h:113
void on_devicemap_load_activate(LiVESMenuItem *, livespointer)
boolean omc_process_string(int supertype, const char *string, boolean learn, omclearn_w *omclw)
process a string (i.e. convert to an OSC message and pass to OSC subsys) only need to set omclw if le...
const char * get_midi_filename(void)
OSCbuf * omc_learner_decode(int type, int index, const char *string)
decode learnt behaviours
boolean has_devicemap(int has_this_macro)
@ VALUE2_COLUMN
Definition: omc-learn.h:121
@ OMC_NUM2_COLUMNS
Definition: omc-learn.h:123
@ TITLE2_COLUMN
Definition: omc-learn.h:120
@ ADJUSTMENT
Definition: omc-learn.h:122
boolean midi_open(void)
void on_devicemap_save_activate(LiVESMenuItem *, livespointer)
void create_devicemap_directory(void)
void midi_close(void)
void on_midi_learn_activate(LiVESMenuItem *, livespointer)
start learning MIDI inputs
const lives_omc_macro_t * get_omc_macro(int idx)
char * midi_mangle(void)
char * msg
OSC message.
Definition: omc-learn.h:50
char * macro_text
macro text
Definition: omc-learn.h:51
char * info_text
descriptive text
Definition: omc-learn.h:52
char * stype_tags
setter type tags
Definition: omc-learn.h:53
double * maxd
Definition: omc-learn.h:62
int * min
min values of input params
Definition: omc-learn.h:74
char * srch
string to match
Definition: omc-learn.h:66
LiVESWidget * treev1
Definition: omc-learn.h:88
int * matchi
match value
Definition: omc-learn.h:78
int macro
action number this is linked to (or -1) (see mainwindow.h)
Definition: omc-learn.h:67
LiVESTreeStore * gtkstore
Definition: omc-learn.h:91
int * max
max values of input params
Definition: omc-learn.h:75
int * offs0
offs to add to params before scale (pre-bias)
Definition: omc-learn.h:70
LiVESWidget * treev2
Definition: omc-learn.h:89
int * map
mapping macro parameters to variables in the input (whether we use a default or a variable)
Definition: omc-learn.h:81
int nvars
number of input params
Definition: omc-learn.h:69
LiVESTreeStore * gtkstore2
Definition: omc-learn.h:92
double * scale
scale for params (unbiased scale)
Definition: omc-learn.h:71
boolean * matchp
do we additionally need to match this param val in the input ?
Definition: omc-learn.h:77
double * fvald
defaults, mapping to fixed doubles
Definition: omc-learn.h:84
int * fvali
defaults, mapping to fixed ints
Definition: omc-learn.h:83
int * offs1
offs to add to params after scale (post bias)
Definition: omc-learn.h:72
LiVESWidget * top_vbox
Definition: omc-learn.h:105
LiVESWidget * table
Definition: omc-learn.h:104
int tbl_currow
Definition: omc-learn.h:103
int tbl_rows
Definition: omc-learn.h:102
LiVESWidget * del_all_button
Definition: omc-learn.h:100
LiVESWidget * dialog
Definition: omc-learn.h:98
LiVESWidget * clear_button
Definition: omc-learn.h:99