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
31 char *js_mangle(void);
32 boolean js_open(void);
33 void js_close(void);
34 const char *get_js_filename(void);
35 #endif
36 
37 #ifdef OMC_MIDI_IMPL
38 char *midi_mangle(void);
39 const char *get_midi_filename(void);
40 boolean midi_open(void);
41 void 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 
49 typedef struct {
50  char *msg;
51  char *macro_text;
52  char *info_text;
53  char *stype_tags;
54 
55  int nparams;
56 
57  char **pname;
58 
59  int *ptypes;
60  int *mini, *maxi, *vali;
61 
62  double *mind, *maxd, *vald;
64 
65 typedef 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 
97 typedef struct {
98  LiVESWidget *dialog;
99  LiVESWidget *clear_button;
100  LiVESWidget *del_all_button;
101 
102  int tbl_rows;
104  LiVESWidget *table;
105  LiVESWidget *top_vbox;
106 } omclearn_w;
107 
108 enum {
117 };
118 
119 enum {
124 };
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 
143 void on_midi_learn_activate(LiVESMenuItem *, livespointer);
144 
147 boolean 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 
152 boolean has_devicemap(int has_this_macro);
154 void on_devicemap_save_activate(LiVESMenuItem *, livespointer);
155 void 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 
163 OSCbuf *omc_learner_decode(int type, int index, const char *string);
164 
165 #endif // HAS_LIVES_OMC_LEARN_H
lives_omc_macro_t::msg
char * msg
OSC message.
Definition: omc-learn.h:50
VALUE2_COLUMN
@ VALUE2_COLUMN
Definition: omc-learn.h:121
lives_omc_match_node_t::matchi
int * matchi
match value
Definition: omc-learn.h:78
ADJUSTMENT
@ ADJUSTMENT
Definition: omc-learn.h:122
lives_omc_match_node_t::srch
char * srch
string to match
Definition: omc-learn.h:66
lives_omc_macro_t::macro_text
char * macro_text
macro text
Definition: omc-learn.h:51
omclearn_w::clear_button
LiVESWidget * clear_button
Definition: omc-learn.h:99
FILTER_COLUMN
@ FILTER_COLUMN
Definition: omc-learn.h:111
lives_omc_macro_t::nparams
int nparams
Definition: omc-learn.h:55
lives_omc_macro_t
Definition: omc-learn.h:49
omc_process_string
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...
omclearn_w::table
LiVESWidget * table
Definition: omc-learn.h:104
omclearn_w
Definition: omc-learn.h:97
lives_omc_match_node_t::offs0
int * offs0
offs to add to params before scale (pre-bias)
Definition: omc-learn.h:70
omc_learner_decode
OSCbuf * omc_learner_decode(int type, int index, const char *string)
decode learnt behaviours
osc.h
lives_omc_match_node_t::treev1
LiVESWidget * treev1
Definition: omc-learn.h:88
lives_omc_macro_t::info_text
char * info_text
descriptive text
Definition: omc-learn.h:52
omclearn_w::tbl_currow
int tbl_currow
Definition: omc-learn.h:103
lives_omc_match_node_t::min
int * min
min values of input params
Definition: omc-learn.h:74
OMC_NUM2_COLUMNS
@ OMC_NUM2_COLUMNS
Definition: omc-learn.h:123
lives_omc_match_node_t::macro
int macro
action number this is linked to (or -1) (see mainwindow.h)
Definition: omc-learn.h:67
lives_omc_match_node_t::fvali
int * fvali
defaults, mapping to fixed ints
Definition: omc-learn.h:83
omclearn_w::del_all_button
LiVESWidget * del_all_button
Definition: omc-learn.h:100
lives_omc_match_node_t::gtkstore
LiVESTreeStore * gtkstore
Definition: omc-learn.h:91
OFFS2_COLUMN
@ OFFS2_COLUMN
Definition: omc-learn.h:115
lives_omc_macro_t::stype_tags
char * stype_tags
setter type tags
Definition: omc-learn.h:53
lives_omc_match_node_t::nvars
int nvars
number of input params
Definition: omc-learn.h:69
has_devicemap
boolean has_devicemap(int has_this_macro)
lives_omc_macro_t::vali
int * vali
Definition: omc-learn.h:60
VALUE_COLUMN
@ VALUE_COLUMN
Definition: omc-learn.h:110
get_midi_filename
const char * get_midi_filename(void)
lives_omc_match_node_t::offs1
int * offs1
offs to add to params after scale (post bias)
Definition: omc-learn.h:72
midi_close
void midi_close(void)
lives_omc_match_node_t::tmpvals
int * tmpvals
Definition: omc-learn.h:94
SCALE_COLUMN
@ SCALE_COLUMN
Definition: omc-learn.h:114
lives_omc_match_node_t::map
int * map
mapping macro parameters to variables in the input (whether we use a default or a variable)
Definition: omc-learn.h:81
lives_omc_match_node_t::gtkstore2
LiVESTreeStore * gtkstore2
Definition: omc-learn.h:92
lives_omc_match_node_t::matchp
boolean * matchp
do we additionally need to match this param val in the input ?
Definition: omc-learn.h:77
create_devicemap_directory
void create_devicemap_directory(void)
get_omc_macro
const lives_omc_macro_t * get_omc_macro(int idx)
on_midi_learn_activate
void on_midi_learn_activate(LiVESMenuItem *, livespointer)
start learning MIDI inputs
lives_omc_macro_t::ptypes
int * ptypes
Definition: omc-learn.h:59
midi_mangle
char * midi_mangle(void)
RANGE_COLUMN
@ RANGE_COLUMN
Definition: omc-learn.h:112
lives_omc_macro_t::pname
char ** pname
Definition: omc-learn.h:57
TITLE2_COLUMN
@ TITLE2_COLUMN
Definition: omc-learn.h:120
midi_open
boolean midi_open(void)
lives_omc_match_node_t::scale
double * scale
scale for params (unbiased scale)
Definition: omc-learn.h:71
omclearn_w::tbl_rows
int tbl_rows
Definition: omc-learn.h:102
omclearn_w::dialog
LiVESWidget * dialog
Definition: omc-learn.h:98
on_devicemap_save_activate
void on_devicemap_save_activate(LiVESMenuItem *, livespointer)
lives_omc_match_node_t::fvald
double * fvald
defaults, mapping to fixed doubles
Definition: omc-learn.h:84
TITLE_COLUMN
@ TITLE_COLUMN
Definition: omc-learn.h:109
lives_omc_match_node_t
Definition: omc-learn.h:65
lives_omc_match_node_t::treev2
LiVESWidget * treev2
Definition: omc-learn.h:89
OMC_NUM_COLUMNS
@ OMC_NUM_COLUMNS
Definition: omc-learn.h:116
on_devicemap_load_activate
void on_devicemap_load_activate(LiVESMenuItem *, livespointer)
omclearn_w::top_vbox
LiVESWidget * top_vbox
Definition: omc-learn.h:105
OFFS1_COLUMN
@ OFFS1_COLUMN
Definition: omc-learn.h:113
lives_omc_macro_t::vald
double * vald
Definition: omc-learn.h:62
lives_omc_match_node_t::max
int * max
max values of input params
Definition: omc-learn.h:75