Example #1
0
//static DEVICE_START( ym3526 )
int device_start_ym3526(void **_info, int clock, int CHIP_SAMPLING_MODE, int CHIP_SAMPLE_RATE)
{
	//static const ym3526_interface dummy = { 0 };
	//ym3526_state *info = get_safe_token(device);
	ym3526_state *info;
	int rate;
	
	info = (ym3526_state *) calloc(1, sizeof(ym3526_state));
	*_info = (void *) info;	

	rate = clock/72;
	if ((CHIP_SAMPLING_MODE == 0x01 && rate < CHIP_SAMPLE_RATE) ||
		CHIP_SAMPLING_MODE == 0x02)
		rate = CHIP_SAMPLE_RATE;
	//info->intf = device->static_config ? (const ym3526_interface *)device->static_config : &dummy;
	//info->intf = &dummy;
	//info->device = device;

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

	//info->stream = stream_create(device,0,1,rate,info,ym3526_stream_update);
	/* YM3526 setup */
	ym3526_set_timer_handler (info->chip, TimerHandler, info);
	ym3526_set_irq_handler   (info->chip, IRQHandler, info);
	ym3526_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);

	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 ym3526_device::device_start()
{
	int rate = clock()/72;

	// resolve callbacks
	m_irq_handler.resolve();

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

	m_stream = machine().sound().stream_alloc(*this,0,1,rate);
	/* YM3526 setup */
	ym3526_set_timer_handler (m_chip, timer_handler, this);
	ym3526_set_irq_handler   (m_chip, IRQHandler, this);
	ym3526_set_update_handler(m_chip, ym3526_update_request, this);

	m_timer[0] = timer_alloc(0);
	m_timer[1] = timer_alloc(1);
}
Example #4
0
static DEVICE_START( ym3526 )
{
	static const ym3526_interface dummy = { 0 };
	ym3526_state *info = get_safe_token(device);
	int rate = device->clock/72;

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

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

	info->stream = stream_create(device,0,1,rate,info,ym3526_stream_update);
	/* YM3526 setup */
	ym3526_set_timer_handler (info->chip, TimerHandler, info);
	ym3526_set_irq_handler   (info->chip, IRQHandler, info);
	ym3526_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);
}
Example #5
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;
}