diff --git a/src/mame/audio/blockade.c b/src/mame/audio/blockade.c index ce99a62e228..f497681281b 100644 --- a/src/mame/audio/blockade.c +++ b/src/mame/audio/blockade.c @@ -44,9 +44,8 @@ WRITE8_MEMBER(blockade_state::blockade_sound_freq_w) WRITE8_MEMBER(blockade_state::blockade_env_on_w) { - samples_device *samples = machine().device("samples"); if (BLOCKADE_LOG) mame_printf_debug("Boom Start\n"); - samples->start(0,0); + m_samples->start(0,0); return; } diff --git a/src/mame/audio/gorf.c b/src/mame/audio/gorf.c index d8946f3f066..bfe529fdd9d 100644 --- a/src/mame/audio/gorf.c +++ b/src/mame/audio/gorf.c @@ -115,7 +115,6 @@ READ8_HANDLER( gorf_speech_r ) UINT8 data = offset >> 8; #if USE_FAKE_VOTRAX astrocde_state *state = space.machine().driver_data(); - samples_device *samples = space.machine().device("samples"); int Phoneme, Intonation; int i = 0; offset &= 0xff; @@ -128,7 +127,7 @@ READ8_HANDLER( gorf_speech_r ) logerror("Date : %d Speech : %s at intonation %d\n",Phoneme, PhonemeTable[Phoneme],Intonation); if(Phoneme==63) { - samples->stop(0); + state->m_samples->stop(0); if (strlen(state->m_totalword)>2) logerror("Clearing sample %s\n",state->m_totalword); state->m_totalword[0] = 0; /* Clear the total word stack */ return data; @@ -141,8 +140,8 @@ READ8_HANDLER( gorf_speech_r ) if (state->m_plural != 0) { logerror("found a possible plural at %d\n",state->m_plural-1); if (!strcmp("S",state->m_totalword)) { /* Plural check */ - samples->start(0, num_samples-2); /* play the sample at position of word */ - samples->set_frequency(0, 11025); /* play at correct rate */ + state->m_samples->start(0, num_samples-2); /* play the sample at position of word */ + state->m_samples->set_frequency(0, 11025); /* play at correct rate */ state->m_totalword[0] = 0; /* Clear the total word stack */ state->m_oldword[0] = 0; /* Clear the total word stack */ return data; @@ -164,8 +163,8 @@ READ8_HANDLER( gorf_speech_r ) } else { state->m_plural=0; } - samples->start(0, i); /* play the sample at position of word */ - samples->set_frequency(0, 11025); /* play at correct rate */ + state->m_samples->start(0, i); /* play the sample at position of word */ + state->m_samples->set_frequency(0, 11025); /* play at correct rate */ logerror("Playing sample %d",i); state->m_totalword[0] = 0; /* Clear the total word stack */ return data; diff --git a/src/mame/audio/meadows.c b/src/mame/audio/meadows.c index f8ef6d6a151..1ff3cdd9a42 100644 --- a/src/mame/audio/meadows.c +++ b/src/mame/audio/meadows.c @@ -50,7 +50,6 @@ SAMPLES_START( meadows_sh_start ) void meadows_sh_update(running_machine &machine) { meadows_state *state = machine.driver_data(); - samples_device *samples = machine.device("samples"); int preset, amp; if (state->m_latched_0c01 != state->m_0c01 || state->m_latched_0c03 != state->m_0c03) @@ -67,8 +66,8 @@ void meadows_sh_update(running_machine &machine) state->m_freq1 = BASE_CTR1 / (preset + 1); else amp = 0; logerror("meadows ctr1 channel #%d preset:%3d freq:%5d amp:%d\n", state->m_channel, preset, state->m_freq1, amp); - samples->set_frequency(0, state->m_freq1 * sizeof(waveform)/2); - samples->set_volume(0,amp/255.0); + state->m_samples->set_frequency(0, state->m_freq1 * sizeof(waveform)/2); + state->m_samples->set_volume(0,amp/255.0); } if (state->m_latched_0c02 != state->m_0c02 || state->m_latched_0c03 != state->m_0c03) @@ -85,8 +84,8 @@ void meadows_sh_update(running_machine &machine) } else amp = 0; logerror("meadows ctr2 channel #%d preset:%3d freq:%5d amp:%d\n", state->m_channel+1, preset, state->m_freq2, amp); - samples->set_frequency(1, state->m_freq2 * sizeof(waveform)); - samples->set_volume(1,amp/255.0); + state->m_samples->set_frequency(1, state->m_freq2 * sizeof(waveform)); + state->m_samples->set_volume(1,amp/255.0); } if (state->m_latched_0c03 != state->m_0c03) diff --git a/src/mame/audio/polyplay.c b/src/mame/audio/polyplay.c index a84dd7c2a70..7b794c63b1a 100644 --- a/src/mame/audio/polyplay.c +++ b/src/mame/audio/polyplay.c @@ -49,29 +49,27 @@ void polyplay_set_channel2(running_machine &machine, int active) void polyplay_play_channel1(running_machine &machine, int data) { polyplay_state *state = machine.driver_data(); - samples_device *samples = machine.device("samples"); if (data) { state->m_freq1 = 2457600 / 16 / data / 8; - samples->set_volume(0, state->m_channel_playing1 * 1.0); - samples->start_raw(0, state->m_backgroundwave, ARRAY_LENGTH(state->m_backgroundwave), sizeof(state->m_backgroundwave)*state->m_freq1,true); + state->m_samples->set_volume(0, state->m_channel_playing1 * 1.0); + state->m_samples->start_raw(0, state->m_backgroundwave, ARRAY_LENGTH(state->m_backgroundwave), sizeof(state->m_backgroundwave)*state->m_freq1,true); } else { - samples->stop(0); - samples->stop(1); + state->m_samples->stop(0); + state->m_samples->stop(1); } } void polyplay_play_channel2(running_machine &machine, int data) { polyplay_state *state = machine.driver_data(); - samples_device *samples = machine.device("samples"); if (data) { state->m_freq2 = 2457600 / 16 / data / 8; - samples->set_volume(1, state->m_channel_playing2 * 1.0); - samples->start_raw(1, state->m_backgroundwave, ARRAY_LENGTH(state->m_backgroundwave), sizeof(state->m_backgroundwave)*state->m_freq2,true); + state->m_samples->set_volume(1, state->m_channel_playing2 * 1.0); + state->m_samples->start_raw(1, state->m_backgroundwave, ARRAY_LENGTH(state->m_backgroundwave), sizeof(state->m_backgroundwave)*state->m_freq2,true); } else { - samples->stop(0); - samples->stop(1); + state->m_samples->stop(0); + state->m_samples->stop(1); } } diff --git a/src/mame/audio/segag80r.c b/src/mame/audio/segag80r.c index d4fa4522e8a..6dcfb94e0ca 100644 --- a/src/mame/audio/segag80r.c +++ b/src/mame/audio/segag80r.c @@ -276,7 +276,6 @@ WRITE8_MEMBER(segag80r_state::astrob_sound_w) { 120.0f, 82.0f, 62.0f, 56.0f, 47.0f, 39.0f, 33.0f, 27.0f, 24.0f, 22.0f }; - samples_device *samples = machine().device("samples"); float freq_factor; UINT8 diff = data ^ m_sound_state[offset]; @@ -286,54 +285,54 @@ WRITE8_MEMBER(segag80r_state::astrob_sound_w) { case 0: /* INVADER-1: channel 0 */ - if ((diff & 0x01) && !(data & 0x01)) samples->start(0, (data & 0x80) ? 0 : 1, true); - if ((data & 0x01) && samples->playing(0)) samples->stop(0); + if ((diff & 0x01) && !(data & 0x01)) m_samples->start(0, (data & 0x80) ? 0 : 1, true); + if ((data & 0x01) && m_samples->playing(0)) m_samples->stop(0); /* INVADER-2: channel 1 */ - if ((diff & 0x02) && !(data & 0x02)) samples->start(1, (data & 0x80) ? 2 : 3, true); - if ((data & 0x02) && samples->playing(1)) samples->stop(1); + if ((diff & 0x02) && !(data & 0x02)) m_samples->start(1, (data & 0x80) ? 2 : 3, true); + if ((data & 0x02) && m_samples->playing(1)) m_samples->stop(1); /* INVADER-3: channel 2 */ - if ((diff & 0x04) && !(data & 0x04)) samples->start(2, (data & 0x80) ? 4 : 5, true); - if ((data & 0x04) && samples->playing(2)) samples->stop(2); + if ((diff & 0x04) && !(data & 0x04)) m_samples->start(2, (data & 0x80) ? 4 : 5, true); + if ((data & 0x04) && m_samples->playing(2)) m_samples->stop(2); /* INVADER-4: channel 3 */ - if ((diff & 0x08) && !(data & 0x08)) samples->start(3, (data & 0x80) ? 6 : 7, true); - if ((data & 0x08) && samples->playing(3)) samples->stop(3); + if ((diff & 0x08) && !(data & 0x08)) m_samples->start(3, (data & 0x80) ? 6 : 7, true); + if ((data & 0x08) && m_samples->playing(3)) m_samples->stop(3); /* ASTROIDS: channel 4 */ - if ((diff & 0x10) && !(data & 0x10)) samples->start(4, 8, true); - if ((data & 0x10) && samples->playing(4)) samples->stop(4); + if ((diff & 0x10) && !(data & 0x10)) m_samples->start(4, 8, true); + if ((data & 0x10) && m_samples->playing(4)) m_samples->stop(4); /* MUTE */ machine().sound().system_mute(data & 0x20); /* REFILL: channel 5 */ - if (!(data & 0x40) && !samples->playing(5)) samples->start(5, 9); - if ( (data & 0x40) && samples->playing(5)) samples->stop(5); + if (!(data & 0x40) && !m_samples->playing(5)) m_samples->start(5, 9); + if ( (data & 0x40) && m_samples->playing(5)) m_samples->stop(5); /* WARP: changes which sample is played for the INVADER samples above */ if (diff & 0x80) { - if (samples->playing(0)) samples->start(0, (data & 0x80) ? 0 : 1, true); - if (samples->playing(1)) samples->start(1, (data & 0x80) ? 2 : 3, true); - if (samples->playing(2)) samples->start(2, (data & 0x80) ? 4 : 5, true); - if (samples->playing(3)) samples->start(3, (data & 0x80) ? 6 : 7, true); + if (m_samples->playing(0)) m_samples->start(0, (data & 0x80) ? 0 : 1, true); + if (m_samples->playing(1)) m_samples->start(1, (data & 0x80) ? 2 : 3, true); + if (m_samples->playing(2)) m_samples->start(2, (data & 0x80) ? 4 : 5, true); + if (m_samples->playing(3)) m_samples->start(3, (data & 0x80) ? 6 : 7, true); } break; case 1: /* LASER #1: channel 6 */ - if ((diff & 0x01) && !(data & 0x01)) samples->start(6, 10); + if ((diff & 0x01) && !(data & 0x01)) m_samples->start(6, 10); /* LASER #2: channel 7 */ - if ((diff & 0x02) && !(data & 0x02)) samples->start(7, 11); + if ((diff & 0x02) && !(data & 0x02)) m_samples->start(7, 11); /* SHORT EXPL: channel 8 */ - if ((diff & 0x04) && !(data & 0x04)) samples->start(8, 12); + if ((diff & 0x04) && !(data & 0x04)) m_samples->start(8, 12); /* LONG EXPL: channel 8 */ - if ((diff & 0x08) && !(data & 0x08)) samples->start(8, 13); + if ((diff & 0x08) && !(data & 0x08)) m_samples->start(8, 13); /* ATTACK RATE */ if ((diff & 0x10) && !(data & 0x10)) m_sound_rate = (m_sound_rate + 1) % 10; @@ -342,10 +341,10 @@ WRITE8_MEMBER(segag80r_state::astrob_sound_w) if (!(data & 0x20)) m_sound_rate = 0; /* BONUS: channel 9 */ - if ((diff & 0x40) && !(data & 0x40)) samples->start(9, 14); + if ((diff & 0x40) && !(data & 0x40)) m_samples->start(9, 14); /* SONAR: channel 10 */ - if ((diff & 0x80) && !(data & 0x80)) samples->start(10, 15); + if ((diff & 0x80) && !(data & 0x80)) m_samples->start(10, 15); break; } @@ -359,10 +358,10 @@ WRITE8_MEMBER(segag80r_state::astrob_sound_w) /* adjust the sample rate of invader sounds based the sound_rate */ /* this is an approximation */ - if (samples->playing(0)) samples->set_frequency(0, samples->base_frequency(0) * freq_factor); - if (samples->playing(1)) samples->set_frequency(1, samples->base_frequency(1) * freq_factor); - if (samples->playing(2)) samples->set_frequency(2, samples->base_frequency(2) * freq_factor); - if (samples->playing(3)) samples->set_frequency(3, samples->base_frequency(3) * freq_factor); + if (m_samples->playing(0)) m_samples->set_frequency(0, m_samples->base_frequency(0) * freq_factor); + if (m_samples->playing(1)) m_samples->set_frequency(1, m_samples->base_frequency(1) * freq_factor); + if (m_samples->playing(2)) m_samples->set_frequency(2, m_samples->base_frequency(2) * freq_factor); + if (m_samples->playing(3)) m_samples->set_frequency(3, m_samples->base_frequency(3) * freq_factor); } @@ -506,32 +505,31 @@ static SOUND_START( sega005 ) WRITE8_MEMBER(segag80r_state::sega005_sound_a_w) { - samples_device *samples = machine().device("samples"); UINT8 diff = data ^ m_sound_state[0]; m_sound_state[0] = data; /* LARGE EXPL: channel 0 */ - if ((diff & 0x01) && !(data & 0x01)) samples->start(0, 0); + if ((diff & 0x01) && !(data & 0x01)) m_samples->start(0, 0); /* SMALL EXPL: channel 1 */ - if ((diff & 0x02) && !(data & 0x02)) samples->start(1, 1); + if ((diff & 0x02) && !(data & 0x02)) m_samples->start(1, 1); /* DROP BOMB: channel 2 */ - if ((diff & 0x04) && !(data & 0x04)) samples->start(2, 2); + if ((diff & 0x04) && !(data & 0x04)) m_samples->start(2, 2); /* SHOOT PISTOL: channel 3 */ - if ((diff & 0x08) && !(data & 0x08)) samples->start(3, 3); + if ((diff & 0x08) && !(data & 0x08)) m_samples->start(3, 3); /* MISSILE: channel 4 */ - if ((diff & 0x10) && !(data & 0x10)) samples->start(4, 4); + if ((diff & 0x10) && !(data & 0x10)) m_samples->start(4, 4); /* HELICOPTER: channel 5 */ - if ((diff & 0x20) && !(data & 0x20) && !samples->playing(5)) samples->start(5, 5, true); - if ((diff & 0x20) && (data & 0x20)) samples->stop(5); + if ((diff & 0x20) && !(data & 0x20) && !m_samples->playing(5)) m_samples->start(5, 5, true); + if ((diff & 0x20) && (data & 0x20)) m_samples->stop(5); /* WHISTLE: channel 6 */ - if ((diff & 0x40) && !(data & 0x40) && !samples->playing(6)) samples->start(6, 6, true); - if ((diff & 0x40) && (data & 0x40)) samples->stop(6); + if ((diff & 0x40) && !(data & 0x40) && !m_samples->playing(6)) m_samples->start(6, 6, true); + if ((diff & 0x40) && (data & 0x40)) m_samples->stop(6); } @@ -724,7 +722,6 @@ static SOUND_START( spaceod ) WRITE8_MEMBER(segag80r_state::spaceod_sound_w) { - samples_device *samples = machine().device("samples"); UINT8 diff = data ^ m_sound_state[offset]; m_sound_state[offset] = data; @@ -732,40 +729,40 @@ WRITE8_MEMBER(segag80r_state::spaceod_sound_w) { case 0: /* BACK G: channel 0 */ - if ((diff & 0x01) && !(data & 0x01) && !samples->playing(0)) samples->start(0, 7, true); - if ((diff & 0x01) && (data & 0x01)) samples->stop(0); + if ((diff & 0x01) && !(data & 0x01) && !m_samples->playing(0)) m_samples->start(0, 7, true); + if ((diff & 0x01) && (data & 0x01)) m_samples->stop(0); /* SHORT EXP: channel 1 */ - if ((diff & 0x04) && !(data & 0x04)) samples->start(1, 2); + if ((diff & 0x04) && !(data & 0x04)) m_samples->start(1, 2); /* ACCELERATE: channel 2 */ - if ((diff & 0x10) && !(data & 0x10)) samples->start(2, 8); + if ((diff & 0x10) && !(data & 0x10)) m_samples->start(2, 8); /* BATTLE STAR: channel 3 */ - if ((diff & 0x20) && !(data & 0x20)) samples->start(3, 10); + if ((diff & 0x20) && !(data & 0x20)) m_samples->start(3, 10); /* D BOMB: channel 4 */ - if ((diff & 0x40) && !(data & 0x40)) samples->start(4, 1); + if ((diff & 0x40) && !(data & 0x40)) m_samples->start(4, 1); /* LONG EXP: channel 5 */ - if ((diff & 0x80) && !(data & 0x80)) samples->start(5, 3); + if ((diff & 0x80) && !(data & 0x80)) m_samples->start(5, 3); break; case 1: /* SHOT: channel 6 */ - if ((diff & 0x01) && !(data & 0x01)) samples->start(6, 0); + if ((diff & 0x01) && !(data & 0x01)) m_samples->start(6, 0); /* BONUS UP: channel 7 */ - if ((diff & 0x02) && !(data & 0x02)) samples->start(7, 6); + if ((diff & 0x02) && !(data & 0x02)) m_samples->start(7, 6); /* WARP: channel 8 */ - if ((diff & 0x08) && !(data & 0x08)) samples->start(8, 4); + if ((diff & 0x08) && !(data & 0x08)) m_samples->start(8, 4); /* APPEARANCE UFO: channel 9 */ - if ((diff & 0x40) && !(data & 0x40)) samples->start(9, 5); + if ((diff & 0x40) && !(data & 0x40)) m_samples->start(9, 5); /* BLACK HOLE: channel 10 */ - if ((diff & 0x80) && !(data & 0x80)) samples->start(10, 9); + if ((diff & 0x80) && !(data & 0x80)) m_samples->start(10, 9); break; } } @@ -921,15 +918,14 @@ WRITE8_MEMBER(segag80r_state::monsterb_sound_a_w) WRITE8_MEMBER(segag80r_state::monsterb_sound_b_w) { - samples_device *samples = machine().device("samples"); UINT8 diff = data ^ m_sound_state[1]; m_sound_state[1] = data; /* SHOT: channel 0 */ - if ((diff & 0x01) && !(data & 0x01)) samples->start(0, 0); + if ((diff & 0x01) && !(data & 0x01)) m_samples->start(0, 0); /* DIVE: channel 1 */ - if ((diff & 0x02) && !(data & 0x02)) samples->start(1, 1); + if ((diff & 0x02) && !(data & 0x02)) m_samples->start(1, 1); /* TODO: D7 on Port B might affect TMS3617 output (mute?) */ } diff --git a/src/mame/audio/segag80v.c b/src/mame/audio/segag80v.c index 1468e04ed71..7a54bf72602 100644 --- a/src/mame/audio/segag80v.c +++ b/src/mame/audio/segag80v.c @@ -137,196 +137,189 @@ d0 crafts joining WRITE8_MEMBER(segag80v_state::elim1_sh_w) { - samples_device *samples = machine().device("samples"); data ^= 0xff; /* Play fireball sample */ if (data & 0x02) - samples->start(0, 0); + m_samples->start(0, 0); /* Play explosion samples */ if (data & 0x04) - samples->start(1, 10); + m_samples->start(1, 10); if (data & 0x08) - samples->start(1, 9); + m_samples->start(1, 9); if (data & 0x10) - samples->start(1, 8); + m_samples->start(1, 8); /* Play bounce sample */ if (data & 0x20) { - if (samples->playing(2)) - samples->stop(2); - samples->start(2, 1); + if (m_samples->playing(2)) + m_samples->stop(2); + m_samples->start(2, 1); } /* Play lazer sample */ if (data & 0xc0) { - if (samples->playing(3)) - samples->stop(3); - samples->start(3, 5); + if (m_samples->playing(3)) + m_samples->stop(3); + m_samples->start(3, 5); } } WRITE8_MEMBER(segag80v_state::elim2_sh_w) { - samples_device *samples = machine().device("samples"); data ^= 0xff; /* Play thrust sample */ if (data & 0x0f) - samples->start(4, 6); + m_samples->start(4, 6); else - samples->stop(4); + m_samples->stop(4); /* Play skitter sample */ if (data & 0x10) - samples->start(5, 2); + m_samples->start(5, 2); /* Play eliminator sample */ if (data & 0x20) - samples->start(6, 3); + m_samples->start(6, 3); /* Play electron samples */ if (data & 0x40) - samples->start(7, 7); + m_samples->start(7, 7); if (data & 0x80) - samples->start(7, 4); + m_samples->start(7, 4); } WRITE8_MEMBER(segag80v_state::zektor1_sh_w) { - samples_device *samples = machine().device("samples"); - data ^= 0xff; /* Play fireball sample */ if (data & 0x02) - samples->start(0, 0); + m_samples->start(0, 0); /* Play explosion samples */ if (data & 0x04) - samples->start(1, 10); + m_samples->start(1, 10); if (data & 0x08) - samples->start(1, 9); + m_samples->start(1, 9); if (data & 0x10) - samples->start(1, 8); + m_samples->start(1, 8); /* Play bounce sample */ if (data & 0x20) { - if (samples->playing(2)) - samples->stop(2); - samples->start(2, 1); + if (m_samples->playing(2)) + m_samples->stop(2); + m_samples->start(2, 1); } /* Play lazer sample */ if (data & 0xc0) { - if (samples->playing(3)) - samples->stop(3); - samples->start(3, 5); + if (m_samples->playing(3)) + m_samples->stop(3); + m_samples->start(3, 5); } } WRITE8_MEMBER(segag80v_state::zektor2_sh_w) { - samples_device *samples = machine().device("samples"); data ^= 0xff; /* Play thrust sample */ if (data & 0x0f) - samples->start(4, 6); + m_samples->start(4, 6); else - samples->stop(4); + m_samples->stop(4); /* Play skitter sample */ if (data & 0x10) - samples->start(5, 2); + m_samples->start(5, 2); /* Play eliminator sample */ if (data & 0x20) - samples->start(6, 3); + m_samples->start(6, 3); /* Play electron samples */ if (data & 0x40) - samples->start(7, 40); + m_samples->start(7, 40); if (data & 0x80) - samples->start(7, 41); + m_samples->start(7, 41); } WRITE8_MEMBER(segag80v_state::spacfury1_sh_w) { - samples_device *samples = machine().device("samples"); data ^= 0xff; /* craft growing */ if (data & 0x01) - samples->start(1, 0); + m_samples->start(1, 0); /* craft moving */ if (data & 0x02) { - if (!samples->playing(2)) - samples->start(2, 1, true); + if (!m_samples->playing(2)) + m_samples->start(2, 1, true); } else - samples->stop(2); + m_samples->stop(2); /* Thrust */ if (data & 0x04) { - if (!samples->playing(3)) - samples->start(3, 4, true); + if (!m_samples->playing(3)) + m_samples->start(3, 4, true); } else - samples->stop(3); + m_samples->stop(3); /* star spin */ if (data & 0x40) - samples->start(4, 8); + m_samples->start(4, 8); /* partial warship? */ if (data & 0x80) - samples->start(4, 9); + m_samples->start(4, 9); } WRITE8_MEMBER(segag80v_state::spacfury2_sh_w) { - samples_device *samples = machine().device("samples"); data ^= 0xff; /* craft joining */ if (data & 0x01) - samples->start(5, 2); + m_samples->start(5, 2); /* ship firing */ if (data & 0x02) { - if (samples->playing(6)) - samples->stop(6); - samples->start(6, 3); + if (m_samples->playing(6)) + m_samples->stop(6); + m_samples->start(6, 3); } /* fireball */ if (data & 0x04) - samples->start(7, 6); + m_samples->start(7, 6); /* small explosion */ if (data & 0x08) - samples->start(7, 6); + m_samples->start(7, 6); /* large explosion */ if (data & 0x10) - samples->start(7, 5); + m_samples->start(7, 5); /* docking bang */ if (data & 0x20) - samples->start(0, 7); + m_samples->start(0, 7); } diff --git a/src/mame/audio/spacefb.c b/src/mame/audio/spacefb.c index 1a07a9dbff0..fe2a285a7d4 100644 --- a/src/mame/audio/spacefb.c +++ b/src/mame/audio/spacefb.c @@ -31,15 +31,13 @@ READ8_MEMBER(spacefb_state::spacefb_audio_t1_r) WRITE8_MEMBER(spacefb_state::spacefb_port_1_w) { - samples_device *samples = machine().device("samples"); - m_audiocpu->set_input_line(0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE); /* enemy killed */ - if (!(data & 0x01) && (m_sound_latch & 0x01)) samples->start(0,0); + if (!(data & 0x01) && (m_sound_latch & 0x01)) m_samples->start(0,0); /* ship fire */ - if (!(data & 0x40) && (m_sound_latch & 0x40)) samples->start(1,1); + if (!(data & 0x40) && (m_sound_latch & 0x40)) m_samples->start(1,1); /* * Explosion Noise @@ -53,10 +51,10 @@ WRITE8_MEMBER(spacefb_state::spacefb_port_1_w) { if (data & 0x80) /* play decaying noise */ - samples->start(2,3); + m_samples->start(2,3); else /* start looping noise */ - samples->start(2,2, true); + m_samples->start(2,2, true); } m_sound_latch = data; diff --git a/src/mame/audio/suna8.c b/src/mame/audio/suna8.c index 68175fbea8c..570ea7b9c62 100644 --- a/src/mame/audio/suna8.c +++ b/src/mame/audio/suna8.c @@ -36,11 +36,9 @@ WRITE8_MEMBER(suna8_state::suna8_samples_number_w) void suna8_state::play_sample(int index) { - samples_device *samples = downcast(machine().device("samples")); - if (index < m_numsamples) { - samples->start_raw(0, &m_samplebuf[SAMPLEN * index], SAMPLEN, FREQ_HZ); + m_samples->start_raw(0, &m_samplebuf[SAMPLEN * index], SAMPLEN, FREQ_HZ); logerror("%s: starting sample %02X\n", machine().describe_context(), index); } else diff --git a/src/mame/audio/turbo.c b/src/mame/audio/turbo.c index c7a02dfe105..a82d3ab66d3 100644 --- a/src/mame/audio/turbo.c +++ b/src/mame/audio/turbo.c @@ -72,7 +72,6 @@ if (!((data >> 4) & 1)) mame_printf_debug("/TRIG4\n"); WRITE8_MEMBER(turbo_state::turbo_sound_a_w) { #if (!DISCRETE_TEST) - samples_device *samples = machine().device("samples"); #endif #if (!DISCRETE_TEST) UINT8 diff = data ^ m_sound_state[0]; @@ -82,31 +81,31 @@ WRITE8_MEMBER(turbo_state::turbo_sound_a_w) #if (!DISCRETE_TEST) /* /CRASH.S: channel 0 */ - if ((diff & 0x01) && !(data & 0x01)) samples->start(0, 5); + if ((diff & 0x01) && !(data & 0x01)) m_samples->start(0, 5); /* /TRIG1: channel 1 */ - if ((diff & 0x02) && !(data & 0x02)) samples->start(1, 0); + if ((diff & 0x02) && !(data & 0x02)) m_samples->start(1, 0); /* /TRIG2: channel 1 */ - if ((diff & 0x04) && !(data & 0x04)) samples->start(1, 1); + if ((diff & 0x04) && !(data & 0x04)) m_samples->start(1, 1); /* /TRIG3: channel 1 */ - if ((diff & 0x08) && !(data & 0x08)) samples->start(1, 2); + if ((diff & 0x08) && !(data & 0x08)) m_samples->start(1, 2); /* /TRIG4: channel 1 */ - if ((diff & 0x10) && !(data & 0x10)) samples->start(1, 3); + if ((diff & 0x10) && !(data & 0x10)) m_samples->start(1, 3); /* OSEL0 */ m_turbo_osel = (m_turbo_osel & 6) | ((data >> 5) & 1); /* /SLIP: channel 2 */ - if ((diff & 0x40) && !(data & 0x40)) samples->start(2, 4); + if ((diff & 0x40) && !(data & 0x40)) m_samples->start(2, 4); /* /CRASH.L: channel 3 */ - if ((diff & 0x80) && !(data & 0x80)) samples->start(3, 5); + if ((diff & 0x80) && !(data & 0x80)) m_samples->start(3, 5); /* update any samples */ - turbo_update_samples(this, samples); + turbo_update_samples(this, m_samples); #else @@ -123,7 +122,6 @@ WRITE8_MEMBER(turbo_state::turbo_sound_a_w) WRITE8_MEMBER(turbo_state::turbo_sound_b_w) { - samples_device *samples = machine().device("samples"); UINT8 diff = data ^ m_sound_state[1]; m_sound_state[1] = data; @@ -132,21 +130,19 @@ WRITE8_MEMBER(turbo_state::turbo_sound_b_w) output_set_value("tachometer", m_turbo_accel); /* /AMBU: channel 4 */ - if ((diff & 0x40) && !(data & 0x40) && !samples->playing(4)) samples->start(4, 8, true); - if ((diff & 0x40) && (data & 0x40)) samples->stop(4); + if ((diff & 0x40) && !(data & 0x40) && !m_samples->playing(4)) m_samples->start(4, 8, true); + if ((diff & 0x40) && (data & 0x40)) m_samples->stop(4); /* /SPIN: channel 2 */ - if ((diff & 0x80) && !(data & 0x80)) samples->start(2, 6); + if ((diff & 0x80) && !(data & 0x80)) m_samples->start(2, 6); /* update any samples */ - turbo_update_samples(this, samples); + turbo_update_samples(this, m_samples); } WRITE8_MEMBER(turbo_state::turbo_sound_c_w) { - samples_device *samples = machine().device("samples"); - /* OSEL1-2 */ m_turbo_osel = (m_turbo_osel & 1) | ((data & 3) << 1); @@ -157,7 +153,7 @@ WRITE8_MEMBER(turbo_state::turbo_sound_c_w) output_set_value("speed", (data >> 4) & 0x0f); /* update any samples */ - turbo_update_samples(this, samples); + turbo_update_samples(this, m_samples); } @@ -323,7 +319,6 @@ INLINE void subroc3d_update_volume(samples_device *samples, int leftchan, UINT8 WRITE8_MEMBER(turbo_state::subroc3d_sound_b_w) { - samples_device *samples = machine().device("samples"); UINT8 diff = data ^ m_sound_state[1]; m_sound_state[1] = data; @@ -332,12 +327,12 @@ WRITE8_MEMBER(turbo_state::subroc3d_sound_b_w) { m_subroc3d_mdis = m_sound_state[0] & 0x0f; m_subroc3d_mdir = (m_sound_state[0] >> 4) & 0x07; - if (!samples->playing(0)) + if (!m_samples->playing(0)) { - samples->start(0, 0, true); - samples->start(1, 0, true); + m_samples->start(0, 0, true); + m_samples->start(1, 0, true); } - subroc3d_update_volume(samples, 0, m_subroc3d_mdis, m_subroc3d_mdir); + subroc3d_update_volume(m_samples, 0, m_subroc3d_mdis, m_subroc3d_mdir); } /* bit 1 latches direction/volume for torpedo */ @@ -345,12 +340,12 @@ WRITE8_MEMBER(turbo_state::subroc3d_sound_b_w) { m_subroc3d_tdis = m_sound_state[0] & 0x0f; m_subroc3d_tdir = (m_sound_state[0] >> 4) & 0x07; - if (!samples->playing(2)) + if (!m_samples->playing(2)) { - samples->start(2, 1, true); - samples->start(3, 1, true); + m_samples->start(2, 1, true); + m_samples->start(3, 1, true); } - subroc3d_update_volume(samples, 2, m_subroc3d_tdis, m_subroc3d_tdir); + subroc3d_update_volume(m_samples, 2, m_subroc3d_tdis, m_subroc3d_tdir); } /* bit 2 latches direction/volume for fighter */ @@ -358,12 +353,12 @@ WRITE8_MEMBER(turbo_state::subroc3d_sound_b_w) { m_subroc3d_fdis = m_sound_state[0] & 0x0f; m_subroc3d_fdir = (m_sound_state[0] >> 4) & 0x07; - if (!samples->playing(4)) + if (!m_samples->playing(4)) { - samples->start(4, 2, true); - samples->start(5, 2, true); + m_samples->start(4, 2, true); + m_samples->start(5, 2, true); } - subroc3d_update_volume(samples, 4, m_subroc3d_fdis, m_subroc3d_fdir); + subroc3d_update_volume(m_samples, 4, m_subroc3d_fdis, m_subroc3d_fdir); } /* bit 3 latches direction/volume for hit */ @@ -371,42 +366,41 @@ WRITE8_MEMBER(turbo_state::subroc3d_sound_b_w) { m_subroc3d_hdis = m_sound_state[0] & 0x0f; m_subroc3d_hdir = (m_sound_state[0] >> 4) & 0x07; - subroc3d_update_volume(samples, 6, m_subroc3d_hdis, m_subroc3d_hdir); + subroc3d_update_volume(m_samples, 6, m_subroc3d_hdis, m_subroc3d_hdir); } } WRITE8_MEMBER(turbo_state::subroc3d_sound_c_w) { - samples_device *samples = machine().device("samples"); UINT8 diff = data ^ m_sound_state[2]; m_sound_state[2] = data; /* /FIRE TRIG */ /* FIRE SELECT */ if ((diff & 0x01) && (data & 0x01)) - samples->start(8, (data & 0x02) ? 6 : 5); + m_samples->start(8, (data & 0x02) ? 6 : 5); /* /SHIP EXP TRIG -> MY SHIP EXP: channel 9 */ if ((diff & 0x04) && (data & 0x04)) - samples->start(9, 7); + m_samples->start(9, 7); /* /HIT TRIG -> HIT.L/R: channels 6+7 */ if ((diff & 0x08) && (data & 0x08)) { - samples->start(6, (m_sound_state[0] & 0x80) ? 4 : 3); - samples->start(7, (m_sound_state[0] & 0x80) ? 4 : 3); + m_samples->start(6, (m_sound_state[0] & 0x80) ? 4 : 3); + m_samples->start(7, (m_sound_state[0] & 0x80) ? 4 : 3); } /* /ALARM TRIG -> ALARM.M: channel 10 */ /* ALARM SELECT */ if ((diff & 0x10) && (data & 0x10)) - samples->start(10, (data & 0x20) ? 10 : 9); + m_samples->start(10, (data & 0x20) ? 10 : 9); /* /PROLOGUE */ - if (!samples->playing(11)) - samples->start(11, 8, true); - samples->set_volume(11, (data & 0x40) ? 0 : 1.0); + if (!m_samples->playing(11)) + m_samples->start(11, 8, true); + m_samples->set_volume(11, (data & 0x40) ? 0 : 1.0); /* /GAME START */ machine().sound().system_mute(data & 0x80); @@ -501,64 +495,62 @@ static void buckrog_update_samples(turbo_state *state, samples_device *samples) WRITE8_MEMBER(turbo_state::buckrog_sound_a_w) { - samples_device *samples = machine().device("samples"); UINT8 diff = data ^ m_sound_state[0]; m_sound_state[0] = data; /* clock HIT DIS from bits 0-2 */ if ((diff & 0x10) && (data & 0x10)) - samples->set_volume(3, (float)(/*7 - */(data & 7)) / 7.0f); + m_samples->set_volume(3, (float)(/*7 - */(data & 7)) / 7.0f); /* clock ACC from bits 0-3 */ if ((diff & 0x20) && (data & 0x20)) { m_buckrog_myship = data & 0x0f; - buckrog_update_samples(this, samples); + buckrog_update_samples(this, m_samples); } /* /ALARM0: channel 0 */ - if ((diff & 0x40) && !(data & 0x40)) samples->start(0, 0); + if ((diff & 0x40) && !(data & 0x40)) m_samples->start(0, 0); /* /ALARM1: channel 0 */ - if ((diff & 0x80) && !(data & 0x80)) samples->start(0, 1); + if ((diff & 0x80) && !(data & 0x80)) m_samples->start(0, 1); } WRITE8_MEMBER(turbo_state::buckrog_sound_b_w) { - samples_device *samples = machine().device("samples"); UINT8 diff = data ^ m_sound_state[1]; m_sound_state[1] = data; /* /ALARM3: channel 0 */ - if ((diff & 0x01) && !(data & 0x01)) samples->start(0, 2); + if ((diff & 0x01) && !(data & 0x01)) m_samples->start(0, 2); /* /ALARM4: channel 0 */ - if ((diff & 0x02) && !(data & 0x02)) samples->start(0, 3); + if ((diff & 0x02) && !(data & 0x02)) m_samples->start(0, 3); /* /FIRE: channel 1 */ - if ((diff & 0x04) && !(data & 0x04)) samples->start(1, 5); + if ((diff & 0x04) && !(data & 0x04)) m_samples->start(1, 5); /* /EXP: channel 2 */ - if ((diff & 0x08) && !(data & 0x08)) samples->start(2, 4); + if ((diff & 0x08) && !(data & 0x08)) m_samples->start(2, 4); /* /HIT: channel 3 */ if ((diff & 0x10) && !(data & 0x10)) { - samples->start(3, 7); - buckrog_update_samples(this, samples); + m_samples->start(3, 7); + buckrog_update_samples(this, m_samples); } /* /REBOUND: channel 4 */ - if ((diff & 0x20) && !(data & 0x20)) samples->start(4, 6); + if ((diff & 0x20) && !(data & 0x20)) m_samples->start(4, 6); /* SHIP: channel 5 */ - if ((diff & 0x40) && (data & 0x40) && !samples->playing(5)) + if ((diff & 0x40) && (data & 0x40) && !m_samples->playing(5)) { - samples->start(5, 8, true); - buckrog_update_samples(this, samples); + m_samples->start(5, 8, true); + buckrog_update_samples(this, m_samples); } - if ((diff & 0x40) && !(data & 0x40) && samples->playing(5)) samples->stop(5); + if ((diff & 0x40) && !(data & 0x40) && m_samples->playing(5)) m_samples->stop(5); /* GAME ON */ machine().sound().system_enable(data & 0x80); diff --git a/src/mame/audio/zaxxon.c b/src/mame/audio/zaxxon.c index 95dc64f6d72..e87c0288132 100644 --- a/src/mame/audio/zaxxon.c +++ b/src/mame/audio/zaxxon.c @@ -112,70 +112,67 @@ MACHINE_CONFIG_END WRITE8_MEMBER(zaxxon_state::zaxxon_sound_a_w) { - samples_device *samples = machine().device("samples"); UINT8 diff = data ^ m_sound_state[0]; m_sound_state[0] = data; /* PLAYER SHIP A/B: volume */ - samples->set_volume(10, 0.5 + 0.157 * (data & 0x03)); - samples->set_volume(11, 0.5 + 0.157 * (data & 0x03)); + m_samples->set_volume(10, 0.5 + 0.157 * (data & 0x03)); + m_samples->set_volume(11, 0.5 + 0.157 * (data & 0x03)); /* PLAYER SHIP C: channel 10 */ - if ((diff & 0x04) && !(data & 0x04)) samples->start(10, 10, true); - if ((diff & 0x04) && (data & 0x04)) samples->stop(10); + if ((diff & 0x04) && !(data & 0x04)) m_samples->start(10, 10, true); + if ((diff & 0x04) && (data & 0x04)) m_samples->stop(10); /* PLAYER SHIP D: channel 11 */ - if ((diff & 0x08) && !(data & 0x08)) samples->start(11, 11, true); - if ((diff & 0x08) && (data & 0x08)) samples->stop(11); + if ((diff & 0x08) && !(data & 0x08)) m_samples->start(11, 11, true); + if ((diff & 0x08) && (data & 0x08)) m_samples->stop(11); /* HOMING MISSILE: channel 0 */ - if ((diff & 0x10) && !(data & 0x10)) samples->start(0, 0, true); - if ((diff & 0x10) && (data & 0x10)) samples->stop(0); + if ((diff & 0x10) && !(data & 0x10)) m_samples->start(0, 0, true); + if ((diff & 0x10) && (data & 0x10)) m_samples->stop(0); /* BASE MISSILE: channel 1 */ - if ((diff & 0x20) && !(data & 0x20)) samples->start(1, 1); + if ((diff & 0x20) && !(data & 0x20)) m_samples->start(1, 1); /* LASER: channel 2 */ - if ((diff & 0x40) && !(data & 0x40)) samples->start(2, 2, true); - if ((diff & 0x40) && (data & 0x40)) samples->stop(2); + if ((diff & 0x40) && !(data & 0x40)) m_samples->start(2, 2, true); + if ((diff & 0x40) && (data & 0x40)) m_samples->stop(2); /* BATTLESHIP: channel 3 */ - if ((diff & 0x80) && !(data & 0x80)) samples->start(3, 3, true); - if ((diff & 0x80) && (data & 0x80)) samples->stop(3); + if ((diff & 0x80) && !(data & 0x80)) m_samples->start(3, 3, true); + if ((diff & 0x80) && (data & 0x80)) m_samples->stop(3); } WRITE8_MEMBER(zaxxon_state::zaxxon_sound_b_w) { - samples_device *samples = machine().device("samples"); UINT8 diff = data ^ m_sound_state[1]; m_sound_state[1] = data; /* S-EXP: channel 4 */ - if ((diff & 0x10) && !(data & 0x10)) samples->start(4, 4); + if ((diff & 0x10) && !(data & 0x10)) m_samples->start(4, 4); /* M-EXP: channel 5 */ - if ((diff & 0x20) && !(data & 0x20) && !samples->playing(5)) samples->start(5, 5); + if ((diff & 0x20) && !(data & 0x20) && !m_samples->playing(5)) m_samples->start(5, 5); /* CANNON: channel 6 */ - if ((diff & 0x80) && !(data & 0x80)) samples->start(6, 6); + if ((diff & 0x80) && !(data & 0x80)) m_samples->start(6, 6); } WRITE8_MEMBER(zaxxon_state::zaxxon_sound_c_w) { - samples_device *samples = machine().device("samples"); UINT8 diff = data ^ m_sound_state[2]; m_sound_state[2] = data; /* SHOT: channel 7 */ - if ((diff & 0x01) && !(data & 0x01)) samples->start(7, 7); + if ((diff & 0x01) && !(data & 0x01)) m_samples->start(7, 7); /* ALARM2: channel 8 */ - if ((diff & 0x04) && !(data & 0x04)) samples->start(8, 8); + if ((diff & 0x04) && !(data & 0x04)) m_samples->start(8, 8); /* ALARM3: channel 9 */ - if ((diff & 0x08) && !(data & 0x08) && !samples->playing(9)) samples->start(9, 9); + if ((diff & 0x08) && !(data & 0x08) && !m_samples->playing(9)) m_samples->start(9, 9); } @@ -220,36 +217,34 @@ MACHINE_CONFIG_END WRITE8_MEMBER(zaxxon_state::congo_sound_b_w) { - samples_device *samples = machine().device("samples"); UINT8 diff = data ^ m_sound_state[1]; m_sound_state[1] = data; /* bit 7 = mute */ /* GORILLA: channel 0 */ - if ((diff & 0x02) && !(data & 0x02) && !samples->playing(0)) samples->start(0, 0); + if ((diff & 0x02) && !(data & 0x02) && !m_samples->playing(0)) m_samples->start(0, 0); } WRITE8_MEMBER(zaxxon_state::congo_sound_c_w) { - samples_device *samples = machine().device("samples"); UINT8 diff = data ^ m_sound_state[2]; m_sound_state[2] = data; /* BASS DRUM: channel 1 */ - if ((diff & 0x01) && !(data & 0x01)) samples->start(1, 1); - if ((diff & 0x01) && (data & 0x01)) samples->stop(1); + if ((diff & 0x01) && !(data & 0x01)) m_samples->start(1, 1); + if ((diff & 0x01) && (data & 0x01)) m_samples->stop(1); /* CONGA (LOW): channel 2 */ - if ((diff & 0x02) && !(data & 0x02)) samples->start(2, 2); - if ((diff & 0x02) && (data & 0x02)) samples->stop(2); + if ((diff & 0x02) && !(data & 0x02)) m_samples->start(2, 2); + if ((diff & 0x02) && (data & 0x02)) m_samples->stop(2); /* CONGA (HIGH): channel 3 */ - if ((diff & 0x04) && !(data & 0x04)) samples->start(3, 3); - if ((diff & 0x04) && (data & 0x04)) samples->stop(3); + if ((diff & 0x04) && !(data & 0x04)) m_samples->start(3, 3); + if ((diff & 0x04) && (data & 0x04)) m_samples->stop(3); /* RIM: channel 4 */ - if ((diff & 0x08) && !(data & 0x08)) samples->start(4, 4); - if ((diff & 0x08) && (data & 0x08)) samples->stop(4); + if ((diff & 0x08) && !(data & 0x08)) m_samples->start(4, 4); + if ((diff & 0x08) && (data & 0x08)) m_samples->stop(4); } diff --git a/src/mame/drivers/astrocde.c b/src/mame/drivers/astrocde.c index 07ffd7bb447..43db371b473 100644 --- a/src/mame/drivers/astrocde.c +++ b/src/mame/drivers/astrocde.c @@ -204,45 +204,43 @@ WRITE8_MEMBER(astrocde_state::seawolf2_lamps_w) WRITE8_MEMBER(astrocde_state::seawolf2_sound_1_w)// Port 40 { - samples_device *samples = machine().device("samples"); UINT8 rising_bits = data & ~m_port_1_last; m_port_1_last = data; - if (rising_bits & 0x01) samples->start(1, 1); /* Left Torpedo */ - if (rising_bits & 0x02) samples->start(0, 0); /* Left Ship Hit */ - if (rising_bits & 0x04) samples->start(4, 4); /* Left Mine Hit */ - if (rising_bits & 0x08) samples->start(6, 1); /* Right Torpedo */ - if (rising_bits & 0x10) samples->start(5, 0); /* Right Ship Hit */ - if (rising_bits & 0x20) samples->start(9, 4); /* Right Mine Hit */ + if (rising_bits & 0x01) m_samples->start(1, 1); /* Left Torpedo */ + if (rising_bits & 0x02) m_samples->start(0, 0); /* Left Ship Hit */ + if (rising_bits & 0x04) m_samples->start(4, 4); /* Left Mine Hit */ + if (rising_bits & 0x08) m_samples->start(6, 1); /* Right Torpedo */ + if (rising_bits & 0x10) m_samples->start(5, 0); /* Right Ship Hit */ + if (rising_bits & 0x20) m_samples->start(9, 4); /* Right Mine Hit */ } WRITE8_MEMBER(astrocde_state::seawolf2_sound_2_w)// Port 41 { - samples_device *samples = machine().device("samples"); UINT8 rising_bits = data & ~m_port_2_last; m_port_2_last = data; - samples->set_volume(0, (data & 0x80) ? 1.0 : 0.0); - samples->set_volume(1, (data & 0x80) ? 1.0 : 0.0); - samples->set_volume(3, (data & 0x80) ? 1.0 : 0.0); - samples->set_volume(4, (data & 0x80) ? 1.0 : 0.0); - samples->set_volume(5, (data & 0x80) ? 1.0 : 0.0); - samples->set_volume(6, (data & 0x80) ? 1.0 : 0.0); - samples->set_volume(8, (data & 0x80) ? 1.0 : 0.0); - samples->set_volume(9, (data & 0x80) ? 1.0 : 0.0); + m_samples->set_volume(0, (data & 0x80) ? 1.0 : 0.0); + m_samples->set_volume(1, (data & 0x80) ? 1.0 : 0.0); + m_samples->set_volume(3, (data & 0x80) ? 1.0 : 0.0); + m_samples->set_volume(4, (data & 0x80) ? 1.0 : 0.0); + m_samples->set_volume(5, (data & 0x80) ? 1.0 : 0.0); + m_samples->set_volume(6, (data & 0x80) ? 1.0 : 0.0); + m_samples->set_volume(8, (data & 0x80) ? 1.0 : 0.0); + m_samples->set_volume(9, (data & 0x80) ? 1.0 : 0.0); /* dive panning controlled by low 3 bits */ - samples->set_volume(2, (float)(~data & 0x07) / 7.0); - samples->set_volume(7, (float)(data & 0x07) / 7.0); + m_samples->set_volume(2, (float)(~data & 0x07) / 7.0); + m_samples->set_volume(7, (float)(data & 0x07) / 7.0); if (rising_bits & 0x08) { - samples->start(2, 2); - samples->start(7, 2); + m_samples->start(2, 2); + m_samples->start(7, 2); } - if (rising_bits & 0x10) samples->start(8, 3); /* Right Sonar */ - if (rising_bits & 0x20) samples->start(3, 3); /* Left Sonar */ + if (rising_bits & 0x10) m_samples->start(8, 3); /* Right Sonar */ + if (rising_bits & 0x20) m_samples->start(3, 3); /* Left Sonar */ coin_counter_w(machine(), 0, data & 0x40); /* Coin Counter */ } @@ -336,7 +334,7 @@ READ8_MEMBER(astrocde_state::gorf_io_1_r) case 6: machine().device("astrocade1")->set_output_gain(0, data ? 0.0 : 1.0); #if USE_FAKE_VOTRAX - machine().device("samples")->set_output_gain(0, data ? 1.0 : 0.0); + m_samples->set_output_gain(0, data ? 1.0 : 0.0); #else machine().device("votrax")->set_output_gain(0, data ? 1.0 : 0.0); #endif diff --git a/src/mame/drivers/dai3wksi.c b/src/mame/drivers/dai3wksi.c index 946815de273..23947d204db 100644 --- a/src/mame/drivers/dai3wksi.c +++ b/src/mame/drivers/dai3wksi.c @@ -50,7 +50,8 @@ public: dai3wksi_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_dai3wksi_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_samples(*this, "samples") { } /* video */ required_shared_ptr m_dai3wksi_videoram; @@ -70,6 +71,7 @@ public: virtual void machine_reset(); UINT32 screen_update_dai3wksi(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); required_device m_maincpu; + required_device m_samples; }; @@ -203,7 +205,6 @@ UINT32 dai3wksi_state::screen_update_dai3wksi(screen_device &screen, bitmap_rgb3 #if (USE_SAMPLES) WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_1_w) { - samples_device *samples = machine().device("samples"); UINT8 rising_bits = data & ~m_port_last1; m_enabled_sound = data & 0x80; @@ -211,19 +212,18 @@ WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_1_w) if ((rising_bits & 0x20) && m_enabled_sound) { if (data & 0x04) - samples->start(CHANNEL_SOUND5, SAMPLE_SOUND5); + m_samples->start(CHANNEL_SOUND5, SAMPLE_SOUND5); else - samples->start(CHANNEL_SOUND5, SAMPLE_SOUND5, true); + m_samples->start(CHANNEL_SOUND5, SAMPLE_SOUND5, true); } if (!(data & 0x20) && (m_port_last1 & 0x20)) - samples->stop(CHANNEL_SOUND5); + m_samples->stop(CHANNEL_SOUND5); m_port_last1 = data; } WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_2_w) { - samples_device *samples = machine().device("samples"); UINT8 rising_bits = data & ~m_port_last2; m_dai3wksi_flipscreen = data & 0x10; @@ -232,15 +232,15 @@ WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_2_w) if (m_enabled_sound) { - if (rising_bits & 0x01) samples->start(CHANNEL_SOUND1, SAMPLE_SOUND1); - if (rising_bits & 0x02) samples->start(CHANNEL_SOUND2, SAMPLE_SOUND2); - if (rising_bits & 0x08) samples->start(CHANNEL_SOUND4, SAMPLE_SOUND4); + if (rising_bits & 0x01) m_samples->start(CHANNEL_SOUND1, SAMPLE_SOUND1); + if (rising_bits & 0x02) m_samples->start(CHANNEL_SOUND2, SAMPLE_SOUND2); + if (rising_bits & 0x08) m_samples->start(CHANNEL_SOUND4, SAMPLE_SOUND4); if (rising_bits & 0x04) { if (!m_sound3_counter) - samples->start(CHANNEL_SOUND3, SAMPLE_SOUND3_1); + m_samples->start(CHANNEL_SOUND3, SAMPLE_SOUND3_1); else - samples->start(CHANNEL_SOUND3, SAMPLE_SOUND3_2); + m_samples->start(CHANNEL_SOUND3, SAMPLE_SOUND3_2); m_sound3_counter ^= 1; } @@ -251,14 +251,12 @@ WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_2_w) WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_3_w) { - samples_device *samples = machine().device("samples"); - if (m_enabled_sound) { if (data & 0x40) - samples->start(CHANNEL_SOUND6, SAMPLE_SOUND6_1); + m_samples->start(CHANNEL_SOUND6, SAMPLE_SOUND6_1); else if (data & 0x80) - samples->start(CHANNEL_SOUND6, SAMPLE_SOUND6_2); + m_samples->start(CHANNEL_SOUND6, SAMPLE_SOUND6_2); } } diff --git a/src/mame/drivers/equites.c b/src/mame/drivers/equites.c index 34a205d129d..9bbfd6f2d91 100644 --- a/src/mame/drivers/equites.c +++ b/src/mame/drivers/equites.c @@ -471,18 +471,15 @@ WRITE8_MEMBER(equites_state::equites_c0f8_w) WRITE8_MEMBER(equites_state::equites_8910porta_w) { - device_t *device = machine().device("samples"); - samples_device *samples = downcast(device); - // bongo 1 - samples->set_volume(0, ((data & 0x30) >> 4) * 0.33); + m_samples->set_volume(0, ((data & 0x30) >> 4) * 0.33); if (data & ~m_ay_port_a & 0x80) - samples->start(0, 0); + m_samples->start(0, 0); // bongo 2 - samples->set_volume(1, (data & 0x03) * 0.33); + m_samples->set_volume(1, (data & 0x03) * 0.33); if (data & ~m_ay_port_a & 0x08) - samples->start(1, 1); + m_samples->start(1, 1); m_ay_port_a = data; @@ -493,17 +490,15 @@ popmessage("HH %d(%d) CYM %d(%d)", m_hihat, BIT(m_ay_port_b, 6), m_cymbal, m_ay_ WRITE8_MEMBER(equites_state::equites_8910portb_w) { - device_t *device = machine().device("samples"); - samples_device *samples = downcast(device); #if POPDRUMKIT if (data & ~m_ay_port_b & 0x08) m_cymbal++; if (data & ~m_ay_port_b & 0x04) m_hihat++; #endif // bongo 3 - samples->set_volume(2, ((data & 0x30)>>4) * 0.33); + m_samples->set_volume(2, ((data & 0x30)>>4) * 0.33); if (data & ~m_ay_port_b & 0x80) - samples->start(2, 2); + m_samples->start(2, 2); // FIXME I'm just enabling the MSM5232 Noise Output for now. Proper emulation // of the analog circuitry should be done instead. diff --git a/src/mame/drivers/mcr.c b/src/mame/drivers/mcr.c index 783e43b50db..9d63cdea1bf 100644 --- a/src/mame/drivers/mcr.c +++ b/src/mame/drivers/mcr.c @@ -535,14 +535,12 @@ WRITE8_MEMBER(mcr_state::kroozr_op4_w) WRITE8_MEMBER(mcr_state::journey_op4_w) { - samples_device *samples = machine().device("samples"); - /* if we're not playing the sample yet, start it */ - if (!samples->playing(0)) - samples->start(0, 0, true); + if (!m_samples->playing(0)) + m_samples->start(0, 0, true); /* bit 0 turns cassette on/off */ - samples->pause(0, ~data & 1); + m_samples->pause(0, ~data & 1); } @@ -555,16 +553,14 @@ WRITE8_MEMBER(mcr_state::journey_op4_w) WRITE8_MEMBER(mcr_state::twotiger_op4_w) { - samples_device *samples = machine().device("samples"); - for (int i = 0; i < 2; i++) { /* play tape, and loop it */ - if (!samples->playing(i)) - samples->start(i, i, true); + if (!m_samples->playing(i)) + m_samples->start(i, i, true); /* bit 1 turns cassette on/off */ - samples->pause(i, ~data & 2); + m_samples->pause(i, ~data & 2); } // bit 2: lamp control? diff --git a/src/mame/drivers/superqix.c b/src/mame/drivers/superqix.c index 809ff119a6d..ba9008f3f24 100644 --- a/src/mame/drivers/superqix.c +++ b/src/mame/drivers/superqix.c @@ -123,7 +123,6 @@ static SAMPLES_START( pbillian_sh_start ) WRITE8_MEMBER(superqix_state::pbillian_sample_trigger_w) { - samples_device *samples = machine().device("samples"); UINT8 *src = memregion("samples")->base(); int len = memregion("samples")->bytes(); int start,end; @@ -134,7 +133,7 @@ WRITE8_MEMBER(superqix_state::pbillian_sample_trigger_w) while (end < len && src[end] != 0xff) end++; - samples->start_raw(0, m_samplebuf + start, end - start, 5000); // 5khz ? + m_samples->start_raw(0, m_samplebuf + start, end - start, 5000); // 5khz ? } diff --git a/src/mame/drivers/tankbatt.c b/src/mame/drivers/tankbatt.c index 256b28bd79f..c1919919943 100644 --- a/src/mame/drivers/tankbatt.c +++ b/src/mame/drivers/tankbatt.c @@ -97,7 +97,7 @@ WRITE8_MEMBER(tankbatt_state::tankbatt_interrupt_enable_w) m_sound_enable = !data; /* hack - turn off the engine noise if the normal game nmi's are disabled */ - if (data) machine().device("samples")->stop(2); + if (data) m_samples->stop(2); } WRITE8_MEMBER(tankbatt_state::tankbatt_demo_interrupt_enable_w) @@ -109,30 +109,27 @@ WRITE8_MEMBER(tankbatt_state::tankbatt_sh_expl_w) { if (m_sound_enable) { - samples_device *samples = machine().device("samples"); - samples->start(1, 3); + m_samples->start(1, 3); } } WRITE8_MEMBER(tankbatt_state::tankbatt_sh_engine_w) { - samples_device *samples = machine().device("samples"); if (m_sound_enable) { if (data) - samples->start(2, 2, true); + m_samples->start(2, 2, true); else - samples->start(2, 1, true); + m_samples->start(2, 1, true); } - else samples->stop(2); + else m_samples->stop(2); } WRITE8_MEMBER(tankbatt_state::tankbatt_sh_fire_w) { if (m_sound_enable) { - samples_device *samples = machine().device("samples"); - samples->start(0, 0); + m_samples->start(0, 0); } } diff --git a/src/mame/drivers/thief.c b/src/mame/drivers/thief.c index 2ca5506a6e8..b8beeb4f7d0 100644 --- a/src/mame/drivers/thief.c +++ b/src/mame/drivers/thief.c @@ -100,7 +100,6 @@ WRITE8_MEMBER(thief_state::thief_input_select_w) WRITE8_MEMBER(thief_state::tape_control_w) { - device_t *device = machine().device("samples"); switch( data ) { case 0x02: /* coin meter on */ @@ -113,27 +112,27 @@ WRITE8_MEMBER(thief_state::tape_control_w) break; case 0x08: /* talk track on */ - tape_set_audio( downcast(device), kTalkTrack, 1 ); + tape_set_audio( m_samples, kTalkTrack, 1 ); break; case 0x09: /* talk track off */ - tape_set_audio( downcast(device), kTalkTrack, 0 ); + tape_set_audio( m_samples, kTalkTrack, 0 ); break; case 0x0a: /* motor on */ - tape_set_motor( downcast(device), 1 ); + tape_set_motor( m_samples, 1 ); break; case 0x0b: /* motor off */ - tape_set_motor( downcast(device), 0 ); + tape_set_motor( m_samples, 0 ); break; case 0x0c: /* crash track on */ - tape_set_audio( downcast(device), kCrashTrack, 1 ); + tape_set_audio( m_samples, kCrashTrack, 1 ); break; case 0x0d: /* crash track off */ - tape_set_audio( downcast(device), kCrashTrack, 0 ); + tape_set_audio( m_samples, kCrashTrack, 0 ); break; } } diff --git a/src/mame/drivers/tnzs.c b/src/mame/drivers/tnzs.c index 49bc17d4ce0..ba24b4f14c8 100644 --- a/src/mame/drivers/tnzs.c +++ b/src/mame/drivers/tnzs.c @@ -706,7 +706,6 @@ READ8_MEMBER(tnzs_state::kageki_csport_r) WRITE8_MEMBER(tnzs_state::kageki_csport_w) { - device_t *device = machine().device("samples"); char mess[80]; if (data > 0x3f) @@ -716,17 +715,16 @@ WRITE8_MEMBER(tnzs_state::kageki_csport_w) } else { - samples_device *samples = downcast(device); if (data > MAX_SAMPLES) { // stop samples - samples->stop(0); + m_samples->stop(0); sprintf(mess, "VOICE:%02X STOP", data); } else { // play samples - samples->start_raw(0, m_sampledata[data], m_samplesize[data], 7000); + m_samples->start_raw(0, m_sampledata[data], m_samplesize[data], 7000); sprintf(mess, "VOICE:%02X PLAY", data); } // popmessage(mess); diff --git a/src/mame/drivers/triplhnt.c b/src/mame/drivers/triplhnt.c index 2bf607b749e..b484dfcee75 100644 --- a/src/mame/drivers/triplhnt.c +++ b/src/mame/drivers/triplhnt.c @@ -33,7 +33,6 @@ void triplhnt_state::triplhnt_set_collision(int code) void triplhnt_state::triplhnt_update_misc(address_space &space, int offset) { - samples_device *samples = machine().device("samples"); UINT8 is_witch_hunt; UINT8 bit = offset >> 1; @@ -76,14 +75,14 @@ void triplhnt_state::triplhnt_update_misc(address_space &space, int offset) bit = ~m_misc_flags & 0x40; /* if we're not playing the sample yet, start it */ - if (!samples->playing(0)) - samples->start(0, 0, true); - if (!samples->playing(1)) - samples->start(1, 1, true); + if (!m_samples->playing(0)) + m_samples->start(0, 0, true); + if (!m_samples->playing(1)) + m_samples->start(1, 1, true); /* bit 6 turns cassette on/off */ - samples->pause(0, is_witch_hunt || bit); - samples->pause(1, !is_witch_hunt || bit); + m_samples->pause(0, is_witch_hunt || bit); + m_samples->pause(1, !is_witch_hunt || bit); } diff --git a/src/mame/includes/astrocde.h b/src/mame/includes/astrocde.h index 3b0ad47c8d9..2474a4721f7 100644 --- a/src/mame/includes/astrocde.h +++ b/src/mame/includes/astrocde.h @@ -3,7 +3,7 @@ Bally Astrocade-based hardware ***************************************************************************/ - +#include "sound/samples.h" #define ASTROCADE_CLOCK (XTAL_14_31818MHz/2) #define AC_SOUND_PRESENT (0x01) @@ -22,7 +22,8 @@ public: m_videoram(*this, "videoram"), m_protected_ram(*this, "protected_ram"), m_maincpu(*this, "maincpu"), - m_subcpu(*this, "sub") { } + m_subcpu(*this, "sub"), + m_samples(*this, "samples") { } optional_shared_ptr m_videoram; UINT8 m_video_config; @@ -136,6 +137,7 @@ public: void init_sparklestar(); required_device m_maincpu; optional_device m_subcpu; + optional_device m_samples; }; /*----------- defined in audio/wow.c -----------*/ diff --git a/src/mame/includes/blockade.h b/src/mame/includes/blockade.h index d99369b4613..81dadf6b652 100644 --- a/src/mame/includes/blockade.h +++ b/src/mame/includes/blockade.h @@ -8,7 +8,8 @@ public: : driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_discrete(*this, "discrete"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_samples(*this, "samples") { } required_shared_ptr m_videoram; required_device m_discrete; @@ -32,6 +33,7 @@ public: INTERRUPT_GEN_MEMBER(blockade_interrupt); DECLARE_WRITE8_MEMBER(blockade_sound_freq_w); required_device m_maincpu; + required_device m_samples; }; /*----------- defined in audio/blockade.c -----------*/ diff --git a/src/mame/includes/equites.h b/src/mame/includes/equites.h index de2f4b4677a..61454d32899 100644 --- a/src/mame/includes/equites.h +++ b/src/mame/includes/equites.h @@ -1,4 +1,4 @@ - +#include "sound/samples.h" #include "sound/msm5232.h" #include "sound/dac.h" @@ -20,7 +20,8 @@ public: m_dac_1(*this, "dac1"), m_dac_2(*this, "dac2"), m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu") { } + m_audiocpu(*this, "audiocpu"), + m_samples(*this, "samples") { } /* memory pointers */ required_shared_ptr m_bg_videoram; @@ -125,4 +126,5 @@ public: void unpack_region( const char *region ); required_device m_maincpu; required_device m_audiocpu; + required_device m_samples; }; diff --git a/src/mame/includes/galaga.h b/src/mame/includes/galaga.h index a190589bd0e..0dc1c42bdab 100644 --- a/src/mame/includes/galaga.h +++ b/src/mame/includes/galaga.h @@ -1,4 +1,5 @@ #include "sound/discrete.h" +#include "sound/samples.h" class galaga_state : public driver_device { @@ -89,7 +90,8 @@ public: m_xevious_fg_colorram(*this, "fg_colorram"), m_xevious_bg_colorram(*this, "bg_colorram"), m_xevious_fg_videoram(*this, "fg_videoram"), - m_xevious_bg_videoram(*this, "bg_videoram") { } + m_xevious_bg_videoram(*this, "bg_videoram"), + m_samples(*this, "samples") { } required_shared_ptr m_xevious_sr1; required_shared_ptr m_xevious_sr2; @@ -98,6 +100,7 @@ public: required_shared_ptr m_xevious_bg_colorram; required_shared_ptr m_xevious_fg_videoram; required_shared_ptr m_xevious_bg_videoram; + optional_device m_samples; INT32 m_xevious_bs[2]; DECLARE_DRIVER_INIT(xevious); diff --git a/src/mame/includes/gaplus.h b/src/mame/includes/gaplus.h index e8d1c483246..2da1356102d 100644 --- a/src/mame/includes/gaplus.h +++ b/src/mame/includes/gaplus.h @@ -1,3 +1,4 @@ +#include "sound/samples.h" #define MAX_STARS 250 struct star { @@ -16,7 +17,8 @@ public: m_spriteram(*this,"spriteram") , m_maincpu(*this, "maincpu"), m_subcpu(*this, "sub"), - m_subcpu2(*this, "sub2") { } + m_subcpu2(*this, "sub2"), + m_samples(*this, "samples") { } required_shared_ptr m_customio_3; required_shared_ptr m_videoram; @@ -60,4 +62,5 @@ public: required_device m_maincpu; required_device m_subcpu; required_device m_subcpu2; + required_device m_samples; }; diff --git a/src/mame/includes/mcr.h b/src/mame/includes/mcr.h index 7026452426b..fa35d6c6993 100644 --- a/src/mame/includes/mcr.h +++ b/src/mame/includes/mcr.h @@ -10,6 +10,7 @@ #include "machine/z80pio.h" #include "machine/z80sio.h" #include "audio/midway.h" +#include "sound/samples.h" /* constants */ #define MAIN_OSC_MCR_I XTAL_19_968MHz @@ -29,7 +30,8 @@ public: m_turbo_chip_squeak(*this, "tcs"), m_squawk_n_talk(*this, "snt"), m_dpoker_coin_in_timer(*this, "dp_coinin"), - m_dpoker_hopper_timer(*this, "dp_hopper") + m_dpoker_hopper_timer(*this, "dp_hopper"), + m_samples(*this, "samples") { } // these should be required but can't because mcr68 shares with us @@ -45,6 +47,7 @@ public: optional_device m_squawk_n_talk; optional_device m_dpoker_coin_in_timer; optional_device m_dpoker_hopper_timer; + optional_device m_samples; DECLARE_WRITE8_MEMBER(mcr_control_port_w); DECLARE_WRITE8_MEMBER(mcr_ipu_laserdisk_w); diff --git a/src/mame/includes/meadows.h b/src/mame/includes/meadows.h index 50ea36403d5..40125d2c09f 100644 --- a/src/mame/includes/meadows.h +++ b/src/mame/includes/meadows.h @@ -14,7 +14,8 @@ public: m_spriteram(*this, "spriteram"), m_videoram(*this, "videoram"), m_maincpu(*this, "maincpu"), - m_dac(*this, "dac") { } + m_dac(*this, "dac"), + m_samples(*this, "samples") { } optional_shared_ptr m_spriteram; required_shared_ptr m_videoram; @@ -54,6 +55,7 @@ public: void draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip); required_device m_maincpu; optional_device m_dac; + optional_device m_samples; }; diff --git a/src/mame/includes/polyplay.h b/src/mame/includes/polyplay.h index af30d3473ac..dbbdd0b7bf4 100644 --- a/src/mame/includes/polyplay.h +++ b/src/mame/includes/polyplay.h @@ -9,7 +9,8 @@ public: : driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_characterram(*this, "characterram"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_samples(*this, "samples") { } required_shared_ptr m_videoram; int m_freq1; @@ -38,6 +39,7 @@ public: INTERRUPT_GEN_MEMBER(coin_interrupt); TIMER_DEVICE_CALLBACK_MEMBER(polyplay_timer_callback); required_device m_maincpu; + required_device m_samples; }; diff --git a/src/mame/includes/segag80r.h b/src/mame/includes/segag80r.h index a34f7e89ab1..06f39bf9644 100644 --- a/src/mame/includes/segag80r.h +++ b/src/mame/includes/segag80r.h @@ -3,7 +3,7 @@ Sega G-80 raster hardware *************************************************************************/ - +#include "sound/samples.h" #include "machine/segag80.h" #include "sound/sn76496.h" @@ -17,7 +17,8 @@ public: m_sn1(*this, "sn1"), m_sn2(*this, "sn2"), m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu") { } + m_audiocpu(*this, "audiocpu"), + m_samples(*this, "samples") { } required_shared_ptr m_mainram; required_shared_ptr m_videoram; @@ -124,6 +125,7 @@ public: void monsterb_expand_gfx(const char *region); required_device m_maincpu; optional_device m_audiocpu; + optional_device m_samples; }; diff --git a/src/mame/includes/segag80v.h b/src/mame/includes/segag80v.h index fff146c773f..89c66d2bb50 100644 --- a/src/mame/includes/segag80v.h +++ b/src/mame/includes/segag80v.h @@ -3,7 +3,7 @@ Sega vector hardware *************************************************************************/ - +#include "sound/samples.h" #include "machine/segag80.h" class segag80v_state : public driver_device @@ -13,7 +13,8 @@ public: : driver_device(mconfig, type, tag), m_mainram(*this, "mainram"), m_vectorram(*this, "vectorram"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_samples(*this, "samples") { } required_shared_ptr m_mainram; device_t *m_usb; @@ -59,4 +60,5 @@ public: offs_t decrypt_offset(address_space &space, offs_t offset); inline UINT8 demangle(UINT8 d7d6, UINT8 d5d4, UINT8 d3d2, UINT8 d1d0); required_device m_maincpu; + optional_device m_samples; }; diff --git a/src/mame/includes/spacefb.h b/src/mame/includes/spacefb.h index 2ffde28001f..7e378735c5e 100644 --- a/src/mame/includes/spacefb.h +++ b/src/mame/includes/spacefb.h @@ -3,7 +3,7 @@ Space Firebird hardware ****************************************************************************/ - +#include "sound/samples.h" /* * SPACEFB_PIXEL_CLOCK clocks the star generator circuit. The rest of * the graphics use a clock half of SPACEFB_PIXEL_CLOCK, thus creating @@ -31,7 +31,8 @@ public: : driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu") { } + m_audiocpu(*this, "audiocpu"), + m_samples(*this, "samples") { } UINT8 m_sound_latch; emu_timer *m_interrupt_timer; @@ -64,6 +65,7 @@ public: void start_interrupt_timer(); required_device m_maincpu; required_device m_audiocpu; + required_device m_samples; }; /*----------- defined in audio/spacefb.c -----------*/ diff --git a/src/mame/includes/starcrus.h b/src/mame/includes/starcrus.h index 98e25c49ea4..083c23448b2 100644 --- a/src/mame/includes/starcrus.h +++ b/src/mame/includes/starcrus.h @@ -1,9 +1,11 @@ +#include "sound/samples.h" class starcrus_state : public driver_device { public: starcrus_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_samples(*this, "samples") { } bitmap_ind16 *m_ship1_vid; bitmap_ind16 *m_ship2_vid; @@ -57,4 +59,5 @@ public: int collision_check_s1p1p2(); int collision_check_s2p1p2(); required_device m_maincpu; + required_device m_samples; }; diff --git a/src/mame/includes/suna8.h b/src/mame/includes/suna8.h index 32c7b9e45cb..25c20a4ca60 100644 --- a/src/mame/includes/suna8.h +++ b/src/mame/includes/suna8.h @@ -12,7 +12,8 @@ public: m_spriteram(*this, "spriteram"), m_wram(*this, "wram"), m_banked_paletteram(*this, "paletteram"), - m_audiocpu(*this, "audiocpu") { } + m_audiocpu(*this, "audiocpu"), + m_samples(*this, "samples") { } required_device m_maincpu; optional_shared_ptr m_hardhead_ip; @@ -20,6 +21,7 @@ public: optional_shared_ptr m_wram; optional_shared_ptr m_banked_paletteram; required_device m_audiocpu; + optional_device m_samples; UINT8 m_rombank; UINT8 m_rombank_latch; diff --git a/src/mame/includes/superqix.h b/src/mame/includes/superqix.h index 7c63c460918..77c9f02c154 100644 --- a/src/mame/includes/superqix.h +++ b/src/mame/includes/superqix.h @@ -1,3 +1,5 @@ +#include "sound/samples.h" + class superqix_state : public driver_device { public: @@ -8,7 +10,8 @@ public: m_spriteram(*this, "spriteram"), m_videoram(*this, "videoram"), m_bitmapram(*this, "bitmapram"), - m_bitmapram2(*this, "bitmapram2"){ } + m_bitmapram2(*this, "bitmapram2"), + m_samples(*this, "samples"){ } required_device m_maincpu; optional_device m_mcu; @@ -16,6 +19,7 @@ public: required_shared_ptr m_videoram; optional_shared_ptr m_bitmapram; optional_shared_ptr m_bitmapram2; + optional_device m_samples; INT16 *m_samplebuf; UINT8 m_port1; diff --git a/src/mame/includes/tankbatt.h b/src/mame/includes/tankbatt.h index 2d69aad1149..7519bacbc46 100644 --- a/src/mame/includes/tankbatt.h +++ b/src/mame/includes/tankbatt.h @@ -1,3 +1,4 @@ +#include "sound/samples.h" class tankbatt_state : public driver_device { public: @@ -5,7 +6,8 @@ public: : driver_device(mconfig, type, tag), m_bulletsram(*this, "bulletsram"), m_videoram(*this, "videoram"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_samples(*this, "samples") { } required_shared_ptr m_bulletsram; required_shared_ptr m_videoram; @@ -34,4 +36,5 @@ public: INTERRUPT_GEN_MEMBER(tankbatt_interrupt); void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect); required_device m_maincpu; + required_device m_samples; }; diff --git a/src/mame/includes/thief.h b/src/mame/includes/thief.h index 5003486d99c..935ad6a0774 100644 --- a/src/mame/includes/thief.h +++ b/src/mame/includes/thief.h @@ -12,7 +12,8 @@ class thief_state : public driver_device public: thief_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_samples(*this, "samples") { } UINT8 *m_videoram; UINT8 m_input_select; @@ -42,4 +43,5 @@ public: void tape_set_audio( samples_device *samples, int track, int bOn ); void tape_set_motor( samples_device *samples, int bOn ); required_device m_maincpu; + required_device m_samples; }; diff --git a/src/mame/includes/tnzs.h b/src/mame/includes/tnzs.h index 7cbfa46a1f5..99082ae90e9 100644 --- a/src/mame/includes/tnzs.h +++ b/src/mame/includes/tnzs.h @@ -1,4 +1,5 @@ #include "sound/dac.h" +#include "sound/samples.h" #define MAX_SAMPLES 0x2f /* max samples */ @@ -25,7 +26,8 @@ public: m_subcpu(*this, "sub"), m_mcu(*this, "mcu"), m_maincpu(*this, "maincpu"), - m_dac(*this, "dac") { } + m_dac(*this, "dac"), + m_samples(*this, "samples") { } /* memory pointers */ // UINT8 * m_paletteram; // currently this uses generic palette handling @@ -112,4 +114,5 @@ public: DECLARE_WRITE_LINE_MEMBER(irqhandler); required_device m_maincpu; optional_device m_dac; + optional_device m_samples; }; diff --git a/src/mame/includes/triplhnt.h b/src/mame/includes/triplhnt.h index abea70daf6a..ae6234dcade 100644 --- a/src/mame/includes/triplhnt.h +++ b/src/mame/includes/triplhnt.h @@ -27,7 +27,8 @@ public: m_orga_ram(*this, "orga_ram"), m_code_ram(*this, "code_ram"), m_maincpu(*this, "maincpu"), - m_discrete(*this, "discrete") { } + m_discrete(*this, "discrete"), + m_samples(*this, "samples") { } UINT8 m_cmos[16]; UINT8 m_da_latch; @@ -59,6 +60,7 @@ public: void triplhnt_update_misc(address_space &space, int offset); required_device m_maincpu; required_device m_discrete; + required_device m_samples; }; diff --git a/src/mame/includes/turbo.h b/src/mame/includes/turbo.h index 11548112152..b7b8e2f5a49 100644 --- a/src/mame/includes/turbo.h +++ b/src/mame/includes/turbo.h @@ -7,7 +7,7 @@ #include "cpu/z80/z80.h" #include "machine/i8255.h" #include "sound/discrete.h" - +#include "sound/samples.h" /* sprites are scaled in the analog domain; to give a better */ /* rendition of this, we scale in the X direction by this factor */ #define TURBO_X_SCALE 2 @@ -28,7 +28,8 @@ public: m_gfx1(*this, "gfx1"), m_videoram(*this, "videoram"), m_spriteram(*this, "spriteram"), - m_sprite_position(*this, "spritepos") + m_sprite_position(*this, "spritepos"), + m_samples(*this, "samples") { } /* device/memory pointers */ @@ -43,6 +44,8 @@ public: required_shared_ptr m_videoram; required_shared_ptr m_spriteram; required_shared_ptr m_sprite_position; + + required_device m_samples; UINT8 * m_buckrog_bitmap_ram; diff --git a/src/mame/includes/zaxxon.h b/src/mame/includes/zaxxon.h index 770a8777550..33bca4b9bb1 100644 --- a/src/mame/includes/zaxxon.h +++ b/src/mame/includes/zaxxon.h @@ -3,6 +3,7 @@ Sega Zaxxon hardware ***************************************************************************/ +#include "sound/samples.h" class zaxxon_state : public driver_device { @@ -12,7 +13,8 @@ public: m_videoram(*this, "videoram"), m_spriteram(*this, "spriteram"), m_colorram(*this, "colorram"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_samples(*this, "samples") { } required_shared_ptr m_videoram; optional_shared_ptr m_spriteram; @@ -86,6 +88,7 @@ public: void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 flipxmask, UINT16 flipymask); void zaxxonj_decode(const char *cputag); required_device m_maincpu; + optional_device m_samples; }; diff --git a/src/mame/machine/gaplus.c b/src/mame/machine/gaplus.c index 4350a1b9736..1599bedc7e6 100644 --- a/src/mame/machine/gaplus.c +++ b/src/mame/machine/gaplus.c @@ -20,9 +20,8 @@ WRITE8_MEMBER(gaplus_state::gaplus_customio_3_w) { - samples_device *samples = machine().device("samples"); if ((offset == 0x09) && (data >= 0x0f)) - samples->start(0,0); + m_samples->start(0,0); m_customio_3[offset] = data; } diff --git a/src/mame/machine/xevious.c b/src/mame/machine/xevious.c index 313139eab7d..5e9d7d3e288 100644 --- a/src/mame/machine/xevious.c +++ b/src/mame/machine/xevious.c @@ -148,12 +148,11 @@ WRITE8_MEMBER( xevious_state::battles_noise_sound_w ) { logerror("CPU3 %04x: 50%02x Write = %02x\n",space.device().safe_pc(),offset,data); if( (m_battles_sound_played == 0) && (data == 0xFF) ){ - samples_device *samples = machine().device("samples"); if( m_customio[0] == 0x40 ){ - samples->start(0, 0); + m_samples->start(0, 0); } else{ - samples->start(0, 1); + m_samples->start(0, 1); } } m_battles_sound_played = data; diff --git a/src/mame/video/starcrus.c b/src/mame/video/starcrus.c index e5dbcd30105..05bd11f4dd2 100644 --- a/src/mame/video/starcrus.c +++ b/src/mame/video/starcrus.c @@ -28,8 +28,6 @@ void starcrus_state::video_start() WRITE8_MEMBER(starcrus_state::starcrus_ship_parm_1_w) { - samples_device *samples = machine().device("samples"); - m_s1_sprite = data&0x1f; m_engine1_on = ((data&0x20)>>5)^0x01; @@ -38,7 +36,7 @@ WRITE8_MEMBER(starcrus_state::starcrus_ship_parm_1_w) if (m_engine_sound_playing == 0) { m_engine_sound_playing = 1; - samples->start(0, 0, true); /* engine sample */ + m_samples->start(0, 0, true); /* engine sample */ } } else @@ -46,15 +44,13 @@ WRITE8_MEMBER(starcrus_state::starcrus_ship_parm_1_w) if (m_engine_sound_playing == 1) { m_engine_sound_playing = 0; - samples->stop(0); + m_samples->stop(0); } } } WRITE8_MEMBER(starcrus_state::starcrus_ship_parm_2_w) { - samples_device *samples = machine().device("samples"); - m_s2_sprite = data&0x1f; set_led_status(machine(), 2,~data & 0x80); /* game over lamp */ coin_counter_w(machine(), 0, ((data&0x40)>>6)^0x01); /* coin counter */ @@ -65,7 +61,7 @@ WRITE8_MEMBER(starcrus_state::starcrus_ship_parm_2_w) if (m_engine_sound_playing == 0) { m_engine_sound_playing = 1; - samples->start(0, 0, true); /* engine sample */ + m_samples->start(0, 0, true); /* engine sample */ } } else @@ -73,7 +69,7 @@ WRITE8_MEMBER(starcrus_state::starcrus_ship_parm_2_w) if (m_engine_sound_playing == 1) { m_engine_sound_playing = 0; - samples->stop(0); + m_samples->stop(0); } } @@ -81,8 +77,6 @@ WRITE8_MEMBER(starcrus_state::starcrus_ship_parm_2_w) WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_1_w) { - samples_device *samples = machine().device("samples"); - m_p1_sprite = data&0x0f; m_launch1_on = ((data&0x20)>>5)^0x01; m_explode1_on = ((data&0x10)>>4)^0x01; @@ -92,7 +86,7 @@ WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_1_w) if (m_explode_sound_playing == 0) { m_explode_sound_playing = 1; - samples->start(1,1, true); /* explosion initial sample */ + m_samples->start(1,1, true); /* explosion initial sample */ } } else @@ -100,7 +94,7 @@ WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_1_w) if (m_explode_sound_playing == 1) { m_explode_sound_playing = 0; - samples->start(1,2); /* explosion ending sample */ + m_samples->start(1,2); /* explosion ending sample */ } } @@ -109,7 +103,7 @@ WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_1_w) if (m_launch1_sound_playing == 0) { m_launch1_sound_playing = 1; - samples->start(2,3); /* launch sample */ + m_samples->start(2,3); /* launch sample */ } } else @@ -120,8 +114,6 @@ WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_1_w) WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_2_w) { - samples_device *samples = machine().device("samples"); - m_p2_sprite = data&0x0f; m_launch2_on = ((data&0x20)>>5)^0x01; m_explode2_on = ((data&0x10)>>4)^0x01; @@ -131,7 +123,7 @@ WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_2_w) if (m_explode_sound_playing == 0) { m_explode_sound_playing = 1; - samples->start(1,1, true); /* explosion initial sample */ + m_samples->start(1,1, true); /* explosion initial sample */ } } else @@ -139,7 +131,7 @@ WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_2_w) if (m_explode_sound_playing == 1) { m_explode_sound_playing = 0; - samples->start(1,2); /* explosion ending sample */ + m_samples->start(1,2); /* explosion ending sample */ } } @@ -148,7 +140,7 @@ WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_2_w) if (m_launch2_sound_playing == 0) { m_launch2_sound_playing = 1; - samples->start(3,3); /* launch sample */ + m_samples->start(3,3); /* launch sample */ } } else