Example #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;
}
Example #2
0
static int sfx_soundexpander_sound_machine_init(sound_t *psid, int speed, int cycles_per_sec)
{
    if (sfx_soundexpander_chip == 3812) {
        if (YM3812_chip != NULL) {
            ym3812_shutdown(YM3812_chip);
        }
        YM3812_chip = ym3812_init((UINT32)3579545, (UINT32)speed);
    } else {
        if (YM3526_chip != NULL) {
            ym3526_shutdown(YM3526_chip);
        }
        YM3526_chip = ym3526_init((UINT32)3579545, (UINT32)speed);
    }
    snd.command = 0;

    return 1;
}
Example #3
0
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);
}
Example #4
0
blargg_err_t Opl_Apu::init( long clock, long rate, blip_time_t period, type_t type )
{
	type_ = type;
	clock_ = clock;
	rate_ = rate;
	period_ = period;
	set_output( 0, 0 );
	volume( 1.0 );
	switch (type)
	{
	case type_opll:
	case type_msxmusic:
	case type_smsfmunit:
		opl = ym2413_init( clock, rate, 0 );
		break;

	case type_vrc7:
		opl = ym2413_init( clock, rate, 1 );
		break;

	case type_opl:
		opl = ym3526_init( clock, rate );
		break;

	case type_msxaudio:
		//logfile = fopen("c:\\temp\\msxaudio.log", "wb");
		opl = y8950_init( clock, rate );
		opl_memory = malloc( 32768 );
		y8950_set_delta_t_memory( opl, opl_memory, 32768 );
		break;

	case type_opl2:
		opl = ym3812_init( clock, rate );
		break;
	}
	reset();
	return 0;
}
Example #5
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);
}