Make sure all voices are deallocated on close.

This commit is contained in:
mycroft 1998-09-13 04:41:34 +00:00
parent 7dcac1e40c
commit 32f42fe1e9
2 changed files with 15 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: opl.c,v 1.4 1998/08/26 13:08:10 augustss Exp $ */
/* $NetBSD: opl.c,v 1.5 1998/09/13 04:41:34 mycroft Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -183,12 +183,12 @@ opl_command(sc, offs, addr, data)
if (sc->model == OPL_2)
delay(10);
else
delay(2);
delay(6);
bus_space_write_1(sc->iot, sc->ioh, OPL_DATA+offs, data);
if (sc->model == OPL_2)
delay(30);
else
delay(2);
delay(6);
}
int
@ -347,13 +347,10 @@ oplsyn_close(ms)
midisyn *ms;
{
struct opl_softc *sc = ms->data;
int v;
DPRINTFN(2, ("oplsyn_close:\n"));
/*opl_reset(ms->data);*/
for (v = 0; v < sc->syn.nvoice ; v++)
oplsyn_noteoff(ms, v, 0, 0);
if (sc->spkrctl)
sc->spkrctl(sc->spkrarg, 0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: midisyn.c,v 1.3 1998/08/17 21:16:12 augustss Exp $ */
/* $NetBSD: midisyn.c,v 1.4 1998/09/13 04:41:34 mycroft Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -112,10 +112,18 @@ midisyn_close(addr)
void *addr;
{
midisyn *ms = addr;
struct midisyn_methods *fs;
int v;
DPRINTF(("midisyn_close: ms=%p ms->mets=%p\n", ms, ms->mets));
if (ms->mets->close)
ms->mets->close(ms);
fs = ms->mets;
for (v = 0; v < ms->nvoice; v++)
if (ms->voices[v].inuse) {
fs->noteoff(ms, v, 0, 0);
midisyn_freevoice(ms, v);
}
if (fs->close)
fs->close(ms);
}
void