summaryrefslogtreecommitdiffstats
path: root/hw/audio/fmopl.c
diff options
context:
space:
mode:
authorHervé Poussineau2017-06-21 06:34:00 +0200
committerGerd Hoffmann2017-07-17 11:09:02 +0200
commitc57fbf50e7b5f94efc697b1d8ef387a5b2b4a5ee (patch)
tree388a2c9c506262443ed2fcc86e72aa8ba1e95c62 /hw/audio/fmopl.c
parentaudio: st_rate_flow exist a infinite loop (diff)
downloadqemu-c57fbf50e7b5f94efc697b1d8ef387a5b2b4a5ee.tar.gz
qemu-c57fbf50e7b5f94efc697b1d8ef387a5b2b4a5ee.tar.xz
qemu-c57fbf50e7b5f94efc697b1d8ef387a5b2b4a5ee.zip
audio/fmopl: modify timer callback to give opaque and channel parameters in two arguments
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20170621043401.19842-2-hpoussin@reactos.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/audio/fmopl.c')
-rw-r--r--hw/audio/fmopl.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 202f752c5d..5cfb6a96dd 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -788,14 +788,18 @@ static void OPLWriteReg(FM_OPL *OPL, int r, int v)
{
double interval = st2 ? (double)OPL->T[1]*OPL->TimerBase : 0.0;
OPL->st[1] = st2;
- if (OPL->TimerHandler) (OPL->TimerHandler)(OPL->TimerParam+1,interval);
+ if (OPL->TimerHandler) {
+ (OPL->TimerHandler)(OPL->TimerParam, 1, interval);
+ }
}
/* timer 1 */
if(OPL->st[0] != st1)
{
double interval = st1 ? (double)OPL->T[0]*OPL->TimerBase : 0.0;
OPL->st[0] = st1;
- if (OPL->TimerHandler) (OPL->TimerHandler)(OPL->TimerParam+0,interval);
+ if (OPL->TimerHandler) {
+ (OPL->TimerHandler)(OPL->TimerParam, 0, interval);
+ }
}
}
return;
@@ -1128,10 +1132,11 @@ void OPLDestroy(FM_OPL *OPL)
/* ---------- Option handlers ---------- */
-void OPLSetTimerHandler(FM_OPL *OPL,OPL_TIMERHANDLER TimerHandler,int channelOffset)
+void OPLSetTimerHandler(FM_OPL *OPL, OPL_TIMERHANDLER TimerHandler,
+ void *param)
{
OPL->TimerHandler = TimerHandler;
- OPL->TimerParam = channelOffset;
+ OPL->TimerParam = param;
}
/* ---------- YM3812 I/O interface ---------- */
@@ -1197,6 +1202,9 @@ int OPLTimerOver(FM_OPL *OPL,int c)
}
}
/* reload timer */
- if (OPL->TimerHandler) (OPL->TimerHandler)(OPL->TimerParam+c,(double)OPL->T[c]*OPL->TimerBase);
+ if (OPL->TimerHandler) {
+ (OPL->TimerHandler)(OPL->TimerParam, c,
+ (double)OPL->T[c] * OPL->TimerBase);
+ }
return OPL->status>>7;
}