home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OS2BAS.ZIP / DEMO3ORG.BAS < prev    next >
BASIC Source File  |  1989-07-29  |  3KB  |  95 lines

  1. '***********************************************************
  2. '* 
  3. '* Program Name: Demo3.BAS
  4. '*
  5. '* Description : This is the original, non-PM version of
  6. '*               CAL.BAS. It is a menu-driven program which
  7. '*               allows the user to choose one of several
  8. '*               sounds. There are 2 related files in the
  9. '*               EXIST2PM\DEMO3\TRANS and EXIST2PM\DEMO3\PM
  10. '*               directories. The first is a PM app which has
  11. '*               the same "look and feel" as this one by
  12. '*               using straight keyboard input. The second
  13. '*               uses other PM features such as a menu and
  14. '*               message box instead.
  15. '***********************************************************
  16.  
  17. DECLARE SUB Bounce (Hi%, Low%)
  18. DECLARE SUB Fall (Hi%, Low%, Del%)
  19. DECLARE SUB Siren (Hi%, Range%)
  20. DECLARE SUB Klaxon (Hi%, Low%)
  21. DEFINT A-Z
  22.  
  23. ' QB 4.5 Version of Sound Effects Demo Program
  24.  
  25. ' Sound effects menu
  26. DO
  27.    CLS
  28.    PRINT "Sound effects": PRINT
  29.    COLOR 15, 0: PRINT "  B"; :  COLOR 7, 0: PRINT "ouncing"
  30.    COLOR 15, 0: PRINT "  F"; :  COLOR 7, 0: PRINT "alling"
  31.    COLOR 15, 0: PRINT "  K"; :  COLOR 7, 0: PRINT "laxon"
  32.    COLOR 15, 0: PRINT "  S"; :  COLOR 7, 0: PRINT "iren"
  33.    COLOR 15, 0: PRINT "  Q"; :  COLOR 7, 0: PRINT "uit"
  34.    PRINT : PRINT "Select: ";
  35.  
  36.    ' Get valid key
  37.    DO
  38.       Q$ = UCASE$(INPUT$(1))
  39.    LOOP WHILE INSTR("BFKSQ", Q$) = 0
  40.  
  41.    ' Take action based on key
  42.    CLS
  43.    SELECT CASE Q$
  44.       CASE IS = "B"
  45.          PRINT "Bouncing . . . "
  46.          Bounce 32767, 246
  47.       CASE IS = "F"
  48.          PRINT "Falling . . . "
  49.          Fall 2000, 550, 500
  50.       CASE IS = "S"
  51.          PRINT "Wailing . . ."
  52.          PRINT " . . . press any key to end."
  53.          Siren 780, 650
  54.       CASE IS = "K"
  55.          PRINT "Oscillating . . ."
  56.          PRINT " . . . press any key to end."
  57.          Klaxon 987, 329
  58.       CASE ELSE
  59.    END SELECT
  60. LOOP UNTIL Q$ = "Q"
  61. END
  62.  
  63. ' Loop two sounds down at decreasing time intervals
  64. SUB Bounce (Hi%, Low%) STATIC
  65.    FOR Count = 60 TO 1 STEP -2
  66.       SOUND Low - Count / 2, Count / 20
  67.       SOUND Hi, Count / 15
  68.    NEXT Count
  69. END SUB
  70.  
  71. ' Loop down from a high sound to a low sound
  72. SUB Fall (Hi%, Low%, Del%) STATIC
  73.    FOR Count = Hi TO Low STEP -10
  74.       SOUND Count, Del / Count
  75.    NEXT Count
  76. END SUB
  77.  
  78. ' Alternate two sounds until a key is pressed
  79. SUB Klaxon (Hi%, Low%) STATIC
  80.    DO WHILE INKEY$ = ""
  81.       SOUND Hi, 5
  82.       SOUND Low, 5
  83.    LOOP
  84. END SUB
  85.  
  86. ' Loop a sound from low to high to low
  87. SUB Siren (Hi%, Range%)
  88.    DO WHILE INKEY$ = ""
  89.       FOR Count = Range TO -Range STEP -4
  90.          SOUND Hi - ABS(Count), .3
  91.          Count = Count - 2 / Range
  92.       NEXT Count
  93.    LOOP
  94. END SUB
  95.