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; }
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 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); }
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 astrob_speech_sh_update (void) { int sound; if( Machine->samples == 0 ) return; if (speechQueue[speechQueuePtr] != NOT_PLAYING) { sound = speechQueue[speechQueuePtr]; if (!sample_playing(SPEECH_CHANNEL)) { if (Machine->samples->sample[sound]) sample_start(SPEECH_CHANNEL, sound, 0); speechQueue[speechQueuePtr] = NOT_PLAYING; speechQueuePtr = ((speechQueuePtr + 1) % MAX_SPEECH_QUEUE); } } }
MACHINE_DRIVER_END /************************************* * * Congo PPI write handlers * *************************************/ WRITE8_HANDLER( congo_sound_b_w ) { UINT8 diff = data ^ sound_state[1]; sound_state[1] = data; /* bit 7 = mute */ /* GORILLA: channel 0 */ if ((diff & 0x02) && !(data & 0x02) && !sample_playing(0)) sample_start(0, 0, FALSE); }
void sega_sh_update (void) { int sound; /* if a sound is playing, return */ if (sample_playing(0)) return; /* Check the queue position. If a sound is scheduled, play it */ if (queue[queuePtr] != NOT_PLAYING) { sound = queue[queuePtr]; sample_start(0, sound, 0); /* Update the queue pointer to the next one */ queue[queuePtr] = NOT_PLAYING; ++ queuePtr; if (queuePtr >= MAX_SPEECH) queuePtr = 0; } }
MACHINE_CONFIG_END /************************************* * * Congo PPI write handlers * *************************************/ WRITE8_DEVICE_HANDLER( congo_sound_b_w ) { zaxxon_state *state = device->machine->driver_data<zaxxon_state>(); device_t *samples = device->machine->device("samples"); UINT8 diff = data ^ state->sound_state[1]; state->sound_state[1] = data; /* bit 7 = mute */ /* GORILLA: channel 0 */ if ((diff & 0x02) && !(data & 0x02) && !sample_playing(samples, 0)) sample_start(samples, 0, 0, FALSE); }
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); } } } } }
int wow_status_r(void) { // logerror("asked for samples status %d\n",0); return !sample_playing(0); }
int gorf_status_r(void) { return !sample_playing(GorfChannel); }
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; } } }
int gorf_status_r(void) { return !sample_playing(0); }
UINT32 gorf_speech_status_r(void *param) { return !sample_playing(0); }
static void berzerk_sh_update(int param) { voice_playing = !sample_playing(VOICE_CHANNEL); if (deathsound==3 && sample_playing(DEATH_CHANNEL) == 0 && lastnoise != 70) deathsound=0; /* reset death sound */ }
void berzerk_sh_update(void) { berzerkplayvoice = !sample_playing(VOICE_CHANNEL); if (deathsound==3 && sample_playing(DEATH_CHANNEL) == 0 && lastnoise != 70) deathsound=0; /* reset death sound */ }
void wpc_play_sample(int channel, int samplename) { /*Don't play again if already playing it*/ if(!sample_playing(channel)) sample_start(channel,samplename,0); }