TriOS-alt/zubehör/game boulderdash/sourcen/Regnatix-Code/sfxtool.spin

239 lines
14 KiB
Plaintext
Raw Normal View History

2010-04-16 00:25:58 +02:00
<EFBFBD><EFBFBD>
CON
_CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000
OBJ
ios: "ios"
num: "numbers"
CON
TIBLEN = 32
VAR
byte tib[TIBLEN] 'tastatur-input-buffer
PUB main | a,b,c,key,n
ios.start
' ios.startram 'code f<00>r test im ram, sollte bei bin-datei auskommentiert werden
ios.screeninit(@prompt1,4)
repeat
ios.sfx_setslot2(@fx_puffer,15)
ios.sfx_fire(15,1)
printfx(@fx_puffer)
key := ios.keywait
case key
"1":
ios.printchar($0d)
ios.print(string("Basisschwingung Waveform (0..6): "))
ios.input(@tib,TIBLEN)
n := num.FromStr(@tib,num#HEX)
byte[@fx_puffer] := n
"2":
ios.printchar($0d)
ios.print(string("Basisschwingung L<00>nge (0..FE, FF endlos):"))
ios.input(@tib,TIBLEN)
n := num.FromStr(@tib,num#HEX)
byte[@fx_puffer+1] := n
"3":
ios.printchar($0d)
ios.print(string("Basisschwingung Frequenz (0..FF): "))
ios.input(@tib,TIBLEN)
n := num.FromStr(@tib,num#HEX)
byte[@fx_puffer+2] := n
"4":
ios.printchar($0d)
ios.print(string("Basisschwingung Volume (0..F): "))
ios.input(@tib,TIBLEN)
n := num.FromStr(@tib,num#HEX)
byte[@fx_puffer+3] := n
"5":
ios.printchar($0d)
ios.print(string("Modulation LFO (Speed 01..FF): "))
ios.input(@tib,TIBLEN)
n := num.FromStr(@tib,num#HEX)
byte[@fx_puffer+4] := n
"6":
ios.printchar($0d)
ios.print(string("Modulation LFW (Waveform 0..5): "))
ios.input(@tib,TIBLEN)
n := num.FromStr(@tib,num#HEX)
byte[@fx_puffer+5] := n
"7":
ios.printchar($0d)
ios.print(string("Modulation FMa (St<00>rke der FM 0 - off, 01..FF, 01 - MAX): "))
ios.input(@tib,TIBLEN)
n := num.FromStr(@tib,num#HEX)
byte[@fx_puffer+6] := n
"8":
ios.printchar($0d)
ios.print(string("Modulation AMa (St<00>rke der AM 0 - off, 01..FF, 01 - MAX): "))
ios.input(@tib,TIBLEN)
n := num.FromStr(@tib,num#HEX)
byte[@fx_puffer+7] := n
"9":
ios.printchar($0d)
ios.print(string("H<00>llkurve Attack - Anstieg (0 - off, 1..FF, 1 - lansamster Anstieg): "))
ios.input(@tib,TIBLEN)
n := num.FromStr(@tib,num#HEX)
byte[@fx_puffer+8] := n
"a":
ios.printchar($0d)
ios.print(string("H<00>llkurve Decay - Abfall (0 - off, 1..FF, 1 - lansamster Abfall): "))
ios.input(@tib,TIBLEN)
n := num.FromStr(@tib,num#HEX)
byte[@fx_puffer+9] := n
"b":
ios.printchar($0d)
ios.print(string("H<00>llkurve Sustain - Halten Volume (0 - Mute, 1..FF, 1 - Leise): "))
ios.input(@tib,TIBLEN)
n := num.FromStr(@tib,num#HEX)
byte[@fx_puffer+10] := n
"c":
ios.printchar($0d)
ios.print(string("H<00>llkurve Release - Freigabe (0 - off, 1..FF, 1 - Langsamste Freigabe): "))
ios.input(@tib,TIBLEN)
n := num.FromStr(@tib,num#HEX)
byte[@fx_puffer+11] := n
"m":
menu2
ios.screeninit(@prompt1,4)
pub menu2 | key,a
ios.screeninit(@prompt2,4)
key := ios.keywait
case key
"s":
"l":
"e": export
"r": menu3
"q": ios.stop
pub export | i
pub menu3 | key,a,n,c,w
ios.screeninit(@prompt3,4)
w := 0
c := 32
repeat
key := ios.keywait
case key
"r":
repeat c
a?
a := a & $FF
byte[@fx_puffer+2] := a
ios.sfx_setslot2(@fx_puffer,15)
ios.sfx_fire(15,1)
printfx(@fx_puffer)
if w > 0
waitcnt(clkfreq / w + cnt)
"c":
ios.printchar($0d)
ios.print(string("Anzahl = "))
ios.printdec(c)
ios.print(string(" : "))
ios.input(@tib,TIBLEN)
c := num.FromStr(@tib,num#DEC)
ios.print(string(" ok",$0d))
"w":
ios.printchar($0d)
ios.print(string("Wait = "))
ios.printdec(w)
ios.print(string(" : "))
ios.input(@tib,TIBLEN)
w := num.FromStr(@tib,num#DEC)
ios.print(string(" ok",$0d))
"b": quit
pub printfx(adr)| i,a
ios.printchar(ios#char_nl)
repeat i from 0 to 11
a := byte[adr+i]
ios.print(string("$"))
ios.printhex(a,2)
ios.print(string(" "))
DAT
prompt1 byte "<00>%Hive: SFX-Tool"
byte $0d,"Basisschwingung Modulation H<00>llkurve "
byte $0d,"Wav Len Fre Vol LFO LFW FMa AMa Att Dec Sus Rel"
byte $0d,"[01] [02] [03] [04] [05] [06] [07] [08] [09] [0A] [0B] [0C] [M] ",$0
prompt2 byte "<00>%SFX-Tool - Men<00>"
byte $0d," "
byte $0d," "
byte $0d,"[S]ave [L]oad [E]xport [R]and [Q]uit",$0
prompt3 byte "<00>%SFX-Tool - Random Freq"
byte $0d," "
byte $0d," "
byte $0d,"[R]un [C]ount [W]ait [B]ack",$0
mod1 byte "bd1.hss ",0
mod2 byte "bd2.hss ",0
'basisschwingung modulation h<00>llkurve
'Wav Len Fre Vol LFO LFW FMa AMa Att Dec Sus Rel
fx_puffer byte $01, $01, $80, $0F, $00, $00, $00, $00, $FF, $00, $00, $80
byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
DAT
{
sfx-struktur:
wav len freq vol grundschwingung
lfo lfw fma ama modulation
att dec sus rel h<00>llkurve
seq (optional)
wav wellenform
0 sinus (0..500hz)
1 schneller sinus (0..1khz)
2 dreieck (0..500hz)
3 rechteck (0..1khz)
4 schnelles rechteck (0..4khz)
5 impulse (0..1,333hz)
6 rauschen
len tonl<00>nge $0..$fe, $ff endlos
freq frequenz $00..$ff
vol lautst<00>rke $00..$0f
lfo low frequency oscillator $ff..$01
lfw low frequency waveform
$00 sinus (0..8hz)
$01 fast sine (0..16hz)
$02 ramp up (0..8hz)
$03 ramp down (0..8hz)
$04 square (0..32hz)
$05 random
$ff sequencer data
fma frequency modulation amount
$00 no modulation
$01..$ff
ama amplitude modulation amount
$00 no modulation
$01..$ff
att attack $00..$ff
dec decay $00..$ff
sus sustain $00..$ff
rel release $00..$ff
}