2 terminatorX - realtime audio scratching software
3 Copyright (C) 1999 Alexander König
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.
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.
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.
21 Description: Header to tX_vtt.cc
27 #ifndef DONT_USE_FLASH
33 #include "tX_vttgui.h"
38 #define EC_MAX_BUFFER 256000
40 #define CONTROL_NOTHING 0
41 #define CONTROL_SCRATCH 1
42 #define CONTROL_VOLUME 2
43 #define CONTROL_CUTOFF 3
44 #define CONTROL_FEEDBACK 4
46 #define NEED_FADE_OUT 0
47 #define NEED_FADE_IN 1
49 #define SAMPLE_MAX 32760.0
50 #define SAMPLE_BORDER 30000.0
57 static int vtt_amount;
58 static list <vtt_class *> main_list;
59 static list <vtt_class *> render_list;
61 static f_prec *mix_buffer;
62 static int16_t *mix_out_buffer;
63 static f_prec mix_max;
64 static int samples_in_mix_buffer;
65 static pthread_mutex_t render_lock;
66 static pthread_mutex_t main_lock;
68 static f_prec master_volume;
69 static f_prec res_master_volume;
70 static f_prec vol_channel_adjust;
72 static f_prec saturate_fac;
73 static int do_saturate;
75 static vtt_class * sync_master;
76 static int master_triggered;
77 static int master_triggered_at;
78 static vtt_class * focused_vtt;
84 /* main object vars */
85 char name[256]; // Turntable's name
86 char filename[PATH_MAX]; // The corresponding audiofile
100 int16_t *buffer; // Actual audio data
101 int samples_in_buffer; // No. of samples in audio data
104 f_prec *output_buffer;
105 f_prec *end_of_outputbuffer;
106 f_prec samples_in_outputbuffer;
107 f_prec inv_samples_in_outputbuffer;
109 /* main playback vars */
110 f_prec rel_volume; // The (user-selected) relative volume
111 f_prec res_volume; // The resulting volume
112 f_prec rel_pitch; // The (user-selected) relative pitch
123 // d_prec speed_default;
133 /* input control vars */
152 f_prec ec_buffer[EC_MAX_BUFFER];
157 f_prec ec_res_length;
165 /* Parameter setup methods */
166 void set_name(char *);
167 void set_file_data(char *, int16_t *, int);
168 int set_output_buffer_size(int);
170 void set_volume(f_prec);
171 void recalc_volume();
173 void set_pitch(f_prec);
176 void set_autotrigger(int);
181 void set_controls(int, int);
183 void lp_set_enable(int);
184 void lp_set_gain(f_prec);
185 void lp_set_reso(f_prec);
186 void lp_set_freq(f_prec);
187 void lp_setup(f_prec, f_prec, f_prec);
189 void ec_set_enable(int);
190 void ec_set_length(f_prec);
191 void ec_set_feedback(f_prec);
192 void ec_clear_buffer();
194 void set_sync_master(int);
195 void set_sync_client(int, int);
197 void set_scratch(int);
198 void xy_input(f_prec, f_prec);
199 void handle_input(int, f_prec);
203 static int16_t *render_all_turntables();
204 static int set_mix_buffer_size(int);
205 static void set_master_volume(f_prec);
206 static void set_master_pitch(f_prec);
207 static int enable_saturate(int);
208 static void focus_no(int);
209 static void focus_next();
210 static void unfocus();
219 static int load_all(FILE *);
220 static int save_all(FILE *);
222 void render_scratch();