[from AtariAce]

Hi mamedev,

This patch continues deglobalifying the MAME core, this time targeting
sound.c.  The first two patches adds running_machine to apis in
sound.h that lack it (the first patch is generated by the perl script,
the second patch fixes some cases it didn't handle well).  The last
patch then removes the globals in the traditional way.

~aa
This commit is contained in:
Aaron Giles 2009-08-30 05:42:33 +00:00
parent 6953873e13
commit 4a80c53a8d
35 changed files with 133 additions and 113 deletions

View File

@ -669,7 +669,7 @@ void debug_cpu_instruction_hook(const device_config *device, offs_t curpc)
debugger_refresh_display(device->machine); debugger_refresh_display(device->machine);
/* wait for the debugger; during this time, disable sound output */ /* wait for the debugger; during this time, disable sound output */
sound_mute(TRUE); sound_mute(device->machine, TRUE);
while (global->execution_state == EXECUTION_STATE_STOPPED) while (global->execution_state == EXECUTION_STATE_STOPPED)
{ {
/* flush any pending updates before waiting again */ /* flush any pending updates before waiting again */
@ -694,7 +694,7 @@ void debug_cpu_instruction_hook(const device_config *device, offs_t curpc)
if (mame_is_scheduled_event_pending(device->machine)) if (mame_is_scheduled_event_pending(device->machine))
global->execution_state = EXECUTION_STATE_RUNNING; global->execution_state = EXECUTION_STATE_RUNNING;
} }
sound_mute(FALSE); sound_mute(device->machine, FALSE);
/* remember the last visible CPU in the debugger */ /* remember the last visible CPU in the debugger */
global->visiblecpu = device; global->visiblecpu = device;

View File

@ -335,7 +335,7 @@ int mame_execute(core_options *options)
/* load the configuration settings and NVRAM */ /* load the configuration settings and NVRAM */
settingsloaded = config_load_settings(machine); settingsloaded = config_load_settings(machine);
nvram_load(machine); nvram_load(machine);
sound_mute(FALSE); sound_mute(machine, FALSE);
/* display the startup screens */ /* display the startup screens */
ui_display_startup_screens(machine, firstrun, !settingsloaded); ui_display_startup_screens(machine, firstrun, !settingsloaded);
@ -377,7 +377,7 @@ int mame_execute(core_options *options)
end_resource_tracking(); end_resource_tracking();
/* save the NVRAM and configuration */ /* save the NVRAM and configuration */
sound_mute(TRUE); sound_mute(machine, TRUE);
nvram_save(machine); nvram_save(machine);
config_save_settings(machine); config_save_settings(machine);
} }

View File

@ -134,6 +134,7 @@ typedef struct _tilemap_private tilemap_private;
typedef struct _streams_private streams_private; typedef struct _streams_private streams_private;
typedef struct _devices_private devices_private; typedef struct _devices_private devices_private;
typedef struct _romload_private romload_private; typedef struct _romload_private romload_private;
typedef struct _sound_private sound_private;
typedef struct _input_port_private input_port_private; typedef struct _input_port_private input_port_private;
typedef struct _ui_input_private ui_input_private; typedef struct _ui_input_private ui_input_private;
typedef struct _cheat_private cheat_private; typedef struct _cheat_private cheat_private;
@ -184,6 +185,7 @@ struct _running_machine
streams_private * streams_data; /* internal data from streams.c */ streams_private * streams_data; /* internal data from streams.c */
devices_private * devices_data; /* internal data from devices.c */ devices_private * devices_data; /* internal data from devices.c */
romload_private * romload_data; /* internal data from romload.c */ romload_private * romload_data; /* internal data from romload.c */
sound_private * sound_data; /* internal data from sound.c */
input_port_private * input_port_data; /* internal data from inptport.c */ input_port_private * input_port_data; /* internal data from inptport.c */
ui_input_private * ui_input_data; /* internal data from uiinput.c */ ui_input_private * ui_input_data; /* internal data from uiinput.c */
cheat_private * cheat_data; /* internal data from cheat.c */ cheat_private * cheat_data; /* internal data from cheat.c */

View File

@ -80,26 +80,24 @@ struct _speaker_info
#endif #endif
}; };
struct _sound_private
{
emu_timer *update_timer;
int totalsnd;
/*************************************************************************** UINT32 finalmix_leftover;
GLOBAL VARIABLES INT16 *finalmix;
***************************************************************************/ INT32 *leftmix;
INT32 *rightmix;
static emu_timer *sound_update_timer; int muted;
int attenuation;
int enabled;
int nosound_mode;
static int totalsnd; wav_file *wavfile;
};
static INT16 *finalmix;
static UINT32 finalmix_leftover;
static INT32 *leftmix, *rightmix;
static int sound_muted;
static int sound_attenuation;
static int global_sound_enabled;
static int nosound_mode;
static wav_file *wavfile;
@ -191,24 +189,27 @@ INLINE speaker_info *index_to_input(running_machine *machine, int index, int *in
void sound_init(running_machine *machine) void sound_init(running_machine *machine)
{ {
sound_private *global;
const char *filename; const char *filename;
machine->sound_data = global = auto_alloc_clear(machine, sound_private);
/* handle -nosound */ /* handle -nosound */
nosound_mode = !options_get_bool(mame_options(), OPTION_SOUND); global->nosound_mode = !options_get_bool(mame_options(), OPTION_SOUND);
if (nosound_mode) if (global->nosound_mode)
machine->sample_rate = 11025; machine->sample_rate = 11025;
/* count the speakers */ /* count the speakers */
VPRINTF(("total speakers = %d\n", speaker_output_count(machine->config))); VPRINTF(("total speakers = %d\n", speaker_output_count(machine->config)));
/* allocate memory for mix buffers */ /* allocate memory for mix buffers */
leftmix = auto_alloc_array(machine, INT32, machine->sample_rate); global->leftmix = auto_alloc_array(machine, INT32, machine->sample_rate);
rightmix = auto_alloc_array(machine, INT32, machine->sample_rate); global->rightmix = auto_alloc_array(machine, INT32, machine->sample_rate);
finalmix = auto_alloc_array(machine, INT16, machine->sample_rate); global->finalmix = auto_alloc_array(machine, INT16, machine->sample_rate);
/* allocate a global timer for sound timing */ /* allocate a global timer for sound timing */
sound_update_timer = timer_alloc(machine, sound_update, NULL); global->update_timer = timer_alloc(machine, sound_update, NULL);
timer_adjust_periodic(sound_update_timer, STREAMS_UPDATE_FREQUENCY, 0, STREAMS_UPDATE_FREQUENCY); timer_adjust_periodic(global->update_timer, STREAMS_UPDATE_FREQUENCY, 0, STREAMS_UPDATE_FREQUENCY);
/* finally, do all the routing */ /* finally, do all the routing */
VPRINTF(("route_sound\n")); VPRINTF(("route_sound\n"));
@ -217,12 +218,12 @@ void sound_init(running_machine *machine)
/* open the output WAV file if specified */ /* open the output WAV file if specified */
filename = options_get_string(mame_options(), OPTION_WAVWRITE); filename = options_get_string(mame_options(), OPTION_WAVWRITE);
if (filename[0] != 0) if (filename[0] != 0)
wavfile = wav_open(filename, machine->sample_rate, 2); global->wavfile = wav_open(filename, machine->sample_rate, 2);
/* enable sound by default */ /* enable sound by default */
global_sound_enabled = TRUE; global->enabled = TRUE;
sound_muted = FALSE; global->muted = FALSE;
sound_set_attenuation(options_get_int(mame_options(), OPTION_VOLUME)); sound_set_attenuation(machine, options_get_int(mame_options(), OPTION_VOLUME));
/* register callbacks */ /* register callbacks */
config_register(machine, "mixer", sound_load, sound_save); config_register(machine, "mixer", sound_load, sound_save);
@ -238,12 +239,15 @@ void sound_init(running_machine *machine)
static void sound_exit(running_machine *machine) static void sound_exit(running_machine *machine)
{ {
sound_private *global = machine->sound_data;
/* close any open WAV file */ /* close any open WAV file */
if (wavfile != NULL) if (global->wavfile != NULL)
wav_close(wavfile); wav_close(global->wavfile);
global->wavfile = NULL;
/* reset variables */ /* reset variables */
totalsnd = 0; global->totalsnd = 0;
} }
@ -541,25 +545,29 @@ static void sound_reset(running_machine *machine)
static void sound_pause(running_machine *machine, int pause) static void sound_pause(running_machine *machine, int pause)
{ {
sound_private *global = machine->sound_data;
if (pause) if (pause)
sound_muted |= 0x02; global->muted |= 0x02;
else else
sound_muted &= ~0x02; global->muted &= ~0x02;
osd_set_mastervolume(sound_muted ? -32 : sound_attenuation); osd_set_mastervolume(global->muted ? -32 : global->attenuation);
} }
/*------------------------------------------------- /*-------------------------------------------------
sound_pause - pause sound output sound_mute - mute sound output
-------------------------------------------------*/ -------------------------------------------------*/
void sound_mute(int mute) void sound_mute(running_machine *machine, int mute)
{ {
sound_private *global = machine->sound_data;
if (mute) if (mute)
sound_muted |= 0x01; global->muted |= 0x01;
else else
sound_muted &= ~0x01; global->muted &= ~0x01;
osd_set_mastervolume(sound_muted ? -32 : sound_attenuation); osd_set_mastervolume(global->muted ? -32 : global->attenuation);
} }
@ -567,10 +575,11 @@ void sound_mute(int mute)
sound_set_attenuation - set the global volume sound_set_attenuation - set the global volume
-------------------------------------------------*/ -------------------------------------------------*/
void sound_set_attenuation(int attenuation) void sound_set_attenuation(running_machine *machine, int attenuation)
{ {
sound_attenuation = attenuation; sound_private *global = machine->sound_data;
osd_set_mastervolume(sound_muted ? -32 : sound_attenuation); global->attenuation = attenuation;
osd_set_mastervolume(global->muted ? -32 : global->attenuation);
} }
@ -579,9 +588,10 @@ void sound_set_attenuation(int attenuation)
volume volume
-------------------------------------------------*/ -------------------------------------------------*/
int sound_get_attenuation(void) int sound_get_attenuation(running_machine *machine)
{ {
return sound_attenuation; sound_private *global = machine->sound_data;
return global->attenuation;
} }
@ -590,9 +600,10 @@ int sound_get_attenuation(void)
globally globally
-------------------------------------------------*/ -------------------------------------------------*/
void sound_global_enable(int enable) void sound_global_enable(running_machine *machine, int enable)
{ {
global_sound_enabled = enable; sound_private *global = machine->sound_data;
global->enabled = enable;
} }
@ -684,11 +695,18 @@ static TIMER_CALLBACK( sound_update )
const device_config *curspeak; const device_config *curspeak;
int samples_this_update = 0; int samples_this_update = 0;
int sample; int sample;
sound_private *global = machine->sound_data;
INT16 *finalmix;
INT32 *leftmix, *rightmix;
VPRINTF(("sound_update\n")); VPRINTF(("sound_update\n"));
profiler_mark_start(PROFILER_SOUND); profiler_mark_start(PROFILER_SOUND);
leftmix = global->leftmix;
rightmix = global->rightmix;
finalmix = global->finalmix;
/* force all the speaker streams to generate the proper number of samples */ /* force all the speaker streams to generate the proper number of samples */
for (curspeak = speaker_output_first(machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak)) for (curspeak = speaker_output_first(machine->config); curspeak != NULL; curspeak = speaker_output_next(curspeak))
{ {
@ -729,7 +747,7 @@ static TIMER_CALLBACK( sound_update )
#endif #endif
/* mix if sound is enabled */ /* mix if sound is enabled */
if (global_sound_enabled && !nosound_mode) if (global->enabled && !global->nosound_mode)
{ {
/* if the speaker is centered, send to both left and right */ /* if the speaker is centered, send to both left and right */
if (spk->speaker->x == 0) if (spk->speaker->x == 0)
@ -755,7 +773,7 @@ static TIMER_CALLBACK( sound_update )
/* now downmix the final result */ /* now downmix the final result */
finalmix_step = video_get_speed_factor(); finalmix_step = video_get_speed_factor();
finalmix_offset = 0; finalmix_offset = 0;
for (sample = finalmix_leftover; sample < samples_this_update * 100; sample += finalmix_step) for (sample = global->finalmix_leftover; sample < samples_this_update * 100; sample += finalmix_step)
{ {
int sampindex = sample / 100; int sampindex = sample / 100;
INT32 samp; INT32 samp;
@ -776,15 +794,15 @@ static TIMER_CALLBACK( sound_update )
samp = 32767; samp = 32767;
finalmix[finalmix_offset++] = samp; finalmix[finalmix_offset++] = samp;
} }
finalmix_leftover = sample - samples_this_update * 100; global->finalmix_leftover = sample - samples_this_update * 100;
/* play the result */ /* play the result */
if (finalmix_offset > 0) if (finalmix_offset > 0)
{ {
osd_update_audio_stream(machine, finalmix, finalmix_offset / 2); osd_update_audio_stream(machine, finalmix, finalmix_offset / 2);
video_avi_add_sound(machine, finalmix, finalmix_offset / 2); video_avi_add_sound(machine, finalmix, finalmix_offset / 2);
if (wavfile != NULL) if (global->wavfile != NULL)
wav_add_data_16(wavfile, finalmix, finalmix_offset); wav_add_data_16(global->wavfile, finalmix, finalmix_offset);
} }
/* update the streamer */ /* update the streamer */

View File

@ -156,10 +156,10 @@ DEVICE_GET_INFO( sound );
/* global sound controls */ /* global sound controls */
void sound_mute(int mute); void sound_mute(running_machine *machine, int mute);
void sound_set_attenuation(int attenuation); void sound_set_attenuation(running_machine *machine, int attenuation);
int sound_get_attenuation(void); int sound_get_attenuation(running_machine *machine);
void sound_global_enable(int enable); void sound_global_enable(running_machine *machine, int enable);
/* user gain controls on speaker inputs for mixing */ /* user gain controls on speaker inputs for mixing */
int sound_get_user_gain_count(running_machine *machine); int sound_get_user_gain_count(running_machine *machine);

View File

@ -1999,7 +1999,7 @@ static STREAM_UPDATE( SN76477_update )
{ {
recursing = 1; recursing = 1;
sound_global_enable(1); sound_global_enable(device->machine, 1);
SN76477_test_enable_w(sn, !sn->enable); SN76477_test_enable_w(sn, !sn->enable);
} }

View File

@ -1576,10 +1576,10 @@ static slider_state *slider_init(running_machine *machine)
static INT32 slider_volume(running_machine *machine, void *arg, astring *string, INT32 newval) static INT32 slider_volume(running_machine *machine, void *arg, astring *string, INT32 newval)
{ {
if (newval != SLIDER_NOCHANGE) if (newval != SLIDER_NOCHANGE)
sound_set_attenuation(newval); sound_set_attenuation(machine, newval);
if (string != NULL) if (string != NULL)
astring_printf(string, "%3ddB", sound_get_attenuation()); astring_printf(string, "%3ddB", sound_get_attenuation(machine));
return sound_get_attenuation(); return sound_get_attenuation(machine);
} }

View File

@ -52,7 +52,7 @@ WRITE8_HANDLER( invadpt2_sh_port_1_w )
c8080bw_screen_red_w(data & 0x04); c8080bw_screen_red_w(data & 0x04);
sound_global_enable(data & 0x20); sound_global_enable(space->machine, data & 0x20);
port_1_last_extra = data; port_1_last_extra = data;
@ -145,7 +145,7 @@ WRITE8_HANDLER( lrescue_sh_port_1_w )
if (rising_bits & 0x08) sample_start(samples, 1, 0, 0); /* Alien Hit */ if (rising_bits & 0x08) sample_start(samples, 1, 0, 0); /* Alien Hit */
if (rising_bits & 0x10) sample_start(samples, 2, 5, 0); /* Bonus Ship (not confirmed) */ if (rising_bits & 0x10) sample_start(samples, 2, 5, 0); /* Bonus Ship (not confirmed) */
sound_global_enable(data & 0x20); sound_global_enable(space->machine, data & 0x20);
c8080bw_screen_red_w(data & 0x04); c8080bw_screen_red_w(data & 0x04);
@ -204,7 +204,7 @@ WRITE8_HANDLER( ballbomb_sh_port_1_w )
if (rising_bits & 0x08) sample_start(samples, 1, 7, 0); /* Hit a Bomb */ if (rising_bits & 0x08) sample_start(samples, 1, 7, 0); /* Hit a Bomb */
if (rising_bits & 0x10) sample_start(samples, 3, 8, 0); /* Bonus Base at 1500 points */ if (rising_bits & 0x10) sample_start(samples, 3, 8, 0); /* Bonus Base at 1500 points */
sound_global_enable(data & 0x20); sound_global_enable(space->machine, data & 0x20);
c8080bw_screen_red_w(data & 0x04); c8080bw_screen_red_w(data & 0x04);
@ -281,7 +281,7 @@ WRITE8_HANDLER( indianbt_sh_port_1_w )
if (rising_bits & 0x04) sample_start(samples, 2, 3, 0); /* Move */ if (rising_bits & 0x04) sample_start(samples, 2, 3, 0); /* Move */
if (rising_bits & 0x08) sample_start(samples, 3, 2, 0); /* Hit */ if (rising_bits & 0x08) sample_start(samples, 3, 2, 0); /* Hit */
sound_global_enable(data & 0x20); sound_global_enable(space->machine, data & 0x20);
c8080bw_screen_red_w(data & 0x01); c8080bw_screen_red_w(data & 0x01);
@ -881,7 +881,7 @@ WRITE8_HANDLER( schaser_sh_port_2_w )
discrete_sound_w(discrete, SCHASER_MUSIC_BIT, data & 0x01); discrete_sound_w(discrete, SCHASER_MUSIC_BIT, data & 0x01);
discrete_sound_w(discrete, SCHASER_SND_EN, data & 0x02); discrete_sound_w(discrete, SCHASER_SND_EN, data & 0x02);
sound_global_enable(data & 0x02); sound_global_enable(space->machine, data & 0x02);
coin_lockout_global_w(data & 0x04); coin_lockout_global_w(data & 0x04);
@ -1090,7 +1090,7 @@ WRITE8_HANDLER( schasrcv_sh_port_2_w )
speaker_level_w(speaker, (data & 0x01) ? 1 : 0); /* End-of-Level */ speaker_level_w(speaker, (data & 0x01) ? 1 : 0); /* End-of-Level */
sound_global_enable(data & 0x10); sound_global_enable(space->machine, data & 0x10);
c8080bw_flip_screen_w(space, data & 0x20); c8080bw_flip_screen_w(space, data & 0x20);
} }
@ -1112,7 +1112,7 @@ WRITE8_HANDLER( yosakdon_sh_port_1_w )
if (rising_bits & 0x08) sample_start(samples, 1, 2, 0); /* Man dead */ if (rising_bits & 0x08) sample_start(samples, 1, 2, 0); /* Man dead */
if (rising_bits & 0x10) sample_start(samples, 5, 8, 0); /* Bonus Man? */ if (rising_bits & 0x10) sample_start(samples, 5, 8, 0); /* Bonus Man? */
sound_global_enable(data & 0x20); sound_global_enable(space->machine, data & 0x20);
port_1_last_extra = data; port_1_last_extra = data;
} }

View File

@ -106,7 +106,7 @@ WRITE8_HANDLER( astrof_audio_1_w )
/* D6 - don't know. Probably something to do with the explosion sounds */ /* D6 - don't know. Probably something to do with the explosion sounds */
/* D7 - sound enable bit */ /* D7 - sound enable bit */
sound_global_enable(data & 0x80); sound_global_enable(space->machine, data & 0x80);
port_1_last = data; port_1_last = data;
} }
@ -237,7 +237,7 @@ WRITE8_HANDLER( tomahawk_audio_w )
/* D6 - explosion */ /* D6 - explosion */
/* D7 - sound enable bit */ /* D7 - sound enable bit */
sound_global_enable(data & 0x80); sound_global_enable(space->machine, data & 0x80);
} }

View File

@ -64,7 +64,7 @@ WRITE8_HANDLER( bzone_sounds_w )
stream_update(channel); stream_update(channel);
latch = data; latch = data;
sound_global_enable(latch & 0x20); sound_global_enable(space->machine, latch & 0x20);
} }
static STREAM_UPDATE( bzone_sound_update ) static STREAM_UPDATE( bzone_sound_update )
@ -567,7 +567,7 @@ WRITE8_DEVICE_HANDLER( bzone_sounds_w )
discrete_sound_w(device, BZ_INPUT, data); discrete_sound_w(device, BZ_INPUT, data);
output_set_value("startled", (data >> 6) & 1); output_set_value("startled", (data >> 6) & 1);
sound_global_enable(data & 0x20); sound_global_enable(device->machine, data & 0x20);
} }

View File

@ -1482,7 +1482,7 @@ static WRITE8_DEVICE_HANDLER( sound_portb_w )
/* bit 2 controls the global mute */ /* bit 2 controls the global mute */
if ((data & 4) != (last_portb_write & 4)) if ((data & 4) != (last_portb_write & 4))
sound_global_enable(!(data & 4)); sound_global_enable(device->machine, !(data & 4));
/* remember the last value written */ /* remember the last value written */
last_portb_write = data; last_portb_write = data;

View File

@ -278,5 +278,5 @@ WRITE8_HANDLER( circus_clown_z_w )
} }
/* Bit 7 enables amplifier (0 = on) */ /* Bit 7 enables amplifier (0 = on) */
sound_global_enable(~data & 0x80); sound_global_enable(space->machine, ~data & 0x80);
} }

View File

@ -1058,7 +1058,7 @@ WRITE8_DEVICE_HANDLER( checkmat_audio_w )
coin_counter_w(0, (data >> 2) & 0x01); coin_counter_w(0, (data >> 2) & 0x01);
sound_global_enable((data >> 3) & 0x01); sound_global_enable(device->machine, (data >> 3) & 0x01);
discrete_sound_w(device, CHECKMAT_TONE_DATA_45, (data >> 4) & 0x03); discrete_sound_w(device, CHECKMAT_TONE_DATA_45, (data >> 4) & 0x03);
discrete_sound_w(device, CHECKMAT_TONE_DATA_67, (data >> 6) & 0x03); discrete_sound_w(device, CHECKMAT_TONE_DATA_67, (data >> 6) & 0x03);
@ -1653,7 +1653,7 @@ WRITE8_HANDLER( gmissile_audio_1_w )
coin_counter_w(0, (data >> 2) & 0x01); coin_counter_w(0, (data >> 2) & 0x01);
sound_global_enable((data >> 3) & 0x01); sound_global_enable(space->machine, (data >> 3) & 0x01);
/* if (data & 0x10) enable RIGHT MISSILE sound (goes to right speaker) */ /* if (data & 0x10) enable RIGHT MISSILE sound (goes to right speaker) */
if (rising_bits & 0x10) sample_start(samples1, 0, 0, 0); if (rising_bits & 0x10) sample_start(samples1, 0, 0, 0);
@ -1749,7 +1749,7 @@ WRITE8_HANDLER( m4_audio_1_w )
coin_counter_w(0, (data >> 2) & 0x01); coin_counter_w(0, (data >> 2) & 0x01);
sound_global_enable((data >> 3) & 0x01); sound_global_enable(space->machine, (data >> 3) & 0x01);
/* if (data & 0x10) enable LEFT PLAYER SHOT sound (goes to left speaker) */ /* if (data & 0x10) enable LEFT PLAYER SHOT sound (goes to left speaker) */
if (rising_bits & 0x10) sample_start(samples0, 0, 0, 0); if (rising_bits & 0x10) sample_start(samples0, 0, 0, 0);
@ -2052,7 +2052,7 @@ WRITE8_DEVICE_HANDLER( clowns_audio_2_w )
discrete_sound_w(device, CLOWNS_POP_TOP_EN, (data >> 2) & 0x01); discrete_sound_w(device, CLOWNS_POP_TOP_EN, (data >> 2) & 0x01);
sound_global_enable((data >> 3) & 0x01); sound_global_enable(device->machine, (data >> 3) & 0x01);
discrete_sound_w(device, CLOWNS_SPRINGBOARD_HIT_EN, (data >> 4) & 0x01); discrete_sound_w(device, CLOWNS_SPRINGBOARD_HIT_EN, (data >> 4) & 0x01);
@ -2109,7 +2109,7 @@ WRITE8_HANDLER( shuffle_audio_1_w )
/* if (data & 0x02) enable SHUFFLE ROLLOVER sound */ /* if (data & 0x02) enable SHUFFLE ROLLOVER sound */
sound_global_enable((data >> 2) & 0x01); sound_global_enable(space->machine, (data >> 2) & 0x01);
/* set SHUFFLE ROLLING sound((data >> 3) & 0x07) 0, if not rolling, /* set SHUFFLE ROLLING sound((data >> 3) & 0x07) 0, if not rolling,
faster rolling = higher number */ faster rolling = higher number */
@ -2198,7 +2198,7 @@ WRITE8_HANDLER( dogpatch_audio_w )
coin_counter_w(0, (data >> 2) & 0x01); coin_counter_w(0, (data >> 2) & 0x01);
sound_global_enable((data >> 3) & 0x01); sound_global_enable(space->machine, (data >> 3) & 0x01);
/* if (data & 0x10) enable LEFT SHOOT sound */ /* if (data & 0x10) enable LEFT SHOOT sound */
@ -2742,7 +2742,7 @@ MACHINE_DRIVER_END
WRITE8_DEVICE_HANDLER( spcenctr_audio_1_w ) WRITE8_DEVICE_HANDLER( spcenctr_audio_1_w )
{ {
sound_global_enable((data >> 0) & 0x01); sound_global_enable(device->machine, (data >> 0) & 0x01);
/* D1 is marked as 'OPTIONAL SWITCH VIDEO FOR COCKTAIL', /* D1 is marked as 'OPTIONAL SWITCH VIDEO FOR COCKTAIL',
but it is never set by the software */ but it is never set by the software */
@ -2830,7 +2830,7 @@ WRITE8_HANDLER( phantom2_audio_1_w )
/* if (data & 0x02) enable ENEMY SHOT sound */ /* if (data & 0x02) enable ENEMY SHOT sound */
sound_global_enable((data >> 2) & 0x01); sound_global_enable(space->machine, (data >> 2) & 0x01);
coin_counter_w(0, (data >> 3) & 0x01); coin_counter_w(0, (data >> 3) & 0x01);
@ -2956,7 +2956,7 @@ WRITE8_DEVICE_HANDLER( bowler_audio_1_w )
coin_counter_w(0, (data >> 1) & 0x01); coin_counter_w(0, (data >> 1) & 0x01);
sound_global_enable((data >> 2) & 0x01); sound_global_enable(device->machine, (data >> 2) & 0x01);
discrete_sound_w(device, BOWLER_FOWL_EN, (data >> 3) & 0x01); discrete_sound_w(device, BOWLER_FOWL_EN, (data >> 3) & 0x01);
@ -3693,7 +3693,7 @@ WRITE8_DEVICE_HANDLER( invaders_audio_1_w )
discrete_sound_w(device, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 1), data & 0x08); discrete_sound_w(device, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 1), data & 0x08);
discrete_sound_w(device, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 1), data & 0x10); discrete_sound_w(device, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 1), data & 0x10);
sound_global_enable(data & 0x20); sound_global_enable(device->machine, data & 0x20);
/* D6 and D7 are not connected */ /* D6 and D7 are not connected */
} }
@ -4075,7 +4075,7 @@ WRITE8_DEVICE_HANDLER( invad2ct_audio_1_w )
discrete_sound_w(device, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 1), data & 0x08); discrete_sound_w(device, INVADERS_NODE(INVADERS_INVADER_HIT_EN, 1), data & 0x08);
discrete_sound_w(device, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 1), data & 0x10); discrete_sound_w(device, INVADERS_NODE(INVADERS_BONUS_MISSLE_BASE_EN, 1), data & 0x10);
sound_global_enable(data & 0x20); sound_global_enable(device->machine, data & 0x20);
/* D6 and D7 are not connected */ /* D6 and D7 are not connected */
} }

View File

@ -84,7 +84,7 @@ WRITE8_DEVICE_HANDLER( scramble_sh_irqtrigger_w )
TTL7474_update(device->machine, 2); TTL7474_update(device->machine, 2);
/* bit 4 is sound disable */ /* bit 4 is sound disable */
sound_global_enable(~data & 0x10); sound_global_enable(device->machine, ~data & 0x10);
} }
WRITE8_DEVICE_HANDLER( mrkougar_sh_irqtrigger_w ) WRITE8_DEVICE_HANDLER( mrkougar_sh_irqtrigger_w )

View File

@ -274,7 +274,7 @@ WRITE8_HANDLER( astrob_sound_w )
if ((data & 0x10) && sample_playing(samples, 4)) sample_stop(samples, 4); if ((data & 0x10) && sample_playing(samples, 4)) sample_stop(samples, 4);
/* MUTE */ /* MUTE */
sound_global_enable(!(data & 0x20)); sound_global_enable(space->machine, !(data & 0x20));
/* REFILL: channel 5 */ /* REFILL: channel 5 */
if (!(data & 0x40) && !sample_playing(samples, 5)) sample_start(samples, 5, 9, FALSE); if (!(data & 0x40) && !sample_playing(samples, 5)) sample_start(samples, 5, 9, FALSE);

View File

@ -413,7 +413,7 @@ WRITE8_DEVICE_HANDLER( subroc3d_sound_c_w )
sample_set_volume(samples, 11, (data & 0x40) ? 0 : 1.0); sample_set_volume(samples, 11, (data & 0x40) ? 0 : 1.0);
/* /GAME START */ /* /GAME START */
sound_global_enable(!(data & 0x80)); sound_global_enable(device->machine, !(data & 0x80));
} }
@ -568,7 +568,7 @@ WRITE8_DEVICE_HANDLER( buckrog_sound_b_w )
if ((diff & 0x40) && !(data & 0x40) && sample_playing(samples, 5)) sample_stop(samples, 5); if ((diff & 0x40) && !(data & 0x40) && sample_playing(samples, 5)) sample_stop(samples, 5);
/* GAME ON */ /* GAME ON */
sound_global_enable(data & 0x80); sound_global_enable(device->machine, data & 0x80);
} }

View File

@ -267,7 +267,7 @@ static WRITE8_DEVICE_HANDLER( astinvad_sound1_w )
if (bits_gone_hi & 0x04) sample_start(samples, 2, SND_BASEHIT, 0); if (bits_gone_hi & 0x04) sample_start(samples, 2, SND_BASEHIT, 0);
if (bits_gone_hi & 0x08) sample_start(samples, 3, SND_INVADERHIT, 0); if (bits_gone_hi & 0x08) sample_start(samples, 3, SND_INVADERHIT, 0);
sound_global_enable(data & 0x20); sound_global_enable(device->machine, data & 0x20);
screen_red = data & 0x04; screen_red = data & 0x04;
} }
@ -313,7 +313,7 @@ static WRITE8_HANDLER( spaceint_sound2_w )
int bits_gone_hi = data & ~sound_state[1]; int bits_gone_hi = data & ~sound_state[1];
sound_state[1] = data; sound_state[1] = data;
sound_global_enable(data & 0x02); sound_global_enable(space->machine, data & 0x02);
if (bits_gone_hi & 0x04) sample_start(samples, 3, SND_INVADERHIT, 0); if (bits_gone_hi & 0x04) sample_start(samples, 3, SND_INVADERHIT, 0);

View File

@ -127,7 +127,7 @@ static WRITE8_HANDLER( nmi_enable_w )
static WRITE8_HANDLER( sound_enable_w ) static WRITE8_HANDLER( sound_enable_w )
{ {
sound_global_enable(data & 1); sound_global_enable(space->machine, data & 1);
} }

View File

@ -167,7 +167,7 @@ static WRITE8_HANDLER( port_sound_w )
crbaloon_set_clear_collision_address((data & 0x01) ? TRUE : FALSE); crbaloon_set_clear_collision_address((data & 0x01) ? TRUE : FALSE);
/* D1 - SOUND STOP */ /* D1 - SOUND STOP */
sound_global_enable((data & 0x02) ? TRUE : FALSE); sound_global_enable(space->machine, (data & 0x02) ? TRUE : FALSE);
/* D2 - unlabeled - music enable */ /* D2 - unlabeled - music enable */
crbaloon_audio_set_music_enable(discrete, 0, (data & 0x04) ? TRUE : FALSE); crbaloon_audio_set_music_enable(discrete, 0, (data & 0x04) ? TRUE : FALSE);

View File

@ -1203,7 +1203,7 @@ static MACHINE_RESET( darius )
} }
memory_set_bankptr(machine, 1, RAM); memory_set_bankptr(machine, 1, RAM);
sound_global_enable( 1 ); /* mixer enabled */ sound_global_enable( machine, 1 ); /* mixer enabled */
for( i = 0; i < DARIUS_VOL_MAX; i++ ){ for( i = 0; i < DARIUS_VOL_MAX; i++ ){
darius_vol[i] = 0x00; /* min volume */ darius_vol[i] = 0x00; /* min volume */

View File

@ -373,7 +373,7 @@ static WRITE8_DEVICE_HANDLER( konami_sound_control_w )
cputag_set_input_line(device->machine, "audiocpu", 0, HOLD_LINE); cputag_set_input_line(device->machine, "audiocpu", 0, HOLD_LINE);
/* bit 4 is sound disable */ /* bit 4 is sound disable */
sound_global_enable(~data & 0x10); sound_global_enable(device->machine, ~data & 0x10);
} }

View File

@ -239,7 +239,7 @@ static WRITE8_HANDLER( m10_ctrl_w )
state->flip = ~data & 0x10; state->flip = ~data & 0x10;
if (!(input_port_read(space->machine, "CAB") & 0x02)) if (!(input_port_read(space->machine, "CAB") & 0x02))
sound_global_enable(~data & 0x80); sound_global_enable(space->machine, ~data & 0x80);
/* sound command in lower 4 bytes */ /* sound command in lower 4 bytes */
switch (data & 0x07) switch (data & 0x07)
@ -315,7 +315,7 @@ static WRITE8_HANDLER( m11_ctrl_w )
state->flip = ~data & 0x10; state->flip = ~data & 0x10;
if (!(input_port_read(space->machine, "CAB") & 0x02)) if (!(input_port_read(space->machine, "CAB") & 0x02))
sound_global_enable(~data & 0x80); sound_global_enable(space->machine, ~data & 0x80);
} }
/* /*
@ -344,7 +344,7 @@ static WRITE8_HANDLER( m15_ctrl_w )
if (input_port_read(space->machine, "CAB") & 0x01) if (input_port_read(space->machine, "CAB") & 0x01)
state->flip = ~data & 0x04; state->flip = ~data & 0x04;
if (!(input_port_read(space->machine, "CAB") & 0x02)) if (!(input_port_read(space->machine, "CAB") & 0x02))
sound_global_enable(~data & 0x08); sound_global_enable(space->machine, ~data & 0x08);
} }

View File

@ -82,7 +82,7 @@ static WRITE8_HANDLER( mcu_portB_w )
cputag_set_input_line(space->machine, "mcu", M6805_IRQ_LINE, CLEAR_LINE ); cputag_set_input_line(space->machine, "mcu", M6805_IRQ_LINE, CLEAR_LINE );
/* AUDMUTE */ /* AUDMUTE */
sound_global_enable((data >> 5) & 1); sound_global_enable(space->machine, (data >> 5) & 1);
/* RES600 */ /* RES600 */
if (diff & 0x10) if (diff & 0x10)

View File

@ -1006,7 +1006,7 @@ static MACHINE_START( ninjaw )
static MACHINE_RESET( ninjaw ) static MACHINE_RESET( ninjaw )
{ {
/**** mixer control enable ****/ /**** mixer control enable ****/
sound_global_enable( 1 ); /* mixer enabled */ sound_global_enable( machine, 1 ); /* mixer enabled */
} }

View File

@ -304,7 +304,7 @@ static WRITE8_DEVICE_HANDLER( tilemap_sound_w )
cputag_set_input_line(device->machine, "soundcpu", INPUT_LINE_NMI, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE); cputag_set_input_line(device->machine, "soundcpu", INPUT_LINE_NMI, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
segaic16_tilemap_set_colscroll(device->machine, 0, ~data & 0x04); segaic16_tilemap_set_colscroll(device->machine, 0, ~data & 0x04);
segaic16_tilemap_set_rowscroll(device->machine, 0, ~data & 0x02); segaic16_tilemap_set_rowscroll(device->machine, 0, ~data & 0x02);
sound_global_enable(data & 0x01); sound_global_enable(device->machine, data & 0x01);
} }

View File

@ -412,7 +412,7 @@ static WRITE16_HANDLER( outrun_custom_io_w )
D7: /MUTE D7: /MUTE
D6-D0: unknown D6-D0: unknown
*/ */
sound_global_enable(data & 0x80); sound_global_enable(space->machine, data & 0x80);
} }
return; return;

View File

@ -567,7 +567,7 @@ static WRITE16_HANDLER( iochip_0_w )
D7: Amplifier mute control (1= sounding, 0= muted) D7: Amplifier mute control (1= sounding, 0= muted)
D6-D0: CN D pin A17-A23 (output level 1= high, 0= low) D6-D0: CN D pin A17-A23 (output level 1= high, 0= low)
*/ */
sound_global_enable(data & 0x80); sound_global_enable(space->machine, data & 0x80);
return; return;
} }
@ -653,7 +653,7 @@ static WRITE16_HANDLER( aburner2_iochip_0_D_w )
coin_counter_w(0, (data >> 4) & 0x01); coin_counter_w(0, (data >> 4) & 0x01);
output_set_lamp_value(0, (data >> 5) & 0x01); /* lock on lamp */ output_set_lamp_value(0, (data >> 5) & 0x01); /* lock on lamp */
output_set_lamp_value(1, (data >> 6) & 0x01); /* danger lamp */ output_set_lamp_value(1, (data >> 6) & 0x01); /* danger lamp */
sound_global_enable((data >> 7) & 0x01); sound_global_enable(space->machine, (data >> 7) & 0x01);
} }

View File

@ -332,7 +332,7 @@ static WRITE16_HANDLER( io_chip_w )
case 0x0e/2: case 0x0e/2:
/* D7 = /MUTE */ /* D7 = /MUTE */
/* D6-D0 = FLT31-25 */ /* D6-D0 = FLT31-25 */
sound_global_enable(data & 0x80); sound_global_enable(space->machine, data & 0x80);
break; break;
/* CNT register */ /* CNT register */

View File

@ -464,7 +464,7 @@ static void dakkochn_custom_w(running_machine *machine, UINT8 data, UINT8 prevda
static WRITE8_DEVICE_HANDLER( sound_control_w ) static WRITE8_DEVICE_HANDLER( sound_control_w )
{ {
/* bit 0 = MUTE (inverted sense on System 2) */ /* bit 0 = MUTE (inverted sense on System 2) */
sound_global_enable(~(data ^ mute_xor) & 1); sound_global_enable(device->machine, ~(data ^ mute_xor) & 1);
/* bit 6 = feedback from sound board that read occurrred */ /* bit 6 = feedback from sound board that read occurrred */

View File

@ -160,7 +160,7 @@ static READ8_HANDLER( thepit_colorram_r )
static WRITE8_HANDLER( thepit_sound_enable_w ) static WRITE8_HANDLER( thepit_sound_enable_w )
{ {
sound_global_enable(data); sound_global_enable(space->machine, data);
} }

View File

@ -83,7 +83,7 @@ static WRITE8_HANDLER( tutankhm_bankselect_w )
static WRITE8_HANDLER( sound_mute_w ) static WRITE8_HANDLER( sound_mute_w )
{ {
sound_global_enable(~data & 1); sound_global_enable(space->machine, ~data & 1);
} }

View File

@ -38,7 +38,7 @@ static WRITE8_HANDLER( jamma_if_control_latch_w )
UINT8 diff = data ^ jamma_if_control_latch; UINT8 diff = data ^ jamma_if_control_latch;
jamma_if_control_latch = data; jamma_if_control_latch = data;
sound_global_enable( (data >> 7) & 1 ); sound_global_enable( space->machine, (data >> 7) & 1 );
if ( diff & 0x40 ) if ( diff & 0x40 )
{ {

View File

@ -710,7 +710,7 @@ static MACHINE_RESET( taito_dualscreen )
banknum = -1; banknum = -1;
/**** mixer control enable ****/ /**** mixer control enable ****/
sound_global_enable( 1 ); /* mixer enabled */ sound_global_enable( machine, 1 ); /* mixer enabled */
} }

View File

@ -186,7 +186,7 @@ WRITE8_HANDLER( bking_cont3_w )
palette_bank = (data >> 1) & 0x03; palette_bank = (data >> 1) & 0x03;
sound_global_enable(~data & 0x08); sound_global_enable(space->machine, ~data & 0x08);
} }

View File

@ -299,7 +299,7 @@ WRITE8_HANDLER( dday_control_w )
if (!(data & 0x10) && (control & 0x10)) if (!(data & 0x10) && (control & 0x10))
devtag_reset(space->machine, "ay"); devtag_reset(space->machine, "ay");
sound_global_enable(data & 0x10); sound_global_enable(space->machine, data & 0x10);
/* bit 6 is search light enable */ /* bit 6 is search light enable */
sl_enable = data & 0x40; sl_enable = data & 0x40;