static DEVICE_START( ym2203 ) { static const ym2203_interface generic_2203 = { { AY8910_LEGACY_OUTPUT, AY8910_DEFAULT_LOADS, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }, NULL }; const ym2203_interface *intf = device->baseconfig().static_config() ? (const ym2203_interface *)device->baseconfig().static_config() : &generic_2203; ym2203_state *info = get_safe_token(device); int rate = device->clock()/72; /* ??? */ info->intf = intf; info->device = device; info->psg = ay8910_start_ym(NULL, YM2203, device, device->clock(), &intf->ay8910_intf); assert_always(info->psg != NULL, "Error creating YM2203/AY8910 chip"); /* Timer Handler set */ info->timer[0] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_2203_0), info); info->timer[1] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_2203_1), info); /* stream system initialize */ info->stream = device->machine().sound().stream_alloc(*device,0,1,rate,info,ym2203_stream_update); /* Initialize FM emurator */ info->chip = ym2203_init(info,device,device->clock(),rate,timer_handler,IRQHandler,&psgintf); assert_always(info->chip != NULL, "Error creating YM2203 chip"); device->machine().state().register_postload(ym2203_intf_postload, info); }
static void *ym2203_start(int sndindex, int clock, const void *config) { static const struct YM2203interface generic_2203 = { 0 }; const struct YM2203interface *intf = config ? config : &generic_2203; struct ym2203_info *info; info = auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); info->intf = intf; info->psg = ay8910_start_ym(SOUND_YM2203, sndindex, clock, 3, intf->portAread, intf->portBread, intf->portAwrite, intf->portBwrite); if (!info->psg) return NULL; /* Timer Handler set */ info->timer[0] = timer_alloc_ptr(timer_callback_2203_0, info); info->timer[1] = timer_alloc_ptr(timer_callback_2203_1, info); /* stream system initialize */ info->stream = stream_create(0,1,Machine->sample_rate,info,ym2203_stream_update); /* Initialize FM emurator */ info->chip = YM2203Init(info,sndindex,clock,Machine->sample_rate,TimerHandler,IRQHandler,&psgintf); state_save_register_func_postload_ptr(ym2203_postload, info); if (info->chip) return info; /* error */ /* stream close */ return NULL; }
static void *ym2149_start(int sndindex, int clock, const void *config) { static const struct AY8910interface generic_ay8910 = { AY8910_LEGACY_OUTPUT, AY8910_DEFAULT_LOADS, NULL, NULL, NULL, NULL }; const struct AY8910interface *intf = (config ? config : &generic_ay8910); return ay8910_start_ym(SOUND_YM2149, sndindex+16, clock, intf); }
static void *ym2608_start(int sndindex, int clock, const void *config) { static const struct YM2608interface generic_2608 = { { AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT, AY8910_DEFAULT_LOADS, NULL, NULL, NULL, NULL }, NULL, 0, }; const struct YM2608interface *intf = config ? config : &generic_2608; int rate = clock/72; void *pcmbufa; int pcmsizea; struct ym2608_info *info; info = auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); info->intf = intf; /* FIXME: Force to use simgle output */ info->psg = ay8910_start_ym(SOUND_YM2608, sndindex, clock, &intf->ay8910_intf); if (!info->psg) return NULL; /* Timer Handler set */ info->timer[0] = timer_alloc(timer_callback_2608_0, info); info->timer[1] = timer_alloc(timer_callback_2608_1, info); /* stream system initialize */ info->stream = stream_create(0,2,rate,info,ym2608_stream_update); /* setup adpcm buffers */ pcmbufa = (void *)(memory_region(info->intf->pcmrom)); pcmsizea = memory_region_length(info->intf->pcmrom); /* initialize YM2608 */ info->chip = YM2608Init(info,sndindex,clock,rate, pcmbufa,pcmsizea, timer_handler,IRQHandler,&psgintf); state_save_register_postload(Machine, ym2608_postload, info); if (info->chip) return info; /* error */ return NULL; }
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); }
static void *ym2610_start(int sndindex, int clock, const void *config) { static const struct YM2610interface generic_2610 = { 0 }; const struct YM2610interface *intf = config ? config : &generic_2610; int rate = Machine->sample_rate; void *pcmbufa,*pcmbufb; int pcmsizea,pcmsizeb; struct ym2610_info *info; sound_type = SOUND_YM2610; info = auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); info->intf = intf; info->psg = ay8910_start_ym(SOUND_YM2610, sndindex, clock, 1, NULL, NULL, NULL, NULL); if (!info->psg) return NULL; /* Timer Handler set */ info->timer[0] =timer_alloc_ptr(timer_callback_0, info); info->timer[1] =timer_alloc_ptr(timer_callback_1, info); /* stream system initialize */ info->stream = stream_create(0,2,rate,info,ym2610_stream_update); /* setup adpcm buffers */ pcmbufa = (void *)(memory_region(info->intf->pcmroma)); pcmsizea = memory_region_length(info->intf->pcmroma); pcmbufb = (void *)(memory_region(info->intf->pcmromb)); pcmsizeb = memory_region_length(info->intf->pcmromb); /**** initialize YM2610 ****/ info->chip = YM2610Init(info,sndindex,clock,rate, pcmbufa,pcmsizea,pcmbufb,pcmsizeb, TimerHandler,IRQHandler,&psgintf); state_save_register_func_postload_ptr(ym2610_postload, info); if (info->chip) return info; /* error */ return NULL; }
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 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 void *ym2203_start(int sndindex, int clock, const void *config) { static const struct YM2203interface generic_2203 = { { AY8910_LEGACY_OUTPUT, AY8910_DEFAULT_LOADS, NULL, NULL, NULL, NULL }, NULL }; const struct YM2203interface *intf = config ? config : &generic_2203; struct ym2203_info *info; int rate = clock/72; /* ??? */ info = auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); info->intf = intf; info->psg = ay8910_start_ym(SOUND_YM2203, sndindex, clock, &intf->ay8910_intf); if (!info->psg) return NULL; /* Timer Handler set */ info->timer[0] = timer_alloc(timer_callback_2203_0, info); info->timer[1] = timer_alloc(timer_callback_2203_1, info); /* stream system initialize */ info->stream = stream_create(0,1,rate,info,ym2203_stream_update); /* Initialize FM emurator */ info->chip = YM2203Init(info,sndindex,clock,rate,timer_handler,IRQHandler,&psgintf); state_save_register_postload(Machine, ym2203_postload, info); if (info->chip) return info; /* error */ /* stream close */ return NULL; }
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( 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; }
//static DEVICE_START( ym2203 ) int device_start_ym2203(UINT8 ChipID, int clock, UINT8 AYDisable, UINT8 AYFlags, int* AYrate) { static const ym2203_interface generic_2203 = { { AY8910_LEGACY_OUTPUT, AY8910_DEFAULT_LOADS //DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }, NULL }; //const ym2203_interface *intf = device->static_config ? (const ym2203_interface *)device->static_config : &generic_2203; ym2203_interface* intf; //ym2203_state *info = get_safe_token(device); ym2203_state *info; int rate; int ay_clock; if (ChipID >= MAX_CHIPS) return 0; info = &YM2203Data[ChipID]; rate = clock/72; /* ??? */ if ((CHIP_SAMPLING_MODE == 0x01 && rate < CHIP_SAMPLE_RATE) || CHIP_SAMPLING_MODE == 0x02) rate = CHIP_SAMPLE_RATE; info->intf = generic_2203; intf = &info->intf; if (AYFlags) intf->ay8910_intf.flags = AYFlags; //info->device = device; //info->psg = ay8910_start_ym(NULL, SOUND_YM2203, device, device->clock, &intf->ay8910_intf); if (! AYDisable) { ay_clock = clock / 2; *AYrate = ay_clock / 8; if ((CHIP_SAMPLING_MODE == 0x01 && rate < CHIP_SAMPLE_RATE) || CHIP_SAMPLING_MODE == 0x02) *AYrate = CHIP_SAMPLE_RATE; switch(AY_EMU_CORE) { #ifdef ENABLE_ALL_CORES case EC_MAME: // fits in the most common cases // TODO: remove after being able to change the resampler's sampling rate info->psg = ay8910_start_ym(NULL, CHTYPE_YM2203, 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 YM2203/AY8910 chip"); /* Timer Handler set */ //info->timer[0] = timer_alloc(device->machine, timer_callback_2203_0, info); //info->timer[1] = timer_alloc(device->machine, timer_callback_2203_1, info); /* stream system initialize */ //info->stream = stream_create(device,0,1,rate,info,ym2203_stream_update); /* Initialize FM emurator */ //info->chip = ym2203_init(info,clock,rate,timer_handler,IRQHandler,&psgintf); info->chip = ym2203_init(info,clock,rate,NULL,NULL,&psgintf); //assert_always(info->chip != NULL, "Error creating YM2203 chip"); //state_save_register_postload(device->machine, ym2203_intf_postload, info); return rate; }
//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; }
static void *ay8910_start(int sndindex, int clock, const void *config) { static const struct AY8910interface generic_ay8910 = { 0 }; const struct AY8910interface *intf = config ? config : &generic_ay8910; return ay8910_start_ym(SOUND_AY8910, sndindex+16, clock, 3, intf->portAread, intf->portBread, intf->portAwrite, intf->portBwrite); }