Versionsvergleich
Aus ProgrammingWiki
Vergleich: 2011-01-29T10:36:46+00:00 → 2011-01-29T12:31:33+00:00
<language>Pascal</language> | |
<code id="4d2a0bf79cc25"> | |
var Pie:String; | |
key:integer; | |
dauer:integer; | |
c:Char; k:Char; | |
i,posx,z:Integer; | |
</code> | |
<canvas w=800 h=100></canvas> | |
<run id="4aa4b46b6775d"> | |
canvas_clear(); | |
Pie := '3.141592653589793238462643383279502884197169399375105820974944592307816406286208998' ; | |
| − | selectSound(19); // 19. MIDI organ |
| + | selectSound(33); // 19. MIDI organ |
posx:=0; | |
z:=2*((length(Pie)-2) div 2); | |
for i := 3 to z+1 do begin | |
if i mod 2 = 1 then begin | |
c := Pie[i]; | |
k := Pie[i+1]; | |
| − | //Quelltext schreiben |
| + | if c ='0' then key:=1; |
| + | if c ='1' then key:=5; |
| + | if c ='2' then key:=61; |
| + | if c ='3' then key:=62; |
| + | if c ='4' then key:=60; |
| + | if c ='5' then key:=66; |
| + | if c ='6' then key:=64; |
| + | if c ='7' then key:=88; |
| + | if c ='8' then key:=90; |
| + | if c ='9' then key:=95; |
| + | |
| + | if (k='0')or (k='2')then dauer :=100 div 1; |
| + | if (k='3')or (k='4') or (k='5')then dauer := 100 div 2; |
| + | if (k='6')or (k='7') or (k='1')then dauer :=100 div 4; |
| + | if (k='8') or (k= '9') then dauer := 100 div 8; |
| + | |
| + | |
| + | |
canvas_fillRect(posx,80-(key-60)*4,dauer,10); | |
posx := posx + dauer+5; | |
sound_play(key,dauer*10); | |
end; | |
end; | |
</run> |