예제 #1
0
파일: 2203intf.c 프로젝트: cdenix/psmame
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);
}
예제 #2
0
void ym2203_device::device_start()
{
	ay8910_device::device_start();

	m_irq_handler.resolve();

	/* Timer Handler set */
	m_timer[0] = timer_alloc(0);
	m_timer[1] = timer_alloc(1);

	/* stream system initialize */
	calculate_rates();

	/* Initialize FM emurator */
	int rate = clock()/72; /* ??? */
	m_chip = ym2203_init(this,this,clock(),rate,timer_handler,IRQHandler,&psgintf);
	assert_always(m_chip != nullptr, "Error creating YM2203 chip");
}
예제 #3
0
void ym2203_device::device_start()
{
	ay8910_device::device_start();

	int rate = clock()/72; /* ??? */

	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,1,rate, stream_update_delegate(FUNC(ym2203_device::stream_generate),this));

	/* Initialize FM emurator */
	m_chip = ym2203_init(this,this,clock(),rate,timer_handler,IRQHandler,&psgintf);
	assert_always(m_chip != nullptr, "Error creating YM2203 chip");
}
예제 #4
0
파일: opnintf.c 프로젝트: ValleyBell/libvgm
static UINT8 device_start_ym2203(const DEV_GEN_CFG* cfg, DEV_INFO* retDevInf)
{
	OPN_INF* info;
	DEV_DATA* devData;
	UINT32 rate;
	
	rate = cfg->clock / 72;
	SRATE_CUSTOM_HIGHEST(cfg->srMode, rate, cfg->smplRate);
	
	info = (OPN_INF*)malloc(sizeof(OPN_INF));
	info->ssg = NULL;
	info->opn = ym2203_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_2203);
	init_ssg_devinfo(retDevInf, cfg, 1, AYTYPE_YM2203);
	return 0x00;
}
예제 #5
0
//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;
}