//static DEVICE_START( ym2612 ) int device_start_ym2612(UINT8 ChipID, int clock) { //static const ym2612_interface dummy = { 0 }; //ym2612_state *info = get_safe_token(device); ym2612_state *info; int rate; if (ChipID >= MAX_CHIPS) return 0; info = &YM2612Data[ChipID]; rate = clock/72; if (EMU_CORE == EC_MAME && ! (ChipFlags & 0x02)) rate /= 2; if ((CHIP_SAMPLING_MODE == 0x01 && rate < CHIP_SAMPLE_RATE) || CHIP_SAMPLING_MODE == 0x02) rate = CHIP_SAMPLE_RATE; //info->intf = device->static_config ? (const ym2612_interface *)device->static_config : &dummy; //info->intf = &dummy; //info->device = device; /* FM init */ /* Timer Handler set */ //info->timer[0] = timer_alloc(device->machine, timer_callback_2612_0, info); //info->timer[1] = timer_alloc(device->machine, timer_callback_2612_1, info); /* stream system initialize */ //info->stream = stream_create(device,0,2,rate,info,ym2612_stream_update); /**** initialize YM2612 ****/ switch(EMU_CORE) { case EC_MAME: //info->chip = ym2612_init(info,clock,rate,timer_handler,IRQHandler); info->chip = ym2612_init(info, clock, rate, NULL, NULL); break; #ifdef ENABLE_ALL_CORES case EC_GENS: if (GensBuf[0x00] == NULL) { GensBuf[0x00] = malloc(sizeof(int) * 0x100); GensBuf[0x01] = GensBuf[0x00] + 0x80; } info->chip = YM2612_Init(clock, rate, 0x00); YM2612_SetMute(info->chip, 0x80); // Disable SSG-EG break; #endif } //assert_always(info->chip != NULL, "Error creating YM2612 chip"); //ym2612_postload(info->chip); //state_save_register_postload(device->machine, ym2612_intf_postload, info); //ym2612_intf_postload(); return rate; }
void ym2612_device::device_start() { int rate = clock()/72; m_irq_handler.resolve(); /* FM init */ /* 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); /**** initialize YM2612 ****/ m_chip = ym2612_init(this,this,clock(),rate,timer_handler,IRQHandler); assert_always(m_chip != NULL, "Error creating YM2612 chip"); }
static DEVICE_START( ym2612 ) { static const ym2612_interface dummy = { 0 }; ym2612_state *info = get_safe_token(device); int rate = device->clock()/72; info->intf = device->static_config() ? (const ym2612_interface *)device->static_config() : &dummy; info->device = device; /* FM init */ /* Timer Handler set */ info->timer[0] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_2612_0), info); info->timer[1] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_2612_1), info); /* stream system initialize */ info->stream = device->machine().sound().stream_alloc(*device,0,2,rate,info,ym2612_stream_update); /**** initialize YM2612 ****/ info->chip = ym2612_init(info,device,device->clock(),rate,timer_handler,IRQHandler); assert_always(info->chip != NULL, "Error creating YM2612 chip"); device->machine().save().register_postload(save_prepost_delegate(FUNC(ym2612_intf_postload), info)); }
static DEVICE_START( ym2612 ) { static const ym2612_interface dummy = { 0 }; ym2612_state *info = get_safe_token(device); int rate = device->clock()/72; info->intf = device->baseconfig().static_config() ? (const ym2612_interface *)device->baseconfig().static_config() : &dummy; info->device = device; /* FM init */ /* Timer Handler set */ info->timer[0] = timer_alloc(device->machine, timer_callback_2612_0, info); info->timer[1] = timer_alloc(device->machine, timer_callback_2612_1, info); /* stream system initialize */ info->stream = stream_create(device,0,2,rate,info,ym2612_stream_update); /**** initialize YM2612 ****/ info->chip = ym2612_init(info,device,device->clock(),rate,timer_handler,IRQHandler); assert_always(info->chip != NULL, "Error creating YM2612 chip"); state_save_register_postload(device->machine, ym2612_intf_postload, info); }