home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 4 Drivers / 04-Drivers.zip / SBOS2DEV.ZIP / mixertool / sblast_user.h < prev   
C/C++ Source or Header  |  1992-10-23  |  7KB  |  208 lines

  1. /*======================================================================
  2.  
  3. MSF - This is user header for SBOS2.SYS versions 0.91
  4. MSF - this is part of SBOS2, original header below.
  5.  
  6.    Header file for Sound Blaster user programs.
  7.    [ This file is a part of SBlast-BSD-1.4 ]
  8.  
  9.    Steve Haehnichen <shaehnic@ucsd.edu>
  10.  
  11.    $Id: sblast.h,v 1.5 1992/06/13 01:48:15 steve Exp steve $
  12.  
  13.  
  14.    Copyright (C) 1992 Steve Haehnichen.
  15.  
  16.    This program is free software; you can redistribute it and/or modify
  17.    it under the terms of the GNU General Public License as published by
  18.    the Free Software Foundation; either version 1, or (at your option)
  19.    any later version.
  20.  
  21.    This program is distributed in the hope that it will be useful,
  22.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  23.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  24.    GNU General Public License for more details.
  25.  
  26.    You should have received a copy of the GNU General Public License
  27.    along with this program; if not, write to the Free Software
  28.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  29.  
  30.  * $Log: sblast.h,v $
  31.  * Revision 1.5  1992/06/13  01:48:15  steve
  32.  * Released in SBlast-BSD-1.4
  33.  
  34. ======================================================================*/
  35.  
  36. #ifndef SBLAST_H
  37. #define SBLAST_H
  38.  
  39.  
  40. typedef unsigned char FLAG;
  41.  
  42. /*
  43.  * Available compression modes
  44.  * (These are actually DSP DMA-start commands, but you don't care)
  45.  */
  46. enum
  47. {
  48.   PCM_8     = 0x14,        /* Straight 8-bit PCM */
  49.   ADPCM_4     = 0x74,        /* 4-bit ADPCM compression */
  50.   ADPCM_2_6    = 0x76,        /* 2.5-bit ADPCM compression */
  51.   ADPCM_2     = 0x16,        /* 2-bit ADPCM compression */
  52. };
  53.  
  54. enum { LEFT, RIGHT, BOTH };    /* Stereo channel choices */
  55.  
  56.  
  57.  
  58. /*   IOCTLs for FM, Mixer, and DSP control.   */
  59.  
  60. /* MSF - Define category for SBDSP ioctl requests (DSP and MIXER actually) */
  61. #define DSP_CAT   0x80
  62.  
  63. /*
  64.  * FM: Reset chips to silence
  65.  *     Play a note as defined by struct sb_fm_note
  66.  *     Set global FM parameters as defined by struct sb_fm_params
  67.  */
  68. /* MSF - use same functions codes as original driver */
  69. #define FM_IOCTL_RESET          10
  70. #define FM_IOCTL_PLAY_NOTE      11
  71. #define FM_IOCTL_SET_PARAMS     13
  72.  
  73. /* Mixer: Set mixer volume levels
  74.  *        Set mixer control parameters (non-volume stuff)
  75.  *      Read current mixer volume levels
  76.  *      Read current mixer parameters
  77.  *      Reset the mixer to a default state
  78.  */      
  79. #define MIXER_IOCTL_SET_LEVELS     20
  80. #define MIXER_IOCTL_SET_PARAMS     21
  81. #define MIXER_IOCTL_READ_LEVELS    22
  82. #define MIXER_IOCTL_READ_PARAMS 23
  83. #define MIXER_IOCTL_RESET     24
  84.  
  85. /* DSP: Reset the DSP and terminate any transfers.
  86.  *      Set the speed (in Hz) of DSP playback/record.
  87.  *      (Note that the speed parameter is modified to be the actual speed.)
  88.  *      Turn the DSP voice output on (non-zero) or off (0)
  89.  *      Flush any pending written data.
  90.  *      Set the DSP decompression mode to one of the above modes.
  91.  *      Set Stereo playback/record on (non-zero) or off (0)
  92.  *      Set the DMA transfer buffer size
  93.  *      Set error when there is recording overrun (ESUCCESS for ignore)
  94.  */
  95. #define DSP_IOCTL_RESET     0
  96. #define DSP_IOCTL_SPEED     1
  97. #define DSP_IOCTL_VOICE     2
  98. #define DSP_IOCTL_FLUSH     3
  99. #define DSP_IOCTL_COMPRESS    4
  100. #define DSP_IOCTL_STEREO    5
  101. #define DSP_IOCTL_BUFSIZE       6
  102. #define DSP_IOCTL_OVERRUN_ERRNO 7
  103.  
  104. /* DSP legal speed range (really!) */
  105. #define        DSP_MAX_SPEED_PRO    43478
  106. #define         DSP_MAX_SPEED_REG       22222
  107. #define        DSP_MIN_SPEED    3906
  108.  
  109. /* define largest, smallest sizes for transfer buffer size */
  110. #define DSP_MIN_BUFSIZE 256
  111. #define DSP_MAX_BUFSIZE (64*1024-2)
  112.  
  113. struct stereo_vol
  114. {
  115.   BYTE l;            /* Left volume */
  116.   BYTE r;            /* Right volume */
  117. };
  118.  
  119.  
  120. /*
  121.  * Mixer volume levels for MIXER_IOCTL_SET_VOL & MIXER_IOCTL_READ_VOL
  122.  */
  123. struct sb_mixer_levels
  124. {
  125.   struct stereo_vol master;    /* Master volume */
  126.   struct stereo_vol voc;    /* DSP Voice volume */
  127.   struct stereo_vol fm;        /* FM volume */
  128.   struct stereo_vol line;    /* Line-in volume */
  129.   struct stereo_vol cd;        /* CD audio */
  130.   BYTE mic;            /* Microphone level */
  131. };
  132.  
  133. /*
  134.  * Mixer parameters for MIXER_IOCTL_SET_PARAMS & MIXER_IOCTL_READ_PARAMS
  135.  */
  136. struct sb_mixer_params
  137. {
  138.   BYTE record_source;        /* Recording source (See SRC_xxx below) */
  139.   FLAG hifreq_filter;        /* Filter frequency (hi/low) */
  140.   FLAG filter_input;        /* ANFI input filter */
  141.   FLAG filter_output;        /* DNFI output filter */
  142.   FLAG dsp_stereo;        /* 1 if DSP is in Stereo mode */
  143. };
  144. #define SRC_MIC         1    /* Select Microphone recording source */
  145. #define SRC_CD          3    /* Select CD recording source */
  146. #define SRC_LINE        7    /* Use Line-in for recording source */
  147.  
  148.  
  149. /*
  150.  * Data structure composing an FM "note" or sound event.
  151.  */
  152. struct sb_fm_note
  153. {
  154.   BYTE channel;            /* LEFT, RIGHT, or BOTH */
  155.   BYTE operator;        /* Operator cell (0 or 1) */
  156.   BYTE voice;            /* FM voice (0 to 8) */
  157.  
  158.   /* Per operator: */
  159.   BYTE waveform;        /* 2 bits: Select wave shape (see WAVEFORM) */
  160.   FLAG am;            /* Amplitude modulation */
  161.   FLAG vibrato;            /* Vibrato effect */
  162.   FLAG do_sustain;        /* Do sustain phase, or skip it */
  163.   FLAG kbd_scale;        /* Keyboard scaling? */
  164.  
  165.   BYTE harmonic;        /* 4 bits: Which harmonic to generate */
  166.   BYTE scale_level;        /* 2 bits: Decrease output as freq rises*/
  167.   BYTE volume;            /* 6 bits: Intuitive volume */
  168.  
  169.   BYTE attack;            /* 4 bits: Attack rate */
  170.   BYTE decay;            /* 4 bits: Decay rate */
  171.   BYTE sustain;            /* 4 bits: Sustain level */
  172.   BYTE release;            /* 4 bits: Release rate */
  173.  
  174.   /* Apply to both operators of one voice: */
  175.   BYTE feedback;        /* 3 bits: How much feedback for op0 */
  176.   FLAG key_on;            /* Set for active, Clear for silent */
  177.   FLAG indep_op;        /* Clear for op0 to modulate op1,
  178.                    Set for parallel tones. */
  179.  
  180.   /* Freq = 50000 * Fnumber * 2^(octave - 20) */
  181.   BYTE octave;            /* 3 bits: What octave to play (0 = low) */
  182.   unsigned int fnum;        /* 10 bits: Frequency "number" */
  183. };
  184.  
  185. /*
  186.  * FM parameters that apply globally to all voices, and thus are not "notes"
  187.  */
  188. struct sb_fm_params
  189. {
  190.   BYTE channel;            /* LEFT, RIGHT, or BOTH, as defined above */
  191.  
  192.   FLAG am_depth;        /* Amplitude Modulation depth (1=hi) */
  193.   FLAG vib_depth;        /* Vibrato depth (1=hi) */
  194.   FLAG wave_ctl;        /* Let voices select their waveform */
  195.   FLAG speech;            /* Composite "Speech" mode (?) */
  196.   FLAG kbd_split;        /* Keyboard split */
  197.   FLAG rhythm;            /* Percussion mode select */
  198.  
  199.   /* Percussion instruments */
  200.   FLAG bass;
  201.   FLAG snare;
  202.   FLAG tomtom;
  203.   FLAG cymbal;
  204.   FLAG hihat;
  205. };
  206.  
  207. #endif                /* !def SBLAST_H */
  208.