Exemple #1
0
void cclimber_audio_device::play_sample(int start,int freq,int volume)
{
	int len;
	int romlen = m_samples_region.bytes();

	if (m_samples_region == nullptr)
	{
		return;
	}

	/* decode the rom samples */
	len = 0;
	while (start + len < romlen && m_samples_region[start+len] != 0x70)
	{
		int sample;

		sample = (m_samples_region[start + len] & 0xf0) >> 4;
		m_sample_buf[2*len] = SAMPLE_CONV4(sample) * volume / 31;

		sample = m_samples_region[start + len] & 0x0f;
		m_sample_buf[2*len + 1] = SAMPLE_CONV4(sample) * volume / 31;

		len++;
	}

	m_samples->start_raw(0,m_sample_buf.get(),2 * len,freq);
}
Exemple #2
0
static void cclimber_play_sample(running_machine &machine, int start,int freq,int volume)
{
	int len;
	int romlen = machine.region("samples")->bytes();
	const UINT8 *rom = machine.region("samples")->base();
	device_t *samples = machine.device("samples");


	if (!rom) return;

	/* decode the rom samples */
	len = 0;
	while (start + len < romlen && rom[start+len] != 0x70)
	{
		int sample;

		sample = (rom[start + len] & 0xf0) >> 4;
		samplebuf[2*len] = SAMPLE_CONV4(sample) * volume / 31;

		sample = rom[start + len] & 0x0f;
		samplebuf[2*len + 1] = SAMPLE_CONV4(sample) * volume / 31;

		len++;
	}

	sample_start_raw(samples,0,samplebuf,2 * len,freq,0);
}
Exemple #3
0
static void cclimber_play_sample(int start,int freq,int volume)
{
	int len;
	const UINT8 *rom = memory_region(REGION_SOUND1);


	if (!rom) return;

	/* decode the rom samples */
	len = 0;
	while (start + len < memory_region_length(REGION_SOUND1) && rom[start+len] != 0x70)
	{
		int sample;

		sample = (rom[start + len] & 0xf0) >> 4;
		samplebuf[2*len] = SAMPLE_CONV4(sample) * volume / 31;

		sample = rom[start + len] & 0x0f;
		samplebuf[2*len + 1] = SAMPLE_CONV4(sample) * volume / 31;

		len++;
	}

	mixer_play_sample(channel,samplebuf,2 * len,freq,0);
}
Exemple #4
0
void cclimber_audio_device::play_sample(int start,int freq,int volume)
{
	int len;
	int romlen = machine().root_device().memregion("samples")->bytes();
	const UINT8 *rom = machine().root_device().memregion("samples")->base();

	if (!rom) return;

	/* decode the rom samples */
	len = 0;
	while (start + len < romlen && rom[start+len] != 0x70)
	{
		int sample;

		sample = (rom[start + len] & 0xf0) >> 4;
		samplebuf[2*len] = SAMPLE_CONV4(sample) * volume / 31;

		sample = rom[start + len] & 0x0f;
		samplebuf[2*len + 1] = SAMPLE_CONV4(sample) * volume / 31;

		len++;
	}

	m_samples->start_raw(0,samplebuf,2 * len,freq);
}
Exemple #5
0
int namco_52xx_sh_start(const struct MachineSound *msound)
{
	int i;
	unsigned char bits;

	intf = msound->sound_interface;
	rom     = memory_region(intf->region);
	rom_len = memory_region_length(intf->region);

	channel = mixer_allocate_channel(intf->mixing_level);
	mixer_set_name(channel,sound_name(msound));

	samples = auto_malloc(2*rom_len);
	if (!samples)
		return 1;

	/* decode the rom samples */
	for (i = 0;i < rom_len;i++)
	{
		bits = rom[i] & 0x0f;
		samples[2*i] = SAMPLE_CONV4(bits);

		bits = (rom[i] & 0xf0) >> 4;
		samples[2*i + 1] = SAMPLE_CONV4(bits);
	}

	return 0;
}
Exemple #6
0
int bosco_sh_start(const struct MachineSound *msound)
{
	int i;
	unsigned char bits;

	channel = mixer_allocate_channel(25);
	mixer_set_name(channel,"Samples");

	speech = auto_malloc(2*memory_region_length(REGION_SOUND2));
	if (!speech)
		return 1;

	/* decode the rom samples */
	for (i = 0;i < memory_region_length(REGION_SOUND2);i++)
	{
		bits = memory_region(REGION_SOUND2)[i] & 0x0f;
		speech[2*i] = SAMPLE_CONV4(bits);

		bits = (memory_region(REGION_SOUND2)[i] & 0xf0) >> 4;
		speech[2*i + 1] = SAMPLE_CONV4(bits);
	}

	return 0;
}