home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
sourcecode
/
procedures
/
sample_bank_maker.amos
/
sample_bank_maker.amosSourceCode
Wrap
AMOS Source Code
|
1999-12-25
|
8KB
|
331 lines
' AMOS Sample Bank Maker
'
' Original routine by Francois Lionet
'
' Altered to take Audiomaster samples and to eliminate header data
' from other iff-samples (Sarv. Engelhardt, 1991)
'
' You may increase the storage capacity of this program by changing
' the size of the text buffer
Set Buffer 40
Default
Close Editor
Dir$="df1:"
Dim S$(20),F$(20),F(20),TYPE(20)
Dim LINE$(5),BUTTON$(3)
NSAM=0 : L0ADED_SAMPLES=False
Global S$(),F$(),F(),LINE$(),BUTTON$(),NSAM,TYPE(),L0ADED_SAMPLES
SET_UP_SCREEN
On Menu Proc MENU_1,MENU_2
Repeat
On Menu On
Until False
Procedure MAKE_AMOS_BANK
On Error Goto FATEL_ERROR1
Cls
F$=Fsel$("*.*","Samples.Abk","Please pick a save name.....")
If F$<>""
Bell
Centre At(,7)+Border$("Please wait while I convert the samples.....",1)
Print At(36,10);Border$("SAMPLE: ",1)
TL=2 : TN=0
For N=1 To NSAM
If Len(S$(N))<>0
Inc TN
TL=TL+Len(S$(N))+4+14
End If
Next
Erase 10
Reserve As Work 10,TL+12+8
AD=Start(10)
A$="AmBk"
For X=1 To Len(A$)
Poke AD+X-1,Asc(Mid$(A$,X,1))
Next X
AD=AD+4
Doke AD,5
AD=AD+2
Doke AD,0
AD=AD+2
Loke AD,(TL+8) or $80000000
AD=AD+4
A$="Samples "
For X=1 To Len(A$)
Poke AD+X-1,Asc(Mid$(A$,X,1))
Next X
AD=AD+8
ACALC=AD
Doke AD,TN
AD=AD+2
AOFF=AD
APOKE=AOFF+TN*4
For N=1 To NSAM
If TYPE(N)=2
WEIGHTING=-128
Else
WEIGHTING=0
End If
If S$(N)<>""
Print At(44,10);N;
Loke AOFF,APOKE-ACALC
AOFF=AOFF+4
A$=Left$(F$(N),8)
AD=APOKE
For X=1 To Len(A$)
Poke AD+X-1,Asc(Mid$(A$,X,1))
Next X
FREQ=F(N)
Doke APOKE+8,FREQ
Loke APOKE+10,Len(S$(N))
APOKE=APOKE+14
A=Varptr(S$(N))
PP=Varptr(P)
For X=0 To Len(S$(N))-1
P=Peek(A+X)+WEIGHTING
Poke APOKE+X,Peek(PP+3)
Next X
APOKE=APOKE+Len(S$(N))
If Btst(0,APOKE)
Inc APOKE
End If
End If
Next N
Cls
Bell
If Right$(Upper$(F$),4)<>".ABK"
F$=F$+".Abk"
End If
Centre At(,8)+Border$("Saving new sample bank.....",1)
Bsave F$,Start(10) To Start(10)+TL+12+8
End If
RECOVER_1:
DISPLAY_SAMS
Pop Proc
FATEL_ERROR1:
For LOP=1 To 5
Bell 30-LOP
Wait 3
Next LOP
If Errn=26
Erase 10
LINE$(0)="I'm out of Memory!"
Else
LINE$(0)="Woops, disc error!"
End If
BUTTON$(0)="Never mind."
ALERT[21,7,0,1,1,1]
Resume RECOVER_1
End Proc
Procedure L0AD_SAMPLE
On Error Goto FATEL_ERROR2
Inc NSAM
F$(NSAM)=Fsel$("","","Please choose a sample to load")
If Not Exist(F$(NSAM))
For LOP=1 To 5
Bell 30-LOP
Wait 3
Next LOP
LINE$(0)="I cannot find that"
LINE$(1)="file on this disc!"
BUTTON$(0)="Woops......."
ALERT[21,7,0,1,1,2]
F$(NSAM)=""
Else
Open In 1,F$(NSAM)
If Lof(1)<Free
S$(NSAM)=Input$(1,Lof(1))
Add MEM,-Lof(1)
Close
If Left$(S$(NSAM),3)="JON"
F(NSAM)=Peek(Varptr(S$(NSAM))+3)
F(NSAM)=F(NSAM)*1000
S$(NSAM)=Mid$(S$(NSAM),4)
TYPE(NSAM)=2
Else
Cls
Clear Key : AFL=0
L=Len(S$(NSAM))
For I=1 To L
A$=Mid$(S$(NSAM),I,5)
If A$="Audio" : AFL=1 : Exit : End If
Next I
If AFL=1
F(NSAM)=Deek(Varptr(S$(NSAM))+32)
TYPE(NSAM)=3
Else
Input At(0,12)+"Please enter sampling frequency:";F(NSAM)
If F(NSAM)<1000 or F(NSAM)>32000
F(NSAM)=15000
End If
TYPE(NSAM)=1
End If
For I=1 To L
A$=Mid$(S$(NSAM),I,4)
Exit If A$="BODY"
Next I
A$=Right$(S$(NSAM),L-I-7)
S$(NSAM)=A$
Cls
End If
If(1 and Len(S$(NSAM)))
S$(NSAM)=S$(NSAM)+Right$(S$(NSAM),1)
End If
F$(NSAM)=Right$(F$(NSAM),Len(F$(NSAM))-4)
DISPLAY_SAMS
L0ADED_SAMPLES=True
Else
LINE$(0)="Sorry, you do not have enough free"
LINE$(1)=" memory to load this sample. "
BUTTON$(0)="Memory expansion time"
ALERT[40,7,0,1,1,2]
End If
End If
RECOVER_2:
Close
Pop Proc
FATEL_ERROR2:
If FILE$<>""
For LOP=1 To 5
Bell 30-LOP
Wait 3
Next LOP
LINE$(0)="Woops, disc error!"
BUTTON$(0)="Never mind."
ALERT[21,7,0,1,1,1]
Dec NSAM
FILE$=""
End If
Resume RECOVER_2
End Proc
Procedure DISPLAY_SAMS
Cls
Curs Off
Inverse On
Print At(0,0);"| Sample | Sample name | Length | Frequency | Sample Type |";
Inverse Off
Under On
For LOP=1 To NSAM
Print At(0,LOP);"| | | | | |";
Print At(3,LOP);LOP;At(11,LOP);Left$(F$(LOP),21);At(36,LOP); Using "#######";Len(S$(LOP))
Print At(52,LOP); Using "#####";F(LOP)
If TYPE(LOP)=1
Print At(68,LOP);"RAW";
End If
If TYPE(LOP)=2
Print At(63,LOP);"STOS MAESTRO";
End If
If TYPE(LOP)=3
Print At(63,LOP);"AUDIO MASTER";
End If
If Inkey$<>""
Wait Key
End If
Next LOP
Under Off
Print
Inverse On
Centre "Free memory:"+Str$(Free)
Inverse Off
End Proc
Procedure SET_UP_SCREEN
Screen Open 1,640,200,2,Hires
Colour 1,$FFF : Flash Off : Curs Off : Cls 0
Paper 0
Pen 1
Menu$(1)=" AMOS "
Menu$(1,1)=" About "
Menu$(1,2)="=======" : Menu Inactive(1,2)
Menu$(1,3)=" Quit "
Menu$(2)=" Edit "
Menu$(2,1)=" Load sample. "
Menu$(2,2)="===================" : Menu Inactive(2,2)
Menu$(2,3)=" Save sample bank. "
Menu$(2,4)="===================" : Menu Inactive(2,4)
Menu$(2,5)=" Erase all samples."
DEF_SETTING
Reserve Zone 1
Menu On
End Proc
Procedure DEF_SETTING
Cls
For LOP=1 To NSAM
S$(LOP)=""
F$(LOP)=""
F(LOP)=0
TYPE(LOP)=0
Next LOP
L0ADED_SAMPLES=False
NSAM=0
Centre At(,7)+"AMOS SAMPLE BANK MAKER"
Centre At(,9)+"By P.J.Hickman"
Inverse On
Centre At(,12)+"Free memory:"+Str$(Free)
Inverse Off
Centre At(,16)+Border$("Click right mouse button to display menu",1)
Repeat : Until Mouse Click
End Proc
Procedure ALERT[W,H,BACK_COL,LINE_COL,NB,NL]
Menu Off
TEMP=0
W=W*8
H=H*8
X=(Screen Width/2)-W/2
Y=4
Get Block 241,0,Y-2,Screen Width,H+6
Ink BACK_COL
Bar X,Y-2 To X+W,Y+H
Ink LINE_COL
Box X+1,Y-2 To X+W-1,Y+H-1
S=W/8/(NB+1)+1
Paper BACK_COL
Pen LINE_COL
For LOP=0 To NL
Locate 0,Y Text(Y)+1+LOP
Centre LINE$(LOP)
Next LOP
TEMP=0
While TEMP<>NB
Locate X Text(X)+S/2+S*TEMP,Y Text(Y+H)-2
Print Border$(Zone$(BUTTON$(TEMP),TEMP+1),2);
Inc TEMP
Wend
TEMP=0
Repeat
Repeat : Until Mouse Click and Mouse Key=1
TEMP=Mouse Zone
Until TEMP>0
Put Block 241,0,Y-2
Del Block 241
Add TEMP,-96
For LOP=0 To NB
BUTTON$(LOP)=""
Next LOP
For LOP=0 To NL
LINE$(LOP)=""
Next LOP
Menu On
End Proc[TEMP]
Procedure MENU_1
Shared LINE$(),BUTTON$()
If Choice(2)=1
For LOP=1 To 10
Bell 50+LOP
Wait 3
Next LOP
LINE$(0)="Sample Bank Maker"
LINE$(1)="~~~~~~~~~~~~~~~~~"
LINE$(2)=""
LINE$(3)=" By P.J.Hickman"
BUTTON$(0)="Have Fun!!!"
ALERT[22,9,0,1,1,4]
End If
If Choice(2)=3
Default
End
End If
End Proc
Procedure MENU_2
If Choice(2)=1 Then L0AD_SAMPLE
If L0ADED_SAMPLES and Choice(2)=3 Then MAKE_AMOS_BANK
If Choice(2)=5 Then DEF_SETTING
End Proc