void ym2610_device::device_start() { ay8910_device::device_start(); int rate = clock()/72; void *pcmbufa,*pcmbufb; int pcmsizea,pcmsizeb; std::string name(tag()); 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(ym2610_device::stream_generate),this)); /* setup adpcm buffers */ pcmbufa = region()->base(); pcmsizea = region()->bytes(); name.append(".deltat"); pcmbufb = (void *)(machine().root_device().memregion(name.c_str())->base()); pcmsizeb = machine().root_device().memregion(name.c_str())->bytes(); if (pcmbufb == NULL || pcmsizeb == 0) { pcmbufb = pcmbufa; pcmsizeb = pcmsizea; } /**** initialize YM2610 ****/ m_chip = ym2610_init(this,this,clock(),rate, pcmbufa,pcmsizea,pcmbufb,pcmsizeb, timer_handler,IRQHandler,&psgintf); assert_always(m_chip != NULL, "Error creating YM2610 chip"); }
static DEVICE_START( ym2610 ) { static const ym2610_interface generic_2610 = { 0 }; static const ay8910_interface generic_ay8910 = { AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT, AY8910_DEFAULT_LOADS, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }; const ym2610_interface *intf = device->baseconfig().static_config() ? (const ym2610_interface *)device->baseconfig().static_config() : &generic_2610; int rate = device->clock()/72; void *pcmbufa,*pcmbufb; int pcmsizea,pcmsizeb; ym2610_state *info = get_safe_token(device); astring name; device_type type = device->type(); info->intf = intf; info->device = device; info->psg = ay8910_start_ym(NULL, device->type(), device, device->clock(), &generic_ay8910); assert_always(info->psg != NULL, "Error creating YM2610/AY8910 chip"); /* Timer Handler set */ info->timer[0] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_0), info); info->timer[1] = device->machine->scheduler().timer_alloc(FUNC(timer_callback_1), info); /* stream system initialize */ info->stream = device->machine->sound().stream_alloc(*device,0,2,rate,info,(type == YM2610) ? ym2610_stream_update : ym2610b_stream_update); /* setup adpcm buffers */ pcmbufa = *device->region(); pcmsizea = device->region()->bytes(); name.printf("%s.deltat", device->tag()); pcmbufb = (void *)(device->machine->region(name)->base()); pcmsizeb = device->machine->region(name)->bytes(); if (pcmbufb == NULL || pcmsizeb == 0) { pcmbufb = pcmbufa; pcmsizeb = pcmsizea; } /**** initialize YM2610 ****/ info->chip = ym2610_init(info,device,device->clock(),rate, pcmbufa,pcmsizea,pcmbufb,pcmsizeb, timer_handler,IRQHandler,&psgintf); assert_always(info->chip != NULL, "Error creating YM2610 chip"); device->machine->state().register_postload(ym2610_intf_postload, info); }
void ym2610_device::device_start() { static const ay8910_interface generic_ay8910 = { AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT, AY8910_DEFAULT_LOADS, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }; int rate = clock()/72; void *pcmbufa,*pcmbufb; int pcmsizea,pcmsizeb; astring name; m_irq_handler.resolve(); m_psg = ay8910_start_ym(this, &generic_ay8910); assert_always(m_psg != NULL, "Error creating YM2610/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(); name.printf("%s.deltat", tag()); pcmbufb = (void *)(machine().root_device().memregion(name)->base()); pcmsizeb = machine().root_device().memregion(name)->bytes(); if (pcmbufb == NULL || pcmsizeb == 0) { pcmbufb = pcmbufa; pcmsizeb = pcmsizea; } /**** initialize YM2610 ****/ m_chip = ym2610_init(this,this,clock(),rate, pcmbufa,pcmsizea,pcmbufb,pcmsizeb, timer_handler,IRQHandler,&psgintf); assert_always(m_chip != NULL, "Error creating YM2610 chip"); }
static UINT8 device_start_ym2610(const DEV_GEN_CFG* cfg, DEV_INFO* retDevInf) { OPN_INF* info; DEV_DATA* devData; UINT32 rate; const DEV_DEF* devDefPtr; 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 = ym2610_init(info, cfg->clock, rate, NULL, NULL); devDefPtr = cfg->flags ? &devDef_MAME_2610B : &devDef_MAME_2610; devData = (DEV_DATA*)info->opn; devData->chipInf = info; // store pointer to OPN_INF into sound chip structure INIT_DEVINF(retDevInf, devData, rate, devDefPtr); init_ssg_devinfo(retDevInf, cfg, 2, AYTYPE_YM2610); return 0x00; }
//static DEVICE_START( ym2610 ) int device_start_ym2610(void **_info, int AY_EMU_CORE, int clock, UINT8 AYDisable, int* AYrate, int CHIP_SAMPLING_MODE, int CHIP_SAMPLE_RATE) { // clock bit 31: 0 - YM2610 // 1 - YM2610B //static const ym2610_interface generic_2610 = { 0 }; #ifdef ENABLE_ALL_CORES static const ay8910_interface generic_ay8910 = { AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT, AY8910_DEFAULT_LOADS //DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }; #endif //const ym2610_interface *intf = device->static_config ? (const ym2610_interface *)device->static_config : &generic_2610; //const ym2610_interface *intf = &generic_2610; int rate; int ay_clock; //void *pcmbufa,*pcmbufb; //int pcmsizea,pcmsizeb; //ym2610_state *info = get_safe_token(device); ym2610_state *info; //astring *name = astring_alloc(); //sound_type type = sound_get_type(device); unsigned char ChipType; #ifdef ENABLE_ALL_CORES if (AY_EMU_CORE >= 0x02) AY_EMU_CORE = EC_EMU2149; #else AY_EMU_CORE = EC_EMU2149; #endif info = (ym2610_state *) calloc(1, sizeof(ym2610_state)); *_info = (void *) info; info->AY_EMU_CORE = AY_EMU_CORE; ChipType = (clock & 0x80000000) ? 0x01 : 0x00; clock &= 0x7FFFFFFF; rate = clock/72; if ((CHIP_SAMPLING_MODE == 0x01 && rate < CHIP_SAMPLE_RATE) || CHIP_SAMPLING_MODE == 0x02) rate = CHIP_SAMPLE_RATE; //info->intf = intf; //info->device = device; //info->psg = ay8910_start_ym(NULL, sound_get_type(device), device, device->clock, &generic_ay8910); 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_YM2610 + ChipType, ay_clock, &generic_ay8910); 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 YM2610/AY8910 chip"); /* Timer Handler set */ //info->timer[0] = timer_alloc(device->machine, timer_callback_0, info); //info->timer[1] = timer_alloc(device->machine, timer_callback_1, info); /* stream system initialize */ //info->stream = stream_create(device,0,2,rate,info,(type == SOUND_YM2610) ? ym2610_stream_update : ym2610b_stream_update); /* setup adpcm buffers */ //pcmbufa = device->region; //pcmsizea = device->regionbytes; //astring_printf(name, "%s.deltat", device->tag); //pcmbufb = (void *)(memory_region(device->machine, astring_c(name))); //pcmsizeb = memory_region_length(device->machine, astring_c(name)); //astring_free(name); /*if (pcmbufb == NULL || pcmsizeb == 0) { pcmbufb = pcmbufa; pcmsizeb = pcmsizea; }*/ /**** initialize YM2610 ****/ //info->chip = ym2610_init(info,device,device->clock,rate, // pcmbufa,pcmsizea,pcmbufb,pcmsizeb, // timer_handler,IRQHandler,&psgintf); info->chip = ym2610_init(info, clock & 0x7FFFFFFF, rate, NULL, NULL, &psgintf); //assert_always(info->chip != NULL, "Error creating YM2610 chip"); //state_save_register_postload(device->machine, ym2610_intf_postload, info); return rate; }