This repository has been archived by the owner on Jul 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbpm_dl.bas
135 lines (131 loc) · 3.98 KB
/
bpm_dl.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
cls:screen 12
BPMTime=3
'open "O",#1,"KLATSCH.RAW"
timer on
dim check(640)
FOR SbPort = &H210 to &H280 STEP &H10
OUT SbPort + &H6, 1
FOR a = 1 to 10:next
OUT SbPort + &H6, 0
FOR a = 1 to 100
IF INP(SbPort + &HA) = &HAA THEN GOTO SbFound
NEXT
NEXT
PRINT "kein SoundBlaster => Ende..."
END
SbFound:
on timer(BPMTime) GOSUB CalcBPM
locate 1,1
color 10:print"SoundBlaster an Adresse ";hex$(SbPort);"h gefunden."
color 15:locate 1,1:print" "
DO
OUT SbPort + &HC, &H20
DO:LOOP UNTIL INP(SbPort + &HE) AND 128
'locate 2,1:print Wert;"/";inp(sbport+&HA)
'gosub ShowLEV
if minus=0 then strecke=strecke+1
if minus=1 then strecke=strecke-1
if strecke>639 then minus=1
if strecke<1 then minus=0
value=(256-125+(inp(sbport+&HA)-125))/256*480
'locate 2,1:print value;
pset (strecke,check(strecke)),0
if value>190 or value<290 then col=10
if (value>155 and value<190) or (value >290 and value <325) then col=14
if value<155 or value>325 then col=12
col=15
if minus=0 then ls=strecke+1 else ls=strecke-1
' ÚÄ y1
line (ls,13)-(ls,480),0 'Wer mit der MAX-Anzeige arbeitet sollte y1 auf 13 setzen
pset (veryolds,veryoldv),8
pset (olds,oldv),7 'Diese Zeile sollte ungeREMt bleiben
if maxvalue<>oldmax then locate 1,8:color 14:print using "Max: ###.#";maxvalue
if beats<>oldbeats then NoNew=0 else NoNew=NoNew+1
oldbeats=beats
oldmax=maxvalue 'alles mit einem 'max' in der Variablen geh”rt zur Maxerkennung
if NoNew>=750 then maxvalue=value
if strecke=1 then pset(0,240),0
pset (strecke,value),col 'Wer aus 'line -' ein 'pset ' macht, und alle anderen REMs entfernt, hat auch einen coolen FX
' line (strecke,1)-(strecke,5),12
line (strecke,479)-(strecke,475),12
if minus=0 then ps=strecke-1 else ps=strecke+1
' line (ps,1)-(ps,5),4
line (ps,479)-(ps,475),4
if minus=0 then ps2=ps-1 else ps2=ps+1
' line (ps2,2)-(ps2,5),0
line (ps2,478)-(ps2,475),0
maxvalue=max(Maxvalue,abs(value))
if beat>0 then beat=beat-1:goto SkipIT
FaktMax=7
if value>=maxvalue-(maxvalue/FaktMax) then
color 12
locate 1,1
diff=value-(maxvalue-(maxvalue/FaktMax))
BeatStage=0
Fakt1=50
Fakt2=80
Fakt3=100
if diff>=0 and diff<=(MAXDIFF/100)*Fakt1 then BeatStage=1
if diff>(MAXDIFF/100)*Fakt1 and diff<=(maxdiff/100)*Fakt2 then BeatStage=2
if diff>(maxdiff/100)*Fakt2 and diff<=(maxdiff/100)*Fakt3 then BeatStage=3
if beats/2=int(beats/2) and BeatStage=1 then print"ßBEATÜ";
if beats/2<>int(beats/2) and BeatStage=1 then print"ÜBEATß";
if beats/2=int(beats/2) and BeatStage=2 then print"ÞBEATÝ";
if beats/2<>int(beats/2) and BeatStage=2 then print"ÝBEATÞ";
if BeatStage=3 then print"ÛÛÛÛÛÛ";
maxdiff=max(maxdiff,diff)
beats=beats+1
beat=50
else
locate 1,1
print" ";
end if
SkipIT:
veryolds=olds
veryoldv=oldv
olds=strecke 'Wenn man die beiden oldx's REMt erh„lt man einen recht
oldv=value 'lustigen Effekt!!!
delay del
check(strecke)=value
'print#1,chr$(inp(sbport+&HA));
a$=inkey$
if a$="+" then del=del+.01
if a$="-" then del=del-.01:if del<0 then del=0
if a$="*" then del=del+.1
if a$="/" then del=del-.1:if del<0 then del=0
if a$="0" then del=0
if a$="1" then del=1
LOOP UNTIL a$=chr$(27)
Goto Ende
CalcBPM:
BPS=Beats/BPMTime
Beats=0
BPM=BPS*60
color 10
locate 1,20:print using"BPS: ###.## BPM: ####.##";bps;bpm;
return
ShowLEV:
y=3
Zeichen=176
Einheit=256/80
Wert=inp(sbport+&HA)
Einheiten=round(Wert/Einheit,0)
for x=1 to 80
locate y,x:if x<=Einheiten then
if x>=0 and x<=45 then color 10
if x>45 and x<=70 then color 14
if x>70 and x<=80 then color 12
else
if x>=0 and x<=45 then color 2
if x>45 and x<=70 then color 6
if x>70 and x<=80 then color 4
end if
print chr$(Zeichen);
locate y+1,x
print chr$(Zeichen);
next x
return
Ende:
screen 0:width 80
print"Programm beendet."