Make the OPL driver turn on the sound on sound cards that require it.
That makes it much more likely that we get any sound. DUH!
This commit is contained in:
parent
a890d2dd7f
commit
bb3c56652c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: opl.c,v 1.2 1998/08/22 22:54:11 augustss Exp $ */
|
||||
/* $NetBSD: opl.c,v 1.3 1998/08/26 12:10:22 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -157,7 +157,7 @@ opl_attach(sc)
|
||||
sc->syn.data = sc;
|
||||
sc->syn.nvoice = sc->model == OPL_2 ? OPL2_NVOICE : OPL3_NVOICE;
|
||||
sc->syn.flags = MS_DOALLOC | MS_FREQXLATE;
|
||||
midisyn_attach(&sc->sc_mididev, &sc->syn);
|
||||
midisyn_attach(&sc->mididev, &sc->syn);
|
||||
|
||||
/* Set up voice table */
|
||||
for (i = 0; i < OPL3_NVOICE; i++)
|
||||
@ -167,7 +167,7 @@ opl_attach(sc)
|
||||
|
||||
printf(": model OPL%d\n", sc->model);
|
||||
|
||||
midi_attach_mi(&midisyn_hw_if, &sc->syn, &sc->sc_mididev.dev);
|
||||
midi_attach_mi(&midisyn_hw_if, &sc->syn, &sc->mididev.dev);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -180,21 +180,15 @@ opl_command(sc, offs, addr, data)
|
||||
sc, offs, addr, data));
|
||||
offs += sc->offs;
|
||||
bus_space_write_1(sc->iot, sc->ioh, OPL_ADDR+offs, addr);
|
||||
if (sc->model == OPL_2) {
|
||||
if (sc->model == OPL_2)
|
||||
delay(10);
|
||||
} else {
|
||||
/* wait a little */
|
||||
bus_space_read_1(sc->iot, sc->ioh, OPL_STATUS+offs);
|
||||
bus_space_read_1(sc->iot, sc->ioh, OPL_STATUS+offs);
|
||||
}
|
||||
else
|
||||
delay(2);
|
||||
bus_space_write_1(sc->iot, sc->ioh, OPL_DATA+offs, data);
|
||||
if (sc->model == OPL_2) {
|
||||
if (sc->model == OPL_2)
|
||||
delay(30);
|
||||
} else {
|
||||
/* wait a little */
|
||||
bus_space_read_1(sc->iot, sc->ioh, OPL_STATUS+offs);
|
||||
bus_space_read_1(sc->iot, sc->ioh, OPL_STATUS+offs);
|
||||
}
|
||||
else
|
||||
delay(2);
|
||||
}
|
||||
|
||||
int
|
||||
@ -325,6 +319,10 @@ opl_reset(sc)
|
||||
|
||||
opl_command(sc, OPL_LO, OPL_TEST, OPL_ENABLE_WAVE_SELECT);
|
||||
opl_command(sc, OPL_LO, OPL_PERCUSSION, 0);
|
||||
if (sc->model == OPL_3) {
|
||||
opl_command(sc, OPL_HI, OPL_MODE, OPL3_ENABLE);
|
||||
opl_command(sc, OPL_HI,OPL_CONNECTION_SELECT,OPL_NOCONNECTION);
|
||||
}
|
||||
|
||||
sc->volume = 64;
|
||||
}
|
||||
@ -334,8 +332,13 @@ oplsyn_open(ms, flags)
|
||||
midisyn *ms;
|
||||
int flags;
|
||||
{
|
||||
struct opl_softc *sc = ms->data;
|
||||
|
||||
DPRINTFN(2, ("oplsyn_open: %d\n", flags));
|
||||
|
||||
opl_reset(ms->data);
|
||||
if (sc->spkrctl)
|
||||
sc->spkrctl(sc->spkrarg, 1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -351,6 +354,8 @@ oplsyn_close(ms)
|
||||
|
||||
for (v = 0; v < sc->syn.nvoice ; v++)
|
||||
oplsyn_noteoff(ms, v, 0, 0);
|
||||
if (sc->spkrctl)
|
||||
sc->spkrctl(sc->spkrarg, 0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: oplvar.h,v 1.1 1998/08/17 21:16:13 augustss Exp $ */
|
||||
/* $NetBSD: oplvar.h,v 1.2 1998/08/26 12:10:22 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -47,7 +47,7 @@ struct opl_voice {
|
||||
};
|
||||
|
||||
struct opl_softc {
|
||||
struct midi_softc sc_mididev;
|
||||
struct midi_softc mididev;
|
||||
bus_space_tag_t iot;
|
||||
bus_space_handle_t ioh;
|
||||
int offs;
|
||||
@ -58,6 +58,9 @@ struct opl_softc {
|
||||
|
||||
struct opl_voice voices[OPL3_NVOICE];
|
||||
int volume;
|
||||
|
||||
int (*spkrctl)__P((void *, int));
|
||||
void *spkrarg;
|
||||
};
|
||||
|
||||
struct opl_attach_arg {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ess.c,v 1.24 1998/08/22 22:55:09 augustss Exp $ */
|
||||
/* $NetBSD: ess.c,v 1.25 1998/08/26 12:10:22 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997
|
||||
@ -844,7 +844,7 @@ essattach(sc)
|
||||
/*
|
||||
* Set gain on each mixer device to a sensible value.
|
||||
* Devices not normally used are turned off, and other devices
|
||||
* are set to 75% volume.
|
||||
* are set to 50% volume.
|
||||
*/
|
||||
for (i = 0; i < ESS_NDEVS; i++) {
|
||||
switch(i) {
|
||||
@ -860,7 +860,7 @@ essattach(sc)
|
||||
v = 0;
|
||||
break;
|
||||
default:
|
||||
v = ESS_4BIT_GAIN(AUDIO_MAX_GAIN * 3 / 4);
|
||||
v = ESS_4BIT_GAIN(AUDIO_MAX_GAIN / 2);
|
||||
break;
|
||||
}
|
||||
sc->gain[i][ESS_LEFT] = sc->gain[i][ESS_RIGHT] = v;
|
||||
@ -946,6 +946,7 @@ ess_drain(addr)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* XXX should use reference count */
|
||||
int
|
||||
ess_speaker_ctl(addr, newstate)
|
||||
void *addr;
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files.isa,v 1.74 1998/08/25 22:34:29 pk Exp $
|
||||
# $NetBSD: files.isa,v 1.75 1998/08/26 12:10:22 augustss Exp $
|
||||
#
|
||||
# Config file and device description for machine-independent ISA code.
|
||||
# Included by ports that need it. Requires that the SCSI files be
|
||||
@ -293,8 +293,7 @@ attach wss at isa with wss_isa
|
||||
file dev/isa/wss_isa.c wss_isa needs-flag
|
||||
|
||||
# ESS Technology ES1887/ES888/ES1888
|
||||
define ess { }
|
||||
device ess: ess, audio, isadma, mulaw, auconv, midibus
|
||||
device ess { } : ess, audio, isadma, mulaw, auconv, midibus
|
||||
file dev/isa/ess.c ess needs-flag
|
||||
|
||||
attach ess at isa with ess_isa
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: opl_ess.c,v 1.1 1998/08/25 12:52:47 augustss Exp $ */
|
||||
/* $NetBSD: opl_ess.c,v 1.2 1998/08/26 12:10:22 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -57,6 +57,8 @@
|
||||
#include <dev/isa/isavar.h>
|
||||
#include <dev/isa/essvar.h>
|
||||
|
||||
extern int ess_speaker_ctl __P((void *, int));
|
||||
|
||||
int opl_ess_match __P((struct device *, struct cfdata *, void *));
|
||||
void opl_ess_attach __P((struct device *, struct device *, void *));
|
||||
|
||||
@ -76,9 +78,9 @@ opl_ess_match(parent, match, aux)
|
||||
|
||||
if (aa->type != AUDIODEV_TYPE_OPL)
|
||||
return (0);
|
||||
memset(&sc, 0, sizeof sc);
|
||||
sc.ioh = ssc->sc_ioh;
|
||||
sc.iot = ssc->sc_iot;
|
||||
sc.offs = 0;
|
||||
return (opl_find(&sc));
|
||||
}
|
||||
|
||||
@ -94,6 +96,8 @@ opl_ess_attach(parent, self, aux)
|
||||
sc->ioh = ssc->sc_ioh;
|
||||
sc->iot = ssc->sc_iot;
|
||||
sc->offs = 0;
|
||||
sc->spkrctl = ess_speaker_ctl;
|
||||
sc->spkrarg = ssc;
|
||||
|
||||
opl_attach(sc);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: opl_sb.c,v 1.1 1998/08/18 17:56:39 augustss Exp $ */
|
||||
/* $NetBSD: opl_sb.c,v 1.2 1998/08/26 12:10:23 augustss Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -76,9 +76,9 @@ opl_sb_match(parent, match, aux)
|
||||
|
||||
if (aa->type != AUDIODEV_TYPE_OPL)
|
||||
return (0);
|
||||
memset(&sc, 0, sizeof sc);
|
||||
sc.ioh = ssc->sc_ioh;
|
||||
sc.iot = ssc->sc_iot;
|
||||
sc.offs = 0;
|
||||
return (opl_find(&sc));
|
||||
}
|
||||
|
||||
@ -94,6 +94,8 @@ opl_sb_attach(parent, self, aux)
|
||||
sc->ioh = ssc->sc_ioh;
|
||||
sc->iot = ssc->sc_iot;
|
||||
sc->offs = 0;
|
||||
sc->spkrctl = sbdsp_speaker_ctl;
|
||||
sc->spkrarg = ssc;
|
||||
|
||||
opl_attach(sc);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user