mirror of https://gitee.com/openkylin/qemu.git
audio: fixes for 2.10
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJZbINkAAoJEEy22O7T6HE4rtwP/0y9GzAQXdWemDFEfk/+ZEZA foImJBORm99Ri5vApM4vR4I+5AHnClPCPUfrAJNNTPZOJJ7u+uaZK6s1dxI9ut3j LVsGlZJBb2sZYr2XUi2bUOp4A/IUgWnwDWBOZQD3iBw1KlaZCOOXtIMZI+01BY05 0KVpqP+LvO5lQClzjbYQ/3gHGpRFpi6/T5ctTK5+UYJLnh8k4pDmFnV/5AvU3uCd at/sSKutwc+pBNiYNmbHyfH0MOI3rf23zEO3LhVkz9QPtgVFShZffmndjxjSpE8Z gcCgISQWMYlY0aCObfe6hOhy9sjA/OClAz5459FylpWj3aMbl7SEirdK+qTwullU mS/e67EHWHRAV0w3b83L4o/VzT57jyX3ArGTUlTE0u/hrLbHULmpJZ5s8mG/GwUA gE3liyHsH34NFn1o0ZGNGWDkI9AGXZcdVAd/zTTvjn1miTRcSmzjKHnoPoV49RXe ZdvD9uHtojKOLlFWQSQxQcn2cohQlwC4SW1/smWvACUpDkLpYVtx0XlkqHsG0O2N i5CT/Z7a2vhPV38UNt3p1gsa3CH/rE3IOh+J/frEisskDWYbWtgYMy5mys97hkfz yiDNbI4vQ9Qt/8FMGAET0Kt64U9bOVr+z72QPq/evqYaL3mz30V0/Rb0uB6kGbua FriSoVyWhBwo+UxBrT4b =2aNN -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/audio-20170717-pull-request' into staging audio: fixes for 2.10 # gpg: Signature made Mon 17 Jul 2017 10:29:08 BST # gpg: using RSA key 0x4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/audio-20170717-pull-request: audio/adlib: remove limitation of one adlib card audio/fmopl: modify timer callback to give opaque and channel parameters in two arguments audio: st_rate_flow exist a infinite loop Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
63dba7e6b1
|
@ -71,6 +71,12 @@ void NAME (void *opaque, struct st_sample *ibuf, struct st_sample *obuf,
|
|||
while (rate->ipos <= (rate->opos >> 32)) {
|
||||
ilast = *ibuf++;
|
||||
rate->ipos++;
|
||||
|
||||
/* if ipos overflow, there is a infinite loop */
|
||||
if (rate->ipos == 0xffffffff) {
|
||||
rate->ipos = 1;
|
||||
rate->opos = rate->opos & 0xffffffff;
|
||||
}
|
||||
/* See if we finished the input buffer yet */
|
||||
if (ibuf >= iend) {
|
||||
goto the_end;
|
||||
|
|
|
@ -74,8 +74,6 @@ typedef struct {
|
|||
PortioList port_list;
|
||||
} AdlibState;
|
||||
|
||||
static AdlibState *glob_adlib;
|
||||
|
||||
static void adlib_stop_opl_timer (AdlibState *s, size_t n)
|
||||
{
|
||||
OPLTimerOver (s->opl, n);
|
||||
|
@ -130,9 +128,9 @@ static uint32_t adlib_read(void *opaque, uint32_t nport)
|
|||
return data;
|
||||
}
|
||||
|
||||
static void timer_handler (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;
|
||||
#ifdef DEBUG
|
||||
double interval;
|
||||
|
@ -259,19 +257,13 @@ static void adlib_realizefn (DeviceState *dev, Error **errp)
|
|||
AdlibState *s = ADLIB(dev);
|
||||
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);
|
||||
if (!s->opl) {
|
||||
error_setg (errp, "OPLCreate %d failed", s->freq);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
OPLSetTimerHandler (s->opl, timer_handler, 0);
|
||||
OPLSetTimerHandler(s->opl, timer_handler, s);
|
||||
s->enabled = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef void (*OPL_TIMERHANDLER)(int channel,double interval_Sec);
|
||||
typedef void (*OPL_TIMERHANDLER)(void *param, int channel, double interval_Sec);
|
||||
|
||||
/* !!!!! here is private section , do not access there member direct !!!!! */
|
||||
|
||||
|
@ -87,13 +87,14 @@ typedef struct fm_opl_f {
|
|||
uint8_t wavesel;
|
||||
/* external event callback handler */
|
||||
OPL_TIMERHANDLER TimerHandler; /* TIMER handler */
|
||||
int TimerParam; /* TIMER parameter */
|
||||
void *TimerParam; /* TIMER parameter */
|
||||
} FM_OPL;
|
||||
|
||||
/* ---------- Generic interface section ---------- */
|
||||
FM_OPL *OPLCreate(int clock, int rate);
|
||||
void OPLDestroy(FM_OPL *OPL);
|
||||
void OPLSetTimerHandler(FM_OPL *OPL,OPL_TIMERHANDLER TimerHandler,int channelOffset);
|
||||
void OPLSetTimerHandler(FM_OPL *OPL, OPL_TIMERHANDLER TimerHandler,
|
||||
void *param);
|
||||
|
||||
int OPLWrite(FM_OPL *OPL,int a,int v);
|
||||
unsigned char OPLRead(FM_OPL *OPL,int a);
|
||||
|
|
Loading…
Reference in New Issue