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

« back to all changes in this revision

Viewing changes to src/tX_legacy_vtt.cc

  • 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-2003  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_legacy_vtt.cc
 
20
*/    
 
21
 
 
22
#include <config.h>
 
23
 
 
24
#ifdef ENABLE_TX_LEGACY
 
25
 
 
26
#include <stdio.h>
 
27
#include "tX_vtt.h"
 
28
#include "tX_global.h"
 
29
#include "tX_loaddlg.h"
 
30
#include "tX_mastergui.h"
 
31
#include "tX_sequencer.h"
 
32
#include <string.h>
 
33
 
 
34
#define atload(data); if (fread((void *) &data, sizeof(data), 1, input)!=1) res+=1;
 
35
 
 
36
int vtt_class :: load_10(FILE * input)
 
37
{
 
38
        int res=0;
 
39
        int obsolete_int;
 
40
        
 
41
        atload(name);
 
42
        atload(filename);
 
43
        atload(is_sync_master);
 
44
        atload(is_sync_client);
 
45
        atload(sync_cycles);
 
46
        atload(rel_volume);
 
47
        recalc_volume();
 
48
        atload(rel_pitch);
 
49
        recalc_pitch();
 
50
        
 
51
        atload(autotrigger);
 
52
        atload(loop);
 
53
        
 
54
        atload(mute);
 
55
        atload(obsolete_int); //x_control
 
56
        atload(obsolete_int); //y_control
 
57
        
 
58
        atload(lp_enable);
 
59
        atload(lp_gain);
 
60
        atload(lp_reso);
 
61
        atload(lp_freq);
 
62
        lp_setup(lp_gain, lp_reso, lp_freq);
 
63
        
 
64
        atload(ec_enable);
 
65
        atload(ec_length);
 
66
        ec_set_length(ec_length);
 
67
        atload(ec_feedback);
 
68
        ec_set_feedback(ec_feedback);
 
69
        
 
70
        return(res);
 
71
}
 
72
 
 
73
 
 
74
int vtt_class :: load_11(FILE * input)
 
75
{
 
76
        int res=0;
 
77
        guint32 pid;
 
78
        int32_t gui_page;
 
79
        int obsolete_int;
 
80
        
 
81
        atload(name);
 
82
        atload(filename);
 
83
        atload(is_sync_master);
 
84
        atload(is_sync_client);
 
85
        atload(sync_cycles);
 
86
        atload(rel_volume);
 
87
        recalc_volume();
 
88
        atload(rel_pitch);
 
89
        recalc_pitch();
 
90
        
 
91
        atload(autotrigger);
 
92
        atload(loop);
 
93
        
 
94
        atload(mute);
 
95
        atload(obsolete_int); //x_control
 
96
        atload(obsolete_int); //y_control
 
97
        
 
98
        atload(lp_enable);
 
99
        atload(lp_gain);
 
100
        atload(lp_reso);
 
101
        atload(lp_freq);
 
102
        lp_setup(lp_gain, lp_reso, lp_freq);
 
103
        
 
104
        atload(ec_enable);
 
105
        atload(ec_length);
 
106
        ec_set_length(ec_length);
 
107
        atload(ec_feedback);
 
108
        ec_set_feedback(ec_feedback);
 
109
 
 
110
        atload(pid);
 
111
        sp_speed.set_persistence_id(pid);
 
112
        atload(pid);
 
113
        sp_volume.set_persistence_id(pid);
 
114
        atload(pid);
 
115
        sp_pitch.set_persistence_id(pid);
 
116
        atload(pid);
 
117
        sp_trigger.set_persistence_id(pid);
 
118
        atload(pid);
 
119
        sp_loop.set_persistence_id(pid);
 
120
        atload(pid);
 
121
        sp_sync_client.set_persistence_id(pid);
 
122
        atload(pid);
 
123
        sp_sync_cycles.set_persistence_id(pid);
 
124
        atload(pid);
 
125
        sp_lp_enable.set_persistence_id(pid);
 
126
        atload(pid);
 
127
        sp_lp_gain.set_persistence_id(pid);
 
128
        atload(pid);
 
129
        sp_lp_reso.set_persistence_id(pid);
 
130
        atload(pid);
 
131
        sp_lp_freq.set_persistence_id(pid);
 
132
        atload(pid);
 
133
        sp_ec_enable.set_persistence_id(pid);
 
134
        atload(pid);
 
135
        sp_ec_length.set_persistence_id(pid);
 
136
        atload(pid);
 
137
        sp_ec_feedback.set_persistence_id(pid);
 
138
        atload(pid);
 
139
        sp_mute.set_persistence_id(pid);
 
140
        atload(pid);
 
141
        sp_spin.set_persistence_id(pid);
 
142
        
 
143
        atload(gui_page);
 
144
        
 
145
        return(res);
 
146
}
 
147
 
 
148
int vtt_class :: load_12(FILE * input)
 
149
{
 
150
        int res=0;
 
151
        guint32 pid;
 
152
        int32_t counter;
 
153
        int32_t type;
 
154
        long id;
 
155
        int i;
 
156
        unsigned int t;
 
157
        LADSPA_Plugin *plugin;
 
158
        char buffer[256];
 
159
        vtt_fx_ladspa *ladspa_effect;
 
160
        guint8 hidden;
 
161
        
 
162
        atload(buffer);
 
163
        this->set_name(buffer);
 
164
        atload(filename);
 
165
        atload(is_sync_master);
 
166
        atload(is_sync_client);
 
167
        atload(sync_cycles);
 
168
        atload(rel_volume);
 
169
        recalc_volume();
 
170
        atload(rel_pitch);
 
171
        recalc_pitch();
 
172
        
 
173
        atload(autotrigger);
 
174
        atload(loop);
 
175
        
 
176
        atload(mute);
 
177
        
 
178
        atload(lp_enable);
 
179
        atload(lp_gain);
 
180
        atload(lp_reso);
 
181
        atload(lp_freq);
 
182
        lp_setup(lp_gain, lp_reso, lp_freq);
 
183
        
 
184
        atload(ec_enable);
 
185
        atload(ec_length);
 
186
        ec_set_length(ec_length);
 
187
        atload(ec_feedback);
 
188
        ec_set_feedback(ec_feedback);
 
189
 
 
190
        atload(pid);
 
191
        sp_speed.set_persistence_id(pid);
 
192
        atload(pid);
 
193
        sp_volume.set_persistence_id(pid);
 
194
        atload(pid);
 
195
        sp_pitch.set_persistence_id(pid);
 
196
        atload(pid);
 
197
        sp_trigger.set_persistence_id(pid);
 
198
        atload(pid);
 
199
        sp_loop.set_persistence_id(pid);
 
200
        atload(pid);
 
201
        sp_sync_client.set_persistence_id(pid);
 
202
        atload(pid);
 
203
        sp_sync_cycles.set_persistence_id(pid);
 
204
        atload(pid);
 
205
        sp_lp_enable.set_persistence_id(pid);
 
206
        atload(pid);
 
207
        sp_lp_gain.set_persistence_id(pid);
 
208
        atload(pid);
 
209
        sp_lp_reso.set_persistence_id(pid);
 
210
        atload(pid);
 
211
        sp_lp_freq.set_persistence_id(pid);
 
212
        atload(pid);
 
213
        sp_ec_enable.set_persistence_id(pid);
 
214
        atload(pid);
 
215
        sp_ec_length.set_persistence_id(pid);
 
216
        atload(pid);
 
217
        sp_ec_feedback.set_persistence_id(pid);
 
218
        atload(pid);
 
219
        sp_mute.set_persistence_id(pid);
 
220
        atload(pid);
 
221
        sp_spin.set_persistence_id(pid);
 
222
                
 
223
        atload(counter);
 
224
        
 
225
        for (i=0; i<counter; i++)
 
226
        {
 
227
                atload(type);
 
228
                switch(type)
 
229
                {
 
230
                        case TX_FX_BUILTINCUTOFF:
 
231
                                for (t=0; t<fx_list.size(); t++) effect_down(lp_fx);
 
232
                        break;
 
233
                        
 
234
                        case TX_FX_BUILTINECHO:
 
235
                                for (t=0; t<fx_list.size(); t++) effect_down(ec_fx);
 
236
                        break;
 
237
                        
 
238
                        case TX_FX_LADSPA:
 
239
                                atload(id);
 
240
                                plugin=LADSPA_Plugin::getPluginByUniqueID(id);
 
241
                                if (plugin)
 
242
                                {
 
243
                                        ladspa_effect=add_effect(plugin);
 
244
                                        ladspa_effect->load(input);
 
245
                                }
 
246
                                else
 
247
                                {
 
248
                                        sprintf(buffer,"Couldn't find required plugin with ID [%li].", id);
 
249
                                        tx_note(buffer, true);
 
250
                                        res++;
 
251
                                }
 
252
                        break;
 
253
                        
 
254
                        default:
 
255
                                tx_note("Fatal error loading set: unknown effect type!", true);
 
256
                                res++;
 
257
                }               
 
258
        }
 
259
 
 
260
        atload(pid);
 
261
        
 
262
        if (pid)
 
263
        {
 
264
                atload(pid);
 
265
                set_x_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
 
266
        }
 
267
        else set_x_input_parameter(NULL);
 
268
        
 
269
        atload(pid);
 
270
        
 
271
        if (pid)
 
272
        {
 
273
                atload(pid);
 
274
                set_y_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
 
275
        }
 
276
        else set_y_input_parameter(NULL);
 
277
 
 
278
        atload(hidden);
 
279
        gui.main_panel->hide(hidden);
 
280
 
 
281
        atload(hidden);
 
282
        gui.trigger_panel->hide(hidden);
 
283
 
 
284
        atload(hidden);
 
285
        gui.lp_panel->hide(hidden);
 
286
 
 
287
        atload(hidden);
 
288
        gui.ec_panel->hide(hidden);
 
289
        
 
290
        return(res);
 
291
}
 
292
 
 
293
int vtt_class :: load_13(FILE * input)
 
294
{
 
295
        int res=0;
 
296
        guint32 pid;
 
297
        int32_t counter;
 
298
        int32_t type;
 
299
        long id;
 
300
        int i;
 
301
        unsigned int t;
 
302
        LADSPA_Plugin *plugin;
 
303
        char buffer[256];
 
304
        vtt_fx_ladspa *ladspa_effect;
 
305
        guint8 hidden;
 
306
        
 
307
        atload(buffer);
 
308
        this->set_name(buffer);
 
309
        atload(filename);
 
310
        atload(is_sync_master);
 
311
        atload(is_sync_client);
 
312
        atload(sync_cycles);
 
313
        atload(rel_volume);
 
314
        atload(rel_pitch);
 
315
        recalc_pitch();
 
316
        
 
317
        atload(autotrigger);
 
318
        atload(loop);
 
319
        
 
320
        atload(mute);
 
321
        atload(pan);
 
322
        
 
323
        atload(lp_enable);
 
324
        atload(lp_gain);
 
325
        atload(lp_reso);
 
326
        atload(lp_freq);
 
327
        lp_setup(lp_gain, lp_reso, lp_freq);
 
328
        
 
329
        atload(ec_enable);
 
330
        atload(ec_length);
 
331
        ec_set_length(ec_length);
 
332
        atload(ec_feedback);
 
333
        ec_set_feedback(ec_feedback);
 
334
        atload(ec_pan);
 
335
        ec_set_pan(ec_pan);
 
336
        atload(ec_volume);
 
337
        ec_set_volume(ec_volume);
 
338
 
 
339
        recalc_volume();
 
340
 
 
341
        atload(pid);
 
342
        sp_speed.set_persistence_id(pid);
 
343
        atload(pid);
 
344
        sp_volume.set_persistence_id(pid);
 
345
        atload(pid);
 
346
        sp_pitch.set_persistence_id(pid);
 
347
        atload(pid);
 
348
        sp_trigger.set_persistence_id(pid);
 
349
        atload(pid);
 
350
        sp_loop.set_persistence_id(pid);
 
351
        atload(pid);
 
352
        sp_sync_client.set_persistence_id(pid);
 
353
        atload(pid);
 
354
        sp_sync_cycles.set_persistence_id(pid);
 
355
        atload(pid);
 
356
        sp_lp_enable.set_persistence_id(pid);
 
357
        atload(pid);
 
358
        sp_lp_gain.set_persistence_id(pid);
 
359
        atload(pid);
 
360
        sp_lp_reso.set_persistence_id(pid);
 
361
        atload(pid);
 
362
        sp_lp_freq.set_persistence_id(pid);
 
363
        atload(pid);
 
364
        sp_ec_enable.set_persistence_id(pid);
 
365
        atload(pid);
 
366
        sp_ec_length.set_persistence_id(pid);
 
367
        atload(pid);
 
368
        sp_ec_feedback.set_persistence_id(pid);
 
369
        atload(pid);
 
370
        sp_ec_volume.set_persistence_id(pid);
 
371
        atload(pid);
 
372
        sp_ec_pan.set_persistence_id(pid);
 
373
        atload(pid);
 
374
        sp_mute.set_persistence_id(pid);
 
375
        atload(pid);
 
376
        sp_spin.set_persistence_id(pid);
 
377
        atload(pid);
 
378
        sp_pan.set_persistence_id(pid);
 
379
                
 
380
        atload(counter);
 
381
        
 
382
        for (i=0; i<counter; i++)
 
383
        {
 
384
                atload(type);
 
385
                switch(type)
 
386
                {
 
387
                        case TX_FX_BUILTINCUTOFF:
 
388
                                for (t=0; t<fx_list.size(); t++) effect_down(lp_fx);
 
389
                        break;
 
390
                        
 
391
                        case TX_FX_BUILTINECHO:
 
392
                                for (t=0; t<fx_list.size(); t++) effect_down(ec_fx);
 
393
                        break;
 
394
                        
 
395
                        case TX_FX_LADSPA:
 
396
                                atload(id);
 
397
                                plugin=LADSPA_Plugin::getPluginByUniqueID(id);
 
398
                                if (plugin)
 
399
                                {
 
400
                                        ladspa_effect=add_effect(plugin);
 
401
                                        ladspa_effect->load(input);
 
402
                                }
 
403
                                else
 
404
                                {
 
405
                                        sprintf(buffer,"Couldn't find required plugin with ID [%li].", id);
 
406
                                        tx_note(buffer, true);
 
407
                                        res++;
 
408
                                }
 
409
                        break;
 
410
                        
 
411
                        default:
 
412
                                tx_note("Fatal error loading set: unknown effect type!", true);
 
413
                                res++;
 
414
                }               
 
415
        }
 
416
 
 
417
        atload(pid);
 
418
        
 
419
        if (pid)
 
420
        {
 
421
                atload(pid);
 
422
                set_x_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
 
423
        }
 
424
        else set_x_input_parameter(NULL);
 
425
        
 
426
        atload(pid);
 
427
        
 
428
        if (pid)
 
429
        {
 
430
                atload(pid);
 
431
                set_y_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
 
432
        }
 
433
        else set_y_input_parameter(NULL);
 
434
 
 
435
        atload(hidden);
 
436
        gui.main_panel->hide(hidden);
 
437
 
 
438
        atload(hidden);
 
439
        gui.trigger_panel->hide(hidden);
 
440
 
 
441
        atload(hidden);
 
442
        gui.lp_panel->hide(hidden);
 
443
 
 
444
        atload(hidden);
 
445
        gui.ec_panel->hide(hidden);
 
446
        
 
447
        return(res);
 
448
}
 
449
 
 
450
int vtt_class :: load_14(FILE * input)
 
451
{
 
452
        int res=0;
 
453
        guint32 pid;
 
454
        int32_t counter;
 
455
        int32_t type;
 
456
        long id;
 
457
        int i;
 
458
        unsigned int t;
 
459
        LADSPA_Plugin *plugin;
 
460
        char buffer[256];
 
461
        vtt_fx_ladspa *ladspa_effect;
 
462
        guint8 hidden;
 
463
        
 
464
        atload(buffer);
 
465
        this->set_name(buffer);
 
466
        atload(filename);
 
467
        atload(is_sync_master);
 
468
        atload(is_sync_client);
 
469
        atload(sync_cycles);
 
470
        atload(rel_volume);
 
471
        atload(rel_pitch);
 
472
        recalc_pitch();
 
473
        
 
474
        atload(autotrigger);
 
475
        atload(loop);
 
476
        
 
477
        atload(mute);
 
478
        atload(pan);
 
479
        
 
480
        atload(lp_enable);
 
481
        atload(lp_gain);
 
482
        atload(lp_reso);
 
483
        atload(lp_freq);
 
484
        lp_setup(lp_gain, lp_reso, lp_freq);
 
485
        
 
486
        atload(ec_enable);
 
487
        atload(ec_length);
 
488
        ec_set_length(ec_length);
 
489
        atload(ec_feedback);
 
490
        ec_set_feedback(ec_feedback);
 
491
        atload(ec_pan);
 
492
        ec_set_pan(ec_pan);
 
493
        atload(ec_volume);
 
494
        ec_set_volume(ec_volume);
 
495
 
 
496
        atload(audio_hidden);
 
497
        atload(control_hidden);
 
498
        
 
499
        recalc_volume();
 
500
 
 
501
        atload(pid);
 
502
        sp_speed.set_persistence_id(pid);
 
503
        atload(pid);
 
504
        sp_volume.set_persistence_id(pid);
 
505
        atload(pid);
 
506
        sp_pitch.set_persistence_id(pid);
 
507
        atload(pid);
 
508
        sp_trigger.set_persistence_id(pid);
 
509
        atload(pid);
 
510
        sp_loop.set_persistence_id(pid);
 
511
        atload(pid);
 
512
        sp_sync_client.set_persistence_id(pid);
 
513
        atload(pid);
 
514
        sp_sync_cycles.set_persistence_id(pid);
 
515
        atload(pid);
 
516
        sp_lp_enable.set_persistence_id(pid);
 
517
        atload(pid);
 
518
        sp_lp_gain.set_persistence_id(pid);
 
519
        atload(pid);
 
520
        sp_lp_reso.set_persistence_id(pid);
 
521
        atload(pid);
 
522
        sp_lp_freq.set_persistence_id(pid);
 
523
        atload(pid);
 
524
        sp_ec_enable.set_persistence_id(pid);
 
525
        atload(pid);
 
526
        sp_ec_length.set_persistence_id(pid);
 
527
        atload(pid);
 
528
        sp_ec_feedback.set_persistence_id(pid);
 
529
        atload(pid);
 
530
        sp_ec_volume.set_persistence_id(pid);
 
531
        atload(pid);
 
532
        sp_ec_pan.set_persistence_id(pid);
 
533
        atload(pid);
 
534
        sp_mute.set_persistence_id(pid);
 
535
        atload(pid);
 
536
        sp_spin.set_persistence_id(pid);
 
537
        atload(pid);
 
538
        sp_pan.set_persistence_id(pid);
 
539
                
 
540
        atload(counter);
 
541
        
 
542
        for (i=0; i<counter; i++)
 
543
        {
 
544
                atload(type);
 
545
                switch(type)
 
546
                {
 
547
                        case TX_FX_BUILTINCUTOFF:
 
548
                                for (t=0; t<fx_list.size(); t++) effect_down(lp_fx);
 
549
                        break;
 
550
                        
 
551
                        case TX_FX_BUILTINECHO:
 
552
                                for (t=0; t<fx_list.size(); t++) effect_down(ec_fx);
 
553
                        break;
 
554
                        
 
555
                        case TX_FX_LADSPA:
 
556
                                atload(id);
 
557
                                plugin=LADSPA_Plugin::getPluginByUniqueID(id);
 
558
                                if (plugin)
 
559
                                {
 
560
                                        ladspa_effect=add_effect(plugin);
 
561
                                        ladspa_effect->load(input);
 
562
                                }
 
563
                                else
 
564
                                {
 
565
                                        sprintf(buffer,"Couldn't find required plugin with ID [%li].", id);
 
566
                                        tx_note(buffer, true);
 
567
                                        res++;
 
568
                                }
 
569
                        break;
 
570
                        
 
571
                        default:
 
572
                                tx_note("Fatal error loading set: unknown effect type!", true);
 
573
                                res++;
 
574
                }               
 
575
        }
 
576
 
 
577
        atload(pid);
 
578
        
 
579
        if (pid)
 
580
        {
 
581
                atload(pid);
 
582
                set_x_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
 
583
        }
 
584
        else set_x_input_parameter(NULL);
 
585
        
 
586
        atload(pid);
 
587
        
 
588
        if (pid)
 
589
        {
 
590
                atload(pid);
 
591
                set_y_input_parameter(tX_seqpar :: get_sp_by_persistence_id(pid));
 
592
        }
 
593
        else set_y_input_parameter(NULL);
 
594
 
 
595
        atload(hidden);
 
596
        gui.main_panel->hide(hidden);
 
597
 
 
598
        atload(hidden);
 
599
        gui.trigger_panel->hide(hidden);
 
600
 
 
601
        atload(hidden);
 
602
        gui.lp_panel->hide(hidden);
 
603
 
 
604
        atload(hidden);
 
605
        gui.ec_panel->hide(hidden);
 
606
        
 
607
        return(res);
 
608
}
 
609
 
 
610
int  vtt_class :: load_all_10(FILE* input, char *fname)
 
611
{
 
612
        int res=0, restmp=0;
 
613
        unsigned int i, max;
 
614
        vtt_class *newvtt;
 
615
        char ftmp[PATH_MAX];
 
616
        
 
617
        while (main_list.size())
 
618
        {
 
619
                delete((*main_list.begin()));
 
620
        }
 
621
                
 
622
        atload(max);
 
623
        atload(master_volume);
 
624
        set_master_volume(master_volume);
 
625
        globals.volume=master_volume;
 
626
        atload(globals.pitch);  
 
627
        set_master_pitch(globals.pitch);
 
628
 
 
629
        ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
 
630
        ld_set_setname(fname);
 
631
 
 
632
        for (i=0; i<max; i++)
 
633
        {
 
634
                newvtt=new vtt_class(1);
 
635
                res+=newvtt->load_10(input);
 
636
                
 
637
                if (strlen(newvtt->filename))
 
638
                {
 
639
                        /* ftmp IS NECESSARY !!! */
 
640
                        strcpy(ftmp, newvtt->filename);
 
641
                        ld_set_filename(ftmp);
 
642
                        
 
643
                        //restmp=load_wav(newvtt->filename, &newbuffer, &size);
 
644
                        restmp=(int) newvtt->load_file(ftmp);
 
645
                        res+=restmp;
 
646
                }
 
647
                gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
 
648
                gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
 
649
        }
 
650
        
 
651
        sequencer.delete_all_events(tX_sequencer::DELETE_ALL);
 
652
        
 
653
        ld_destroy();
 
654
        
 
655
        return(res);
 
656
}
 
657
 
 
658
 
 
659
int  vtt_class :: load_all_11(FILE* input, char *fname)
 
660
{
 
661
        int res=0, restmp=0;
 
662
        unsigned int i, max;
 
663
        vtt_class *newvtt;
 
664
        char ftmp[PATH_MAX];
 
665
        guint32 pid;
 
666
        
 
667
        while (main_list.size())
 
668
        {
 
669
                delete((*main_list.begin()));
 
670
        }
 
671
                
 
672
        atload(max);
 
673
        atload(master_volume);
 
674
        set_master_volume(master_volume);
 
675
        globals.volume=master_volume;
 
676
        atload(globals.pitch);  
 
677
        set_master_pitch(globals.pitch);
 
678
        atload(pid);
 
679
        sp_master_volume.set_persistence_id(pid);
 
680
        atload(pid);
 
681
        sp_master_pitch.set_persistence_id(pid);
 
682
 
 
683
        ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
 
684
        ld_set_setname(fname);
 
685
 
 
686
        for (i=0; i<max; i++)
 
687
        {
 
688
                newvtt=new vtt_class(1);
 
689
                res+=newvtt->load_11(input);
 
690
                
 
691
                if (strlen(newvtt->filename))
 
692
                {
 
693
                        /* ftmp IS NECESSARY !!! */
 
694
                        strcpy(ftmp, newvtt->filename);
 
695
                        ld_set_filename(ftmp);
 
696
                        
 
697
                        //restmp=load_wav(newvtt->filename, &newbuffer, &size);
 
698
                        restmp=(int) newvtt->load_file(ftmp);
 
699
                        res+=restmp;
 
700
                }
 
701
                gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
 
702
                gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
 
703
                
 
704
        }
 
705
        
 
706
        sequencer.load(input);
 
707
        
 
708
        ld_destroy();
 
709
        
 
710
        return(res);
 
711
}
 
712
 
 
713
 
 
714
int  vtt_class :: load_all_12(FILE* input, char *fname)
 
715
{
 
716
        int res=0, restmp=0;
 
717
        unsigned int i, max;
 
718
        vtt_class *newvtt;
 
719
        char ftmp[PATH_MAX];
 
720
        guint32 pid;
 
721
        
 
722
        while (main_list.size())
 
723
        {
 
724
                delete((*main_list.begin()));
 
725
        }
 
726
                
 
727
        atload(max);
 
728
        atload(master_volume);
 
729
        set_master_volume(master_volume);
 
730
        globals.volume=master_volume;
 
731
        atload(globals.pitch);  
 
732
        set_master_pitch(globals.pitch);
 
733
        atload(pid);
 
734
        sp_master_volume.set_persistence_id(pid);
 
735
        atload(pid);
 
736
        sp_master_pitch.set_persistence_id(pid);
 
737
 
 
738
        ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
 
739
        ld_set_setname(fname);
 
740
 
 
741
        for (i=0; i<max; i++)
 
742
        {
 
743
                newvtt=new vtt_class(1);
 
744
                res+=newvtt->load_12(input);
 
745
                
 
746
                if (strlen(newvtt->filename))
 
747
                {
 
748
                        /* ftmp IS NECESSARY !!! */
 
749
                        strcpy(ftmp, newvtt->filename);
 
750
                        ld_set_filename(ftmp);
 
751
                        
 
752
                        //restmp=load_wav(newvtt->filename, &newbuffer, &size);
 
753
                        restmp=(int) newvtt->load_file(ftmp);
 
754
                        res+=restmp;
 
755
                }
 
756
                gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
 
757
                gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
 
758
                
 
759
        }
 
760
        
 
761
        sequencer.load(input);
 
762
        
 
763
        ld_destroy();
 
764
        
 
765
        return(res);
 
766
}
 
767
 
 
768
int  vtt_class :: load_all_13(FILE* input, char *fname)
 
769
{
 
770
        int res=0, restmp=0;
 
771
        unsigned int i, max;
 
772
        vtt_class *newvtt;
 
773
        char ftmp[PATH_MAX];
 
774
        guint32 pid;
 
775
        
 
776
        while (main_list.size())
 
777
        {
 
778
                delete((*main_list.begin()));
 
779
        }
 
780
                
 
781
        atload(max);
 
782
        atload(master_volume);
 
783
        set_master_volume(master_volume);
 
784
        globals.volume=master_volume;
 
785
        atload(globals.pitch);  
 
786
        set_master_pitch(globals.pitch);
 
787
        atload(pid);
 
788
        sp_master_volume.set_persistence_id(pid);
 
789
        atload(pid);
 
790
        sp_master_pitch.set_persistence_id(pid);
 
791
 
 
792
        ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
 
793
        ld_set_setname(fname);
 
794
 
 
795
        for (i=0; i<max; i++)
 
796
        {
 
797
                newvtt=new vtt_class(1);
 
798
                res+=newvtt->load_13(input);
 
799
                
 
800
                if (strlen(newvtt->filename))
 
801
                {
 
802
                        /* ftmp IS NECESSARY !!! */
 
803
                        strcpy(ftmp, newvtt->filename);
 
804
                        ld_set_filename(ftmp);
 
805
                        
 
806
                        //restmp=load_wav(newvtt->filename, &newbuffer, &size);
 
807
                        restmp=(int) newvtt->load_file(ftmp);
 
808
                        res+=restmp;
 
809
                }
 
810
                gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
 
811
                gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
 
812
                
 
813
        }
 
814
        
 
815
        sequencer.load(input);
 
816
        
 
817
        ld_destroy();
 
818
        
 
819
        return(res);
 
820
}
 
821
 
 
822
int  vtt_class :: load_all_14(FILE* input, char *fname)
 
823
{
 
824
        int res=0, restmp=0;
 
825
        unsigned int i, max;
 
826
        vtt_class *newvtt;
 
827
        char ftmp[PATH_MAX];
 
828
        guint32 pid;
 
829
        
 
830
        while (main_list.size())
 
831
        {
 
832
                delete((*main_list.begin()));
 
833
        }
 
834
                
 
835
        atload(max);
 
836
        atload(master_volume);
 
837
        set_master_volume(master_volume);
 
838
        globals.volume=master_volume;
 
839
        atload(globals.pitch);  
 
840
        set_master_pitch(globals.pitch);
 
841
        atload(pid);
 
842
        sp_master_volume.set_persistence_id(pid);
 
843
        atload(pid);
 
844
        sp_master_pitch.set_persistence_id(pid);
 
845
 
 
846
        ld_create_loaddlg(TX_LOADDLG_MODE_MULTI, max);
 
847
        ld_set_setname(fname);
 
848
 
 
849
        for (i=0; i<max; i++)
 
850
        {
 
851
                newvtt=new vtt_class(1);
 
852
                res+=newvtt->load_14(input);
 
853
                
 
854
                if (strlen(newvtt->filename))
 
855
                {
 
856
                        /* ftmp IS NECESSARY !!! */
 
857
                        strcpy(ftmp, newvtt->filename);
 
858
                        ld_set_filename(ftmp);
 
859
                        
 
860
                        //restmp=load_wav(newvtt->filename, &newbuffer, &size);
 
861
                        restmp=(int) newvtt->load_file(ftmp);
 
862
                        res+=restmp;
 
863
                }
 
864
                gtk_box_pack_start(GTK_BOX(control_parent), newvtt->gui.control_box, TRUE, TRUE, 0);
 
865
                gtk_box_pack_start(GTK_BOX(audio_parent), newvtt->gui.audio_box, TRUE, TRUE, 0);
 
866
            if (newvtt->audio_hidden) newvtt->hide_audio(newvtt->audio_hidden);
 
867
            if (newvtt->control_hidden) newvtt->hide_control(newvtt->control_hidden);
 
868
        }
 
869
        
 
870
        sequencer.load(input);
 
871
        
 
872
        ld_destroy();
 
873
        
 
874
        return(res);
 
875
}
 
876
 
 
877
void vtt_fx_ladspa :: load (FILE *input)
 
878
{
 
879
        guint32 count;
 
880
        unsigned int i;
 
881
        list <tX_seqpar_vttfx *> :: iterator sp;
 
882
        guint32 pid;
 
883
        guint8 hidden;
 
884
        float value;
 
885
        
 
886
        fread((void *) &count, sizeof(count), 1, input);
 
887
        
 
888
        if (count!=controls.size())
 
889
        {
 
890
                fprintf(stderr, "tX: Ouch! Plugin %li has less/more controls than saved!\n", plugin->getUniqueID());
 
891
        }
 
892
        
 
893
        for (i=0, sp=controls.begin(); (i<count) && (sp!=controls.end()); i++, sp++) {
 
894
                fread((void *) &pid, sizeof(pid), 1, input);
 
895
                (*sp)->set_persistence_id(pid);
 
896
                fread((void *) &value, sizeof(value), 1, input);
 
897
                (*sp)->do_exec(value);
 
898
                (*sp)->do_update_graphics();
 
899
        } 
 
900
        
 
901
        fread((void *) &hidden, sizeof(hidden), 1, input);
 
902
        panel->hide(hidden);
 
903
}
 
904
 
 
905
void tX_sequencer :: load(FILE *in)
 
906
{
 
907
        guint32 event_count=0;
 
908
        guint32 i;
 
909
        tX_event *new_event=NULL;
 
910
        
 
911
        delete_all_events(tX_sequencer::DELETE_ALL);
 
912
        
 
913
        fread ((void *) &event_count, sizeof(event_count), 1, in);
 
914
        
 
915
        max_timestamp=0;
 
916
        
 
917
        for (i=0; i<event_count; i++)
 
918
        {
 
919
                new_event=new tX_event(in);
 
920
                song_list.push_back(new_event);
 
921
        }
 
922
        
 
923
        start_timestamp=0;
 
924
        current_timestamp=0;
 
925
        
 
926
        if (new_event) max_timestamp=new_event->get_timestamp();
 
927
}
 
928
 
 
929
tX_event :: tX_event (FILE *input)
 
930
{
 
931
        unsigned int sp_persistence_id;
 
932
 
 
933
        fread((void *) &sp_persistence_id, sizeof(sp_persistence_id), 1, input);
 
934
        fread((void *) &timestamp, sizeof(timestamp), 1, input);
 
935
        fread((void *) &value, sizeof(value), 1, input);
 
936
 
 
937
        sp=tX_seqpar::get_sp_by_persistence_id(sp_persistence_id);
 
938
        if (!sp)
 
939
        {
 
940
                fprintf(stderr, "oops: couldn't resolve sp by persistence id %i.\n", sp_persistence_id);
 
941
        }
 
942
}
 
943
 
 
944
#endif