home *** CD-ROM | disk | FTP | other *** search
- \ *******************************************************************
-
- \ Sophus S5 CSI Multi-Forth Support
-
- \ Demo2 - More complex example of S5 Library useage
-
- \ *******************************************************************
-
- \ This program performs the same function as SrPlayer in the
- \ library but goes through all the steps that S5Player uses,
- \ to show the way Frags are used, with other routines.
-
- anew demo \ marker
-
- include s5.calls
- include s5.symbols \ needed definitions
-
- \ define two pointer variables for the frag addresses
-
- variable leftfrag
- variable rightfrag
-
- \ success variable
- variable success
- create buff 256 allot \ filename buffer
-
- : grablib 0" s5.library" 0 s5number open.lib
- dup success ! not if abort" Library fault." \ Open the library
- then ;
-
- : player
- cr
- ." File to play: "
- buff 255 input.string
- 0 buff c@ buff + c! \ add null instead of LF
-
- buff c@ 0> if
- 100 FRAG_CHIP S5AllocateFrag leftfrag !
- 100 FRAG_CHIP S5AllocateFrag rightfrag ! \ ask for frag structures
-
- leftfrag @ rightfrag @ | 0= if abort" Memory problems." cr then
-
- \ If we get here we have our frags set up
-
- leftfrag @ buff 1+ 0 S5LoadIFF dup success ! \ try a default IFF load
- success @ dup E_FORMAT = swap E_OK = |
- if
-
- E_FORMAT = if \ not iff
- leftfrag @ rightfrag @ buff 1+ 0 S5Loadsop2 success !
- \ so try sop2 format
- then
- success @ E_OK = if \ play it
- cr ." File read okay."
- leftfrag @ rightfrag @ 0 S5StereoStart
- E_OK = if
- ." Playing it....." cr
- 0 S5WaitForEnd
- 1 S5WaitForEnd
- ." Played it......" cr
- then
- then
- else ." File error. " cr drop
- then
- leftfrag @ S5DeallocateFrag
- rightfrag @ S5DeallocateFrag
- then
- ;
- grablib
- : prompter success @ if
- ." To run, type Player. To forget type forget demo." cr cr
- else cr then ;
- prompter
-
-
-