Previous 199869 Revisions Next

r29556 Saturday 12th April, 2014 at 10:13:44 UTC by Fabio Priuli
tms36xx: converted to use inline configs. nw.
[src/emu/sound]tms36xx.c tms36xx.h
[src/mame/audio]segag80r.c
[src/mame/drivers]naughtyb.c phoenix.c

trunk/src/emu/sound/tms36xx.c
r29555r29556
55
66#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
77
8#define VMIN    0x0000
9#define VMAX    0x7fff
10
118/* the frequencies are later adjusted by "* clock / FSCALE" */
129#define FSCALE  1024
1310
r29555r29556
338335      m_enable(0),
339336      m_tune_num(0),
340337      m_tune_ofs(0),
341      m_tune_max(0),
342      m_intf(NULL)
338      m_tune_max(0)
343339{
344340   memset(m_vol, 0, sizeof(int)*12);
345341   memset(m_vol_counter, 0, sizeof(int)*12);
r29555r29556
355351
356352void tms36xx_device::device_start()
357353{
358   int j;
359   int enable;
354   int enable = 0;
360355
361   m_intf = (const tms36xx_interface *)static_config();
362
363356   m_channel = stream_alloc(0, 1, clock() * 64);
364357   m_samplerate = clock() * 64;
365358   m_basefreq = clock();
366   enable = 0;
367   for (j = 0; j < 6; j++)
359
360   for (int j = 0; j < 6; j++)
368361   {
369      if( m_intf->decay[j] > 0 )
362      if (m_decay_time[j] > 0)
370363      {
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];
372365         enable |= 0x41 << j;
373366      }
374367   }
375   m_speed = (m_intf->speed > 0) ? VMAX / m_intf->speed : VMAX;
376368   tms3617_enable(enable);
377369
378370   LOG(("TMS36xx samplerate    %d\n", m_samplerate));
trunk/src/emu/sound/tms36xx.h
r29555r29556
1212#define MCFG_TMS36XX_REPLACE(_tag, _clock) \
1313   MCFG_DEVICE_REPLACE(_tag, TMS36XX, _clock)
1414
15#define MCFG_TMS36XX_TYPE(_type) \
16   tms36xx_device::set_subtype(*device, _type);
1517
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
1625//**************************************************************************
1726//  TYPE DEFINITIONS
1827//**************************************************************************
r29555r29556
2231#define TMS3615     15      // Naughty Boy, Pleiads (13 notes, one output)
2332#define TMS3617     17      // Monster Bash (13 notes, six outputs)
2433
34#define VMIN    0x0000
35#define VMAX    0x7fff
2536
26// ======================> tms36xx_interface
2737
28struct 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
3638// ======================> tms36xx_device
3739
3840class tms36xx_device : public device_t,
r29555r29556
4244   tms36xx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
4345   ~tms36xx_device() { }
4446
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   
4581protected:
4682   // device-level overrides
4783   virtual void device_start();
r29555r29556
6399   void tms36xx_reset_counters();
64100   void tms3617_enable(int enable);
65101
66private:
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
68105   sound_stream *m_channel; // returned by stream_create()
69106
70107   int m_samplerate;     // output sample rate
r29555r29556
80117   int m_shift;          // shift toggles between 0 and 6 to allow decaying voices
81118   int m_vol[12];        // (decaying) volume of harmonics notes
82119   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
84121
85122   int m_counter[12];    // tone frequency counter
86123   int m_frequency[12];  // tone frequency
r29555r29556
90127   int m_tune_num;       // tune currently playing
91128   int m_tune_ofs;       // note currently playing
92129   int m_tune_max;       // end of tune
93
94   const tms36xx_interface *m_intf;
95130};
96131
97132extern const device_type TMS36XX;
trunk/src/mame/drivers/naughtyb.c
r29555r29556
402402GFXDECODE_END
403403
404404
405
406static 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
421405static MACHINE_CONFIG_START( naughtyb, naughtyb_state )
422406
423407   /* basic machine hardware */
r29555r29556
442426   MCFG_SPEAKER_STANDARD_MONO("mono")
443427
444428   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')
446434   MCFG_SOUND_ROUTE(0, "mono", 0.60)
447435
448436   MCFG_SOUND_ADD("naughtyb_custom", NAUGHTYB, 0)
r29555r29556
475463   MCFG_SPEAKER_STANDARD_MONO("mono")
476464
477465   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')
479471   MCFG_SOUND_ROUTE(0, "mono", 0.60)
480472
481473   MCFG_SOUND_ADD("popflame_custom", POPFLAME, 0)
trunk/src/mame/drivers/phoenix.c
r29555r29556
411411GFXDECODE_END
412412
413413
414static 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
421static 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
433414static const ay8910_interface survival_ay8910_interface =
434415{
435416   AY8910_LEGACY_OUTPUT,
r29555r29556
471452   /* sound hardware */
472453   MCFG_SPEAKER_STANDARD_MONO("mono")
473454
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)
476459   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
477460
478461   MCFG_SOUND_ADD("cust", PHOENIX, 0)
r29555r29556
498481
499482   /* sound hardware */
500483   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')
502489   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
503490
504491   MCFG_DEVICE_REMOVE("cust")
trunk/src/mame/audio/segag80r.c
r29555r29556
711711};
712712
713713
714static 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
722714/*************************************
723715 *
724716 *  N7751 memory maps
r29555r29556
769761   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
770762
771763   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)
773766   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
774767
775768   MCFG_DAC_ADD("dac")

Previous 199869 Revisions Next


© 1997-2024 The MAME Team