Beispiel #1
0
void sn76496_base_device::device_start()
{
    int sample_rate = clock()/2;
    int i;
    double out;
    int gain;

    const sn76496_config *conf = reinterpret_cast<const sn76496_config *>(static_config());
    m_ready.resolve(conf->ready, *this);

    m_sound = machine().sound().stream_alloc(*this, 0, (m_stereo? 2:1), sample_rate, this);

    for (i = 0; i < 4; i++) m_volume[i] = 0;

    m_last_register = 0;
    for (i = 0; i < 8; i+=2)
    {
        m_register[i] = 0;
        m_register[i + 1] = 0x0f;   // volume = 0
    }

    for (i = 0; i < 4; i++)
    {
        m_output[i] = 0;
        m_period[i] = 0;
        m_count[i] = 0;
    }

    m_RNG = m_feedback_mask;
    m_output[3] = m_RNG & 1;

    m_cycles_to_ready = 1;          // assume ready is not active immediately on init. is this correct?
    m_stereo_mask = 0xFF;           // all channels enabled
    m_current_clock = m_clock_divider-1;

    // set gain
    gain = 0;

    gain &= 0xff;

    // increase max output basing on gain (0.2 dB per step)
    out = MAX_OUTPUT / 4; // four channels, each gets 1/4 of the total range
    while (gain-- > 0)
        out *= 1.023292992; // = (10 ^ (0.2/20))

    // build volume table (2dB per step)
    for (i = 0; i < 15; i++)
    {
        // limit volume to avoid clipping
        if (out > MAX_OUTPUT / 4) m_vol_table[i] = MAX_OUTPUT / 4;
        else m_vol_table[i] = out;

        out /= 1.258925412; /* = 10 ^ (2/20) = 2dB */
    }
    m_vol_table[15] = 0;

    m_ready_state = true;

    register_for_save_states();
}
Beispiel #2
0
void sn76496_base_device::device_start()
{
	int sample_rate = clock()/2;
	int i;
	double out;
	int gain;

	m_ready_handler.resolve_safe();

	m_sound = machine().sound().stream_alloc(*this, 0, (m_stereo? 2:1), sample_rate);

	for (i = 0; i < 4; i++) m_volume[i] = 0;

	m_last_register = m_sega_style_psg?3:0; // Sega VDP PSG defaults to selected period reg for 2nd channel
	for (i = 0; i < 8; i+=2)
	{
		m_register[i] = 0;
		m_register[i + 1] = 0x0;   // volume = 0x0 (max volume) on reset; this needs testing on chips other than SN76489A and Sega VDP PSG
	}

	for (i = 0; i < 4; i++)
	{
		m_output[i] = 0;
		m_period[i] = 0;
		m_count[i] = 0;
	}

	m_RNG = m_feedback_mask;
	m_output[3] = m_RNG & 1;

	m_cycles_to_ready = 1;          // assume ready is not active immediately on init. is this correct?
	m_stereo_mask = 0xFF;           // all channels enabled
	m_current_clock = m_clock_divider-1;

	// set gain
	gain = 0;

	gain &= 0xff;

	// increase max output basing on gain (0.2 dB per step)
	out = MAX_OUTPUT / 4; // four channels, each gets 1/4 of the total range
	while (gain-- > 0)
		out *= 1.023292992; // = (10 ^ (0.2/20))

	// build volume table (2dB per step)
	for (i = 0; i < 15; i++)
	{
		// limit volume to avoid clipping
		if (out > MAX_OUTPUT / 4) m_vol_table[i] = MAX_OUTPUT / 4;
		else m_vol_table[i] = out;

		out /= 1.258925412; /* = 10 ^ (2/20) = 2dB */
	}
	m_vol_table[15] = 0;

	m_ready_state = true;

	register_for_save_states();
}
Beispiel #3
0
static DEVICE_START( tms6100 )
{
    //static const tms5110_interface dummy = { 0 };
    tms6100_state *tms = get_safe_token(device);

    assert_always(tms != NULL, "Error creating TMS6100 chip");

    //tms->intf = device->baseconfig().static_config ? (const tms5110_interface *)device->baseconfig().static_config : &dummy;
    tms->rom = *device->region();

    tms->device = device;

    register_for_save_states(tms);
}