1 /*
2   rakarrack - a guitar effects software
3 
4  process.C  -  mainloop functions
5   Copyright (C) 2008-2010 Josep Andreu
6   Author: Josep Andreu
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of version 2 of the GNU General Public License
10  as published by the Free Software Foundation.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  GNU General Public License (version 2) for more details.
16 
17  You should have received a copy of the GNU General Public License
18  (version2)  along with this program; if not, write to the Free Software
19  Foundation,
20  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21 
22 */
23 
24 #include <stdio.h>
25 #include <string.h>
26 #include <math.h>
27 #include <stdlib.h>
28 #include <fcntl.h>
29 #include <sys/types.h>
30 #include <unistd.h>
31 #include <FL/Fl_Preferences.H>
32 #include "global.h"
33 
34 int Pexitprogram, preset;
35 int commandline;
36 int exitwithhelp, gui, nojack;
37 int period;
38 int note_active[POLY];
39 int rnote[POLY];
40 int gate[POLY];
41 int reconota;
42 int maxx_len;
43 int error_num;
44 int stecla;
45 int looper_lqua;
46 int needtoloadstate;
47 int needtoloadbank;
48 unsigned int SAMPLE_RATE;
49 float fPERIOD;
50 float fSAMPLE_RATE;
51 float cSAMPLE_RATE;
52 //int Wave_res_amount;
53 //int Wave_up_q;
54 //int Wave_down_q;
55 int pdata[50];
56 float val_sum;
57 float r__ratio[12];
58 float freqs[12];
59 float lfreqs[12];
60 float aFreq;
61 char *s_uuid;
62 char *statefile;
63 char *filetoload;
64 char *banktoload;
65 Fl_Preferences rakarrack (Fl_Preferences::USER, WEBSITE, PACKAGE);
66 Pixmap p, mask;
67 XWMHints *hints;
68 
RKR()69 RKR::RKR ()
70 {
71     db6booster=0;
72     jdis=0;
73     jshut=0;
74     char temp[256];
75     ML_filter=0;
76     error_num = 0;
77     eff_filter = 0;
78     OnOffC = 0;
79     flpos = 0;
80     Har_Down = 0;
81     Rev_Down = 0;
82     Con_Down = 0;
83     Shi_Down = 0;
84     Seq_Down = 0;
85     cpufp = 0;
86     numpc = 0;
87     numpi = 0;
88     numpo = 0;
89     numpa = 0;
90     numpmi = 0;
91     numpmo = 0;
92     mess_dis = 0;
93     mtc_counter = 0;
94     nojack = 0;
95     memset (Mcontrol, 0, sizeof (Mcontrol));
96     Mvalue = 0;
97     actuvol= 0;
98     OnCounter=0;
99 
100 
101     sprintf (temp, "rakarrack");
102 
103 #ifdef JACK_SESSION
104     jackclient = jack_client_open (temp, JackSessionID, NULL, s_uuid);
105 #else
106     jackclient = jack_client_open (temp, options, &status, NULL);
107 #endif
108 
109 
110     if (jackclient == NULL) {
111         fprintf (stderr, "Cannot make a jack client, is jackd running?\n");
112         nojack = 1;
113         exitwithhelp = 1;
114         return;
115 
116     }
117 
118     strcpy (jackcliname, jack_get_client_name (jackclient));
119 
120 
121 
122 
123     J_SAMPLE_RATE = jack_get_sample_rate (jackclient);
124     J_PERIOD = jack_get_buffer_size (jackclient);
125 
126     rakarrack.get(PrefNom("Disable Warnings"),mess_dis,0);
127     rakarrack.get (PrefNom ("Filter DC Offset"), DC_Offset, 0);
128     rakarrack.get (PrefNom ("UpSampling"), upsample, 0);
129     rakarrack.get (PrefNom ("UpQuality"), UpQual, 4);
130     rakarrack.get (PrefNom ("DownQuality"), DownQual, 4);
131     rakarrack.get (PrefNom ("UpAmount"), UpAmo, 0);
132 
133 
134     Adjust_Upsample();
135 
136     rakarrack.get (PrefNom ("Looper Size"), looper_size, 1);
137     rakarrack.get (PrefNom ("Calibration"), aFreq, 440.0f);
138     update_freqs(aFreq);
139 
140     rakarrack.get (PrefNom ("Vocoder Bands"), VocBands, 32);
141     rakarrack.get (PrefNom ("Recognize Trigger"), rtrig, .6f);
142 
143 
144     Fraction_Bypass = 1.0f;
145     Master_Volume = 0.50f;
146     Input_Gain = 0.50f;
147     Cabinet_Preset = 0;
148 
149     rakarrack.get (PrefNom("Harmonizer Downsample"),Har_Down,5);
150     rakarrack.get (PrefNom("Harmonizer Up Quality"),Har_U_Q,4);
151     rakarrack.get (PrefNom("Harmonizer Down Quality"),Har_D_Q,2);
152 
153     rakarrack.get (PrefNom("StereoHarm Downsample"),Ste_Down,5);
154     rakarrack.get (PrefNom("StereoHarm Up Quality"),Ste_U_Q,4);
155     rakarrack.get (PrefNom("StereoHarm Down Quality"),Ste_D_Q,2);
156 
157     rakarrack.get (PrefNom("Reverbtron Downsample"),Rev_Down,5);
158     rakarrack.get (PrefNom("Reverbtron Up Quality"),Rev_U_Q,4);
159     rakarrack.get (PrefNom("Reverbtron Down Quality"),Rev_D_Q,2);
160 
161     rakarrack.get (PrefNom("Convolotron Downsample"),Con_Down,6);
162     rakarrack.get (PrefNom("Convolotron Up Quality"),Con_U_Q,4);
163     rakarrack.get (PrefNom("Convolotron Down Quality"),Con_D_Q,2);
164 
165     rakarrack.get (PrefNom("Sequence Downsample"),Seq_Down,5);
166     rakarrack.get (PrefNom("Sequence Up Quality"),Seq_U_Q,4);
167     rakarrack.get (PrefNom("Sequence Down Quality"),Seq_D_Q,2);
168 
169     rakarrack.get (PrefNom("Shifter Downsample"),Shi_Down,5);
170     rakarrack.get (PrefNom("Shifter Up Quality"),Shi_U_Q,4);
171     rakarrack.get (PrefNom("Shifter Down Quality"),Shi_D_Q,2);
172 
173     rakarrack.get (PrefNom("Vocoder Downsample"),Voc_Down,5);
174     rakarrack.get (PrefNom("Vocoder Up Quality"),Voc_U_Q,4);
175     rakarrack.get (PrefNom("Vocoder Down Quality"),Voc_D_Q,2);
176 
177 
178 //    rakarrack.get (PrefNom("Waveshape Resampling"),Wave_res_amount,5);
179 //    rakarrack.get (PrefNom("Waveshape Up Quality"),Wave_up_q,4);
180 //    rakarrack.get (PrefNom("Waveshape Down Quality"),Wave_down_q,2);
181 
182 
183 
184 
185     rakarrack.get (PrefNom ("Harmonizer Quality"), HarQual, 4);
186     rakarrack.get (PrefNom ("StereoHarm Quality"), SteQual, 4);
187 
188     rakarrack.get (PrefNom ("Auto Connect Jack"), aconnect_JA, 1);
189     rakarrack.get (PrefNom ("Auto Connect Jack In"), aconnect_JIA, 1);
190 
191     rakarrack.get (PrefNom ("Auto Connect Num"), cuan_jack, 2);
192     rakarrack.get (PrefNom ("Auto Connect In Num"), cuan_ijack, 1);
193 
194     int i;
195     memset (temp, 0, sizeof (temp));
196     char j_names[128];
197 
198     static const char *jack_names[] =
199     { "system:playback_1", "system:playback_2" };
200 
201     for (i = 0; i < cuan_jack; i++) {
202         memset (temp, 0, sizeof (temp));
203         sprintf (temp, "Jack Port %d", i + 1);
204         if (i < 2)
205             strcpy (j_names, jack_names[i]);
206         else
207             strcpy (j_names, "");
208         rakarrack.get (PrefNom (temp), jack_po[i].name, j_names, 128);
209 
210     }
211 
212     memset(j_names,0, sizeof(j_names));
213 
214     static const char *jack_inames[] =
215     { "system:capture_1", "system:capture_2" };
216 
217     for (i = 0; i < cuan_ijack; i++) {
218         memset (temp, 0, sizeof (temp));
219         sprintf (temp, "Jack Port In %d", i + 1);
220         if (i < 1)
221             strcpy (j_names, jack_inames[i]);
222         else
223             strcpy (j_names, "");
224         rakarrack.get (PrefNom (temp), jack_poi[i].name, j_names, 128);
225     }
226 
227 
228     bogomips = 0.0f;
229     i = Get_Bogomips();
230 
231 
232 
233     efxoutl = (float *) malloc (sizeof (float) * period);
234     efxoutr = (float *) malloc (sizeof (float) * period);
235 
236     smpl = (float *) malloc (sizeof (float) * period);
237     smpr = (float *) malloc (sizeof (float) * period);
238 
239     anall = (float *) malloc (sizeof (float) * period);
240     analr = (float *) malloc (sizeof (float) * period);
241 
242     auxdata = (float *) malloc (sizeof (float) * period);
243     auxresampled = (float *) malloc (sizeof (float) * period);
244 
245     m_ticks = (float *) malloc (sizeof (float) * period);
246 
247 
248 
249     Fpre = new FPreset();
250     DC_Offsetl = new AnalogFilter (1, 20, 1, 0);
251     DC_Offsetr = new AnalogFilter (1, 20, 1, 0);
252     M_Metronome = new metronome();
253     efx_Chorus = new Chorus (efxoutl, efxoutr);
254     efx_Flanger = new Chorus (efxoutl, efxoutr);
255     efx_Rev = new Reverb (efxoutl, efxoutr);
256     efx_Echo = new Echo (efxoutl, efxoutr);
257     efx_Phaser = new Phaser (efxoutl, efxoutr);
258     efx_APhaser = new Analog_Phaser(efxoutl, efxoutr);
259     efx_Distorsion = new Distorsion (efxoutl, efxoutr);
260     efx_Overdrive = new Distorsion (efxoutl, efxoutr);
261     efx_EQ2 = new EQ (efxoutl, efxoutr);
262     efx_EQ1 = new EQ (efxoutl, efxoutr);
263     efx_Compressor = new Compressor (efxoutl, efxoutr);
264     efx_WhaWha = new DynamicFilter (efxoutl, efxoutr);
265     efx_Alienwah = new Alienwah (efxoutl, efxoutr);
266     efx_Cabinet = new EQ (efxoutl, efxoutr);
267     efx_Pan = new Pan (efxoutl, efxoutr);
268     efx_Har = new Harmonizer (efxoutl, efxoutr, (long) HarQual, Har_Down, Har_U_Q, Har_D_Q);
269     efx_MusDelay = new MusicDelay (efxoutl, efxoutr);
270     efx_Gate = new Gate (efxoutl, efxoutr);
271     efx_NewDist = new NewDist(efxoutl, efxoutr);
272     efx_FLimiter = new Compressor (efxoutl, efxoutr);
273     efx_Valve = new Valve(efxoutl, efxoutr);
274     efx_DFlange = new Dflange(efxoutl,efxoutr);
275     efx_Ring = new Ring(efxoutl,efxoutr);
276     efx_Exciter = new Exciter(efxoutl,efxoutr);
277     efx_MBDist = new MBDist(efxoutl,efxoutr);
278     efx_Arpie = new Arpie(efxoutl,efxoutr);
279     efx_Expander = new Expander(efxoutl,efxoutr);
280     efx_Shuffle = new Shuffle(efxoutl,efxoutr);
281     efx_Synthfilter = new Synthfilter(efxoutl,efxoutr);
282     efx_MBVvol = new MBVvol(efxoutl,efxoutr);
283     efx_Convol = new Convolotron(efxoutl,efxoutr,Con_Down,Con_U_Q,Con_D_Q);
284     efx_Looper = new Looper(efxoutl,efxoutr,looper_size);
285     efx_RyanWah = new RyanWah(efxoutl,efxoutr);
286     efx_RBEcho = new RBEcho(efxoutl,efxoutr);
287     efx_CoilCrafter = new CoilCrafter(efxoutl,efxoutr);
288     efx_ShelfBoost = new ShelfBoost(efxoutl,efxoutr);
289     efx_Vocoder = new Vocoder(efxoutl,efxoutr,auxresampled,VocBands,Voc_Down, Voc_U_Q, Voc_D_Q);
290     efx_Sustainer = new Sustainer(efxoutl,efxoutr);
291     efx_Sequence = new Sequence(efxoutl,efxoutr, (long) HarQual, Seq_Down, Seq_U_Q, Seq_D_Q);
292     efx_Shifter =  new Shifter(efxoutl,efxoutr, (long) HarQual, Shi_Down, Shi_U_Q, Shi_D_Q);
293     efx_StompBox = new StompBox(efxoutl,efxoutr);
294     efx_Reverbtron = new Reverbtron(efxoutl,efxoutr,Rev_Down, Rev_U_Q, Rev_D_Q);
295     efx_Echotron = new Echotron(efxoutl,efxoutr);
296     efx_StereoHarm = new StereoHarm(efxoutl, efxoutr, (long) SteQual, Ste_Down, Ste_U_Q, Ste_D_Q);
297     efx_CompBand = new CompBand(efxoutl,efxoutr);
298     efx_Opticaltrem = new Opticaltrem(efxoutl,efxoutr);
299     efx_Vibe = new Vibe(efxoutl,efxoutr);
300     efx_Infinity = new Infinity(efxoutl,efxoutr);
301 
302     U_Resample = new Resample(UpQual);
303     D_Resample = new Resample(DownQual);
304     A_Resample = new Resample(3);
305 
306     beat = new beattracker();
307     efx_Tuner = new Tuner ();
308     efx_MIDIConverter = new MIDIConverter(jackcliname);
309     RecNote = new Recognize (efxoutl, efxoutr, rtrig);
310     RC = new RecChord ();
311 
312 
313     Preset_Name = (char *) malloc (sizeof (char) * 64);
314     memset (Preset_Name, 0, sizeof (char) * 64);
315     Author = (char *) malloc (sizeof (char) * 64);
316     memset (Author, 0, sizeof (char) * 64);
317     Bank_Saved = (char *) malloc (sizeof (char) * 128);
318     memset (Bank_Saved, 0, sizeof (char) * 128);
319     UserRealName = (char *) malloc (sizeof (char) * 128);
320     memset (UserRealName, 0, sizeof (char) * 128);
321 
322 // Names
323 
324     /*
325     //Filter
326 
327     1   - Distortion
328     2   - Modulation
329     4   - Time
330     8   - Emulation
331     16  - Filters
332     32  - Dynamics
333     64  - Processing & EQ
334     128 - Synthesis
335     */
336 
337     NumEffects = 47;
338 
339     {
340         static const char *los_names[] = {
341             "AlienWah","11","16",
342             "Analog Phaser","18","2",
343             "Arpie","24","4",
344             "Cabinet","12","8",
345             "Chorus","5","2",
346             "Coil Crafter","33","8",
347             "CompBand","43","8",
348             "Compressor","1","32",
349             "Convolotron","29","8",
350             "Derelict","17","1",
351             "DistBand","23","1",
352             "Distortion","2","1",
353             "Dual Flange","20","2",
354             "Echo","4","4",
355             "Echotron","41","4",
356             "Echoverse","32","4",
357             "EQ","0","64",
358             "Exciter","22","64",
359             "Expander","25","32",
360             "Flanger","7","2",
361             "Harmonizer","14","128",
362             "Infinity","46","16",
363             "Looper","30","128",
364             "MusicalDelay","15","4",
365             "MuTroMojo","31","16",
366             "NoiseGate","16","32",
367             "Opticaltrem","44","2",
368             "Overdrive","3","1",
369             "Pan","13","64",
370             "Parametric EQ","9","64",
371             "Phaser","6","2",
372             "Reverb","8","4",
373             "Reverbtron","40","4",
374             "Ring","21","128",
375             "Sequence","37","128",
376             "ShelfBoost","34","64",
377             "Shifter","38","128",
378             "Shuffle","26","64",
379             "StereoHarm","42","128",
380             "StompBox","39","9",
381             "Sustainer","36","32",
382             "Synthfilter","27","16",
383             "Valve","19","9",
384             "VaryBand","28","2",
385             "Vibe","45","2",
386             "Vocoder","35","128",
387             "WahWah","10","16"
388 
389         };
390 
391         for (i = 0; i < NumEffects*3; i+=3) {
392             strcpy (efx_names[i/3].Nom, los_names[i]);
393             sscanf(los_names[i+1],"%d",&efx_names[i/3].Pos);
394             sscanf(los_names[i+2],"%d",&efx_names[i/3].Type);
395 
396 
397         }
398     }
399 
400 
401     NumParams= 377;
402 
403     {
404         static const char *los_params[] = {
405 
406             "Alienwah Depth","20","11",
407             "Alienwah Fb","82","11",
408             "Alienwah Tempo","76","11",
409             "Alienwah LR_Cr","96","11",
410             "Alienwah Pan","61","11",
411             "Alienwah Phase","115","11",
412             "Alienwah Rnd.","109","11",
413             "Alienwah St_df.","103","11",
414             "Alienwah Wet/Dry","55","11",
415             "Analog Phaser Depth","120","18",
416             "Analog Phaser Distortion","118","18",
417             "Analog Phaser Feedback","122","18",
418             "Analog Phaser Tempo","119","18",
419             "Analog Phaser Mismatch","123","18",
420             "Analog Phaser St.df","124","18",
421             "Analog Phaser Wet-Dry","117","18",
422             "Analog Phaser Width","121","18",
423             "Arpie Arpe's","213","24",
424             "Arpie Damp","219","24",
425             "Arpie Fb","218","24",
426             "Arpie LR_Cr","217","24",
427             "Arpie LRdl","216","24",
428             "Arpie Pan","214","24",
429             "Arpie Tempo","215","24",
430             "Arpie WD","212","24",
431             "AutoPan/Extra Stereo Tempo","77","13",
432             "AutoPan/Extra Stereo Pan","67","13",
433             "AutoPan/Extra Stereo Rnd","110","13",
434             "AutoPan/Extra Stereo St_df.","104","13",
435             "AutoPan/Extra Stereo Wet/Dry","58","13",
436             "Balance","12","50",
437             "Chorus Depth","23","5",
438             "Chorus Fb","79","5",
439             "Chorus Tempo","72","5",
440             "Chorus LR_Cr","91","5",
441             "Chorus Pan","50","5",
442             "Chorus Rnd","105","5",
443             "Chorus St_df","99","5",
444             "Chorus Wet/Dry","52","5",
445             "CoilCrafter Freq1","288","33",
446             "CoilCrafter Freq2","290","33",
447             "CoilCrafter Gain","286","33",
448             "CoilCrafter Q1","289","33",
449             "CoilCrafter Q2","291","33",
450             "CoilCrafter Tone","287","33",
451             "CompBand Cross 1","378","43",
452             "CompBand Cross 2","379","43",
453             "CompBand Cross 3","380","43",
454             "CompBand Gain","369","43",
455             "CompBand H Ratio","373","43",
456             "CompBand H Thres","377","43",
457             "CompBand L Ratio","370","43",
458             "CompBand L Thres","374","43",
459             "CompBand MH Ratio","372","43",
460             "CompBand MH Thres","376","43",
461             "CompBand ML Ratio","371","43",
462             "CompBand ML Thres","375","43",
463             "CompBand WD ","368","43",
464             "Compressor A.Time","142","1",
465             "Compressor Knee","145","1",
466             "Compressor Output","147","1",
467             "Compressor Ratio","144","1",
468             "Compressor R.Time","143","1",
469             "Compressor Threshold","146","1",
470             "Convolotron Damp","283","29",
471             "Convolotron Fb","284","29",
472             "Convolotron Length","285","29",
473             "Convolotron Level","282","29",
474             "Convolotron Pan","281","29",
475             "Convolotron WD","280","29",
476             "Derelict Dist Color","6","17",
477             "Derelict Dist Drive","2","17",
478             "Derelict Dist HPF","5","17",
479             "Derelict Dist Level","3","17",
480             "Derelict Dist LPF","4","17",
481             "Derelict Dist LR Cross","127","17",
482             "Derelict Dist Pan","126","17",
483             "Derelict Sub Octave","8","17",
484             "Derelict Wet-Dry","125","17",
485             "DistBand Cross1","209","23",
486             "DistBand Cross2","210","23",
487             "DistBand Drive","204","23",
488             "DistBand H.Gain","208","23",
489             "DistBand Level","205","23",
490             "DistBand L.Gain","206","23",
491             "DistBand LR_Cr","203","23",
492             "DistBand M.Gain","207","23",
493             "DistBand Pan","211","23",
494             "DistBand WD","202","23",
495             "Distortion Drive","69","2",
496             "Distortion HPF","89","2",
497             "Distortion Level","71","2",
498             "Distortion LPF","86","2",
499             "Distortion LR_Cr","95","2",
500             "Distortion Pan","48","2",
501             "Distortion Sub Octave","9","2",
502             "Distortion Wet/Dry","30","2",
503             "Dual Flange Depth","161","20",
504             "Dual Flange FB","164","20",
505             "Dual Flange LPF","165","20",
506             "Dual Flange LR_Cr","160","20",
507             "Dual Flange Offset","163","20",
508             "Dual Flange Pan","159","20",
509             "Dual Flange Rnd","168","20",
510             "Dual Flange St_df.","167","20",
511             "Dual Flange Tempo","166","20",
512             "Dual Flange WD","158","20",
513             "Dual Flange Width","162","20",
514             "Echo Fb","78","4",
515             "Echo LR_Cr","97","4",
516             "Echo Pan","46","4",
517             "Echo Wet/Dry","59","4",
518             "Echotron WD","348","41",
519             "Echotron Pan","349","41",
520             "Echotron Tempo","350","41",
521             "Echotron Damp","351","41",
522             "Echotron Fb","352","41",
523             "Echotron LR_Cr","353","41",
524             "Echotron Width","354","41",
525             "Echotron Depth","355","41",
526             "Echotron St_df","356","41",
527             "Echotron #","357","41",
528             "Echoverse Angle","311","32",
529             "Echoverse Damp","309","32",
530             "Echoverse E.S.","310","32",
531             "Echoverse Fb","308","32",
532             "Echoverse LRdl","307","32",
533             "Echoverse Pan","305","32",
534             "Echoverse Reverse","304","32",
535             "Echoverse Tempo","306","32",
536             "Echoverse WD","303","32",
537             "EQ 125 Hz","134","0",
538             "EQ 16 Khz","141","0",
539             "EQ 1 Khz","137","0",
540             "EQ 250 Hz","135","0",
541             "EQ 2 Khz","138","0",
542             "EQ 31 Hz","132","0",
543             "EQ 4 Khz","139","0",
544             "EQ 500 Hz","136","0",
545             "EQ 63 Hz","133","0",
546             "EQ 8 Khz","140","0",
547             "EQ Gain","130","0",
548             "EQ Q","131","0",
549             "Exciter Gain","189","22",
550             "Exciter Har 10","201","22",
551             "Exciter Har 1","192","22",
552             "Exciter Har 2","193","22",
553             "Exciter Har 3","194","22",
554             "Exciter Har 4","195","22",
555             "Exciter Har 5","196","22",
556             "Exciter Har 6","197","22",
557             "Exciter Har 7","198","22",
558             "Exciter Har 8","199","22",
559             "Exciter Har 9","200","22",
560             "Exciter HPF","191","22",
561             "Exciter LPF","190","22",
562             "Expander A.Time","220","25",
563             "Expander HPF","226","25",
564             "Expander Level","224","25",
565             "Expander LPF","225","25",
566             "Expander R.Time","221","25",
567             "Expander Shape","222","25",
568             "Expander Threshold","223","25",
569             "Flanger Depth","22","7",
570             "Flanger Fb","80","7",
571             "Flanger Tempo","73","7",
572             "Flanger LR_Cr","92","7",
573             "Flanger Pan","51","7",
574             "Flanger Rnd","106","7",
575             "Flanger St_df","100","7",
576             "Flanger Wet/Dry","53","7",
577             "Harmonizer Freq","26","14",
578             "Harmonizer Interval","27","14",
579             "Harmonizer Pan","49","14",
580             "Harmonizer Wet/Dry","31","14",
581             "Infinity WD","395","46",
582             "Infinity Res","396","46",
583             "Infinity AutoPan","397","46",
584             "Infinity St_df","398","46",
585             "Infinity Start","399","46",
586             "Infinity End","400","46",
587             "Infinity Tempo","401","46",
588             "Infinity Subdiv","402","46",
589             "Input","14","50",
590             "Looper Auto Play"," 271","30",
591             "Looper Clear","279","30",
592             "Looper Level 1","268","30",
593             "Looper Level 2","269","30",
594             "Looper Play","272","30",
595             "Looper R1","275","30",
596             "Looper R2","276","30",
597             "Looper Record","274","30",
598             "Looper Reverse","270","30",
599             "Looper Stop","273","30",
600             "Looper Track 1","277","30",
601             "Looper Track 2","278","30",
602             "Looper WD","267","30",
603             "Multi On/Off","116","50",
604             "Musical Delay Fb 1","83","15",
605             "Musical Delay Fb 2","84","15",
606             "Musical Delay Gain 1","24","15",
607             "Musical Delay Gain 2","25","15",
608             "Musical Delay LR_Cr","98","15",
609             "Musical Delay Pan 1","62","15",
610             "Musical Delay Pan 2","65","15",
611             "Musical Delay Wet/Dry","56","15",
612             "MuTroMojo E. Sens","265","31",
613             "MuTroMojo BP","258","31",
614             "MuTroMojo HP","259","31",
615             "MuTroMojo LP","257","31",
616             "MuTroMojo Range","263","31",
617             "MuTroMojo Res","262","31",
618             "MuTroMojo Smooth","266","31",
619             "MuTroMojo Tempo","261","31",
620             "MuTroMojo Wah","264","31",
621             "MuTroMojo WD","256","31",
622             "MuTroMojo Width","260","31",
623             "Opticaltrem Depth","381","44",
624             "Opticaltrem Pan","385","44",
625             "Opticaltrem Rnd","383","44",
626             "Opticaltrem St.df","384","44",
627             "Opticaltrem Tempo","382","44",
628             "Overdrive Drive","68","3",
629             "Overdrive Level","70","3",
630             "Overdrive LPF","85","3",
631             "Overdrive HPF","88","3",
632             "Overdrive LR_Cr","94","3",
633             "Overdrive Pan","47","3",
634             "Overdrive Wet/Dry","29","3",
635             "P.EQ Gain","148","9",
636             "P.EQ High Freq","155","9",
637             "P.EQ High Gain","156","9",
638             "P.EQ High Q","157","9",
639             "P.EQ Low Freq","149","9",
640             "P.EQ Low Gain","150","9",
641             "P.EQ Low Q","151","9",
642             "P.EQ Mid Freq","152","9",
643             "P.EQ Mid Gain","153","9",
644             "P.EQ Mid Q","154","9",
645             "Phaser Depth","21","6",
646             "Phaser Fb","81","6",
647             "Phaser Tempo","74","6",
648             "Phaser LR_Cr","93","6",
649             "Phaser Pan","60","6",
650             "Phaser Phase","114","6",
651             "Phaser Rnd","107","6",
652             "Phaser St_df","101","6",
653             "Phaser Wet/Dry","54","6",
654             "Reverb HPF","90","8",
655             "Reverb LPF","87","8",
656             "Reverb Pan","63","8",
657             "Reverb Wet/Dry","57","8",
658             "Reverbtron WD","339","40",
659             "Reverbtron Pan","340","40",
660             "Reverbtron Level","341","40",
661             "Reverbtron Damp","342","40",
662             "Reverbtron Fb","343","40",
663             "Reverbtron Length","344","40",
664             "Reverbtron Stretch","345","40",
665             "Reverbtron I.Del","346","40",
666             "Reverbtron Fade","347","40",
667             "Ring Depth","183","21",
668             "Ring Freq","184","21",
669             "Ring Input","180","21",
670             "Ring Level","181","21",
671             "Ring LR_Cr","179","21",
672             "Ring Pan","182","21",
673             "Ring Saw","187","21",
674             "Ring Sin","185","21",
675             "Ring Squ","188","21",
676             "Ring Tri","186","21",
677             "Ring WD","178","21",
678             "Sequence WD","314","37",
679             "Sequence 1","315","37",
680             "Sequence 2","316","37",
681             "Sequence 3","317","37",
682             "Sequence 4","318","37",
683             "Sequence 5","319","37",
684             "Sequence 6","320","37",
685             "Sequence 7","321","37",
686             "Sequence 8","322","37",
687             "Sequence Tempo","323","37",
688             "Sequence Q","324","37",
689             "Sequence St.df","325","37",
690             "ShelfBoost Gain","292","34",
691             "ShelfBoost Level","293","34",
692             "ShelfBoost Pres","295","34",
693             "ShelfBoost Tone","294","34",
694             "Shifter WD","326","38",
695             "Shifter Int","327","38",
696             "Shifter Gain","328","38",
697             "Shifter Pan","329","38",
698             "Shifter Attack","330","38",
699             "Shifter Decay","331","38",
700             "Shifter Thrshold","332","38",
701             "Shifter Whamy","333","38",
702             "Shuffle High Freq","234","26",
703             "Shuffle High Gain","235","26",
704             "Shuffle Low Freq","228","26",
705             "Shuffle Low Gain","229","26",
706             "Shuffle M.H. Freq","232","26",
707             "Shuffle M.H. Gain","233","26",
708             "Shuffle M.L. Freq","230","26",
709             "Shuffle M.L. Gain","231","26",
710             "Shuffle Q","236","26",
711             "Shuffle WD","227","26",
712             "StereoHarm Chord","367","42",
713             "StereoHarm Chrm L","360","42",
714             "StereoHarm Chrm R","363","42",
715             "StereoHarm Gain L","361","42",
716             "StereoHarm Gain R","364","42",
717             "StereoHarm Int L","359","42",
718             "StereoHarm Int R","362","42",
719             "StereoHarm LR_Cr","365","42",
720             "StereoHarm Note","366","42",
721             "StereoHarm WD","358","42",
722             "StompBox Level","334","39",
723             "StompBox Gain","335","39",
724             "StompBox Low","336","39",
725             "StompBox Mid","337","39",
726             "StompBox High","338","39",
727             "Sustainer Gain","312","36",
728             "Sustainer Sustain","313","36",
729             "Synthfilter A.Time","245","27",
730             "Synthfilter Depth","243","27",
731             "Synthfilter Distort","238","27",
732             "Synthfilter E.Sens","244","27",
733             "Synthfilter Fb","242","27",
734             "Synthfilter Offset","247","27",
735             "Synthfilter R.Time","246","27",
736             "Synthfilter St.df","240","27",
737             "Synthfilter Tempo","239","27",
738             "Synthfilter WD","237","27",
739             "Synthfilter Width","241","27",
740             "Valve Dist","174","19",
741             "Valve Drive","173","19",
742             "Valve HPF","177","19",
743             "Valve Level","172","19",
744             "Valve LPF","176","19",
745             "Valve LR_Cr","170","19",
746             "Valve Pan","171","19",
747             "Valve Presence","175","19",
748             "Valve WD","169","19",
749             "VaryBand Cross1","253","28",
750             "VaryBand Cross2","254","28",
751             "VaryBand Cross3","255","28",
752             "VaryBand St.df 1","250","28",
753             "VaryBand St.df 2","252","28",
754             "VaryBand Tempo 1","249","28",
755             "VaryBand Tempo 2","251","28",
756             "VaryBand WD","248","28",
757             "Vibe Depth","388","45",
758             "Vibe Fb","392","45",
759             "Vibe LR_Cr","393","45",
760             "Vibe Pan","394","45",
761             "Vibe Rnd","390","45",
762             "Vibe St_df","391","45",
763             "Vibe Tempo","389","45",
764             "Vibe WD","386","45",
765             "Vibe Width","387","45",
766             "Vocoder Input","298","35",
767             "Vocoder Level","302","35",
768             "Vocoder Muf.","299","35",
769             "Vocoder Pan","297","35",
770             "Vocoder Q","300","35",
771             "Vocoder Ring","301","35",
772             "Vocoder WD","296","35",
773             "Volume","7","50",
774             "WahWah Amp S.","111","10",
775             "WahWah Amp S.I.","112","10",
776             "WahWah Depth","1","10",
777             "WahWah Tempo","75","10",
778             "WahWah Pan","66","10",
779             "WahWah Rnd.","108","10",
780             "WahWah Smooth","113","10",
781             "WahWah St_df.","102","10",
782             "WahWah WD","28","10"
783         };
784         for(i=0; i<NumParams; i++) {
785             strcpy (efx_params[i].Nom, los_params[i*3]);
786             sscanf(los_params[i*3+1],"%d",&efx_params[i].Ato);
787             sscanf(los_params[i*3+2],"%d",&efx_params[i].Effect);
788 
789         }
790     }
791 
792 // Init Preset
793 
794     New ();
795 
796 // Init Bank
797 
798     New_Bank ();
799     init_rkr ();
800 
801 }
802 
803 
804 
~RKR()805 RKR::~RKR ()
806 {
807 };
808 
809 
810 
811 
812 void
init_rkr()813 RKR::init_rkr ()
814 {
815 
816     Tuner_Bypass = 0;
817     MIDIConverter_Bypass = 0;
818     Metro_Bypass = 0;
819 
820     for (int i = 0; i <= 45; i += 5) {
821         efx_EQ1->changepar (i + 10, 7);
822         efx_EQ1->changepar (i + 14, 0);
823     }
824 
825     efx_EQ1->changepar (11, 31);
826     efx_EQ1->changepar (16, 63);
827     efx_EQ1->changepar (21, 125);
828     efx_EQ1->changepar (26, 250);
829     efx_EQ1->changepar (31, 500);
830     efx_EQ1->changepar (36, 1000);
831     efx_EQ1->changepar (41, 2000);
832     efx_EQ1->changepar (46, 4000);
833     efx_EQ1->changepar (51, 8000);
834     efx_EQ1->changepar (56, 16000);
835 
836     for (int i = 0; i <= 10; i += 5) {
837         efx_EQ2->changepar (i + 10, 7);
838         efx_EQ2->changepar (i + 13, 64);
839         efx_EQ2->changepar (i + 14, 0);
840 
841     }
842 
843 
844     efx_FLimiter->Compressor_Change_Preset(0,3);
845 
846 
847     old_il_sum = -0.0f;
848     old_ir_sum = -0.0f;
849 
850     old_vl_sum = -0.0f;
851     old_vr_sum = -0.0f;
852 
853     old_a_sum = -0.0f;
854     val_a_sum = -0.0f;
855 
856     val_il_sum = -0.0f;
857     val_ir_sum = -0.0f;
858 
859     val_vl_sum = -0.0f;
860     val_vr_sum = -0.0f;
861 
862     last_auxvalue = 0;
863     note_old = 0;
864     nfreq_old = 0;
865     afreq_old = 0;
866     cents_old = 0;
867 
868     MidiCh = 0;
869     RControl = 0;
870     ControlGet = 0;
871 
872     help_displayed = 0;
873     modified = 0;
874 
875 
876     tempocnt=0;
877     for(int i=0; i<6; i++)tempobuf[i]=0;
878     Tap_timeB = 0;
879     Tap_Display = 0;
880     Tap_Selection = 0;
881     Tap_TempoSet = 90;
882 
883 // Load Preset Bank File
884 
885     char temp[128];
886     memset (temp, 0, sizeof (temp));
887     sprintf (temp, "%s/Default.rkrb", DATADIR);
888     rakarrack.get (PrefNom ("Bank Filename"), BankFilename, temp, 127);
889     loadnames();
890 
891     if (commandline == 0) {
892         loadbank (BankFilename);
893         a_bank=3;
894 
895     }
896     RC->cleanup ();
897     reconota = -1;
898 
899 }
900 
901 
902 void
Adjust_Upsample()903 RKR::Adjust_Upsample()
904 {
905 
906     if(upsample) {
907         SAMPLE_RATE = J_SAMPLE_RATE*(UpAmo+2);
908         period = J_PERIOD*(UpAmo+2);
909         u_up = (double)UpAmo+2.0;
910         u_down = 1.0 / u_up;
911 
912 
913     } else {
914         SAMPLE_RATE = J_SAMPLE_RATE;
915         period = J_PERIOD;
916     }
917 
918     fSAMPLE_RATE = (float) SAMPLE_RATE;
919     cSAMPLE_RATE = 1.0f / (float)SAMPLE_RATE;
920     fPERIOD= float(period);
921     t_periods = J_SAMPLE_RATE / 12 / J_PERIOD;
922 
923 }
924 
925 
926 
927 
928 
929 void
ConnectMIDI()930 RKR::ConnectMIDI ()
931 {
932 
933 // Get config settings and init settings
934 // Get MIDI IN Setting
935 
936     rakarrack.get (PrefNom ("Auto Connect MIDI IN"), aconnect_MI, 0);
937     rakarrack.get (PrefNom ("MIDI IN Device"), MID, "", 40);
938     if (aconnect_MI)
939         Conecta ();
940 
941 
942 }
943 
944 int
Cabinet_setpreset(int npreset)945 RKR::Cabinet_setpreset (int npreset)
946 {
947 
948     const int PRESET_SIZE = 81;
949     const int NUM_PRESETS = 11;
950     int presets[NUM_PRESETS][PRESET_SIZE] = {
951 
952         //Marshall-4-12
953         {
954             2, 1135, 0, 0, 0, 8, 116, 87, 71, 0, 7, 128, 77, 53, 0, 7, 825, 84, 64, 0,
955             7, 1021, 49, 19, 0, 7, 2657, 75, 95, 0, 7, 3116, 72, 86, 0, 7, 10580, 31, 64, 0,
956             7, 17068, 28, 68, 0, 3, 17068, 0, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0,
957             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0,
958             67
959         },
960 
961 
962         //Celestion G12M
963         {
964             2, 704, 64, 64, 0, 7, 64, 90, 111, 0, 7, 151, 69, 59, 0, 7, 1021, 56, 25, 0,
965             7, 1562, 56, 62, 0, 7, 2389, 71, 77, 0, 7, 5896, 53, 69, 0, 7, 6916, 59, 83, 0,
966             7, 7691, 52, 102, 0, 7, 9021, 43, 64, 0, 7, 15347, 32, 59, 0, 3, 17068, 1, 58, 0,
967             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 67
968         },
969 
970 
971         //Jensen Alnico P12-N
972         {
973             2, 270, 0, 0, 0, 7, 414, 46, 56, 0, 7, 1647, 46, 84, 0, 7, 7293, 53, 69, 0,
974             7, 10032, 43, 109, 0, 7, 12408, 41, 86, 0, 7, 14553, 41, 90, 0, 7, 17068, 35, 27, 0,
975             3, 17068, 64, 61, 0, 7, 4065, 71, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0,
976             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 67
977         },
978 
979         //Jensen Alnico P15-N
980         {
981             0, 600, 64, 64, 0, 2, 256, 64, 64, 0, 7, 414, 49, 43, 0, 7, 1832, 68, 58, 0,
982             7, 4065, 46, 92, 0, 7, 8111, 52, 75, 0, 7, 11766, 43, 83, 0, 3, 15347, 64, 41, 0,
983             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0,
984             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 67
985         },
986 
987         //Eminence Delta Demon
988         {
989             2, 68, 64, 64, 0, 7, 600, 55, 43, 0, 7, 1021, 72, 72, 0, 7, 1562, 68, 92, 0,
990             7, 2519, 66, 80, 0, 7, 6218, 52, 66, 0, 7, 9513, 43, 81, 0, 3, 10580, 64, 66, 0,
991             7, 12408, 58, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0,
992             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 67
993         },
994 
995         //Celestion EVH12
996         {
997             2, 151, 64, 64, 0, 7, 1481, 56, 64, 0, 7, 2519, 66, 87, 0, 7, 3116, 66, 92, 0,
998             7, 7293, 53, 87, 0, 7, 8554, 52, 87, 0, 7, 11157, 46, 59, 0, 3, 17068, 61, 30, 0,
999             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0,
1000             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 67
1001         },
1002 
1003         //Eminence Copperhead
1004 
1005         {
1006             2, 301, 64, 64, 0, 7, 301, 58, 77, 0, 7, 1077, 68, 74, 0, 7, 2519, 71, 77, 0,
1007             7, 6558, 55, 87, 0, 7, 7293, 58, 37, 0, 7, 15347, 13, 75, 0, 3, 17068, 50, 43, 0,
1008             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0,
1009             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 67
1010         },
1011 
1012         //Mesa Boogie
1013         {
1014             2, 600, 64, 64, 0, 7, 128, 93, 52, 0, 7, 633, 58, 80, 0, 7, 1077, 52, 89, 0,
1015             7, 1647, 66, 89, 0, 7, 2037, 75, 86, 0, 7, 3466, 75, 90, 0, 7, 6218, 62, 52, 0,
1016             7, 11157, 58, 71, 0, 3, 1404, 64, 47, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0,
1017             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 67
1018         },
1019 
1020         //Jazz-Chorus
1021         {
1022             4, 72, 0, 40, 0, 7, 72, 50, 43, 0, 7, 667, 38, 89, 0, 7, 3466, 77, 112, 0,
1023             7, 7293, 46, 93, 0, 7, 8111, 43, 105, 0, 7, 17068, 15, 40, 0, 3, 17068, 58, 55, 0,
1024             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0,
1025             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 67
1026         },
1027 
1028         //Vox-Bright
1029         {
1030             2, 1021, 64, 64, 0, 7, 243, 68, 72, 0, 7, 2657, 75, 41, 0, 7, 3466, 69, 96, 0,
1031             7, 4767, 74, 74, 0, 7, 6218, 44, 81, 0, 7, 8554, 52, 100, 0, 7, 13086, 46, 72, 0,
1032             7, 15347, 52, 62, 0, 3, 13800, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0,
1033             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 67
1034         },
1035 
1036         //Marshall-I
1037         {
1038             2, 4287, 53, 64, 0, 7, 122, 80, 25, 0, 7, 633, 69, 86, 0, 7, 1021, 78, 59, 0,
1039             7, 1647, 75, 64, 0, 7, 2389, 86, 78, 0, 7, 3286, 95, 61, 0, 7, 6916, 61, 59, 0,
1040             7, 8554, 56, 84, 0, 7, 12408, 22, 18, 0, 3, 10032, 64, 61, 0, 0, 64, 64, 64, 0,
1041             0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 0, 64, 64, 64, 0, 67
1042         }
1043 
1044 
1045     };
1046 
1047 
1048     if (npreset > (NUM_PRESETS -1))
1049         npreset = 0;
1050     for (int n = 0; n < 16; n++) {
1051         efx_Cabinet->changepar (n * 5 + 10, presets[npreset][n * 5]);
1052         efx_Cabinet->changepar (n * 5 + 11, presets[npreset][n * 5 + 1]);
1053         efx_Cabinet->changepar (n * 5 + 12, presets[npreset][n * 5 + 2]);
1054         efx_Cabinet->changepar (n * 5 + 13, presets[npreset][n * 5 + 3]);
1055         efx_Cabinet->changepar (n * 5 + 14, presets[npreset][n * 5 + 4]);
1056 
1057     }
1058 
1059     Cabinet_Preset = npreset;
1060 
1061     return (0);
1062 
1063 
1064 };
1065 
1066 
1067 
1068 
1069 
1070 void
EQ1_setpreset(int npreset)1071 RKR::EQ1_setpreset (int npreset)
1072 {
1073 
1074     const int PRESET_SIZE = 12;
1075     const int NUM_PRESETS = 3;
1076     int presets[NUM_PRESETS][PRESET_SIZE] = {
1077         //Plain
1078         {64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64},
1079         //Pop
1080         {78, 71, 64, 64, 64, 64, 64, 64, 71, 80, 64, 42},
1081         //Jazz
1082         {71, 68, 64, 64, 64, 64, 64, 64, 66, 69, 64, 40}
1083     };
1084 
1085     if (npreset >= NUM_PRESETS) {
1086         Fpre->ReadPreset(0,npreset-NUM_PRESETS+1);
1087         for (int n = 0; n < 10; n++)
1088             efx_EQ1->changepar (n * 5 + 12, pdata[n]);
1089         efx_EQ1->changepar (0, pdata[10]);
1090         for (int n = 0; n < 10; n++)
1091             efx_EQ1->changepar (n * 5 + 13, pdata[11]);
1092     } else {
1093         for (int n = 0; n < 10; n++)
1094             efx_EQ1->changepar (n * 5 + 12, presets[npreset][n]);
1095         efx_EQ1->changepar (0, presets[npreset][10]);
1096         for (int n = 0; n < 10; n++)
1097             efx_EQ1->changepar (n * 5 + 13, presets[npreset][11]);
1098     }
1099 };
1100 
1101 
1102 
1103 void
EQ2_setpreset(int npreset)1104 RKR::EQ2_setpreset (int npreset)
1105 {
1106 
1107 
1108     const int PRESET_SIZE = 10;
1109     const int NUM_PRESETS = 3;
1110     int presets[NUM_PRESETS][PRESET_SIZE] = {
1111         //Plain
1112         {72, 64, 64, 1077, 64, 64, 8111, 64, 64, 64},
1113         //Pop
1114         {72, 73, 45, 1077, 64, 64, 8111, 69, 38, 64},
1115         //Jazz
1116         {72, 71, 38, 1077, 64, 64, 10580, 69, 38, 64}
1117     };
1118 
1119 
1120     if (npreset >= NUM_PRESETS) {
1121 
1122         Fpre->ReadPreset(9,npreset-NUM_PRESETS+1);
1123         for (int n = 0; n < 3; n++) {
1124             efx_EQ2->changepar (n * 5 + 11, pdata[n * 3]);
1125             efx_EQ2->changepar (n * 5 + 12, pdata[n * 3 + 1]);
1126             efx_EQ2->changepar (n * 5 + 13, pdata[n * 3 + 2]);
1127         }
1128         efx_EQ2->changepar (0, pdata[9]);
1129     }
1130 
1131     else {
1132         for (int n = 0; n < 3; n++) {
1133             efx_EQ2->changepar (n * 5 + 11, presets[npreset][n * 3]);
1134             efx_EQ2->changepar (n * 5 + 12, presets[npreset][n * 3 + 1]);
1135             efx_EQ2->changepar (n * 5 + 13, presets[npreset][n * 3 + 2]);
1136         }
1137         efx_EQ2->changepar (0, presets[npreset][9]);
1138     }
1139 };
1140 
1141 
1142 void
add_metro()1143 RKR::add_metro()
1144 {
1145     for(int i=0; i<period; i++) {
1146 
1147         efxoutl[i] +=m_ticks[i]*M_Metro_Vol;
1148         efxoutr[i] +=m_ticks[i]*M_Metro_Vol;
1149 
1150     }
1151 
1152 }
1153 
1154 void
Vol2_Efx()1155 RKR::Vol2_Efx ()
1156 {
1157     memcpy(smpl,efxoutl, period * sizeof(float));
1158     memcpy(smpr,efxoutr, period * sizeof(float));
1159 }
1160 
1161 
1162 void
Vol3_Efx()1163 RKR::Vol3_Efx ()
1164 {
1165     int i;
1166     float att=2.0f;
1167 
1168     for (i = 0; i < period; i++) {
1169         efxoutl[i] *= att;
1170         efxoutr[i] *= att;
1171     }
1172 
1173     Vol2_Efx();
1174 
1175 }
1176 
1177 
1178 void
Vol_Efx(int NumEffect,float volume)1179 RKR::Vol_Efx (int NumEffect, float volume)
1180 {
1181     int i;
1182     float v1, v2;
1183 
1184     if (volume < 0.5f) {
1185         v1 = 1.0f;
1186         v2 = volume * 2.0f;
1187     } else {
1188         v1 = (1.0f - volume) * 2.0f;
1189         v2 = 1.0f;
1190     };
1191 
1192 
1193     if ((NumEffect == 8) || (NumEffect == 15))
1194         v2 *= v2;
1195 
1196     for (i = 0; i < period; i++) {
1197         efxoutl[i] = smpl[i] * v2 + efxoutl[i] * v1;
1198         efxoutr[i] = smpr[i] * v2 + efxoutr[i] * v1;
1199     };
1200 
1201     Vol2_Efx();
1202 
1203 }
1204 
1205 
1206 void
calculavol(int i)1207 RKR::calculavol (int i)
1208 {
1209 
1210     if (i == 1)
1211         Log_I_Gain = powf (Input_Gain * 2.0f, 4);
1212     if (i == 2)
1213         Log_M_Volume = powf (Master_Volume * 2.0f, 4);
1214 
1215 }
1216 
1217 int
checkforaux()1218 RKR::checkforaux()
1219 {
1220     int i;
1221 
1222     for(i=0; i<10; i++)
1223         if(efx_order[i]==35) {
1224             if (Vocoder_Bypass) return(1);
1225         }
1226 
1227     return(0);
1228 
1229 }
1230 void
Control_Gain(float * origl,float * origr)1231 RKR::Control_Gain (float *origl, float *origr)
1232 {
1233 
1234     int i;
1235     float il_sum = 1e-12f;
1236     float ir_sum = 1e-12f;
1237 
1238     float a_sum = 1e-12f;
1239 
1240     float temp_sum;
1241 
1242     float tmp;
1243 
1244 
1245 
1246 
1247 
1248 
1249 
1250     if(upsample) {
1251         U_Resample->out(origl,origr,efxoutl,efxoutr,J_PERIOD,u_up);
1252         if((checkforaux()) || (ACI_Bypass)) A_Resample->mono_out(auxdata,auxresampled,J_PERIOD,u_up,period);
1253     } else if((checkforaux()) || (ACI_Bypass)) memcpy(auxresampled,auxdata,sizeof(float)*J_PERIOD);
1254 
1255     if(DC_Offset) {
1256         DC_Offsetl->filterout(efxoutl);
1257         DC_Offsetr->filterout(efxoutr);
1258     }
1259 
1260 
1261 
1262     for (i = 0; i <= period; i++) {
1263         efxoutl[i] *= Log_I_Gain;
1264         efxoutr[i] *= Log_I_Gain;
1265         tmp = fabsf(efxoutr[i]);
1266         if (tmp > ir_sum) ir_sum = tmp;
1267         tmp = fabsf(efxoutl[i]);
1268         if (tmp > il_sum) il_sum = tmp;
1269 
1270 
1271     }
1272     memcpy(smpl,efxoutl,sizeof(float)*period);
1273     memcpy(smpr,efxoutr,sizeof(float)*period);
1274 
1275     temp_sum = (float)CLAMP (rap2dB (il_sum), -48.0, 15.0);
1276     val_il_sum = .6f * old_il_sum + .4f * temp_sum;
1277 
1278     temp_sum = (float)CLAMP (rap2dB (ir_sum), -48.0, 15.0);
1279     val_ir_sum = .6f * old_ir_sum + .4f * temp_sum;
1280 
1281     val_sum = val_il_sum + val_ir_sum;
1282 
1283 
1284     if((ACI_Bypass) && (Aux_Source==0)) {
1285         temp_sum = 0.0;
1286         tmp = 0.0;
1287         for (i = 0; i <= period; i++) {
1288             tmp = fabsf(auxresampled[i]);
1289             if (tmp > a_sum) a_sum = tmp;
1290         }
1291 
1292         val_a_sum = .6f * old_a_sum + .4f * a_sum;
1293         old_a_sum = val_a_sum;
1294     }
1295 
1296 
1297 
1298 
1299 
1300 
1301 }
1302 
1303 
1304 void
Control_Volume(float * origl,float * origr)1305 RKR::Control_Volume (float *origl,float *origr)
1306 {
1307     int i;
1308     float il_sum = 1e-12f;
1309     float ir_sum = 1e-12f;
1310 
1311     float temp_sum;
1312     float tmp;
1313     float Temp_M_Volume = 0.0f;
1314 
1315     if((flpos)&&(have_signal)) {
1316         if(db6booster) {
1317             for(i=0; i<period; i++) {
1318                 efxoutl[i] *=.5f;
1319                 efxoutr[i] *=.5f;
1320             }
1321         }
1322 
1323         efx_FLimiter->out(efxoutl, efxoutr);
1324 
1325         if(db6booster) {
1326             for(i=0; i<period; i++) {
1327                 efxoutl[i] *=2.0f;
1328                 efxoutr[i] *=2.0f;
1329             }
1330         }
1331 
1332 
1333     }
1334 
1335     memcpy(anall, efxoutl, sizeof(float)* period);
1336     memcpy(analr, efxoutr, sizeof(float)* period);
1337 
1338 
1339 
1340     if(upsample)
1341         D_Resample->out(anall,analr,efxoutl,efxoutr,period,u_down);
1342 
1343 
1344     if (OnCounter < t_periods) {
1345         Temp_M_Volume = Log_M_Volume / (float) (t_periods - OnCounter);
1346         OnCounter++;
1347     }
1348 
1349     else Temp_M_Volume = Log_M_Volume;
1350 
1351     for (i = 0; i <= period; i++) { //control volume
1352 
1353         efxoutl[i] *= Temp_M_Volume*booster;
1354         efxoutr[i] *= Temp_M_Volume*booster;
1355 
1356 
1357         if (Fraction_Bypass < 1.0f) {
1358             efxoutl[i]= (origl[i] * (1.0f - Fraction_Bypass) + efxoutl[i] * Fraction_Bypass);
1359             efxoutr[i]= (origr[i] * (1.0f - Fraction_Bypass) + efxoutr[i] * Fraction_Bypass);
1360         }
1361 
1362         tmp = fabsf (efxoutl[i]);
1363         if (tmp > il_sum) il_sum = tmp;
1364         tmp = fabsf (efxoutr[i]);
1365         if (tmp > ir_sum) ir_sum = tmp;
1366 
1367     }
1368 
1369     if ((!flpos) && (have_signal)) {
1370         if(db6booster) {
1371             for(i=0; i<period; i++) {
1372                 efxoutl[i] *=.5f;
1373                 efxoutr[i] *=.5f;
1374             }
1375         }
1376 
1377         efx_FLimiter->out(efxoutl, efxoutr);  //then limit final output
1378 
1379         if(db6booster) {
1380             for(i=0; i<period; i++) {
1381                 efxoutl[i] *=2.0f;
1382                 efxoutr[i] *=2.0f;
1383             }
1384         }
1385 
1386 
1387     }
1388 
1389 
1390     for (i = 0; i <= period; i++) {
1391 
1392         tmp = fabsf (efxoutl[i]);
1393         if (tmp > il_sum) il_sum = tmp;
1394         tmp = fabsf (efxoutr[i]);
1395         if (tmp > ir_sum) ir_sum = tmp;
1396     }
1397 
1398     temp_sum = (float) CLAMP(rap2dB (il_sum), -48, 15);
1399     val_vl_sum = .6f * old_vl_sum + .4f * temp_sum;
1400     temp_sum = (float) CLAMP(rap2dB (ir_sum), -48, 15);
1401     val_vr_sum = .6f * old_vr_sum + .4f * temp_sum;
1402 
1403     if ((il_sum+ir_sum) > 0.0004999f)  have_signal = 1;
1404     else  have_signal = 0;
1405 
1406 
1407 }
1408 
1409 
1410 
1411 void
cleanup_efx()1412 RKR::cleanup_efx ()
1413 {
1414 
1415 
1416     efx_EQ1->cleanup ();
1417     efx_Rev->cleanup ();
1418     efx_Distorsion->cleanup ();
1419     efx_Overdrive->cleanup ();
1420     efx_Compressor->cleanup ();
1421     efx_Echo->cleanup ();
1422     efx_Chorus->cleanup ();
1423     efx_Flanger->cleanup ();
1424     efx_Phaser->cleanup ();
1425     efx_EQ2->cleanup ();
1426     efx_WhaWha->cleanup ();
1427     efx_Alienwah->cleanup ();
1428     efx_Cabinet->cleanup ();
1429     efx_Pan->cleanup ();
1430     efx_Har->cleanup ();
1431     efx_MusDelay->cleanup ();
1432     efx_Gate->cleanup ();
1433     efx_NewDist->cleanup();
1434     efx_APhaser->cleanup();
1435     efx_Valve->cleanup();
1436     efx_DFlange->cleanup();
1437     efx_Ring->cleanup();
1438     efx_Exciter->cleanup();
1439     efx_MBDist->cleanup();
1440     efx_Arpie->cleanup();
1441     efx_Expander->cleanup();
1442     efx_Shuffle->cleanup();
1443     efx_Synthfilter->cleanup();
1444     efx_MBVvol->cleanup();
1445     efx_Convol->cleanup();
1446     efx_Looper->cleanup();
1447     efx_RyanWah->cleanup();
1448     efx_RBEcho->cleanup();
1449     efx_CoilCrafter->cleanup();
1450     efx_ShelfBoost->cleanup();
1451     efx_Vocoder->cleanup();
1452     efx_Sustainer->cleanup();
1453     efx_Sequence->cleanup();
1454     efx_Shifter->cleanup();
1455     efx_StompBox->cleanup();
1456     efx_Reverbtron->cleanup();
1457     efx_Echotron->cleanup();
1458     efx_StereoHarm->cleanup();
1459     efx_CompBand->cleanup();
1460     efx_Opticaltrem->cleanup();
1461     efx_Vibe->cleanup();
1462     RC->cleanup();
1463     efx_FLimiter->cleanup();
1464     efx_Infinity->cleanup();
1465 
1466 };
1467 
1468 
1469 void
Alg(float * inl1,float * inr1,float * origl,float * origr,void *)1470 RKR::Alg (float *inl1, float *inr1, float *origl, float *origr, void *)
1471 {
1472 
1473     int i;
1474     int reco=0;
1475     int ponlast=0;
1476     efxoutl = inl1;
1477     efxoutr = inr1;
1478 
1479     if((t_timeout) && (Tap_Bypass)) TapTempo_Timeout(1);
1480 
1481     if (Bypass) {
1482 
1483         Control_Gain (origl, origr);
1484 
1485         if(Metro_Bypass) M_Metronome->metronomeout(m_ticks);
1486 
1487         if((Tap_Bypass) && (Tap_Selection == 4)) {
1488             beat->detect(efxoutl,efxoutr);
1489             int bt_tempo=lrintf(beat->get_tempo());
1490             if((bt_tempo>19) && (bt_tempo<360) && (bt_tempo != Tap_TempoSet)) {
1491                 Tap_TempoSet=bt_tempo;
1492                 Update_tempo();
1493                 Tap_Display=1;
1494             }
1495 
1496         }
1497 
1498 
1499         if (Tuner_Bypass)
1500             efx_Tuner->schmittFloat (period, efxoutl, efxoutr);
1501 
1502         if (MIDIConverter_Bypass)
1503             efx_MIDIConverter->schmittFloat (period, efxoutl, efxoutr);
1504 
1505 
1506         if ((Harmonizer_Bypass) && (have_signal)) {
1507             if (efx_Har->mira) {
1508                 if ((efx_Har->PMIDI) || (efx_Har->PSELECT)) {
1509                     RecNote->schmittFloat (efxoutl, efxoutr);
1510                     reco=1;
1511                     if ((reconota != -1) && (reconota != last)) {
1512                         if(RecNote->afreq > 0.0) {
1513                             RC->Vamos (0,efx_Har->Pinterval - 12);
1514                             ponlast = 1;
1515                         }
1516                     }
1517                 }
1518             }
1519         }
1520 
1521 
1522         if ((StereoHarm_Bypass) && (have_signal)) {
1523             if (efx_StereoHarm->mira) {
1524                 if ((efx_StereoHarm->PMIDI) || (efx_StereoHarm->PSELECT)) {
1525                     if(!reco) RecNote->schmittFloat (efxoutl, efxoutr);
1526                     reco=1;
1527                     if ((reconota != -1) && (reconota != last)) {
1528                         if(RecNote->afreq > 0.0) {
1529                             RC->Vamos (1,efx_StereoHarm->Pintervall - 12);
1530                             RC->Vamos (2,efx_StereoHarm->Pintervalr - 12);
1531                             ponlast = 1;
1532                         }
1533                     }
1534                 }
1535             }
1536         }
1537 
1538 
1539         if((Ring_Bypass) && (efx_Ring->Pafreq)) {
1540             if(!reco) RecNote->schmittFloat (efxoutl, efxoutr);
1541             reco=1;
1542             if ((reconota != -1) && (reconota != last)) {
1543                 if(RecNote->afreq > 0.0) {
1544                     efx_Ring->Pfreq=lrintf(RecNote->lafreq);
1545                     ponlast = 1;
1546                 }
1547             }
1548         }
1549 
1550         if(ponlast) last=reconota;
1551 
1552         for (i = 0; i < 10; i++) {
1553             switch (efx_order[i]) {
1554             case 0:
1555                 if (EQ1_Bypass) {
1556                     efx_EQ1->out (efxoutl, efxoutr);
1557                     Vol2_Efx ();
1558                 }
1559                 break;
1560 
1561             case 1:
1562                 if (Compressor_Bypass) {
1563                     efx_Compressor->out (efxoutl, efxoutr);
1564                     Vol2_Efx ();
1565                 }
1566                 break;
1567 
1568             case 5:
1569                 if (Chorus_Bypass) {
1570                     efx_Chorus->out (efxoutl, efxoutr);
1571                     Vol_Efx (5, efx_Chorus->outvolume);
1572                 }
1573                 break;
1574 
1575             case 7:
1576                 if (Flanger_Bypass) {
1577                     efx_Flanger->out (efxoutl, efxoutr);
1578                     Vol_Efx (7, efx_Flanger->outvolume);
1579                 }
1580                 break;
1581 
1582             case 6:
1583                 if (Phaser_Bypass) {
1584                     efx_Phaser->out (efxoutl, efxoutr);
1585                     Vol_Efx (6, efx_Phaser->outvolume);
1586                 }
1587                 break;
1588 
1589             case 2:
1590                 if (Distorsion_Bypass) {
1591                     efx_Distorsion->out (efxoutl, efxoutr);
1592                     Vol_Efx (2, efx_Distorsion->outvolume);
1593                 }
1594                 break;
1595 
1596             case 3:
1597                 if (Overdrive_Bypass) {
1598                     efx_Overdrive->out (efxoutl, efxoutr);
1599                     Vol_Efx (3, efx_Overdrive->outvolume);
1600                 }
1601                 break;
1602 
1603             case 4:
1604                 if (Echo_Bypass) {
1605                     efx_Echo->out (efxoutl, efxoutr);
1606                     Vol_Efx (4, efx_Echo->outvolume);
1607                 }
1608                 break;
1609             case 8:
1610                 if (Reverb_Bypass) {
1611                     efx_Rev->out (efxoutl, efxoutr);
1612                     Vol_Efx (8, efx_Rev->outvolume);
1613                 }
1614                 break;
1615 
1616             case 9:
1617                 if (EQ2_Bypass) {
1618                     efx_EQ2->out (efxoutl, efxoutr);
1619                     Vol2_Efx ();
1620                 }
1621                 break;
1622 
1623             case 10:
1624                 if (WhaWha_Bypass) {
1625                     efx_WhaWha->out (efxoutl, efxoutr);
1626                     Vol_Efx (10, efx_WhaWha->outvolume);
1627                 }
1628                 break;
1629 
1630             case 11:
1631                 if (Alienwah_Bypass) {
1632                     efx_Alienwah->out (efxoutl, efxoutr);
1633                     Vol_Efx (11, efx_Alienwah->outvolume);
1634                 }
1635                 break;
1636 
1637             case 12:
1638                 if (Cabinet_Bypass) {
1639                     efx_Cabinet->out (efxoutl, efxoutr);
1640                     Vol3_Efx ();
1641                 }
1642 
1643                 break;
1644 
1645             case 13:
1646                 if (Pan_Bypass) {
1647                     efx_Pan->out (efxoutl, efxoutr);
1648                     Vol_Efx (13, efx_Pan->outvolume);
1649                 }
1650                 break;
1651 
1652             case 14:
1653                 if (Harmonizer_Bypass) {
1654                     efx_Har->out (efxoutl, efxoutr);
1655                     Vol_Efx (14, efx_Har->outvolume);
1656                 }
1657                 break;
1658 
1659             case 15:
1660                 if (MusDelay_Bypass) {
1661                     efx_MusDelay->out (efxoutl, efxoutr);
1662                     Vol_Efx (15, efx_MusDelay->outvolume);
1663                 }
1664                 break;
1665 
1666             case 16:
1667                 if (Gate_Bypass) {
1668                     efx_Gate->out (efxoutl, efxoutr);
1669                     Vol2_Efx ();
1670                 }
1671                 break;
1672 
1673             case 17:
1674                 if(NewDist_Bypass) {
1675                     efx_NewDist->out (efxoutl, efxoutr);
1676                     Vol_Efx(17,efx_NewDist->outvolume);
1677                 }
1678                 break;
1679 
1680             case 18:
1681                 if (APhaser_Bypass) {
1682                     efx_APhaser->out (efxoutl, efxoutr);
1683                     Vol_Efx (18, efx_APhaser->outvolume);
1684                 }
1685                 break;
1686 
1687             case 19:
1688                 if (Valve_Bypass) {
1689                     efx_Valve->out(efxoutl, efxoutr);
1690                     Vol_Efx (19, efx_Valve->outvolume);
1691                 }
1692                 break;
1693 
1694             case 20:
1695                 if (DFlange_Bypass) {
1696                     efx_DFlange->out(efxoutl, efxoutr);
1697                     Vol2_Efx ();
1698                 }
1699                 break;
1700 
1701             case 21:
1702                 if (Ring_Bypass) {
1703                     efx_Ring->out(efxoutl, efxoutr);
1704                     Vol_Efx (21,efx_Ring->outvolume);
1705                 }
1706                 break;
1707 
1708             case 22:
1709                 if (Exciter_Bypass) {
1710                     efx_Exciter->out(efxoutl, efxoutr);
1711                     Vol2_Efx();
1712                 }
1713                 break;
1714 
1715             case 23:
1716                 if (MBDist_Bypass) {
1717                     efx_MBDist->out(efxoutl, efxoutr);
1718                     Vol_Efx(23,efx_MBDist->outvolume);
1719                 }
1720                 break;
1721 
1722             case 24:
1723                 if (Arpie_Bypass) {
1724                     efx_Arpie->out(efxoutl, efxoutr);
1725                     Vol_Efx(24,efx_Arpie->outvolume);
1726                 }
1727                 break;
1728 
1729             case 25:
1730                 if (Expander_Bypass) {
1731                     efx_Expander->out(efxoutl, efxoutr);
1732                     Vol2_Efx();
1733                 }
1734                 break;
1735 
1736             case 26:
1737                 if (Shuffle_Bypass) {
1738                     efx_Shuffle->out(efxoutl, efxoutr);
1739                     Vol_Efx(26,efx_Shuffle->outvolume);
1740                 }
1741                 break;
1742 
1743             case 27:
1744                 if (Synthfilter_Bypass) {
1745                     efx_Synthfilter->out(efxoutl, efxoutr);
1746                     Vol_Efx(27,efx_Synthfilter->outvolume);
1747                 }
1748                 break;
1749 
1750             case 28:
1751                 if (MBVvol_Bypass) {
1752                     efx_MBVvol->out(efxoutl, efxoutr);
1753                     Vol_Efx(28,efx_MBVvol->outvolume);
1754                 }
1755                 break;
1756 
1757             case 29:
1758                 if (Convol_Bypass) {
1759                     efx_Convol->out(efxoutl, efxoutr);
1760                     Vol_Efx(29,efx_Convol->outvolume);
1761                 }
1762                 break;
1763 
1764             case 30:
1765                 if (Looper_Bypass) {
1766                     efx_Looper->out(efxoutl, efxoutr);
1767                     Vol_Efx(30,efx_Looper->outvolume);
1768                 }
1769                 break;
1770 
1771             case 31:
1772                 if (RyanWah_Bypass) {
1773                     efx_RyanWah->out(efxoutl, efxoutr);
1774                     Vol_Efx(31,efx_RyanWah->outvolume);
1775                 }
1776                 break;
1777 
1778             case 32:
1779                 if (RBEcho_Bypass) {
1780                     efx_RBEcho->out(efxoutl, efxoutr);
1781                     Vol_Efx(32,efx_RBEcho->outvolume);
1782                 }
1783                 break;
1784 
1785             case 33:
1786                 if (CoilCrafter_Bypass) {
1787                     efx_CoilCrafter->out(efxoutl, efxoutr);
1788                     Vol2_Efx();
1789                 }
1790                 break;
1791 
1792             case 34:
1793                 if (ShelfBoost_Bypass) {
1794                     efx_ShelfBoost->out(efxoutl, efxoutr);
1795                     Vol2_Efx();
1796                 }
1797                 break;
1798 
1799             case 35:
1800                 if (Vocoder_Bypass) {
1801                     efx_Vocoder->out(efxoutl, efxoutr);
1802                     Vol_Efx(35,efx_Vocoder->outvolume);
1803                 }
1804                 break;
1805 
1806             case 36:
1807                 if (Sustainer_Bypass) {
1808                     efx_Sustainer->out(efxoutl, efxoutr);
1809                     Vol2_Efx();
1810                 }
1811                 break;
1812 
1813             case 37:
1814                 if (Sequence_Bypass) {
1815                     efx_Sequence->out(efxoutl, efxoutr);
1816                     Vol_Efx(37,efx_Sequence->outvolume);
1817                 }
1818                 break;
1819 
1820             case 38:
1821                 if (Shifter_Bypass) {
1822                     efx_Shifter->out(efxoutl, efxoutr);
1823                     Vol_Efx(38,efx_Shifter->outvolume);
1824                 }
1825                 break;
1826 
1827             case 39:
1828                 if (StompBox_Bypass) {
1829                     efx_StompBox->out(efxoutl, efxoutr);
1830                     Vol2_Efx();
1831                 }
1832                 break;
1833 
1834             case 40:
1835                 if (Reverbtron_Bypass) {
1836                     efx_Reverbtron->out(efxoutl, efxoutr);
1837                     Vol_Efx(40,efx_Reverbtron->outvolume);
1838                 }
1839                 break;
1840 
1841             case 41:
1842                 if (Echotron_Bypass) {
1843                     efx_Echotron->out(efxoutl, efxoutr);
1844                     Vol_Efx(41,efx_Echotron->outvolume);
1845                 }
1846                 break;
1847 
1848             case 42:
1849                 if (StereoHarm_Bypass) {
1850                     efx_StereoHarm->out(efxoutl, efxoutr);
1851                     Vol_Efx(42,efx_StereoHarm->outvolume);
1852                 }
1853                 break;
1854 
1855             case 43:
1856                 if (CompBand_Bypass) {
1857                     efx_CompBand->out(efxoutl, efxoutr);
1858                     Vol_Efx(43,efx_CompBand->outvolume);
1859                 }
1860                 break;
1861 
1862             case 44:
1863                 if (Opticaltrem_Bypass) {
1864                     efx_Opticaltrem->out(efxoutl, efxoutr);
1865                     Vol2_Efx();
1866                 }
1867                 break;
1868 
1869             case 45:
1870                 if (Vibe_Bypass) {
1871                     efx_Vibe->out(efxoutl, efxoutr);
1872                     Vol_Efx(45,efx_Vibe->outvolume);
1873                 }
1874                 break;
1875 
1876             case 46:
1877                 if (Infinity_Bypass) {
1878                     efx_Infinity->out(efxoutl, efxoutr);
1879                     Vol_Efx(46,efx_Infinity->outvolume);
1880 
1881                 }
1882 
1883 
1884 
1885             }
1886 
1887         }
1888 
1889         if(Metro_Bypass) add_metro();
1890 
1891         Control_Volume (origl,origr);
1892 
1893     }
1894 
1895 }
1896 
1897