Hi. I hope you all are safe.
I am and besides normal work I am spending some time with Cabbage.
The idea (for my last project) is simple - have an multitrack recorder (something like portastudio) as VST plugin and then record using this in Element VST host.
I hacked together working one recorder, but it seems it has some problems with sampling rate - everything recorded with it sound somewhat glitched.
See example:
Source code is here and you need working directory C:/severak/aaa/
:
<Cabbage> bounds(0, 0, 0, 0)
form caption("4track") size(400, 300), colour(58, 110, 182), pluginid("4trk")
vslider bounds(40, 4, 50, 150) range(0, 1, 1, 1, 0.001) channel("vol1")
vslider bounds(94, 4, 50, 150) range(0, 1, 1, 1, 0.001) channel("vol2")
vslider bounds(150, 4, 50, 150) range(0, 1, 1, 1, 0.001) channel("vol3")
vslider bounds(204, 4, 50, 150) range(0, 1, 1, 1, 0.001) channel("vol4")
checkbox bounds(46, 158, 30, 30) channel("ch1") radiogroup("ch")
checkbox bounds(104, 158, 30, 30) channel("ch2") radiogroup("ch")
checkbox bounds(160, 158, 30, 30) channel("ch3") radiogroup("ch")
checkbox bounds(214, 158, 30, 30) channel("ch4") radiogroup("ch")
checkbox bounds(268, 50, 102, 30) channel("ch0") radiogroup("ch") text("MIX")
checkbox bounds(268, 12, 100, 30) text("PLAY/REC") channel("running") colour:1(255, 0, 0, 255) fontcolour:1(0, 255, 0, 255)
filebutton bounds(268, 90, 122, 30) mode("directory") channel("dir") text("DIR", "DIR")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d
</CsOptions>
<CsInstruments>
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
gkRunning init 0
; this will be a working dir:
; selectable by button DIR
gSdir init "C:/severak/aaa/"
; recorder controls (always on)
instr 1
kch1 chnget "ch1"
kch2 chnget "ch2"
kch3 chnget "ch3"
kch4 chnget "ch4"
kch0 chnget "ch0"
gkRunning chnget "running"
if changed:k(gkRunning)==1 && gkRunning==1 && kch1==1 then
printks "REC 1 ON\n", 0.5
event "i",200,0,900,1
endif
if changed:k(gkRunning)==1 && gkRunning==1 && kch2==1 then
printks "REC 2 ON\n", 0.5
event "i",200,0,900,2
endif
if changed:k(gkRunning)==1 && gkRunning==1 && kch3==1 then
printks "REC 3 ON\n", 0.5
event "i",200,0,900,3
endif
if changed:k(gkRunning)==1 && gkRunning==1 && kch4==1 then
printks "REC 4 ON\n", 0.5
event "i",200,0,900,4
endif
if changed:k(gkRunning)==1 && gkRunning==1 && kch0==1 then
printks "MIX ON\n", 0.5
; TODO - record MIX
endif
if changed:k(gkRunning)==1 && gkRunning==1 && kch1!=1 then
printks "PLAY 1 ON\n", 0.5
event "i",100,0,900,1
endif
if changed:k(gkRunning)==1 && gkRunning==1 && kch2!=1 then
printks "PLAY 2 ON\n", 0.5
event "i",100,0,900,2
endif
if changed:k(gkRunning)==1 && gkRunning==1 && kch3!=1 then
printks "PLAY 3 ON\n", 0.5
event "i",100,0,900,3
endif
if changed:k(gkRunning)==1 && gkRunning==1 && kch4!=1 then
printks "PLAY 4 ON\n", 0.5
event "i",100,0,900,4
endif
endin
; playback
instr 100
if gkRunning==0 then
turnoff
endif
ich = p4
Sname sprintf "%sch%d.wav", gSdir, ich
Schname sprintf "ch%d", ich
printf_i "in=%s\n", 1, Sname
ivalid filevalid Sname
if ivalid==1 then
kVol chnget Schname
aL, aR diskin2 Sname, 1
outs aL, aR
else
turnoff
endif
endin
; record
instr 200
if gkRunning==0 then
turnoff
endif
aL, aR ins
ich = p4
Sname sprintf "%sch%d.wav", gSdir, ich
printf_i "out=%s\n", 1, Sname
fout Sname, 9, aL, aR
outs aL, aR
clear aL, aR
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
;starts instrument 1 and runs it for a week
i1 0 [60*60*24*7]
</CsScore>
</CsoundSynthesizer>