form caption("Slot Demo") size(220, 400), guiMode("queue") pluginId("tnbd")
rslider bounds(10, 5, 50, 50), channel("gain"), range(0, 1, 0, 1, .01), text("Gain"), trackerColour("lime"), outlineColour(0, 0, 0, 50), textColour("black")
-n -d -+rtmidi=NULL -M0 -m0d
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
//#GUI Opcodes
opcode slotDial, Sk,SSiiSSoo
SContainerName,SparamName, icol, irow, Sgui, SlabelGui, iw, ih xin
if ih == 0 then
ih = 2
endif
if iw == 0 then
iw = 4
endif
Sdial sprintf "%s_%s" , SContainerName , SparamName
Screate sprintf "channel(%s) parent(%s) %s", Sdial, SContainerName, Sgui
cabbageCreate "rslider", Screate
Slabel sprintf "%s_%sl" , SContainerName , SparamName
Screate sprintf "channel(%s) parent(%s) text(%s) fontColour(white) %s", Slabel, SContainerName, SparamName, SlabelGui
cabbageCreate "label", Screate
iBounds[] cabbageGet SContainerName, "bounds"
cabbageSet Sdial, "bounds", icol*iBounds[2]/iw+iBounds[2]/(iw*6), irow*iBounds[3]/ih+iBounds[3]/(ih*6), iBounds[2]/(iw*1.5), iBounds[3]/(ih*1.25)
cabbageSet Slabel, "bounds", icol*iBounds[2]/iw+iBounds[2]/(iw*6), irow*iBounds[3]/ih, iBounds[2]/(iw*1.5), iBounds[3]/(ih*4)
kVal cabbageGetValue Sdial
xout Sdial, kVal
endop
opcode slotDial, k, SSiiSSoo
SContainerName,SparamName, icol, irow, Sgui, SlabelGui, iw, ih xin
Sdummy, kval slotDial SContainerName,SparamName, icol, irow, Sgui, SlabelGui, iw, ih
xout kval
endop
opcode slotSelect, Sk,SSiiSSoo
/* Creates a combobox takes up 2 columns */
SContainerName,SparamName, icol, irow, Sgui, SlabelGui, iw, ih xin
if ih == 0 then
ih = 2
endif
if iw == 0 then
iw = 4
endif
Sbox sprintf "%s_%s" , SContainerName , SparamName
Screate sprintf "channel(%s) parent(%s) %s", Sbox, SContainerName, Sgui
cabbageCreate "combobox", Screate
Slabel sprintf "%s_%sl" , SContainerName , SparamName
Screate sprintf "channel(%s) parent(%s) text(%s) fontColour(white) %s", Slabel, SContainerName, SparamName, SlabelGui
cabbageCreate "label", Screate
iBounds[] cabbageGet SContainerName, "bounds"
cabbageSet Sbox, "bounds", icol*iBounds[2]/(iw)+iBounds[2]/(iw*6), irow*iBounds[3]/ih+iBounds[3]/(ih*6)+iBounds[3]/(ih*8), iBounds[2]/(iw*1.5)*2.5, iBounds[3]/(ih*2)
cabbageSet Slabel, "bounds", icol*iBounds[2]/iw+iBounds[2]/(iw*6), irow*iBounds[3]/(ih)+iBounds[3]/(ih*16), iBounds[2]/(iw*1.5)*2.5, iBounds[3]/(ih*4)
kVal cabbageGetValue Sbox
xout Sbox, kVal
endop
opcode slotSelect, k, SSiiSSoo
SContainerName,SparamName, icol, irow, Sgui, SlabelGui, iw, ih xin
Sdummy, kval slotSelect SContainerName,SparamName, icol, irow, Sgui, SlabelGui, iw, ih
xout kval
endop
//#DELAY SLOT
opcode slotDelay, aa, aaSikk
aL, aR, Sname, iIndex, kSelect, kBypass xin
iIndex += 1
//Create image container
SFXname = "delay"
SContainerName sprintf "%s_%s", Sname, SFXname
iBounds[] cabbageGet sprintf("%s_slot",Sname), "bounds"
Screate sprintf "bounds(0,0,%f,%f), channel(%s) visible(0) colour(0,0,255) parent(%s_slot)", iBounds[2], iBounds[3], SContainerName, Sname
cabbageCreate "image", Screate
//GUI Code
SlabelFormat = "fontColour(white)"
Stime, kdelayTime slotDial SContainerName, "time", 0, 0, "range(0.1,2000,100,0.5,0.1)", SlabelFormat
Sfeedback, kFeedback slotDial SContainerName, "fb", 1, 0, "range(0,1,0,1,0.01)", SlabelFormat
/*
SparamName = "mode"
SMode sprintf "%s_%s" , SContainerName , SparamName
Screate sprintf "channel(%s) parent(%s) caption(%s) items(stereo, pingpong)", SMode, SContainerName, SparamName
cabbageCreate "combobox", Screate
cabbageSet SMode, "bounds", 95,2,75,16
*/
SMode, kMode slotSelect SContainerName, "mode", 2,0,"items(stereo,pingpong) fontColour(white)", ""
//Toggle Visibility
if changed2:k(kSelect) == 1 then
if kSelect == iIndex then
cabbageSet k(1), SContainerName, "visible(1)"
else
cabbageSet k(1), SContainerName, "visible(0)"
endif
endif
if kSelect == iIndex && kBypass != 0 then
//DSP Code Goes Here
aFbL init 0
aFbR init 0
aL vdelay3 aL+aFbL, kdelayTime, 5000
aR vdelay3 aR+aFbR, kdelayTime, 5000
aFbL = aL*port(kFeedback,0.1)
aFbR = aL*port(kFeedback,0.1)
if kMode ==2 then
aFbtmp = aFbL
aFbL= aFbR
aFbR= aFbtmp
endif
endif
xout aL, aR
endop
//#CHORUS SLOT
opcode slotChorus, aa, aaSikk
aL, aR, Sname, iIndex, kSelect, kBypass xin
iIndex += 1
//Create image container
SFXname = "chorus"
SContainerName sprintf "%s_%s", Sname, SFXname
iBounds[] cabbageGet sprintf("%s_slot",Sname), "bounds"
Screate sprintf "bounds(0,0,%f,%f), channel(%s) visible(0) colour(150,0,255) parent(%s_slot)", iBounds[2], iBounds[3], SContainerName, Sname
cabbageCreate "image", Screate
//GUI Code
SlabelFormat = "fontColour(white)"
Stime, kdelayTime slotDial SContainerName, "time", 0, 0, "range(0.1,2000,100,0.5,0.1)", SlabelFormat
Sfeedback, kFeedback slotDial SContainerName, "fb", 1, 0, "range(0,1,0, 1 ,0.001)", SlabelFormat
SDepth, kDepth slotDial SContainerName, "depth", 2, 0, "range(0,50,0, 0.5 , 0.001)", SlabelFormat
SFreq, kFreq slotDial SContainerName, "freq", 3, 0, "range(0.01,25,0, 0.25 , 0.01)",SlabelFormat
SRDepth, kRDepth slotDial SContainerName, "rDepth", 2, 1, "range(0,1,0, 1 , 0.01)",sprintf("%s %s", SlabelFormat, "text(rnd)")
//Toggle Visibility
if changed2:k(kSelect) == 1 then
if kSelect == iIndex then
cabbageSet k(1), SContainerName, "visible(1)"
else
cabbageSet k(1), SContainerName, "visible(0)"
endif
endif
if kSelect == iIndex && kBypass != 0 then
//DSP Code Goes Here
kchFB = kFeedback
kchdel = kdelayTime
kchdepth = kDepth
kchcps = kFreq
kchrand = 0
achorusFBL init 0
achorusFBR init 0
afeedL=aL+achorusFBL
afeedR=aR+achorusFBR
kdepthrand=kchdepth*kchrand*.001
kchdel=kchdel*.001
kcpsrand=kchcps*kchrand
kchcps randomi kchcps-kcpsrand,kchcps+kcpsrand,kchcps
kchdepth randomi kchdepth-kdepthrand,kchdepth+kdepthrand,kchcps
kchdepth port kchdepth,.1
ardelL oscili kchdepth,kchcps,25
ardelR oscili kchdepth,kchcps,25,.25
ardel3 oscili kchdepth,kchcps,25,.5
ardel4 oscili kchdepth,kchcps,25,.75
ardelL=ardelL+(kchdepth*2.1+kchdel)
ardelR=ardelR+(kchdepth*2.1+kchdel)
ardel3=ardel3+(kchdepth*2.1+kchdel)
ardel4=ardel4+(kchdepth*2.1+kchdel)
amodL vdelay afeedL,ardelL,200
amodR vdelay afeedR,ardelR,200
amod3 vdelay afeedL*.33+afeedR*.66,ardel3,200
amod4 vdelay afeedR*.33+afeedL*.66,ardel4,200
achorusFBL=dcblock(((amodL*.6)+(amod4*.3)+(amod3*.15))*-kchFB)
achorusFBR=dcblock(((amodR*.6)+(amod3*.3)+(amod4*.15))*-kchFB)
aL= afeedL*.7+amodL
aR= afeedR*.7+amodR
endif
xout aL, aR
endop
//#HARMONIZER
opcode slotHarmonizer, aa, aaSikk
aL, aR, Sname, iIndex, kSelect, kBypass xin
iIndex += 1
//Create image container
SFXname = "template"
SContainerName sprintf "%s_%s", Sname, SFXname
iBounds[] cabbageGet sprintf("%s_slot",Sname), "bounds"
Screate sprintf "bounds(0,0,%f,%f), channel(%s) visible(0) colour(0,0,255) parent(%s_slot)", iBounds[2], iBounds[3], SContainerName, Sname
cabbageCreate "image", Screate
//GUI Code
kPitch slotDial SContainerName, "pitch", 0, 0, "range(-12,12,0,1,0.1)", "", 3,2
kPitchR slotDial SContainerName, "pitch rnd", 0, 1, "range(0,12,0,1,0.1)", "", 3,2
kVibRate slotDial SContainerName, "vib rate", 1, 0, "range(0,20,0,1,0.1)", "", 3,2
kVibDepth slotDial SContainerName, "vib depth", 1, 1, "range(0,12,0,0.5,0.1)", "", 3,2
kfb slotDial SContainerName, "fb", 2, 0, "range(0,1,0,1,0.01)", "", 3,2
//Toggle Visibility
if changed2:k(kSelect) == 1 then
if kSelect == iIndex then
cabbageSet k(1), SContainerName, "visible(1)"
else
cabbageSet k(1), SContainerName, "visible(0)"
endif
endif
if kSelect == iIndex && kBypass != 0 then
//DSP Code Goes Here
afbL init 0
afbR init 0
ideltabL ftgenonce 0, 0, 1*sr, 7, 0
ideltabR ftgenonce 0, 0, 1*sr, 7, 0
iwindow ftgenonce 0, 0, 4096, 20, 2
idelay = 1
kPitch init 0
ktranspose init 0
ktranspose port kPitch, 0.01
ktranspose += random(-kPitchR, kPitchR)
klfohz = 10
iminDelay = ksmps/sr
klfoperiod = 1/klfohz
krate = ktranspose/12
aclock phasor klfohz
aclock2 = wrap(aclock+0.5,0,1)
aVibAmount = kVibDepth/12
if krate < 0 then
astart = iminDelay+aVibAmount*-klfoperiod
atarget = -klfoperiod*(krate+aVibAmount)+iminDelay
else
astart = klfoperiod*(krate+aVibAmount)+iminDelay
atarget = iminDelay+aVibAmount*klfoperiod
endif
atrig = limit(aclock-0.999,0,1)
astart1 samphold astart, atrig , 0
aVibAmount1 samphold aVibAmount, atrig, 0
atargetDelay1 samphold atarget, atrig, 0
atrig = limit(aclock2-0.999,0,1)
astart2 samphold astart, atrig, 0
aVibAmount2 samphold aVibAmount, atrig, 0
atargetDelay2 samphold atarget, atrig, 0
aVib1 oscil aVibAmount1*klfoperiod, kVibRate
aVib2 oscil aVibAmount2*klfoperiod, kVibRate
adummy delayr idelay
av1 deltapi (1-aclock)*(astart1)+aclock*atargetDelay1+aVib1
aenv1 tablei limit(aclock*1.05,0,1), iwindow, 1
av1 *= aenv1
av2 deltapi (1-aclock2)*(astart2)+aclock2*atargetDelay2+aVib2
aenv2 tablei limit(aclock2*1.05,0,1), iwindow, 1
av2*= aenv2
aLOut = av1+av2
delayw aL + afbL
adummy delayr idelay
av1 deltapi (1-aclock)*(astart1)+aclock*atargetDelay1+aVib1
aenv1 tablei limit(aclock*1.05,0,1), iwindow, 1
av1 *= aenv1
av2 deltapi (1-aclock2)*(astart2)+aclock2*atargetDelay2+aVib2
aenv2 tablei limit(aclock2*1.05,0,1), iwindow, 1
av2*= aenv2
aROut = av1+av2
delayw aR + afbR
aL = aLOut
aR = aROut
kfbsmooth port kfb, 0.01
afbL = aLOut*kfbsmooth
afbR = aROut*kfbsmooth
endif
xout aL, aR
endop
//#FREEVERB SLOT
opcode slotFreeverb, aa, aaSikk
aL, aR, Sname, iIndex, kSelect, kBypass xin
iIndex += 1
//Create image container
SFXname = "freeverb"
SContainerName sprintf "%s_%s", Sname, SFXname
iBounds[] cabbageGet sprintf("%s_slot",Sname), "bounds"
Screate sprintf "bounds(0,0,%f,%f), channel(%s) visible(0) colour(0,0,255) parent(%s_slot)", iBounds[2], iBounds[3], SContainerName, Sname
cabbageCreate "image", Screate
//GUI Code
SpreGain, kpreGain slotDial SContainerName, "pre-gain", 0, 0, "range(-48,48,0,1,0.1)", "",3,2
SpostGain, kpostGain slotDial SContainerName, "post-gain", 1, 0, "range(-48,48,0,1,0.1)", "",3,2
SroomSize, kroomSize slotDial SContainerName, "size", 0, 1, "range(0,1,0.5,1,0.01)", "",3,2
Sdamp, kdamp slotDial SContainerName, "damp", 1, 1, "range(0,1,0,1,0.01)", "",3,2
//Toggle Visibility
if changed2:k(kSelect) == 1 then
if kSelect == iIndex then
cabbageSet k(1), SContainerName, "visible(1)"
else
cabbageSet k(1), SContainerName, "visible(0)"
endif
endif
if kSelect == iIndex && kBypass != 0 then
//DSP Code Goes Here
aL, aR freeverb aL, aR, kroomSize, kdamp, sr
endif
xout aL, aR
endop
//#FDN Reverb SLOT
opcode slotFdnReverb, aa, aaSikk
aL, aR, Sname, iIndex, kSelect, kBypass xin
iIndex += 1
//Create image container
SFXname = "fdnReverb"
SContainerName sprintf "%s_%s", Sname, SFXname
iBounds[] cabbageGet sprintf("%s_slot",Sname), "bounds"
Screate sprintf "bounds(0,0,%f,%f), channel(%s) visible(0) colour(0,0,255) parent(%s_slot)", iBounds[2], iBounds[3], SContainerName, Sname
cabbageCreate "image", Screate
//GUI Code
SpreGain, kpreGain slotDial SContainerName, "pre-gain", 0, 0, "range(-48,48,0,1,0.1)", "",3,2
SpostGain, kpostGain slotDial SContainerName, "post-gain", 1, 0, "range(-48,48,0,1,0.1)", "",3,2
Sfb, kfb slotDial SContainerName, "fb", 0, 1, "range(0,1,0.5,1,0.01)", "",3,2
Scuttoff, kcuttoff slotDial SContainerName, "cuttoff", 1, 1, "range(50,15000,15000,0.25,1)", "",3,2
SpitchR, kpitchR slotDial SContainerName, "rand pitch", 2, 1, "range(0,10,0,1,0.25)", "",3,2
//Toggle Visibility
if changed2:k(kSelect) == 1 then
if kSelect == iIndex then
cabbageSet k(1), SContainerName, "visible(1)"
else
cabbageSet k(1), SContainerName, "visible(0)"
endif
endif
if kSelect == iIndex && kBypass != 0 then
//DSP Code Goes Here
if changed2:k(kpitchR) == 1 then
reinit FDNVERBINIT
endif
aL *= db(port(kpreGain,0.01))
aR *= db(port(kpreGain,0.01))
FDNVERBINIT:
ipitchR =i(kpitchR)
aL, aR reverbsc aL, aR, kfb, kcuttoff, sr, ipitchR
rireturn
endif
aL *= db(port(kpostGain,0.01))
aR *= db(port(kpostGain,0.01))
xout aL, aR
endop
//#Compressor SLOT
opcode slotComp, aa, aaSikk
aL, aR, Sname, iIndex, kSelect, kBypass xin
iIndex += 1
//Create image container
SFXname = "comp"
SContainerName sprintf "%s_%s", Sname, SFXname
iBounds[] cabbageGet sprintf("%s_slot",Sname), "bounds"
Screate sprintf "bounds(0,0,%f,%f), channel(%s) visible(0) colour(0,0,255) parent(%s_slot)", iBounds[2], iBounds[3], SContainerName, Sname
cabbageCreate "image", Screate
//GUI Code
SpreGain, kpreGain slotDial SContainerName, "pre-gain", 3, 0, "range(-48,48,0,1,0.1)", "",4,2
SpostGain, kpostGain slotDial SContainerName, "post-gain", 3, 1, "range(-48,48,0,1,0.1)", "",4,2
Sthresh, kthresh slotDial SContainerName, "thresh", 0, 0, "range(-108,0,-90,0.25,0.1)", "",4,2
Sknee, kknee slotDial SContainerName, "knee", 1, 0, "range(0,1,0.5,1,0.01)", "",4,2
Sratio, kratio slotDial SContainerName, "ratio", 2, 0, "range(0.25,10,-90,0.5,0.01)", "",4,2
Satt, katt slotDial SContainerName, "attack", 0, 1, "range(0,1000,10,0.25,0.1)", "",4,2
Srel, krel slotDial SContainerName, "release", 1, 1, "range(0,1000,10,0.25,0.1)", "",4,2
Slook, klook slotDial SContainerName, "look a.", 2, 1, "range(5,200,5,0.25,0.1)", "",4,2
//Toggle Visibility
if changed2:k(kSelect) == 1 then
if kSelect == iIndex then
cabbageSet k(1), SContainerName, "visible(1)"
else
cabbageSet k(1), SContainerName, "visible(0)"
endif
endif
if kSelect == iIndex && kBypass != 0 then
//DSP Code Goes Here
klowknee = kknee*-44
khighknee = -30
aL *= db(port(kpreGain,0.01))
aR *= db(port(kpreGain,0.01))
if changed2:k(klook)==1 then
reinit SLOTCOMPINIT
endif
SLOTCOMPINIT:
aL compress2 aL, (aL+aR)*0.75, kthresh, klowknee, khighknee, kratio/1000, katt/1000, krel/1000, i(klook)/1000
aR compress2 aR, (aL+aR)*0.75, kthresh, klowknee, khighknee, kratio/1000, katt/1000, krel/1000, i(klook) /1000
rireturn
aL *= db(port(kpostGain,0.01))
aR *= db(port(kpostGain,0.01))
endif
xout aL, aR
endop
//#Phaser SLOT
opcode slotPhaser, aa, aaSikk
aL, aR, Sname, iIndex, kSelect, kBypass xin
iIndex += 1
//Create image container
SFXname = "phaser"
SContainerName sprintf "%s_%s", Sname, SFXname
iBounds[] cabbageGet sprintf("%s_slot",Sname), "bounds"
Screate sprintf "bounds(0,0,%f,%f), channel(%s) visible(0) colour(0,0,255) parent(%s_slot)", iBounds[2], iBounds[3], SContainerName, Sname
cabbageCreate "image", Screate
//GUI Code
icols = 4;
irows = 2;
kphscps slotDial SContainerName, "rate", 0, 0, "range(0.01, 100, .4, 0.25, 0.01)", "", icols, irows
kphsdev slotDial SContainerName, "phs dev", 1, 0, "range(0,1,0,1,0.01)", "", icols, irows
kphsQ slotDial SContainerName, "Q", 2, 0, "range(0.01, 100, 1, .25, 0.01)", "", icols, irows
kphsFB slotDial SContainerName, "Fb", 3, 0, "range(0, 1, 0.5, 1, 0.01)", "" , icols, irows
//Toggle Visibility
if changed2:k(kSelect) == 1 then
if kSelect == iIndex then
cabbageSet k(1), SContainerName, "visible(1)"
else
cabbageSet k(1), SContainerName, "visible(0)"
endif
endif
if kSelect == iIndex && kBypass != 0 then
//DSP Code Goes Here
kphsdev oscil 25,kphscps,25
aLphs phaser2 aL,100+kphsdev,kphsQ,20,1,1,kphsFB
aRphs phaser2 aR,100+kphsdev,kphsQ,20,1,1,kphsFB
aL=aLphs
aR=aRphs
endif
xout aL, aR
endop
//#Flanger SLOT
opcode slotFlanger, aa, aaSikko
aL, aR, Sname, iIndex, kSelect, kBypass, itab xin
iIndex += 1
//Create image container
SFXname = "flanger"
SContainerName sprintf "%s_%s", Sname, SFXname
iBounds[] cabbageGet sprintf("%s_slot",Sname), "bounds"
Screate sprintf "bounds(0,0,%f,%f), channel(%s) visible(0) colour(0,0,255) parent(%s_slot)", iBounds[2], iBounds[3], SContainerName, Sname
cabbageCreate "image", Screate
//GUI Code
icols = 2;
irows = 1;
kflcps slotDial SContainerName, "rate", 0, 0, "range(0.01, 100, .4, 0.25, 0.01)", "", icols, irows
kflFB slotDial SContainerName, "Fb", 1, 0, "range(0, 1, 0.5, 1, 0.01)", "" , icols, irows
//Toggle Visibility
if changed2:k(kSelect) == 1 then
if kSelect == iIndex then
cabbageSet k(1), SContainerName, "visible(1)"
else
cabbageSet k(1), SContainerName, "visible(0)"
endif
endif
if kSelect == iIndex && kBypass != 0 then
//DSP Code Goes Here
if (itab == 0) then
itab ftgenonce 0, 0, 16385, 7, 0, 8192, 1, 8193, 0
endif
adel oscil .02,kflcps,itab
aLfl flanger aL,adel*.05,kflFB,.1
aLfl clip aLfl,1,1
aRfl flanger aR,adel*.05,kflFB,.1
aRfl clip aRfl,1,1
aL = aLfl
aR= aRfl
endif
xout aL, aR
endop
//#Multitap SLOT
opcode slotMultitap, aa, aaSikk
aL, aR, Sname, iIndex, kSelect, kBypass xin
iIndex += 1
//Create image container
SFXname = "multitap"
SContainerName sprintf "%s_%s", Sname, SFXname
iBounds[] cabbageGet sprintf("%s_slot",Sname), "bounds"
Screate sprintf "bounds(0,0,%f,%f), channel(%s) visible(0) colour(0,0,255) parent(%s_slot)", iBounds[2], iBounds[3], SContainerName, Sname
cabbageCreate "image", Screate
//GUI Code
ktaps[] init 6
kamps[] init 6
icols = 6;
irows = 2;
ktaps[0] slotDial SContainerName, "t 1", 0, 0, "range(1, 1000, 50, 0.25, 1)", "", icols, irows
kamps[0] slotDial SContainerName, "a 1", 0, 1, "range(0, 1, 0.5, 1, 0.01)", "" , icols, irows
ktaps[1] slotDial SContainerName, "t 2", 1, 0, "range(1, 1000, 77, 0.25, 1)", "", icols, irows
kamps[1] slotDial SContainerName, "a 2", 1, 1, "range(0, 1, 0.5, 1, 0.01)", "" , icols, irows
ktaps[2] slotDial SContainerName, "t 3", 2, 0, "range(1, 1000, 182, 0.25, 1)", "", icols, irows
kamps[2] slotDial SContainerName, "a 3", 2, 1, "range(0, 1, 0.5, 1, 0.01)", "" , icols, irows
ktaps[3] slotDial SContainerName, "t 4", 3, 0, "range(1, 1000, 297, 0.25, 1)", "", icols, irows
kamps[3] slotDial SContainerName, "a 4", 3, 1, "range(0, 1, 0.5, 1, 0.01)", "" , icols, irows
ktaps[4] slotDial SContainerName, "t 5", 4, 0, "range(1, 1000, 305, 0.25, 1)", "", icols, irows
kamps[4] slotDial SContainerName, "a 5", 4, 1, "range(0, 1, 0.5, 1, 0.01)", "" , icols, irows
ktaps[5] slotDial SContainerName, "t 6", 5, 0, "range(1, 1000, 470, 0.25, 1)", "", icols, irows
kamps[5] slotDial SContainerName, "a 6", 5, 1, "range(0, 1, 0.5, 1, 0.01)", "" , icols, irows
//Toggle Visibility
if changed2:k(kSelect) == 1 then
if kSelect == iIndex then
cabbageSet k(1), SContainerName, "visible(1)"
else
cabbageSet k(1), SContainerName, "visible(0)"
endif
endif
if kSelect == iIndex && kBypass != 0 then
//DSP Code Goes Here
aLDel = 0
aRDel = 0
ktaps = ktaps/1000
adummy delayr 1
aLDel += deltapi(port(ktaps[0],0.01))*kamps[0]
aLDel += deltapi(port(ktaps[1],0.01))*kamps[1]
aLDel += deltapi(port(ktaps[2],0.01))*kamps[2]
aLDel += deltapi(port(ktaps[3],0.01))*kamps[3]
aLDel += deltapi(port(ktaps[4],0.01))*kamps[4]
aLDel += deltapi(port(ktaps[5],0.01) )*kamps[5]
delayw aL
adummy delayr 1
aRDel += deltapi(port(ktaps[0],0.01))*kamps[0]
aRDel += deltapi(port(ktaps[1],0.01))*kamps[1]
aRDel += deltapi(port(ktaps[2],0.01))*kamps[2]
aRDel += deltapi(port(ktaps[3],0.01))*kamps[3]
aRDel += deltapi(port(ktaps[4],0.01))*kamps[4]
aRDel += deltapi(port(ktaps[5],0.01) )*kamps[5]
delayw aR
aL = aLDel
aR = aRDel
endif
xout aL, aR
endop
//#FX SLOT
opcode fxslot, aa, aaSii
aL, aR, Sname, ileft, iright xin
ih = 100
iw = 200
Screate sprintf "bounds(%f, %f, %f, %f) channel(%s_container)", ileft, iright, iw, ih, Sname
cabbageCreate "image", Screate
Screate sprintf "bounds(5,5,100,16) channel(%s_select) items(none,delay,chorus,harmonize,freeverb, \"fdn reverb\", compressor, phaser, flanger, multitap) parent(%s_container)", Sname, Sname
cabbageCreate "combobox", Screate
Screate sprintf "bounds(%f, %f, %f, %f) channel(%s_slot) parent(%s_container) colour(255,0,0) ", 5, 20, 190, 70, Sname, Sname
cabbageCreate "image", Screate
Screate sprintf "bounds(%f, %f, %f, %f) channel(%s_mix) parent(%s_container) colour(0,0,0) value(1)", 110, 2, 20, 20, Sname, Sname
cabbageCreate "rslider", Screate
Screate sprintf "bounds(%f, %f, %f, %f) channel(%s_bypass) parent(%s_container) colour(0,0,0) value(1) text(-| |-) colour:0(red) colour:1(green)", 135, 6, 30, 12, Sname, Sname
cabbageCreate "button", Screate
aOutL = aL
aOutR = aR
kbypass = port(chnget:k(sprintf("%s_bypass", Sname)),0.1)
kselect cabbageGet sprintf("%s_select", Sname)
kmix cabbageGet sprintf("%s_mix", Sname)
aOutL, aOutR slotDelay aOutL, aOutR, Sname, 1, kselect,kbypass
aOutL, aOutR slotChorus aOutL, aOutR, Sname, 2, kselect, kbypass
aOutL, aOutR slotHarmonizer, aOutL, aOutR, Sname, 3 , kselect, kbypass
aOutL, aOutR slotFreeverb, aOutL, aOutR, Sname, 4 , kselect, kbypass
aOutL, aOutR slotFdnReverb, aOutL, aOutR, Sname, 5 , kselect, kbypass
aOutL, aOutR slotComp, aOutL, aOutR, Sname, 6, kselect, kbypass
aOutL, aOutR slotPhaser, aOutL, aOutR, Sname, 7, kselect,kbypass
aOutL, aOutR slotFlanger, aOutL, aOutR, Sname, 8, kselect,kbypass, 27
aOutL, aOutR slotMultitap, aOutL, aOutR, Sname, 9, kselect,kbypass
kmix = port(kmix, 0.1)
aOutL = aL*(1-kmix)+aOutL*kmix*kbypass
aOutR = aR*(1-kmix)+aOutR*kmix*kbypass
xout aOutL, aOutR
endop
instr 1
kGain chnget "gain"
a1 inch 1
a2 inch 2
a1, a2 fxslot a1, a2, "fx1", 10,60
a1, a2 fxslot a1, a2, "fx2", 10,160
a1, a2 fxslot a1, a2, "fx3", 10,260
outs a1*kGain, a2*kGain
endin
;causes Csound to run for about 7000 years...
f0 z
f 25 0 128 10 1 0.5 0.3 0.25 0.2 0.167 0.14 0.125 .111
;starts instrument 1 and runs it for a week
i1 0 [60*60*24*7]
f 27 0 16385 7 0 8192 1 8193 0