Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


ultrasound.h
001: #ifndef _ULTRASOUND_H_
002: #define _ULTRASOUND_H_
003: /*
004:  *      ultrasound.h - Macros for programming the Gravis Ultrasound
005:  *                      These macros are extremely device dependent
006:  *                      and not portable.
007:  */
008: /*
009:  * Copyright (C) by Hannu Savolainen 1993-1997
010:  *
011:  * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
012:  * Version 2 (June 1991). See the "COPYING" file distributed with this software
013:  * for more info.
014:  */
015: 
016: 
017: /*
018:  *      Private events for Gravis Ultrasound (GUS)
019:  *
020:  *      Format:
021:  *              byte 0          - SEQ_PRIVATE (0xfe)
022:  *              byte 1          - Synthesizer device number (0-N)
023:  *              byte 2          - Command (see below)
024:  *              byte 3          - Voice number (0-31)
025:  *              bytes 4 and 5   - parameter P1 (unsigned short)
026:  *              bytes 6 and 7   - parameter P2 (unsigned short)
027:  *
028:  *      Commands:
029:  *              Each command affects one voice defined in byte 3.
030:  *              Unused parameters (P1 and/or P2 *MUST* be initialized to zero).
031:  *              _GUS_NUMVOICES  - Sets max. number of concurrent voices (P1=14-31, default 16)
032:  *              _GUS_VOICESAMPLE- ************ OBSOLETE *************
033:  *              _GUS_VOICEON    - Starts voice (P1=voice mode)
034:  *              _GUS_VOICEOFF   - Stops voice (no parameters)
035:  *              _GUS_VOICEFADE  - Stops the voice smoothly.
036:  *              _GUS_VOICEMODE  - Alters the voice mode, don't start or stop voice (P1=voice mode)
037:  *              _GUS_VOICEBALA  - Sets voice balance (P1, 0=left, 7=middle and 15=right, default 7)
038:  *              _GUS_VOICEFREQ  - Sets voice (sample) playback frequency (P1=Hz)
039:  *              _GUS_VOICEVOL   - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
040:  *              _GUS_VOICEVOL2  - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
041:  *                                (Like GUS_VOICEVOL but doesn't change the hw
042:  *                                volume. It just updates volume in the voice table).
043:  *
044:  *              _GUS_RAMPRANGE  - Sets limits for volume ramping (P1=low volume, P2=high volume)
045:  *              _GUS_RAMPRATE   - Sets the speed for volume ramping (P1=scale, P2=rate)
046:  *              _GUS_RAMPMODE   - Sets the volume ramping mode (P1=ramping mode)
047:  *              _GUS_RAMPON     - Starts volume ramping (no parameters)
048:  *              _GUS_RAMPOFF    - Stops volume ramping (no parameters)
049:  *              _GUS_VOLUME_SCALE - Changes the volume calculation constants
050:  *                                for all voices.
051:  */
052: 
053: #define _GUS_NUMVOICES          0x00
054: #define _GUS_VOICESAMPLE        0x01    /* OBSOLETE */
055: #define _GUS_VOICEON            0x02
056: #define _GUS_VOICEOFF           0x03
057: #define _GUS_VOICEMODE          0x04
058: #define _GUS_VOICEBALA          0x05
059: #define _GUS_VOICEFREQ          0x06
060: #define _GUS_VOICEVOL           0x07
061: #define _GUS_RAMPRANGE          0x08
062: #define _GUS_RAMPRATE           0x09
063: #define _GUS_RAMPMODE           0x0a
064: #define _GUS_RAMPON             0x0b
065: #define _GUS_RAMPOFF            0x0c
066: #define _GUS_VOICEFADE          0x0d
067: #define _GUS_VOLUME_SCALE       0x0e
068: #define _GUS_VOICEVOL2          0x0f
069: #define _GUS_VOICE_POS          0x10
070: 
071: /*
072:  *      GUS API macros
073:  */
074: 
075: #define _GUS_CMD(chn, voice, cmd, p1, p2) \
076:                                         {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_PRIVATE;\
077:                                         _seqbuf[_seqbufptr+1] = (chn); _seqbuf[_seqbufptr+2] = cmd;\
078:                                         _seqbuf[_seqbufptr+3] = voice;\
079:                                         *(unsigned short*)&_seqbuf[_seqbufptr+4] = p1;\
080:                                         *(unsigned short*)&_seqbuf[_seqbufptr+6] = p2;\
081:                                         _SEQ_ADVBUF(8);}
082: 
083: #define GUS_NUMVOICES(chn, p1)                  _GUS_CMD(chn, 0, _GUS_NUMVOICES, (p1), 0)
084: #define GUS_VOICESAMPLE(chn, voice, p1)         _GUS_CMD(chn, voice, _GUS_VOICESAMPLE, (p1), 0) /* OBSOLETE */
085: #define GUS_VOICEON(chn, voice, p1)             _GUS_CMD(chn, voice, _GUS_VOICEON, (p1), 0)
086: #define GUS_VOICEOFF(chn, voice)                _GUS_CMD(chn, voice, _GUS_VOICEOFF, 0, 0)
087: #define GUS_VOICEFADE(chn, voice)               _GUS_CMD(chn, voice, _GUS_VOICEFADE, 0, 0)
088: #define GUS_VOICEMODE(chn, voice, p1)           _GUS_CMD(chn, voice, _GUS_VOICEMODE, (p1), 0)
089: #define GUS_VOICEBALA(chn, voice, p1)           _GUS_CMD(chn, voice, _GUS_VOICEBALA, (p1), 0)
090: #define GUS_VOICEFREQ(chn, voice, p)            _GUS_CMD(chn, voice, _GUS_VOICEFREQ, \
091:                                                         (p) & 0xffff, ((p) >> 16) & 0xffff)
092: #define GUS_VOICEVOL(chn, voice, p1)            _GUS_CMD(chn, voice, _GUS_VOICEVOL, (p1), 0)
093: #define GUS_VOICEVOL2(chn, voice, p1)           _GUS_CMD(chn, voice, _GUS_VOICEVOL2, (p1), 0)
094: #define GUS_RAMPRANGE(chn, voice, low, high)    _GUS_CMD(chn, voice, _GUS_RAMPRANGE, (low), (high))
095: #define GUS_RAMPRATE(chn, voice, p1, p2)        _GUS_CMD(chn, voice, _GUS_RAMPRATE, (p1), (p2))
096: #define GUS_RAMPMODE(chn, voice, p1)            _GUS_CMD(chn, voice, _GUS_RAMPMODE, (p1), 0)
097: #define GUS_RAMPON(chn, voice, p1)              _GUS_CMD(chn, voice, _GUS_RAMPON, (p1), 0)
098: #define GUS_RAMPOFF(chn, voice)                 _GUS_CMD(chn, voice, _GUS_RAMPOFF, 0, 0)
099: #define GUS_VOLUME_SCALE(chn, voice, p1, p2)    _GUS_CMD(chn, voice, _GUS_VOLUME_SCALE, (p1), (p2))
100: #define GUS_VOICE_POS(chn, voice, p)            _GUS_CMD(chn, voice, _GUS_VOICE_POS, \
101:                                                         (p) & 0xffff, ((p) >> 16) & 0xffff)
102: 
103: #endif
104: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/