예제 #1
0
//static DEVICE_START( ym3812 )
int device_start_ym3812(void **_info, int EMU_CORE, int clock, int CHIP_SAMPLING_MODE, int CHIP_SAMPLE_RATE)
{
	//static const ym3812_interface dummy = { 0 };
	//ym3812_state *info = get_safe_token(device);
	ym3812_state *info;
	int rate;

#ifdef ENABLE_ALL_CORES
	if (EMU_CORE >= 0x02)
		EMU_CORE = EC_DBOPL;
#else
	EMU_CORE = EC_DBOPL;
#endif
	
	info = (ym3812_state *) calloc(1, sizeof(ym3812_state));
	*_info = (void *) info;
	
	info->EMU_CORE = EMU_CORE;
	rate = (clock & 0x7FFFFFFF)/72;
	if ((CHIP_SAMPLING_MODE == 0x01 && rate < CHIP_SAMPLE_RATE) ||
		CHIP_SAMPLING_MODE == 0x02)
		rate = CHIP_SAMPLE_RATE;
	//info->intf = device->static_config ? (const ym3812_interface *)device->static_config : &dummy;
	//info->intf = &dummy;
	//info->device = device;

	/* stream system initialize */
	switch(EMU_CORE)
	{
#ifdef ENABLE_ALL_CORES
	case EC_MAME:
		info->chip = ym3812_init(clock & 0x7FFFFFFF,rate);
		//assert_always(info->chip != NULL, "Error creating YM3812 chip");

		//info->stream = stream_create(device,0,1,rate,info,ym3812_stream_update);

		/* YM3812 setup */
		ym3812_set_timer_handler (info->chip, TimerHandler, info);
		ym3812_set_irq_handler   (info->chip, IRQHandler, info);
		ym3812_set_update_handler(info->chip, _stream_update, info);

		//info->timer[0] = timer_alloc(device->machine, timer_callback_0, info);
		//info->timer[1] = timer_alloc(device->machine, timer_callback_1, info);
		break;
#endif
	case EC_DBOPL:
		info->chip = adlib_OPL2_init(clock & 0x7FFFFFFF, rate, _stream_update, info);
		break;
	}

	return rate;
}
예제 #2
0
파일: 3812intf.cpp 프로젝트: robsonfr/mame
void ym3812_device::device_start()
{
	int rate = clock()/72;

	m_irq_handler.resolve();

	/* stream system initialize */
	m_chip = ym3812_init(this,clock(),rate);
	assert_always(m_chip != NULL, "Error creating YM3812 chip");

	m_stream = machine().sound().stream_alloc(*this,0,1,rate);

	/* YM3812 setup */
	ym3812_set_timer_handler (m_chip, timer_handler, this);
	ym3812_set_irq_handler   (m_chip, IRQHandler, this);
	ym3812_set_update_handler(m_chip, ym3812_update_request, this);

	m_timer[0] = timer_alloc(0);
	m_timer[1] = timer_alloc(1);
}
예제 #3
0
static DEVICE_START( ym3812 )
{
	static const ym3812_interface dummy = { 0 };
	ym3812_state *info = get_safe_token(device);
	int rate = device->clock()/72;

	info->intf = device->static_config() ? (const ym3812_interface *)device->static_config() : &dummy;
	info->device = device;

	/* stream system initialize */
	info->chip = ym3812_init(device,device->clock(),rate);
	assert_always(info->chip != NULL, "Error creating YM3812 chip");

	info->stream = device->machine().sound().stream_alloc(*device,0,1,rate,info,ym3812_stream_update);

	/* YM3812 setup */
	ym3812_set_timer_handler (info->chip, TimerHandler, info);
	ym3812_set_irq_handler   (info->chip, IRQHandler, info);
	ym3812_set_update_handler(info->chip, _stream_update, info);

	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);
}