Browse CVS Repository
Contents of /mame32jp/mame32jp/src/sndintrf.c
Parent Directory
| Revision Log
| Revision Graph
Revision 1.5 -
( show annotations)
( download)
( as text)
Wed Apr 24 03:53:20 2002 UTC
(21 years, 11 months ago)
by zero
Branch: MAIN
CVS Tags: ver_0_60_1, ver0_59_13, ver0_59_14, ver0_60_2, ver0_60_3, ver0_60_4, ver0_60_5, HEAD
Changes since 1.4: +0 -0 lines
File MIME type: text/x-csrc
*** empty log message ***
| 1 |
#include "driver.h" |
| 2 |
|
| 3 |
|
| 4 |
/*************************************************************************** |
| 5 |
|
| 6 |
Many games use a master-slave CPU setup. Typically, the main CPU writes |
| 7 |
a command to some register, and then writes to another register to trigger |
| 8 |
an interrupt on the slave CPU (the interrupt might also be triggered by |
| 9 |
the first write). The slave CPU, notified by the interrupt, goes and reads |
| 10 |
the command. |
| 11 |
|
| 12 |
***************************************************************************/ |
| 13 |
|
| 14 |
static int cleared_value = 0x00; |
| 15 |
|
| 16 |
static int latch,read_debug; |
| 17 |
|
| 18 |
|
| 19 |
static void soundlatch_callback(int param) |
| 20 |
{ |
| 21 |
if (read_debug == 0 && latch != param) |
| 22 |
logerror("Warning: sound latch written before being read. Previous: %02x, new: %02x\n",latch,param); |
| 23 |
latch = param; |
| 24 |
read_debug = 0; |
| 25 |
} |
| 26 |
|
| 27 |
WRITE_HANDLER( soundlatch_w ) |
| 28 |
{ |
| 29 |
/* make all the CPUs synchronize, and only AFTER that write the new command to the latch */ |
| 30 |
timer_set(TIME_NOW,data,soundlatch_callback); |
| 31 |
} |
| 32 |
|
| 33 |
WRITE16_HANDLER( soundlatch_word_w ) |
| 34 |
{ |
| 35 |
static data16_t word; |
| 36 |
COMBINE_DATA(&word); |
| 37 |
|
| 38 |
/* make all the CPUs synchronize, and only AFTER that write the new command to the latch */ |
| 39 |
timer_set(TIME_NOW,word,soundlatch_callback); |
| 40 |
} |
| 41 |
|
| 42 |
READ_HANDLER( soundlatch_r ) |
| 43 |
{ |
| 44 |
read_debug = 1; |
| 45 |
return latch; |
| 46 |
} |
| 47 |
|
| 48 |
READ16_HANDLER( soundlatch_word_r ) |
| 49 |
{ |
| 50 |
read_debug = 1; |
| 51 |
return latch; |
| 52 |
} |
| 53 |
|
| 54 |
WRITE_HANDLER( soundlatch_clear_w ) |
| 55 |
{ |
| 56 |
latch = cleared_value; |
| 57 |
} |
| 58 |
|
| 59 |
|
| 60 |
static int latch2,read_debug2; |
| 61 |
|
| 62 |
static void soundlatch2_callback(int param) |
| 63 |
{ |
| 64 |
if (read_debug2 == 0 && latch2 != param) |
| 65 |
logerror("Warning: sound latch 2 written before being read. Previous: %02x, new: %02x\n",latch2,param); |
| 66 |
latch2 = param; |
| 67 |
read_debug2 = 0; |
| 68 |
} |
| 69 |
|
| 70 |
WRITE_HANDLER( soundlatch2_w ) |
| 71 |
{ |
| 72 |
/* make all the CPUs synchronize, and only AFTER that write the new command to the latch */ |
| 73 |
timer_set(TIME_NOW,data,soundlatch2_callback); |
| 74 |
} |
| 75 |
|
| 76 |
WRITE16_HANDLER( soundlatch2_word_w ) |
| 77 |
{ |
| 78 |
static data16_t word; |
| 79 |
COMBINE_DATA(&word); |
| 80 |
|
| 81 |
/* make all the CPUs synchronize, and only AFTER that write the new command to the latch */ |
| 82 |
timer_set(TIME_NOW,word,soundlatch2_callback); |
| 83 |
} |
| 84 |
|
| 85 |
READ_HANDLER( soundlatch2_r ) |
| 86 |
{ |
| 87 |
read_debug2 = 1; |
| 88 |
return latch2; |
| 89 |
} |
| 90 |
|
| 91 |
READ16_HANDLER( soundlatch2_word_r ) |
| 92 |
{ |
| 93 |
read_debug2 = 1; |
| 94 |
return latch2; |
| 95 |
} |
| 96 |
|
| 97 |
WRITE_HANDLER( soundlatch2_clear_w ) |
| 98 |
{ |
| 99 |
latch2 = cleared_value; |
| 100 |
} |
| 101 |
|
| 102 |
|
| 103 |
static int latch3,read_debug3; |
| 104 |
|
| 105 |
static void soundlatch3_callback(int param) |
| 106 |
{ |
| 107 |
if (read_debug3 == 0 && latch3 != param) |
| 108 |
logerror("Warning: sound latch 3 written before being read. Previous: %02x, new: %02x\n",latch3,param); |
| 109 |
latch3 = param; |
| 110 |
read_debug3 = 0; |
| 111 |
} |
| 112 |
|
| 113 |
WRITE_HANDLER( soundlatch3_w ) |
| 114 |
{ |
| 115 |
/* make all the CPUs synchronize, and only AFTER that write the new command to the latch */ |
| 116 |
timer_set(TIME_NOW,data,soundlatch3_callback); |
| 117 |
} |
| 118 |
|
| 119 |
WRITE16_HANDLER( soundlatch3_word_w ) |
| 120 |
{ |
| 121 |
static data16_t word; |
| 122 |
COMBINE_DATA(&word); |
| 123 |
|
| 124 |
/* make all the CPUs synchronize, and only AFTER that write the new command to the latch */ |
| 125 |
timer_set(TIME_NOW,word,soundlatch3_callback); |
| 126 |
} |
| 127 |
|
| 128 |
READ_HANDLER( soundlatch3_r ) |
| 129 |
{ |
| 130 |
read_debug3 = 1; |
| 131 |
return latch3; |
| 132 |
} |
| 133 |
|
| 134 |
READ16_HANDLER( soundlatch3_word_r ) |
| 135 |
{ |
| 136 |
read_debug3 = 1; |
| 137 |
return latch3; |
| 138 |
} |
| 139 |
|
| 140 |
WRITE_HANDLER( soundlatch3_clear_w ) |
| 141 |
{ |
| 142 |
latch3 = cleared_value; |
| 143 |
} |
| 144 |
|
| 145 |
|
| 146 |
static int latch4,read_debug4; |
| 147 |
|
| 148 |
static void soundlatch4_callback(int param) |
| 149 |
{ |
| 150 |
if (read_debug4 == 0 && latch4 != param) |
| 151 |
logerror("Warning: sound latch 4 written before being read. Previous: %02x, new: %02x\n",latch2,param); |
| 152 |
latch4 = param; |
| 153 |
read_debug4 = 0; |
| 154 |
} |
| 155 |
|
| 156 |
WRITE_HANDLER( soundlatch4_w ) |
| 157 |
{ |
| 158 |
/* make all the CPUs synchronize, and only AFTER that write the new command to the latch */ |
| 159 |
timer_set(TIME_NOW,data,soundlatch4_callback); |
| 160 |
} |
| 161 |
|
| 162 |
WRITE16_HANDLER( soundlatch4_word_w ) |
| 163 |
{ |
| 164 |
static data16_t word; |
| 165 |
COMBINE_DATA(&word); |
| 166 |
|
| 167 |
/* make all the CPUs synchronize, and only AFTER that write the new command to the latch */ |
| 168 |
timer_set(TIME_NOW,word,soundlatch4_callback); |
| 169 |
} |
| 170 |
|
| 171 |
READ_HANDLER( soundlatch4_r ) |
| 172 |
{ |
| 173 |
read_debug4 = 1; |
| 174 |
return latch4; |
| 175 |
} |
| 176 |
|
| 177 |
READ16_HANDLER( soundlatch4_word_r ) |
| 178 |
{ |
| 179 |
read_debug4 = 1; |
| 180 |
return latch4; |
| 181 |
} |
| 182 |
|
| 183 |
WRITE_HANDLER( soundlatch4_clear_w ) |
| 184 |
{ |
| 185 |
latch4 = cleared_value; |
| 186 |
} |
| 187 |
|
| 188 |
|
| 189 |
void soundlatch_setclearedvalue(int value) |
| 190 |
{ |
| 191 |
cleared_value = value; |
| 192 |
} |
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
/*************************************************************************** |
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
***************************************************************************/ |
| 203 |
|
| 204 |
static void *sound_update_timer; |
| 205 |
static double refresh_period; |
| 206 |
static double refresh_period_inv; |
| 207 |
|
| 208 |
|
| 209 |
struct snd_interface |
| 210 |
{ |
| 211 |
unsigned sound_num; /* ID */ |
| 212 |
const char *name; /* description */ |
| 213 |
int (*chips_num)(const struct MachineSound *msound); /* returns number of chips if applicable */ |
| 214 |
int (*chips_clock)(const struct MachineSound *msound); /* returns chips clock if applicable */ |
| 215 |
int (*start)(const struct MachineSound *msound); /* starts sound emulation */ |
| 216 |
void (*stop)(void); /* stops sound emulation */ |
| 217 |
void (*update)(void); /* updates emulation once per frame if necessary */ |
| 218 |
void (*reset)(void); /* resets sound emulation */ |
| 219 |
}; |
| 220 |
|
| 221 |
|
| 222 |
#if (HAS_CUSTOM) |
| 223 |
static const struct CustomSound_interface *cust_intf; |
| 224 |
|
| 225 |
int custom_sh_start(const struct MachineSound *msound) |
| 226 |
{ |
| 227 |
cust_intf = msound->sound_interface; |
| 228 |
|
| 229 |
if (cust_intf->sh_start) |
| 230 |
return (*cust_intf->sh_start)(msound); |
| 231 |
else return 0; |
| 232 |
} |
| 233 |
void custom_sh_stop(void) |
| 234 |
{ |
| 235 |
if (cust_intf->sh_stop) (*cust_intf->sh_stop)(); |
| 236 |
} |
| 237 |
void custom_sh_update(void) |
| 238 |
{ |
| 239 |
if (cust_intf->sh_update) (*cust_intf->sh_update)(); |
| 240 |
} |
| 241 |
#endif |
| 242 |
#if (HAS_DAC) |
| 243 |
int DAC_num(const struct MachineSound *msound) { return ((struct DACinterface*)msound->sound_interface)->num; } |
| 244 |
#endif |
| 245 |
#if (HAS_ADPCM) |
| 246 |
int ADPCM_num(const struct MachineSound *msound) { return ((struct ADPCMinterface*)msound->sound_interface)->num; } |
| 247 |
#endif |
| 248 |
#if (HAS_OKIM6295) |
| 249 |
int OKIM6295_num(const struct MachineSound *msound) { return ((struct OKIM6295interface*)msound->sound_interface)->num; } |
| 250 |
int OKIM6295_clock(const struct MachineSound *msound) { return ((struct OKIM6295interface*)msound->sound_interface)->frequency[0]; } |
| 251 |
#endif |
| 252 |
#if (HAS_MSM5205) |
| 253 |
int MSM5205_num(const struct MachineSound *msound) { return ((struct MSM5205interface*)msound->sound_interface)->num; } |
| 254 |
#endif |
| 255 |
#if (HAS_MSM5232) |
| 256 |
int MSM5232_num(const struct MachineSound *msound) { return ((struct MSM5232interface*)msound->sound_interface)->num; } |
| 257 |
#endif |
| 258 |
#if (HAS_HC55516) |
| 259 |
int HC55516_num(const struct MachineSound *msound) { return ((struct hc55516_interface*)msound->sound_interface)->num; } |
| 260 |
#endif |
| 261 |
#if (HAS_K007232) |
| 262 |
int K007232_num(const struct MachineSound *msound) { return ((struct K007232_interface*)msound->sound_interface)->num_chips; } |
| 263 |
#endif |
| 264 |
#if (HAS_AY8910) |
| 265 |
int AY8910_clock(const struct MachineSound *msound) { return ((struct AY8910interface*)msound->sound_interface)->baseclock; } |
| 266 |
int AY8910_num(const struct MachineSound *msound) { return ((struct AY8910interface*)msound->sound_interface)->num; } |
| 267 |
#endif |
| 268 |
#if (HAS_YM2203) |
| 269 |
int YM2203_clock(const struct MachineSound *msound) { return ((struct YM2203interface*)msound->sound_interface)->baseclock; } |
| 270 |
int YM2203_num(const struct MachineSound *msound) { return ((struct YM2203interface*)msound->sound_interface)->num; } |
| 271 |
#endif |
| 272 |
#if (HAS_YM2413) |
| 273 |
int YM2413_clock(const struct MachineSound *msound) { return ((struct YM2413interface*)msound->sound_interface)->baseclock; } |
| 274 |
int YM2413_num(const struct MachineSound *msound) { return ((struct YM2413interface*)msound->sound_interface)->num; } |
| 275 |
#endif |
| 276 |
#if (HAS_YM2608) |
| 277 |
int YM2608_clock(const struct MachineSound *msound) { return ((struct YM2608interface*)msound->sound_interface)->baseclock; } |
| 278 |
int YM2608_num(const struct MachineSound *msound) { return ((struct YM2608interface*)msound->sound_interface)->num; } |
| 279 |
#endif |
| 280 |
#if (HAS_YM2610) |
| 281 |
int YM2610_clock(const struct MachineSound *msound) { return ((struct YM2610interface*)msound->sound_interface)->baseclock; } |
| 282 |
int YM2610_num(const struct MachineSound *msound) { return ((struct YM2610interface*)msound->sound_interface)->num; } |
| 283 |
#endif |
| 284 |
#if (HAS_YM2612 || HAS_YM3438) |
| 285 |
int YM2612_clock(const struct MachineSound *msound) { return ((struct YM2612interface*)msound->sound_interface)->baseclock; } |
| 286 |
int YM2612_num(const struct MachineSound *msound) { return ((struct YM2612interface*)msound->sound_interface)->num; } |
| 287 |
#endif |
| 288 |
#if (HAS_POKEY) |
| 289 |
int POKEY_clock(const struct MachineSound *msound) { return ((struct POKEYinterface*)msound->sound_interface)->baseclock; } |
| 290 |
int POKEY_num(const struct MachineSound *msound) { return ((struct POKEYinterface*)msound->sound_interface)->num; } |
| 291 |
#endif |
| 292 |
#if (HAS_YM3812 || HAS_YM3526 || HAS_Y8950) |
| 293 |
int YM3812_clock(const struct MachineSound *msound) { return ((struct YM3812interface*)msound->sound_interface)->baseclock; } |
| 294 |
int YM3812_num(const struct MachineSound *msound) { return ((struct YM3812interface*)msound->sound_interface)->num; } |
| 295 |
#endif |
| 296 |
#if (HAS_YMZ280B) |
| 297 |
int YMZ280B_clock(const struct MachineSound *msound) { return ((struct YMZ280Binterface*)msound->sound_interface)->baseclock[0]; } |
| 298 |
int YMZ280B_num(const struct MachineSound *msound) { return ((struct YMZ280Binterface*)msound->sound_interface)->num; } |
| 299 |
#endif |
| 300 |
#if (HAS_VLM5030) |
| 301 |
int VLM5030_clock(const struct MachineSound *msound) { return ((struct VLM5030interface*)msound->sound_interface)->baseclock; } |
| 302 |
#endif |
| 303 |
#if (HAS_TMS36XX) |
| 304 |
int TMS36XX_num(const struct MachineSound *msound) { return ((struct TMS36XXinterface*)msound->sound_interface)->num; } |
| 305 |
#endif |
| 306 |
#if (HAS_TMS5110) |
| 307 |
int TMS5110_clock(const struct MachineSound *msound) { return ((struct TMS5110interface*)msound->sound_interface)->baseclock; } |
| 308 |
#endif |
| 309 |
#if (HAS_TMS5220) |
| 310 |
int TMS5220_clock(const struct MachineSound *msound) { return ((struct TMS5220interface*)msound->sound_interface)->baseclock; } |
| 311 |
#endif |
| 312 |
#if (HAS_YM2151 || HAS_YM2151_ALT) |
| 313 |
int YM2151_clock(const struct MachineSound *msound) { return ((struct YM2151interface*)msound->sound_interface)->baseclock; } |
| 314 |
int YM2151_num(const struct MachineSound *msound) { return ((struct YM2151interface*)msound->sound_interface)->num; } |
| 315 |
#endif |
| 316 |
#if (HAS_NES) |
| 317 |
int NES_num(const struct MachineSound *msound) { return ((struct NESinterface*)msound->sound_interface)->num; } |
| 318 |
#endif |
| 319 |
#if (HAS_SN76477) |
| 320 |
int SN76477_num(const struct MachineSound *msound) { return ((struct SN76477interface*)msound->sound_interface)->num; } |
| 321 |
#endif |
| 322 |
#if (HAS_SN76496) |
| 323 |
int SN76496_clock(const struct MachineSound *msound) { return ((struct SN76496interface*)msound->sound_interface)->baseclock[0]; } |
| 324 |
int SN76496_num(const struct MachineSound *msound) { return ((struct SN76496interface*)msound->sound_interface)->num; } |
| 325 |
#endif |
| 326 |
#if (HAS_MSM5205) |
| 327 |
int MSM5205_clock(const struct MachineSound *msound) { return ((struct MSM5205interface*)msound->sound_interface)->baseclock; } |
| 328 |
#endif |
| 329 |
#if (HAS_MSM5232) |
| 330 |
int MSM5232_clock(const struct MachineSound *msound) { return ((struct MSM5232interface*)msound->sound_interface)->baseclock; } |
| 331 |
#endif |
| 332 |
#if (HAS_ASTROCADE) |
| 333 |
int ASTROCADE_clock(const struct MachineSound *msound) { return ((struct astrocade_interface*)msound->sound_interface)->baseclock; } |
| 334 |
int ASTROCADE_num(const struct MachineSound *msound) { return ((struct astrocade_interface*)msound->sound_interface)->num; } |
| 335 |
#endif |
| 336 |
#if (HAS_K051649) |
| 337 |
int K051649_clock(const struct MachineSound *msound) { return ((struct k051649_interface*)msound->sound_interface)->master_clock; } |
| 338 |
#endif |
| 339 |
#if (HAS_K053260) |
| 340 |
int K053260_clock(const struct MachineSound *msound) { return ((struct K053260_interface*)msound->sound_interface)->clock[0]; } |
| 341 |
int K053260_num(const struct MachineSound *msound) { return ((struct K053260_interface*)msound->sound_interface)->num; } |
| 342 |
#endif |
| 343 |
#if (HAS_K054539) |
| 344 |
int K054539_clock(const struct MachineSound *msound) { return ((struct K054539interface*)msound->sound_interface)->clock; } |
| 345 |
int K054539_num(const struct MachineSound *msound) { return ((struct K054539interface*)msound->sound_interface)->num; } |
| 346 |
#endif |
| 347 |
#if (HAS_CEM3394) |
| 348 |
int cem3394_num(const struct MachineSound *msound) { return ((struct cem3394_interface*)msound->sound_interface)->numchips; } |
| 349 |
#endif |
| 350 |
#if (HAS_QSOUND) |
| 351 |
int qsound_clock(const struct MachineSound *msound) { return ((struct QSound_interface*)msound->sound_interface)->clock; } |
| 352 |
#endif |
| 353 |
#if (HAS_SAA1099) |
| 354 |
int saa1099_num(const struct MachineSound *msound) { return ((struct SAA1099_interface*)msound->sound_interface)->numchips; } |
| 355 |
#endif |
| 356 |
#if (HAS_IREMGA20) |
| 357 |
int iremga20_clock(const struct MachineSound *msound) { return ((struct IremGA20_interface*)msound->sound_interface)->clock; } |
| 358 |
#endif |
| 359 |
#if (HAS_ES5505) |
| 360 |
int ES5505_clock(const struct MachineSound *msound) { return ((struct ES5505interface*)msound->sound_interface)->baseclock[0]; } |
| 361 |
int ES5505_num(const struct MachineSound *msound) { return ((struct ES5505interface*)msound->sound_interface)->num; } |
| 362 |
#endif |
| 363 |
#if (HAS_ES5506) |
| 364 |
int ES5506_clock(const struct MachineSound *msound) { return ((struct ES5506interface*)msound->sound_interface)->baseclock[0]; } |
| 365 |
int ES5506_num(const struct MachineSound *msound) { return ((struct ES5506interface*)msound->sound_interface)->num; } |
| 366 |
#endif |
| 367 |
#if (HAS_BSMT2000) |
| 368 |
int BSMT2000_clock(const struct MachineSound *msound) { return ((struct BSMT2000interface*)msound->sound_interface)->baseclock[0]; } |
| 369 |
int BSMT2000_num(const struct MachineSound *msound) { return ((struct BSMT2000interface*)msound->sound_interface)->num; } |
| 370 |
#endif |
| 371 |
|
| 372 |
#ifdef MESS |
| 373 |
#if (HAS_BEEP) |
| 374 |
int beep_num(const struct MachineSound *msound) { return ((struct beep_interface*)msound->sound_interface)->num; } |
| 375 |
#endif |
| 376 |
#if (HAS_SPEAKER) |
| 377 |
int speaker_num(const struct MachineSound *msound) { return ((struct Speaker_interface*)msound->sound_interface)->num; } |
| 378 |
#endif |
| 379 |
#if (HAS_TIA) |
| 380 |
int TIA_clock(const struct MachineSound *msound) { return ((struct TIAinterface*)msound->sound_interface)->baseclock; } |
| 381 |
#endif |
| 382 |
#if (HAS_WAVE) |
| 383 |
int wave_num(const struct MachineSound *msound) { return ((struct Wave_interface*)msound->sound_interface)->num; } |
| 384 |
#endif |
| 385 |
#endif |
| 386 |
|
| 387 |
struct snd_interface sndintf[] = |
| 388 |
{ |
| 389 |
{ |
| 390 |
SOUND_DUMMY, |
| 391 |
"", |
| 392 |
0, |
| 393 |
0, |
| 394 |
0, |
| 395 |
0, |
| 396 |
0, |
| 397 |
0 |
| 398 |
}, |
| 399 |
#if (HAS_CUSTOM) |
| 400 |
{ |
| 401 |
SOUND_CUSTOM, |
| 402 |
"Custom", |
| 403 |
0, |
| 404 |
0, |
| 405 |
custom_sh_start, |
| 406 |
custom_sh_stop, |
| 407 |
custom_sh_update, |
| 408 |
0 |
| 409 |
}, |
| 410 |
#endif |
| 411 |
#if (HAS_SAMPLES) |
| 412 |
{ |
| 413 |
SOUND_SAMPLES, |
| 414 |
"Samples", |
| 415 |
0, |
| 416 |
0, |
| 417 |
samples_sh_start, |
| 418 |
0, |
| 419 |
0, |
| 420 |
0 |
| 421 |
}, |
| 422 |
#endif |
| 423 |
#if (HAS_DAC) |
| 424 |
{ |
| 425 |
SOUND_DAC, |
| 426 |
"DAC", |
| 427 |
DAC_num, |
| 428 |
0, |
| 429 |
DAC_sh_start, |
| 430 |
0, |
| 431 |
0, |
| 432 |
0 |
| 433 |
}, |
| 434 |
#endif |
| 435 |
#if (HAS_DISCRETE) |
| 436 |
{ |
| 437 |
SOUND_DISCRETE, |
| 438 |
"Discrete Components", |
| 439 |
0, |
| 440 |
0, |
| 441 |
discrete_sh_start, |
| 442 |
discrete_sh_stop, |
| 443 |
0, |
| 444 |
discrete_sh_reset |
| 445 |
}, |
| 446 |
#endif |
| 447 |
#if (HAS_AY8910) |
| 448 |
{ |
| 449 |
SOUND_AY8910, |
| 450 |
"AY-8910", |
| 451 |
AY8910_num, |
| 452 |
AY8910_clock, |
| 453 |
AY8910_sh_start, |
| 454 |
AY8910_sh_stop, |
| 455 |
0, |
| 456 |
AY8910_sh_reset |
| 457 |
}, |
| 458 |
#endif |
| 459 |
#if (HAS_YM2203) |
| 460 |
{ |
| 461 |
SOUND_YM2203, |
| 462 |
"YM2203", |
| 463 |
YM2203_num, |
| 464 |
YM2203_clock, |
| 465 |
YM2203_sh_start, |
| 466 |
YM2203_sh_stop, |
| 467 |
0, |
| 468 |
YM2203_sh_reset |
| 469 |
}, |
| 470 |
#endif |
| 471 |
#if (HAS_YM2151 || HAS_YM2151_ALT) |
| 472 |
{ |
| 473 |
SOUND_YM2151, |
| 474 |
"YM2151", |
| 475 |
YM2151_num, |
| 476 |
YM2151_clock, |
| 477 |
YM2151_sh_start, |
| 478 |
YM2151_sh_stop, |
| 479 |
0, |
| 480 |
YM2151_sh_reset |
| 481 |
}, |
| 482 |
#endif |
| 483 |
#if (HAS_YM2608) |
| 484 |
{ |
| 485 |
SOUND_YM2608, |
| 486 |
"YM2608", |
| 487 |
YM2608_num, |
| 488 |
YM2608_clock, |
| 489 |
YM2608_sh_start, |
| 490 |
YM2608_sh_stop, |
| 491 |
0, |
| 492 |
YM2608_sh_reset |
| 493 |
}, |
| 494 |
#endif |
| 495 |
#if (HAS_YM2610) |
| 496 |
{ |
| 497 |
SOUND_YM2610, |
| 498 |
"YM2610", |
| 499 |
YM2610_num, |
| 500 |
YM2610_clock, |
| 501 |
YM2610_sh_start, |
| 502 |
YM2610_sh_stop, |
| 503 |
0, |
| 504 |
YM2610_sh_reset |
| 505 |
}, |
| 506 |
#endif |
| 507 |
#if (HAS_YM2610B) |
| 508 |
{ |
| 509 |
SOUND_YM2610B, |
| 510 |
"YM2610B", |
| 511 |
YM2610_num, |
| 512 |
YM2610_clock, |
| 513 |
YM2610B_sh_start, |
| 514 |
YM2610_sh_stop, |
| 515 |
0, |
| 516 |
YM2610_sh_reset |
| 517 |
}, |
| 518 |
#endif |
| 519 |
#if (HAS_YM2612) |
| 520 |
{ |
| 521 |
SOUND_YM2612, |
| 522 |
"YM2612", |
| 523 |
YM2612_num, |
| 524 |
YM2612_clock, |
| 525 |
YM2612_sh_start, |
| 526 |
YM2612_sh_stop, |
| 527 |
0, |
| 528 |
YM2612_sh_reset |
| 529 |
}, |
| 530 |
#endif |
| 531 |
#if (HAS_YM3438) |
| 532 |
{ |
| 533 |
SOUND_YM3438, |
| 534 |
"YM3438", |
| 535 |
YM2612_num, |
| 536 |
YM2612_clock, |
| 537 |
YM2612_sh_start, |
| 538 |
YM2612_sh_stop, |
| 539 |
0, |
| 540 |
YM2612_sh_reset |
| 541 |
}, |
| 542 |
#endif |
| 543 |
#if (HAS_YM2413) |
| 544 |
{ |
| 545 |
SOUND_YM2413, |
| 546 |
"YM2413", |
| 547 |
YM2413_num, |
| 548 |
YM2413_clock, |
| 549 |
YM2413_sh_start, |
| 550 |
YM2413_sh_stop, |
| 551 |
0, |
| 552 |
0 |
| 553 |
}, |
| 554 |
#endif |
| 555 |
#if (HAS_YM3812) |
| 556 |
{ |
| 557 |
SOUND_YM3812, |
| 558 |
"YM3812", |
| 559 |
YM3812_num, |
| 560 |
YM3812_clock, |
| 561 |
YM3812_sh_start, |
| 562 |
YM3812_sh_stop, |
| 563 |
0, |
| 564 |
0 |
| 565 |
}, |
| 566 |
#endif |
| 567 |
#if (HAS_YM3526) |
| 568 |
{ |
| 569 |
SOUND_YM3526, |
| 570 |
"YM3526", |
| 571 |
YM3812_num, |
| 572 |
YM3812_clock, |
| 573 |
YM3812_sh_start, |
| 574 |
YM3812_sh_stop, |
| 575 |
0, |
| 576 |
0 |
| 577 |
}, |
| 578 |
#endif |
| 579 |
#if (HAS_YMZ280B) |
| 580 |
{ |
| 581 |
SOUND_YMZ280B, |
| 582 |
"YMZ280B", |
| 583 |
YMZ280B_num, |
| 584 |
YMZ280B_clock, |
| 585 |
YMZ280B_sh_start, |
| 586 |
YMZ280B_sh_stop, |
| 587 |
0, |
| 588 |
#ifdef MAME32JP |
| 589 |
YMZ280B_sh_reset //ks hcmame |
| 590 |
#else |
| 591 |
0 |
| 592 |
#endif |
| 593 |
}, |
| 594 |
#endif |
| 595 |
#if (HAS_Y8950) |
| 596 |
{ |
| 597 |
SOUND_Y8950, |
| 598 |
"Y8950", /* (MSX-AUDIO) */ |
| 599 |
YM3812_num, |
| 600 |
YM3812_clock, |
| 601 |
Y8950_sh_start, |
| 602 |
Y8950_sh_stop, |
| 603 |
0, |
| 604 |
0 |
| 605 |
}, |
| 606 |
#endif |
| 607 |
#if (HAS_SN76477) |
| 608 |
{ |
| 609 |
SOUND_SN76477, |
| 610 |
"SN76477", |
| 611 |
SN76477_num, |
| 612 |
0, |
| 613 |
SN76477_sh_start, |
| 614 |
SN76477_sh_stop, |
| 615 |
0, |
| 616 |
0 |
| 617 |
}, |
| 618 |
#endif |
| 619 |
#if (HAS_SN76496) |
| 620 |
{ |
| 621 |
SOUND_SN76496, |
| 622 |
"SN76496", |
| 623 |
SN76496_num, |
| 624 |
SN76496_clock, |
| 625 |
SN76496_sh_start, |
| 626 |
0, |
| 627 |
0 |
| 628 |
}, |
| 629 |
#endif |
| 630 |
#if (HAS_POKEY) |
| 631 |
{ |
| 632 |
SOUND_POKEY, |
| 633 |
"Pokey", |
| 634 |
POKEY_num, |
| 635 |
POKEY_clock, |
| 636 |
pokey_sh_start, |
| 637 |
pokey_sh_stop, |
| 638 |
0, |
| 639 |
0 |
| 640 |
}, |
| 641 |
#endif |
| 642 |
#if (HAS_NES) |
| 643 |
{ |
| 644 |
SOUND_NES, |
| 645 |
"Nintendo", |
| 646 |
NES_num, |
| 647 |
0, |
| 648 |
NESPSG_sh_start, |
| 649 |
NESPSG_sh_stop, |
| 650 |
NESPSG_sh_update, |
| 651 |
0 |
| 652 |
}, |
| 653 |
#endif |
| 654 |
#if (HAS_ASTROCADE) |
| 655 |
{ |
| 656 |
SOUND_ASTROCADE, |
| 657 |
"Astrocade", |
| 658 |
ASTROCADE_num, |
| 659 |
ASTROCADE_clock, |
| 660 |
astrocade_sh_start, |
| 661 |
astrocade_sh_stop, |
| 662 |
astrocade_sh_update, |
| 663 |
0 |
| 664 |
}, |
| 665 |
#endif |
| 666 |
#if (HAS_NAMCO) |
| 667 |
{ |
| 668 |
SOUND_NAMCO, |
| 669 |
"Namco", |
| 670 |
0, |
| 671 |
0, |
| 672 |
namco_sh_start, |
| 673 |
namco_sh_stop, |
| 674 |
0, |
| 675 |
0 |
| 676 |
}, |
| 677 |
#endif |
| 678 |
#if (HAS_TMS36XX) |
| 679 |
{ |
| 680 |
SOUND_TMS36XX, |
| 681 |
"TMS36XX", |
| 682 |
TMS36XX_num, |
| 683 |
0, |
| 684 |
tms36xx_sh_start, |
| 685 |
tms36xx_sh_stop, |
| 686 |
tms36xx_sh_update, |
| 687 |
0 |
| 688 |
}, |
| 689 |
#endif |
| 690 |
#if (HAS_TMS5110) |
| 691 |
{ |
| 692 |
SOUND_TMS5110, |
| 693 |
"TMS5110", |
| 694 |
0, |
| 695 |
TMS5110_clock, |
| 696 |
tms5110_sh_start, |
| 697 |
tms5110_sh_stop, |
| 698 |
tms5110_sh_update, |
| 699 |
0 |
| 700 |
}, |
| 701 |
#endif |
| 702 |
#if (HAS_TMS5220) |
| 703 |
{ |
| 704 |
SOUND_TMS5220, |
| 705 |
"TMS5220", |
| 706 |
0, |
| 707 |
TMS5220_clock, |
| 708 |
tms5220_sh_start, |
| 709 |
tms5220_sh_stop, |
| 710 |
tms5220_sh_update, |
| 711 |
0 |
| 712 |
}, |
| 713 |
#endif |
| 714 |
#if (HAS_VLM5030) |
| 715 |
{ |
| 716 |
SOUND_VLM5030, |
| 717 |
"VLM5030", |
| 718 |
0, |
| 719 |
VLM5030_clock, |
| 720 |
VLM5030_sh_start, |
| 721 |
VLM5030_sh_stop, |
| 722 |
VLM5030_sh_update, |
| 723 |
0 |
| 724 |
}, |
| 725 |
#endif |
| 726 |
#if (HAS_ADPCM) |
| 727 |
{ |
| 728 |
SOUND_ADPCM, |
| 729 |
"ADPCM", |
| 730 |
ADPCM_num, |
| 731 |
0, |
| 732 |
ADPCM_sh_start, |
| 733 |
ADPCM_sh_stop, |
| 734 |
ADPCM_sh_update, |
| 735 |
0 |
| 736 |
}, |
| 737 |
#endif |
| 738 |
#if (HAS_OKIM6295) |
| 739 |
{ |
| 740 |
SOUND_OKIM6295, |
| 741 |
"OKI6295", |
| 742 |
OKIM6295_num, |
| 743 |
OKIM6295_clock, |
| 744 |
OKIM6295_sh_start, |
| 745 |
OKIM6295_sh_stop, |
| 746 |
OKIM6295_sh_update, |
| 747 |
0 |
| 748 |
}, |
| 749 |
#endif |
| 750 |
#if (HAS_MSM5205) |
| 751 |
{ |
| 752 |
SOUND_MSM5205, |
| 753 |
"MSM5205", |
| 754 |
MSM5205_num, |
| 755 |
MSM5205_clock, |
| 756 |
MSM5205_sh_start, |
| 757 |
0, |
| 758 |
0, |
| 759 |
MSM5205_sh_reset, |
| 760 |
}, |
| 761 |
#endif |
| 762 |
#if (HAS_MSM5232) |
| 763 |
{ |
| 764 |
SOUND_MSM5232, |
| 765 |
"MSM5232", |
| 766 |
MSM5232_num, |
| 767 |
MSM5232_clock, |
| 768 |
MSM5232_sh_start, |
| 769 |
MSM5232_sh_stop, |
| 770 |
0, |
| 771 |
MSM5232_sh_reset, |
| 772 |
}, |
| 773 |
#endif |
| 774 |
#if (HAS_UPD7759) |
| 775 |
{ |
| 776 |
SOUND_UPD7759, |
| 777 |
"uPD7759", |
| 778 |
0, |
| 779 |
0, |
| 780 |
UPD7759_sh_start, |
| 781 |
0, |
| 782 |
0, |
| 783 |
0 |
| 784 |
}, |
| 785 |
#endif |
| 786 |
#if (HAS_HC55516) |
| 787 |
{ |
| 788 |
SOUND_HC55516, |
| 789 |
"HC55516", |
| 790 |
HC55516_num, |
| 791 |
0, |
| 792 |
hc55516_sh_start, |
| 793 |
0, |
| 794 |
0, |
| 795 |
0 |
| 796 |
}, |
| 797 |
#endif |
| 798 |
#if (HAS_K005289) |
| 799 |
{ |
| 800 |
SOUND_K005289, |
| 801 |
"005289", |
| 802 |
0, |
| 803 |
0, |
| 804 |
K005289_sh_start, |
| 805 |
K005289_sh_stop, |
| 806 |
0, |
| 807 |
0 |
| 808 |
}, |
| 809 |
#endif |
| 810 |
#if (HAS_K007232) |
| 811 |
{ |
| 812 |
SOUND_K007232, |
| 813 |
"007232", |
| 814 |
K007232_num, |
| 815 |
0, |
| 816 |
K007232_sh_start, |
| 817 |
0, |
| 818 |
0, |
| 819 |
0 |
| 820 |
}, |
| 821 |
#endif |
| 822 |
#if (HAS_K051649) |
| 823 |
{ |
| 824 |
SOUND_K051649, |
| 825 |
"051649", |
| 826 |
0, |
| 827 |
K051649_clock, |
| 828 |
K051649_sh_start, |
| 829 |
K051649_sh_stop, |
| 830 |
0, |
| 831 |
0 |
| 832 |
}, |
| 833 |
#endif |
| 834 |
#if (HAS_K053260) |
| 835 |
{ |
| 836 |
SOUND_K053260, |
| 837 |
"053260", |
| 838 |
K053260_num, |
| 839 |
K053260_clock, |
| 840 |
K053260_sh_start, |
| 841 |
K053260_sh_stop, |
| 842 |
0, |
| 843 |
0 |
| 844 |
}, |
| 845 |
#endif |
| 846 |
#if (HAS_K054539) |
| 847 |
{ |
| 848 |
SOUND_K054539, |
| 849 |
"054539", |
| 850 |
K054539_num, |
| 851 |
K054539_clock, |
| 852 |
K054539_sh_start, |
| 853 |
K054539_sh_stop, |
| 854 |
0, |
| 855 |
0 |
| 856 |
}, |
| 857 |
#endif |
| 858 |
#if (HAS_SEGAPCM) |
| 859 |
{ |
| 860 |
SOUND_SEGAPCM, |
| 861 |
"Sega PCM", |
| 862 |
0, |
| 863 |
0, |
| 864 |
SEGAPCM_sh_start, |
| 865 |
SEGAPCM_sh_stop, |
| 866 |
SEGAPCM_sh_update, |
| 867 |
0 |
| 868 |
}, |
| 869 |
#endif |
| 870 |
#if (HAS_RF5C68) |
| 871 |
{ |
| 872 |
SOUND_RF5C68, |
| 873 |
"RF5C68", |
| 874 |
0, |
| 875 |
0, |
| 876 |
RF5C68_sh_start, |
| 877 |
RF5C68_sh_stop, |
| 878 |
0, |
| 879 |
0 |
| 880 |
}, |
| 881 |
#endif |
| 882 |
#if (HAS_CEM3394) |
| 883 |
{ |
| 884 |
SOUND_CEM3394, |
| 885 |
"CEM3394", |
| 886 |
cem3394_num, |
| 887 |
0, |
| 888 |
cem3394_sh_start, |
| 889 |
cem3394_sh_stop, |
| 890 |
0, |
| 891 |
0 |
| 892 |
}, |
| 893 |
#endif |
| 894 |
#if (HAS_C140) |
| 895 |
{ |
| 896 |
SOUND_C140, |
| 897 |
"C140", |
| 898 |
0, |
| 899 |
0, |
| 900 |
C140_sh_start, |
| 901 |
C140_sh_stop, |
| 902 |
0, |
| 903 |
0 |
| 904 |
}, |
| 905 |
#endif |
| 906 |
#if (HAS_QSOUND) |
| 907 |
{ |
| 908 |
SOUND_QSOUND, |
| 909 |
"QSound", |
| 910 |
0, |
| 911 |
qsound_clock, |
| 912 |
qsound_sh_start, |
| 913 |
qsound_sh_stop, |
| 914 |
0, |
| 915 |
0 |
| 916 |
}, |
| 917 |
#endif |
| 918 |
#if (HAS_SAA1099) |
| 919 |
{ |
| 920 |
SOUND_SAA1099, |
| 921 |
"SAA1099", |
| 922 |
saa1099_num, |
| 923 |
0, |
| 924 |
saa1099_sh_start, |
| 925 |
saa1099_sh_stop, |
| 926 |
0, |
| 927 |
0 |
| 928 |
}, |
| 929 |
#endif |
| 930 |
#if (HAS_IREMGA20) |
| 931 |
{ |
| 932 |
SOUND_IREMGA20, |
| 933 |
"GA20", |
| 934 |
0, |
| 935 |
iremga20_clock, |
| 936 |
IremGA20_sh_start, |
| 937 |
IremGA20_sh_stop, |
| 938 |
0, |
| 939 |
0 |
| 940 |
}, |
| 941 |
#endif |
| 942 |
#if (HAS_ES5505) |
| 943 |
{ |
| 944 |
SOUND_ES5505, |
| 945 |
"ES5505", |
| 946 |
ES5505_num, |
| 947 |
ES5505_clock, |
| 948 |
ES5505_sh_start, |
| 949 |
ES5505_sh_stop, |
| 950 |
0, |
| 951 |
0 |
| 952 |
}, |
| 953 |
#endif |
| 954 |
#if (HAS_ES5506) |
| 955 |
{ |
| 956 |
SOUND_ES5506, |
| 957 |
"ES5506", |
| 958 |
ES5506_num, |
| 959 |
ES5506_clock, |
| 960 |
ES5506_sh_start, |
| 961 |
ES5506_sh_stop, |
| 962 |
0, |
| 963 |
0 |
| 964 |
}, |
| 965 |
#endif |
| 966 |
#if (HAS_BSMT2000) |
| 967 |
{ |
| 968 |
SOUND_BSMT2000, |
| 969 |
"BSMT2000", |
| 970 |
BSMT2000_num, |
| 971 |
BSMT2000_clock, |
| 972 |
BSMT2000_sh_start, |
| 973 |
BSMT2000_sh_stop, |
| 974 |
0, |
| 975 |
0 |
| 976 |
}, |
| 977 |
#endif |
| 978 |
|
| 979 |
#ifdef MESS |
| 980 |
#if (HAS_BEEP) |
| 981 |
{ |
| 982 |
SOUND_BEEP, |
| 983 |
"Beep", |
| 984 |
beep_num, |
| 985 |
0, |
| 986 |
beep_sh_start, |
| 987 |
beep_sh_stop, |
| 988 |
beep_sh_update, |
| 989 |
0 |
| 990 |
}, |
| 991 |
#endif |
| 992 |
#if (HAS_SPEAKER) |
| 993 |
{ |
| 994 |
SOUND_SPEAKER, |
| 995 |
"Speaker", |
| 996 |
speaker_num, |
| 997 |
0, |
| 998 |
speaker_sh_start, |
| 999 |
speaker_sh_stop, |
| 1000 |
speaker_sh_update, |
| 1001 |
0 |
| 1002 |
}, |
| 1003 |
#endif |
| 1004 |
#if (HAS_TIA) |
| 1005 |
{ |
| 1006 |
SOUND_TIA, |
| 1007 |
"TIA", |
| 1008 |
0, |
| 1009 |
TIA_clock, |
| 1010 |
tia_sh_start, |
| 1011 |
tia_sh_stop, |
| 1012 |
tia_sh_update, |
| 1013 |
0 |
| 1014 |
}, |
| 1015 |
#endif |
| 1016 |
#if (HAS_WAVE) |
| 1017 |
{ |
| 1018 |
SOUND_WAVE, |
| 1019 |
"Cassette", |
| 1020 |
wave_num, |
| 1021 |
0, |
| 1022 |
wave_sh_start, |
| 1023 |
wave_sh_stop, |
| 1024 |
wave_sh_update, |
| 1025 |
0 |
| 1026 |
}, |
| 1027 |
#endif |
| 1028 |
#endif |
| 1029 |
|
| 1030 |
}; |
| 1031 |
|
| 1032 |
|
| 1033 |
|
| 1034 |
|
| 1035 |
int sound_start(void) |
| 1036 |
{ |
| 1037 |
int totalsound = 0; |
| 1038 |
int i; |
| 1039 |
|
| 1040 |
/* Verify the order of entries in the sndintf[] array */ |
| 1041 |
for (i = 0;i < SOUND_COUNT;i++) |
| 1042 |
{ |
| 1043 |
if (sndintf[i].sound_num != i) |
| 1044 |
{ |
| 1045 |
int j; |
| 1046 |
logerror("Sound #%d wrong ID %d: check enum SOUND_... in src/sndintrf.h!\n",i,sndintf[i].sound_num); |
| 1047 |
for (j = 0; j < i; j++) |
| 1048 |
logerror("ID %2d: %s\n", j, sndintf[j].name); |
| 1049 |
return 1; |
| 1050 |
} |
| 1051 |
} |
| 1052 |
|
| 1053 |
|
| 1054 |
/* samples will be read later if needed */ |
| 1055 |
Machine->samples = 0; |
| 1056 |
|
| 1057 |
refresh_period = TIME_IN_HZ(Machine->drv->frames_per_second); |
| 1058 |
refresh_period_inv = 1.0 / refresh_period; |
| 1059 |
sound_update_timer = timer_alloc(NULL); |
| 1060 |
|
| 1061 |
if (mixer_sh_start() != 0) |
| 1062 |
return 1; |
| 1063 |
|
| 1064 |
if (streams_sh_start() != 0) |
| 1065 |
return 1; |
| 1066 |
|
| 1067 |
while (Machine->drv->sound[totalsound].sound_type != 0 && totalsound < MAX_SOUND) |
| 1068 |
{ |
| 1069 |
if ((*sndintf[Machine->drv->sound[totalsound].sound_type].start)(&Machine->drv->sound[totalsound]) != 0) |
| 1070 |
goto getout; |
| 1071 |
|
| 1072 |
totalsound++; |
| 1073 |
} |
| 1074 |
|
| 1075 |
return 0; |
| 1076 |
|
| 1077 |
|
| 1078 |
getout: |
| 1079 |
/* TODO: should also free the resources allocated before */ |
| 1080 |
return 1; |
| 1081 |
} |
| 1082 |
|
| 1083 |
|
| 1084 |
|
| 1085 |
void sound_stop(void) |
| 1086 |
{ |
| 1087 |
int totalsound = 0; |
| 1088 |
|
| 1089 |
|
| 1090 |
while (Machine->drv->sound[totalsound].sound_type != 0 && totalsound < MAX_SOUND) |
| 1091 |
{ |
| 1092 |
if (sndintf[Machine->drv->sound[totalsound].sound_type].stop) |
| 1093 |
(*sndintf[Machine->drv->sound[totalsound].sound_type].stop)(); |
| 1094 |
|
| 1095 |
totalsound++; |
| 1096 |
} |
| 1097 |
|
| 1098 |
streams_sh_stop(); |
| 1099 |
mixer_sh_stop(); |
| 1100 |
|
| 1101 |
/* free audio samples */ |
| 1102 |
Machine->samples = 0; |
| 1103 |
} |
| 1104 |
|
| 1105 |
|
| 1106 |
|
| 1107 |
void sound_update(void) |
| 1108 |
{ |
| 1109 |
int totalsound = 0; |
| 1110 |
|
| 1111 |
|
| 1112 |
profiler_mark(PROFILER_SOUND); |
| 1113 |
|
| 1114 |
while (Machine->drv->sound[totalsound].sound_type != 0 && totalsound < MAX_SOUND) |
| 1115 |
{ |
| 1116 |
if (sndintf[Machine->drv->sound[totalsound].sound_type].update) |
| 1117 |
(*sndintf[Machine->drv->sound[totalsound].sound_type].update)(); |
| 1118 |
|
| 1119 |
totalsound++; |
| 1120 |
} |
| 1121 |
|
| 1122 |
streams_sh_update(); |
| 1123 |
mixer_sh_update(); |
| 1124 |
|
| 1125 |
timer_adjust(sound_update_timer, TIME_NEVER, 0, 0); |
| 1126 |
|
| 1127 |
profiler_mark(PROFILER_END); |
| 1128 |
} |
| 1129 |
|
| 1130 |
|
| 1131 |
void sound_reset(void) |
| 1132 |
{ |
| 1133 |
int totalsound = 0; |
| 1134 |
|
| 1135 |
|
| 1136 |
while (Machine->drv->sound[totalsound].sound_type != 0 && totalsound < MAX_SOUND) |
| 1137 |
{ |
| 1138 |
if (sndintf[Machine->drv->sound[totalsound].sound_type].reset) |
| 1139 |
(*sndintf[Machine->drv->sound[totalsound].sound_type].reset)(); |
| 1140 |
|
| 1141 |
totalsound++; |
| 1142 |
} |
| 1143 |
} |
| 1144 |
|
| 1145 |
|
| 1146 |
|
| 1147 |
const char *sound_name(const struct MachineSound *msound) |
| 1148 |
{ |
| 1149 |
if (msound->sound_type < SOUND_COUNT) |
| 1150 |
return sndintf[msound->sound_type].name; |
| 1151 |
else |
| 1152 |
return ""; |
| 1153 |
} |
| 1154 |
|
| 1155 |
int sound_num(const struct MachineSound *msound) |
| 1156 |
{ |
| 1157 |
if (msound->sound_type < SOUND_COUNT && sndintf[msound->sound_type].chips_num) |
| 1158 |
return (*sndintf[msound->sound_type].chips_num)(msound); |
| 1159 |
else |
| 1160 |
return 0; |
| 1161 |
} |
| 1162 |
|
| 1163 |
int sound_clock(const struct MachineSound *msound) |
| 1164 |
{ |
| 1165 |
if (msound->sound_type < SOUND_COUNT && sndintf[msound->sound_type].chips_clock) |
| 1166 |
return (*sndintf[msound->sound_type].chips_clock)(msound); |
| 1167 |
else |
| 1168 |
return 0; |
| 1169 |
} |
| 1170 |
|
| 1171 |
|
| 1172 |
int sound_scalebufferpos(int value) |
| 1173 |
{ |
| 1174 |
int result = (int)((double)value * timer_timeelapsed(sound_update_timer) * refresh_period_inv); |
| 1175 |
if (value >= 0) return (result < value) ? result : value; |
| 1176 |
else return (result > value) ? result : value; |
| 1177 |
} |
| |