zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 6191b806cca170866cb08a6b2def2957359adb64
parent c498839072ed18d0aad05012705dcc2f3a7e5873
Author: fundamental <mark.d.mccurry@gmail.com>
Date:   Sat, 29 May 2010 12:41:17 -0400

Adding pan to aphaser

Diffstat:
Msrc/Effects/APhaser.cpp | 32++++++++++++++++++++++----------
Msrc/Effects/APhaser.h | 2++
Msrc/UI/EffUI.fl | 14+++++++-------
3 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/src/Effects/APhaser.cpp b/src/Effects/APhaser.cpp @@ -120,7 +120,8 @@ void Analog_Phaser::out(const Stereo<REALTYPE *> &input) g.l += diff.l;// Linear interpolation between LFO samples g.r += diff.r; - Stereo<REALTYPE> xn(input.l[i], input.r[i]); + Stereo<REALTYPE> xn(input.l[i] * panning, + input.r[i] * (1.0f - panning)); if (barber) { g.l = fmodf((g.l + 0.25f), ONE_); @@ -195,6 +196,12 @@ void Analog_Phaser::setwidth(unsigned char Pwidth) width = ((float)Pwidth / 127.0f); } +void Analog_Phaser::setpanning(unsigned char Ppanning) +{ + this->Ppanning = Ppanning; + panning = (float)Ppanning / 127.0; +} + void Analog_Phaser::setfb(unsigned char Pfb) { @@ -257,21 +264,21 @@ void Analog_Phaser::setdepth(unsigned char Pdepth) void Analog_Phaser::setpreset(unsigned char npreset) { - const int PRESET_SIZE = 13; + const int PRESET_SIZE = 14; const int NUM_PRESETS = 6; unsigned char presets[NUM_PRESETS][PRESET_SIZE] = { //Phaser1 - {64, 20, 14, 0, 1, 64, 110, 40, 4, 10, 0, 64, 1}, + {64, 64, 14, 0, 1, 64, 110, 40, 4, 10, 0, 64, 1, 20}, //Phaser2 - {64, 20, 14, 5, 1, 64, 110, 40, 6, 10, 0, 70, 1}, + {64, 64, 14, 5, 1, 64, 110, 40, 6, 10, 0, 70, 1, 20}, //Phaser3 - {64, 20, 9, 0, 0, 64, 40, 40, 8, 10, 0, 60, 0}, + {64, 64, 9, 0, 0, 64, 40, 40, 8, 10, 0, 60, 0, 20}, //Phaser4 - {64, 20, 14, 10, 0, 64, 110, 80, 7, 10, 1, 45, 1}, + {64, 64, 14, 10, 0, 64, 110, 80, 7, 10, 1, 45, 1, 20}, //Phaser5 - {25, 20, 240, 10, 0, 64, 25, 16, 8, 100, 0, 25, 0}, + {25, 64, 127, 10, 0, 64, 25, 16, 8, 100, 0, 25, 0, 20}, //Phaser6 - {64, 20, 1, 10, 1, 64, 110, 40, 12, 10, 0, 70, 1} + {64, 64, 1, 10, 1, 64, 110, 40, 12, 10, 0, 70, 1, 20} }; if(npreset >= NUM_PRESETS) npreset = NUM_PRESETS - 1; @@ -288,7 +295,7 @@ void Analog_Phaser::changepar(int npar, unsigned char value) setvolume(value); break; case 1: - setdistortion(value); + setpanning(value); break; case 2: lfo.Pfreq = value; @@ -328,6 +335,9 @@ void Analog_Phaser::changepar(int npar, unsigned char value) case 12: Phyper = min((int)value, 1); break; + case 13: + setdistortion(value); + break; } } @@ -337,7 +347,7 @@ unsigned char Analog_Phaser::getpar(int npar) const case 0: return Pvolume; case 1: - return Pdistortion; + return Ppanning; case 2: return lfo.Pfreq; case 3: @@ -360,6 +370,8 @@ unsigned char Analog_Phaser::getpar(int npar) const return Pdepth; case 12: return Phyper; + case 13: + return Pdistortion; default: return 0; } diff --git a/src/Effects/APhaser.h b/src/Effects/APhaser.h @@ -47,6 +47,7 @@ class Analog_Phaser:public Effect //Phaser parameters EffectLFO lfo; //Phaser modulator unsigned char Pvolume; //Used to set wet/dry mix + unsigned char Ppanning; //Sets the pan of the output unsigned char Pdistortion; //Model distortion added by FET element unsigned char Pwidth; //Phaser width (LFO amplitude) unsigned char Pfb; //feedback @@ -60,6 +61,7 @@ class Analog_Phaser:public Effect //Control parameters void setvolume(unsigned char Pvolume); + void setpanning(unsigned char Ppanning); void setdistortion(unsigned char Pdistortion); void setwidth(unsigned char Pwidth); void setfb(unsigned char Pfb); diff --git a/src/UI/EffUI.fl b/src/UI/EffUI.fl @@ -585,7 +585,7 @@ refresh(eff);} } Function {make_phaser_window()} {open } { - Fl_Window effphaserwindow {open selected + Fl_Window effphaserwindow {open xywh {75 25 380 95} type Double box PLASTIC_UP_BOX color 221 labelfont 1 class Fl_Group visible } { @@ -753,9 +753,9 @@ refresh(eff);} class WidgetPDial } Fl_Dial aphaser1 { - label dist + label Pan callback {eff->seteffectpar(1,(int) o->value());} - tooltip Distortion xywh {85 5 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 + xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 class WidgetPDial } Fl_Dial aphaser2 { @@ -830,10 +830,10 @@ refresh(eff);} callback {eff->seteffectpar(12,(int) o->value());} tooltip hyper xywh {245 35 55 15} down_box DOWN_BOX } - Fl_Dial aphaser2 { - label Pan - callback {eff->seteffectpar(2,(int) o->value());} - xywh {45 40 30 30} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 + Fl_Dial aphaser13 { + label dist + callback {eff->seteffectpar(13,(int) o->value());} selected + tooltip Distortion xywh {85 5 25 25} box ROUND_UP_BOX labelfont 1 labelsize 11 maximum 127 class WidgetPDial } Fl_Check_Button {} {