Revision db895a1e hw/audio/adlib.c
b/hw/audio/adlib.c | ||
---|---|---|
283 | 283 |
AUD_remove_card (&s->card); |
284 | 284 |
} |
285 | 285 |
|
286 |
static int Adlib_initfn (ISADevice *dev)
|
|
286 |
static void adlib_realizefn (DeviceState *dev, Error **errp)
|
|
287 | 287 |
{ |
288 | 288 |
AdlibState *s = ADLIB(dev); |
289 | 289 |
struct audsettings as; |
290 | 290 |
|
291 | 291 |
if (glob_adlib) { |
292 |
dolog ("Cannot create more than 1 adlib device\n");
|
|
293 |
return -1;
|
|
292 |
error_setg (errp, "Cannot create more than 1 adlib device");
|
|
293 |
return; |
|
294 | 294 |
} |
295 | 295 |
glob_adlib = s; |
296 | 296 |
|
297 | 297 |
#ifdef HAS_YMF262 |
298 | 298 |
if (YMF262Init (1, 14318180, s->freq)) { |
299 |
dolog ("YMF262Init %d failed\n", s->freq);
|
|
300 |
return -1;
|
|
299 |
error_setg (errp, "YMF262Init %d failed", s->freq);
|
|
300 |
return; |
|
301 | 301 |
} |
302 | 302 |
else { |
303 | 303 |
YMF262SetTimerHandler (0, timer_handler, 0); |
... | ... | |
306 | 306 |
#else |
307 | 307 |
s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, s->freq); |
308 | 308 |
if (!s->opl) { |
309 |
dolog ("OPLCreate %d failed\n", s->freq);
|
|
310 |
return -1;
|
|
309 |
error_setg (errp, "OPLCreate %d failed", s->freq);
|
|
310 |
return; |
|
311 | 311 |
} |
312 | 312 |
else { |
313 | 313 |
OPLSetTimerHandler (s->opl, timer_handler, 0); |
... | ... | |
332 | 332 |
); |
333 | 333 |
if (!s->voice) { |
334 | 334 |
Adlib_fini (s); |
335 |
return -1; |
|
335 |
error_setg (errp, "Initializing audio voice failed"); |
|
336 |
return; |
|
336 | 337 |
} |
337 | 338 |
|
338 | 339 |
s->samples = AUD_get_buffer_size_out (s->voice) >> SHIFT; |
... | ... | |
346 | 347 |
|
347 | 348 |
register_ioport_read (s->port + 8, 2, 1, adlib_read, s); |
348 | 349 |
register_ioport_write (s->port + 8, 2, 1, adlib_write, s); |
349 |
|
|
350 |
return 0; |
|
351 | 350 |
} |
352 | 351 |
|
353 | 352 |
static Property adlib_properties[] = { |
... | ... | |
359 | 358 |
static void adlib_class_initfn (ObjectClass *klass, void *data) |
360 | 359 |
{ |
361 | 360 |
DeviceClass *dc = DEVICE_CLASS (klass); |
362 |
ISADeviceClass *ic = ISA_DEVICE_CLASS (klass); |
|
363 |
ic->init = Adlib_initfn;
|
|
361 |
|
|
362 |
dc->realize = adlib_realizefn;
|
|
364 | 363 |
dc->desc = ADLIB_DESC; |
365 | 364 |
dc->props = adlib_properties; |
366 | 365 |
} |
Also available in: Unified diff