poradny midilog

This commit is contained in:
severak 2019-11-07 23:53:14 +01:00
parent b883666ae2
commit b5327d313d
1 changed files with 27 additions and 2 deletions

View File

@ -5,8 +5,9 @@
; TODO - kontrola zda jsme nenechali nějakou stistknutou klávesu (na tlačítko)
<Cabbage>
form caption("MIDI log") size(400, 300), colour(58, 110, 182), pluginid("mlog") bounds(0, 0, 400, 300)
csoundoutput bounds(6, 4, 393, 288) text("MIDI log")
form caption("MIDI log") size(600, 220), colour(58, 110, 182), pluginid("mlog") bounds(0, 0, 600, 220)
csoundoutput bounds(6, 4, 590, 194) text("MIDI log")
checkbox bounds(6, 208, 6, 6) widgetarray("pressed", 128)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
@ -20,13 +21,21 @@ nchnls = 2
;instrument will be triggered by MIDI
instr 1
kpressed[] init 128
kstatus, kchan, kdata1, kdata2 midiin
if changed(kstatus, kchan, kdata1, kdata2)==1 then
;printks "= %d %d %d %d\n", 0, kstatus, kchan, kdata1, kdata2
if kstatus==144 then
printks "CH %d: ON %d vel %d\n", 0, kchan, kdata1, kdata2
kpressed[i(kdata1)] = 1
Snam sprintfk "pressed_ident%d", kdata1
chnset "value(1)", Snam
elseif kstatus==128 then
printks "CH %d: OFF %d vel %d\n", 0, kchan, kdata1, kdata2
kpressed[i(kdata1)] = 0
Snam sprintfk "pressed_ident%d", kdata1
chnset "value(0)", Snam
elseif kstatus==176 then
printks "CH %d: CC %d val %d\n", 0.05, kchan, kdata1, kdata2
elseif kstatus==224 then
@ -35,8 +44,24 @@ instr 1
endif
endin
instr 2
iCnt init 21
kMetro metro 1
until iCnt > 108 do
printks "%d", 0, iCnt
Sval sprintfk "pos(%d, 208)", (iCnt-21)*6+6
Snam sprintfk "pressed_ident%d", iCnt
chnset Sval, Snam
iCnt=iCnt+1
enduntil
;if kMetro==1 then
; event "i", 2, 0, .01
;endif
endin
</CsInstruments>
<CsScore>
i 1 0 [3600*24*7]
i 2 0 0
</CsScore>
</CsoundSynthesizer>