zynaddsubfx

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

commit 3a1b2c8c80e33c865f9cf872341873e8adc580ae
parent 5d59273916eba8cc38f8fd7bf8fc6c6708cfe788
Author: paulnasca <paulnasca>
Date:   Tue, 31 Oct 2006 20:48:57 +0000

*** empty log message ***

Diffstat:
MChangeLog | 5++++-
Msrc/Makefile | 2+-
Msrc/Misc/Config.C | 2+-
Msrc/Misc/Master.C | 53+++++++++++++++++++++++++++--------------------------
Msrc/Misc/Util.C | 2+-
Msrc/Synth/OscilGen.C | 110++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/UI/PartUI.fl | 14+++++++-------
7 files changed, 96 insertions(+), 92 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -808,6 +808,9 @@ 30 Oct 2006 - Adaugat un patch "standalone zombie fix stripped from Lars" - Adaugat un patch "Extended mono" si "font resizing stuff" de Gerald Folcher 31 Oct 2006 - Adaugat un patch "Extended mono v.3" de Gerald Folcher - + - Inlocuit fl_ask cu fl_choice in fisierele .fl + - In mod prestabilit nu se mai seteaza volumul la efectul 0 + - Efectele sunt numerotare de la 1 si in la "send to" din partui + diff --git a/src/Makefile b/src/Makefile @@ -3,7 +3,7 @@ include Makefile.inc ifneq ($(MAKECMDGOALS),debug) CXXFLAGS= -O6 -Wall else - CXXFLAGS= -O0 -Wall -Wpointer-arith -Wstrict-prototypes + CXXFLAGS= -O0 -Wall -Wpointer-arith endif CXXFLAGS += -DOS_$(OS_PORT) -D$(MIDIIN)MIDIIN -DFFTW_VERSION_$(FFTW_VERSION) -DASM_F2I_$(ASM_F2I) diff --git a/src/Misc/Config.C b/src/Misc/Config.C @@ -39,7 +39,7 @@ void Config::init(){ //defaults cfg.SampleRate=44100; cfg.SoundBufferSize=256; - cfg.OscilSize=512; + cfg.OscilSize=1024; cfg.SwapStereo=0; cfg.LinuxOSSWaveOutDev=new char[MAX_STRING_SIZE]; diff --git a/src/Misc/Master.C b/src/Misc/Master.C @@ -73,36 +73,37 @@ Master::Master(){ }; void Master::defaults(){ - volume=1.0; - setPvolume(80); - setPkeyshift(64); - - for (int npart=0;npart<NUM_MIDI_PARTS;npart++){ - part[npart]->defaults(); - part[npart]->Prcvchn=npart%NUM_MIDI_CHANNELS; - }; - - partonoff(0,1);//enable the first part + volume=1.0; + setPvolume(80); + setPkeyshift(64); - for (int nefx=0;nefx<NUM_INS_EFX;nefx++) { - insefx[nefx]->defaults(); - Pinsparts[nefx]=-1; - }; - - //System Effects init - for (int nefx=0;nefx<NUM_SYS_EFX;nefx++) { - sysefx[nefx]->defaults(); for (int npart=0;npart<NUM_MIDI_PARTS;npart++){ - if (nefx==0) setPsysefxvol(npart,nefx,64); - else setPsysefxvol(npart,nefx,0); + part[npart]->defaults(); + part[npart]->Prcvchn=npart%NUM_MIDI_CHANNELS; + }; + + partonoff(0,1);//enable the first part + + for (int nefx=0;nefx<NUM_INS_EFX;nefx++) { + insefx[nefx]->defaults(); + Pinsparts[nefx]=-1; }; - for (int nefxto=0;nefxto<NUM_SYS_EFX;nefxto++) - setPsysefxsend(nefx,nefxto,0); - }; - sysefx[0]->changeeffect(1); - microtonal.defaults(); - ShutUp(); + //System Effects init + for (int nefx=0;nefx<NUM_SYS_EFX;nefx++) { + sysefx[nefx]->defaults(); + for (int npart=0;npart<NUM_MIDI_PARTS;npart++){ + //if (nefx==0) setPsysefxvol(npart,nefx,64); + //else + setPsysefxvol(npart,nefx,0); + }; + for (int nefxto=0;nefxto<NUM_SYS_EFX;nefxto++) + setPsysefxsend(nefx,nefxto,0); + }; + +// sysefx[0]->changeeffect(1); + microtonal.defaults(); + ShutUp(); }; /* diff --git a/src/Misc/Util.C b/src/Misc/Util.C @@ -33,7 +33,7 @@ int SAMPLE_RATE=44100; int SOUND_BUFFER_SIZE=256; -int OSCIL_SIZE=512; +int OSCIL_SIZE=1024; Config config; REALTYPE *denormalkillbuf; diff --git a/src/Synth/OscilGen.C b/src/Synth/OscilGen.C @@ -719,67 +719,67 @@ void OscilGen::prepare(){ }; void OscilGen::adaptiveharmonic(FFTFREQS f,REALTYPE freq){ - if ((Padaptiveharmonics==0)/*||(freq<1.0)*/) return; - if (freq<1.0) freq=440.0; + if ((Padaptiveharmonics==0)/*||(freq<1.0)*/) return; + if (freq<1.0) freq=440.0; - FFTFREQS inf; - newFFTFREQS(&inf,OSCIL_SIZE/2); - for (int i=0;i<OSCIL_SIZE/2;i++) { - inf.s[i]=f.s[i]; - inf.c[i]=f.c[i]; - f.s[i]=0.0; - f.c[i]=0.0; - }; - inf.c[0]=0.0;inf.s[0]=0.0; - - REALTYPE hc=0.0,hs=0.0; - REALTYPE basefreq=30.0*pow(10.0,Padaptiveharmonicsbasefreq/128.0); - REALTYPE power=(Padaptiveharmonicspower+1.0)/101.0; - - REALTYPE rap=freq/basefreq; + FFTFREQS inf; + newFFTFREQS(&inf,OSCIL_SIZE/2); + for (int i=0;i<OSCIL_SIZE/2;i++) { + inf.s[i]=f.s[i]; + inf.c[i]=f.c[i]; + f.s[i]=0.0; + f.c[i]=0.0; + }; + inf.c[0]=0.0;inf.s[0]=0.0; - rap=pow(rap,power); + REALTYPE hc=0.0,hs=0.0; + REALTYPE basefreq=30.0*pow(10.0,Padaptiveharmonicsbasefreq/128.0); + REALTYPE power=(Padaptiveharmonicspower+1.0)/101.0; - bool down=false; - if (rap>1.0) { - rap=1.0/rap; - down=true; - }; - - for (int i=0;i<OSCIL_SIZE/2-2;i++){ - REALTYPE h=i*rap; - int high=(int)(i*rap); - REALTYPE low=fmod(h,1.0); + REALTYPE rap=freq/basefreq; - if (high>=(OSCIL_SIZE/2-2)){ - break; - } else { - if (down){ - f.c[high]+=inf.c[i]*(1.0-low); - f.s[high]+=inf.s[i]*(1.0-low); - f.c[high+1]+=inf.c[i]*low; - f.s[high+1]+=inf.s[i]*low; - } else { - hc=inf.c[high]*(1.0-low)+inf.c[high+1]*low; - hs=inf.s[high]*(1.0-low)+inf.s[high+1]*low; - }; - if (fabs(hc)<0.000001) hc=0.0; - if (fabs(hs)<0.000001) hs=0.0; + rap=pow(rap,power); + + bool down=false; + if (rap>1.0) { + rap=1.0/rap; + down=true; }; - - if (!down){ - if (i==0) {//corect the aplitude of the first harmonic - hc*=rap; - hs*=rap; - }; - f.c[i]=hc; - f.s[i]=hs; + + for (int i=0;i<OSCIL_SIZE/2-2;i++){ + REALTYPE h=i*rap; + int high=(int)(i*rap); + REALTYPE low=fmod(h,1.0); + + if (high>=(OSCIL_SIZE/2-2)){ + break; + } else { + if (down){ + f.c[high]+=inf.c[i]*(1.0-low); + f.s[high]+=inf.s[i]*(1.0-low); + f.c[high+1]+=inf.c[i]*low; + f.s[high+1]+=inf.s[i]*low; + } else { + hc=inf.c[high]*(1.0-low)+inf.c[high+1]*low; + hs=inf.s[high]*(1.0-low)+inf.s[high+1]*low; + }; + if (fabs(hc)<0.000001) hc=0.0; + if (fabs(hs)<0.000001) hs=0.0; + }; + + if (!down){ + if (i==0) {//corect the aplitude of the first harmonic + hc*=rap; + hs*=rap; + }; + f.c[i]=hc; + f.s[i]=hs; + }; }; - }; - - f.c[1]+=f.c[0];f.s[1]+=f.s[0]; - f.c[0]=0.0;f.s[0]=0.0; - deleteFFTFREQS(&inf); + + f.c[1]+=f.c[0];f.s[1]+=f.s[0]; + f.c[0]=0.0;f.s[0]=0.0; + deleteFFTFREQS(&inf); }; void OscilGen::adaptiveharmonicpostprocess(REALTYPE *f,int size){ diff --git a/src/UI/PartUI.fl b/src/UI/PartUI.fl @@ -42,9 +42,9 @@ decl {\#include "../Misc/Master.h"} {public decl {\#include "../Misc/Part.h"} {public } -class PartSysEffSend {: {public Fl_Group} +class PartSysEffSend {open : {public Fl_Group} } { - Function {make_window()} {private + Function {make_window()} {open private } { Fl_Window syseffsend { private xywh {584 83 90 35} type Double hide @@ -52,11 +52,11 @@ class PartSysEffSend {: {public Fl_Group} } { Fl_Dial {} { label 01 - callback {master->setPsysefxvol(npart,neff,(int) o->value());} + callback {master->setPsysefxvol(npart,neff,(int) o->value());} selected xywh {0 0 25 25} box ROUND_UP_BOX labelfont 1 labelsize 10 align 130 maximum 127 step 1 code0 {o->size(25,25);} code1 {o->value(master->Psysefxvol[neff][npart]);} - code2 {char tmp[10];snprintf(tmp,10,"%d",neff);o->label(strdup(tmp));} + code2 {char tmp[10];snprintf(tmp,10,"%d",neff+1);o->label(strdup(tmp));} class WidgetPDial } } @@ -279,8 +279,8 @@ class PartUI {open : {public Fl_Group,PartUI_} Function {make_window()} {open private } { Fl_Window partgroup { - private xywh {424 178 385 180} type Double - class Fl_Group visible + private xywh {424 178 385 180} type Double hide + class Fl_Group } { Fl_Group partgroupui { xywh {0 0 385 180} @@ -377,7 +377,7 @@ if (part->Pminkey>part->Pmaxkey) o->textcolor(FL_RED); } Fl_Check_Button {} { label Portamento - callback {part->ctl.portamento.portamento=(int) o->value();} selected + callback {part->ctl.portamento.portamento=(int) o->value();} tooltip {Enable/Disable the portamento} xywh {95 155 88 20} down_box DOWN_BOX labelfont 1 labelsize 11 code0 {o->value(part->ctl.portamento.portamento);} }