home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 10
/
amigaformatcd10.iso
/
-readerstuff-
/
martin_cameron
/
bonus
/
adpcmpack.amos
/
adpcmpack.amosSourceCode
Wrap
AMOS Source Code
|
1996-04-02
|
2KB
|
81 lines
Screen Open 0,640,200,2,Hires : Palette $777,$FF9
'
Print "FlowerPower's ADPCM Packer -- Amos interface by Martin Cameron."
Print
Print "This program is a replacement for the XtoADPCM utility an the"
Print "FP-ADPCM archive (Aminet/util/pack). It will only pack 8bit RAW, but"
Print "it uses virtual memory to pack samples of any size, unlike XtoADPCM"
Print "which can only handle files of around 1meg no matter how much mem you have."
Print
Print "Included with this program is the cli program PlayDPCM, which plays"
Print "back these ADPCM files using virtual memory."
Print
Print "See how good quality a 2 or 3 bit sample can be with ADPCM!"
Print
Print "Buffer size should be a reasonable amount, upto 500000 if you have the memory!"
Print
Print
Input "Enter buffer size (bytes) >";BUFFER
'
Reserve As Work 1,BUFFER
Reserve As Work 2,BUFFER/2
'
IN$=Fsel$("","","Load Raw..") : Open In 1,IN$
OUT$=Fsel$("","","Save ADPCM") : Open Out 2,OUT$
'
Input "Type number of bits (2/3) >";BITS
Input "Type playback samplerate in hertz >";SAMPLRATE
'
Proc HEADER[BITS,SAMPLRATE]
JOINCODE=0
'
Repeat
Print "Loading bytes.";Lof(1)-Pof(1);" To go..."
Proc LODE[BUFFER] : AMOUNT=Param
Print "Packing";AMOUNT;" bytes to";(AMOUNT/8)*BITS;" bytes."
Proc ADPACK[Start(1),AMOUNT,Start(2),BITS,JOINCODE] : JOINCODE=Param
Print "Saving data..."
Ssave 2,Start(2) To Start(2)+(AMOUNT/8)*BITS
Until AMOUNT<BUFFER
Close 1 : Close 2
'
Procedure ADPACK[STRT,SIZE,DEST,BITS,JOIN]
Areg(0)=STRT : Dreg(0)=SIZE
Areg(1)=DEST : Dreg(1)=JOIN
'
If BITS=2
Proc ADCOMP2 : JC=Dreg(0)
Else If BITS=3
Proc ADCOMP3 : JC=Dreg(0)
End If
End Proc[JC]
'
Procedure LODE[AMOUNT]
POS=Lof(1)-Pof(1)
If POS>=AMOUNT
Sload 1 To Start(1),AMOUNT
Else
Sload 1 To Start(1),POS
AMOUNT=POS
End If
End Proc[AMOUNT]
Procedure HEADER[BITS,SAMPLRATE]
If BITS=2
Poke$ Start(2),"ADPCM2"
Else If BITS=3
Poke$ Start(2),"ADPCM3"
Else
Print "2 or 3 bits only...bye!" : End
End If
'
Loke Start(2)+6,SAMPLRATE
'
Ssave 2,Start(2) To Start(2)+10
End Proc
'
Procedure ADCOMP2
' COMPILED PROCEDURE -- can't convert this to AMOS code
End Proc
Procedure ADCOMP3
' COMPILED PROCEDURE -- can't convert this to AMOS code
End Proc