Esempio n. 1
0
void polyplay_play_channel2(running_machine *machine, int data)
{
	device_t *samples = machine->device("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);
	}
}
Esempio n. 2
0
void polyplay_play_channel1(running_machine *machine, int data)
{
	running_device *samples = devtag_get_device(machine, "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);
	}
}
Esempio n. 3
0
static void invaders_sh_1_w(int board, int data, unsigned char *last)
{
	int base_channel, base_sample;

	base_channel = 4 * board;
	base_sample  = 9 * board;

	SN76477_enable_w(board, !(data & 0x01));				/* Saucer Sound */

	if (data & 0x02 && ~*last & 0x02)
		sample_start (base_channel+0, base_sample+0, 0);	/* Shot Sound */

	if (data & 0x04 && ~*last & 0x04)
		sample_start (base_channel+1, base_sample+1, 0);	/* Base Hit */

	if (~data & 0x04 && *last & 0x04)
		sample_stop (base_channel+1);

	if (data & 0x08 && ~*last & 0x08)
		sample_start (base_channel+0, base_sample+2, 0);	/* Invader Hit */

	if (data & 0x10 && ~*last & 0x10)
		sample_start (base_channel+2, 8, 0);				/* Bonus Missle Base */

	invaders_screen_red_w(data & 0x04);

	*last = data;
}
Esempio n. 4
0
void astrof_sample1_w(int offset,int data)
{
	static int last = 0;

	if (death_playing)
	{
		death_playing = sample_playing(CHANNEL_EXPLOSION);
	}

	if (bosskill_playing)
	{
		bosskill_playing = sample_playing(CHANNEL_EXPLOSION);
	}

	/* Bit 2 - Explosion trigger */
	if ((data & 0x04) && !(last & 0x04))
	{
		/* I *know* that the effect select port will be written shortly
		   after this one, so this works */
		start_explosion = 1;
	}

	/* Bit 0/1/3 - Background noise */
	if ((data & 0x08) != (last & 0x08))
	{
		if (data & 0x08)
		{
			int sample = SAMPLE_WAVE + (data & 3);
			sample_start(CHANNEL_WAVE,sample,1);
		}
		else
		{
			sample_stop(CHANNEL_WAVE);
		}
	}

	/* Bit 4 - Boss Laser */
	if ((data & 0x10) && !(last & 0x10))
	{
		if (!bosskill_playing)
		{
			sample_start(CHANNEL_BOSSFIRE,SAMPLE_BOSSFIRE,0);
		}
	}

	/* Bit 5 - Fire */
	if ((data & 0x20) && !(last & 0x20))
	{
		if (!bosskill_playing)
		{
			sample_start(CHANNEL_FIRE,SAMPLE_FIRE,0);
		}
	}

	/* Bit 6 - Don't know. Probably something to do with the explosion sounds */

	/* Bit 7 - Don't know. Maybe a global sound enable bit? */

	last = data;
}
Esempio n. 5
0
/* Check if a sample is specified for changed solenoid */
void proc_mechsounds(int sol, int newState) {
  if ((sol == sLRFlip) ||
      ((sol == sURFlip) && (core_gameData->hw.flippers & FLIP_SOL(FLIP_UR))))
    sample_start(0, newState ? SAM_RFLIPPER : SAM_SOLENOID_OFF,0);
  else if ((sol == sLLFlip) ||
           ((sol == sULFlip) && (core_gameData->hw.flippers & FLIP_SOL(FLIP_UL))))
    sample_start(2, newState ? SAM_LFLIPPER : SAM_SOLENOID_OFF,0);
  else {
    wpc_tSamSolMap *item = core_gameData->hw.solsammap;
    if (item) {
	  while (item->solname >= 0 && item->solname != sol)
			item++;
	  if(item->solname >= 0 && item->solname == sol) {
		if (newState) {
	        if (item->flags == WPCSAM_F_OFFON)
	          sample_start(item->channel, item->samname, 0);
		    else if (item->flags == WPCSAM_F_CONT)
              sample_start(item->channel, item->samname, 1);
		}
		else {
			if (item->flags == WPCSAM_F_ONOFF)
              sample_start(item->channel, item->samname, 0);
            else if (item->flags == WPCSAM_F_CONT)
	          sample_stop(item->channel);
		}
	    item++;
      } /* if(item->solname >=0 */
    } /* if (item) */
  }
}
Esempio n. 6
0
MACHINE_DRIVER_END


static TIMER_CALLBACK( frogs_croak_callback )
{
	const device_config *samples = devtag_get_device(machine, "samples");
	sample_stop(samples, 2);
}
Esempio n. 7
0
MACHINE_CONFIG_END


static TIMER_CALLBACK( frogs_croak_callback )
{
	device_t *samples = machine.device("samples");
	sample_stop(samples, 2);
}
Esempio n. 8
0
static WRITE8_HANDLER( tankbatt_interrupt_enable_w )
{
	tankbatt_state *state = space->machine().driver_data<tankbatt_state>();
	state->m_nmi_enable = !data;
	state->m_sound_enable = !data;

	/* hack - turn off the engine noise if the normal game nmi's are disabled */
	if (data) sample_stop (space->machine().device("samples"), 2);
}
Esempio n. 9
0
static WRITE8_HANDLER( tankbatt_interrupt_enable_w )
{
	tankbatt_nmi_enable = !data;
	tankbatt_sound_enable = !data;

	/* hack - turn off the engine noise if the normal game nmi's are disabled */
	if (data) sample_stop (devtag_get_device(space->machine, "samples"), 2);
//  interrupt_enable_w (offset, !data);
}
Esempio n. 10
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);
}
Esempio n. 11
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);
}
Esempio n. 12
0
/* LT 20-3-1998 */
void invaders_sh_port4_w(int offset, int data)
{
	static unsigned char Sound = 0;

	if (data & 0x01 && ~Sound & 0x01)
		sample_start (0, 0, 1);

	if (~data & 0x01 && Sound & 0x01)
		sample_stop (0);

	if (data & 0x02 && ~Sound & 0x02)
		sample_start (1, 1, 0);

	if (data & 0x04 && ~Sound & 0x04){
            sample_start (2, 2, 0);
    /* turn all colours red here */
            palette_change_color(1,0xff,0x00,0x00);
            palette_change_color(2,0xff,0x00,0x00);
            palette_change_color(3,0xff,0x00,0x00);
            palette_change_color(4,0xff,0x00,0x00);
            palette_change_color(5,0xff,0x00,0x00);
            palette_change_color(6,0xff,0x00,0x00);
            palette_change_color(7,0xff,0x00,0x00);
        }

	if (~data & 0x04 && Sound & 0x04){
            sample_stop (2);
    /* restore colours here */
            palette_change_color(1,0x20,0x20,0xff);
            palette_change_color(2,0x20,0xff,0x20);
            palette_change_color(3,0x20,0xff,0xff);
            palette_change_color(4,0xff,0x20,0x20);
            palette_change_color(5,0xff,0x20,0xff);
            palette_change_color(6,0xff,0xff,0x20);
            palette_change_color(7,0xff,0xff,0xff);
        }
	if (data & 0x08 && ~Sound & 0x08)
		sample_start (3, 3, 0);

	Sound = data;
}
Esempio n. 13
0
static WRITE8_HANDLER( tankbatt_sh_engine_w )
{
	const device_config *samples = devtag_get_device(space->machine, "samples");
	if (tankbatt_sound_enable)
	{
		if (data)
			sample_start (samples, 2, 2, 1);
		else
			sample_start (samples, 2, 1, 1);
	}
	else sample_stop (samples, 2);
}
Esempio n. 14
0
static void spacewar_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
{
	running_device *samples = machine->device("samples");

	/* Explosion - rising edge */
	if (SOUNDVAL_RISING_EDGE(0x01))
		sample_start(samples, 0, (mame_rand(machine) & 1) ? 0 : 6, 0);

	/* Fire sound - rising edge */
	if (SOUNDVAL_RISING_EDGE(0x02))
		sample_start(samples, 1, (mame_rand(machine) & 1) ? 1 : 7, 0);

	/* Player 1 thrust - 0=on, 1=off */
	if (SOUNDVAL_FALLING_EDGE(0x04))
		sample_start(samples, 3, 3, 1);
	if (SOUNDVAL_RISING_EDGE(0x04))
		sample_stop(samples, 3);

	/* Player 2 thrust - 0=on, 1-off */
	if (SOUNDVAL_FALLING_EDGE(0x08))
		sample_start(samples, 4, 4, 1);
	if (SOUNDVAL_RISING_EDGE(0x08))
		sample_stop(samples, 4);

	/* Mute - 0=off, 1=on */
	if (SOUNDVAL_FALLING_EDGE(0x10))
		sample_start(samples, 2, 2, 1);	/* play idle sound */
	if (SOUNDVAL_RISING_EDGE(0x10))
	{
        int i;

		/* turn off all but the idle sound */
		for (i = 0; i < 5; i++)
			if (i != 2)
				sample_stop(samples, i);

		/* Pop when board is shut off */
		sample_start(samples, 2, 5, 0);
	}
}
Esempio n. 15
0
void dkongjr_sh_land_w(int offset,int data)
{
	static int land = 0;

	if (land != data)
	{
		if (data)
			sample_stop (7) ;
			sample_start (4,1,0);

			land = data;
	}
}
Esempio n. 16
0
void dkongjr_sh_snapjaw_w(int offset,int data)
{
	static int snapjaw = 0;

	if (snapjaw != data)
	{
		if (data)
			sample_stop (7) ;
			sample_start (4,7,0);

		snapjaw = data;
	}
}
Esempio n. 17
0
static WRITE8_HANDLER( tankbatt_sh_engine_w )
{
	tankbatt_state *state = space->machine().driver_data<tankbatt_state>();
	device_t *samples = space->machine().device("samples");
	if (state->m_sound_enable)
	{
		if (data)
			sample_start (samples, 2, 2, 1);
		else
			sample_start (samples, 2, 1, 1);
	}
	else sample_stop (samples, 2);
}
Esempio n. 18
0
static void spacewar_sound_w(UINT8 sound_val, UINT8 bits_changed)
{
	/* Explosion - rising edge */
	if (SOUNDVAL_RISING_EDGE(0x01))
		sample_start(0, (rand() & 1) ? 0 : 6, 0);

	/* Fire sound - rising edge */
	if (SOUNDVAL_RISING_EDGE(0x02))
		sample_start(1, (rand() & 1) ? 1 : 7, 0);

	/* Player 1 thrust - 0=on, 1=off */
	if (SOUNDVAL_FALLING_EDGE(0x04))
		sample_start(3, 3, 1);
	if (SOUNDVAL_RISING_EDGE(0x04))
		sample_stop(3);

	/* Player 2 thrust - 0=on, 1-off */
	if (SOUNDVAL_FALLING_EDGE(0x08))
		sample_start(4, 4, 1);
	if (SOUNDVAL_RISING_EDGE(0x08))
		sample_stop(4);

	/* Mute - 0=off, 1=on */
	if (SOUNDVAL_FALLING_EDGE(0x10))
		sample_start(2, 2, 1);	/* play idle sound */
	if (SOUNDVAL_RISING_EDGE(0x10))
	{
        int i;

		/* turn off all but the idle sound */
		for (i = 0; i < 5; i++)
			if (i != 2)
				sample_stop(i);

		/* Pop when board is shut off */
		sample_start(2, 5, 0);
	}
}
Esempio n. 19
0
void dkongjr_sh_death_w(int offset,int data)
{
	static int death = 0;

	if (death != data)
	{
		if (data)
			sample_stop (7);
			sample_start (6, 4, 0);


		death = data;
	}
}
Esempio n. 20
0
void invad2ct_sh_port1_w(int offset, int data)
{
	static unsigned char Sound = 0;

	if (data & 0x01 && ~Sound & 0x01)
		sample_start (7, 10, 1);		/* Saucer Sound - Player 2 */

	if (~data & 0x01 && Sound & 0x01)
		sample_stop (7);

	if (data & 0x02 && ~Sound & 0x02)
		sample_start (8, 11, 0);		/* Missle Sound - Player 2 */

	if (data & 0x04 && ~Sound & 0x04)
		sample_start (9, 12, 0);		/* Explosion - Player 2 */

	if (data & 0x08 && ~Sound & 0x08)
		sample_start (10, 13, 0);		/* Invader Hit - Player 2 */

	if (data & 0x10 && ~Sound & 0x10)
		sample_start (4, 9, 0);		    /* Bonus Missle Base - Player 2 */

	Sound = data;
}
Esempio n. 21
0
void invaders_sh_port3_w(int offset, int data)
{
	static unsigned char Sound = 0;

	if (data & 0x01 && ~Sound & 0x01)
		sample_start (0, 0, 1);			/* Saucer Sound */

	if (~data & 0x01 && Sound & 0x01)
		sample_stop (0);

	if (data & 0x02 && ~Sound & 0x02)
		sample_start (1, 1, 0);			/* Missle Sound */

	if (data & 0x04 && ~Sound & 0x04)
		sample_start (2, 2, 0);			/* Explosion */

	if (data & 0x08 && ~Sound & 0x08)
		sample_start (3, 3, 0);			/* Invader Hit */

	if (data & 0x10 && ~Sound & 0x10)
		sample_start (4, 9, 0);			/* Bonus Missle Base */

	Sound = data;
}
Esempio n. 22
0
void starcas_sound_w(UINT8 sound_val, UINT8 bits_changed)
{
    UINT32 target_pitch;
	UINT8 shift_diff;

    cinemat_shift (sound_val, bits_changed, 0x80, 0x10);

	// Now see if it's time to act upon the shifted data

	if ((bits_changed & 0x01) && (0 == (sound_val & 0x01)))
	{
		// Yep. Falling edge! Find out what has changed.

		shift_diff = current_shift ^ last_shift;

		if ((shift_diff & 1) && (0 == (current_shift & 1)))
			sample_start(2, 2, 0);	// Castle fire

		if ((shift_diff & 2) && (0 == (current_shift & 2)))
			sample_start(5, 5, 0);	// Shield hit

		if (shift_diff & 0x04)
		{
			if (current_shift & 0x04)
				sample_start(6, 6, 1);	// Star sound
			else
				sample_stop(6);	// Stop it!
		}

		if (shift_diff & 0x08)
		{
			if (current_shift & 0x08)
				sample_stop(7);	// Stop it!
			else
				sample_start(7, 7, 1);	// Thrust sound
		}

		if (shift_diff & 0x10)
		{
			if (current_shift & 0x10)
				sample_stop(4);
			else
				sample_start(4, 4, 1);	// Drone
		}

		// Latch the drone pitch

        target_pitch = (current_shift & 0x60) >> 3;
        target_pitch |= ((current_shift & 0x40) >> 5);
        target_pitch |= ((current_shift & 0x80) >> 7);

        // target_pitch = (current_shift & 0x60) >> 3;
        // is the the target drone pitch to rise and stop at.

        target_pitch = 0x10000 + (target_pitch << 12);

        // 0x10000 is lowest value the pitch will drop to
        // Star Castle drone sound

        if (cpu_getcurrentframe() > last_frame)
        {
            if (current_pitch > target_pitch)
                current_pitch -= 300;
            if (current_pitch < target_pitch)
                current_pitch += 200;
            sample_set_freq(4, current_pitch);
            last_frame = cpu_getcurrentframe();
        }

		last_shift = current_shift;
	}
Esempio n. 23
0
void zaxxon_sound_w(int offset,int data)
{
	int line;
	int noise;


	if (offset == 0)
	{
		/* handle background rumble */
		switch (data & 0x0c)
		{
			case 0x04:
				soundplaying[20] = 0;
				sample_stop(sa[20].channel);
				if (soundplaying[21] == 0)
				{
					soundplaying[21] = 1;
					sample_start(sa[21].channel,sa[21].num,sa[21].looped);
				}
				sample_adjust(sa[21].channel,-1,128 + 40 * (data & 0x03));
				break;
			case 0x00:
			case 0x08:
				if (soundplaying[20] == 0)
				{
					soundplaying[20] = 1;
					sample_start(sa[20].channel,sa[20].num,sa[20].looped);
				}
				sample_adjust(sa[20].channel,-1,128 + 40 * (data & 0x03));
				soundplaying[21] = 0;
				sample_stop(sa[21].channel);
				break;
			case 0x0c:
				soundplaying[20] = 0;
				sample_stop(sa[20].channel);
				soundplaying[21] = 0;
				sample_stop(sa[21].channel);
				break;
		}
	}

	for (line = 0;line < 8;line++)
	{
		noise = 8 * offset + line - 4;

		/* the first four sound lines are handled separately */
		if (noise >= 0)
		{
			if ((data & (1 << line)) == 0)
			{
				/* trigger sound */
				if (soundplaying[noise] == 0)
				{
					soundplaying[noise] = 1;
					if (sa[noise].channel != -1)
					{
						if (sa[noise].restartable || !sample_playing(sa[noise].channel))
							sample_start(sa[noise].channel,sa[noise].num,sa[noise].looped);
					}
				}
			}
			else
			{
				if (soundplaying[noise])
				{
					soundplaying[noise] = 0;
					if (sa[noise].channel != -1 && sa[noise].stoppable)
						sample_stop(sa[noise].channel);
				}
			}
		}
	}
}
Esempio n. 24
0
void croak_callback(int param)
{
	sample_stop(2);
}
Esempio n. 25
0
void namcoio_54XX_write(int data)
{
	static int fetch;
	static int fetchmode;
	static UINT8 config1[4],config2[4],config3[5];


//logerror("%04x: custom 54XX write %02x\n",activecpu_get_pc(),data);

	if (fetch)
	{
		switch (fetchmode)
		{
			default:
			case 1:
				config1[4-(fetch--)] = data;
				break;

			case 2:
				config2[4-(fetch--)] = data;
				break;

			case 3:
				config3[5-(fetch--)] = data;
				break;
		}
	}
	else
	{
		switch (data & 0xf0)
		{
			case 0x00:	// nop
				break;

			case 0x10:	// output sound on pins 4-7 only
				if (memcmp(config1,"\x40\x00\x02\xdf",4) == 0)
					// bosco
					// galaga
					// xevious
					sample_start(0, 0, 0);
				else if (memcmp(config1,"\x10\x00\x80\xff",4) == 0)
					// xevious
					sample_start(0, 1, 0);
				else if (memcmp(config1,"\x80\x80\x01\xff",4) == 0)
					// xevious
					sample_start(0, 2, 0);
				break;

			case 0x20:	// output sound on pins 8-11 only
				if (memcmp(config2,"\x40\x40\x01\xff",4) == 0)
					// xevious
					sample_start(1, 3, 0);
				else if (memcmp(config2,"\x30\x30\x03\xdf",4) == 0)
					// bosco
					// galaga
					sample_start(1, 1, 0);
				else if (memcmp(config2,"\x60\x30\x03\x66",4) == 0)
					// polepos
					sample_start( 0, 0, 0 );
				break;

			case 0x30:
				fetch = 4;
				fetchmode = 1;
				break;

			case 0x40:
				fetch = 4;
				fetchmode = 2;
				break;

			case 0x50:	// output sound on pins 17-20 only
				if (memcmp(config3,"\x08\x04\x21\x00\xf1",5) == 0)
					// bosco
					sample_start(2, 2, 0);
				break;

			case 0x60:
				fetch = 5;
				fetchmode = 3;
				break;

			case 0x70:
				// polepos
				/* 0x7n = Screech sound. n = pitch (if 0 then no sound) */
				/* followed by 0x60 command? */
				if (( data & 0x0f ) == 0)
				{
					if (sample_playing(1))
						sample_stop(1);
				}
				else
				{
					int freq = (int)( ( 44100.0f / 10.0f ) * (float)(data & 0x0f) );

					if (!sample_playing(1))
						sample_start(1, 1, 1);
					sample_set_freq(1, freq);
				}
				break;
		}
	}
}