mirror of https://github.com/xqemu/xqemu.git
audio/adlib: remove limitation of one adlib card
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20170621043401.19842-3-hpoussin@reactos.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
c57fbf50e7
commit
639b49ef9a
|
@ -74,8 +74,6 @@ typedef struct {
|
||||||
PortioList port_list;
|
PortioList port_list;
|
||||||
} AdlibState;
|
} AdlibState;
|
||||||
|
|
||||||
static AdlibState *glob_adlib;
|
|
||||||
|
|
||||||
static void adlib_stop_opl_timer (AdlibState *s, size_t n)
|
static void adlib_stop_opl_timer (AdlibState *s, size_t n)
|
||||||
{
|
{
|
||||||
OPLTimerOver (s->opl, n);
|
OPLTimerOver (s->opl, n);
|
||||||
|
@ -132,7 +130,7 @@ static uint32_t adlib_read(void *opaque, uint32_t nport)
|
||||||
|
|
||||||
static void timer_handler (void *opaque, int c, double interval_Sec)
|
static void timer_handler (void *opaque, int c, double interval_Sec)
|
||||||
{
|
{
|
||||||
AdlibState *s = glob_adlib;
|
AdlibState *s = opaque;
|
||||||
unsigned n = c & 1;
|
unsigned n = c & 1;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
double interval;
|
double interval;
|
||||||
|
@ -259,19 +257,13 @@ static void adlib_realizefn (DeviceState *dev, Error **errp)
|
||||||
AdlibState *s = ADLIB(dev);
|
AdlibState *s = ADLIB(dev);
|
||||||
struct audsettings as;
|
struct audsettings as;
|
||||||
|
|
||||||
if (glob_adlib) {
|
|
||||||
error_setg (errp, "Cannot create more than 1 adlib device");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
glob_adlib = s;
|
|
||||||
|
|
||||||
s->opl = OPLCreate (3579545, s->freq);
|
s->opl = OPLCreate (3579545, s->freq);
|
||||||
if (!s->opl) {
|
if (!s->opl) {
|
||||||
error_setg (errp, "OPLCreate %d failed", s->freq);
|
error_setg (errp, "OPLCreate %d failed", s->freq);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
OPLSetTimerHandler (s->opl, timer_handler, 0);
|
OPLSetTimerHandler(s->opl, timer_handler, s);
|
||||||
s->enabled = 1;
|
s->enabled = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue