"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)
{
samples_device *samples = machine().device<samples_device>("samples");
if (BLOCKADE_LOG) mame_printf_debug("Boom Start\n");
samples->start(0,0);
m_samples->start(0,0);
return;
}

View File

@ -115,7 +115,6 @@ READ8_HANDLER( gorf_speech_r )
UINT8 data = offset >> 8;
#if USE_FAKE_VOTRAX
astrocde_state *state = space.machine().driver_data<astrocde_state>();
samples_device *samples = space.machine().device<samples_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;

View File

@ -50,7 +50,6 @@ SAMPLES_START( meadows_sh_start )
void meadows_sh_update(running_machine &machine)
{
meadows_state *state = machine.driver_data<meadows_state>();
samples_device *samples = machine.device<samples_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)

View File

@ -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<polyplay_state>();
samples_device *samples = machine.device<samples_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<polyplay_state>();
samples_device *samples = machine.device<samples_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);
}
}

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
};
samples_device *samples = machine().device<samples_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_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_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_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?) */
}

View File

@ -137,196 +137,189 @@ d0 crafts joining
WRITE8_MEMBER(segag80v_state::elim1_sh_w)
{
samples_device *samples = machine().device<samples_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_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_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_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_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_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);
}

View File

@ -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_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;

View File

@ -36,11 +36,9 @@ WRITE8_MEMBER(suna8_state::suna8_samples_number_w)
void suna8_state::play_sample(int index)
{
samples_device *samples = downcast<samples_device *>(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

View File

@ -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_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_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_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_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_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_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_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);

View File

@ -112,70 +112,67 @@ MACHINE_CONFIG_END
WRITE8_MEMBER(zaxxon_state::zaxxon_sound_a_w)
{
samples_device *samples = machine().device<samples_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_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_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_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_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);
}

View File

@ -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_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_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<astrocade_device>("astrocade1")->set_output_gain(0, data ? 0.0 : 1.0);
#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
machine().device<votrax_sc01_device>("votrax")->set_output_gain(0, data ? 1.0 : 0.0);
#endif

View File

@ -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<UINT8> 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<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)
WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_1_w)
{
samples_device *samples = machine().device<samples_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_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_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);
}
}

View File

@ -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<samples_device *>(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<samples_device *>(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.

View File

@ -535,14 +535,12 @@ WRITE8_MEMBER(mcr_state::kroozr_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 (!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_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?

View File

@ -123,7 +123,6 @@ static SAMPLES_START( pbillian_sh_start )
WRITE8_MEMBER(superqix_state::pbillian_sample_trigger_w)
{
samples_device *samples = machine().device<samples_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 ?
}

View File

@ -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_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_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_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_device>("samples");
samples->start(0, 0);
m_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)
{
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<samples_device *>(device), kTalkTrack, 1 );
tape_set_audio( m_samples, kTalkTrack, 1 );
break;
case 0x09: /* talk track off */
tape_set_audio( downcast<samples_device *>(device), kTalkTrack, 0 );
tape_set_audio( m_samples, kTalkTrack, 0 );
break;
case 0x0a: /* motor on */
tape_set_motor( downcast<samples_device *>(device), 1 );
tape_set_motor( m_samples, 1 );
break;
case 0x0b: /* motor off */
tape_set_motor( downcast<samples_device *>(device), 0 );
tape_set_motor( m_samples, 0 );
break;
case 0x0c: /* crash track on */
tape_set_audio( downcast<samples_device *>(device), kCrashTrack, 1 );
tape_set_audio( m_samples, kCrashTrack, 1 );
break;
case 0x0d: /* crash track off */
tape_set_audio( downcast<samples_device *>(device), kCrashTrack, 0 );
tape_set_audio( m_samples, kCrashTrack, 0 );
break;
}
}

View File

@ -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<samples_device *>(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);

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)
{
samples_device *samples = machine().device<samples_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);
}

View File

@ -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<UINT8> m_videoram;
UINT8 m_video_config;
@ -136,6 +137,7 @@ public:
void init_sparklestar();
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_subcpu;
optional_device<samples_device> m_samples;
};
/*----------- defined in audio/wow.c -----------*/

View File

@ -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<UINT8> m_videoram;
required_device<discrete_device> m_discrete;
@ -32,6 +33,7 @@ public:
INTERRUPT_GEN_MEMBER(blockade_interrupt);
DECLARE_WRITE8_MEMBER(blockade_sound_freq_w);
required_device<cpu_device> m_maincpu;
required_device<samples_device> m_samples;
};
/*----------- defined in audio/blockade.c -----------*/

View File

@ -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<UINT16> m_bg_videoram;
@ -125,4 +126,5 @@ public:
void unpack_region( const char *region );
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<samples_device> m_samples;
};

View File

@ -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<UINT8> m_xevious_sr1;
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_fg_videoram;
required_shared_ptr<UINT8> m_xevious_bg_videoram;
optional_device<samples_device> m_samples;
INT32 m_xevious_bs[2];
DECLARE_DRIVER_INIT(xevious);

View File

@ -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<UINT8> m_customio_3;
required_shared_ptr<UINT8> m_videoram;
@ -60,4 +62,5 @@ public:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_subcpu;
required_device<cpu_device> m_subcpu2;
required_device<samples_device> m_samples;
};

View File

@ -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<midway_squawk_n_talk_device> m_squawk_n_talk;
optional_device<timer_device> m_dpoker_coin_in_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_ipu_laserdisk_w);

View File

@ -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<UINT8> m_spriteram;
required_shared_ptr<UINT8> m_videoram;
@ -54,6 +55,7 @@ public:
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip);
required_device<cpu_device> m_maincpu;
optional_device<dac_device> m_dac;
optional_device<samples_device> m_samples;
};

View File

@ -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<UINT8> m_videoram;
int m_freq1;
@ -38,6 +39,7 @@ public:
INTERRUPT_GEN_MEMBER(coin_interrupt);
TIMER_DEVICE_CALLBACK_MEMBER(polyplay_timer_callback);
required_device<cpu_device> m_maincpu;
required_device<samples_device> m_samples;
};

View File

@ -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<UINT8> m_mainram;
required_shared_ptr<UINT8> m_videoram;
@ -124,6 +125,7 @@ public:
void monsterb_expand_gfx(const char *region);
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
optional_device<samples_device> m_samples;
};

View File

@ -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<UINT8> 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<cpu_device> m_maincpu;
optional_device<samples_device> m_samples;
};

View File

@ -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<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<samples_device> m_samples;
};
/*----------- defined in audio/spacefb.c -----------*/

View File

@ -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<cpu_device> m_maincpu;
required_device<samples_device> m_samples;
};

View File

@ -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<cpu_device> m_maincpu;
optional_shared_ptr<UINT8> m_hardhead_ip;
@ -20,6 +21,7 @@ public:
optional_shared_ptr<UINT8> m_wram;
optional_shared_ptr<UINT8> m_banked_paletteram;
required_device<cpu_device> m_audiocpu;
optional_device<samples_device> m_samples;
UINT8 m_rombank;
UINT8 m_rombank_latch;

View File

@ -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<cpu_device> m_maincpu;
optional_device<cpu_device> m_mcu;
@ -16,6 +19,7 @@ public:
required_shared_ptr<UINT8> m_videoram;
optional_shared_ptr<UINT8> m_bitmapram;
optional_shared_ptr<UINT8> m_bitmapram2;
optional_device<samples_device> m_samples;
INT16 *m_samplebuf;
UINT8 m_port1;

View File

@ -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<UINT8> m_bulletsram;
required_shared_ptr<UINT8> m_videoram;
@ -34,4 +36,5 @@ public:
INTERRUPT_GEN_MEMBER(tankbatt_interrupt);
void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect);
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:
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<cpu_device> m_maincpu;
required_device<samples_device> m_samples;
};

View File

@ -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<cpu_device> m_maincpu;
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_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<cpu_device> m_maincpu;
required_device<discrete_device> m_discrete;
required_device<samples_device> m_samples;
};

View File

@ -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 */
@ -44,6 +45,8 @@ public:
required_shared_ptr<UINT8> m_spriteram;
required_shared_ptr<UINT8> m_sprite_position;
required_device<samples_device> m_samples;
UINT8 * m_buckrog_bitmap_ram;
/* machine states */

View File

@ -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<UINT8> m_videoram;
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 zaxxonj_decode(const char *cputag);
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)
{
samples_device *samples = machine().device<samples_device>("samples");
if ((offset == 0x09) && (data >= 0x0f))
samples->start(0,0);
m_samples->start(0,0);
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);
if( (m_battles_sound_played == 0) && (data == 0xFF) ){
samples_device *samples = machine().device<samples_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;

View File

@ -28,8 +28,6 @@ void starcrus_state::video_start()
WRITE8_MEMBER(starcrus_state::starcrus_ship_parm_1_w)
{
samples_device *samples = machine().device<samples_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_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_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_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