diff options
author | jkh <jkh@FreeBSD.org> | 1995-07-28 21:40:49 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1995-07-28 21:40:49 +0000 |
commit | 19112b8b1d7c4013411f77a8ee48332903ec93ab (patch) | |
tree | 81647a2f70826c19344d26635282f97d889294b9 /sys/i386/isa/sound/pas2_mixer.c | |
parent | ccee31df86151913015fb2d5accc4c61a4a5f822 (diff) | |
download | FreeBSD-src-19112b8b1d7c4013411f77a8ee48332903ec93ab.zip FreeBSD-src-19112b8b1d7c4013411f77a8ee48332903ec93ab.tar.gz |
Update the sound driver to VOXWARE 3.05 with one GUS patch from
Amancio. There is some SoundSource support here that is primitive and
probably doesn't work, but I'll let the two submitters let me know
how my integration of that was since I don't have this card to test.
I've only tested this on my GUS MAX since it's all I have.
This all probably needs to be re-done anyway since we're widely variant
from the original VOXWARE source in the current layout.
Submitted by: Amancio Hasty and Jim Lowe
Obtained from: Hannu Savolainen
Diffstat (limited to 'sys/i386/isa/sound/pas2_mixer.c')
-rw-r--r-- | sys/i386/isa/sound/pas2_mixer.c | 150 |
1 files changed, 54 insertions, 96 deletions
diff --git a/sys/i386/isa/sound/pas2_mixer.c b/sys/i386/isa/sound/pas2_mixer.c index 18c64e5..0b143b3 100644 --- a/sys/i386/isa/sound/pas2_mixer.c +++ b/sys/i386/isa/sound/pas2_mixer.c @@ -27,7 +27,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pas2_mixer.c,v 1.7 1994/10/01 02:16:56 swallace Exp $ */ #include "sound_config.h" @@ -36,18 +35,12 @@ #include "pas.h" -#define TRACE(what) /* - * * * (what) */ +#define TRACE(what) /* (what) */ extern int translat_code; +extern char pas_model; -static int rec_devices = (SOUND_MASK_MIC); /* - - - * * * * Default * - * recording * source - * - * * */ +static int rec_devices = (SOUND_MASK_MIC); /* Default recording source */ static int mode_control = 0; #define POSSIBLE_RECORDING_DEVICES (SOUND_MASK_SYNTH | SOUND_MASK_SPEAKER | SOUND_MASK_LINE | SOUND_MASK_MIC | \ @@ -60,53 +53,48 @@ static int mode_control = 0; static unsigned short levels[SOUND_MIXER_NRDEVICES] = { - 0x3232, /* - * Master Volume - */ - 0x3232, /* - * Bass - */ - 0x3232, /* - * Treble - */ - 0x5050, /* - * FM - */ - 0x4b4b, /* - * PCM - */ - 0x3232, /* - * PC Speaker - */ - 0x4b4b, /* - * Ext Line - */ - 0x4b4b, /* - * Mic - */ - 0x4b4b, /* - * CD - */ - 0x6464, /* - * Recording monitor - */ - 0x4b4b, /* - * SB PCM - */ - 0x6464}; /* - + 0x3232, /* Master Volume */ + 0x3232, /* Bass */ + 0x3232, /* Treble */ + 0x5050, /* FM */ + 0x4b4b, /* PCM */ + 0x3232, /* PC Speaker */ + 0x4b4b, /* Ext Line */ + 0x4b4b, /* Mic */ + 0x4b4b, /* CD */ + 0x6464, /* Recording monitor */ + 0x4b4b, /* SB PCM */ + 0x6464 /* Recording level */ +}; - * * * * Recording level */ +void +mix_write (unsigned char data, int ioaddr) +{ + /* + * The Revision D cards have a problem with their MVA508 interface. The + * kludge-o-rama fix is to make a 16-bit quantity with identical LSB and + * MSBs out of the output byte and to do a 16-bit out to the mixer port - + * 1. We need to do this because it isn't timing problem but chip access + * sequence problem. + */ + + if (pas_model == PAS_16D) + { + OUTW (data | (data << 8), (ioaddr ^ translat_code) - 1); + OUTB (0x80, 0); + } + else + pas_write (data, ioaddr); +} static int mixer_output (int right_vol, int left_vol, int div, int bits, - int mixer /* - * Input or output mixer - */ ) + int mixer) /* Input or output mixer */ { int left = left_vol * div / 100; int right = right_vol * div / 100; + if (bits & P_M_MV508_MIXER) { /* * Select input or output mixer @@ -161,9 +149,7 @@ pas_mixer_set (int whichDev, unsigned int level) switch (whichDev) { - case SOUND_MIXER_VOLUME: /* - * Master volume (0-63) - */ + case SOUND_MIXER_VOLUME: /* Master volume (0-63) */ levels[whichDev] = mixer_output (right, left, 63, P_M_MV508_MASTER_A, 0); break; @@ -171,62 +157,39 @@ pas_mixer_set (int whichDev, unsigned int level) * Note! Bass and Treble are mono devices. Will use just the left * channel. */ - case SOUND_MIXER_BASS: /* - * Bass (0-12) - */ + case SOUND_MIXER_BASS: /* Bass (0-12) */ levels[whichDev] = mixer_output (right, left, 12, P_M_MV508_BASS, 0); break; - case SOUND_MIXER_TREBLE: /* - * Treble (0-12) - */ + case SOUND_MIXER_TREBLE: /* Treble (0-12) */ levels[whichDev] = mixer_output (right, left, 12, P_M_MV508_TREBLE, 0); break; - case SOUND_MIXER_SYNTH: /* - * Internal synthesizer (0-31) - */ + case SOUND_MIXER_SYNTH: /* Internal synthesizer (0-31) */ levels[whichDev] = mixer_output (right, left, 31, P_M_MV508_MIXER | P_M_MV508_FM, mixer); break; - case SOUND_MIXER_PCM: /* - * PAS PCM (0-31) - */ + case SOUND_MIXER_PCM: /* PAS PCM (0-31) */ levels[whichDev] = mixer_output (right, left, 31, P_M_MV508_MIXER | P_M_MV508_PCM, mixer); break; - case SOUND_MIXER_ALTPCM: /* - * SB PCM (0-31) - */ + case SOUND_MIXER_ALTPCM: /* SB PCM (0-31) */ levels[whichDev] = mixer_output (right, left, 31, P_M_MV508_MIXER | P_M_MV508_SB, mixer); break; - case SOUND_MIXER_SPEAKER: /* - * PC speaker (0-31) - */ + case SOUND_MIXER_SPEAKER: /* PC speaker (0-31) */ levels[whichDev] = mixer_output (right, left, 31, P_M_MV508_MIXER | P_M_MV508_SPEAKER, mixer); break; - case SOUND_MIXER_LINE: /* - * External line (0-31) - */ + case SOUND_MIXER_LINE: /* External line (0-31) */ levels[whichDev] = mixer_output (right, left, 31, P_M_MV508_MIXER | P_M_MV508_LINE, mixer); break; - case SOUND_MIXER_CD: /* - * CD (0-31) - */ + case SOUND_MIXER_CD: /* CD (0-31) */ levels[whichDev] = mixer_output (right, left, 31, P_M_MV508_MIXER | P_M_MV508_CDROM, mixer); break; - case SOUND_MIXER_MIC: /* - * External microphone (0-31) - */ + case SOUND_MIXER_MIC: /* External microphone (0-31) */ levels[whichDev] = mixer_output (right, left, 31, P_M_MV508_MIXER | P_M_MV508_MIC, mixer); break; - case SOUND_MIXER_IMIX: /* - * Recording monitor (0-31) (Only available * - * on the Output Mixer) - */ + case SOUND_MIXER_IMIX: /* Recording monitor (0-31) (Output mixer only) */ levels[whichDev] = mixer_output (right, left, 31, P_M_MV508_MIXER | P_M_MV508_IMIXER, P_M_MV508_OUTPUTMIX); break; - case SOUND_MIXER_RECLEV: /* - * Recording level (0-15) - */ + case SOUND_MIXER_RECLEV: /* Recording level (0-15) */ levels[whichDev] = mixer_output (right, left, 15, P_M_MV508_MASTER_B, 0); break; @@ -254,9 +217,7 @@ pas_mixer_set (int whichDev, unsigned int level) if (level) mode_control |= P_M_MV508_LOUDNESS; set_mode (mode_control); - return !!level; /* - * 0 or 1 - */ + return !!level; /* 0 or 1 */ break; case SOUND_MIXER_RECSRC: @@ -306,7 +267,7 @@ pas_mixer_ioctl (int dev, unsigned int cmd, unsigned int arg) return IOCTL_OUT (arg, pas_mixer_set (cmd & 0xff, IOCTL_IN (arg))); else { /* - * Read parameters + * Read parameters */ switch (cmd & 0xff) @@ -329,15 +290,11 @@ pas_mixer_ioctl (int dev, unsigned int cmd, unsigned int arg) break; case SOUND_MIXER_CAPS: - return IOCTL_OUT (arg, 0); /* - * No special capabilities - */ + return IOCTL_OUT (arg, 0); /* No special capabilities */ break; case SOUND_MIXER_MUTE: - return IOCTL_OUT (arg, 0); /* - * No mute yet - */ + return IOCTL_OUT (arg, 0); /* No mute yet */ break; case SOUND_MIXER_ENHANCE: @@ -362,6 +319,7 @@ pas_mixer_ioctl (int dev, unsigned int cmd, unsigned int arg) static struct mixer_operations pas_mixer_operations = { + "Pro Audio Spectrum 16", pas_mixer_ioctl }; |