Exemplo n.º 1
0
static void adjust_sample(device_t *samples, UINT8 freq)
{
	tone_freq = freq;

	if ((tone_freq == 0xff) || (tone_freq == 0x00))
		sample_set_volume(samples, 3, 0);
	else
	{
		sample_set_freq(samples, 3, 1.0 * max_freq / (0xff - tone_freq));
		sample_set_volume(samples, 3, tone_active);
	}
}
Exemplo n.º 2
0
void targ_sh_start(void)
{
	tone_pointer=0;
	tone_offset=0;
	tone_active=0;
	sound_a_freq = 0x00;
	sample_set_volume(3,0);
	sample_start_raw(3,waveform1,32,1000,1);
}
Exemplo n.º 3
0
MACHINE_CONFIG_END



/*************************************
 *
 *  Zaxxon PPI write handlers
 *
 *************************************/

WRITE8_DEVICE_HANDLER( zaxxon_sound_a_w )
{
	zaxxon_state *state = device->machine->driver_data<zaxxon_state>();
	device_t *samples = device->machine->device("samples");
	UINT8 diff = data ^ state->sound_state[0];
	state->sound_state[0] = data;

	/* PLAYER SHIP A/B: volume */
	sample_set_volume(samples, 10, 0.5 + 0.157 * (data & 0x03));
	sample_set_volume(samples, 11, 0.5 + 0.157 * (data & 0x03));

	/* PLAYER SHIP C: channel 10 */
	if ((diff & 0x04) && !(data & 0x04)) sample_start(samples, 10, 10, TRUE);
	if ((diff & 0x04) &&  (data & 0x04)) sample_stop(samples, 10);

	/* PLAYER SHIP D: channel 11 */
	if ((diff & 0x08) && !(data & 0x08)) sample_start(samples, 11, 11, TRUE);
	if ((diff & 0x08) &&  (data & 0x08)) sample_stop(samples, 11);

	/* HOMING MISSILE: channel 0 */
	if ((diff & 0x10) && !(data & 0x10)) sample_start(samples, 0, 0, TRUE);
	if ((diff & 0x10) &&  (data & 0x10)) sample_stop(samples, 0);

	/* BASE MISSILE: channel 1 */
	if ((diff & 0x20) && !(data & 0x20)) sample_start(samples, 1, 1, FALSE);

	/* LASER: channel 2 */
	if ((diff & 0x40) && !(data & 0x40)) sample_start(samples, 2, 2, TRUE);
	if ((diff & 0x40) &&  (data & 0x40)) sample_stop(samples, 2);

	/* BATTLESHIP: channel 3 */
	if ((diff & 0x80) && !(data & 0x80)) sample_start(samples, 3, 3, TRUE);
	if ((diff & 0x80) &&  (data & 0x80)) sample_stop(samples, 3);
}
Exemplo n.º 4
0
void targ_tone_generator(int data)
{
	int maxfreq;


	if (targ_spec_flag) maxfreq = MAXFREQ_A_TARG;
	else maxfreq = MAXFREQ_A_SPECTAR;

    sound_a_freq = data;
    if (sound_a_freq == 0xFF || sound_a_freq == 0x00)
	{
		sample_set_volume(3,0);
    }
    else
	{
		sample_set_freq(3,maxfreq/(0xFF-sound_a_freq));
		sample_set_volume(3,tone_active*1.0);
	}
}
Exemplo n.º 5
0
MACHINE_DRIVER_END



/*************************************
 *
 *  Zaxxon PPI write handlers
 *
 *************************************/

WRITE8_HANDLER( zaxxon_sound_a_w )
{
	UINT8 diff = data ^ sound_state[0];
	sound_state[0] = data;

	/* PLAYER SHIP A/B: volume */
	sample_set_volume(10, 0.5 + 0.157 * (data & 0x03));
	sample_set_volume(11, 0.5 + 0.157 * (data & 0x03));

	/* PLAYER SHIP C: channel 10 */
	if ((diff & 0x04) && !(data & 0x04)) sample_start(10, 10, TRUE);
	if ((diff & 0x04) &&  (data & 0x04)) sample_stop(10);

	/* PLAYER SHIP D: channel 11 */
	if ((diff & 0x08) && !(data & 0x08)) sample_start(11, 11, TRUE);
	if ((diff & 0x08) &&  (data & 0x08)) sample_stop(11);

	/* HOMING MISSILE: channel 0 */
	if ((diff & 0x10) && !(data & 0x10)) sample_start(0, 0, TRUE);
	if ((diff & 0x10) &&  (data & 0x10)) sample_stop(0);

	/* BASE MISSILE: channel 1 */
	if ((diff & 0x20) && !(data & 0x20)) sample_start(1, 1, FALSE);

	/* LASER: channel 2 */
	if ((diff & 0x40) && !(data & 0x40)) sample_start(2, 2, TRUE);
	if ((diff & 0x40) &&  (data & 0x40)) sample_stop(2);

	/* BATTLESHIP: channel 3 */
	if ((diff & 0x80) && !(data & 0x80)) sample_start(3, 3, TRUE);
	if ((diff & 0x80) &&  (data & 0x80)) sample_stop(3);
}
Exemplo n.º 6
0
void polyplay_play_channel2(int data)
{
	if (data) {
		freq2 = 2457600 / 16 / data / 8;
		sample_set_volume(1, channel_playing2 * 1.0);
		sample_start_raw(1, backgroundwave, ARRAY_LENGTH(backgroundwave), sizeof(backgroundwave)*freq2,1);
	}
	else {
		sample_stop(0);
		sample_stop(1);
	}
}
Exemplo n.º 7
0
void play_channel1(int data)
{
    if (data) {
        freq1 = 2457600 / 16 / data / 8;
        sample_set_volume(0, channel_playing1 * 1.0);
        sample_start_raw(0, backgroundwave, sizeof(backgroundwave)/2, sizeof(backgroundwave)*freq1,1);
    }
    else {
        sample_stop(0);
        sample_stop(1);
    }
}
Exemplo n.º 8
0
void polyplay_play_channel2(running_machine *machine, int data)
{
	running_device *samples = devtag_get_device(machine, "samples");
	if (data) {
		freq2 = 2457600 / 16 / data / 8;
		sample_set_volume(samples, 1, channel_playing2 * 1.0);
		sample_start_raw(samples, 1, backgroundwave, ARRAY_LENGTH(backgroundwave), sizeof(backgroundwave)*freq2,1);
	}
	else {
		sample_stop(samples, 0);
		sample_stop(samples, 1);
	}
}
Exemplo n.º 9
0
void polyplay_play_channel1(running_machine *machine, int data)
{
	device_t *samples = machine->device("samples");
	if (data) {
		freq1 = 2457600 / 16 / data / 8;
		sample_set_volume(samples, 0, channel_playing1 * 1.0);
		sample_start_raw(samples, 0, backgroundwave, ARRAY_LENGTH(backgroundwave), sizeof(backgroundwave)*freq1,1);
	}
	else {
		sample_stop(samples, 0);
		sample_stop(samples, 1);
	}
}
Exemplo n.º 10
0
static void common_audio_start(running_machine *machine, int freq)
{
	device_t *samples = machine->device("samples");
	max_freq = freq;

	tone_freq = 0;
	tone_active = 0;

	sample_set_volume(samples, 3, 0);
	sample_start_raw(samples, 3, sine_wave, 32, 1000, 1);

	state_save_register_global(machine, port_1_last);
	state_save_register_global(machine, port_2_last);
	state_save_register_global(machine, tone_freq);
	state_save_register_global(machine, tone_active);
}
Exemplo n.º 11
0
void senjyo_sh_start(void)
{
    int i;

	/* z80 ctc init */
	ctc_intf.baseclock = Machine->drv->cpu[1].cpu_clock;
	z80ctc_init (0, &ctc_intf);

	/* z80 pio init */
	z80pio_init (0, &pio_intf);

	_single = (INT16 *)auto_malloc(SINGLE_LENGTH*2);

	for (i = 0;i < SINGLE_LENGTH;i++)		/* freq = ctc2 zco / 8 */
		_single[i] = ((i/SINGLE_DIVIDER)&0x01)*127*256;

	/* CTC2 single tone generator */
	sample_set_volume(0,0);
	sample_start_raw(0,_single,SINGLE_LENGTH,single_rate,1);

	timer_pulse(TIME_IN_HZ(Machine->refresh_rate), 0, senjyo_sh_update);
}
Exemplo n.º 12
0
void senjyo_sh_start(void)
{
    int i;

	/* z80 ctc init */
	ctc_intf.baseclock = cpunum_get_clock(1);
	z80ctc_init (0, &ctc_intf);

	/* z80 pio init */
	z80pio_init (0, &pio_intf);

	_single = (INT16 *)auto_malloc(SINGLE_LENGTH*2);

	for (i = 0;i < SINGLE_LENGTH;i++)		/* freq = ctc2 zco / 8 */
		_single[i] = ((i/SINGLE_DIVIDER)&0x01)*127*256;

	/* CTC2 single tone generator */
	sample_set_volume(0,0);
	sample_start_raw(0,_single,SINGLE_LENGTH,single_rate,1);

	timer_pulse(video_screen_get_frame_period(Machine->primary_screen), NULL, 0, senjyo_sh_update);
}
Exemplo n.º 13
0
static void tape_set_audio( int track, int bOn )
{
	sample_set_volume( track, bOn ? 1.0 : 0.0 );
}
Exemplo n.º 14
0
static void tape_set_audio( device_t *samples, int track, int bOn )
{
	sample_set_volume(samples, track, bOn ? 1.0 : 0.0 );
}