Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _ULTRASOUND_H_
0003 #define _ULTRASOUND_H_
0004 /*
0005  *  ultrasound.h - Macros for programming the Gravis Ultrasound
0006  *          These macros are extremely device dependent
0007  *          and not portable.
0008  */
0009 /*
0010  * Copyright (C) by Hannu Savolainen 1993-1997
0011  *
0012  * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
0013  * Version 2 (June 1991). See the "COPYING" file distributed with this software
0014  * for more info.
0015  */
0016 
0017 
0018 /*
0019  *  Private events for Gravis Ultrasound (GUS)
0020  *
0021  *  Format:
0022  *      byte 0      - SEQ_PRIVATE (0xfe)
0023  *      byte 1      - Synthesizer device number (0-N)
0024  *      byte 2      - Command (see below)
0025  *      byte 3      - Voice number (0-31)
0026  *      bytes 4 and 5   - parameter P1 (unsigned short)
0027  *      bytes 6 and 7   - parameter P2 (unsigned short)
0028  *
0029  *  Commands:
0030  *      Each command affects one voice defined in byte 3.
0031  *      Unused parameters (P1 and/or P2 *MUST* be initialized to zero).
0032  *      _GUS_NUMVOICES  - Sets max. number of concurrent voices (P1=14-31, default 16)
0033  *      _GUS_VOICESAMPLE- ************ OBSOLETE *************
0034  *      _GUS_VOICEON    - Starts voice (P1=voice mode)
0035  *      _GUS_VOICEOFF   - Stops voice (no parameters)
0036  *      _GUS_VOICEFADE  - Stops the voice smoothly.
0037  *      _GUS_VOICEMODE  - Alters the voice mode, don't start or stop voice (P1=voice mode)
0038  *      _GUS_VOICEBALA  - Sets voice balance (P1, 0=left, 7=middle and 15=right, default 7)
0039  *      _GUS_VOICEFREQ  - Sets voice (sample) playback frequency (P1=Hz)
0040  *      _GUS_VOICEVOL   - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
0041  *      _GUS_VOICEVOL2  - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
0042  *                (Like GUS_VOICEVOL but doesn't change the hw
0043  *                volume. It just updates volume in the voice table).
0044  *
0045  *      _GUS_RAMPRANGE  - Sets limits for volume ramping (P1=low volume, P2=high volume)
0046  *      _GUS_RAMPRATE   - Sets the speed for volume ramping (P1=scale, P2=rate)
0047  *      _GUS_RAMPMODE   - Sets the volume ramping mode (P1=ramping mode)
0048  *      _GUS_RAMPON - Starts volume ramping (no parameters)
0049  *      _GUS_RAMPOFF    - Stops volume ramping (no parameters)
0050  *      _GUS_VOLUME_SCALE - Changes the volume calculation constants
0051  *                for all voices.
0052  */
0053 
0054 #define _GUS_NUMVOICES      0x00
0055 #define _GUS_VOICESAMPLE    0x01    /* OBSOLETE */
0056 #define _GUS_VOICEON        0x02
0057 #define _GUS_VOICEOFF       0x03
0058 #define _GUS_VOICEMODE      0x04
0059 #define _GUS_VOICEBALA      0x05
0060 #define _GUS_VOICEFREQ      0x06
0061 #define _GUS_VOICEVOL       0x07
0062 #define _GUS_RAMPRANGE      0x08
0063 #define _GUS_RAMPRATE       0x09
0064 #define _GUS_RAMPMODE       0x0a
0065 #define _GUS_RAMPON     0x0b
0066 #define _GUS_RAMPOFF        0x0c
0067 #define _GUS_VOICEFADE      0x0d
0068 #define _GUS_VOLUME_SCALE   0x0e
0069 #define _GUS_VOICEVOL2      0x0f
0070 #define _GUS_VOICE_POS      0x10
0071 
0072 /*
0073  *  GUS API macros
0074  */
0075 
0076 #define _GUS_CMD(chn, voice, cmd, p1, p2) \
0077                     {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_PRIVATE;\
0078                     _seqbuf[_seqbufptr+1] = (chn); _seqbuf[_seqbufptr+2] = cmd;\
0079                     _seqbuf[_seqbufptr+3] = voice;\
0080                     *(unsigned short*)&_seqbuf[_seqbufptr+4] = p1;\
0081                     *(unsigned short*)&_seqbuf[_seqbufptr+6] = p2;\
0082                     _SEQ_ADVBUF(8);}
0083 
0084 #define GUS_NUMVOICES(chn, p1)          _GUS_CMD(chn, 0, _GUS_NUMVOICES, (p1), 0)
0085 #define GUS_VOICESAMPLE(chn, voice, p1)     _GUS_CMD(chn, voice, _GUS_VOICESAMPLE, (p1), 0) /* OBSOLETE */
0086 #define GUS_VOICEON(chn, voice, p1)     _GUS_CMD(chn, voice, _GUS_VOICEON, (p1), 0)
0087 #define GUS_VOICEOFF(chn, voice)        _GUS_CMD(chn, voice, _GUS_VOICEOFF, 0, 0)
0088 #define GUS_VOICEFADE(chn, voice)       _GUS_CMD(chn, voice, _GUS_VOICEFADE, 0, 0)
0089 #define GUS_VOICEMODE(chn, voice, p1)       _GUS_CMD(chn, voice, _GUS_VOICEMODE, (p1), 0)
0090 #define GUS_VOICEBALA(chn, voice, p1)       _GUS_CMD(chn, voice, _GUS_VOICEBALA, (p1), 0)
0091 #define GUS_VOICEFREQ(chn, voice, p)        _GUS_CMD(chn, voice, _GUS_VOICEFREQ, \
0092                             (p) & 0xffff, ((p) >> 16) & 0xffff)
0093 #define GUS_VOICEVOL(chn, voice, p1)        _GUS_CMD(chn, voice, _GUS_VOICEVOL, (p1), 0)
0094 #define GUS_VOICEVOL2(chn, voice, p1)       _GUS_CMD(chn, voice, _GUS_VOICEVOL2, (p1), 0)
0095 #define GUS_RAMPRANGE(chn, voice, low, high)    _GUS_CMD(chn, voice, _GUS_RAMPRANGE, (low), (high))
0096 #define GUS_RAMPRATE(chn, voice, p1, p2)    _GUS_CMD(chn, voice, _GUS_RAMPRATE, (p1), (p2))
0097 #define GUS_RAMPMODE(chn, voice, p1)        _GUS_CMD(chn, voice, _GUS_RAMPMODE, (p1), 0)
0098 #define GUS_RAMPON(chn, voice, p1)      _GUS_CMD(chn, voice, _GUS_RAMPON, (p1), 0)
0099 #define GUS_RAMPOFF(chn, voice)         _GUS_CMD(chn, voice, _GUS_RAMPOFF, 0, 0)
0100 #define GUS_VOLUME_SCALE(chn, voice, p1, p2)    _GUS_CMD(chn, voice, _GUS_VOLUME_SCALE, (p1), (p2))
0101 #define GUS_VOICE_POS(chn, voice, p)        _GUS_CMD(chn, voice, _GUS_VOICE_POS, \
0102                             (p) & 0xffff, ((p) >> 16) & 0xffff)
0103 
0104 #endif