Previous 199869 Revisions Next

r32107 Saturday 13th September, 2014 at 14:28:14 UTC by Miodrag Milanović
static_config removed from speaker (nw)
[src/emu/bus/ecbbus]grip.c
[src/emu/sound]speaker.c speaker.h
[src/mess/drivers]apogee.c pokemini.c vtech1.c

trunk/src/emu/bus/ecbbus/grip.c
r32106r32107
270270
271271static const INT16 speaker_levels[] = { -32768, 0, 32767, 0 };
272272
273static const speaker_interface speaker_intf =
274{
275   4,
276   speaker_levels
277};
278
279
280273//-------------------------------------------------
281274//  I8255A interface
282275//-------------------------------------------------
r32106r32107
481474   // sound hardware
482475   MCFG_SPEAKER_STANDARD_MONO("mono")
483476   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
484   MCFG_SOUND_CONFIG(speaker_intf)
477   MCFG_SPEAKER_LEVELS(4, speaker_levels)
485478   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
486479
487480   // devices
trunk/src/emu/sound/speaker.c
r32106r32107
8383
8484speaker_sound_device::speaker_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
8585               : device_t(mconfig, SPEAKER_SOUND, "Filtered 1-bit DAC", tag, owner, clock, "speaker_sound", __FILE__),
86                  device_sound_interface(mconfig, *this)
86                  device_sound_interface(mconfig, *this),
87                  m_num_levels(2),
88                  m_levels(default_levels)
8789{
8890}
8991
9092//-------------------------------------------------
91//  device_config_complete - perform any
92//  operations now that the configuration is
93//  complete
94//-------------------------------------------------
95
96void speaker_sound_device::device_config_complete()
97{
98   // inherit a copy of the static data
99   const speaker_interface *intf = reinterpret_cast<const speaker_interface *>(static_config());
100   if (intf != NULL)
101      *static_cast<speaker_interface *>(this) = *intf;
102
103   // or initialize to defaults if none provided
104   else
105   {
106      m_num_levels = 2;
107      m_levels = default_levels;
108   }
109}
110
111//-------------------------------------------------
11293//  device_start - device-specific startup
11394//-------------------------------------------------
11495
trunk/src/emu/sound/speaker.h
r32106r32107
1717   FILTER_LENGTH = 64
1818};
1919
20#define MCFG_SPEAKER_LEVELS(_num, _levels) \
21      speaker_sound_device::static_set_levels(*device, _num, _levels);
2022
21struct speaker_interface
22{
23   int          m_num_levels;  /* optional: number of levels (if not two) */
24   const INT16  *m_levels;     /* optional: pointer to level lookup table */
25};
26
27
2823class speaker_sound_device : public device_t,
29                        public device_sound_interface,
30                        public speaker_interface
24                        public device_sound_interface
3125{
3226public:
3327   speaker_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
3428   ~speaker_sound_device() {}
29   
30   // static configuration
31   static void static_set_levels(device_t &device, int num_levels, const INT16 *levels) { downcast<speaker_sound_device &>(device).m_num_levels = num_levels; downcast<speaker_sound_device &>(device).m_levels = levels;}
3532
3633   void level_w(int new_level);
3734
3835protected:
3936   // device-level overrides
40   virtual void device_config_complete();
4137   virtual void device_start();
4238   virtual void device_reset();
4339
r32106r32107
8480
8581   // DC blocker state
8682   double  m_prevx, m_prevy;
83   
84   int          m_num_levels;  /* optional: number of levels (if not two) */
85   const INT16  *m_levels;     /* optional: pointer to level lookup table */
8786};
8887
8988extern const device_type SPEAKER_SOUND;
trunk/src/mess/drivers/vtech1.c
r32106r32107
415415
416416static const INT16 speaker_levels[] = {-32768, 0, 32767, 0};
417417
418static const speaker_interface vtech1_speaker_interface =
419{
420   4,
421   speaker_levels
422};
423
424418static MACHINE_CONFIG_START( laser110, vtech1_state )
425419
426420   // basic machine hardware
r32106r32107
444438   MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette")
445439   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
446440   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
447   MCFG_SOUND_CONFIG(vtech1_speaker_interface)
441   MCFG_SPEAKER_LEVELS(4, speaker_levels)
448442   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
449443
450444   // peripheral and memory expansion slots
trunk/src/mess/drivers/apogee.c
r32106r32107
144144
145145static const INT16 speaker_levels[] = {-32767, -10922, 10922, 32767};
146146
147static const speaker_interface apogee_speaker_interface =
148{
149   4,
150   speaker_levels
151};
152
153147WRITE_LINE_MEMBER(apogee_state::pit8253_out0_changed)
154148{
155149   m_out0 = state;
r32106r32107
252246   MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette")
253247   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
254248   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
255   MCFG_SOUND_CONFIG(apogee_speaker_interface)
249   MCFG_SPEAKER_LEVELS(4, speaker_levels)
256250   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
257251
258252   MCFG_DEVICE_ADD("dma8257", I8257, XTAL_16MHz / 9)
trunk/src/mess/drivers/pokemini.c
r32106r32107
17501750
17511751static const INT16 speaker_levels[] = {-32768, 0, 32767};
17521752
1753
1754static const speaker_interface pokemini_speaker_interface =
1755{
1756   3,              /* optional: number of different levels */
1757   speaker_levels  /* optional: level lookup table */
1758};
1759
1760
17611753void pokemini_state::video_start()
17621754{
17631755   machine().first_screen()->register_screen_bitmap(m_bitmap);
r32106r32107
17971789   /* sound hardware */
17981790   MCFG_SPEAKER_STANDARD_MONO("mono")
17991791   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
1800   MCFG_SOUND_CONFIG(pokemini_speaker_interface)
1792   MCFG_SPEAKER_LEVELS(3, speaker_levels)
18011793   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
18021794
18031795   /* cartridge */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team