64 lines
1.7 KiB
Plaintext
64 lines
1.7 KiB
Plaintext
;
|
|
; WARNING: DO NOT USE THIS, IT'S BROKEN FOR NOW
|
|
;
|
|
|
|
|
|
; VELOFIX
|
|
; (c) Severak 2019
|
|
; MIT licensed
|
|
<Cabbage>
|
|
form caption("VeloFix") size(250, 120), colour(58, 110, 182), pluginid("vefi"), bounds(0, 0, 250, 120)
|
|
checkbox bounds(132, 4, 100, 30) text("by volume") channel("byvol")
|
|
label bounds(0, 4, 134, 31) text("VeloFix")
|
|
hslider bounds(4, 36, 245, 43) range(0, 127, 0, 1, 1) channel("vol")
|
|
button bounds(134, 80, 80, 37) text("Silence!") colour:1(255, 0, 0, 255) colour:0(0, 0, 255, 255) channel("silence")
|
|
hslider bounds(6, 82, 124, 31) range(0, 16, 0, 1, 1) channel("channel")
|
|
</Cabbage>
|
|
<CsoundSynthesizer>
|
|
<CsOptions>
|
|
-dm0 -+rtmidi=NULL -Q0 -M0 --midi-key-cps=4 --midi-velocity-amp=5
|
|
</CsOptions>
|
|
<CsInstruments>
|
|
; Initialize the global variables.
|
|
ksmps = 64
|
|
|
|
;instrument will be triggered by keyboard widget
|
|
instr 1
|
|
kstatus, kchan, kdata1, kdata2 midiin
|
|
kvol chnget "vol"
|
|
kbyvol chnget "byvol"
|
|
|
|
if changed(kstatus, kchan, kdata1, kdata2)==1 then
|
|
if kstatus==144 then
|
|
midiout kstatus, kchan, kdata1, kvol
|
|
elseif kstatus==128 then
|
|
midiout kstatus, kchan, kdata1, 0
|
|
elseif kstatus==176 && kdata1=7 then
|
|
if kbyvol==1 then
|
|
chnset kdata2, "vol"
|
|
endif
|
|
elseif kstatus>0 then
|
|
midiout kstatus, kchan, kdata1, kdata2
|
|
endif
|
|
endif
|
|
|
|
kSilence chnget "silence"
|
|
kChannel chnget "channel"
|
|
if changed(kSilence)==1 then
|
|
kCnt init 21
|
|
until kCnt > 108 do
|
|
printks "OFF %d", 0, kCnt
|
|
midiout 128, kChannel, kCnt, 0
|
|
kCnt = kCnt + 1
|
|
enduntil
|
|
|
|
endif
|
|
|
|
endin
|
|
|
|
</CsInstruments>
|
|
<CsScore>
|
|
i 1 0 [3600*24*7]
|
|
</CsScore>
|
|
</CsoundSynthesizer>
|