home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 28
/
amigaformatcd28.iso
/
-seriously_amiga-
/
programming
/
amos
/
lipsynclab
/
buster.amos
/
buster.amosSourceCode
Wrap
AMOS Source Code
|
1998-04-23
|
4KB
|
143 lines
'Buster Speaks, �1998 Steve Tiffany
'an example of using LipSyncLab data with HAM screens...
'The data generated by LSL goes into the procedure AD[], where it gets copied
'as needed to files in ram: that hold which samples to play and all necessary
'mouth data...
Global SAMDIR$,CURRDIR$,PICDIR$
'Important! Change next line to true location of LipSyncLab directory...
CURRDIR$="work:LipSyncLab/"
'CURRDIR$=Dir$ : Rem : Change to this just before compiling.
Proc SETUP
Do
Proc WRITESCENE
Proc PERFORMSCENE
Loop
Procedure SETUP
SAMDIR$=CURRDIR$+"Samples/" : PICDIR$=CURRDIR$+"Pictures/"
Screen Open 0,320,200,2,Lowres : Cls 0 :
Auto View Off
'load pictures to screens 1-7...
For J=1 To 7
Screen Open J,320,200,4096,Lowres
Hide
J$=PICDIR$+"Buster"+Str$(J)-" "
Load Iff J$
Next J
Screen To Front 1
Auto View On
'longest possible sentence is 8 samples, so open 8 banks...
For J=10 To 17
Reserve As Chip Work J,8032 : Rem : temporary banks to hold samples
Next J
End Proc
Procedure WRITESCENE
'write files in ram: for the words he'll say...
Open Out 1,"ram:SceneNums.asc" : Open Out 2,"ram:SceneWords.asc"
'Gotta have two separate files because first you load all samples into
'memory banks, then you play them one by one and display the mouths.
'If it's all in one file, there's all this mouth data in between the
'sample names, so it can't tell which samples to pre-load.
AD["think"] : AD["of"] : AD["soup"] : AD["."]
AD["soup"] : AD["like"] : AD["Iwould"] : AD["make"] : AD["you"] : AD["."]
AD["you"] : AD["forget"] : AD["me"] : AD["but"] : AD["Iwould"] :
AD["think"] : AD["of"] : AD["you"] : AD["."]
AD["Iwould"] : AD["like"] : AD["you"] : AD["."]
AD["Iwould"] : AD["like"] : AD["you"] : AD["to"] :
AD["make"] : AD["me"] : AD["soup"] : AD["."]
AD["Iwould"] : AD["like"] : AD["you"] : AD["to"] : AD["forget"] : AD["."]
AD["Iwould"] : AD["forget"] : AD["you"] : AD["but"] :
AD["think"] : AD["of"] : AD["soup"] : AD["."] : AD["END"]
Close 1 : Close 2
End Proc
Procedure PERFORMSCENE
'speak the sentences by reading the files...
Open In 1,"ram:SceneNums.asc" : Open In 2,"ram:SceneWords.asc"
Do
CURRBANK=9
Gosub BANKLOAD : Rem : load all samples in this sentence
If WORD$="END" Then Exit
Gosub PERFORMSENT
Loop
Close 1 : Close 2
Pop Proc
BANKLOAD:
Do
Input #2,WORD$ :
If WORD$="END"
Return : Rem : it's over
Else If WORD$="SpeakSent"
Return : Rem : speak the sentence
Else
Inc CURRBANK
SAM$=SAMDIR$+WORD$
Bload SAM$,Start(CURRBANK) : Rem : load sample into temporary bank
End If
Loop
Return
PERFORMSENT:
For K=10 To CURRBANK
Input #1,SAMLEN : Input #1,NUMMOUTHS
Sam Raw 3,Start(K),SAMLEN,13982
For J=1 To NUMMOUTHS
XWAITRESS=Timer
Input #1,MOUTHNUM : Screen To Front MOUTHNUM
Input #1,MOUTHWAIT :
While Timer<XWAITRESS+MOUTHWAIT : Rem : check for clicks while waiting
If Mouse Click=1
Close 1 : Close 2
Kill "ram:SceneNums.asc"
Kill "ram:SceneWords.asc" : Edit
End If
Wend
Next J
Next K
Screen To Front 1
Wait 30
Return
End Proc
Procedure AD[WORD$]
'adds the word and its relevant data to the file in ram: ...
If WORD$="."
Print #2,"SpeakSent"
Else If WORD$="END"
Print #2,"END"
Else
Print #2,WORD$
WORD$="_"+Upper$(WORD$)-" "
Restore WORD$ :
Read SAMLENGTH : Print #1,SAMLENGTH
Read NUMMOUTHS : Print #1,NUMMOUTHS
For J=1 To NUMMOUTHS
Read MOUTHNUM : Print #1,MOUTHNUM :
Read MOUTHWAIT : Print #1,MOUTHWAIT
Next J
End If
Pop Proc
_BUT: Data 2346,3,1,2,3,4,2,5
_FORGET: Data 8022,6,7,3,3,4,4,6,2,4,3,10,2,7
_IWOULD: Data 6442,4,3,5,2,4,4,10,2,9
_LIKE: Data 5616,3,2,8,3,8,2,8
_MAKE: Data 4004,3,1,3,3,6,2,8
_ME: Data 4236,2,1,5,6,14
_OF: Data 2730,2,3,3,7,9
_SOUP: Data 7756,3,2,12,4,14,1,8
_THINK: Data 4320,3,2,2,3,6,2,11
_TO: Data 2686,3,2,3,3,4,2,4
_YOU: Data 4766,2,2,4,4,16
End Proc