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; }
/* 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) */ } }
void invaders_sh_port3_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); if (~data & 0x04 && Sound & 0x04) sample_stop (2); if (data & 0x08 && ~Sound & 0x08) sample_start (3, 3, 0); if (data & 0x10 && ~Sound & 0x10) sample_start (4, 9, 0); invaders_screen_red_w(data & 0x04); Sound = data; }
static void tape_set_motor( int bOn ) { if( bOn ) { /* If talk track is not playing, start it. */ if (! sample_playing( kTalkTrack )) sample_start( 0, kTalkTrack, 1 ); /* Resume playback of talk track. */ sample_set_pause( kTalkTrack, 0); /* If crash track is not playing, start it. */ if (! sample_playing( kCrashTrack )) sample_start( 1, kCrashTrack, 1 ); /* Resume playback of crash track. */ sample_set_pause( kCrashTrack, 0); } else { /* Pause both the talk and crash tracks. */ sample_set_pause( kTalkTrack, 1 ); sample_set_pause( kCrashTrack, 1 ); } }
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; }
void dragrace_start_anim (void) { //ball_search_timer_reset(); // TODO show graphic of racetrack starting grid or something suitable // ready lamp_tristate_on(LM_TREE_TOP_YELLOW); dmd_alloc_low_clean (); font_render_string_center (&font_supercar9, 64, 16, "READY"); dmd_show_low (); sample_start (SND_RACE_STARTER_01, SL_500MS); task_sleep_sec(1); // set lamp_tristate_on(LM_TREE_BOTTOM_YELLOW); dmd_alloc_low_clean (); font_render_string_center (&font_supercar9, 64, 16, "SET"); dmd_show_low (); sample_start (SND_RACE_STARTER_01, SL_500MS); task_sleep_sec(1); // go lamp_tristate_flash(LM_LEFT_TREE_GREEN); lamp_tristate_flash(LM_RIGHT_TREE_GREEN); dmd_alloc_low_clean (); font_render_string_center (&font_supercar9, 64, 16, "GO"); dmd_show_low (); sample_start (SND_RACE_STARTER_02, SL_2S); }
static void invaders_sh_2_w(int board, int data, unsigned char *last) { int base_channel, base_sample; base_channel = 4 * board; base_sample = 9 * board; if (data & 0x01 && ~*last & 0x01) sample_start (base_channel+1, base_sample+3, 0); /* Fleet 1 */ if (data & 0x02 && ~*last & 0x02) sample_start (base_channel+1, base_sample+4, 0); /* Fleet 2 */ if (data & 0x04 && ~*last & 0x04) sample_start (base_channel+1, base_sample+5, 0); /* Fleet 3 */ if (data & 0x08 && ~*last & 0x08) sample_start (base_channel+1, base_sample+6, 0); /* Fleet 4 */ if (data & 0x10 && ~*last & 0x10) sample_start (base_channel+3, base_sample+7, 0); /* Saucer Hit */ invaders_flip_screen_w(data & 0x20); *last = data; }
static void triplhnt_update_misc(running_machine &machine, int offset) { triplhnt_state *state = machine.driver_data<triplhnt_state>(); device_t *samples = machine.device("samples"); device_t *discrete = machine.device("discrete"); UINT8 is_witch_hunt; UINT8 bit = offset >> 1; /* BIT0 => UNUSED */ /* BIT1 => LAMP */ /* BIT2 => SCREECH */ /* BIT3 => LOCKOUT */ /* BIT4 => SPRITE ZOOM */ /* BIT5 => CMOS WRITE */ /* BIT6 => TAPE CTRL */ /* BIT7 => SPRITE BANK */ if (offset & 1) { state->m_misc_flags |= 1 << bit; if (bit == 5) { state->m_cmos[state->m_cmos_latch] = state->m_da_latch; } } else { state->m_misc_flags &= ~(1 << bit); } state->m_sprite_zoom = (state->m_misc_flags >> 4) & 1; state->m_sprite_bank = (state->m_misc_flags >> 7) & 1; set_led_status(machine, 0, state->m_misc_flags & 0x02); coin_lockout_w(machine, 0, !(state->m_misc_flags & 0x08)); coin_lockout_w(machine, 1, !(state->m_misc_flags & 0x08)); discrete_sound_w(discrete, TRIPLHNT_SCREECH_EN, state->m_misc_flags & 0x04); // screech discrete_sound_w(discrete, TRIPLHNT_LAMP_EN, state->m_misc_flags & 0x02); // Lamp is used to reset noise discrete_sound_w(discrete, TRIPLHNT_BEAR_EN, state->m_misc_flags & 0x80); // bear is_witch_hunt = input_port_read(machine, "0C09") == 0x40; bit = ~state->m_misc_flags & 0x40; /* if we're not playing the sample yet, start it */ if (!sample_playing(samples, 0)) sample_start(samples, 0, 0, 1); if (!sample_playing(samples, 1)) sample_start(samples, 1, 1, 1); /* bit 6 turns cassette on/off */ sample_set_pause(samples, 0, is_witch_hunt || bit); sample_set_pause(samples, 1, !is_witch_hunt || bit); }
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); }
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); }
static void trigger_sample(device_t *samples, UINT8 data) { gottlieb_state *state = samples->machine().driver_data<gottlieb_state>(); /* Reactor samples */ if (strcmp(samples->machine().system().name, "reactor") == 0) { switch (data) { case 55: case 56: case 57: case 59: sample_start(samples, 0, data - 53, 0); break; case 31: state->m_score_sample = 7; break; case 39: state->m_score_sample++; if (state->m_score_sample < 20) sample_start(samples, 0, state->m_score_sample, 0); break; } } /* Q*Bert samples */ else { switch (data) { case 17: case 18: case 19: case 20: case 21: sample_start(samples, 0, (data - 17) * 8 + state->m_random_offset, 0); state->m_random_offset = (state->m_random_offset + 1) & 7; break; case 22: sample_start(samples, 0,40,0); break; case 23: sample_start(samples, 0,41,0); break; } } }
static void barrier_sound_w(UINT8 sound_val, UINT8 bits_changed) { /* Player die - rising edge */ if (SOUNDVAL_RISING_EDGE(0x01)) sample_start(0, 0, 0); /* Player move - falling edge */ if (SOUNDVAL_FALLING_EDGE(0x02)) sample_start(1, 1, 0); /* Enemy move - falling edge */ if (SOUNDVAL_FALLING_EDGE(0x04)) sample_start(2, 2, 0); }
void gottlieb_sh_w(int offset,int data) { data &= 0xff; if (data != 0xff) { if (Machine->gamedrv->samplenames) { /* if we have loaded samples, we must be Q*Bert */ switch(data ^ 0xff) { case 0x12: /* play a sample here (until Votrax speech is emulated) */ sample_start (0, 0, 0); break; case 0x14: /* play a sample here (until Votrax speech is emulated) */ sample_start (0, 1, 0); break; case 0x16: /* play a sample here (until Votrax speech is emulated) */ sample_start (0, 2, 0); break; case 0x11: /* play a sample here (until Votrax speech is emulated) */ sample_start (0, 3, 0); break; } } soundlatch_w(offset,data); switch (cpu_gettotalcpu()) { case 2: /* Revision 1 sound board */ cpu_cause_interrupt(1,M6502_INT_IRQ); break; case 3: case 4: /* Revision 2 & 3 sound board */ cpu_cause_interrupt(cpu_gettotalcpu()-1,M6502_INT_IRQ); cpu_cause_interrupt(cpu_gettotalcpu()-2,M6502_INT_IRQ); break; } } }
static void trigger_sample(const device_config *samples, UINT8 data) { /* Reactor samples */ if (strcmp(samples->machine->gamedrv->name, "reactor") == 0) { switch (data) { case 55: case 56: case 57: case 59: sample_start(samples, 0, data - 53, 0); break; case 31: score_sample = 7; break; case 39: score_sample++; if (score_sample < 20) sample_start(samples, 0, score_sample, 0); break; } } /* Q*Bert samples */ else { switch (data) { case 17: case 18: case 19: case 20: case 21: sample_start(samples, 0, (data - 17) * 8 + random_offset, 0); random_offset = (random_offset + 1) & 7; break; case 22: sample_start(samples, 0,40,0); break; case 23: sample_start(samples, 0,41,0); break; } } }
void pitstop_award_deff(void) { // must happen in the deff so it doesn't crash in test mode due to uninitialised list of items determine_allowable_pitstop_awards(); U8 pitstop_award_items_remaining; for (pitstop_award_items_remaining = PITSTOP_AWARD_ITEMS; pitstop_award_items_remaining >= 1 ; pitstop_award_items_remaining--) { dbprintf("remaining items: %d\n", pitstop_award_items_remaining); pitstop_award_draw(); task_sleep_sec(1); if (pitstop_award_items_remaining >= 3) { sample_start (SND_TRAFFIC_ZOOM_02, SL_4S); eliminate_pitstop_award(); } else if (pitstop_award_items_remaining == 2) { sample_start (SND_TRAFFIC_ZOOM_05, SL_4S); eliminate_pitstop_award(); } else if (pitstop_award_items_remaining == 1) { sample_start (SND_TRAFFIC_ZOOM_03, SL_4S); } dmd_invert_page (dmd_low_buffer); dmd_show_low(); task_sleep(TIME_100MS); } // find the one remaining award pitstop_award = DISABLED_AWARD; for (pitstop_award_index = 0; pitstop_award_index < PITSTOP_AWARD_ITEMS; pitstop_award_index++) { if (selected_pitstop_awards[pitstop_award_index] != DISABLED_AWARD) { pitstop_award = selected_pitstop_awards[pitstop_award_index]; } } dbprintf("%s\n", pitstop_award_options_titles[pitstop_award]); // flash the remaining award dmd_alloc_pair (); dmd_clean_page_low (); font_render_string_center (&font_var5, 64, 16, pitstop_award_options_titles[pitstop_award]); dmd_show_low (); dmd_copy_low_to_high (); dmd_invert_page (dmd_low_buffer); deff_swap_low_high (10, TIME_100MS); deff_exit (); // ball will be ejected from popper soon }
CALLSET_ENTRY (trivial, sw_outer_right_inlane) { fh_clock_advance (CLK_5_MIN); score (SC_10K); rudy_look_straight (); sample_start (SND_OUTER_RIGHT_INLANE, SL_500MS); }
/**************************************************************************** * * DMD display and sound effects * ****************************************************************************/ void cryoprison_super_jackpot_deff (void) { U8 i; for (i = 0; i < 8; i++) { switch (i) { case 0: sound_start (ST_SPEECH, SPCH_AHHHGGG, SL_2S, PRI_GAME_QUICK5); break; case 4: sound_start (ST_SPEECH, SPCH_HURRY_UP, SL_2S, PRI_GAME_QUICK5); break; case 8: sound_start (ST_SPEECH, SPCH_CLOSE_ENOUGH, SL_2S, PRI_GAME_QUICK5); break; case 1: case 3: case 5: case 7: sound_start (ST_ANY, EXPLOSION1_SHORT, SL_2S, PRI_GAME_QUICK5); }//END OF SWITCH dmd_sched_transition (&trans_scroll_up); dmd_alloc_low_clean (); font_render_string_center (&font_fireball, 64, 8, "SUPER"); font_render_string_center (&font_fireball, 64, 24, "JACKPOT"); dmd_show_low (); }//end of loop sample_start (MACHINE14_LONG, SL_1S); task_sleep (TIME_500MS); speech_start (SPCH_SUPER_JACKPOT, SL_1S); task_sleep_sec (1); deff_exit (); }//end of function
static void barrier_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed) { running_device *samples = machine->device("samples"); /* Player die - rising edge */ if (SOUNDVAL_RISING_EDGE(0x01)) sample_start(samples, 0, 0, 0); /* Player move - falling edge */ if (SOUNDVAL_FALLING_EDGE(0x02)) sample_start(samples, 1, 1, 0); /* Enemy move - falling edge */ if (SOUNDVAL_FALLING_EDGE(0x04)) sample_start(samples, 2, 2, 0); }
static WRITE8_HANDLER( seawolf2_sound_2_w ) /* Port 41 */ { game_on = data & 0x80; if (game_on) { /* data & 0x07 control dive L/R panning - not implemented */ if (data & 0x08) sample_start (2, 2, 0); /* Dive */ if (data & 0x10) sample_start (8, 3, 0); /* Right Sonar */ if (data & 0x20) sample_start (3, 3, 0); /* Left Sonar */ } coin_counter_w(0, data & 0x40); /* Coin Counter */ }
void astrof_sample2_w(int offset,int data) { static int last = 0; /* Bit 0-2 Explosion select (triggered by Bit 2 of the other port */ if (start_explosion) { if (data & 0x04) { /* This is really a compound effect, made up of I believe 3 sound effects, but since our sample contains them all, disable playing the other effects while the explosion is playing */ if (!bosskill_playing) { sample_start(CHANNEL_EXPLOSION,SAMPLE_BOSSKILL,0); bosskill_playing = 1; } } else if (data & 0x02) { sample_start(CHANNEL_EXPLOSION,SAMPLE_BOSSHIT,0); } else if (data & 0x01) { sample_start(CHANNEL_EXPLOSION,SAMPLE_EKILLED,0); } else { if (!death_playing) { sample_start(CHANNEL_EXPLOSION,SAMPLE_DEATH,0); death_playing = 1; } } start_explosion = 0; } /* Bit 3 - Low Fuel Warning */ if ((data & 0x08) && !(last & 0x08)) { sample_start(CHANNEL_FUEL,SAMPLE_FUEL,0); } last = data; }
void tacscan_sh_update (void) { /* If the ship roar has started playing but the sample stopped */ /* play the intermediate roar noise */ if ((roarPlaying) && (!sample_playing(kVoiceShipRoar))) sample_start (kVoiceShipRoar, 1, 1); }
void dkongjr_sh_climb_w(int offset,int data) { static int climb = 0; if (climb != data) { if (data && walk == 0) { sample_start (3,3,0); } else if (data && walk == 1) { sample_start (3,6,0); } climb = data; } }
static WRITE8_HANDLER( tankbatt_sh_fire_w ) { if (tankbatt_sound_enable) { const device_config *samples = devtag_get_device(space->machine, "samples"); sample_start (samples, 0, 0, 0); } }
CALLSET_ENTRY (trivial, sw_left_slingshot, sw_right_slingshot) { rudy_look_straight (); score (SC_110); sample_start (SND_SLING, SL_100MS * 3); if (flag_test (FLAG_OUTLANES_LIT)) lamp_toggle (LM_SPECIALS); }
void gottlieb_knocker(running_machine &machine) { device_t *samples = space->machine().device("samples"); if (!strcmp(machine.system().name,"reactor")) /* reactor */ { } else if (samples != NULL) /* qbert */ sample_start(samples, 0,44,0); }
CALLSET_ENTRY (trivial, sw_right_plunger) { if (!switch_poll_logical (SW_RIGHT_PLUNGER)) { sample_start (SND_PLUNGE, SL_2S); leff_start (LEFF_SHOOTER); } callset_invoke (sw_shooter); }
CALLSET_ENTRY (trivial, sw_plunger) { if (!switch_poll_logical (SW_PLUNGER)) { sample_start (SND_BURNOUT_01, SL_2S); // @TODO leff_start (LEFF_SHOOTER); } callset_invoke (sw_shooter); }
static WRITE8_HANDLER( tankbatt_sh_fire_w ) { tankbatt_state *state = space->machine().driver_data<tankbatt_state>(); if (state->m_sound_enable) { device_t *samples = space->machine().device("samples"); sample_start (samples, 0, 0, 0); } }
/* HC 4/14/98 */ void boothill_sh_port5_w(int offset, int data) { switch (data) { case 0x3b: sample_start (2, 1, 0); break; } }
/* HC 4/14/98 */ static WRITE_HANDLER( boothill_sh_port5_w ) { switch (data) { case 0x3b: sample_start (2, 1, 0); break; } }