Previous 199869 Revisions Next

r18045 Thursday 20th September, 2012 at 13:58:28 UTC by Robbbert
Flicker: replaced temporary beeper sound with samples.
[src/mame/drivers]flicker.c
[src/mame/machine]genpin.c* genpin.h*

trunk/src/mame/machine/genpin.c
r0r18045
1/*********************************************************************************
2
3This is for common pinball machine coding.
4
5**********************************************************************************/
6
7
8
9#include "genpin.h"
10
11// nothing yet
12
13
trunk/src/mame/machine/genpin.h
r0r18045
1#ifndef GENPIN_H_
2#define GENPIN_H_
3
4
5#include "emu.h"
6#include "sound/samples.h"
7
8
9
10static const char *const genpin_sample_names[] =
11{
12   "*genpin",
13   "bumper",
14   "chime1",
15   "chime2",
16   "chime3",
17   "coinin",
18   "hole",
19   "knocker",
20   0   /* end of array */
21};
22
23static const samples_interface genpin_samples_intf =
24{
25   4, // channels
26   genpin_sample_names
27};
28
29MACHINE_CONFIG_FRAGMENT( genpin_audio )
30   MCFG_SPEAKER_STANDARD_MONO("mono")
31   MCFG_SAMPLES_ADD("samples", genpin_samples_intf)
32   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
33MACHINE_CONFIG_END
34
35
36#endif /* GENPIN_H_ */
No newline at end of file
trunk/src/mame/drivers/flicker.c
r18044r18045
1818
1919************************************************************************************/
2020
21#include "emu.h"
21#include "machine/genpin.h"
2222#include "cpu/i4004/i4004.h"
23#include "sound/beep.h"
2423#include "flicker.lh"
2524
2625class flicker_state : public driver_device
r18044r18045
2928   flicker_state(const machine_config &mconfig, device_type type, const char *tag)
3029      : driver_device(mconfig, type, tag),
3130   m_maincpu(*this, "maincpu"),
32   m_beeper(*this, BEEPER_TAG)
31   m_samples(*this, "samples")
3332   { }
3433
3534   DECLARE_WRITE8_MEMBER(port00_w);
r18044r18045
4140
4241   // devices
4342   required_device<cpu_device> m_maincpu;
44   required_device<device_t> m_beeper;
43   required_device<samples_device> m_samples;
4544
4645   // driver_device overrides
4746   virtual void machine_reset();
47private:
48   UINT8 m_out_data;
4849};
4950
5051
r18044r18045
161162    8 = 3000 hole
162163    9 = knocker
163164    A = coin counter
164    B = coin acceptor */
165   offset = m_maincpu->state_int(I4004_RAM) & 0x0f; // we need the full address
166   if (data && data != offset)
165    B = coin acceptor
166
167The coin outputs (A and B) don't activate
168
169A large amount of data is continuously flowing through here, even when there is no
170sound to produce. We need to change this to just one pulse per actual sound. */
171
172   if (!data && offset == m_out_data)
173      m_out_data = 0;
174   else
167175   {
168      switch (offset)
176      offset = m_maincpu->state_int(I4004_RAM) & 0x0f; // we need the full address
177      if (data != offset)
169178      {
170         case 0x01:
171            beep_set_state(m_beeper, 1);
172            beep_set_frequency(m_beeper, 2000);
173            break;
174         case 0x02:
175            beep_set_state(m_beeper, 1);
176            beep_set_frequency(m_beeper, 1500);
177            break;
178         case 0x03:
179            beep_set_state(m_beeper, 1);
180            beep_set_frequency(m_beeper, 800);
181            break;
182         case 0x09:
183            beep_set_state(m_beeper, 1);
184            beep_set_frequency(m_beeper, 200);
185            break;
186         case 0x0a:
187            //coin_counter_w(machine(), 0, 1);
188            //coin_counter_w(machine(), 0, 0);
189            break;
190         default:
191            break;
179         if (data != m_out_data)
180         {
181            m_out_data = data;
182            switch (data)
183            {
184               case 0x01:
185                  m_samples->start(1, 1);
186                  break;
187               case 0x02:
188                  m_samples->start(2, 2);
189                  break;
190               case 0x03:
191                  m_samples->start(3, 3);
192                  break;
193               case 0x04:
194               case 0x05:
195               case 0x06:
196                  m_samples->start(0, 0);
197                  break;
198               case 0x07:
199               case 0x08:
200                  m_samples->start(0, 5);
201                  break;
202               case 0x09:
203                  m_samples->start(0, 6);
204                  break;
205               default:
206                  break;
207            }
208         }
192209      }
193210   }
194   else
195      beep_set_state(m_beeper, 0);
196211}
197212
198213
r18044r18045
211226   MCFG_DEFAULT_LAYOUT(layout_flicker)
212227
213228   /* Sound */
214   MCFG_SPEAKER_STANDARD_MONO("mono")
215   MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)
216   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
229   MCFG_FRAGMENT_ADD( genpin_audio )
217230MACHINE_CONFIG_END
218231
219232

Previous 199869 Revisions Next


© 1997-2024 The MAME Team