trunk/src/emu/bus/ecbbus/grip.c
r32106 | r32107 | |
270 | 270 | |
271 | 271 | static const INT16 speaker_levels[] = { -32768, 0, 32767, 0 }; |
272 | 272 | |
273 | | static const speaker_interface speaker_intf = |
274 | | { |
275 | | 4, |
276 | | speaker_levels |
277 | | }; |
278 | | |
279 | | |
280 | 273 | //------------------------------------------------- |
281 | 274 | // I8255A interface |
282 | 275 | //------------------------------------------------- |
r32106 | r32107 | |
481 | 474 | // sound hardware |
482 | 475 | MCFG_SPEAKER_STANDARD_MONO("mono") |
483 | 476 | MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) |
484 | | MCFG_SOUND_CONFIG(speaker_intf) |
| 477 | MCFG_SPEAKER_LEVELS(4, speaker_levels) |
485 | 478 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
486 | 479 | |
487 | 480 | // devices |
trunk/src/emu/sound/speaker.c
r32106 | r32107 | |
83 | 83 | |
84 | 84 | speaker_sound_device::speaker_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
85 | 85 | : 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) |
87 | 89 | { |
88 | 90 | } |
89 | 91 | |
90 | 92 | //------------------------------------------------- |
91 | | // device_config_complete - perform any |
92 | | // operations now that the configuration is |
93 | | // complete |
94 | | //------------------------------------------------- |
95 | | |
96 | | void 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 | | //------------------------------------------------- |
112 | 93 | // device_start - device-specific startup |
113 | 94 | //------------------------------------------------- |
114 | 95 | |
trunk/src/emu/sound/speaker.h
r32106 | r32107 | |
17 | 17 | FILTER_LENGTH = 64 |
18 | 18 | }; |
19 | 19 | |
| 20 | #define MCFG_SPEAKER_LEVELS(_num, _levels) \ |
| 21 | speaker_sound_device::static_set_levels(*device, _num, _levels); |
20 | 22 | |
21 | | struct 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 | | |
28 | 23 | class speaker_sound_device : public device_t, |
29 | | public device_sound_interface, |
30 | | public speaker_interface |
| 24 | public device_sound_interface |
31 | 25 | { |
32 | 26 | public: |
33 | 27 | speaker_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
34 | 28 | ~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;} |
35 | 32 | |
36 | 33 | void level_w(int new_level); |
37 | 34 | |
38 | 35 | protected: |
39 | 36 | // device-level overrides |
40 | | virtual void device_config_complete(); |
41 | 37 | virtual void device_start(); |
42 | 38 | virtual void device_reset(); |
43 | 39 | |
r32106 | r32107 | |
84 | 80 | |
85 | 81 | // DC blocker state |
86 | 82 | 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 */ |
87 | 86 | }; |
88 | 87 | |
89 | 88 | extern const device_type SPEAKER_SOUND; |
trunk/src/mess/drivers/vtech1.c
r32106 | r32107 | |
415 | 415 | |
416 | 416 | static const INT16 speaker_levels[] = {-32768, 0, 32767, 0}; |
417 | 417 | |
418 | | static const speaker_interface vtech1_speaker_interface = |
419 | | { |
420 | | 4, |
421 | | speaker_levels |
422 | | }; |
423 | | |
424 | 418 | static MACHINE_CONFIG_START( laser110, vtech1_state ) |
425 | 419 | |
426 | 420 | // basic machine hardware |
r32106 | r32107 | |
444 | 438 | MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") |
445 | 439 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
446 | 440 | MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) |
447 | | MCFG_SOUND_CONFIG(vtech1_speaker_interface) |
| 441 | MCFG_SPEAKER_LEVELS(4, speaker_levels) |
448 | 442 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
449 | 443 | |
450 | 444 | // peripheral and memory expansion slots |
trunk/src/mess/drivers/apogee.c
r32106 | r32107 | |
144 | 144 | |
145 | 145 | static const INT16 speaker_levels[] = {-32767, -10922, 10922, 32767}; |
146 | 146 | |
147 | | static const speaker_interface apogee_speaker_interface = |
148 | | { |
149 | | 4, |
150 | | speaker_levels |
151 | | }; |
152 | | |
153 | 147 | WRITE_LINE_MEMBER(apogee_state::pit8253_out0_changed) |
154 | 148 | { |
155 | 149 | m_out0 = state; |
r32106 | r32107 | |
252 | 246 | MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") |
253 | 247 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
254 | 248 | MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) |
255 | | MCFG_SOUND_CONFIG(apogee_speaker_interface) |
| 249 | MCFG_SPEAKER_LEVELS(4, speaker_levels) |
256 | 250 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) |
257 | 251 | |
258 | 252 | MCFG_DEVICE_ADD("dma8257", I8257, XTAL_16MHz / 9) |
trunk/src/mess/drivers/pokemini.c
r32106 | r32107 | |
1750 | 1750 | |
1751 | 1751 | static const INT16 speaker_levels[] = {-32768, 0, 32767}; |
1752 | 1752 | |
1753 | | |
1754 | | static const speaker_interface pokemini_speaker_interface = |
1755 | | { |
1756 | | 3, /* optional: number of different levels */ |
1757 | | speaker_levels /* optional: level lookup table */ |
1758 | | }; |
1759 | | |
1760 | | |
1761 | 1753 | void pokemini_state::video_start() |
1762 | 1754 | { |
1763 | 1755 | machine().first_screen()->register_screen_bitmap(m_bitmap); |
r32106 | r32107 | |
1797 | 1789 | /* sound hardware */ |
1798 | 1790 | MCFG_SPEAKER_STANDARD_MONO("mono") |
1799 | 1791 | MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) |
1800 | | MCFG_SOUND_CONFIG(pokemini_speaker_interface) |
| 1792 | MCFG_SPEAKER_LEVELS(3, speaker_levels) |
1801 | 1793 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
1802 | 1794 | |
1803 | 1795 | /* cartridge */ |