home *** CD-ROM | disk | FTP | other *** search
/ Millennium Time Capsule / AC2000.BIN / disks / ac5_disk / kp_sack.100 / waveplay.h < prev   
Encoding:
C/C++ Source or Header  |  1997-04-25  |  4.2 KB  |  137 lines

  1. /***********************************************************************
  2. ** 
  3. ** Lattice C WavePlay() Xbios Binding - opcode 0xa5;
  4. ** Original binding by Scott Sanders/SDS.
  5. ** Extra comments by Anthony Jacques & Xav for KPP.
  6. **     (http://www.cs.man.ac.uk/~jacquesa/)
  7. **     (http://www.compsoc.man.ac.uk/~xav)
  8. **
  9. **
  10. ** Function is present ONLY if the 'SAM\0' cookie is in the cookie
  11. ** jar. This should be checked prior to calling these functions.
  12. ** To determine the presence of SAM, use something like:
  13. **
  14. **    sam_present=get_cookie(SAM_COOKIE, NULL);
  15. **
  16. ************************************************************************
  17. **
  18. ** short WavePlay(short flags,    /* Flags (see WP_...)         */
  19. **                long rate,      /* See below for valid rates  */
  20. **                void *sound,    /* Pointer to start of sound  */
  21. **                long length);   /* Length in _bytes_!         */
  22. **
  23. ** This plays the given sample at the given rate with the
  24. ** given properties.
  25. **
  26. ** Returns:
  27. **   0 (WP_OK)      = Sound played...everything ok.
  28. **   1 (WP_NOSOUND) = No error, but sound not played
  29. **  -1 (WP_ERROR)   = An error occurred
  30. **
  31. ************************************************************************
  32. **
  33. ** short WavePlayGlobal(long global); /* see AG_ list below      */
  34. ** 
  35. **
  36. ** This plays the globally defined system-wide sample for
  37. ** the given event (QUIT, SAVE etc). Note that your application
  38. ** should have this event flagged in an SAA for this to take
  39. ** effect.
  40. **
  41. ** Returns:
  42. **   0 (WP_OK)      = Sound played...everything ok.
  43. **   1 (WP_NOSOUND) = No error, but sound not played
  44. **  -1 (WP_ERROR)   = An error occurred
  45. **
  46. ************************************************************************
  47. **
  48. ** short WavePlayMacro(char *cookie, /* 4-letter cookie         */
  49. **                     long macro);  /* global number 0-15      */
  50. ** 
  51. ** This plays an application macro, as defined in an
  52. ** application's SAA file.
  53. **
  54. ** Returns:
  55. **   0 (WP_OK)      = Sound played...everything ok.
  56. **   1 (WP_NOSOUND) = No error, but sound not played
  57. **  -1 (WP_ERROR)   = An error occurred
  58. **
  59. ************************************************************************
  60. **
  61. ** = Note =
  62. **
  63. ** WavePlayMacro() and WavePlayGlobal() are actually variations of 
  64. ** the same call as WavePlay(), but  this should be transparent to
  65. ** the application programmer.
  66. **
  67. ***********************************************************************/
  68.  
  69. #ifndef _WAVEPLAY_H_
  70. #define _WAVEPLAY_H_
  71.  
  72. /* error messages */
  73. #define WP_OK        0
  74. #define WP_ERROR    -1
  75. #define WP_NOSOUND   1
  76.  
  77. /* sample format */
  78. #define WP_STEREO   0x00
  79. #define WP_MONO     0x01
  80.  
  81. #define WP_8BIT     0x00
  82. #define WP_16BIT    0x02
  83.  
  84. /* SAM can use AFM if installed */
  85. #define WP_NOUSEDSP 0x00
  86. #define WP_USEDSP   0x04
  87.  
  88. /* used by the WavePlayMacro() and WavePlayGlobal() calls */
  89. #define WP_MACRO    0x100
  90.  
  91. /* Falcon compatible frequencies */
  92. #ifndef ACT_CLK50K
  93. #define ACT_CLK50K  49170
  94. #define ACT_CLK33K  33880
  95. #define ACT_CLK25K  24585
  96. #define ACT_CLK20K  20770
  97. #define ACT_CLK16K  16490
  98. #define ACT_CLK12K  12292
  99. #define ACT_CLK10K  9834
  100. #define ACT_CLK8K   8195
  101. #endif
  102.  
  103. /* STe/TT Rates */
  104. #ifndef TT_CLK50K
  105. #define TT_CLK50K   50066L
  106. #define TT_CLK25K   25033L
  107. #define TT_CLK12K   12517L
  108. #define TT_CLK6K    6258L    /* NOTE: this isn't valid on a Falcon */
  109. #endif
  110.  
  111. /* both = 'SAM\0' */
  112. #define SAM_COOKIE  0x53414D00
  113. #define APP_GLOBAL  (char *)0x53414D00
  114.  
  115. /* the 'application globals' used for system-wide sounds. */
  116. #define AG_FIND     0L
  117. #define AG_REPLACE  1L
  118. #define AG_CUT      2L
  119. #define AG_COPY     3L
  120. #define AG_PASTE    4L
  121. #define AG_DELETE   5L
  122. #define AG_HELP     6L
  123. #define AG_PRINT    7L
  124. #define AG_SAVE     8L
  125. #define AG_ERROR    9L
  126. #define AG_QUIT     10L
  127.  
  128. /* _sslll = xbios function call */
  129. #pragma inline d0=_sslll((short),(short),,,)    {register d2,a2; "4e4e";}
  130.  
  131. /* The WavePlay xbios call, and some macros using it. */
  132. #define WavePlay(a,b,c,d)   _sslll(0xA5,a,b,c,d)
  133. #define WavePlayGlobal(a)   _sslll(0xA5, WP_MACRO, 0L, APP_GLOBAL, a);
  134. #define WavePlayMacro(a,b)  _sslll(0xA5, WP_MACRO, 0L, (char *)a, (long)b);
  135.  
  136. #endif
  137.