ultrasound.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _ULTRASOUND_H_
  3. #define _ULTRASOUND_H_
  4. /*
  5. * ultrasound.h - Macros for programming the Gravis Ultrasound
  6. * These macros are extremely device dependent
  7. * and not portable.
  8. */
  9. /*
  10. * Copyright (C) by Hannu Savolainen 1993-1997
  11. *
  12. * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
  13. * Version 2 (June 1991). See the "COPYING" file distributed with this software
  14. * for more info.
  15. */
  16. /*
  17. * Private events for Gravis Ultrasound (GUS)
  18. *
  19. * Format:
  20. * byte 0 - SEQ_PRIVATE (0xfe)
  21. * byte 1 - Synthesizer device number (0-N)
  22. * byte 2 - Command (see below)
  23. * byte 3 - Voice number (0-31)
  24. * bytes 4 and 5 - parameter P1 (unsigned short)
  25. * bytes 6 and 7 - parameter P2 (unsigned short)
  26. *
  27. * Commands:
  28. * Each command affects one voice defined in byte 3.
  29. * Unused parameters (P1 and/or P2 *MUST* be initialized to zero).
  30. * _GUS_NUMVOICES - Sets max. number of concurrent voices (P1=14-31, default 16)
  31. * _GUS_VOICESAMPLE- ************ OBSOLETE *************
  32. * _GUS_VOICEON - Starts voice (P1=voice mode)
  33. * _GUS_VOICEOFF - Stops voice (no parameters)
  34. * _GUS_VOICEFADE - Stops the voice smoothly.
  35. * _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode)
  36. * _GUS_VOICEBALA - Sets voice balance (P1, 0=left, 7=middle and 15=right, default 7)
  37. * _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz)
  38. * _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
  39. * _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
  40. * (Like GUS_VOICEVOL but doesn't change the hw
  41. * volume. It just updates volume in the voice table).
  42. *
  43. * _GUS_RAMPRANGE - Sets limits for volume ramping (P1=low volume, P2=high volume)
  44. * _GUS_RAMPRATE - Sets the speed for volume ramping (P1=scale, P2=rate)
  45. * _GUS_RAMPMODE - Sets the volume ramping mode (P1=ramping mode)
  46. * _GUS_RAMPON - Starts volume ramping (no parameters)
  47. * _GUS_RAMPOFF - Stops volume ramping (no parameters)
  48. * _GUS_VOLUME_SCALE - Changes the volume calculation constants
  49. * for all voices.
  50. */
  51. #define _GUS_NUMVOICES 0x00
  52. #define _GUS_VOICESAMPLE 0x01 /* OBSOLETE */
  53. #define _GUS_VOICEON 0x02
  54. #define _GUS_VOICEOFF 0x03
  55. #define _GUS_VOICEMODE 0x04
  56. #define _GUS_VOICEBALA 0x05
  57. #define _GUS_VOICEFREQ 0x06
  58. #define _GUS_VOICEVOL 0x07
  59. #define _GUS_RAMPRANGE 0x08
  60. #define _GUS_RAMPRATE 0x09
  61. #define _GUS_RAMPMODE 0x0a
  62. #define _GUS_RAMPON 0x0b
  63. #define _GUS_RAMPOFF 0x0c
  64. #define _GUS_VOICEFADE 0x0d
  65. #define _GUS_VOLUME_SCALE 0x0e
  66. #define _GUS_VOICEVOL2 0x0f
  67. #define _GUS_VOICE_POS 0x10
  68. /*
  69. * GUS API macros
  70. */
  71. #define _GUS_CMD(chn, voice, cmd, p1, p2) \
  72. {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_PRIVATE;\
  73. _seqbuf[_seqbufptr+1] = (chn); _seqbuf[_seqbufptr+2] = cmd;\
  74. _seqbuf[_seqbufptr+3] = voice;\
  75. *(unsigned short*)&_seqbuf[_seqbufptr+4] = p1;\
  76. *(unsigned short*)&_seqbuf[_seqbufptr+6] = p2;\
  77. _SEQ_ADVBUF(8);}
  78. #define GUS_NUMVOICES(chn, p1) _GUS_CMD(chn, 0, _GUS_NUMVOICES, (p1), 0)
  79. #define GUS_VOICESAMPLE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICESAMPLE, (p1), 0) /* OBSOLETE */
  80. #define GUS_VOICEON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEON, (p1), 0)
  81. #define GUS_VOICEOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEOFF, 0, 0)
  82. #define GUS_VOICEFADE(chn, voice) _GUS_CMD(chn, voice, _GUS_VOICEFADE, 0, 0)
  83. #define GUS_VOICEMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEMODE, (p1), 0)
  84. #define GUS_VOICEBALA(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEBALA, (p1), 0)
  85. #define GUS_VOICEFREQ(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICEFREQ, \
  86. (p) & 0xffff, ((p) >> 16) & 0xffff)
  87. #define GUS_VOICEVOL(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL, (p1), 0)
  88. #define GUS_VOICEVOL2(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_VOICEVOL2, (p1), 0)
  89. #define GUS_RAMPRANGE(chn, voice, low, high) _GUS_CMD(chn, voice, _GUS_RAMPRANGE, (low), (high))
  90. #define GUS_RAMPRATE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_RAMPRATE, (p1), (p2))
  91. #define GUS_RAMPMODE(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPMODE, (p1), 0)
  92. #define GUS_RAMPON(chn, voice, p1) _GUS_CMD(chn, voice, _GUS_RAMPON, (p1), 0)
  93. #define GUS_RAMPOFF(chn, voice) _GUS_CMD(chn, voice, _GUS_RAMPOFF, 0, 0)
  94. #define GUS_VOLUME_SCALE(chn, voice, p1, p2) _GUS_CMD(chn, voice, _GUS_VOLUME_SCALE, (p1), (p2))
  95. #define GUS_VOICE_POS(chn, voice, p) _GUS_CMD(chn, voice, _GUS_VOICE_POS, \
  96. (p) & 0xffff, ((p) >> 16) & 0xffff)
  97. #endif