trunk/src/emu/sound/tms36xx.c
| r29555 | r29556 | |
| 5 | 5 | |
| 6 | 6 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 7 | 7 | |
| 8 | | #define VMIN 0x0000 |
| 9 | | #define VMAX 0x7fff |
| 10 | | |
| 11 | 8 | /* the frequencies are later adjusted by "* clock / FSCALE" */ |
| 12 | 9 | #define FSCALE 1024 |
| 13 | 10 | |
| r29555 | r29556 | |
| 338 | 335 | m_enable(0), |
| 339 | 336 | m_tune_num(0), |
| 340 | 337 | m_tune_ofs(0), |
| 341 | | m_tune_max(0), |
| 342 | | m_intf(NULL) |
| 338 | m_tune_max(0) |
| 343 | 339 | { |
| 344 | 340 | memset(m_vol, 0, sizeof(int)*12); |
| 345 | 341 | memset(m_vol_counter, 0, sizeof(int)*12); |
| r29555 | r29556 | |
| 355 | 351 | |
| 356 | 352 | void tms36xx_device::device_start() |
| 357 | 353 | { |
| 358 | | int j; |
| 359 | | int enable; |
| 354 | int enable = 0; |
| 360 | 355 | |
| 361 | | m_intf = (const tms36xx_interface *)static_config(); |
| 362 | | |
| 363 | 356 | m_channel = stream_alloc(0, 1, clock() * 64); |
| 364 | 357 | m_samplerate = clock() * 64; |
| 365 | 358 | m_basefreq = clock(); |
| 366 | | enable = 0; |
| 367 | | for (j = 0; j < 6; j++) |
| 359 | |
| 360 | for (int j = 0; j < 6; j++) |
| 368 | 361 | { |
| 369 | | if( m_intf->decay[j] > 0 ) |
| 362 | if (m_decay_time[j] > 0) |
| 370 | 363 | { |
| 371 | | m_decay[j+0] = m_decay[j+6] = VMAX / m_intf->decay[j]; |
| 364 | m_decay[j+0] = m_decay[j+6] = VMAX / m_decay_time[j]; |
| 372 | 365 | enable |= 0x41 << j; |
| 373 | 366 | } |
| 374 | 367 | } |
| 375 | | m_speed = (m_intf->speed > 0) ? VMAX / m_intf->speed : VMAX; |
| 376 | 368 | tms3617_enable(enable); |
| 377 | 369 | |
| 378 | 370 | LOG(("TMS36xx samplerate %d\n", m_samplerate)); |
trunk/src/emu/sound/tms36xx.h
| r29555 | r29556 | |
| 12 | 12 | #define MCFG_TMS36XX_REPLACE(_tag, _clock) \ |
| 13 | 13 | MCFG_DEVICE_REPLACE(_tag, TMS36XX, _clock) |
| 14 | 14 | |
| 15 | #define MCFG_TMS36XX_TYPE(_type) \ |
| 16 | tms36xx_device::set_subtype(*device, _type); |
| 15 | 17 | |
| 18 | #define MCFG_TMS36XX_DECAY_TIMES(_dec0, _dec1, _dec2, _dec3, _dec4, _dec5) \ |
| 19 | tms36xx_device::set_decays(*device, _dec0, _dec1, _dec2, _dec3, _dec4, _dec5); |
| 20 | |
| 21 | #define MCFG_TMS36XX_TUNE_SPEED(_speed) \ |
| 22 | tms36xx_device::set_tune_speed(*device, _speed); |
| 23 | |
| 24 | |
| 16 | 25 | //************************************************************************** |
| 17 | 26 | // TYPE DEFINITIONS |
| 18 | 27 | //************************************************************************** |
| r29555 | r29556 | |
| 22 | 31 | #define TMS3615 15 // Naughty Boy, Pleiads (13 notes, one output) |
| 23 | 32 | #define TMS3617 17 // Monster Bash (13 notes, six outputs) |
| 24 | 33 | |
| 34 | #define VMIN 0x0000 |
| 35 | #define VMAX 0x7fff |
| 25 | 36 | |
| 26 | | // ======================> tms36xx_interface |
| 27 | 37 | |
| 28 | | struct tms36xx_interface |
| 29 | | { |
| 30 | | int subtype; |
| 31 | | double decay[6]; // decay times for the six harmonic notes |
| 32 | | double speed; // tune speed (meaningful for the TMS3615 only) |
| 33 | | }; |
| 34 | | |
| 35 | | |
| 36 | 38 | // ======================> tms36xx_device |
| 37 | 39 | |
| 38 | 40 | class tms36xx_device : public device_t, |
| r29555 | r29556 | |
| 42 | 44 | tms36xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 43 | 45 | ~tms36xx_device() { } |
| 44 | 46 | |
| 47 | static void set_subtype(device_t &device, int type) |
| 48 | { |
| 49 | tms36xx_device &dev = downcast<tms36xx_device &>(device); |
| 50 | switch (type) |
| 51 | { |
| 52 | case MM6221AA: |
| 53 | dev.m_subtype = "MM6221AA"; |
| 54 | break; |
| 55 | case TMS3615: |
| 56 | dev.m_subtype = "TMS3615"; |
| 57 | break; |
| 58 | case TMS3617: |
| 59 | dev.m_subtype = "TMS3617"; |
| 60 | break; |
| 61 | default: |
| 62 | fatalerror("Invalid TMS36XX type: %d\n", type); |
| 63 | break; |
| 64 | } |
| 65 | } |
| 66 | static void set_tune_speed(device_t &device, double speed) |
| 67 | { |
| 68 | downcast<tms36xx_device &>(device).m_speed = (speed > 0) ? VMAX / speed : VMAX; |
| 69 | } |
| 70 | static void set_decays(device_t &device, double decay_0, double decay_1, double decay_2, double decay_3, double decay_4, double decay_5) |
| 71 | { |
| 72 | tms36xx_device &dev = downcast<tms36xx_device &>(device); |
| 73 | dev.m_decay_time[0] = decay_0; |
| 74 | dev.m_decay_time[1] = decay_1; |
| 75 | dev.m_decay_time[2] = decay_2; |
| 76 | dev.m_decay_time[3] = decay_3; |
| 77 | dev.m_decay_time[4] = decay_4; |
| 78 | dev.m_decay_time[5] = decay_5; |
| 79 | } |
| 80 | |
| 45 | 81 | protected: |
| 46 | 82 | // device-level overrides |
| 47 | 83 | virtual void device_start(); |
| r29555 | r29556 | |
| 63 | 99 | void tms36xx_reset_counters(); |
| 64 | 100 | void tms3617_enable(int enable); |
| 65 | 101 | |
| 66 | | private: |
| 67 | | char *m_subtype; // subtype name MM6221AA, TMS3615 or TMS3617 |
| 102 | double m_decay_time[6]; // decay times for the six harmonic notes |
| 103 | |
| 104 | const char *m_subtype; // subtype name MM6221AA, TMS3615 or TMS3617 |
| 68 | 105 | sound_stream *m_channel; // returned by stream_create() |
| 69 | 106 | |
| 70 | 107 | int m_samplerate; // output sample rate |
| r29555 | r29556 | |
| 80 | 117 | int m_shift; // shift toggles between 0 and 6 to allow decaying voices |
| 81 | 118 | int m_vol[12]; // (decaying) volume of harmonics notes |
| 82 | 119 | int m_vol_counter[12];// volume adjustment counter |
| 83 | | int m_decay[12]; // volume adjustment rate - dervied from decay |
| 120 | int m_decay[12]; // volume adjustment rate - derived from m_intf_decay |
| 84 | 121 | |
| 85 | 122 | int m_counter[12]; // tone frequency counter |
| 86 | 123 | int m_frequency[12]; // tone frequency |
| r29555 | r29556 | |
| 90 | 127 | int m_tune_num; // tune currently playing |
| 91 | 128 | int m_tune_ofs; // note currently playing |
| 92 | 129 | int m_tune_max; // end of tune |
| 93 | | |
| 94 | | const tms36xx_interface *m_intf; |
| 95 | 130 | }; |
| 96 | 131 | |
| 97 | 132 | extern const device_type TMS36XX; |
trunk/src/mame/drivers/naughtyb.c
| r29555 | r29556 | |
| 402 | 402 | GFXDECODE_END |
| 403 | 403 | |
| 404 | 404 | |
| 405 | | |
| 406 | | static const tms36xx_interface tms3615_interface = |
| 407 | | { |
| 408 | | TMS3615, /* TMS36xx subtype */ |
| 409 | | /* |
| 410 | | * Decay times of the voices; NOTE: it's unknown if |
| 411 | | * the the TMS3615 mixes more than one voice internally. |
| 412 | | * A wav taken from Pop Flamer sounds like there |
| 413 | | * are at least no 'odd' harmonics (5 1/3' and 2 2/3') |
| 414 | | */ |
| 415 | | {0.15,0.20,0,0,0,0} |
| 416 | | |
| 417 | | }; |
| 418 | | |
| 419 | | |
| 420 | | |
| 421 | 405 | static MACHINE_CONFIG_START( naughtyb, naughtyb_state ) |
| 422 | 406 | |
| 423 | 407 | /* basic machine hardware */ |
| r29555 | r29556 | |
| 442 | 426 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 443 | 427 | |
| 444 | 428 | MCFG_TMS36XX_ADD("tms", 350) |
| 445 | | MCFG_SOUND_CONFIG(tms3615_interface) |
| 429 | MCFG_TMS36XX_TYPE(TMS3615) |
| 430 | MCFG_TMS36XX_DECAY_TIMES(0.15, 0.20, 0, 0, 0, 0) |
| 431 | // NOTE: it's unknown if the TMS3615 mixes more than one voice internally. |
| 432 | // A wav taken from Pop Flamer sounds like there are at least no 'odd' |
| 433 | // harmonics (5 1/3' and 2 2/3') |
| 446 | 434 | MCFG_SOUND_ROUTE(0, "mono", 0.60) |
| 447 | 435 | |
| 448 | 436 | MCFG_SOUND_ADD("naughtyb_custom", NAUGHTYB, 0) |
| r29555 | r29556 | |
| 475 | 463 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 476 | 464 | |
| 477 | 465 | MCFG_TMS36XX_ADD("tms", 350) |
| 478 | | MCFG_SOUND_CONFIG(tms3615_interface) |
| 466 | MCFG_TMS36XX_TYPE(TMS3615) |
| 467 | MCFG_TMS36XX_DECAY_TIMES(0.15, 0.20, 0, 0, 0, 0) |
| 468 | // NOTE: it's unknown if the TMS3615 mixes more than one voice internally. |
| 469 | // A wav taken from Pop Flamer sounds like there are at least no 'odd' |
| 470 | // harmonics (5 1/3' and 2 2/3') |
| 479 | 471 | MCFG_SOUND_ROUTE(0, "mono", 0.60) |
| 480 | 472 | |
| 481 | 473 | MCFG_SOUND_ADD("popflame_custom", POPFLAME, 0) |
trunk/src/mame/drivers/phoenix.c
| r29555 | r29556 | |
| 411 | 411 | GFXDECODE_END |
| 412 | 412 | |
| 413 | 413 | |
| 414 | | static const tms36xx_interface phoenix_tms36xx_interface = |
| 415 | | { |
| 416 | | MM6221AA, /* TMS36xx subtype(s) */ |
| 417 | | {0.50,0,0,1.05,0,0}, /* decay times of voices */ |
| 418 | | 0.21 /* tune speed (time between beats) */ |
| 419 | | }; |
| 420 | | |
| 421 | | static const tms36xx_interface pleiads_tms36xx_interface = |
| 422 | | { |
| 423 | | TMS3615, /* TMS36xx subtype(s) */ |
| 424 | | /* |
| 425 | | * Decay times of the voices; NOTE: it's unknown if |
| 426 | | * the the TMS3615 mixes more than one voice internally. |
| 427 | | * A wav taken from Pop Flamer sounds like there |
| 428 | | * are at least no 'odd' harmonics (5 1/3' and 2 2/3') |
| 429 | | */ |
| 430 | | {0.33,0.33,0,0.33,0,0.33} |
| 431 | | }; |
| 432 | | |
| 433 | 414 | static const ay8910_interface survival_ay8910_interface = |
| 434 | 415 | { |
| 435 | 416 | AY8910_LEGACY_OUTPUT, |
| r29555 | r29556 | |
| 471 | 452 | /* sound hardware */ |
| 472 | 453 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 473 | 454 | |
| 474 | | MCFG_TMS36XX_ADD("tms", 372) |
| 475 | | MCFG_SOUND_CONFIG(phoenix_tms36xx_interface) |
| 455 | MCFG_TMS36XX_ADD("tms", 372) |
| 456 | MCFG_TMS36XX_TYPE(MM6221AA) |
| 457 | MCFG_TMS36XX_DECAY_TIMES(0.50, 0, 0, 1.05, 0, 0) |
| 458 | MCFG_TMS36XX_TUNE_SPEED(0.21) |
| 476 | 459 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) |
| 477 | 460 | |
| 478 | 461 | MCFG_SOUND_ADD("cust", PHOENIX, 0) |
| r29555 | r29556 | |
| 498 | 481 | |
| 499 | 482 | /* sound hardware */ |
| 500 | 483 | MCFG_TMS36XX_REPLACE("tms", 247) |
| 501 | | MCFG_SOUND_CONFIG(pleiads_tms36xx_interface) |
| 484 | MCFG_TMS36XX_TYPE(TMS3615) |
| 485 | MCFG_TMS36XX_DECAY_TIMES(0.33, 0.33, 0, 0.33, 0, 0.33) |
| 486 | // NOTE: it's unknown if the TMS3615 mixes more than one voice internally. |
| 487 | // A wav taken from Pop Flamer sounds like there are at least no 'odd' |
| 488 | // harmonics (5 1/3' and 2 2/3') |
| 502 | 489 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
| 503 | 490 | |
| 504 | 491 | MCFG_DEVICE_REMOVE("cust") |
trunk/src/mame/audio/segag80r.c
| r29555 | r29556 | |
| 711 | 711 | }; |
| 712 | 712 | |
| 713 | 713 | |
| 714 | | static const tms36xx_interface monsterb_tms3617_interface = |
| 715 | | { |
| 716 | | TMS3617, |
| 717 | | {0.5,0.5,0.5,0.5,0.5,0.5} /* decay times of voices */ |
| 718 | | }; |
| 719 | | |
| 720 | | |
| 721 | | |
| 722 | 714 | /************************************* |
| 723 | 715 | * |
| 724 | 716 | * N7751 memory maps |
| r29555 | r29556 | |
| 769 | 761 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 770 | 762 | |
| 771 | 763 | MCFG_TMS36XX_ADD("music", 247) |
| 772 | | MCFG_SOUND_CONFIG(monsterb_tms3617_interface) |
| 764 | MCFG_TMS36XX_TYPE(TMS3617) |
| 765 | MCFG_TMS36XX_DECAY_TIMES(0.5, 0.5, 0.5, 0.5, 0.5, 0.5) |
| 773 | 766 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 774 | 767 | |
| 775 | 768 | MCFG_DAC_ADD("dac") |