From 78622af0ebcb0e21a20c253bdc559734fd1994ed Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Thu, 4 Dec 2008 10:44:15 +0000 Subject: [PATCH] This patch furthers the process of aligning the sound cores with the recent cpu core changes. Specifically, it adds a fake device implementation similar to the one the cpu cores were using in 128u3 (i.e. it only provides the machine pointer and the token), and makes some interface adjustments aligned to 128u4 (i.e. adding snd_class_header, adding get_ to various getter functions). The primary benefit of this change is the removal of "deprecat.h" from 23 sound cores. I also adjusted ui.c to stop calling sndnum_clock and access the clock data similarly to how it does the cpu clock data. [AtariAce] --- src/emu/info.c | 2 +- src/emu/sndintrf.c | 119 +++++++++++++++++++-------------------- src/emu/sndintrf.h | 82 +++++++++++++++++---------- src/emu/sound.c | 8 +-- src/emu/sound/2151intf.c | 7 +-- src/emu/sound/2203intf.c | 6 +- src/emu/sound/2413intf.c | 4 +- src/emu/sound/2608intf.c | 10 ++-- src/emu/sound/2610intf.c | 22 ++++---- src/emu/sound/2612intf.c | 6 +- src/emu/sound/262intf.c | 4 +- src/emu/sound/3812intf.c | 16 +++--- src/emu/sound/5110intf.c | 6 +- src/emu/sound/5220intf.c | 6 +- src/emu/sound/astrocde.c | 10 ++-- src/emu/sound/ay8910.c | 4 +- src/emu/sound/bsmt2000.c | 18 +++--- src/emu/sound/c140.c | 3 +- src/emu/sound/c352.c | 5 +- src/emu/sound/cdp1869.c | 2 +- src/emu/sound/custom.c | 4 +- src/emu/sound/discrete.c | 6 +- src/emu/sound/es5506.c | 14 ++--- src/emu/sound/es8712.c | 5 +- src/emu/sound/flt_rc.c | 2 +- src/emu/sound/flt_vol.c | 3 +- src/emu/sound/hc55516.c | 3 +- src/emu/sound/ics2115.c | 4 +- src/emu/sound/iremga20.c | 15 +++-- src/emu/sound/k005289.c | 3 +- src/emu/sound/k007232.c | 7 +-- src/emu/sound/k051649.c | 2 +- src/emu/sound/k053260.c | 14 +++-- src/emu/sound/k054539.c | 2 +- src/emu/sound/msm5205.c | 12 ++-- src/emu/sound/msm5232.c | 12 ++-- src/emu/sound/multipcm.c | 3 +- src/emu/sound/n63701x.c | 3 +- src/emu/sound/namco52.c | 20 ++++--- src/emu/sound/nes_apu.c | 7 +-- src/emu/sound/nile.c | 3 +- src/emu/sound/okim6258.c | 3 +- src/emu/sound/okim6295.c | 5 +- src/emu/sound/qsound.c | 7 +-- src/emu/sound/s14001a.c | 5 +- src/emu/sound/samples.c | 6 +- src/emu/sound/segapcm.c | 5 +- src/emu/sound/sid6581.c | 2 +- src/emu/sound/sn76477.c | 7 +-- src/emu/sound/sp0256.c | 16 +++--- src/emu/sound/speaker.c | 3 +- src/emu/sound/tiaintf.c | 2 +- src/emu/sound/upd7759.c | 15 +++-- src/emu/sound/vlm5030.c | 19 ++++--- src/emu/sound/votrax.c | 6 +- src/emu/sound/wave.c | 4 +- src/emu/sound/ymf271.c | 4 +- src/emu/sound/ymf278b.c | 9 ++- src/emu/sound/ymz280b.c | 4 +- src/emu/ui.c | 8 +-- 60 files changed, 325 insertions(+), 289 deletions(-) diff --git a/src/emu/info.c b/src/emu/info.c index 59873391123..076cf374bcb 100644 --- a/src/emu/info.c +++ b/src/emu/info.c @@ -590,7 +590,7 @@ static void print_game_chips(FILE *out, const game_driver *game, const machine_c fprintf(out, "\t\tsound[chipnum].tag)); - fprintf(out, " name=\"%s\"", xml_normalize_string(sndtype_name(config->sound[chipnum].type))); + fprintf(out, " name=\"%s\"", xml_normalize_string(sndtype_get_name(config->sound[chipnum].type))); if (config->sound[chipnum].clock != 0) fprintf(out, " clock=\"%d\"", config->sound[chipnum].clock); fprintf(out, "/>\n"); diff --git a/src/emu/sndintrf.c b/src/emu/sndintrf.c index c7dccc2e52d..0ed6256a41e 100644 --- a/src/emu/sndintrf.c +++ b/src/emu/sndintrf.c @@ -17,6 +17,7 @@ ***************************************************************************/ #include "driver.h" +#include "deprecat.h" @@ -34,25 +35,13 @@ TYPE DEFINITIONS ***************************************************************************/ -typedef struct _sound_interface sound_interface; -struct _sound_interface -{ - /* table of core functions */ - void (*get_info)(void *token, UINT32 state, sndinfo *info); - void (*set_info)(void *token, UINT32 state, sndinfo *info); - void * (*start)(const char *tag, int index, int clock, const void *config); - void (*stop)(void *token); - void (*reset)(void *token); -}; - - typedef struct _sndintrf_data sndintrf_data; struct _sndintrf_data { - sound_interface intf; /* copy of the interface data */ + snd_class_header intf; /* copy of the interface data */ sound_type sndtype; /* type index of this sound chip */ sound_type aliastype; /* aliased type index of this sound chip */ - void * token; /* dynamically allocated token data */ + device_config device; /* dummy device for now */ const char * tag; /* tag this sound chip */ int index; /* index of this sound chip */ int clock; /* clock for this sound chip */ @@ -61,7 +50,7 @@ struct _sndintrf_data /*************************************************************************** - EXTERNAL PROTOTYPES + PROTOTYPES FOR ALL SND ENTRY POINTS ***************************************************************************/ static SND_GET_INFO( dummy_sound ); @@ -181,15 +170,13 @@ SND_GET_INFO( filter_rc ); /*************************************************************************** - CORE INTERFACE LIST + MASTER SND LIST ***************************************************************************/ -static sound_interface sndintrf[SOUND_COUNT]; - static const struct { sound_type sndtype; - void (*get_info)(void *token, UINT32 state, sndinfo *info); + snd_get_info_func get_info; } sndintrf_map[] = { { SOUND_DUMMY, SND_GET_INFO_NAME( dummy_sound ) }, @@ -513,6 +500,8 @@ static const struct GLOBAL VARIABLES ***************************************************************************/ +static snd_class_header snd_type_header[SOUND_COUNT]; + static sndintrf_data sound[MAX_SOUND]; static sndintrf_data *current_sound_start; static UINT8 sound_matrix[SOUND_COUNT][MAX_SOUND]; @@ -535,40 +524,41 @@ void sndintrf_init(running_machine *machine) int mapindex; /* reset the sndintrf array */ - memset(sndintrf, 0, sizeof(sndintrf)); + memset(snd_type_header, 0, sizeof(snd_type_header)); /* build the sndintrf array */ - for (mapindex = 0; mapindex < sizeof(sndintrf_map) / sizeof(sndintrf_map[0]); mapindex++) + for (mapindex = 0; mapindex < ARRAY_LENGTH(sndintrf_map); mapindex++) { sound_type sndtype = sndintrf_map[mapindex].sndtype; - sound_interface *intf = &sndintrf[sndtype]; + snd_class_header *header = &snd_type_header[sndtype]; sndinfo info; /* start with the get_info routine */ - intf->get_info = sndintrf_map[mapindex].get_info; + header->sndtype = sndtype; + header->get_info = sndintrf_map[mapindex].get_info; /* bootstrap the rest of the function pointers */ info.set_info = NULL; - (*intf->get_info)(NULL, SNDINFO_PTR_SET_INFO, &info); - intf->set_info = info.set_info; + (*header->get_info)(NULL, SNDINFO_PTR_SET_INFO, &info); + header->set_info = info.set_info; info.start = NULL; - (*intf->get_info)(NULL, SNDINFO_PTR_START, &info); - intf->start = info.start; + (*header->get_info)(NULL, SNDINFO_PTR_START, &info); + header->start = info.start; info.stop = NULL; - (*intf->get_info)(NULL, SNDINFO_PTR_STOP, &info); - intf->stop = info.stop; + (*header->get_info)(NULL, SNDINFO_PTR_STOP, &info); + header->stop = info.stop; info.reset = NULL; - (*intf->get_info)(NULL, SNDINFO_PTR_RESET, &info); - intf->reset = info.reset; + (*header->get_info)(NULL, SNDINFO_PTR_RESET, &info); + header->reset = info.reset; } /* fill in any empty entries with the dummy sound */ for (mapindex = 0; mapindex < SOUND_COUNT; mapindex++) - if (sndintrf[mapindex].get_info == NULL) - sndintrf[mapindex] = sndintrf[SOUND_DUMMY]; + if (snd_type_header[mapindex].get_info == NULL) + snd_type_header[mapindex] = snd_type_header[SOUND_DUMMY]; /* zap the sound data structures */ memset(sound, 0, sizeof(sound)); @@ -589,8 +579,11 @@ int sndintrf_init_sound(int sndnum, const char *tag, sound_type sndtype, int clo sndintrf_data *info = &sound[sndnum]; int index; + memset(&info->device, 0, sizeof(info->device)); + info->device.machine = Machine; + /* fill in the type and interface */ - info->intf = sndintrf[sndtype]; + info->intf = snd_type_header[sndtype]; info->tag = tag; info->sndtype = sndtype; info->aliastype = sndtype_get_info_int(sndtype, SNDINFO_INT_ALIAS); @@ -610,12 +603,12 @@ int sndintrf_init_sound(int sndnum, const char *tag, sound_type sndtype, int clo /* start the chip, tagging all its streams */ current_sound_start = &sound[sndnum]; - info->token = (*info->intf.start)(info->tag, index, clock, config); + info->device.token = (*info->intf.start)(&info->device, info->tag, index, clock, config); current_sound_start = NULL; - VPRINTF((" token = %p\n", info->token)); + VPRINTF((" token = %p\n", info->device.token)); /* if that failed, die */ - if (!info->token) + if (!info->device.token) return 1; return 0; @@ -631,7 +624,7 @@ void sndintrf_exit_sound(int sndnum) { /* stop the chip */ if (sound[sndnum].intf.stop) - (*sound[sndnum].intf.stop)(sound[sndnum].token); + (*sound[sndnum].intf.stop)(&sound[sndnum].device); } @@ -648,7 +641,7 @@ void sndintrf_exit_sound(int sndnum) void sndintrf_register_token(void *token) { if (current_sound_start) - current_sound_start->token = token; + current_sound_start->device.token = token; } @@ -720,7 +713,7 @@ INT64 sndnum_get_info_int(int sndnum, UINT32 state) VERIFY_SNDNUM(sndnum_get_info_int); info.i = 0; - (*sound[sndnum].intf.get_info)(sound[sndnum].token, state, &info); + (*sound[sndnum].intf.get_info)(&sound[sndnum].device, state, &info); return info.i; } @@ -730,7 +723,7 @@ void *sndnum_get_info_ptr(int sndnum, UINT32 state) VERIFY_SNDNUM(sndnum_get_info_ptr); info.p = NULL; - (*sound[sndnum].intf.get_info)(sound[sndnum].token, state, &info); + (*sound[sndnum].intf.get_info)(&sound[sndnum].device, state, &info); return info.p; } @@ -740,7 +733,7 @@ genf *sndnum_get_info_fct(int sndnum, UINT32 state) VERIFY_SNDNUM(sndnum_get_info_fct); info.f = NULL; - (*sound[sndnum].intf.get_info)(sound[sndnum].token, state, &info); + (*sound[sndnum].intf.get_info)(&sound[sndnum].device, state, &info); return info.f; } @@ -750,7 +743,7 @@ const char *sndnum_get_info_string(int sndnum, UINT32 state) VERIFY_SNDNUM(sndnum_get_info_string); info.s = NULL; - (*sound[sndnum].intf.get_info)(sound[sndnum].token, state, &info); + (*sound[sndnum].intf.get_info)(&sound[sndnum].device, state, &info); return info.s; } @@ -764,7 +757,7 @@ void sndnum_set_info_int(int sndnum, UINT32 state, INT64 data) sndinfo info; VERIFY_SNDNUM(sndnum_set_info_int); info.i = data; - (*sound[sndnum].intf.set_info)(sound[sndnum].token, state, &info); + (*sound[sndnum].intf.set_info)(&sound[sndnum].device, state, &info); } void sndnum_set_info_ptr(int sndnum, UINT32 state, void *data) @@ -772,7 +765,7 @@ void sndnum_set_info_ptr(int sndnum, UINT32 state, void *data) sndinfo info; VERIFY_SNDNUM(sndnum_set_info_ptr); info.p = data; - (*sound[sndnum].intf.set_info)(sound[sndnum].token, state, &info); + (*sound[sndnum].intf.set_info)(&sound[sndnum].device, state, &info); } void sndnum_set_info_fct(int sndnum, UINT32 state, genf *data) @@ -780,7 +773,7 @@ void sndnum_set_info_fct(int sndnum, UINT32 state, genf *data) sndinfo info; VERIFY_SNDNUM(sndnum_set_info_ptr); info.f = data; - (*sound[sndnum].intf.set_info)(sound[sndnum].token, state, &info); + (*sound[sndnum].intf.set_info)(&sound[sndnum].device, state, &info); } @@ -792,7 +785,7 @@ void sndnum_reset(int sndnum) { VERIFY_SNDNUM(sndnum_reset); if (sound[sndnum].intf.reset) - (*sound[sndnum].intf.reset)(sound[sndnum].token); + (*sound[sndnum].intf.reset)(&sound[sndnum].device); } int sndnum_clock(int sndnum) @@ -804,7 +797,7 @@ int sndnum_clock(int sndnum) void *sndnum_token(int sndnum) { VERIFY_SNDNUM(sndnum_token); - return sound[sndnum].token; + return sound[sndnum].device.token; } @@ -825,7 +818,7 @@ INT64 sndti_get_info_int(sound_type sndtype, int sndindex, UINT32 state) VERIFY_SNDTI(sndti_get_info_int); sndnum = sound_matrix[sndtype][sndindex] - 1; info.i = 0; - (*sound[sndnum].intf.get_info)(sound[sndnum].token, state, &info); + (*sound[sndnum].intf.get_info)(&sound[sndnum].device, state, &info); return info.i; } @@ -837,7 +830,7 @@ void *sndti_get_info_ptr(sound_type sndtype, int sndindex, UINT32 state) VERIFY_SNDTI(sndti_get_info_ptr); sndnum = sound_matrix[sndtype][sndindex] - 1; info.p = NULL; - (*sound[sndnum].intf.get_info)(sound[sndnum].token, state, &info); + (*sound[sndnum].intf.get_info)(&sound[sndnum].device, state, &info); return info.p; } @@ -849,7 +842,7 @@ genf *sndti_get_info_fct(sound_type sndtype, int sndindex, UINT32 state) VERIFY_SNDTI(sndti_get_info_fct); sndnum = sound_matrix[sndtype][sndindex] - 1; info.f = NULL; - (*sound[sndnum].intf.get_info)(sound[sndnum].token, state, &info); + (*sound[sndnum].intf.get_info)(&sound[sndnum].device, state, &info); return info.f; } @@ -861,7 +854,7 @@ const char *sndti_get_info_string(sound_type sndtype, int sndindex, UINT32 state VERIFY_SNDTI(sndti_get_info_string); sndnum = sound_matrix[sndtype][sndindex] - 1; info.s = NULL; - (*sound[sndnum].intf.get_info)(sound[sndnum].token, state, &info); + (*sound[sndnum].intf.get_info)(&sound[sndnum].device, state, &info); return info.s; } @@ -878,7 +871,7 @@ void sndti_set_info_int(sound_type sndtype, int sndindex, UINT32 state, INT64 da VERIFY_SNDTI(sndti_set_info_int); sndnum = sound_matrix[sndtype][sndindex] - 1; info.i = data; - (*sound[sndnum].intf.set_info)(sound[sndnum].token, state, &info); + (*sound[sndnum].intf.set_info)(&sound[sndnum].device, state, &info); } void sndti_set_info_ptr(sound_type sndtype, int sndindex, UINT32 state, void *data) @@ -889,7 +882,7 @@ void sndti_set_info_ptr(sound_type sndtype, int sndindex, UINT32 state, void *da VERIFY_SNDTI(sndti_set_info_ptr); sndnum = sound_matrix[sndtype][sndindex] - 1; info.p = data; - (*sound[sndnum].intf.set_info)(sound[sndnum].token, state, &info); + (*sound[sndnum].intf.set_info)(&sound[sndnum].device, state, &info); } void sndti_set_info_fct(sound_type sndtype, int sndindex, UINT32 state, genf *data) @@ -900,7 +893,7 @@ void sndti_set_info_fct(sound_type sndtype, int sndindex, UINT32 state, genf *da VERIFY_SNDTI(sndti_set_info_ptr); sndnum = sound_matrix[sndtype][sndindex] - 1; info.f = data; - (*sound[sndnum].intf.set_info)(sound[sndnum].token, state, &info); + (*sound[sndnum].intf.set_info)(&sound[sndnum].device, state, &info); } @@ -915,7 +908,7 @@ void sndti_reset(sound_type sndtype, int sndindex) VERIFY_SNDTI(sndti_reset); sndnum = sound_matrix[sndtype][sndindex] - 1; if (sound[sndnum].intf.reset) - (*sound[sndnum].intf.reset)(sound[sndnum].token); + (*sound[sndnum].intf.reset)(&sound[sndnum].device); } int sndti_clock(sound_type sndtype, int sndindex) @@ -931,7 +924,7 @@ void *sndti_token(sound_type sndtype, int sndindex) int sndnum; VERIFY_SNDTI(sndti_token); sndnum = sound_matrix[sndtype][sndindex] - 1; - return sound[sndnum].token; + return sound[sndnum].device.token; } @@ -946,41 +939,45 @@ void *sndti_token(sound_type sndtype, int sndindex) INT64 sndtype_get_info_int(sound_type sndtype, UINT32 state) { + snd_class_header *classheader = &snd_type_header[sndtype]; sndinfo info; VERIFY_SNDTYPE(sndtype_get_info_int); info.i = 0; - (*sndintrf[sndtype].get_info)(NULL, state, &info); + (*classheader->get_info)(NULL, state, &info); return info.i; } void *sndtype_get_info_ptr(sound_type sndtype, UINT32 state) { + snd_class_header *classheader = &snd_type_header[sndtype]; sndinfo info; VERIFY_SNDTYPE(sndtype_get_info_ptr); info.p = NULL; - (*sndintrf[sndtype].get_info)(NULL, state, &info); + (*classheader->get_info)(NULL, state, &info); return info.p; } genf *sndtype_get_info_fct(sound_type sndtype, UINT32 state) { + snd_class_header *classheader = &snd_type_header[sndtype]; sndinfo info; VERIFY_SNDTYPE(sndtype_get_info_fct); info.f = NULL; - (*sndintrf[sndtype].get_info)(NULL, state, &info); + (*classheader->get_info)(NULL, state, &info); return info.f; } const char *sndtype_get_info_string(sound_type sndtype, UINT32 state) { + snd_class_header *classheader = &snd_type_header[sndtype]; sndinfo info; VERIFY_SNDTYPE(sndtype_get_info_string); info.s = NULL; - (*sndintrf[sndtype].get_info)(NULL, state, &info); + (*classheader->get_info)(NULL, state, &info); return info.s; } diff --git a/src/emu/sndintrf.h b/src/emu/sndintrf.h index 7db71a1385e..e94bc1757b8 100644 --- a/src/emu/sndintrf.h +++ b/src/emu/sndintrf.h @@ -187,24 +187,24 @@ enum ***************************************************************************/ #define SND_GET_INFO_NAME(name) snd_get_info_##name -#define SND_GET_INFO(name) void SND_GET_INFO_NAME(name)(void *token, UINT32 state, sndinfo *info) -#define SND_GET_INFO_CALL(name) SND_GET_INFO_NAME(name)(token, state, info) +#define SND_GET_INFO(name) void SND_GET_INFO_NAME(name)(const device_config *device, UINT32 state, sndinfo *info) +#define SND_GET_INFO_CALL(name) SND_GET_INFO_NAME(name)(device, state, info) #define SND_SET_INFO_NAME(name) snd_set_info_##name -#define SND_SET_INFO(name) void SND_SET_INFO_NAME(name)(void *token, UINT32 state, sndinfo *info) -#define SND_SET_INFO_CALL(name) SND_SET_INFO_NAME(name)(token, state, info) +#define SND_SET_INFO(name) void SND_SET_INFO_NAME(name)(const device_config *device, UINT32 state, sndinfo *info) +#define SND_SET_INFO_CALL(name) SND_SET_INFO_NAME(name)(device, state, info) #define SND_START_NAME(name) snd_start_##name -#define SND_START(name) void *SND_START_NAME(name)(const char *tag, int sndindex, int clock, const void *config) -#define SND_START_CALL(name) SND_START_NAME(name)(tag, sndindex, clock, config) +#define SND_START(name) void *SND_START_NAME(name)(const device_config *device, const char *tag, int sndindex, int clock, const void *config) +#define SND_START_CALL(name) SND_START_NAME(name)(device, tag, sndindex, clock, config) #define SND_STOP_NAME(name) snd_stop_##name -#define SND_STOP(name) void SND_STOP_NAME(name)(void *token) -#define SND_STOP_CALL(name) SND_STOP_NAME(name)(token) +#define SND_STOP(name) void SND_STOP_NAME(name)(const device_config *device) +#define SND_STOP_CALL(name) SND_STOP_NAME(name)(device) #define SND_RESET_NAME(name) snd_reset_##name -#define SND_RESET(name) void SND_RESET_NAME(name)(void *token) -#define SND_RESET_CALL(name) SND_RESET_NAME(name)(token) +#define SND_RESET(name) void SND_RESET_NAME(name)(const device_config *device) +#define SND_RESET_CALL(name) SND_RESET_NAME(name)(device) @@ -212,7 +212,18 @@ enum TYPE DEFINITIONS ***************************************************************************/ +/* forward declaration of this union */ typedef union _sndinfo sndinfo; + +/* define the various callback functions */ +typedef void (*snd_get_info_func)(const device_config *device, UINT32 state, sndinfo *info); +typedef void (*snd_set_info_func)(const device_config *device, UINT32 state, sndinfo *info); +typedef void *(*snd_start_func)(const device_config *device, const char *tag, int sndindex, int clock, const void *config); +typedef void (*snd_stop_func)(const device_config *device); +typedef void (*snd_reset_func)(const device_config *device); + + +/* sndinfo union used to pass data to/from the get_info/set_info functions */ union _sndinfo { INT64 i; /* generic integers */ @@ -220,12 +231,25 @@ union _sndinfo genf * f; /* generic function pointers */ const char *s; /* generic strings */ - void (*set_info)(void *token, UINT32 state, sndinfo *info); - void * (*start)(const char *tag, int index, int clock, const void *config);/* SNDINFO_PTR_START */ - void (*stop)(void *token); /* SNDINFO_PTR_STOP */ - void (*reset)(void *token); /* SNDINFO_PTR_RESET */ + snd_set_info_func set_info; /* SNDINFO_PTR_SET_INFO */ + snd_start_func start; /* SNDINFO_PTR_START */ + snd_stop_func stop; /* SNDINFO_PTR_STOP */ + snd_reset_func reset; /* SNDINFO_PTR_RESET */ }; +typedef struct _snd_class_header snd_class_header; +struct _snd_class_header +{ + int index; /* index of this SND */ + sound_type sndtype; /* type index of this SND */ + + /* table of core functions */ + snd_get_info_func get_info; + snd_set_info_func set_info; + snd_start_func start; + snd_stop_func stop; + snd_reset_func reset; +}; /*************************************************************************** @@ -243,11 +267,11 @@ void sndnum_set_info_int(int sndnum, UINT32 state, INT64 data); void sndnum_set_info_ptr(int sndnum, UINT32 state, void *data); void sndnum_set_info_fct(int sndnum, UINT32 state, genf *data); -#define sndnum_name(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_NAME) -#define sndnum_core_family(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_CORE_FAMILY) -#define sndnum_core_version(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_CORE_VERSION) -#define sndnum_core_file(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_CORE_FILE) -#define sndnum_core_credits(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_CORE_CREDITS) +#define sndnum_get_name(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_NAME) +#define sndnum_get_core_family(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_CORE_FAMILY) +#define sndnum_get_core_version(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_CORE_VERSION) +#define sndnum_get_core_file(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_CORE_FILE) +#define sndnum_get_core_credits(sndnum) sndnum_get_info_string(sndnum, SNDINFO_STR_CORE_CREDITS) /* misc accessors */ void sndnum_reset(int sndnum); @@ -271,11 +295,11 @@ void sndti_set_info_int(sound_type sndtype, int sndindex, UINT32 state, INT64 da void sndti_set_info_ptr(sound_type sndtype, int sndindex, UINT32 state, void *data); void sndti_set_info_fct(sound_type sndtype, int sndindex, UINT32 state, genf *data); -#define sndti_name(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_NAME) -#define sndti_core_family(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_FAMILY) -#define sndti_core_version(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_VERSION) -#define sndti_core_file(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_FILE) -#define sndti_core_credits(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_CREDITS) +#define sndti_get_name(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_NAME) +#define sndti_get_core_family(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_FAMILY) +#define sndti_get_core_version(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_VERSION) +#define sndti_get_core_file(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_FILE) +#define sndti_get_core_credits(sndtype, sndindex) sndti_get_info_string(sndtype, sndindex, SNDINFO_STR_CORE_CREDITS) /* misc accessors */ void sndti_reset(sound_type sndtype, int sndindex); @@ -297,11 +321,11 @@ void *sndtype_get_info_ptr(sound_type sndtype, UINT32 state); genf *sndtype_get_info_fct(sound_type sndtype, UINT32 state); const char *sndtype_get_info_string(sound_type sndtype, UINT32 state); -#define sndtype_name(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_NAME) -#define sndtype_core_family(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_CORE_FAMILY) -#define sndtype_core_version(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_CORE_VERSION) -#define sndtype_core_file(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_CORE_FILE) -#define sndtype_core_credits(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_CORE_CREDITS) +#define sndtype_get_name(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_NAME) +#define sndtype_get_core_family(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_CORE_FAMILY) +#define sndtype_get_core_version(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_CORE_VERSION) +#define sndtype_get_core_file(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_CORE_FILE) +#define sndtype_get_core_credits(sndtype) sndtype_get_info_string(sndtype, SNDINFO_STR_CORE_CREDITS) diff --git a/src/emu/sound.c b/src/emu/sound.c index b95dfef6573..e48ccea08d0 100644 --- a/src/emu/sound.c +++ b/src/emu/sound.c @@ -295,15 +295,15 @@ static void start_sound_chips(running_machine *machine) num_regs = state_save_get_reg_count(); streams_set_tag(machine, info); if (sndintrf_init_sound(sndnum, msound->tag, msound->type, msound->clock, msound->config) != 0) - fatalerror("Sound chip #%d (%s) failed to initialize!", sndnum, sndnum_name(sndnum)); + fatalerror("Sound chip #%d (%s) failed to initialize!", sndnum, sndnum_get_name(sndnum)); /* if no state registered for saving, we can't save */ num_regs = state_save_get_reg_count() - num_regs; if (num_regs == 0) { - logerror("Sound chip #%d (%s) did not register any state to save!\n", sndnum, sndnum_name(sndnum)); + logerror("Sound chip #%d (%s) did not register any state to save!\n", sndnum, sndnum_get_name(sndnum)); if (machine->gamedrv->flags & GAME_SUPPORTS_SAVE) - fatalerror("Sound chip #%d (%s) did not register any state to save!", sndnum, sndnum_name(sndnum)); + fatalerror("Sound chip #%d (%s) did not register any state to save!", sndnum, sndnum_get_name(sndnum)); } /* now count the outputs */ @@ -440,7 +440,7 @@ static void route_sound(running_machine *machine) sprintf(namebuf, "%sSpeaker '%s': ", namebuf, speaker->tag); /* device name */ - sprintf(namebuf, "%s%s ", namebuf, sndnum_name(sndnum)); + sprintf(namebuf, "%s%s ", namebuf, sndnum_get_name(sndnum)); /* device index, if more than one of this type */ if (sndtype_count(sndtype) > 1) diff --git a/src/emu/sound/2151intf.c b/src/emu/sound/2151intf.c index 17bf04792dc..45459c42893 100644 --- a/src/emu/sound/2151intf.c +++ b/src/emu/sound/2151intf.c @@ -8,7 +8,6 @@ #include "sndintrf.h" #include "streams.h" -#include "deprecat.h" #include "fm.h" #include "2151intf.h" #include "ym2151.h" @@ -55,7 +54,7 @@ static SND_START( ym2151 ) info->chip = ym2151_init(tag,clock,rate); - state_save_register_postload(Machine, ym2151intf_postload, info); + state_save_register_postload(device->machine, ym2151intf_postload, info); if (info->chip != 0) { @@ -69,13 +68,13 @@ static SND_START( ym2151 ) static SND_STOP( ym2151 ) { - struct ym2151_info *info = token; + struct ym2151_info *info = device->token; ym2151_shutdown(info->chip); } static SND_RESET( ym2151 ) { - struct ym2151_info *info = token; + struct ym2151_info *info = device->token; ym2151_reset_chip(info->chip); } diff --git a/src/emu/sound/2203intf.c b/src/emu/sound/2203intf.c index 4446e14bf3d..1c283cc4ec4 100644 --- a/src/emu/sound/2203intf.c +++ b/src/emu/sound/2203intf.c @@ -137,7 +137,7 @@ static SND_START( ym2203 ) /* Initialize FM emurator */ info->chip = ym2203_init(info,tag,clock,rate,timer_handler,IRQHandler,&psgintf); - state_save_register_postload(Machine, ym2203_intf_postload, info); + state_save_register_postload(device->machine, ym2203_intf_postload, info); if (info->chip) return info; @@ -149,14 +149,14 @@ static SND_START( ym2203 ) static SND_STOP( ym2203 ) { - struct ym2203_info *info = token; + struct ym2203_info *info = device->token; ym2203_shutdown(info->chip); ay8910_stop_ym(info->psg); } static SND_RESET( ym2203 ) { - struct ym2203_info *info = token; + struct ym2203_info *info = device->token; ym2203_reset_chip(info->chip); } diff --git a/src/emu/sound/2413intf.c b/src/emu/sound/2413intf.c index d27de1de7fb..ebd975c6ba2 100644 --- a/src/emu/sound/2413intf.c +++ b/src/emu/sound/2413intf.c @@ -97,13 +97,13 @@ static SND_START( ym2413 ) static SND_STOP( ym2413 ) { - struct ym2413_info *info = token; + struct ym2413_info *info = device->token; ym2413_shutdown(info->chip); } static SND_RESET( ym2413 ) { - struct ym2413_info *info = token; + struct ym2413_info *info = device->token; ym2413_reset_chip(info->chip); } diff --git a/src/emu/sound/2608intf.c b/src/emu/sound/2608intf.c index 3464c87eb34..2bcf5fd5d99 100644 --- a/src/emu/sound/2608intf.c +++ b/src/emu/sound/2608intf.c @@ -151,15 +151,15 @@ static SND_START( ym2608 ) /* stream system initialize */ info->stream = stream_create(0,2,rate,info,ym2608_stream_update); /* setup adpcm buffers */ - pcmbufa = (void *)(memory_region(Machine, tag)); - pcmsizea = memory_region_length(Machine, tag); + pcmbufa = (void *)(memory_region(device->machine, tag)); + pcmsizea = memory_region_length(device->machine, tag); /* initialize YM2608 */ info->chip = ym2608_init(info,tag,clock,rate, pcmbufa,pcmsizea, timer_handler,IRQHandler,&psgintf); - state_save_register_postload(Machine, ym2608_intf_postload, info); + state_save_register_postload(device->machine, ym2608_intf_postload, info); if (info->chip) return info; @@ -170,14 +170,14 @@ static SND_START( ym2608 ) static SND_STOP( ym2608 ) { - struct ym2608_info *info = token; + struct ym2608_info *info = device->token; ym2608_shutdown(info->chip); ay8910_stop_ym(info->psg); } static SND_RESET( ym2608 ) { - struct ym2608_info *info = token; + struct ym2608_info *info = device->token; ym2608_reset_chip(info->chip); } diff --git a/src/emu/sound/2610intf.c b/src/emu/sound/2610intf.c index 42c204b11da..d2935c45d43 100644 --- a/src/emu/sound/2610intf.c +++ b/src/emu/sound/2610intf.c @@ -152,11 +152,11 @@ static SND_START( ym2610 ) /* stream system initialize */ info->stream = stream_create(0,2,rate,info,ym2610_stream_update); /* setup adpcm buffers */ - pcmbufa = (void *)(memory_region(Machine, tag)); - pcmsizea = memory_region_length(Machine, tag); + pcmbufa = (void *)(memory_region(device->machine, tag)); + pcmsizea = memory_region_length(device->machine, tag); astring_printf(name, "%s.deltat", tag); - pcmbufb = (void *)(memory_region(Machine, astring_c(name))); - pcmsizeb = memory_region_length(Machine, astring_c(name)); + pcmbufb = (void *)(memory_region(device->machine, astring_c(name))); + pcmsizeb = memory_region_length(device->machine, astring_c(name)); astring_free(name); if (pcmbufb == NULL || pcmsizeb == 0) { @@ -169,7 +169,7 @@ static SND_START( ym2610 ) pcmbufa,pcmsizea,pcmbufb,pcmsizeb, timer_handler,IRQHandler,&psgintf); - state_save_register_postload(Machine, ym2610_intf_postload, info); + state_save_register_postload(device->machine, ym2610_intf_postload, info); if (info->chip) return info; @@ -218,11 +218,11 @@ static SND_START( ym2610b ) /* stream system initialize */ info->stream = stream_create(0,2,rate,info,ym2610b_stream_update); /* setup adpcm buffers */ - pcmbufa = (void *)(memory_region(Machine, tag)); - pcmsizea = memory_region_length(Machine, tag); + pcmbufa = (void *)(memory_region(device->machine, tag)); + pcmsizea = memory_region_length(device->machine, tag); astring_printf(name, "%s.deltat", tag); - pcmbufb = (void *)(memory_region(Machine, astring_c(name))); - pcmsizeb = memory_region_length(Machine, astring_c(name)); + pcmbufb = (void *)(memory_region(device->machine, astring_c(name))); + pcmsizeb = memory_region_length(device->machine, astring_c(name)); astring_free(name); if (pcmbufb == NULL || pcmsizeb == 0) { @@ -244,14 +244,14 @@ static SND_START( ym2610b ) static SND_STOP( ym2610 ) { - struct ym2610_info *info = token; + struct ym2610_info *info = device->token; ym2610_shutdown(info->chip); ay8910_stop_ym(info->psg); } static SND_RESET( ym2610 ) { - struct ym2610_info *info = token; + struct ym2610_info *info = device->token; ym2610_reset_chip(info->chip); } diff --git a/src/emu/sound/2612intf.c b/src/emu/sound/2612intf.c index dee023aebd9..55ef8f8bda9 100644 --- a/src/emu/sound/2612intf.c +++ b/src/emu/sound/2612intf.c @@ -109,7 +109,7 @@ static SND_START( ym2612 ) /**** initialize YM2612 ****/ info->chip = ym2612_init(info,tag,clock,rate,timer_handler,IRQHandler); - state_save_register_postload(Machine, ym2612_intf_postload, info); + state_save_register_postload(device->machine, ym2612_intf_postload, info); if (info->chip) return info; @@ -120,13 +120,13 @@ static SND_START( ym2612 ) static SND_STOP( ym2612 ) { - struct ym2612_info *info = token; + struct ym2612_info *info = device->token; ym2612_shutdown(info->chip); } static SND_RESET( ym2612 ) { - struct ym2612_info *info = token; + struct ym2612_info *info = device->token; ym2612_reset_chip(info->chip); } diff --git a/src/emu/sound/262intf.c b/src/emu/sound/262intf.c index e4bd4c5a21b..ccfd7c5158e 100644 --- a/src/emu/sound/262intf.c +++ b/src/emu/sound/262intf.c @@ -98,14 +98,14 @@ static SND_START( ymf262 ) static SND_STOP( ymf262 ) { - struct ymf262_info *info = token; + struct ymf262_info *info = device->token; ymf262_shutdown(info->chip); } /* reset */ static SND_RESET( ymf262 ) { - struct ymf262_info *info = token; + struct ymf262_info *info = device->token; ymf262_reset_chip(info->chip); } diff --git a/src/emu/sound/3812intf.c b/src/emu/sound/3812intf.c index 3e706032fba..c9caa94474e 100644 --- a/src/emu/sound/3812intf.c +++ b/src/emu/sound/3812intf.c @@ -110,13 +110,13 @@ static SND_START( ym3812 ) static SND_STOP( ym3812 ) { - struct ym3812_info *info = token; + struct ym3812_info *info = device->token; ym3812_shutdown(info->chip); } static SND_RESET( ym3812 ) { - struct ym3812_info *info = token; + struct ym3812_info *info = device->token; ym3812_reset_chip(info->chip); } @@ -278,13 +278,13 @@ static SND_START( ym3526 ) static SND_STOP( ym3526 ) { - struct ym3526_info *info = token; + struct ym3526_info *info = device->token; ym3526_shutdown(info->chip); } static SND_RESET( ym3526 ) { - struct ym3526_info *info = token; + struct ym3526_info *info = device->token; ym3526_reset_chip(info->chip); } @@ -470,8 +470,8 @@ static SND_START( y8950 ) /* ADPCM ROM data */ y8950_set_delta_t_memory(info->chip, - (void *)(memory_region(Machine, tag)), - memory_region_length(Machine, tag) ); + (void *)(memory_region(device->machine, tag)), + memory_region_length(device->machine, tag) ); info->stream = stream_create(0,1,rate,info,y8950_stream_update); @@ -492,13 +492,13 @@ static SND_START( y8950 ) static SND_STOP( y8950 ) { - struct y8950_info *info = token; + struct y8950_info *info = device->token; y8950_shutdown(info->chip); } static SND_RESET( y8950 ) { - struct y8950_info *info = token; + struct y8950_info *info = device->token; y8950_reset_chip(info->chip); } diff --git a/src/emu/sound/5110intf.c b/src/emu/sound/5110intf.c index d18d79d38eb..b05246d1176 100644 --- a/src/emu/sound/5110intf.c +++ b/src/emu/sound/5110intf.c @@ -84,7 +84,7 @@ static SND_START( tms5110 ) /* initialize a stream */ info->stream = stream_create(0, 1, clock / 80, info, tms5110_update); - if (memory_region(Machine, tag) == NULL) + if (memory_region(device->machine, tag) == NULL) { if (info->intf->M0_callback==NULL) { @@ -158,14 +158,14 @@ static SND_START( m58817 ) static SND_STOP( tms5110 ) { - struct tms5110_info *info = token; + struct tms5110_info *info = device->token; tms5110_destroy(info->chip); } static SND_RESET( tms5110 ) { - struct tms5110_info *info = token; + struct tms5110_info *info = device->token; tms5110_reset_chip(info->chip); } diff --git a/src/emu/sound/5220intf.c b/src/emu/sound/5220intf.c index 61892a6040a..3786370c7a7 100644 --- a/src/emu/sound/5220intf.c +++ b/src/emu/sound/5220intf.c @@ -92,7 +92,7 @@ static SND_START( tms5200 ) static SND_STOP( tms5220 ) { - struct tms5220_info *info = token; + struct tms5220_info *info = device->token; tms5220_destroy(info->chip); } @@ -100,7 +100,7 @@ static SND_STOP( tms5220 ) static SND_RESET( tms5220 ) { - struct tms5220_info *info = token; + struct tms5220_info *info = device->token; tms5220_reset_chip(info->chip); } @@ -240,7 +240,7 @@ void tms5220_set_frequency(int frequency) static SND_SET_INFO( tms5220 ) { - struct tms5220_info *ti = token; + struct tms5220_info *ti = device->token; switch (state) { diff --git a/src/emu/sound/astrocde.c b/src/emu/sound/astrocde.c index b093028f49f..2e21bcd2522 100644 --- a/src/emu/sound/astrocde.c +++ b/src/emu/sound/astrocde.c @@ -196,10 +196,8 @@ static void astrocade_update(void *param, stream_sample_t **inputs, stream_sampl * *************************************/ -static SND_RESET( astrocade ) +static void astrocade_reset(struct astrocade_info *chip) { - struct astrocade_info *chip = token; - memset(chip->reg, 0, sizeof(chip->reg)); chip->master_count = 0; @@ -218,6 +216,10 @@ static SND_RESET( astrocade ) chip->c_state = 0; } +SND_RESET( astrocade ) +{ + astrocade_reset(device->token); +} /************************************* @@ -273,7 +275,7 @@ static SND_START( astrocade ) chip->stream = stream_create(0, 1, clock, chip, astrocade_update); /* reset state */ - SND_RESET_NAME( astrocade )(chip); + astrocade_reset(chip); astrocade_state_save_register(chip, tag); return chip; diff --git a/src/emu/sound/ay8910.c b/src/emu/sound/ay8910.c index 7c479a78464..f7a48294b86 100644 --- a/src/emu/sound/ay8910.c +++ b/src/emu/sound/ay8910.c @@ -846,12 +846,12 @@ static SND_START( ym2149 ) static SND_STOP( ay8910 ) { - ay8910_stop_ym(token); + ay8910_stop_ym(device->token); } static SND_RESET( ay8910 ) { - ay8910_reset_ym(token); + ay8910_reset_ym(device->token); } static SND_SET_INFO( ay8910 ) diff --git a/src/emu/sound/bsmt2000.c b/src/emu/sound/bsmt2000.c index 0f4a3ca4fc9..674a6b62998 100644 --- a/src/emu/sound/bsmt2000.c +++ b/src/emu/sound/bsmt2000.c @@ -14,7 +14,6 @@ #include #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "bsmt2000.h" @@ -86,8 +85,7 @@ struct _bsmt2000_chip ***************************************************************************/ /* core implementation */ -static SND_START( bsmt2000 ); -static SND_RESET( bsmt2000 ); +static void bsmt2000_reset(bsmt2000_chip *chip); static void bsmt2000_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length); /* read/write access */ @@ -121,8 +119,8 @@ static SND_START( bsmt2000 ) chip->clock = clock; /* initialize the regions */ - chip->region_base = (INT8 *)memory_region(Machine, tag); - chip->total_banks = memory_region_length(Machine, tag) / 0x10000; + chip->region_base = (INT8 *)memory_region(device->machine, tag); + chip->total_banks = memory_region_length(device->machine, tag) / 0x10000; /* register chip-wide data for save states */ state_save_register_item("bsmt2000", tag, 0, chip->last_register); @@ -148,7 +146,7 @@ static SND_START( bsmt2000 ) } /* reset the chip -- this also configures the default mode */ - SND_RESET_NAME( bsmt2000 )(chip); + bsmt2000_reset(chip); return chip; } @@ -157,9 +155,8 @@ static SND_START( bsmt2000 ) SND_RESET( bsmt2000 ) - chip reset callback -------------------------------------------------*/ -static SND_RESET( bsmt2000 ) +static void bsmt2000_reset(bsmt2000_chip *chip) { - bsmt2000_chip *chip = token; int voicenum; /* reset all the voice data */ @@ -175,6 +172,11 @@ static SND_RESET( bsmt2000 ) set_mode(chip); } +static SND_RESET( bsmt2000 ) +{ + bsmt2000_reset(device->token); +} + /*------------------------------------------------- bsmt2000_update - update callback for diff --git a/src/emu/sound/c140.c b/src/emu/sound/c140.c index e1b71222ca2..e691b51e744 100644 --- a/src/emu/sound/c140.c +++ b/src/emu/sound/c140.c @@ -45,7 +45,6 @@ Unmapped registers: #include #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "c140.h" @@ -469,7 +468,7 @@ static SND_START( c140 ) info->stream = stream_create(0,2,info->sample_rate,info,update_stereo); - info->pRom=memory_region(Machine, tag); + info->pRom=memory_region(device->machine, tag); /* make decompress pcm table */ //2000.06.26 CAB { diff --git a/src/emu/sound/c352.c b/src/emu/sound/c352.c index 52811bc01c3..13cb9201e67 100644 --- a/src/emu/sound/c352.c +++ b/src/emu/sound/c352.c @@ -15,7 +15,6 @@ #include #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "c352.h" @@ -542,8 +541,8 @@ static SND_START( c352 ) info = auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); - info->c352_rom_samples = memory_region(Machine, tag); - info->c352_rom_length = memory_region_length(Machine, tag); + info->c352_rom_samples = memory_region(device->machine, tag); + info->c352_rom_length = memory_region_length(device->machine, tag); info->sample_rate_base = clock / 192; diff --git a/src/emu/sound/cdp1869.c b/src/emu/sound/cdp1869.c index 9c4702dd09f..b15644cb688 100644 --- a/src/emu/sound/cdp1869.c +++ b/src/emu/sound/cdp1869.c @@ -110,7 +110,7 @@ static SND_START( cdp1869 ) info = auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); - info->stream = stream_create(0, 1, Machine->sample_rate, info, cdp1869_update ); + info->stream = stream_create(0, 1, device->machine->sample_rate, info, cdp1869_update ); info->incr = 0; info->signal = 0x07fff; diff --git a/src/emu/sound/custom.c b/src/emu/sound/custom.c index d6d1025c26b..3bec25d1bc8 100644 --- a/src/emu/sound/custom.c +++ b/src/emu/sound/custom.c @@ -32,7 +32,7 @@ static SND_START( custom ) static SND_STOP( custom ) { - struct custom_info *info = token; + struct custom_info *info = device->token; if (info->intf->stop) (*info->intf->stop)(info->token); } @@ -40,7 +40,7 @@ static SND_STOP( custom ) static SND_RESET( custom ) { - struct custom_info *info = token; + struct custom_info *info = device->token; if (info->intf->reset) (*info->intf->reset)(info->token); } diff --git a/src/emu/sound/discrete.c b/src/emu/sound/discrete.c index 7a539f4c74a..64581f3a482 100644 --- a/src/emu/sound/discrete.c +++ b/src/emu/sound/discrete.c @@ -261,7 +261,7 @@ static SND_START( discrete ) if (clock) info->sample_rate = clock; else - info->sample_rate = Machine->sample_rate; + info->sample_rate = device->machine->sample_rate; info->sample_time = 1.0 / info->sample_rate; info->neg_sample_time = - info->sample_time; @@ -332,7 +332,7 @@ static SND_START( discrete ) static SND_STOP( discrete ) { - discrete_info *info = token; + discrete_info *info = device->token; int log_num; #if (DISCRETE_PROFILING) @@ -392,7 +392,7 @@ static SND_STOP( discrete ) static SND_RESET( discrete ) { - discrete_info *info = token; + discrete_info *info = device->token; int nodenum; discrete_current_context = info; diff --git a/src/emu/sound/es5506.c b/src/emu/sound/es5506.c index 82252aded5a..385095ebfe7 100644 --- a/src/emu/sound/es5506.c +++ b/src/emu/sound/es5506.c @@ -820,7 +820,7 @@ static void es5506_update(void *param, stream_sample_t **inputs, stream_sample_t ***********************************************************************************************/ -static void *es5506_start_common(sound_type sndtype, const char *tag, int sndindex, int clock, const void *config) +static void *es5506_start_common(const device_config *device, const char *tag, int sndindex, int clock, const void *config, sound_type sndtype) { const es5506_interface *intf = config; struct ES5506Chip *chip; @@ -842,10 +842,10 @@ static void *es5506_start_common(sound_type sndtype, const char *tag, int sndind chip->stream = stream_create(0, 2, clock / (16*32), chip, es5506_update); /* initialize the regions */ - chip->region_base[0] = intf->region0 ? (UINT16 *)memory_region(Machine, intf->region0) : NULL; - chip->region_base[1] = intf->region1 ? (UINT16 *)memory_region(Machine, intf->region1) : NULL; - chip->region_base[2] = intf->region2 ? (UINT16 *)memory_region(Machine, intf->region2) : NULL; - chip->region_base[3] = intf->region3 ? (UINT16 *)memory_region(Machine, intf->region3) : NULL; + chip->region_base[0] = intf->region0 ? (UINT16 *)memory_region(device->machine, intf->region0) : NULL; + chip->region_base[1] = intf->region1 ? (UINT16 *)memory_region(device->machine, intf->region1) : NULL; + chip->region_base[2] = intf->region2 ? (UINT16 *)memory_region(device->machine, intf->region2) : NULL; + chip->region_base[3] = intf->region3 ? (UINT16 *)memory_region(device->machine, intf->region3) : NULL; /* initialize the rest of the structure */ chip->master_clock = clock; @@ -874,7 +874,7 @@ static void *es5506_start_common(sound_type sndtype, const char *tag, int sndind static SND_START( es5506 ) { - return es5506_start_common(SOUND_ES5506, tag, sndindex, clock, config); + return es5506_start_common(device, tag, sndindex, clock, config, SOUND_ES5506); } @@ -1511,7 +1511,7 @@ static SND_START( es5505 ) es5506intf.irq_callback = intf->irq_callback; es5506intf.read_port = intf->read_port; - return es5506_start_common(SOUND_ES5505, tag, sndindex, clock, &es5506intf); + return es5506_start_common(device, tag, sndindex, clock, &es5506intf, SOUND_ES5505); } diff --git a/src/emu/sound/es8712.c b/src/emu/sound/es8712.c index 100b87e9849..aeda7c92d25 100644 --- a/src/emu/sound/es8712.c +++ b/src/emu/sound/es8712.c @@ -15,7 +15,6 @@ #include #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "es8712.h" @@ -222,7 +221,7 @@ static SND_START( es8712 ) chip->repeat = 0; chip->bank_offset = 0; - chip->region_base = memory_region(Machine, tag); + chip->region_base = memory_region(device->machine, tag); /* generate the name and create the stream */ chip->stream = stream_create(0, 1, clock, chip, es8712_update); @@ -246,7 +245,7 @@ static SND_START( es8712 ) static SND_RESET( es8712 ) { - struct es8712 *chip = token; + struct es8712 *chip = device->token; if (chip->playing) { diff --git a/src/emu/sound/flt_rc.c b/src/emu/sound/flt_rc.c index 7a5c896f47d..8a83fd95aa5 100644 --- a/src/emu/sound/flt_rc.c +++ b/src/emu/sound/flt_rc.c @@ -88,7 +88,7 @@ static SND_START( filter_rc ) info = auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); - info->stream = stream_create(1, 1, Machine->sample_rate, info, filter_rc_update); + info->stream = stream_create(1, 1, device->machine->sample_rate, info, filter_rc_update); if (conf) set_RC_info(info, conf->type, conf->R1, conf->R2, conf->R3, conf->C); else diff --git a/src/emu/sound/flt_vol.c b/src/emu/sound/flt_vol.c index 7b758c44de6..6a2baeed350 100644 --- a/src/emu/sound/flt_vol.c +++ b/src/emu/sound/flt_vol.c @@ -1,6 +1,5 @@ #include "sndintrf.h" #include "streams.h" -#include "deprecat.h" #include "flt_vol.h" @@ -31,7 +30,7 @@ static SND_START( filter_volume ) memset(info, 0, sizeof(*info)); info->gain = 0x100; - info->stream = stream_create(1, 1, Machine->sample_rate, info, filter_volume_update); + info->stream = stream_create(1, 1, device->machine->sample_rate, info, filter_volume_update); return info; } diff --git a/src/emu/sound/hc55516.c b/src/emu/sound/hc55516.c index e27106806b2..d614ce35d8a 100644 --- a/src/emu/sound/hc55516.c +++ b/src/emu/sound/hc55516.c @@ -110,7 +110,8 @@ static SND_START( mc3418 ) static SND_RESET( hc55516 ) { - ((struct hc55516_data *)token)->last_clock_state = 0; + struct hc55516_data *chip = device->token; + chip->last_clock_state = 0; } diff --git a/src/emu/sound/ics2115.c b/src/emu/sound/ics2115.c index 4af798645d2..107f7a40f88 100644 --- a/src/emu/sound/ics2115.c +++ b/src/emu/sound/ics2115.c @@ -450,7 +450,7 @@ static SND_START( ics2115 ) chip->intf = config; chip->index = sndindex; - chip->rom = memory_region(Machine, tag); + chip->rom = memory_region(device->machine, tag); chip->timer[0].timer = timer_alloc(Machine, timer_cb_0, chip); chip->timer[1].timer = timer_alloc(Machine, timer_cb_1, chip); chip->ulaw = auto_malloc(256*sizeof(INT16)); @@ -521,7 +521,7 @@ WRITE8_HANDLER( ics2115_w ) static SND_RESET( ics2115 ) { - struct ics2115 *chip = token; + struct ics2115 *chip = device->token; chip->irq_en = 0; chip->irq_pend = 0; memset(chip->voice, 0, sizeof(chip->voice)); diff --git a/src/emu/sound/iremga20.c b/src/emu/sound/iremga20.c index 6a9fd9cd55c..10085a62d63 100644 --- a/src/emu/sound/iremga20.c +++ b/src/emu/sound/iremga20.c @@ -27,7 +27,6 @@ Revisions: *********************************************************/ #include #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "iremga20.h" @@ -206,9 +205,8 @@ READ16_HANDLER( irem_ga20_r ) return 0; } -static SND_RESET( iremga20 ) +static void iremga20_reset(struct IremGA20_chip_def *chip) { - struct IremGA20_chip_def *chip = token; int i; for( i = 0; i < 4; i++ ) { @@ -226,6 +224,11 @@ static SND_RESET( iremga20 ) } +static SND_RESET( iremga20 ) +{ + iremga20_reset(device->token); +} + static SND_START( iremga20 ) { struct IremGA20_chip_def *chip; @@ -235,10 +238,10 @@ static SND_START( iremga20 ) memset(chip, 0, sizeof(*chip)); /* Initialize our chip structure */ - chip->rom = memory_region(Machine, tag); - chip->rom_size = memory_region_length(Machine, tag); + chip->rom = memory_region(device->machine, tag); + chip->rom_size = memory_region_length(device->machine, tag); - SND_RESET_NAME( iremga20 )(chip); + iremga20_reset(chip); for ( i = 0; i < 0x40; i++ ) chip->regs[i] = 0; diff --git a/src/emu/sound/k005289.c b/src/emu/sound/k005289.c index 0948641a29c..02147d3fd42 100644 --- a/src/emu/sound/k005289.c +++ b/src/emu/sound/k005289.c @@ -26,7 +26,6 @@ ***************************************************************************/ #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "k005289.h" @@ -172,7 +171,7 @@ static SND_START( k005289 ) if (make_mixer_table(info, 2)) return NULL; - info->sound_prom = memory_region(Machine, tag); + info->sound_prom = memory_region(device->machine, tag); /* reset all the voices */ voice[0].frequency = 0; diff --git a/src/emu/sound/k007232.c b/src/emu/sound/k007232.c index 2ce52742492..1c1b6c02f7e 100644 --- a/src/emu/sound/k007232.c +++ b/src/emu/sound/k007232.c @@ -24,7 +24,6 @@ added external port callback, and functions to set the volume of the channels #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "k007232.h" #include @@ -307,9 +306,9 @@ static SND_START( k007232 ) /* Set up the chips */ - info->pcmbuf[0] = (unsigned char *)memory_region(Machine, tag); - info->pcmbuf[1] = (unsigned char *)memory_region(Machine, tag); - info->pcmlimit = (unsigned int)memory_region_length(Machine, tag); + info->pcmbuf[0] = (unsigned char *)memory_region(device->machine, tag); + info->pcmbuf[1] = (unsigned char *)memory_region(device->machine, tag); + info->pcmlimit = (unsigned int)memory_region_length(device->machine, tag); info->clock = clock; diff --git a/src/emu/sound/k051649.c b/src/emu/sound/k051649.c index 58d142d4ca0..084ff0b1323 100644 --- a/src/emu/sound/k051649.c +++ b/src/emu/sound/k051649.c @@ -151,7 +151,7 @@ static SND_START( k051649 ) static SND_RESET( k051649 ) { - struct k051649_info *info = token; + struct k051649_info *info = device->token; k051649_sound_channel *voice = info->channel_list; int i; diff --git a/src/emu/sound/k053260.c b/src/emu/sound/k053260.c index dc9eece9324..c6ffe1e64c6 100644 --- a/src/emu/sound/k053260.c +++ b/src/emu/sound/k053260.c @@ -64,8 +64,7 @@ static void InitDeltaTable( struct k053260_chip_def *ic, int rate, int clock ) { } } -static SND_RESET( k053260 ) { - struct k053260_chip_def *ic = token; +static void k053260_reset(struct k053260_chip_def *ic) { int i; for( i = 0; i < 4; i++ ) { @@ -83,6 +82,11 @@ static SND_RESET( k053260 ) { } } +static SND_RESET( k053260 ) { + k053260_reset(device->token); +} + + INLINE int limit( int val, int max, int min ) { if ( val > max ) val = max; @@ -208,10 +212,10 @@ static SND_START( k053260 ) ic->intf = (config != NULL) ? config : &defintrf; ic->mode = 0; - ic->rom = memory_region(Machine, (ic->intf->rgnoverride != NULL) ? ic->intf->rgnoverride : tag); - ic->rom_size = memory_region_length(Machine, (ic->intf->rgnoverride != NULL) ? ic->intf->rgnoverride : tag) - 1; + ic->rom = memory_region(device->machine, (ic->intf->rgnoverride != NULL) ? ic->intf->rgnoverride : tag); + ic->rom_size = memory_region_length(device->machine, (ic->intf->rgnoverride != NULL) ? ic->intf->rgnoverride : tag) - 1; - SND_RESET_NAME( k053260 )( ic ); + k053260_reset( ic ); for ( i = 0; i < 0x30; i++ ) ic->regs[i] = 0; diff --git a/src/emu/sound/k054539.c b/src/emu/sound/k054539.c index dcc43462f8d..f7ead552d1a 100644 --- a/src/emu/sound/k054539.c +++ b/src/emu/sound/k054539.c @@ -664,7 +664,7 @@ static SND_START( k054539 ) k054539_init_chip(tag, info, clock, sndindex); - state_save_register_postload(Machine, reset_zones, info); + state_save_register_postload(device->machine, reset_zones, info); return info; } diff --git a/src/emu/sound/msm5205.c b/src/emu/sound/msm5205.c index 033904b32b9..1a01d8f92bc 100644 --- a/src/emu/sound/msm5205.c +++ b/src/emu/sound/msm5205.c @@ -147,10 +147,8 @@ static TIMER_CALLBACK( MSM5205_vclk_callback ) /* * Reset emulation of an MSM5205-compatible chip */ -static SND_RESET( msm5205 ) +static void msm5205_reset(struct MSM5205Voice *voice) { - struct MSM5205Voice *voice = token; - /* initialize work */ voice->data = 0; voice->vclk = 0; @@ -161,6 +159,12 @@ static SND_RESET( msm5205 ) msm5205_playmode_w(voice->index,voice->intf->select); } + +static SND_RESET( msm5205 ) +{ + msm5205_reset(device->token); +} + /* * Start emulation of an MSM5205-compatible chip */ @@ -186,7 +190,7 @@ static SND_START( msm5205 ) voice->timer = timer_alloc(Machine, MSM5205_vclk_callback, voice); /* initialize */ - SND_RESET_NAME( msm5205 )(voice); + msm5205_reset(voice); /* register for save states */ state_save_register_item("msm5205", tag, 0, voice->clock); diff --git a/src/emu/sound/msm5232.c b/src/emu/sound/msm5232.c index 8b14a5c8fde..4d841a07b9e 100644 --- a/src/emu/sound/msm5232.c +++ b/src/emu/sound/msm5232.c @@ -265,9 +265,8 @@ static void msm5232_gate_update(MSM5232 *chip) } -static SND_RESET( msm5232 ) +static void msm5232_reset(MSM5232 *chip) { - MSM5232 *chip = token; int i; for (i=0; i<8; i++) @@ -294,6 +293,11 @@ static SND_RESET( msm5232 ) msm5232_gate_update(chip); } +static SND_RESET( msm5232 ) +{ + msm5232_reset(device->token); +} + static void msm5232_init(MSM5232 *chip, const msm5232_interface *intf, int clock, int rate) { int j; @@ -315,7 +319,7 @@ static void msm5232_init(MSM5232 *chip, const msm5232_interface *intf, int clock memset(&chip->voi[j],0,sizeof(VOICE)); msm5232_init_voice(chip,j); } - SND_RESET_NAME( msm5232 )( chip ); + msm5232_reset( chip ); } static void msm5232_shutdown(void *chip) @@ -791,7 +795,7 @@ static SND_START( msm5232 ) static SND_STOP( msm5232 ) { - msm5232_shutdown(token); + msm5232_shutdown(device->token); } WRITE8_HANDLER ( msm5232_0_w ) diff --git a/src/emu/sound/multipcm.c b/src/emu/sound/multipcm.c index de63b07d1ce..15e22d3dfb2 100644 --- a/src/emu/sound/multipcm.c +++ b/src/emu/sound/multipcm.c @@ -33,7 +33,6 @@ #include #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "multipcm.h" @@ -494,7 +493,7 @@ static SND_START( multipcm ) ptChip=(struct _MultiPCM *)auto_malloc(sizeof(struct _MultiPCM)); - ptChip->ROM=(INT8 *)memory_region(Machine, tag); + ptChip->ROM=(INT8 *)memory_region(device->machine, tag); ptChip->Rate=(float) clock / MULTIPCM_CLOCKDIV; ptChip->stream = stream_create(0, 2, ptChip->Rate, ptChip, MultiPCM_update); diff --git a/src/emu/sound/n63701x.c b/src/emu/sound/n63701x.c index 3631ccf7d34..cab09b7afe4 100644 --- a/src/emu/sound/n63701x.c +++ b/src/emu/sound/n63701x.c @@ -14,7 +14,6 @@ silence compression: '00 nn' must be replaced by nn+1 times '80'. ***************************************************************************/ #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "n63701x.h" @@ -107,7 +106,7 @@ static SND_START( namco_63701x ) chip = auto_malloc(sizeof(*chip)); memset(chip, 0, sizeof(*chip)); - chip->rom = memory_region(Machine, tag); + chip->rom = memory_region(device->machine, tag); chip->stream = stream_create(0, 2, clock/1000, chip, namco_63701x_update); diff --git a/src/emu/sound/namco52.c b/src/emu/sound/namco52.c index 777c257ce2c..ec0b089f78b 100644 --- a/src/emu/sound/namco52.c +++ b/src/emu/sound/namco52.c @@ -46,7 +46,6 @@ Jan 12, 2005. The 555 is probably an external playback frequency. ***************************************************************************/ #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "filter.h" #include "namco52.h" @@ -70,7 +69,7 @@ struct namco_52xx filter2_context n52_lp_filter; }; -static SND_RESET( namco_52xx ); +static void namco_52xx_reset(struct namco_52xx *chip); static void namco_52xx_stream_update_one(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length) @@ -100,7 +99,7 @@ static void namco_52xx_stream_update_one(void *param, stream_sample_t **inputs, /* sample done */ memset(&buffer[i], 0, (length - i) * sizeof(INT16)); i = length; - SND_RESET_NAME( namco_52xx )(chip); + namco_52xx_reset(chip); } else { @@ -120,16 +119,19 @@ static void namco_52xx_stream_update_one(void *param, stream_sample_t **inputs, } } - -static SND_RESET( namco_52xx ) +static void namco_52xx_reset(struct namco_52xx *chip) { - struct namco_52xx *chip = token; chip->n52_pb_cycle = chip->n52_start = chip->n52_end = chip->n52_length = chip->n52_pos = 0; filter2_reset(&chip->n52_hp_filter); filter2_reset(&chip->n52_lp_filter); } +static SND_RESET( namco_52xx ) +{ + namco_52xx_reset(device->token); +} + static SND_START( namco_52xx ) { struct namco_52xx *chip; @@ -139,8 +141,8 @@ static SND_START( namco_52xx ) memset(chip, 0, sizeof(*chip)); chip->intf = config; - chip->rom = memory_region(Machine, tag); - chip->rom_len = memory_region_length(Machine, tag); + chip->rom = memory_region(device->machine, tag); + chip->rom_len = memory_region_length(device->machine, tag); if (chip->intf->play_rate == 0) { @@ -157,7 +159,7 @@ static SND_START( namco_52xx ) chip->stream = stream_create(0, 1, rate, chip, namco_52xx_stream_update_one); - SND_RESET_NAME( namco_52xx )(chip); + namco_52xx_reset(chip); state_save_register_item("namco52xx", tag, 0, chip->n52_pb_cycle); state_save_register_item("namco52xx", tag, 0, chip->n52_step); diff --git a/src/emu/sound/nes_apu.c b/src/emu/sound/nes_apu.c index 852b553f957..1f46add2994 100644 --- a/src/emu/sound/nes_apu.c +++ b/src/emu/sound/nes_apu.c @@ -47,7 +47,6 @@ #include "sndintrf.h" #include "cpuexec.h" #include "streams.h" -#include "deprecat.h" #include "nes_apu.h" #include "cpu/m6502/m6502.h" @@ -681,9 +680,9 @@ static SND_START( nesapu ) memset(info, 0, sizeof(*info)); /* Initialize global variables */ - info->samps_per_sync = rate / ATTOSECONDS_TO_HZ(video_screen_get_frame_period(Machine->primary_screen).attoseconds); + info->samps_per_sync = rate / ATTOSECONDS_TO_HZ(video_screen_get_frame_period(device->machine->primary_screen).attoseconds); info->buffer_size = info->samps_per_sync; - info->real_rate = info->samps_per_sync * ATTOSECONDS_TO_HZ(video_screen_get_frame_period(Machine->primary_screen).attoseconds); + info->real_rate = info->samps_per_sync * ATTOSECONDS_TO_HZ(video_screen_get_frame_period(device->machine->primary_screen).attoseconds); info->apu_incsize = (float) (clock / (float) info->real_rate); /* Use initializer calls */ @@ -695,7 +694,7 @@ static SND_START( nesapu ) info->buffer_size+=info->samps_per_sync; /* Initialize individual chips */ - (info->APU.dpcm).memory = cputag_get_address_space(Machine, intf->cpu_tag, ADDRESS_SPACE_PROGRAM); + (info->APU.dpcm).memory = cputag_get_address_space(device->machine, intf->cpu_tag, ADDRESS_SPACE_PROGRAM); info->stream = stream_create(0, 1, rate, info, nes_psg_update_sound); diff --git a/src/emu/sound/nile.c b/src/emu/sound/nile.c index 2c3e6aead5c..53f25972232 100644 --- a/src/emu/sound/nile.c +++ b/src/emu/sound/nile.c @@ -29,7 +29,6 @@ #include "streams.h" #include "cpuintrf.h" #include "nile.h" -#include "deprecat.h" #define NILE_VOICES 8 @@ -224,7 +223,7 @@ static SND_START( nile ) info = auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); - info->sound_ram = (UINT8 *)memory_region(Machine, tag); + info->sound_ram = (UINT8 *)memory_region(device->machine, tag); info->stream = stream_create(0, 2, 44100, info, nile_update); diff --git a/src/emu/sound/okim6258.c b/src/emu/sound/okim6258.c index ced86e6d77e..9b6fbb1abb3 100644 --- a/src/emu/sound/okim6258.c +++ b/src/emu/sound/okim6258.c @@ -12,7 +12,6 @@ #include #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "okim6258.h" @@ -219,7 +218,7 @@ static SND_START( okim6258 ) static SND_RESET( okim6258 ) { - struct okim6258 *info = token; + struct okim6258 *info = device->token; stream_update(info->stream); diff --git a/src/emu/sound/okim6295.c b/src/emu/sound/okim6295.c index 40a00481e7d..37e92381adf 100644 --- a/src/emu/sound/okim6295.c +++ b/src/emu/sound/okim6295.c @@ -24,7 +24,6 @@ #include #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "okim6295.h" @@ -332,7 +331,7 @@ static SND_START( okim6295 ) info->command = -1; info->bank_offset = 0; - info->region_base = memory_region(Machine, (intf->rgnoverride != NULL) ? intf->rgnoverride : tag); + info->region_base = memory_region(device->machine, (intf->rgnoverride != NULL) ? intf->rgnoverride : tag); info->master_clock = clock; @@ -363,7 +362,7 @@ static SND_START( okim6295 ) static SND_RESET( okim6295 ) { - struct okim6295 *info = token; + struct okim6295 *info = device->token; int i; stream_update(info->stream); diff --git a/src/emu/sound/qsound.c b/src/emu/sound/qsound.c index be43c8fa130..a5cc85c2ce8 100644 --- a/src/emu/sound/qsound.c +++ b/src/emu/sound/qsound.c @@ -33,7 +33,6 @@ #include #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "qsound.h" @@ -101,8 +100,8 @@ static SND_START( qsound ) chip = auto_malloc(sizeof(*chip)); memset(chip, 0, sizeof(*chip)); - chip->sample_rom = (QSOUND_SRC_SAMPLE *)memory_region(Machine, tag); - chip->sample_rom_length = memory_region_length(Machine, tag); + chip->sample_rom = (QSOUND_SRC_SAMPLE *)memory_region(device->machine, tag); + chip->sample_rom_length = memory_region_length(device->machine, tag); memset(chip->channel, 0, sizeof(chip->channel)); @@ -155,7 +154,7 @@ static SND_START( qsound ) static SND_STOP( qsound ) { - struct qsound_info *chip = token; + struct qsound_info *chip = device->token; if (chip->fpRawDataR) { fclose(chip->fpRawDataR); diff --git a/src/emu/sound/s14001a.c b/src/emu/sound/s14001a.c index cf055b30879..7e7e1f86832 100644 --- a/src/emu/sound/s14001a.c +++ b/src/emu/sound/s14001a.c @@ -230,7 +230,6 @@ and off as it normally does during speech). Once START has gone low-high-low, th #include "sndintrf.h" #include "streams.h" -#include "deprecat.h" #include "s14001a.h" typedef struct @@ -575,9 +574,9 @@ static SND_START( s14001a ) chip->filtervals[i] = SILENCE; } - chip->SpeechRom = memory_region(Machine, tag); + chip->SpeechRom = memory_region(device->machine, tag); - chip->stream = stream_create(0, 1, clock ? clock : Machine->sample_rate, chip, s14001a_pcm_update); + chip->stream = stream_create(0, 1, clock ? clock : device->machine->sample_rate, chip, s14001a_pcm_update); return chip; } diff --git a/src/emu/sound/samples.c b/src/emu/sound/samples.c index 5141d5b5105..82510b176b7 100644 --- a/src/emu/sound/samples.c +++ b/src/emu/sound/samples.c @@ -541,7 +541,7 @@ static SND_START( samples ) /* read audio samples */ if (intf->samplenames) - info->samples = readsamples(intf->samplenames,Machine->gamedrv->name); + info->samples = readsamples(intf->samplenames,device->machine->gamedrv->name); /* allocate channels */ info->numchannels = intf->channels; @@ -549,7 +549,7 @@ static SND_START( samples ) info->channel = auto_malloc(sizeof(*info->channel) * info->numchannels); for (i = 0; i < info->numchannels; i++) { - info->channel[i].stream = stream_create(0, 1, Machine->sample_rate, &info->channel[i], sample_update_sound); + info->channel[i].stream = stream_create(0, 1, device->machine->sample_rate, &info->channel[i], sample_update_sound); info->channel[i].source = NULL; info->channel[i].source_num = -1; @@ -566,7 +566,7 @@ static SND_START( samples ) state_save_register_item("samples", tag, i, info->channel[i].loop); state_save_register_item("samples", tag, i, info->channel[i].paused); } - state_save_register_postload(Machine, samples_postload, info); + state_save_register_postload(device->machine, samples_postload, info); /* initialize any custom handlers */ if (intf->start) diff --git a/src/emu/sound/segapcm.c b/src/emu/sound/segapcm.c index ab2c42bcc73..06d91e8f21e 100644 --- a/src/emu/sound/segapcm.c +++ b/src/emu/sound/segapcm.c @@ -3,7 +3,6 @@ /*********************************************************/ #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "segapcm.h" @@ -86,7 +85,7 @@ static SND_START( segapcm ) spcm = auto_malloc(sizeof(*spcm)); memset(spcm, 0, sizeof(*spcm)); - spcm->rom = (const UINT8 *)memory_region(Machine, tag); + spcm->rom = (const UINT8 *)memory_region(device->machine, tag); spcm->ram = auto_malloc(0x800); memset(spcm->ram, 0xff, 0x800); @@ -96,7 +95,7 @@ static SND_START( segapcm ) if(!mask) mask = BANK_MASK7>>16; - len = memory_region_length(Machine, tag); + len = memory_region_length(device->machine, tag); for(rom_mask = 1; rom_mask < len; rom_mask *= 2); rom_mask--; diff --git a/src/emu/sound/sid6581.c b/src/emu/sound/sid6581.c index 07778d24ec6..59f6aa8ec74 100644 --- a/src/emu/sound/sid6581.c +++ b/src/emu/sound/sid6581.c @@ -53,7 +53,7 @@ static void *sid_start(const char *tag, int sndindex, int clock, const void *con static SND_RESET( sid ) { - SID6581 *sid = (SID6581 *) token; + SID6581 *sid = device->token; sidEmuReset(sid); } diff --git a/src/emu/sound/sn76477.c b/src/emu/sound/sn76477.c index 3aac55fc402..f67dfea8ef5 100644 --- a/src/emu/sound/sn76477.c +++ b/src/emu/sound/sn76477.c @@ -30,7 +30,6 @@ #include /* for pow() */ #include "sndintrf.h" #include "streams.h" -#include "deprecat.h" #include "wavwrite.h" #include "sn76477.h" @@ -2405,7 +2404,7 @@ static SND_START( sn76477 ) sn->tag = tag; - sn->channel = stream_create(0, 1, Machine->sample_rate, sn, SN76477_update); + sn->channel = stream_create(0, 1, device->machine->sample_rate, sn, SN76477_update); if (clock > 0) { @@ -2413,7 +2412,7 @@ static SND_START( sn76477 ) } else { - sn->sample_rate = Machine->sample_rate; + sn->sample_rate = device->machine->sample_rate; } intialize_noise(sn); @@ -2464,7 +2463,7 @@ static SND_START( sn76477 ) static SND_STOP( sn76477 ) { - struct SN76477 *sn = (struct SN76477 *)token; + struct SN76477 *sn = device->token; if (LOG_WAV) close_wav_file(sn); diff --git a/src/emu/sound/sp0256.c b/src/emu/sound/sp0256.c index 92a577d2bcf..e9a0cc95252 100644 --- a/src/emu/sound/sp0256.c +++ b/src/emu/sound/sp0256.c @@ -33,7 +33,6 @@ #include #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "cpuintrf.h" #include "sp0256.h" @@ -1206,7 +1205,7 @@ static SND_START( sp0256 ) /* -------------------------------------------------------------------- */ /* Setup the ROM. */ /* -------------------------------------------------------------------- */ - sp->rom = memory_region(Machine, tag); + sp->rom = memory_region(device->machine, tag); sp0256_bitrevbuff(sp->rom, 0, 0xffff); return sp; @@ -1214,14 +1213,12 @@ static SND_START( sp0256 ) static SND_STOP( sp0256 ) { - struct sp0256 *sp = token; + struct sp0256 *sp = device->token; free( sp->scratch ); } -static SND_RESET( sp0256 ) +static void sp0256_reset(struct sp0256 *sp) { - struct sp0256 *sp = token; - /* ---------------------------------------------------------------- */ /* Reset the FIFO and SP0256. */ /* ---------------------------------------------------------------- */ @@ -1243,6 +1240,11 @@ static SND_RESET( sp0256 ) SET_SBY(ASSERT_LINE) } +static SND_RESET( sp0256 ) +{ + sp0256_reset(device->token); +} + WRITE8_HANDLER( sp0256_ALD_w ) { struct sp0256 *sp = sndti_token(SOUND_SP0256, 0); @@ -1314,7 +1316,7 @@ WRITE16_HANDLER( spb640_w ) if (data & 0x400) { sp->fifo_head = sp->fifo_tail = sp->fifo_bitp = 0; - SND_RESET_NAME( sp0256 )(sp); + sp0256_reset(sp); return; } diff --git a/src/emu/sound/speaker.c b/src/emu/sound/speaker.c index 399353bd865..264f19677b6 100644 --- a/src/emu/sound/speaker.c +++ b/src/emu/sound/speaker.c @@ -9,7 +9,6 @@ #include "sndintrf.h" #include "streams.h" -#include "deprecat.h" #include "speaker.h" static const INT16 default_levels[2] = {0,32767}; @@ -40,7 +39,7 @@ static SND_START( speaker ) { struct speaker *sp = auto_malloc(sizeof(*sp)); - sp->channel = stream_create(0, 1, Machine->sample_rate, sp, speaker_sound_update); + sp->channel = stream_create(0, 1, device->machine->sample_rate, sp, speaker_sound_update); sp->num_levels = 2; sp->levels = default_levels; sp->level = 0; diff --git a/src/emu/sound/tiaintf.c b/src/emu/sound/tiaintf.c index 9ea3166d1b8..07a9bb69516 100644 --- a/src/emu/sound/tiaintf.c +++ b/src/emu/sound/tiaintf.c @@ -35,7 +35,7 @@ static SND_START( tia ) static SND_STOP( tia ) { - struct tia_info *info = (struct tia_info*)token; + struct tia_info *info = device->token; tia_sound_free(info->chip); } diff --git a/src/emu/sound/upd7759.c b/src/emu/sound/upd7759.c index 270ad58e6fc..140835fc510 100644 --- a/src/emu/sound/upd7759.c +++ b/src/emu/sound/upd7759.c @@ -552,9 +552,8 @@ static TIMER_CALLBACK( upd7759_slave_update ) *************************************************************/ -static SND_RESET( upd7759 ) +static void upd7759_reset(struct upd7759_chip *chip) { - struct upd7759_chip *chip = token; chip->pos = 0; chip->fifo_in = 0; chip->drq = 0; @@ -581,6 +580,12 @@ static SND_RESET( upd7759 ) } +static SND_RESET( upd7759 ) +{ + upd7759_reset(device->token); +} + + static STATE_POSTLOAD( upd7759_postload ) { struct upd7759_chip *chip = (struct upd7759_chip *)param; @@ -643,7 +648,7 @@ static SND_START( upd7759 ) chip->state = STATE_IDLE; /* compute the ROM base or allocate a timer */ - chip->rom = chip->rombase = memory_region(Machine, tag); + chip->rom = chip->rombase = memory_region(device->machine, tag); if (chip->rom == NULL) chip->timer = timer_alloc(Machine, upd7759_slave_update, chip); @@ -655,7 +660,7 @@ static SND_START( upd7759 ) chip->start = 1; /* toggle the reset line to finish the reset */ - SND_RESET_NAME( upd7759 )(chip); + upd7759_reset(chip); register_for_save(chip, tag); @@ -682,7 +687,7 @@ void upd7759_reset_w(int which, UINT8 data) /* on the falling edge, reset everything */ if (oldreset && !chip->reset) - SND_RESET_NAME( upd7759 )(chip); + upd7759_reset(chip); } void upd7759_start_w(int which, UINT8 data) diff --git a/src/emu/sound/vlm5030.c b/src/emu/sound/vlm5030.c index c38bed71616..d1129a548d5 100644 --- a/src/emu/sound/vlm5030.c +++ b/src/emu/sound/vlm5030.c @@ -494,9 +494,8 @@ static STATE_POSTLOAD( vlm5030_restore_state ) } -static SND_RESET( vlm5030 ) +static void vlm5030_reset(struct vlm5030_info *chip) { - struct vlm5030_info *chip = token; chip->phase = PH_RESET; chip->address = 0; chip->vcu_addr_h = 0; @@ -516,6 +515,12 @@ static SND_RESET( vlm5030 ) vlm5030_setup_parameter(chip, 0x00); } +static SND_RESET( vlm5030 ) +{ + vlm5030_reset(device->token); +} + + /* set speech rom address */ void vlm5030_set_rom(void *speech_rom) { @@ -557,7 +562,7 @@ void vlm5030_rst (int pin ) chip->pin_RST = 1; if( chip->pin_BSY ) { - SND_RESET_NAME( vlm5030 )(chip); + vlm5030_reset(chip); } } } @@ -649,13 +654,13 @@ static SND_START( vlm5030 ) chip->pin_RST = chip->pin_ST = chip->pin_VCU= 0; chip->latch_data = 0; - SND_RESET_NAME( vlm5030 )(chip); + vlm5030_reset(chip); chip->phase = PH_IDLE; - chip->rom = memory_region(Machine, tag); + chip->rom = memory_region(device->machine, tag); /* memory size */ if( chip->intf->memory_size == 0) - chip->address_mask = memory_region_length(Machine, tag)-1; + chip->address_mask = memory_region_length(device->machine, tag)-1; else chip->address_mask = chip->intf->memory_size-1; @@ -682,7 +687,7 @@ static SND_START( vlm5030 ) state_save_register_item(VLM_NAME,tag,0,chip->target_pitch); state_save_register_item_array(VLM_NAME,tag,0,chip->target_k); state_save_register_item_array(VLM_NAME,tag,0,chip->x); - state_save_register_postload(Machine, vlm5030_restore_state, chip); + state_save_register_postload(device->machine, vlm5030_restore_state, chip); return chip; } diff --git a/src/emu/sound/votrax.c b/src/emu/sound/votrax.c index a9144b8a3c4..71c581017ee 100644 --- a/src/emu/sound/votrax.c +++ b/src/emu/sound/votrax.c @@ -108,10 +108,10 @@ static SND_START( votrax ) memset(votrax, 0, sizeof(*votrax)); votrax->samples = readsamples(VotraxTable,"votrax"); - votrax->frequency = 8000; - votrax->volume = 230; + votrax->frequency = 8000; + votrax->volume = 230; - votrax->channel = stream_create(0, 1, Machine->sample_rate, votrax, votrax_update_sound); + votrax->channel = stream_create(0, 1, device->machine->sample_rate, votrax, votrax_update_sound); votrax->sample = NULL; votrax->step = 0; diff --git a/src/emu/sound/wave.c b/src/emu/sound/wave.c index 35491a34449..c9fc9d7cc81 100644 --- a/src/emu/sound/wave.c +++ b/src/emu/sound/wave.c @@ -62,9 +62,9 @@ static SND_START( wave ) const device_config *image = NULL; #ifdef MESS - image = device_list_find_by_tag( Machine->config->devicelist, CASSETTE, tag ); + image = device_list_find_by_tag( device->machine->config->devicelist, CASSETTE, tag ); #endif - stream_create(0, 1, Machine->sample_rate, (void *)image, wave_sound_update); + stream_create(0, 1, device->machine->sample_rate, (void *)image, wave_sound_update); return (void *) (FPTR)(sndindex | WAVE_TOKEN_MASK); } diff --git a/src/emu/sound/ymf271.c b/src/emu/sound/ymf271.c index e3e3286beaf..b187ba50d46 100644 --- a/src/emu/sound/ymf271.c +++ b/src/emu/sound/ymf271.c @@ -1757,7 +1757,7 @@ static SND_START( ymf271 ) intf = (config != NULL) ? config : &defintrf; - ymf271_init(chip, memory_region(Machine, tag), intf->irq_callback, intf->ext_read, intf->ext_write); + ymf271_init(chip, memory_region(device->machine, tag), intf->irq_callback, intf->ext_read, intf->ext_write); chip->stream = stream_create(0, 2, clock/384, chip, ymf271_update); for (i = 0; i < 256; i++) @@ -1801,7 +1801,7 @@ WRITE8_HANDLER( ymf271_1_w ) static SND_RESET( ymf271 ) { int i; - YMF271Chip *chip = (YMF271Chip*)token; + YMF271Chip *chip = device->token; for (i = 0; i < 48; i++) { diff --git a/src/emu/sound/ymf278b.c b/src/emu/sound/ymf278b.c index 3a3ceaa0156..543c1478d19 100644 --- a/src/emu/sound/ymf278b.c +++ b/src/emu/sound/ymf278b.c @@ -59,7 +59,6 @@ #include #include "sndintrf.h" -#include "deprecat.h" #include "streams.h" #include "cpuintrf.h" #include "ymf278b.h" @@ -655,12 +654,12 @@ static void ymf278b_data_port_C_w(int num, UINT8 data) ymf278b_C_w(chip, chip->port_C, data); } -static void ymf278b_init(YMF278BChip *chip, UINT8 *rom, void (*cb)(running_machine *, int), int clock) +static void ymf278b_init(running_machine *machine, YMF278BChip *chip, UINT8 *rom, void (*cb)(running_machine *, int), int clock) { chip->rom = rom; chip->irq_callback = cb; - chip->timer_a = timer_alloc(Machine, ymf278b_timer_a_tick, chip); - chip->timer_b = timer_alloc(Machine, ymf278b_timer_b_tick, chip); + chip->timer_a = timer_alloc(machine, ymf278b_timer_a_tick, chip); + chip->timer_b = timer_alloc(machine, ymf278b_timer_b_tick, chip); chip->irq_line = CLEAR_LINE; chip->clock = clock; @@ -680,7 +679,7 @@ static SND_START( ymf278b ) intf = (config != NULL) ? config : &defintrf; - ymf278b_init(chip, memory_region(Machine, tag), intf->irq_callback, clock); + ymf278b_init(device->machine, chip, memory_region(device->machine, tag), intf->irq_callback, clock); chip->stream = stream_create(0, 2, clock/768, chip, ymf278b_pcm_update); // Volume table, 1 = -0.375dB, 8 = -3dB, 256 = -96dB diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c index 0dd5ed5d4cf..be5d3889f50 100644 --- a/src/emu/sound/ymz280b.c +++ b/src/emu/sound/ymz280b.c @@ -644,7 +644,7 @@ static SND_START( ymz280b ) /* initialize the rest of the structure */ chip->master_clock = (double)clock / 384.0; - chip->region_base = memory_region(Machine, tag); + chip->region_base = memory_region(device->machine, tag); chip->irq_callback = intf->irq_callback; /* create the stream */ @@ -691,7 +691,7 @@ static SND_START( ymz280b ) } } - state_save_register_postload(Machine, YMZ280B_state_save_update_step, chip); + state_save_register_postload(device->machine, YMZ280B_state_save_update_step, chip); #if MAKE_WAVS chip->wavresample = wav_open("resamp.wav", INTERNAL_SAMPLE_RATE, 2); diff --git a/src/emu/ui.c b/src/emu/ui.c index f29e7168239..c4a4530598d 100644 --- a/src/emu/ui.c +++ b/src/emu/ui.c @@ -1010,7 +1010,7 @@ astring *game_info_astring(running_machine *machine, astring *string) for (sndnum = 0; sndnum < MAX_SOUND && machine->config->sound[sndnum].type != SOUND_DUMMY; sndnum += count) { sound_type type = machine->config->sound[sndnum].type; - int clock = sndnum_clock(sndnum); + int clock = machine->config->sound[sndnum].clock; /* append the Sound: string */ if (sndnum == 0) @@ -1019,13 +1019,13 @@ astring *game_info_astring(running_machine *machine, astring *string) /* count how many identical sound chips we have */ for (count = 1; sndnum + count < MAX_SOUND; count++) if (machine->config->sound[sndnum + count].type != type || - sndnum_clock(sndnum + count) != clock) + machine->config->sound[sndnum + count].clock != clock) break; - /* if more than one, prepend a #x in front of the CPU name */ + /* if more than one, prepend a #x in front of the SND name */ if (count > 1) astring_catprintf(string, "%d" UTF8_MULTIPLY, count); - astring_catc(string, sndnum_name(sndnum)); + astring_catc(string, sndtype_get_name(type)); /* display clock in kHz or MHz */ if (clock >= 1000000)