static void *ym2413_start(int sndindex, int clock, const void *config) { int rate = clock/72; struct ym2413_info *info; info = auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); /* emulator create */ info->chip = YM2413Init(clock, rate, sndindex); if (!info->chip) return NULL; /* stream system initialize */ info->stream = stream_create(0,2,rate,info,ym2413_stream_update); YM2413SetUpdateHandler(info->chip, _stream_update, info); return info; #if 0 int i, tst; char name[40]; num = intf->num; tst = YM3812_sh_start (msound); if (tst) return 1; for (i=0;i<num;i++) { ym2413_reset (i); ym2413[i].DAC_stream = stream_create(0, 1, clock/72, i, YM2413DAC_update); if (ym2413[i].DAC_stream == -1) return 1; } return 0; #endif }
static DEVICE_START( ym2413 ) { ym2413_state *info = get_safe_token(device); int rate = device->clock()/72; /* emulator create */ info->chip = ym2413_init(device, device->clock(), rate); assert_always(info->chip != NULL, "Error creating YM2413 chip"); /* stream system initialize */ info->stream = device->machine().sound().stream_alloc(*device,0,2,rate,info,ym2413_stream_update); ym2413_set_update_handler(info->chip, _stream_update, info); #if 0 int i, tst; char name[40]; num = intf->num; tst = YM3812_sh_start (msound); if (tst) return 1; for (i=0;i<num;i++) { ym2413_reset (i); ym2413[i].DAC_stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock()/72, i, YM2413DAC_update); if (ym2413[i].DAC_stream == -1) return 1; } return 0; #endif }