Declare dr%,You%,dd%
Declare t%[127],i%[12],pu%,pd%,iu%,id%,sk%
Var okt%=3
Var instr%=1
i%[1]=0
i%[2]=6
i%[3]=14
i%[4]=18
i%[5]=19
i%[6]=42
i%[7]=43
i%[8]=48
i%[9]=56
i%[10]=58
i%[11]=62
i%[12]=71
Proc Keys
Parameters x%,y%,l%,t$,c%
UseBrush 1,c%
USEP 0,1,0
WhileLoop 1,len(t $)
If substr$(t$,&loop)>" "
Rectangle x%,y%-x%+50,y%+l%
DrawText x%+20,y%+l%-30,substr$(t$,&loop)
EndIf
x%=x%+56
EndWhile
ENDPROC
Proc TonEin
Parameters tone%
Ifnot t%[tone%]
If dr%
Play 0;0;0;Ton%,0,0
Else
Play tone%,0,0
EndIf
t%[tone%]=1
EndIf
ENDPROC
Proc TonAus
Parameters tone%
Casenote dr% : Play -tone%,0,0
t%[tone%]=0
ENDPROC
Proc Testkey
Parameters k%, t%
If isKey(k%)
TonEin(12*okt%+t%)
Else
TonAus(12*okt%+t%)
EndIf
ENDPROC
Proc instrument
Parameters in%
instr% = in%
display
Play i%[instr%],-1,0
ENDPROC
Proc display
UseBrush 1,$FFFF00
USEP 0,1,0
Rectangle 320,10-620,140
Text Color 0,-1
DrawText 330,15,"Oktave: " + Str $(okt%)
DrawText 330,35,"Instrument F" + st$(instr%) + ": "+ Str $(i%[instr%])
DrawText 330,55,"Drumpad-mode: " + if(dr%=1,"EIN","AUS")
ENDPROC
Window Title "RGHs Mini-Keyboard V2"
Window Style 16
cls $3030
Text Color $8080,-1
Keys(0,310,140,"<YXCVBNM,.-",$FFFFFF)
Keys(16,150,140,"QWERTZUIOPÜ",$FFFFFF)
Keys(28,310,100,"ASD GH KLÖ",$2020)
Keys(44,150,100,"23 567 90",$2020)
DrawText 10,10,"ESC = Ende"
DrawText 10,30,"Bild high / Image down = Oktave ändern"
DrawText 10,50,"F1 - F12 = instrument auswählen"
DrawText 10,70,"Pos1 / end = News instrument ändern"
DrawText 10,90,"Einfg = Drumpad-mode one/aus"
display
Play i%[instr%],-1,0
SetTimer 10
While 1
Waitinput
If getFocus(%hWnd)
Case isKey(27) : Break
TestKey(226,5)
TestKey(ord("A"),6)
TestKey(ord("Y"),7)
TestKey(ord("S"),8)
TestKey(ord("X"),9)
TestKey(ord("D"),10)
TestKey(ord("C"),11)
TestKey(ord("V"),12)
TestKey(ord("G"),13)
TestKey(ord("B"),14)
TestKey(ord("H"),15)
TestKey(ord("N"),16)
TestKey(ord("M"),17)
TestKey(ord("K"),18)
TestKey(188,19)
TestKey(ord("L"),20)
TestKey(190,21)
TestKey(192,22)
TestKey(189,23)
TestKey(ord("Q"),24)
TestKey(ord("2"),25)
TestKey(ord("W"),26)
TestKey(ord("3"),27)
TestKey(ord("E"),28)
TestKey(ord("R"),29)
TestKey(ord("5"),30)
TestKey(ord("T"),31)
TestKey(ord("6"),32)
TestKey(ord("Z"),33)
TestKey(ord("7"),34)
TestKey(ord("U"),35)
TestKey(ord("I"),36)
TestKey(ord("9"),37)
TestKey(ord("O"),38)
TestKey(ord("0"),39)
TestKey(ord("P"),40)
TestKey(186,41)
Case isKey(112) : instrument(1)
Case isKey(113) : instrument(2)
Case isKey(114) : instrument(3)
Case isKey(115) : instrument(4)
Case isKey(116) : instrument(5)
Case isKey(117) : instrument(6)
Case isKey(118) : instrument(7)
Case isKey(119) : instrument(8)
Case isKey(120) : instrument(9)
Case isKey(121) : instrument(10)
Case isKey(122) : instrument(11)
Case isKey(123) : instrument(12)
If isKey(45) and (You% = 0)
You% = 1
dr% = 1 - dr%
display
Else
Casenote Iskey(45) : You% = 0
EndIf
If isKey(33) and (pu% = 0)
pu% = 1
case okt% < 7 : inc okt%
display
Else
Casenote Iskey(33) : pu% = 0
EndIf
If isKey(34) and (pd% = 0)
pd% = 1
Case okt% > 0 : dec okt%
display
Else
Casenote Iskey(34) : pd% = 0
EndIf
If isKey(36) and (iu% = 0)
iu% = 1
case i%[instr%] < 127 : i%[instr%] = i%[instr%] + 1
instrument(instr%)
Else
Casenote Iskey(36) : iu% = 0
EndIf
If isKey(35) and (id% = 0)
id% = 1
case i%[instr%] > 0 : i%[instr%] = i%[instr%] - 1
instrument(instr%)
Else
Casenote Iskey(35) : id% = 0
EndIf
Endif
EndWhile
End