"samples" lookup tag removal (nw)

This commit is contained in:
Miodrag Milanovic 2013-04-14 15:44:00 +00:00
parent becc984029
commit a0314377c7
42 changed files with 354 additions and 368 deletions

View File

@ -44,9 +44,8 @@ WRITE8_MEMBER(blockade_state::blockade_sound_freq_w)
WRITE8_MEMBER(blockade_state::blockade_env_on_w) WRITE8_MEMBER(blockade_state::blockade_env_on_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
if (BLOCKADE_LOG) mame_printf_debug("Boom Start\n"); if (BLOCKADE_LOG) mame_printf_debug("Boom Start\n");
samples->start(0,0); m_samples->start(0,0);
return; return;
} }

View File

@ -115,7 +115,6 @@ READ8_HANDLER( gorf_speech_r )
UINT8 data = offset >> 8; UINT8 data = offset >> 8;
#if USE_FAKE_VOTRAX #if USE_FAKE_VOTRAX
astrocde_state *state = space.machine().driver_data<astrocde_state>(); astrocde_state *state = space.machine().driver_data<astrocde_state>();
samples_device *samples = space.machine().device<samples_device>("samples");
int Phoneme, Intonation; int Phoneme, Intonation;
int i = 0; int i = 0;
offset &= 0xff; offset &= 0xff;
@ -128,7 +127,7 @@ READ8_HANDLER( gorf_speech_r )
logerror("Date : %d Speech : %s at intonation %d\n",Phoneme, PhonemeTable[Phoneme],Intonation); logerror("Date : %d Speech : %s at intonation %d\n",Phoneme, PhonemeTable[Phoneme],Intonation);
if(Phoneme==63) { 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); if (strlen(state->m_totalword)>2) logerror("Clearing sample %s\n",state->m_totalword);
state->m_totalword[0] = 0; /* Clear the total word stack */ state->m_totalword[0] = 0; /* Clear the total word stack */
return data; return data;
@ -141,8 +140,8 @@ READ8_HANDLER( gorf_speech_r )
if (state->m_plural != 0) { if (state->m_plural != 0) {
logerror("found a possible plural at %d\n",state->m_plural-1); logerror("found a possible plural at %d\n",state->m_plural-1);
if (!strcmp("S",state->m_totalword)) { /* Plural check */ if (!strcmp("S",state->m_totalword)) { /* Plural check */
samples->start(0, num_samples-2); /* play the sample at position of word */ state->m_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->set_frequency(0, 11025); /* play at correct rate */
state->m_totalword[0] = 0; /* Clear the total word stack */ state->m_totalword[0] = 0; /* Clear the total word stack */
state->m_oldword[0] = 0; /* Clear the total word stack */ state->m_oldword[0] = 0; /* Clear the total word stack */
return data; return data;
@ -164,8 +163,8 @@ READ8_HANDLER( gorf_speech_r )
} else { } else {
state->m_plural=0; state->m_plural=0;
} }
samples->start(0, i); /* play the sample at position of word */ state->m_samples->start(0, i); /* play the sample at position of word */
samples->set_frequency(0, 11025); /* play at correct rate */ state->m_samples->set_frequency(0, 11025); /* play at correct rate */
logerror("Playing sample %d",i); logerror("Playing sample %d",i);
state->m_totalword[0] = 0; /* Clear the total word stack */ state->m_totalword[0] = 0; /* Clear the total word stack */
return data; return data;

View File

@ -50,7 +50,6 @@ SAMPLES_START( meadows_sh_start )
void meadows_sh_update(running_machine &machine) void meadows_sh_update(running_machine &machine)
{ {
meadows_state *state = machine.driver_data<meadows_state>(); meadows_state *state = machine.driver_data<meadows_state>();
samples_device *samples = machine.device<samples_device>("samples");
int preset, amp; int preset, amp;
if (state->m_latched_0c01 != state->m_0c01 || state->m_latched_0c03 != state->m_0c03) 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); state->m_freq1 = BASE_CTR1 / (preset + 1);
else amp = 0; else amp = 0;
logerror("meadows ctr1 channel #%d preset:%3d freq:%5d amp:%d\n", state->m_channel, preset, state->m_freq1, amp); 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); state->m_samples->set_frequency(0, state->m_freq1 * sizeof(waveform)/2);
samples->set_volume(0,amp/255.0); state->m_samples->set_volume(0,amp/255.0);
} }
if (state->m_latched_0c02 != state->m_0c02 || state->m_latched_0c03 != state->m_0c03) 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; else amp = 0;
logerror("meadows ctr2 channel #%d preset:%3d freq:%5d amp:%d\n", state->m_channel+1, preset, state->m_freq2, amp); 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)); state->m_samples->set_frequency(1, state->m_freq2 * sizeof(waveform));
samples->set_volume(1,amp/255.0); state->m_samples->set_volume(1,amp/255.0);
} }
if (state->m_latched_0c03 != state->m_0c03) if (state->m_latched_0c03 != state->m_0c03)

View File

@ -49,29 +49,27 @@ void polyplay_set_channel2(running_machine &machine, int active)
void polyplay_play_channel1(running_machine &machine, int data) void polyplay_play_channel1(running_machine &machine, int data)
{ {
polyplay_state *state = machine.driver_data<polyplay_state>(); polyplay_state *state = machine.driver_data<polyplay_state>();
samples_device *samples = machine.device<samples_device>("samples");
if (data) { if (data) {
state->m_freq1 = 2457600 / 16 / data / 8; state->m_freq1 = 2457600 / 16 / data / 8;
samples->set_volume(0, state->m_channel_playing1 * 1.0); state->m_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->start_raw(0, state->m_backgroundwave, ARRAY_LENGTH(state->m_backgroundwave), sizeof(state->m_backgroundwave)*state->m_freq1,true);
} }
else { else {
samples->stop(0); state->m_samples->stop(0);
samples->stop(1); state->m_samples->stop(1);
} }
} }
void polyplay_play_channel2(running_machine &machine, int data) void polyplay_play_channel2(running_machine &machine, int data)
{ {
polyplay_state *state = machine.driver_data<polyplay_state>(); polyplay_state *state = machine.driver_data<polyplay_state>();
samples_device *samples = machine.device<samples_device>("samples");
if (data) { if (data) {
state->m_freq2 = 2457600 / 16 / data / 8; state->m_freq2 = 2457600 / 16 / data / 8;
samples->set_volume(1, state->m_channel_playing2 * 1.0); state->m_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->start_raw(1, state->m_backgroundwave, ARRAY_LENGTH(state->m_backgroundwave), sizeof(state->m_backgroundwave)*state->m_freq2,true);
} }
else { else {
samples->stop(0); state->m_samples->stop(0);
samples->stop(1); state->m_samples->stop(1);
} }
} }

View File

@ -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 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_device>("samples");
float freq_factor; float freq_factor;
UINT8 diff = data ^ m_sound_state[offset]; UINT8 diff = data ^ m_sound_state[offset];
@ -286,54 +285,54 @@ WRITE8_MEMBER(segag80r_state::astrob_sound_w)
{ {
case 0: case 0:
/* INVADER-1: channel 0 */ /* INVADER-1: channel 0 */
if ((diff & 0x01) && !(data & 0x01)) samples->start(0, (data & 0x80) ? 0 : 1, true); if ((diff & 0x01) && !(data & 0x01)) m_samples->start(0, (data & 0x80) ? 0 : 1, true);
if ((data & 0x01) && samples->playing(0)) samples->stop(0); if ((data & 0x01) && m_samples->playing(0)) m_samples->stop(0);
/* INVADER-2: channel 1 */ /* INVADER-2: channel 1 */
if ((diff & 0x02) && !(data & 0x02)) samples->start(1, (data & 0x80) ? 2 : 3, true); if ((diff & 0x02) && !(data & 0x02)) m_samples->start(1, (data & 0x80) ? 2 : 3, true);
if ((data & 0x02) && samples->playing(1)) samples->stop(1); if ((data & 0x02) && m_samples->playing(1)) m_samples->stop(1);
/* INVADER-3: channel 2 */ /* INVADER-3: channel 2 */
if ((diff & 0x04) && !(data & 0x04)) samples->start(2, (data & 0x80) ? 4 : 5, true); if ((diff & 0x04) && !(data & 0x04)) m_samples->start(2, (data & 0x80) ? 4 : 5, true);
if ((data & 0x04) && samples->playing(2)) samples->stop(2); if ((data & 0x04) && m_samples->playing(2)) m_samples->stop(2);
/* INVADER-4: channel 3 */ /* INVADER-4: channel 3 */
if ((diff & 0x08) && !(data & 0x08)) samples->start(3, (data & 0x80) ? 6 : 7, true); if ((diff & 0x08) && !(data & 0x08)) m_samples->start(3, (data & 0x80) ? 6 : 7, true);
if ((data & 0x08) && samples->playing(3)) samples->stop(3); if ((data & 0x08) && m_samples->playing(3)) m_samples->stop(3);
/* ASTROIDS: channel 4 */ /* ASTROIDS: channel 4 */
if ((diff & 0x10) && !(data & 0x10)) samples->start(4, 8, true); if ((diff & 0x10) && !(data & 0x10)) m_samples->start(4, 8, true);
if ((data & 0x10) && samples->playing(4)) samples->stop(4); if ((data & 0x10) && m_samples->playing(4)) m_samples->stop(4);
/* MUTE */ /* MUTE */
machine().sound().system_mute(data & 0x20); machine().sound().system_mute(data & 0x20);
/* REFILL: channel 5 */ /* REFILL: channel 5 */
if (!(data & 0x40) && !samples->playing(5)) samples->start(5, 9); if (!(data & 0x40) && !m_samples->playing(5)) m_samples->start(5, 9);
if ( (data & 0x40) && samples->playing(5)) samples->stop(5); if ( (data & 0x40) && m_samples->playing(5)) m_samples->stop(5);
/* WARP: changes which sample is played for the INVADER samples above */ /* WARP: changes which sample is played for the INVADER samples above */
if (diff & 0x80) if (diff & 0x80)
{ {
if (samples->playing(0)) samples->start(0, (data & 0x80) ? 0 : 1, true); if (m_samples->playing(0)) m_samples->start(0, (data & 0x80) ? 0 : 1, true);
if (samples->playing(1)) samples->start(1, (data & 0x80) ? 2 : 3, true); if (m_samples->playing(1)) m_samples->start(1, (data & 0x80) ? 2 : 3, true);
if (samples->playing(2)) samples->start(2, (data & 0x80) ? 4 : 5, true); if (m_samples->playing(2)) m_samples->start(2, (data & 0x80) ? 4 : 5, true);
if (samples->playing(3)) samples->start(3, (data & 0x80) ? 6 : 7, true); if (m_samples->playing(3)) m_samples->start(3, (data & 0x80) ? 6 : 7, true);
} }
break; break;
case 1: case 1:
/* LASER #1: channel 6 */ /* 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 */ /* 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 */ /* 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 */ /* 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 */ /* ATTACK RATE */
if ((diff & 0x10) && !(data & 0x10)) m_sound_rate = (m_sound_rate + 1) % 10; 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; if (!(data & 0x20)) m_sound_rate = 0;
/* BONUS: channel 9 */ /* 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 */ /* SONAR: channel 10 */
if ((diff & 0x80) && !(data & 0x80)) samples->start(10, 15); if ((diff & 0x80) && !(data & 0x80)) m_samples->start(10, 15);
break; break;
} }
@ -359,10 +358,10 @@ WRITE8_MEMBER(segag80r_state::astrob_sound_w)
/* adjust the sample rate of invader sounds based the sound_rate */ /* adjust the sample rate of invader sounds based the sound_rate */
/* this is an approximation */ /* this is an approximation */
if (samples->playing(0)) samples->set_frequency(0, samples->base_frequency(0) * freq_factor); if (m_samples->playing(0)) m_samples->set_frequency(0, m_samples->base_frequency(0) * freq_factor);
if (samples->playing(1)) samples->set_frequency(1, samples->base_frequency(1) * freq_factor); if (m_samples->playing(1)) m_samples->set_frequency(1, m_samples->base_frequency(1) * freq_factor);
if (samples->playing(2)) samples->set_frequency(2, samples->base_frequency(2) * freq_factor); if (m_samples->playing(2)) m_samples->set_frequency(2, m_samples->base_frequency(2) * freq_factor);
if (samples->playing(3)) samples->set_frequency(3, samples->base_frequency(3) * 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) WRITE8_MEMBER(segag80r_state::sega005_sound_a_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 diff = data ^ m_sound_state[0]; UINT8 diff = data ^ m_sound_state[0];
m_sound_state[0] = data; m_sound_state[0] = data;
/* LARGE EXPL: channel 0 */ /* 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 */ /* 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 */ /* 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 */ /* 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 */ /* 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 */ /* HELICOPTER: channel 5 */
if ((diff & 0x20) && !(data & 0x20) && !samples->playing(5)) samples->start(5, 5, true); if ((diff & 0x20) && !(data & 0x20) && !m_samples->playing(5)) m_samples->start(5, 5, true);
if ((diff & 0x20) && (data & 0x20)) samples->stop(5); if ((diff & 0x20) && (data & 0x20)) m_samples->stop(5);
/* WHISTLE: channel 6 */ /* WHISTLE: channel 6 */
if ((diff & 0x40) && !(data & 0x40) && !samples->playing(6)) samples->start(6, 6, true); if ((diff & 0x40) && !(data & 0x40) && !m_samples->playing(6)) m_samples->start(6, 6, true);
if ((diff & 0x40) && (data & 0x40)) samples->stop(6); if ((diff & 0x40) && (data & 0x40)) m_samples->stop(6);
} }
@ -724,7 +722,6 @@ static SOUND_START( spaceod )
WRITE8_MEMBER(segag80r_state::spaceod_sound_w) WRITE8_MEMBER(segag80r_state::spaceod_sound_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 diff = data ^ m_sound_state[offset]; UINT8 diff = data ^ m_sound_state[offset];
m_sound_state[offset] = data; m_sound_state[offset] = data;
@ -732,40 +729,40 @@ WRITE8_MEMBER(segag80r_state::spaceod_sound_w)
{ {
case 0: case 0:
/* BACK G: channel 0 */ /* BACK G: channel 0 */
if ((diff & 0x01) && !(data & 0x01) && !samples->playing(0)) samples->start(0, 7, true); if ((diff & 0x01) && !(data & 0x01) && !m_samples->playing(0)) m_samples->start(0, 7, true);
if ((diff & 0x01) && (data & 0x01)) samples->stop(0); if ((diff & 0x01) && (data & 0x01)) m_samples->stop(0);
/* SHORT EXP: channel 1 */ /* 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 */ /* 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 */ /* 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 */ /* 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 */ /* LONG EXP: channel 5 */
if ((diff & 0x80) && !(data & 0x80)) samples->start(5, 3); if ((diff & 0x80) && !(data & 0x80)) m_samples->start(5, 3);
break; break;
case 1: case 1:
/* SHOT: channel 6 */ /* 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 */ /* 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 */ /* 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 */ /* 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 */ /* BLACK HOLE: channel 10 */
if ((diff & 0x80) && !(data & 0x80)) samples->start(10, 9); if ((diff & 0x80) && !(data & 0x80)) m_samples->start(10, 9);
break; break;
} }
} }
@ -921,15 +918,14 @@ WRITE8_MEMBER(segag80r_state::monsterb_sound_a_w)
WRITE8_MEMBER(segag80r_state::monsterb_sound_b_w) WRITE8_MEMBER(segag80r_state::monsterb_sound_b_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 diff = data ^ m_sound_state[1]; UINT8 diff = data ^ m_sound_state[1];
m_sound_state[1] = data; m_sound_state[1] = data;
/* SHOT: channel 0 */ /* 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 */ /* 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?) */ /* TODO: D7 on Port B might affect TMS3617 output (mute?) */
} }

View File

@ -137,196 +137,189 @@ d0 crafts joining
WRITE8_MEMBER(segag80v_state::elim1_sh_w) WRITE8_MEMBER(segag80v_state::elim1_sh_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
data ^= 0xff; data ^= 0xff;
/* Play fireball sample */ /* Play fireball sample */
if (data & 0x02) if (data & 0x02)
samples->start(0, 0); m_samples->start(0, 0);
/* Play explosion samples */ /* Play explosion samples */
if (data & 0x04) if (data & 0x04)
samples->start(1, 10); m_samples->start(1, 10);
if (data & 0x08) if (data & 0x08)
samples->start(1, 9); m_samples->start(1, 9);
if (data & 0x10) if (data & 0x10)
samples->start(1, 8); m_samples->start(1, 8);
/* Play bounce sample */ /* Play bounce sample */
if (data & 0x20) if (data & 0x20)
{ {
if (samples->playing(2)) if (m_samples->playing(2))
samples->stop(2); m_samples->stop(2);
samples->start(2, 1); m_samples->start(2, 1);
} }
/* Play lazer sample */ /* Play lazer sample */
if (data & 0xc0) if (data & 0xc0)
{ {
if (samples->playing(3)) if (m_samples->playing(3))
samples->stop(3); m_samples->stop(3);
samples->start(3, 5); m_samples->start(3, 5);
} }
} }
WRITE8_MEMBER(segag80v_state::elim2_sh_w) WRITE8_MEMBER(segag80v_state::elim2_sh_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
data ^= 0xff; data ^= 0xff;
/* Play thrust sample */ /* Play thrust sample */
if (data & 0x0f) if (data & 0x0f)
samples->start(4, 6); m_samples->start(4, 6);
else else
samples->stop(4); m_samples->stop(4);
/* Play skitter sample */ /* Play skitter sample */
if (data & 0x10) if (data & 0x10)
samples->start(5, 2); m_samples->start(5, 2);
/* Play eliminator sample */ /* Play eliminator sample */
if (data & 0x20) if (data & 0x20)
samples->start(6, 3); m_samples->start(6, 3);
/* Play electron samples */ /* Play electron samples */
if (data & 0x40) if (data & 0x40)
samples->start(7, 7); m_samples->start(7, 7);
if (data & 0x80) if (data & 0x80)
samples->start(7, 4); m_samples->start(7, 4);
} }
WRITE8_MEMBER(segag80v_state::zektor1_sh_w) WRITE8_MEMBER(segag80v_state::zektor1_sh_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
data ^= 0xff; data ^= 0xff;
/* Play fireball sample */ /* Play fireball sample */
if (data & 0x02) if (data & 0x02)
samples->start(0, 0); m_samples->start(0, 0);
/* Play explosion samples */ /* Play explosion samples */
if (data & 0x04) if (data & 0x04)
samples->start(1, 10); m_samples->start(1, 10);
if (data & 0x08) if (data & 0x08)
samples->start(1, 9); m_samples->start(1, 9);
if (data & 0x10) if (data & 0x10)
samples->start(1, 8); m_samples->start(1, 8);
/* Play bounce sample */ /* Play bounce sample */
if (data & 0x20) if (data & 0x20)
{ {
if (samples->playing(2)) if (m_samples->playing(2))
samples->stop(2); m_samples->stop(2);
samples->start(2, 1); m_samples->start(2, 1);
} }
/* Play lazer sample */ /* Play lazer sample */
if (data & 0xc0) if (data & 0xc0)
{ {
if (samples->playing(3)) if (m_samples->playing(3))
samples->stop(3); m_samples->stop(3);
samples->start(3, 5); m_samples->start(3, 5);
} }
} }
WRITE8_MEMBER(segag80v_state::zektor2_sh_w) WRITE8_MEMBER(segag80v_state::zektor2_sh_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
data ^= 0xff; data ^= 0xff;
/* Play thrust sample */ /* Play thrust sample */
if (data & 0x0f) if (data & 0x0f)
samples->start(4, 6); m_samples->start(4, 6);
else else
samples->stop(4); m_samples->stop(4);
/* Play skitter sample */ /* Play skitter sample */
if (data & 0x10) if (data & 0x10)
samples->start(5, 2); m_samples->start(5, 2);
/* Play eliminator sample */ /* Play eliminator sample */
if (data & 0x20) if (data & 0x20)
samples->start(6, 3); m_samples->start(6, 3);
/* Play electron samples */ /* Play electron samples */
if (data & 0x40) if (data & 0x40)
samples->start(7, 40); m_samples->start(7, 40);
if (data & 0x80) if (data & 0x80)
samples->start(7, 41); m_samples->start(7, 41);
} }
WRITE8_MEMBER(segag80v_state::spacfury1_sh_w) WRITE8_MEMBER(segag80v_state::spacfury1_sh_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
data ^= 0xff; data ^= 0xff;
/* craft growing */ /* craft growing */
if (data & 0x01) if (data & 0x01)
samples->start(1, 0); m_samples->start(1, 0);
/* craft moving */ /* craft moving */
if (data & 0x02) if (data & 0x02)
{ {
if (!samples->playing(2)) if (!m_samples->playing(2))
samples->start(2, 1, true); m_samples->start(2, 1, true);
} }
else else
samples->stop(2); m_samples->stop(2);
/* Thrust */ /* Thrust */
if (data & 0x04) if (data & 0x04)
{ {
if (!samples->playing(3)) if (!m_samples->playing(3))
samples->start(3, 4, true); m_samples->start(3, 4, true);
} }
else else
samples->stop(3); m_samples->stop(3);
/* star spin */ /* star spin */
if (data & 0x40) if (data & 0x40)
samples->start(4, 8); m_samples->start(4, 8);
/* partial warship? */ /* partial warship? */
if (data & 0x80) if (data & 0x80)
samples->start(4, 9); m_samples->start(4, 9);
} }
WRITE8_MEMBER(segag80v_state::spacfury2_sh_w) WRITE8_MEMBER(segag80v_state::spacfury2_sh_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
data ^= 0xff; data ^= 0xff;
/* craft joining */ /* craft joining */
if (data & 0x01) if (data & 0x01)
samples->start(5, 2); m_samples->start(5, 2);
/* ship firing */ /* ship firing */
if (data & 0x02) if (data & 0x02)
{ {
if (samples->playing(6)) if (m_samples->playing(6))
samples->stop(6); m_samples->stop(6);
samples->start(6, 3); m_samples->start(6, 3);
} }
/* fireball */ /* fireball */
if (data & 0x04) if (data & 0x04)
samples->start(7, 6); m_samples->start(7, 6);
/* small explosion */ /* small explosion */
if (data & 0x08) if (data & 0x08)
samples->start(7, 6); m_samples->start(7, 6);
/* large explosion */ /* large explosion */
if (data & 0x10) if (data & 0x10)
samples->start(7, 5); m_samples->start(7, 5);
/* docking bang */ /* docking bang */
if (data & 0x20) if (data & 0x20)
samples->start(0, 7); m_samples->start(0, 7);
} }

View File

@ -31,15 +31,13 @@ READ8_MEMBER(spacefb_state::spacefb_audio_t1_r)
WRITE8_MEMBER(spacefb_state::spacefb_port_1_w) WRITE8_MEMBER(spacefb_state::spacefb_port_1_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
m_audiocpu->set_input_line(0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE); m_audiocpu->set_input_line(0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE);
/* enemy killed */ /* 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 */ /* 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 * Explosion Noise
@ -53,10 +51,10 @@ WRITE8_MEMBER(spacefb_state::spacefb_port_1_w)
{ {
if (data & 0x80) if (data & 0x80)
/* play decaying noise */ /* play decaying noise */
samples->start(2,3); m_samples->start(2,3);
else else
/* start looping noise */ /* start looping noise */
samples->start(2,2, true); m_samples->start(2,2, true);
} }
m_sound_latch = data; m_sound_latch = data;

View File

@ -36,11 +36,9 @@ WRITE8_MEMBER(suna8_state::suna8_samples_number_w)
void suna8_state::play_sample(int index) void suna8_state::play_sample(int index)
{ {
samples_device *samples = downcast<samples_device *>(machine().device("samples"));
if (index < m_numsamples) 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); logerror("%s: starting sample %02X\n", machine().describe_context(), index);
} }
else else

View File

@ -72,7 +72,6 @@ if (!((data >> 4) & 1)) mame_printf_debug("/TRIG4\n");
WRITE8_MEMBER(turbo_state::turbo_sound_a_w) WRITE8_MEMBER(turbo_state::turbo_sound_a_w)
{ {
#if (!DISCRETE_TEST) #if (!DISCRETE_TEST)
samples_device *samples = machine().device<samples_device>("samples");
#endif #endif
#if (!DISCRETE_TEST) #if (!DISCRETE_TEST)
UINT8 diff = data ^ m_sound_state[0]; UINT8 diff = data ^ m_sound_state[0];
@ -82,31 +81,31 @@ WRITE8_MEMBER(turbo_state::turbo_sound_a_w)
#if (!DISCRETE_TEST) #if (!DISCRETE_TEST)
/* /CRASH.S: channel 0 */ /* /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 */ /* /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 */ /* /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 */ /* /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 */ /* /TRIG4: channel 1 */
if ((diff & 0x10) && !(data & 0x10)) samples->start(1, 3); if ((diff & 0x10) && !(data & 0x10)) m_samples->start(1, 3);
/* OSEL0 */ /* OSEL0 */
m_turbo_osel = (m_turbo_osel & 6) | ((data >> 5) & 1); m_turbo_osel = (m_turbo_osel & 6) | ((data >> 5) & 1);
/* /SLIP: channel 2 */ /* /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 */ /* /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 */ /* update any samples */
turbo_update_samples(this, samples); turbo_update_samples(this, m_samples);
#else #else
@ -123,7 +122,6 @@ WRITE8_MEMBER(turbo_state::turbo_sound_a_w)
WRITE8_MEMBER(turbo_state::turbo_sound_b_w) WRITE8_MEMBER(turbo_state::turbo_sound_b_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 diff = data ^ m_sound_state[1]; UINT8 diff = data ^ m_sound_state[1];
m_sound_state[1] = data; m_sound_state[1] = data;
@ -132,21 +130,19 @@ WRITE8_MEMBER(turbo_state::turbo_sound_b_w)
output_set_value("tachometer", m_turbo_accel); output_set_value("tachometer", m_turbo_accel);
/* /AMBU: channel 4 */ /* /AMBU: channel 4 */
if ((diff & 0x40) && !(data & 0x40) && !samples->playing(4)) samples->start(4, 8, true); if ((diff & 0x40) && !(data & 0x40) && !m_samples->playing(4)) m_samples->start(4, 8, true);
if ((diff & 0x40) && (data & 0x40)) samples->stop(4); if ((diff & 0x40) && (data & 0x40)) m_samples->stop(4);
/* /SPIN: channel 2 */ /* /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 */ /* update any samples */
turbo_update_samples(this, samples); turbo_update_samples(this, m_samples);
} }
WRITE8_MEMBER(turbo_state::turbo_sound_c_w) WRITE8_MEMBER(turbo_state::turbo_sound_c_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
/* OSEL1-2 */ /* OSEL1-2 */
m_turbo_osel = (m_turbo_osel & 1) | ((data & 3) << 1); 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); output_set_value("speed", (data >> 4) & 0x0f);
/* update any samples */ /* 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) WRITE8_MEMBER(turbo_state::subroc3d_sound_b_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 diff = data ^ m_sound_state[1]; UINT8 diff = data ^ m_sound_state[1];
m_sound_state[1] = data; 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_mdis = m_sound_state[0] & 0x0f;
m_subroc3d_mdir = (m_sound_state[0] >> 4) & 0x07; m_subroc3d_mdir = (m_sound_state[0] >> 4) & 0x07;
if (!samples->playing(0)) if (!m_samples->playing(0))
{ {
samples->start(0, 0, true); m_samples->start(0, 0, true);
samples->start(1, 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 */ /* 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_tdis = m_sound_state[0] & 0x0f;
m_subroc3d_tdir = (m_sound_state[0] >> 4) & 0x07; m_subroc3d_tdir = (m_sound_state[0] >> 4) & 0x07;
if (!samples->playing(2)) if (!m_samples->playing(2))
{ {
samples->start(2, 1, true); m_samples->start(2, 1, true);
samples->start(3, 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 */ /* 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_fdis = m_sound_state[0] & 0x0f;
m_subroc3d_fdir = (m_sound_state[0] >> 4) & 0x07; m_subroc3d_fdir = (m_sound_state[0] >> 4) & 0x07;
if (!samples->playing(4)) if (!m_samples->playing(4))
{ {
samples->start(4, 2, true); m_samples->start(4, 2, true);
samples->start(5, 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 */ /* 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_hdis = m_sound_state[0] & 0x0f;
m_subroc3d_hdir = (m_sound_state[0] >> 4) & 0x07; 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) WRITE8_MEMBER(turbo_state::subroc3d_sound_c_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 diff = data ^ m_sound_state[2]; UINT8 diff = data ^ m_sound_state[2];
m_sound_state[2] = data; m_sound_state[2] = data;
/* /FIRE TRIG */ /* /FIRE TRIG */
/* FIRE SELECT */ /* FIRE SELECT */
if ((diff & 0x01) && (data & 0x01)) 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 */ /* /SHIP EXP TRIG -> MY SHIP EXP: channel 9 */
if ((diff & 0x04) && (data & 0x04)) if ((diff & 0x04) && (data & 0x04))
samples->start(9, 7); m_samples->start(9, 7);
/* /HIT TRIG -> HIT.L/R: channels 6+7 */ /* /HIT TRIG -> HIT.L/R: channels 6+7 */
if ((diff & 0x08) && (data & 0x08)) if ((diff & 0x08) && (data & 0x08))
{ {
samples->start(6, (m_sound_state[0] & 0x80) ? 4 : 3); m_samples->start(6, (m_sound_state[0] & 0x80) ? 4 : 3);
samples->start(7, (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 TRIG -> ALARM.M: channel 10 */
/* ALARM SELECT */ /* ALARM SELECT */
if ((diff & 0x10) && (data & 0x10)) if ((diff & 0x10) && (data & 0x10))
samples->start(10, (data & 0x20) ? 10 : 9); m_samples->start(10, (data & 0x20) ? 10 : 9);
/* /PROLOGUE */ /* /PROLOGUE */
if (!samples->playing(11)) if (!m_samples->playing(11))
samples->start(11, 8, true); m_samples->start(11, 8, true);
samples->set_volume(11, (data & 0x40) ? 0 : 1.0); m_samples->set_volume(11, (data & 0x40) ? 0 : 1.0);
/* /GAME START */ /* /GAME START */
machine().sound().system_mute(data & 0x80); 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) WRITE8_MEMBER(turbo_state::buckrog_sound_a_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 diff = data ^ m_sound_state[0]; UINT8 diff = data ^ m_sound_state[0];
m_sound_state[0] = data; m_sound_state[0] = data;
/* clock HIT DIS from bits 0-2 */ /* clock HIT DIS from bits 0-2 */
if ((diff & 0x10) && (data & 0x10)) 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 */ /* clock ACC from bits 0-3 */
if ((diff & 0x20) && (data & 0x20)) if ((diff & 0x20) && (data & 0x20))
{ {
m_buckrog_myship = data & 0x0f; m_buckrog_myship = data & 0x0f;
buckrog_update_samples(this, samples); buckrog_update_samples(this, m_samples);
} }
/* /ALARM0: channel 0 */ /* /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 */ /* /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) WRITE8_MEMBER(turbo_state::buckrog_sound_b_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 diff = data ^ m_sound_state[1]; UINT8 diff = data ^ m_sound_state[1];
m_sound_state[1] = data; m_sound_state[1] = data;
/* /ALARM3: channel 0 */ /* /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 */ /* /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 */ /* /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 */ /* /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 */ /* /HIT: channel 3 */
if ((diff & 0x10) && !(data & 0x10)) if ((diff & 0x10) && !(data & 0x10))
{ {
samples->start(3, 7); m_samples->start(3, 7);
buckrog_update_samples(this, samples); buckrog_update_samples(this, m_samples);
} }
/* /REBOUND: channel 4 */ /* /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 */ /* 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); m_samples->start(5, 8, true);
buckrog_update_samples(this, samples); 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 */ /* GAME ON */
machine().sound().system_enable(data & 0x80); machine().sound().system_enable(data & 0x80);

View File

@ -112,70 +112,67 @@ MACHINE_CONFIG_END
WRITE8_MEMBER(zaxxon_state::zaxxon_sound_a_w) WRITE8_MEMBER(zaxxon_state::zaxxon_sound_a_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 diff = data ^ m_sound_state[0]; UINT8 diff = data ^ m_sound_state[0];
m_sound_state[0] = data; m_sound_state[0] = data;
/* PLAYER SHIP A/B: volume */ /* PLAYER SHIP A/B: volume */
samples->set_volume(10, 0.5 + 0.157 * (data & 0x03)); m_samples->set_volume(10, 0.5 + 0.157 * (data & 0x03));
samples->set_volume(11, 0.5 + 0.157 * (data & 0x03)); m_samples->set_volume(11, 0.5 + 0.157 * (data & 0x03));
/* PLAYER SHIP C: channel 10 */ /* PLAYER SHIP C: channel 10 */
if ((diff & 0x04) && !(data & 0x04)) samples->start(10, 10, true); if ((diff & 0x04) && !(data & 0x04)) m_samples->start(10, 10, true);
if ((diff & 0x04) && (data & 0x04)) samples->stop(10); if ((diff & 0x04) && (data & 0x04)) m_samples->stop(10);
/* PLAYER SHIP D: channel 11 */ /* PLAYER SHIP D: channel 11 */
if ((diff & 0x08) && !(data & 0x08)) samples->start(11, 11, true); if ((diff & 0x08) && !(data & 0x08)) m_samples->start(11, 11, true);
if ((diff & 0x08) && (data & 0x08)) samples->stop(11); if ((diff & 0x08) && (data & 0x08)) m_samples->stop(11);
/* HOMING MISSILE: channel 0 */ /* HOMING MISSILE: channel 0 */
if ((diff & 0x10) && !(data & 0x10)) samples->start(0, 0, true); if ((diff & 0x10) && !(data & 0x10)) m_samples->start(0, 0, true);
if ((diff & 0x10) && (data & 0x10)) samples->stop(0); if ((diff & 0x10) && (data & 0x10)) m_samples->stop(0);
/* BASE MISSILE: channel 1 */ /* 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 */ /* LASER: channel 2 */
if ((diff & 0x40) && !(data & 0x40)) samples->start(2, 2, true); if ((diff & 0x40) && !(data & 0x40)) m_samples->start(2, 2, true);
if ((diff & 0x40) && (data & 0x40)) samples->stop(2); if ((diff & 0x40) && (data & 0x40)) m_samples->stop(2);
/* BATTLESHIP: channel 3 */ /* BATTLESHIP: channel 3 */
if ((diff & 0x80) && !(data & 0x80)) samples->start(3, 3, true); if ((diff & 0x80) && !(data & 0x80)) m_samples->start(3, 3, true);
if ((diff & 0x80) && (data & 0x80)) samples->stop(3); if ((diff & 0x80) && (data & 0x80)) m_samples->stop(3);
} }
WRITE8_MEMBER(zaxxon_state::zaxxon_sound_b_w) WRITE8_MEMBER(zaxxon_state::zaxxon_sound_b_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 diff = data ^ m_sound_state[1]; UINT8 diff = data ^ m_sound_state[1];
m_sound_state[1] = data; m_sound_state[1] = data;
/* S-EXP: channel 4 */ /* 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 */ /* 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 */ /* 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) WRITE8_MEMBER(zaxxon_state::zaxxon_sound_c_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 diff = data ^ m_sound_state[2]; UINT8 diff = data ^ m_sound_state[2];
m_sound_state[2] = data; m_sound_state[2] = data;
/* SHOT: channel 7 */ /* 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 */ /* 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 */ /* 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) WRITE8_MEMBER(zaxxon_state::congo_sound_b_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 diff = data ^ m_sound_state[1]; UINT8 diff = data ^ m_sound_state[1];
m_sound_state[1] = data; m_sound_state[1] = data;
/* bit 7 = mute */ /* bit 7 = mute */
/* GORILLA: channel 0 */ /* 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) WRITE8_MEMBER(zaxxon_state::congo_sound_c_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 diff = data ^ m_sound_state[2]; UINT8 diff = data ^ m_sound_state[2];
m_sound_state[2] = data; m_sound_state[2] = data;
/* BASS DRUM: channel 1 */ /* BASS DRUM: channel 1 */
if ((diff & 0x01) && !(data & 0x01)) samples->start(1, 1); if ((diff & 0x01) && !(data & 0x01)) m_samples->start(1, 1);
if ((diff & 0x01) && (data & 0x01)) samples->stop(1); if ((diff & 0x01) && (data & 0x01)) m_samples->stop(1);
/* CONGA (LOW): channel 2 */ /* CONGA (LOW): channel 2 */
if ((diff & 0x02) && !(data & 0x02)) samples->start(2, 2); if ((diff & 0x02) && !(data & 0x02)) m_samples->start(2, 2);
if ((diff & 0x02) && (data & 0x02)) samples->stop(2); if ((diff & 0x02) && (data & 0x02)) m_samples->stop(2);
/* CONGA (HIGH): channel 3 */ /* CONGA (HIGH): channel 3 */
if ((diff & 0x04) && !(data & 0x04)) samples->start(3, 3); if ((diff & 0x04) && !(data & 0x04)) m_samples->start(3, 3);
if ((diff & 0x04) && (data & 0x04)) samples->stop(3); if ((diff & 0x04) && (data & 0x04)) m_samples->stop(3);
/* RIM: channel 4 */ /* RIM: channel 4 */
if ((diff & 0x08) && !(data & 0x08)) samples->start(4, 4); if ((diff & 0x08) && !(data & 0x08)) m_samples->start(4, 4);
if ((diff & 0x08) && (data & 0x08)) samples->stop(4); if ((diff & 0x08) && (data & 0x08)) m_samples->stop(4);
} }

View File

@ -204,45 +204,43 @@ WRITE8_MEMBER(astrocde_state::seawolf2_lamps_w)
WRITE8_MEMBER(astrocde_state::seawolf2_sound_1_w)// Port 40 WRITE8_MEMBER(astrocde_state::seawolf2_sound_1_w)// Port 40
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 rising_bits = data & ~m_port_1_last; UINT8 rising_bits = data & ~m_port_1_last;
m_port_1_last = data; m_port_1_last = data;
if (rising_bits & 0x01) samples->start(1, 1); /* Left Torpedo */ if (rising_bits & 0x01) m_samples->start(1, 1); /* Left Torpedo */
if (rising_bits & 0x02) samples->start(0, 0); /* Left Ship Hit */ if (rising_bits & 0x02) m_samples->start(0, 0); /* Left Ship Hit */
if (rising_bits & 0x04) samples->start(4, 4); /* Left Mine Hit */ if (rising_bits & 0x04) m_samples->start(4, 4); /* Left Mine Hit */
if (rising_bits & 0x08) samples->start(6, 1); /* Right Torpedo */ if (rising_bits & 0x08) m_samples->start(6, 1); /* Right Torpedo */
if (rising_bits & 0x10) samples->start(5, 0); /* Right Ship Hit */ if (rising_bits & 0x10) m_samples->start(5, 0); /* Right Ship Hit */
if (rising_bits & 0x20) samples->start(9, 4); /* Right Mine Hit */ if (rising_bits & 0x20) m_samples->start(9, 4); /* Right Mine Hit */
} }
WRITE8_MEMBER(astrocde_state::seawolf2_sound_2_w)// Port 41 WRITE8_MEMBER(astrocde_state::seawolf2_sound_2_w)// Port 41
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 rising_bits = data & ~m_port_2_last; UINT8 rising_bits = data & ~m_port_2_last;
m_port_2_last = data; m_port_2_last = data;
samples->set_volume(0, (data & 0x80) ? 1.0 : 0.0); m_samples->set_volume(0, (data & 0x80) ? 1.0 : 0.0);
samples->set_volume(1, (data & 0x80) ? 1.0 : 0.0); m_samples->set_volume(1, (data & 0x80) ? 1.0 : 0.0);
samples->set_volume(3, (data & 0x80) ? 1.0 : 0.0); m_samples->set_volume(3, (data & 0x80) ? 1.0 : 0.0);
samples->set_volume(4, (data & 0x80) ? 1.0 : 0.0); m_samples->set_volume(4, (data & 0x80) ? 1.0 : 0.0);
samples->set_volume(5, (data & 0x80) ? 1.0 : 0.0); m_samples->set_volume(5, (data & 0x80) ? 1.0 : 0.0);
samples->set_volume(6, (data & 0x80) ? 1.0 : 0.0); m_samples->set_volume(6, (data & 0x80) ? 1.0 : 0.0);
samples->set_volume(8, (data & 0x80) ? 1.0 : 0.0); m_samples->set_volume(8, (data & 0x80) ? 1.0 : 0.0);
samples->set_volume(9, (data & 0x80) ? 1.0 : 0.0); m_samples->set_volume(9, (data & 0x80) ? 1.0 : 0.0);
/* dive panning controlled by low 3 bits */ /* dive panning controlled by low 3 bits */
samples->set_volume(2, (float)(~data & 0x07) / 7.0); m_samples->set_volume(2, (float)(~data & 0x07) / 7.0);
samples->set_volume(7, (float)(data & 0x07) / 7.0); m_samples->set_volume(7, (float)(data & 0x07) / 7.0);
if (rising_bits & 0x08) if (rising_bits & 0x08)
{ {
samples->start(2, 2); m_samples->start(2, 2);
samples->start(7, 2); m_samples->start(7, 2);
} }
if (rising_bits & 0x10) samples->start(8, 3); /* Right Sonar */ if (rising_bits & 0x10) m_samples->start(8, 3); /* Right Sonar */
if (rising_bits & 0x20) samples->start(3, 3); /* Left Sonar */ if (rising_bits & 0x20) m_samples->start(3, 3); /* Left Sonar */
coin_counter_w(machine(), 0, data & 0x40); /* Coin Counter */ coin_counter_w(machine(), 0, data & 0x40); /* Coin Counter */
} }
@ -336,7 +334,7 @@ READ8_MEMBER(astrocde_state::gorf_io_1_r)
case 6: case 6:
machine().device<astrocade_device>("astrocade1")->set_output_gain(0, data ? 0.0 : 1.0); machine().device<astrocade_device>("astrocade1")->set_output_gain(0, data ? 0.0 : 1.0);
#if USE_FAKE_VOTRAX #if USE_FAKE_VOTRAX
machine().device<samples_device>("samples")->set_output_gain(0, data ? 1.0 : 0.0); m_samples->set_output_gain(0, data ? 1.0 : 0.0);
#else #else
machine().device<votrax_sc01_device>("votrax")->set_output_gain(0, data ? 1.0 : 0.0); machine().device<votrax_sc01_device>("votrax")->set_output_gain(0, data ? 1.0 : 0.0);
#endif #endif

View File

@ -50,7 +50,8 @@ public:
dai3wksi_state(const machine_config &mconfig, device_type type, const char *tag) dai3wksi_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_dai3wksi_videoram(*this, "videoram"), m_dai3wksi_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu") { } m_maincpu(*this, "maincpu"),
m_samples(*this, "samples") { }
/* video */ /* video */
required_shared_ptr<UINT8> m_dai3wksi_videoram; required_shared_ptr<UINT8> m_dai3wksi_videoram;
@ -70,6 +71,7 @@ public:
virtual void machine_reset(); virtual void machine_reset();
UINT32 screen_update_dai3wksi(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_dai3wksi(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<samples_device> m_samples;
}; };
@ -203,7 +205,6 @@ UINT32 dai3wksi_state::screen_update_dai3wksi(screen_device &screen, bitmap_rgb3
#if (USE_SAMPLES) #if (USE_SAMPLES)
WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_1_w) WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_1_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 rising_bits = data & ~m_port_last1; UINT8 rising_bits = data & ~m_port_last1;
m_enabled_sound = data & 0x80; 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 ((rising_bits & 0x20) && m_enabled_sound)
{ {
if (data & 0x04) if (data & 0x04)
samples->start(CHANNEL_SOUND5, SAMPLE_SOUND5); m_samples->start(CHANNEL_SOUND5, SAMPLE_SOUND5);
else else
samples->start(CHANNEL_SOUND5, SAMPLE_SOUND5, true); m_samples->start(CHANNEL_SOUND5, SAMPLE_SOUND5, true);
} }
if (!(data & 0x20) && (m_port_last1 & 0x20)) if (!(data & 0x20) && (m_port_last1 & 0x20))
samples->stop(CHANNEL_SOUND5); m_samples->stop(CHANNEL_SOUND5);
m_port_last1 = data; m_port_last1 = data;
} }
WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_2_w) WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_2_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 rising_bits = data & ~m_port_last2; UINT8 rising_bits = data & ~m_port_last2;
m_dai3wksi_flipscreen = data & 0x10; m_dai3wksi_flipscreen = data & 0x10;
@ -232,15 +232,15 @@ WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_2_w)
if (m_enabled_sound) if (m_enabled_sound)
{ {
if (rising_bits & 0x01) samples->start(CHANNEL_SOUND1, SAMPLE_SOUND1); if (rising_bits & 0x01) m_samples->start(CHANNEL_SOUND1, SAMPLE_SOUND1);
if (rising_bits & 0x02) samples->start(CHANNEL_SOUND2, SAMPLE_SOUND2); if (rising_bits & 0x02) m_samples->start(CHANNEL_SOUND2, SAMPLE_SOUND2);
if (rising_bits & 0x08) samples->start(CHANNEL_SOUND4, SAMPLE_SOUND4); if (rising_bits & 0x08) m_samples->start(CHANNEL_SOUND4, SAMPLE_SOUND4);
if (rising_bits & 0x04) if (rising_bits & 0x04)
{ {
if (!m_sound3_counter) if (!m_sound3_counter)
samples->start(CHANNEL_SOUND3, SAMPLE_SOUND3_1); m_samples->start(CHANNEL_SOUND3, SAMPLE_SOUND3_1);
else else
samples->start(CHANNEL_SOUND3, SAMPLE_SOUND3_2); m_samples->start(CHANNEL_SOUND3, SAMPLE_SOUND3_2);
m_sound3_counter ^= 1; m_sound3_counter ^= 1;
} }
@ -251,14 +251,12 @@ WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_2_w)
WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_3_w) WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_3_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
if (m_enabled_sound) if (m_enabled_sound)
{ {
if (data & 0x40) if (data & 0x40)
samples->start(CHANNEL_SOUND6, SAMPLE_SOUND6_1); m_samples->start(CHANNEL_SOUND6, SAMPLE_SOUND6_1);
else if (data & 0x80) else if (data & 0x80)
samples->start(CHANNEL_SOUND6, SAMPLE_SOUND6_2); m_samples->start(CHANNEL_SOUND6, SAMPLE_SOUND6_2);
} }
} }

View File

@ -471,18 +471,15 @@ WRITE8_MEMBER(equites_state::equites_c0f8_w)
WRITE8_MEMBER(equites_state::equites_8910porta_w) WRITE8_MEMBER(equites_state::equites_8910porta_w)
{ {
device_t *device = machine().device("samples");
samples_device *samples = downcast<samples_device *>(device);
// bongo 1 // 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) if (data & ~m_ay_port_a & 0x80)
samples->start(0, 0); m_samples->start(0, 0);
// bongo 2 // 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) if (data & ~m_ay_port_a & 0x08)
samples->start(1, 1); m_samples->start(1, 1);
m_ay_port_a = data; 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) WRITE8_MEMBER(equites_state::equites_8910portb_w)
{ {
device_t *device = machine().device("samples");
samples_device *samples = downcast<samples_device *>(device);
#if POPDRUMKIT #if POPDRUMKIT
if (data & ~m_ay_port_b & 0x08) m_cymbal++; if (data & ~m_ay_port_b & 0x08) m_cymbal++;
if (data & ~m_ay_port_b & 0x04) m_hihat++; if (data & ~m_ay_port_b & 0x04) m_hihat++;
#endif #endif
// bongo 3 // 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) 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 // FIXME I'm just enabling the MSM5232 Noise Output for now. Proper emulation
// of the analog circuitry should be done instead. // of the analog circuitry should be done instead.

View File

@ -535,14 +535,12 @@ WRITE8_MEMBER(mcr_state::kroozr_op4_w)
WRITE8_MEMBER(mcr_state::journey_op4_w) WRITE8_MEMBER(mcr_state::journey_op4_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
/* if we're not playing the sample yet, start it */ /* if we're not playing the sample yet, start it */
if (!samples->playing(0)) if (!m_samples->playing(0))
samples->start(0, 0, true); m_samples->start(0, 0, true);
/* bit 0 turns cassette on/off */ /* 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) WRITE8_MEMBER(mcr_state::twotiger_op4_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
/* play tape, and loop it */ /* play tape, and loop it */
if (!samples->playing(i)) if (!m_samples->playing(i))
samples->start(i, i, true); m_samples->start(i, i, true);
/* bit 1 turns cassette on/off */ /* bit 1 turns cassette on/off */
samples->pause(i, ~data & 2); m_samples->pause(i, ~data & 2);
} }
// bit 2: lamp control? // bit 2: lamp control?

View File

@ -123,7 +123,6 @@ static SAMPLES_START( pbillian_sh_start )
WRITE8_MEMBER(superqix_state::pbillian_sample_trigger_w) WRITE8_MEMBER(superqix_state::pbillian_sample_trigger_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 *src = memregion("samples")->base(); UINT8 *src = memregion("samples")->base();
int len = memregion("samples")->bytes(); int len = memregion("samples")->bytes();
int start,end; int start,end;
@ -134,7 +133,7 @@ WRITE8_MEMBER(superqix_state::pbillian_sample_trigger_w)
while (end < len && src[end] != 0xff) while (end < len && src[end] != 0xff)
end++; end++;
samples->start_raw(0, m_samplebuf + start, end - start, 5000); // 5khz ? m_samples->start_raw(0, m_samplebuf + start, end - start, 5000); // 5khz ?
} }

View File

@ -97,7 +97,7 @@ WRITE8_MEMBER(tankbatt_state::tankbatt_interrupt_enable_w)
m_sound_enable = !data; m_sound_enable = !data;
/* hack - turn off the engine noise if the normal game nmi's are disabled */ /* hack - turn off the engine noise if the normal game nmi's are disabled */
if (data) machine().device<samples_device>("samples")->stop(2); if (data) m_samples->stop(2);
} }
WRITE8_MEMBER(tankbatt_state::tankbatt_demo_interrupt_enable_w) 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) if (m_sound_enable)
{ {
samples_device *samples = machine().device<samples_device>("samples"); m_samples->start(1, 3);
samples->start(1, 3);
} }
} }
WRITE8_MEMBER(tankbatt_state::tankbatt_sh_engine_w) WRITE8_MEMBER(tankbatt_state::tankbatt_sh_engine_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
if (m_sound_enable) if (m_sound_enable)
{ {
if (data) if (data)
samples->start(2, 2, true); m_samples->start(2, 2, true);
else 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) WRITE8_MEMBER(tankbatt_state::tankbatt_sh_fire_w)
{ {
if (m_sound_enable) if (m_sound_enable)
{ {
samples_device *samples = machine().device<samples_device>("samples"); m_samples->start(0, 0);
samples->start(0, 0);
} }
} }

View File

@ -100,7 +100,6 @@ WRITE8_MEMBER(thief_state::thief_input_select_w)
WRITE8_MEMBER(thief_state::tape_control_w) WRITE8_MEMBER(thief_state::tape_control_w)
{ {
device_t *device = machine().device("samples");
switch( data ) switch( data )
{ {
case 0x02: /* coin meter on */ case 0x02: /* coin meter on */
@ -113,27 +112,27 @@ WRITE8_MEMBER(thief_state::tape_control_w)
break; break;
case 0x08: /* talk track on */ case 0x08: /* talk track on */
tape_set_audio( downcast<samples_device *>(device), kTalkTrack, 1 ); tape_set_audio( m_samples, kTalkTrack, 1 );
break; break;
case 0x09: /* talk track off */ case 0x09: /* talk track off */
tape_set_audio( downcast<samples_device *>(device), kTalkTrack, 0 ); tape_set_audio( m_samples, kTalkTrack, 0 );
break; break;
case 0x0a: /* motor on */ case 0x0a: /* motor on */
tape_set_motor( downcast<samples_device *>(device), 1 ); tape_set_motor( m_samples, 1 );
break; break;
case 0x0b: /* motor off */ case 0x0b: /* motor off */
tape_set_motor( downcast<samples_device *>(device), 0 ); tape_set_motor( m_samples, 0 );
break; break;
case 0x0c: /* crash track on */ case 0x0c: /* crash track on */
tape_set_audio( downcast<samples_device *>(device), kCrashTrack, 1 ); tape_set_audio( m_samples, kCrashTrack, 1 );
break; break;
case 0x0d: /* crash track off */ case 0x0d: /* crash track off */
tape_set_audio( downcast<samples_device *>(device), kCrashTrack, 0 ); tape_set_audio( m_samples, kCrashTrack, 0 );
break; break;
} }
} }

View File

@ -706,7 +706,6 @@ READ8_MEMBER(tnzs_state::kageki_csport_r)
WRITE8_MEMBER(tnzs_state::kageki_csport_w) WRITE8_MEMBER(tnzs_state::kageki_csport_w)
{ {
device_t *device = machine().device("samples");
char mess[80]; char mess[80];
if (data > 0x3f) if (data > 0x3f)
@ -716,17 +715,16 @@ WRITE8_MEMBER(tnzs_state::kageki_csport_w)
} }
else else
{ {
samples_device *samples = downcast<samples_device *>(device);
if (data > MAX_SAMPLES) if (data > MAX_SAMPLES)
{ {
// stop samples // stop samples
samples->stop(0); m_samples->stop(0);
sprintf(mess, "VOICE:%02X STOP", data); sprintf(mess, "VOICE:%02X STOP", data);
} }
else else
{ {
// play samples // 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); sprintf(mess, "VOICE:%02X PLAY", data);
} }
// popmessage(mess); // popmessage(mess);

View File

@ -33,7 +33,6 @@ void triplhnt_state::triplhnt_set_collision(int code)
void triplhnt_state::triplhnt_update_misc(address_space &space, int offset) void triplhnt_state::triplhnt_update_misc(address_space &space, int offset)
{ {
samples_device *samples = machine().device<samples_device>("samples");
UINT8 is_witch_hunt; UINT8 is_witch_hunt;
UINT8 bit = offset >> 1; UINT8 bit = offset >> 1;
@ -76,14 +75,14 @@ void triplhnt_state::triplhnt_update_misc(address_space &space, int offset)
bit = ~m_misc_flags & 0x40; bit = ~m_misc_flags & 0x40;
/* if we're not playing the sample yet, start it */ /* if we're not playing the sample yet, start it */
if (!samples->playing(0)) if (!m_samples->playing(0))
samples->start(0, 0, true); m_samples->start(0, 0, true);
if (!samples->playing(1)) if (!m_samples->playing(1))
samples->start(1, 1, true); m_samples->start(1, 1, true);
/* bit 6 turns cassette on/off */ /* bit 6 turns cassette on/off */
samples->pause(0, is_witch_hunt || bit); m_samples->pause(0, is_witch_hunt || bit);
samples->pause(1, !is_witch_hunt || bit); m_samples->pause(1, !is_witch_hunt || bit);
} }

View File

@ -3,7 +3,7 @@
Bally Astrocade-based hardware Bally Astrocade-based hardware
***************************************************************************/ ***************************************************************************/
#include "sound/samples.h"
#define ASTROCADE_CLOCK (XTAL_14_31818MHz/2) #define ASTROCADE_CLOCK (XTAL_14_31818MHz/2)
#define AC_SOUND_PRESENT (0x01) #define AC_SOUND_PRESENT (0x01)
@ -22,7 +22,8 @@ public:
m_videoram(*this, "videoram"), m_videoram(*this, "videoram"),
m_protected_ram(*this, "protected_ram"), m_protected_ram(*this, "protected_ram"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_subcpu(*this, "sub") { } m_subcpu(*this, "sub"),
m_samples(*this, "samples") { }
optional_shared_ptr<UINT8> m_videoram; optional_shared_ptr<UINT8> m_videoram;
UINT8 m_video_config; UINT8 m_video_config;
@ -136,6 +137,7 @@ public:
void init_sparklestar(); void init_sparklestar();
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_subcpu; optional_device<cpu_device> m_subcpu;
optional_device<samples_device> m_samples;
}; };
/*----------- defined in audio/wow.c -----------*/ /*----------- defined in audio/wow.c -----------*/

View File

@ -8,7 +8,8 @@ public:
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"), m_videoram(*this, "videoram"),
m_discrete(*this, "discrete"), m_discrete(*this, "discrete"),
m_maincpu(*this, "maincpu") { } m_maincpu(*this, "maincpu"),
m_samples(*this, "samples") { }
required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_videoram;
required_device<discrete_device> m_discrete; required_device<discrete_device> m_discrete;
@ -32,6 +33,7 @@ public:
INTERRUPT_GEN_MEMBER(blockade_interrupt); INTERRUPT_GEN_MEMBER(blockade_interrupt);
DECLARE_WRITE8_MEMBER(blockade_sound_freq_w); DECLARE_WRITE8_MEMBER(blockade_sound_freq_w);
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<samples_device> m_samples;
}; };
/*----------- defined in audio/blockade.c -----------*/ /*----------- defined in audio/blockade.c -----------*/

View File

@ -1,4 +1,4 @@
#include "sound/samples.h"
#include "sound/msm5232.h" #include "sound/msm5232.h"
#include "sound/dac.h" #include "sound/dac.h"
@ -20,7 +20,8 @@ public:
m_dac_1(*this, "dac1"), m_dac_1(*this, "dac1"),
m_dac_2(*this, "dac2"), m_dac_2(*this, "dac2"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu") { } m_audiocpu(*this, "audiocpu"),
m_samples(*this, "samples") { }
/* memory pointers */ /* memory pointers */
required_shared_ptr<UINT16> m_bg_videoram; required_shared_ptr<UINT16> m_bg_videoram;
@ -125,4 +126,5 @@ public:
void unpack_region( const char *region ); void unpack_region( const char *region );
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu; required_device<cpu_device> m_audiocpu;
required_device<samples_device> m_samples;
}; };

View File

@ -1,4 +1,5 @@
#include "sound/discrete.h" #include "sound/discrete.h"
#include "sound/samples.h"
class galaga_state : public driver_device class galaga_state : public driver_device
{ {
@ -89,7 +90,8 @@ public:
m_xevious_fg_colorram(*this, "fg_colorram"), m_xevious_fg_colorram(*this, "fg_colorram"),
m_xevious_bg_colorram(*this, "bg_colorram"), m_xevious_bg_colorram(*this, "bg_colorram"),
m_xevious_fg_videoram(*this, "fg_videoram"), 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<UINT8> m_xevious_sr1; required_shared_ptr<UINT8> m_xevious_sr1;
required_shared_ptr<UINT8> m_xevious_sr2; required_shared_ptr<UINT8> m_xevious_sr2;
@ -98,6 +100,7 @@ public:
required_shared_ptr<UINT8> m_xevious_bg_colorram; required_shared_ptr<UINT8> m_xevious_bg_colorram;
required_shared_ptr<UINT8> m_xevious_fg_videoram; required_shared_ptr<UINT8> m_xevious_fg_videoram;
required_shared_ptr<UINT8> m_xevious_bg_videoram; required_shared_ptr<UINT8> m_xevious_bg_videoram;
optional_device<samples_device> m_samples;
INT32 m_xevious_bs[2]; INT32 m_xevious_bs[2];
DECLARE_DRIVER_INIT(xevious); DECLARE_DRIVER_INIT(xevious);

View File

@ -1,3 +1,4 @@
#include "sound/samples.h"
#define MAX_STARS 250 #define MAX_STARS 250
struct star { struct star {
@ -16,7 +17,8 @@ public:
m_spriteram(*this,"spriteram") , m_spriteram(*this,"spriteram") ,
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_subcpu(*this, "sub"), m_subcpu(*this, "sub"),
m_subcpu2(*this, "sub2") { } m_subcpu2(*this, "sub2"),
m_samples(*this, "samples") { }
required_shared_ptr<UINT8> m_customio_3; required_shared_ptr<UINT8> m_customio_3;
required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_videoram;
@ -60,4 +62,5 @@ public:
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_subcpu; required_device<cpu_device> m_subcpu;
required_device<cpu_device> m_subcpu2; required_device<cpu_device> m_subcpu2;
required_device<samples_device> m_samples;
}; };

View File

@ -10,6 +10,7 @@
#include "machine/z80pio.h" #include "machine/z80pio.h"
#include "machine/z80sio.h" #include "machine/z80sio.h"
#include "audio/midway.h" #include "audio/midway.h"
#include "sound/samples.h"
/* constants */ /* constants */
#define MAIN_OSC_MCR_I XTAL_19_968MHz #define MAIN_OSC_MCR_I XTAL_19_968MHz
@ -29,7 +30,8 @@ public:
m_turbo_chip_squeak(*this, "tcs"), m_turbo_chip_squeak(*this, "tcs"),
m_squawk_n_talk(*this, "snt"), m_squawk_n_talk(*this, "snt"),
m_dpoker_coin_in_timer(*this, "dp_coinin"), 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 // these should be required but can't because mcr68 shares with us
@ -45,6 +47,7 @@ public:
optional_device<midway_squawk_n_talk_device> m_squawk_n_talk; optional_device<midway_squawk_n_talk_device> m_squawk_n_talk;
optional_device<timer_device> m_dpoker_coin_in_timer; optional_device<timer_device> m_dpoker_coin_in_timer;
optional_device<timer_device> m_dpoker_hopper_timer; optional_device<timer_device> m_dpoker_hopper_timer;
optional_device<samples_device> m_samples;
DECLARE_WRITE8_MEMBER(mcr_control_port_w); DECLARE_WRITE8_MEMBER(mcr_control_port_w);
DECLARE_WRITE8_MEMBER(mcr_ipu_laserdisk_w); DECLARE_WRITE8_MEMBER(mcr_ipu_laserdisk_w);

View File

@ -14,7 +14,8 @@ public:
m_spriteram(*this, "spriteram"), m_spriteram(*this, "spriteram"),
m_videoram(*this, "videoram"), m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_dac(*this, "dac") { } m_dac(*this, "dac"),
m_samples(*this, "samples") { }
optional_shared_ptr<UINT8> m_spriteram; optional_shared_ptr<UINT8> m_spriteram;
required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_videoram;
@ -54,6 +55,7 @@ public:
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip);
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
optional_device<dac_device> m_dac; optional_device<dac_device> m_dac;
optional_device<samples_device> m_samples;
}; };

View File

@ -9,7 +9,8 @@ public:
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"), m_videoram(*this, "videoram"),
m_characterram(*this, "characterram"), m_characterram(*this, "characterram"),
m_maincpu(*this, "maincpu") { } m_maincpu(*this, "maincpu"),
m_samples(*this, "samples") { }
required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_videoram;
int m_freq1; int m_freq1;
@ -38,6 +39,7 @@ public:
INTERRUPT_GEN_MEMBER(coin_interrupt); INTERRUPT_GEN_MEMBER(coin_interrupt);
TIMER_DEVICE_CALLBACK_MEMBER(polyplay_timer_callback); TIMER_DEVICE_CALLBACK_MEMBER(polyplay_timer_callback);
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<samples_device> m_samples;
}; };

View File

@ -3,7 +3,7 @@
Sega G-80 raster hardware Sega G-80 raster hardware
*************************************************************************/ *************************************************************************/
#include "sound/samples.h"
#include "machine/segag80.h" #include "machine/segag80.h"
#include "sound/sn76496.h" #include "sound/sn76496.h"
@ -17,7 +17,8 @@ public:
m_sn1(*this, "sn1"), m_sn1(*this, "sn1"),
m_sn2(*this, "sn2"), m_sn2(*this, "sn2"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu") { } m_audiocpu(*this, "audiocpu"),
m_samples(*this, "samples") { }
required_shared_ptr<UINT8> m_mainram; required_shared_ptr<UINT8> m_mainram;
required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_videoram;
@ -124,6 +125,7 @@ public:
void monsterb_expand_gfx(const char *region); void monsterb_expand_gfx(const char *region);
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu; optional_device<cpu_device> m_audiocpu;
optional_device<samples_device> m_samples;
}; };

View File

@ -3,7 +3,7 @@
Sega vector hardware Sega vector hardware
*************************************************************************/ *************************************************************************/
#include "sound/samples.h"
#include "machine/segag80.h" #include "machine/segag80.h"
class segag80v_state : public driver_device class segag80v_state : public driver_device
@ -13,7 +13,8 @@ public:
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_mainram(*this, "mainram"), m_mainram(*this, "mainram"),
m_vectorram(*this, "vectorram"), m_vectorram(*this, "vectorram"),
m_maincpu(*this, "maincpu") { } m_maincpu(*this, "maincpu"),
m_samples(*this, "samples") { }
required_shared_ptr<UINT8> m_mainram; required_shared_ptr<UINT8> m_mainram;
device_t *m_usb; device_t *m_usb;
@ -59,4 +60,5 @@ public:
offs_t decrypt_offset(address_space &space, offs_t offset); offs_t decrypt_offset(address_space &space, offs_t offset);
inline UINT8 demangle(UINT8 d7d6, UINT8 d5d4, UINT8 d3d2, UINT8 d1d0); inline UINT8 demangle(UINT8 d7d6, UINT8 d5d4, UINT8 d3d2, UINT8 d1d0);
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
optional_device<samples_device> m_samples;
}; };

View File

@ -3,7 +3,7 @@
Space Firebird hardware Space Firebird hardware
****************************************************************************/ ****************************************************************************/
#include "sound/samples.h"
/* /*
* SPACEFB_PIXEL_CLOCK clocks the star generator circuit. The rest of * SPACEFB_PIXEL_CLOCK clocks the star generator circuit. The rest of
* the graphics use a clock half of SPACEFB_PIXEL_CLOCK, thus creating * the graphics use a clock half of SPACEFB_PIXEL_CLOCK, thus creating
@ -31,7 +31,8 @@ public:
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"), m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu") { } m_audiocpu(*this, "audiocpu"),
m_samples(*this, "samples") { }
UINT8 m_sound_latch; UINT8 m_sound_latch;
emu_timer *m_interrupt_timer; emu_timer *m_interrupt_timer;
@ -64,6 +65,7 @@ public:
void start_interrupt_timer(); void start_interrupt_timer();
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu; required_device<cpu_device> m_audiocpu;
required_device<samples_device> m_samples;
}; };
/*----------- defined in audio/spacefb.c -----------*/ /*----------- defined in audio/spacefb.c -----------*/

View File

@ -1,9 +1,11 @@
#include "sound/samples.h"
class starcrus_state : public driver_device class starcrus_state : public driver_device
{ {
public: public:
starcrus_state(const machine_config &mconfig, device_type type, const char *tag) starcrus_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, 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_ship1_vid;
bitmap_ind16 *m_ship2_vid; bitmap_ind16 *m_ship2_vid;
@ -57,4 +59,5 @@ public:
int collision_check_s1p1p2(); int collision_check_s1p1p2();
int collision_check_s2p1p2(); int collision_check_s2p1p2();
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<samples_device> m_samples;
}; };

View File

@ -12,7 +12,8 @@ public:
m_spriteram(*this, "spriteram"), m_spriteram(*this, "spriteram"),
m_wram(*this, "wram"), m_wram(*this, "wram"),
m_banked_paletteram(*this, "paletteram"), m_banked_paletteram(*this, "paletteram"),
m_audiocpu(*this, "audiocpu") { } m_audiocpu(*this, "audiocpu"),
m_samples(*this, "samples") { }
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
optional_shared_ptr<UINT8> m_hardhead_ip; optional_shared_ptr<UINT8> m_hardhead_ip;
@ -20,6 +21,7 @@ public:
optional_shared_ptr<UINT8> m_wram; optional_shared_ptr<UINT8> m_wram;
optional_shared_ptr<UINT8> m_banked_paletteram; optional_shared_ptr<UINT8> m_banked_paletteram;
required_device<cpu_device> m_audiocpu; required_device<cpu_device> m_audiocpu;
optional_device<samples_device> m_samples;
UINT8 m_rombank; UINT8 m_rombank;
UINT8 m_rombank_latch; UINT8 m_rombank_latch;

View File

@ -1,3 +1,5 @@
#include "sound/samples.h"
class superqix_state : public driver_device class superqix_state : public driver_device
{ {
public: public:
@ -8,7 +10,8 @@ public:
m_spriteram(*this, "spriteram"), m_spriteram(*this, "spriteram"),
m_videoram(*this, "videoram"), m_videoram(*this, "videoram"),
m_bitmapram(*this, "bitmapram"), m_bitmapram(*this, "bitmapram"),
m_bitmapram2(*this, "bitmapram2"){ } m_bitmapram2(*this, "bitmapram2"),
m_samples(*this, "samples"){ }
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_mcu; optional_device<cpu_device> m_mcu;
@ -16,6 +19,7 @@ public:
required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_videoram;
optional_shared_ptr<UINT8> m_bitmapram; optional_shared_ptr<UINT8> m_bitmapram;
optional_shared_ptr<UINT8> m_bitmapram2; optional_shared_ptr<UINT8> m_bitmapram2;
optional_device<samples_device> m_samples;
INT16 *m_samplebuf; INT16 *m_samplebuf;
UINT8 m_port1; UINT8 m_port1;

View File

@ -1,3 +1,4 @@
#include "sound/samples.h"
class tankbatt_state : public driver_device class tankbatt_state : public driver_device
{ {
public: public:
@ -5,7 +6,8 @@ public:
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_bulletsram(*this, "bulletsram"), m_bulletsram(*this, "bulletsram"),
m_videoram(*this, "videoram"), m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu") { } m_maincpu(*this, "maincpu"),
m_samples(*this, "samples") { }
required_shared_ptr<UINT8> m_bulletsram; required_shared_ptr<UINT8> m_bulletsram;
required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_videoram;
@ -34,4 +36,5 @@ public:
INTERRUPT_GEN_MEMBER(tankbatt_interrupt); INTERRUPT_GEN_MEMBER(tankbatt_interrupt);
void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<samples_device> m_samples;
}; };

View File

@ -12,7 +12,8 @@ class thief_state : public driver_device
public: public:
thief_state(const machine_config &mconfig, device_type type, const char *tag) thief_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag) , : driver_device(mconfig, type, tag) ,
m_maincpu(*this, "maincpu") { } m_maincpu(*this, "maincpu"),
m_samples(*this, "samples") { }
UINT8 *m_videoram; UINT8 *m_videoram;
UINT8 m_input_select; UINT8 m_input_select;
@ -42,4 +43,5 @@ public:
void tape_set_audio( samples_device *samples, int track, int bOn ); void tape_set_audio( samples_device *samples, int track, int bOn );
void tape_set_motor( samples_device *samples, int bOn ); void tape_set_motor( samples_device *samples, int bOn );
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<samples_device> m_samples;
}; };

View File

@ -1,4 +1,5 @@
#include "sound/dac.h" #include "sound/dac.h"
#include "sound/samples.h"
#define MAX_SAMPLES 0x2f /* max samples */ #define MAX_SAMPLES 0x2f /* max samples */
@ -25,7 +26,8 @@ public:
m_subcpu(*this, "sub"), m_subcpu(*this, "sub"),
m_mcu(*this, "mcu"), m_mcu(*this, "mcu"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_dac(*this, "dac") { } m_dac(*this, "dac"),
m_samples(*this, "samples") { }
/* memory pointers */ /* memory pointers */
// UINT8 * m_paletteram; // currently this uses generic palette handling // UINT8 * m_paletteram; // currently this uses generic palette handling
@ -112,4 +114,5 @@ public:
DECLARE_WRITE_LINE_MEMBER(irqhandler); DECLARE_WRITE_LINE_MEMBER(irqhandler);
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
optional_device<dac_device> m_dac; optional_device<dac_device> m_dac;
optional_device<samples_device> m_samples;
}; };

View File

@ -27,7 +27,8 @@ public:
m_orga_ram(*this, "orga_ram"), m_orga_ram(*this, "orga_ram"),
m_code_ram(*this, "code_ram"), m_code_ram(*this, "code_ram"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_discrete(*this, "discrete") { } m_discrete(*this, "discrete"),
m_samples(*this, "samples") { }
UINT8 m_cmos[16]; UINT8 m_cmos[16];
UINT8 m_da_latch; UINT8 m_da_latch;
@ -59,6 +60,7 @@ public:
void triplhnt_update_misc(address_space &space, int offset); void triplhnt_update_misc(address_space &space, int offset);
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<discrete_device> m_discrete; required_device<discrete_device> m_discrete;
required_device<samples_device> m_samples;
}; };

View File

@ -7,7 +7,7 @@
#include "cpu/z80/z80.h" #include "cpu/z80/z80.h"
#include "machine/i8255.h" #include "machine/i8255.h"
#include "sound/discrete.h" #include "sound/discrete.h"
#include "sound/samples.h"
/* sprites are scaled in the analog domain; to give a better */ /* sprites are scaled in the analog domain; to give a better */
/* rendition of this, we scale in the X direction by this factor */ /* rendition of this, we scale in the X direction by this factor */
#define TURBO_X_SCALE 2 #define TURBO_X_SCALE 2
@ -28,7 +28,8 @@ public:
m_gfx1(*this, "gfx1"), m_gfx1(*this, "gfx1"),
m_videoram(*this, "videoram"), m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"), m_spriteram(*this, "spriteram"),
m_sprite_position(*this, "spritepos") m_sprite_position(*this, "spritepos"),
m_samples(*this, "samples")
{ } { }
/* device/memory pointers */ /* device/memory pointers */
@ -44,6 +45,8 @@ public:
required_shared_ptr<UINT8> m_spriteram; required_shared_ptr<UINT8> m_spriteram;
required_shared_ptr<UINT8> m_sprite_position; required_shared_ptr<UINT8> m_sprite_position;
required_device<samples_device> m_samples;
UINT8 * m_buckrog_bitmap_ram; UINT8 * m_buckrog_bitmap_ram;
/* machine states */ /* machine states */

View File

@ -3,6 +3,7 @@
Sega Zaxxon hardware Sega Zaxxon hardware
***************************************************************************/ ***************************************************************************/
#include "sound/samples.h"
class zaxxon_state : public driver_device class zaxxon_state : public driver_device
{ {
@ -12,7 +13,8 @@ public:
m_videoram(*this, "videoram"), m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"), m_spriteram(*this, "spriteram"),
m_colorram(*this, "colorram"), m_colorram(*this, "colorram"),
m_maincpu(*this, "maincpu") { } m_maincpu(*this, "maincpu"),
m_samples(*this, "samples") { }
required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_videoram;
optional_shared_ptr<UINT8> m_spriteram; optional_shared_ptr<UINT8> m_spriteram;
@ -86,6 +88,7 @@ public:
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 flipxmask, UINT16 flipymask); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 flipxmask, UINT16 flipymask);
void zaxxonj_decode(const char *cputag); void zaxxonj_decode(const char *cputag);
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
optional_device<samples_device> m_samples;
}; };

View File

@ -20,9 +20,8 @@
WRITE8_MEMBER(gaplus_state::gaplus_customio_3_w) WRITE8_MEMBER(gaplus_state::gaplus_customio_3_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
if ((offset == 0x09) && (data >= 0x0f)) if ((offset == 0x09) && (data >= 0x0f))
samples->start(0,0); m_samples->start(0,0);
m_customio_3[offset] = data; m_customio_3[offset] = data;
} }

View File

@ -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); logerror("CPU3 %04x: 50%02x Write = %02x\n",space.device().safe_pc(),offset,data);
if( (m_battles_sound_played == 0) && (data == 0xFF) ){ if( (m_battles_sound_played == 0) && (data == 0xFF) ){
samples_device *samples = machine().device<samples_device>("samples");
if( m_customio[0] == 0x40 ){ if( m_customio[0] == 0x40 ){
samples->start(0, 0); m_samples->start(0, 0);
} }
else{ else{
samples->start(0, 1); m_samples->start(0, 1);
} }
} }
m_battles_sound_played = data; m_battles_sound_played = data;

View File

@ -28,8 +28,6 @@ void starcrus_state::video_start()
WRITE8_MEMBER(starcrus_state::starcrus_ship_parm_1_w) WRITE8_MEMBER(starcrus_state::starcrus_ship_parm_1_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
m_s1_sprite = data&0x1f; m_s1_sprite = data&0x1f;
m_engine1_on = ((data&0x20)>>5)^0x01; 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) if (m_engine_sound_playing == 0)
{ {
m_engine_sound_playing = 1; m_engine_sound_playing = 1;
samples->start(0, 0, true); /* engine sample */ m_samples->start(0, 0, true); /* engine sample */
} }
} }
else else
@ -46,15 +44,13 @@ WRITE8_MEMBER(starcrus_state::starcrus_ship_parm_1_w)
if (m_engine_sound_playing == 1) if (m_engine_sound_playing == 1)
{ {
m_engine_sound_playing = 0; m_engine_sound_playing = 0;
samples->stop(0); m_samples->stop(0);
} }
} }
} }
WRITE8_MEMBER(starcrus_state::starcrus_ship_parm_2_w) WRITE8_MEMBER(starcrus_state::starcrus_ship_parm_2_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
m_s2_sprite = data&0x1f; m_s2_sprite = data&0x1f;
set_led_status(machine(), 2,~data & 0x80); /* game over lamp */ set_led_status(machine(), 2,~data & 0x80); /* game over lamp */
coin_counter_w(machine(), 0, ((data&0x40)>>6)^0x01); /* coin counter */ 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) if (m_engine_sound_playing == 0)
{ {
m_engine_sound_playing = 1; m_engine_sound_playing = 1;
samples->start(0, 0, true); /* engine sample */ m_samples->start(0, 0, true); /* engine sample */
} }
} }
else else
@ -73,7 +69,7 @@ WRITE8_MEMBER(starcrus_state::starcrus_ship_parm_2_w)
if (m_engine_sound_playing == 1) if (m_engine_sound_playing == 1)
{ {
m_engine_sound_playing = 0; 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) WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_1_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
m_p1_sprite = data&0x0f; m_p1_sprite = data&0x0f;
m_launch1_on = ((data&0x20)>>5)^0x01; m_launch1_on = ((data&0x20)>>5)^0x01;
m_explode1_on = ((data&0x10)>>4)^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) if (m_explode_sound_playing == 0)
{ {
m_explode_sound_playing = 1; m_explode_sound_playing = 1;
samples->start(1,1, true); /* explosion initial sample */ m_samples->start(1,1, true); /* explosion initial sample */
} }
} }
else else
@ -100,7 +94,7 @@ WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_1_w)
if (m_explode_sound_playing == 1) if (m_explode_sound_playing == 1)
{ {
m_explode_sound_playing = 0; 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) if (m_launch1_sound_playing == 0)
{ {
m_launch1_sound_playing = 1; m_launch1_sound_playing = 1;
samples->start(2,3); /* launch sample */ m_samples->start(2,3); /* launch sample */
} }
} }
else else
@ -120,8 +114,6 @@ WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_1_w)
WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_2_w) WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_2_w)
{ {
samples_device *samples = machine().device<samples_device>("samples");
m_p2_sprite = data&0x0f; m_p2_sprite = data&0x0f;
m_launch2_on = ((data&0x20)>>5)^0x01; m_launch2_on = ((data&0x20)>>5)^0x01;
m_explode2_on = ((data&0x10)>>4)^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) if (m_explode_sound_playing == 0)
{ {
m_explode_sound_playing = 1; m_explode_sound_playing = 1;
samples->start(1,1, true); /* explosion initial sample */ m_samples->start(1,1, true); /* explosion initial sample */
} }
} }
else else
@ -139,7 +131,7 @@ WRITE8_MEMBER(starcrus_state::starcrus_proj_parm_2_w)
if (m_explode_sound_playing == 1) if (m_explode_sound_playing == 1)
{ {
m_explode_sound_playing = 0; 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) if (m_launch2_sound_playing == 0)
{ {
m_launch2_sound_playing = 1; m_launch2_sound_playing = 1;
samples->start(3,3); /* launch sample */ m_samples->start(3,3); /* launch sample */
} }
} }
else else