~ubuntu-branches/ubuntu/dapper/terminatorx/dapper

« back to all changes in this revision

Viewing changes to src/tX_seqpar.h

  • Committer: Bazaar Package Importer
  • Author(s): Mike Furr
  • Date: 2004-04-26 21:20:09 UTC
  • Revision ID: james.westby@ubuntu.com-20040426212009-acjw8flkt05j945f
Tags: upstream-3.81
Import upstream version 3.81

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    terminatorX - realtime audio scratching software
 
3
    Copyright (C) 1999, 2000 Alexander K�nig
 
4
 
 
5
    This program is free software; you can redistribute it and/or modify
 
6
    it under the terms of the GNU General Public License as published by
 
7
    the Free Software Foundation; either version 2 of the License, or
 
8
    (at your option) any later version.
 
9
 
 
10
    This program is distributed in the hope that it will be useful,
 
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
    GNU General Public License for more details.
 
14
 
 
15
    You should have received a copy of the GNU General Public License
 
16
    along with this program; if not, write to the Free Software
 
17
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
18
 
 
19
    File: tX_seqpar.h
 
20
 
 
21
    Description: Header to tX_seqpar.cc
 
22
*/    
 
23
 
 
24
#include <pthread.h>
 
25
#include <list>
 
26
#include <gtk/gtk.h>
 
27
#include "tX_extdial.h"
 
28
#include "tX_midiin.h"
 
29
#include "tX_global.h"
 
30
 
 
31
#ifndef _tx_seqpar_h
 
32
#define _tx_seqpar_h 1
 
33
 
 
34
#define NO_MOUSE_MAPPING 0
 
35
#define MOUSE_MAPPING_OK 1
 
36
 
 
37
#include <libxml/xmlmemory.h>
 
38
#include <libxml/parser.h>
 
39
 
 
40
/* required for gcc>=3.0 */
 
41
using namespace std;
 
42
 
 
43
class tX_seqpar
 
44
{       
 
45
        public:
 
46
        static list <tX_seqpar *> all;
 
47
        void *vtt; /* have to make this void as tX_vtt.h includes this */
 
48
 
 
49
        tX_midievent bound_midi_event;
 
50
 
 
51
        protected:
 
52
        static list <tX_seqpar *> update;
 
53
        static pthread_mutex_t update_lock;
 
54
                
 
55
        int touched;
 
56
        int gui_active;
 
57
        
 
58
        float fwd_value;
 
59
        
 
60
        guint32 persistence_id;
 
61
        guint32 touch_timestamp;                
 
62
        void *last_event_recorded;
 
63
        
 
64
        public:
 
65
        /* default constructor */
 
66
        tX_seqpar();
 
67
        /* to initialize with a vtt 
 
68
        tX_seqpar(void *); */
 
69
        /* to initialize with mapping settings */
 
70
        /* tX_seqpar(float max, float min, float scale, int mappable); */
 
71
        /* to initialize with mapping settings AND a vtt 
 
72
        tX_seqpar (void *mytt, float max, float min, float scale, int mappable); */
 
73
        
 
74
        virtual float get_value();
 
75
        void set_mapping_parameters(float max, float min, float scale, int mappable);
 
76
        virtual ~tX_seqpar();
 
77
        
 
78
        void set_vtt(void *);
 
79
        int is_touched() {return touched;}
 
80
        int is_untouched() {return !touched;}
 
81
        
 
82
        void do_touch(); /* can't be inline as requires tX_sequencer.h */
 
83
        void touch() { if (!touched) do_touch();}
 
84
        void untouch() { touched=0; last_event_recorded=NULL; }
 
85
        
 
86
        static void untouch_all();
 
87
        
 
88
        int is_gui_active() { return gui_active; }
 
89
        guint32 get_touch_timestamp() { return touch_timestamp; }
 
90
        
 
91
        static void create_persistence_ids();
 
92
        guint32 get_persistence_id() { return persistence_id; }
 
93
        void set_persistence_id(guint32 pid) { persistence_id=pid; }
 
94
        static tX_seqpar *get_sp_by_persistence_id(unsigned int pid);
 
95
 
 
96
        void record_value (const float value);
 
97
        virtual void do_exec(const float value)=NULL;
 
98
        virtual void exec_value(const float value)=NULL;        
 
99
        virtual void do_update_graphics()=NULL;
 
100
        void update_graphics();
 
101
        static void update_all_graphics();
 
102
        static void init_all_graphics();
 
103
        
 
104
        /* slot for gui actions */
 
105
        void receive_gui_value(const float value); 
 
106
        
 
107
        /* slot for fastforwarding (no effect for vtt) */
 
108
        virtual void receive_forward_value(const float value);
 
109
        
 
110
        /* slot for mouse and keyboard actions (updating graphics) */
 
111
        virtual void handle_mouse_input(float adjustment);
 
112
        void receive_input_value(const float value);
 
113
#ifdef USE_ALSA_MIDI_IN 
 
114
        virtual void handle_midi_input( const tX_midievent& );
 
115
#endif  
 
116
        
 
117
        /* Make it so ;) */
 
118
        static void materialize_forward_values();
 
119
 
 
120
        /* info functions for the editor */
 
121
        char *get_vtt_name();
 
122
        virtual const char *get_name(); 
 
123
        
 
124
        /* For Mouse and MIDI Mapping */
 
125
        protected:
 
126
        float max_value;
 
127
        float min_value;
 
128
        float scale_value;
 
129
 
 
130
        bool midi_upper_bound_set;
 
131
        double midi_upper_bound;
 
132
        
 
133
        bool midi_lower_bound_set;
 
134
        double midi_lower_bound;
 
135
        
 
136
        bool is_boolean;
 
137
        
 
138
        public:
 
139
        int is_mappable;        
 
140
        void restore_meta(xmlNodePtr node);
 
141
        void store_meta(FILE *rc, gzFile rz);
 
142
        
 
143
        void set_upper_midi_bound(double val) {
 
144
                midi_upper_bound=val;
 
145
                midi_upper_bound_set=true;              
 
146
        }
 
147
        
 
148
        void reset_upper_midi_bound() { midi_upper_bound_set=false; }
 
149
 
 
150
        void set_lower_midi_bound(double val) {
 
151
                midi_lower_bound=val;
 
152
                midi_lower_bound_set=true;              
 
153
        }
 
154
        
 
155
        void reset_lower_midi_bound() { midi_lower_bound_set=false; }
 
156
        
 
157
        static gboolean tX_seqpar_press(GtkWidget *widget, GdkEventButton *event, gpointer data);
 
158
        
 
159
#ifdef USE_ALSA_MIDI_IN 
 
160
        static gboolean remove_midi_binding(GtkWidget *widget, gpointer data);
 
161
        static gboolean learn_midi_binding(GtkWidget *widget, gpointer data);   
 
162
        
 
163
        static gboolean set_midi_upper_bound(GtkWidget *widget, gpointer data);
 
164
        static gboolean reset_midi_upper_bound(GtkWidget *widget, gpointer data);
 
165
        
 
166
        static gboolean set_midi_lower_bound(GtkWidget *widget, gpointer data);
 
167
        static gboolean reset_midi_lower_bound(GtkWidget *widget, gpointer data);       
 
168
#endif  
 
169
};
 
170
 
 
171
class tX_seqpar_update : public tX_seqpar
 
172
{
 
173
        public:
 
174
        virtual void exec_value(const float value);     
 
175
};
 
176
 
 
177
class tX_seqpar_no_update : public tX_seqpar
 
178
{
 
179
        virtual void do_update_graphics();
 
180
        virtual void exec_value(const float value);     
 
181
};
 
182
 
 
183
class tX_seqpar_update_active_forward : public tX_seqpar_update
 
184
{
 
185
        virtual void receive_forward_value(const float value);
 
186
};
 
187
 
 
188
class tX_seqpar_no_update_active_forward : public tX_seqpar_no_update
 
189
{
 
190
        virtual void receive_forward_value(const float value);
 
191
};
 
192
 
 
193
/* now the classes for *real* sequenceable parameters */
 
194
 
 
195
class tX_seqpar_master_volume : public tX_seqpar_update
 
196
{
 
197
        public:
 
198
        tX_seqpar_master_volume();
 
199
        virtual void do_exec(const float value);
 
200
        virtual void do_update_graphics();      
 
201
        private:
 
202
        virtual const char *get_name(); 
 
203
};
 
204
 
 
205
class tX_seqpar_master_pitch : public tX_seqpar_update_active_forward
 
206
{
 
207
        public:
 
208
        tX_seqpar_master_pitch();
 
209
        virtual void do_exec(const float value);
 
210
        virtual void do_update_graphics();      
 
211
        private:
 
212
    virtual const char *get_name(); 
 
213
};
 
214
 
 
215
class tX_seqpar_vtt_speed : public tX_seqpar_no_update_active_forward
 
216
{
 
217
        public:
 
218
        tX_seqpar_vtt_speed();
 
219
        virtual void handle_mouse_input(float adjustment);
 
220
        private:        
 
221
        virtual void do_exec(const float value);
 
222
        virtual const char *get_name(); 
 
223
};
 
224
 
 
225
class tX_seqpar_spin : public tX_seqpar_no_update_active_forward
 
226
{
 
227
        public:
 
228
        tX_seqpar_spin();
 
229
        private:        
 
230
        virtual void do_exec(const float value);
 
231
        virtual const char *get_name(); 
 
232
};
 
233
 
 
234
class tX_seqpar_vtt_volume : public tX_seqpar_update
 
235
{
 
236
        public:
 
237
        tX_seqpar_vtt_volume();
 
238
        virtual float get_value();
 
239
        private:        
 
240
        virtual void do_exec(const float value);
 
241
        virtual void do_update_graphics();      
 
242
        virtual const char *get_name(); 
 
243
};
 
244
 
 
245
class tX_seqpar_vtt_pan : public tX_seqpar_update
 
246
{
 
247
        public:
 
248
        tX_seqpar_vtt_pan();
 
249
        virtual float get_value();
 
250
        private:        
 
251
        virtual void do_exec(const float value);
 
252
        virtual void do_update_graphics();      
 
253
        virtual const char *get_name(); 
 
254
};
 
255
 
 
256
class tX_seqpar_vtt_pitch : public tX_seqpar_update_active_forward
 
257
{
 
258
        public:
 
259
        tX_seqpar_vtt_pitch();
 
260
        virtual float get_value();
 
261
        virtual void do_exec(const float value);
 
262
        private:        
 
263
        virtual void do_update_graphics();      
 
264
        virtual const char *get_name(); 
 
265
};
 
266
 
 
267
class tX_seqpar_vtt_trigger : public tX_seqpar_no_update_active_forward
 
268
{
 
269
        public:
 
270
        tX_seqpar_vtt_trigger();
 
271
        private:        
 
272
        virtual void do_exec(const float value);
 
273
        virtual const char *get_name(); 
 
274
};
 
275
 
 
276
class tX_seqpar_vtt_loop : public tX_seqpar_update
 
277
{
 
278
        public:
 
279
        tX_seqpar_vtt_loop();
 
280
        private:        
 
281
        virtual void do_exec(const float value);
 
282
        virtual void do_update_graphics();      
 
283
        virtual const char *get_name(); 
 
284
};
 
285
 
 
286
class tX_seqpar_vtt_sync_client : public tX_seqpar_update
 
287
{
 
288
        public:
 
289
        tX_seqpar_vtt_sync_client();
 
290
        private:        
 
291
        virtual void do_exec(const float value);
 
292
        virtual void do_update_graphics();      
 
293
        virtual const char *get_name(); 
 
294
};
 
295
 
 
296
class tX_seqpar_vtt_sync_cycles : public tX_seqpar_update
 
297
{
 
298
        public:
 
299
        tX_seqpar_vtt_sync_cycles();
 
300
        private:        
 
301
        virtual void do_exec(const float value);
 
302
        virtual void do_update_graphics();      
 
303
        virtual const char *get_name(); 
 
304
};
 
305
 
 
306
class tX_seqpar_vtt_lp_enable : public tX_seqpar_update
 
307
{
 
308
        public:
 
309
        tX_seqpar_vtt_lp_enable();
 
310
        private:        
 
311
        virtual void do_exec(const float value);
 
312
        virtual void do_update_graphics();      
 
313
        virtual const char *get_name(); 
 
314
};
 
315
 
 
316
class tX_seqpar_vtt_lp_gain : public tX_seqpar_update
 
317
{
 
318
        public:
 
319
        tX_seqpar_vtt_lp_gain();
 
320
        virtual float get_value();
 
321
        private:        
 
322
        virtual void do_exec(const float value);
 
323
        virtual void do_update_graphics();      
 
324
        virtual const char *get_name(); 
 
325
};
 
326
 
 
327
class tX_seqpar_vtt_lp_reso : public tX_seqpar_update
 
328
{
 
329
        public:
 
330
        tX_seqpar_vtt_lp_reso();
 
331
        virtual float get_value();
 
332
        private:        
 
333
        virtual void do_exec(const float value);
 
334
        virtual void do_update_graphics();      
 
335
        virtual const char *get_name(); 
 
336
};
 
337
 
 
338
class tX_seqpar_vtt_lp_freq : public tX_seqpar_update
 
339
{
 
340
        public:
 
341
        virtual float get_value();
 
342
        tX_seqpar_vtt_lp_freq();
 
343
        private:        
 
344
        virtual void do_exec(const float value);
 
345
        virtual void do_update_graphics();      
 
346
        virtual const char *get_name(); 
 
347
};
 
348
 
 
349
class tX_seqpar_vtt_ec_enable : public tX_seqpar_update
 
350
{
 
351
        public:
 
352
        tX_seqpar_vtt_ec_enable();
 
353
        private:        
 
354
        virtual void do_exec(const float value);
 
355
        virtual void do_update_graphics();      
 
356
        virtual const char *get_name(); 
 
357
};
 
358
 
 
359
class tX_seqpar_vtt_ec_length : public tX_seqpar_update
 
360
{
 
361
        public:
 
362
        tX_seqpar_vtt_ec_length();
 
363
        virtual float get_value();
 
364
        private:        
 
365
        virtual void do_exec(const float value);
 
366
        virtual void do_update_graphics();      
 
367
        virtual const char *get_name(); 
 
368
};
 
369
 
 
370
class tX_seqpar_vtt_ec_feedback : public tX_seqpar_update
 
371
{
 
372
        public:
 
373
        tX_seqpar_vtt_ec_feedback();
 
374
        virtual float get_value();
 
375
        private:        
 
376
        virtual void do_exec(const float value);
 
377
        virtual void do_update_graphics();      
 
378
        virtual const char *get_name(); 
 
379
};
 
380
 
 
381
class tX_seqpar_vtt_ec_pan : public tX_seqpar_update
 
382
{
 
383
        public:
 
384
        tX_seqpar_vtt_ec_pan();
 
385
        virtual float get_value();
 
386
        private:        
 
387
        virtual void do_exec(const float value);
 
388
        virtual void do_update_graphics();      
 
389
        virtual const char *get_name(); 
 
390
};
 
391
 
 
392
class tX_seqpar_vtt_ec_volume : public tX_seqpar_update
 
393
{
 
394
        public:
 
395
        tX_seqpar_vtt_ec_volume();
 
396
        virtual float get_value();
 
397
        private:        
 
398
        virtual void do_exec(const float value);
 
399
        virtual void do_update_graphics();      
 
400
        virtual const char *get_name(); 
 
401
};
 
402
 
 
403
class tX_seqpar_vtt_mute : public tX_seqpar_no_update
 
404
{
 
405
        public:
 
406
        tX_seqpar_vtt_mute();
 
407
        private:        
 
408
        virtual void do_exec(const float value);
 
409
        virtual const char *get_name(); 
 
410
};
 
411
 
 
412
/* Seqpars for the LADSPA Plugins */
 
413
 
 
414
class tX_seqpar_vttfx : public tX_seqpar_update
 
415
{
 
416
        /* fx_value will be malloc()ed by constructor */        
 
417
        protected:
 
418
        GtkWidget *widget;
 
419
        char label_name[2048];
 
420
        char name[2048];
 
421
        float *fx_value;
 
422
        
 
423
        public:
 
424
        tX_seqpar_vttfx();
 
425
        virtual ~tX_seqpar_vttfx();
 
426
        void set_name(const char *, const char *);
 
427
        GtkWidget *get_widget() { return widget; } 
 
428
        
 
429
        virtual float get_value();
 
430
        float *get_value_ptr() { return fx_value; }
 
431
        
 
432
        private:
 
433
        virtual void create_widget();
 
434
        
 
435
        public:
 
436
        virtual const char *get_name();         
 
437
};
 
438
 
 
439
class tX_seqpar_vttfx_float : public tX_seqpar_vttfx
 
440
{
 
441
        private:
 
442
        tX_extdial *mydial;
 
443
        GtkAdjustment *myadj;
 
444
        
 
445
        virtual void create_widget();
 
446
        virtual void do_exec(const float value);
 
447
        virtual void do_update_graphics();              
 
448
        public:
 
449
        virtual ~tX_seqpar_vttfx_float();
 
450
        
 
451
        static GtkSignalFunc gtk_callback(GtkWidget*, tX_seqpar_vttfx_float *);
 
452
};
 
453
 
 
454
class tX_seqpar_vttfx_bool : public tX_seqpar_vttfx
 
455
{
 
456
        private:
 
457
        virtual void create_widget();
 
458
        virtual void do_exec(const float value);
 
459
        virtual void do_update_graphics();      
 
460
 
 
461
        static GtkSignalFunc gtk_callback(GtkWidget*, tX_seqpar_vttfx_bool *);
 
462
 
 
463
        public:
 
464
        virtual ~tX_seqpar_vttfx_bool();
 
465
};
 
466
 
 
467
class tX_seqpar_vttfx_int : public tX_seqpar_vttfx
 
468
{
 
469
        private:
 
470
        GtkAdjustment *myadj;
 
471
 
 
472
        private:
 
473
        virtual void create_widget();
 
474
        virtual void do_exec(const float value);
 
475
        virtual void do_update_graphics();      
 
476
 
 
477
        public:
 
478
        virtual ~tX_seqpar_vttfx_int();
 
479
 
 
480
        static GtkSignalFunc gtk_callback(GtkWidget*, tX_seqpar_vttfx_int *);
 
481
};
 
482
 
 
483
#endif