void ym2608_device::device_start() { ay8910_device::device_start(); int rate = clock()/72; void *pcmbufa; int pcmsizea; m_irq_handler.resolve(); /* Timer Handler set */ m_timer[0] = timer_alloc(0); m_timer[1] = timer_alloc(1); /* stream system initialize */ m_stream = machine().sound().stream_alloc(*this,0,2,rate, stream_update_delegate(FUNC(ym2608_device::stream_generate),this)); /* setup adpcm buffers */ pcmbufa = region()->base(); pcmsizea = region()->bytes(); /* initialize YM2608 */ m_chip = ym2608_init(this,this,clock(),rate, pcmbufa,pcmsizea, timer_handler,IRQHandler,&psgintf); assert_always(m_chip != NULL, "Error creating YM2608 chip"); }
static UINT8 device_start_ym2608(const DEV_GEN_CFG* cfg, DEV_INFO* retDevInf) { OPN_INF* info; DEV_DATA* devData; UINT32 rate; rate = cfg->clock / 2 / 72; SRATE_CUSTOM_HIGHEST(cfg->srMode, rate, cfg->smplRate); info = (OPN_INF*)malloc(sizeof(OPN_INF)); info->ssg = NULL; info->opn = ym2608_init(info, cfg->clock, rate, NULL, NULL); devData = (DEV_DATA*)info->opn; devData->chipInf = info; // store pointer to OPN_INF into sound chip structure INIT_DEVINF(retDevInf, devData, rate, &devDef_MAME_2608); init_ssg_devinfo(retDevInf, cfg, 2, AYTYPE_YM2608); return 0x00; }
static DEVICE_START( ym2608 ) { static const ym2608_interface generic_2608 = { { AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT, AY8910_DEFAULT_LOADS, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }, NULL }; const ym2608_interface *intf = device->baseconfig().static_config() ? (const ym2608_interface *)device->baseconfig().static_config() : &generic_2608; int rate = device->clock()/72; void *pcmbufa; int pcmsizea; ym2608_state *info = get_safe_token(device); info->intf = intf; info->device = device; /* FIXME: Force to use simgle output */ info->psg = ay8910_start_ym(NULL, SOUND_YM2608, device, device->clock(), &intf->ay8910_intf); assert_always(info->psg != NULL, "Error creating YM2608/AY8910 chip"); /* Timer Handler set */ info->timer[0] = timer_alloc(device->machine, timer_callback_2608_0, info); info->timer[1] = timer_alloc(device->machine, timer_callback_2608_1, info); /* stream system initialize */ info->stream = stream_create(device,0,2,rate,info,ym2608_stream_update); /* setup adpcm buffers */ pcmbufa = *device->region(); pcmsizea = device->region()->bytes(); /* initialize YM2608 */ info->chip = ym2608_init(info,device,device->clock(),rate, pcmbufa,pcmsizea, timer_handler,IRQHandler,&psgintf); assert_always(info->chip != NULL, "Error creating YM2608 chip"); state_save_register_postload(device->machine, ym2608_intf_postload, info); }
void ym2608_device::device_start() { static const ay8910_interface default_ay8910_config = { AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT, AY8910_DEFAULT_LOADS, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }; int rate = clock()/72; void *pcmbufa; int pcmsizea; const ay8910_interface *ay8910_config = m_ay8910_config != NULL ? m_ay8910_config : &default_ay8910_config; m_irq_handler.resolve(); /* FIXME: Force to use single output */ m_psg = ay8910_start_ym(this, ay8910_config); assert_always(m_psg != NULL, "Error creating YM2608/AY8910 chip"); /* Timer Handler set */ m_timer[0] = timer_alloc(0); m_timer[1] = timer_alloc(1); /* stream system initialize */ m_stream = machine().sound().stream_alloc(*this,0,2,rate); /* setup adpcm buffers */ pcmbufa = *region(); pcmsizea = region()->bytes(); /* initialize YM2608 */ m_chip = ym2608_init(this,this,clock(),rate, pcmbufa,pcmsizea, timer_handler,IRQHandler,&psgintf); assert_always(m_chip != NULL, "Error creating YM2608 chip"); }
//static DEVICE_START( ym2608 ) int device_start_ym2608(UINT8 ChipID, int clock, UINT8 AYDisable, UINT8 AYFlags, int* AYrate) { static const ym2608_interface generic_2608 = { { AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT, AY8910_DEFAULT_LOADS //DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }, NULL }; //const ym2608_interface *intf = device->static_config ? (const ym2608_interface *)device->static_config : &generic_2608; ym2608_interface *intf; int rate; int ay_clock; //void *pcmbufa; //int pcmsizea; //ym2608_state *info = get_safe_token(device); ym2608_state *info; if (ChipID >= MAX_CHIPS) return 0; info = &YM2608Data[ChipID]; rate = clock/72; if ((CHIP_SAMPLING_MODE == 0x01 && rate < CHIP_SAMPLE_RATE) || CHIP_SAMPLING_MODE == 0x02) rate = CHIP_SAMPLE_RATE; info->intf = generic_2608; intf = &info->intf; if (AYFlags) intf->ay8910_intf.flags = AYFlags; //info->device = device; /* FIXME: Force to use single output */ //info->psg = ay8910_start_ym(NULL, SOUND_YM2608, clock, &intf->ay8910_intf); if (! AYDisable) { ay_clock = clock / 4; *AYrate = ay_clock / 8; switch(AY_EMU_CORE) { #ifdef ENABLE_ALL_CORES case EC_MAME: info->psg = ay8910_start_ym(NULL, CHTYPE_YM2608, ay_clock, &intf->ay8910_intf); break; #endif case EC_EMU2149: info->psg = PSG_new(ay_clock, *AYrate); if (info->psg == NULL) return 0; PSG_setVolumeMode((PSG*)info->psg, 1); // YM2149 volume mode break; } } else { info->psg = NULL; *AYrate = 0; } //assert_always(info->psg != NULL, "Error creating YM2608/AY8910 chip"); /* Timer Handler set */ //info->timer[0] = timer_alloc(device->machine, timer_callback_2608_0, info); //info->timer[1] = timer_alloc(device->machine, timer_callback_2608_1, info); /* stream system initialize */ //info->stream = stream_create(device,0,2,rate,info,ym2608_stream_update); /* setup adpcm buffers */ //pcmbufa = device->region; //pcmsizea = device->regionbytes; /* initialize YM2608 */ //info->chip = ym2608_init(info,device,device->clock,rate, // pcmbufa,pcmsizea, // timer_handler,IRQHandler,&psgintf); info->chip = ym2608_init(info, clock, rate, NULL, NULL, &psgintf); //assert_always(info->chip != NULL, "Error creating YM2608 chip"); //state_save_register_postload(device->machine, ym2608_intf_postload, info); return rate; }