Previous 199869 Revisions Next

r31906 Thursday 4th September, 2014 at 17:49:30 UTC by Osso
samples_device: converted to use inline config and delegates. Will probably need clean compile. (nw)
[src/emu/bus/nes]jaleco.c pt554.c
[src/emu/sound]samples.c samples.h
[src/mame/audio]8080bw.c astrof.c blockade.c carnival.c cclimber.c cclimber.h cinemat.c circus.c depthch.c gottlieb.c invinco.c meadows.c mw8080bw.c polyplay.c pulsar.c segag80r.c snk6502.c spacefb.c suna8.c targ.c triplhnt.c turbo.c vicdual.c zaxxon.c
[src/mame/drivers]8080bw.c aristmk4.c astinvad.c astrocde.c blockade.c circus.c cosmic.c dai3wksi.c equites.c galaga.c gaplus.c gotya.c gridlee.c homerun.c m10.c m63.c mcr.c meadows.c ninjakd2.c polyplay.c rallyx.c rotaryf.c safarir.c segag80v.c snk6502.c starcrus.c starfire.c suna8.c superqix.c tankbatt.c thief.c tmnt.c tnzs.c triplhnt.c
[src/mame/includes]8080bw.h blockade.h circus.h exidy.h meadows.h ninjakd2.h polyplay.h snk6502.h suna8.h superqix.h thief.h tmnt.h tnzs.h triplhnt.h turbo.h
[src/mame/machine]genpin.c genpin.h

trunk/src/emu/sound/samples.c
r31905r31906
5353
5454samples_device::samples_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
5555   : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
56      device_sound_interface(mconfig, *this)
56      device_sound_interface(mconfig, *this),
57      m_channels(0),
58      m_names(NULL)
5759{
5860}
5961
6062
61//-------------------------------------------------
62//  static_set_interface - configuration helper
63//  to set the interface
64//-------------------------------------------------
65
66void samples_device::static_set_interface(device_t &device, const samples_interface &interface)
67{
68   samples_device &samples = downcast<samples_device &>(device);
69   static_cast<samples_interface &>(samples) = interface;
70}
71
72
73
7463//**************************************************************************
7564//  PUBLIC INTERFACE
7665//**************************************************************************
r31905r31906
272261   }
273262
274263   // initialize any custom handlers
275   if (m_start != NULL)
276      (*m_start)(*this);
264   m_samples_start_cb.bind_relative_to(*owner());
265   
266   if (!m_samples_start_cb.isnull())
267      m_samples_start_cb();
277268}
278269
279270
trunk/src/emu/sound/samples.h
r31905r31906
1818//  INTERFACE CONFIGURATION MACROS
1919//**************************************************************************
2020
21#define MCFG_SAMPLES_ADD(_tag, _interface) \
22   MCFG_DEVICE_ADD(_tag, SAMPLES, 0) \
23   samples_device::static_set_interface(*device, _interface);
21#define MCFG_SAMPLES_CHANNELS(_channels) \
22   samples_device::static_set_channels(*device, _channels);
2423
25#define MCFG_SAMPLES_REPLACE(_tag, _interface) \
26   MCFG_DEVICE_REPLACE(_tag, SAMPLES, 0) \
27   samples_device::static_set_interface(*device, _interface);
24#define MCFG_SAMPLES_NAMES(_names) \
25   samples_device::static_set_samples_names(*device, _names);
26   
27typedef device_delegate<void ()> samples_start_cb_delegate;
2828
29#define SAMPLES_START_CB_MEMBER(_name) void _name()
30   
31#define MCFG_SAMPLES_START_CB(_class, _method) \
32   samples_device::set_samples_start_callback(*device, samples_start_cb_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
2933
30#define SAMPLES_START(name) void name(samples_device &device)
31
32
33
3434//**************************************************************************
3535//  TYPE DEFINITIONS
3636//**************************************************************************
3737
38class samples_device;
39
40
41// ======================> samples_interface sample
42
43struct samples_interface
44{
45   UINT8       m_channels;         // number of discrete audio channels needed
46   const char *const *m_names;     // array of sample names
47   void        (*m_start)(samples_device &device); // optional callback
48};
49
50
5138// ======================> samples_device
5239
5340class samples_device :  public device_t,
54                  public device_sound_interface,
55                  public samples_interface
41                  public device_sound_interface
5642{
5743public:
5844   // construction/destruction
5945   samples_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
6046
6147   // static configuration helpers
62   static void static_set_interface(device_t &device, const samples_interface &interface);
48   static void static_set_channels(device_t &device, UINT8 channels) { downcast<samples_device &>(device).m_channels = channels; }
49   static void static_set_samples_names(device_t &device, const char *const *names) { downcast<samples_device &>(device).m_names = names; }
50   static void set_samples_start_callback(device_t &device, samples_start_cb_delegate callback) { downcast<samples_device &>(device).m_samples_start_cb = callback; }
6351
6452   // getters
6553   bool playing(UINT8 channel) const;
r31905r31906
8674      dynamic_array<INT16> data;      // 16-bit signed data
8775   };
8876   static bool read_sample(emu_file &file, sample_t &sample);
77   
78   // interface
79   UINT8       m_channels;         // number of discrete audio channels needed
80   const char *const *m_names;     // array of sample names
81   samples_start_cb_delegate m_samples_start_cb; // optional callback
8982
9083protected:
9184   // subclasses can do it this way
r31905r31906
140133{
141134public:
142135   // construction/destruction
143   samples_iterator(samples_interface &intf)
144      : m_intf(intf),
136   samples_iterator(samples_device &device)
137      : m_samples(device),
145138         m_current(-1) { }
146139
147140   // getters
148   const char *altbasename() const { return (m_intf.m_names != NULL && m_intf.m_names[0] != NULL && m_intf.m_names[0][0] == '*') ? &m_intf.m_names[0][1] : NULL; }
141   const char *altbasename() const { return (m_samples.m_names != NULL && m_samples.m_names[0] != NULL && m_samples.m_names[0][0] == '*') ? &m_samples.m_names[0][1] : NULL; }
149142
150143   // iteration
151144   const char *first()
152145   {
153      if (m_intf.m_names == NULL || m_intf.m_names[0] == NULL)
146      if (m_samples.m_names == NULL || m_samples.m_names[0] == NULL)
154147         return NULL;
155148      m_current = 0;
156      if (m_intf.m_names[0][0] == '*')
149      if (m_samples.m_names[0][0] == '*')
157150         m_current++;
158      return m_intf.m_names[m_current++];
151      return m_samples.m_names[m_current++];
159152   }
160153
161154   const char *next()
162155   {
163      if (m_current == -1 || m_intf.m_names[m_current] == NULL)
156      if (m_current == -1 || m_samples.m_names[m_current] == NULL)
164157         return NULL;
165      return m_intf.m_names[m_current++];
158      return m_samples.m_names[m_current++];
166159   }
167160
168161   // counting
r31905r31906
178171
179172private:
180173   // internal state
181   samples_interface &     m_intf;
174   samples_device &m_samples;
182175   int                     m_current;
183176};
184177
trunk/src/emu/bus/nes/pt554.c
r31905r31906
8383   0
8484};
8585
86static const samples_interface pt554_samples_interface =
87{
88   8,   /* channels */
89   pt554_sample_names
90};
91
92
9386//-------------------------------------------------
9487//  MACHINE_DRIVER
9588//-------------------------------------------------
r31905r31906
9992   // additional sound hardware
10093   MCFG_SPEAKER_STANDARD_MONO("addon")
10194
102   MCFG_SAMPLES_ADD("samples", pt554_samples_interface)
95   MCFG_SOUND_ADD("samples", SAMPLES, 0)
96   MCFG_SAMPLES_CHANNELS(8)
97   MCFG_SAMPLES_NAMES(pt554_sample_names)
10398   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 0.50)
10499MACHINE_CONFIG_END
105100
trunk/src/emu/bus/nes/jaleco.c
r31905r31906
766766   0
767767};
768768
769static const samples_interface jf13_samples_interface =
770{
771   16,   /* channels */
772   jf13_sample_names
773};
774
775static const samples_interface jf17_samples_interface =
776{
777   20,   /* channels */
778   jf17_sample_names
779};
780
781static const samples_interface jf19_samples_interface =
782{
783   20,   /* channels */
784   jf19_sample_names
785};
786
787static const samples_interface jf23_samples_interface =
788{
789   20,   /* channels */
790   jf23_sample_names
791};
792
793static const samples_interface jf24_samples_interface =
794{
795   6,   /* channels */
796   jf24_sample_names
797};
798
799static const samples_interface jf29_samples_interface =
800{
801   20,   /* channels */
802   jf29_sample_names
803};
804
805static const samples_interface jf33_samples_interface =
806{
807   20,   /* channels */
808   jf33_sample_names
809};
810
811
812769//-------------------------------------------------
813770//  MACHINE_DRIVER
814771//-------------------------------------------------
r31905r31906
818775   // additional sound hardware
819776   MCFG_SPEAKER_STANDARD_MONO("addon")
820777
821   MCFG_SAMPLES_ADD("samples", jf13_samples_interface)
778   MCFG_SOUND_ADD("samples", SAMPLES, 0)
779   MCFG_SAMPLES_CHANNELS(16)
780   MCFG_SAMPLES_NAMES(jf13_sample_names)
822781   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 0.50)
823782MACHINE_CONFIG_END
824783
r31905r31906
827786   // additional sound hardware
828787   MCFG_SPEAKER_STANDARD_MONO("addon")
829788
830   MCFG_SAMPLES_ADD("samples", jf17_samples_interface)
789   MCFG_SOUND_ADD("samples", SAMPLES, 0)
790   MCFG_SAMPLES_CHANNELS(20)
791   MCFG_SAMPLES_NAMES(jf17_sample_names)
831792   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 0.50)
832793MACHINE_CONFIG_END
833794
r31905r31906
836797   // additional sound hardware
837798   MCFG_SPEAKER_STANDARD_MONO("addon")
838799
839   MCFG_SAMPLES_ADD("samples", jf19_samples_interface)
800   MCFG_SOUND_ADD("samples", SAMPLES, 0)
801   MCFG_SAMPLES_CHANNELS(20)
802   MCFG_SAMPLES_NAMES(jf19_sample_names)
840803   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 0.50)
841804MACHINE_CONFIG_END
842805
r31905r31906
845808   // additional sound hardware
846809   MCFG_SPEAKER_STANDARD_MONO("addon")
847810
848   MCFG_SAMPLES_ADD("samples", jf23_samples_interface)
811   MCFG_SOUND_ADD("samples", SAMPLES, 0)
812   MCFG_SAMPLES_CHANNELS(20)
813   MCFG_SAMPLES_NAMES(jf23_sample_names)
849814   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 0.50)
850815MACHINE_CONFIG_END
851816
r31905r31906
854819   // additional sound hardware
855820   MCFG_SPEAKER_STANDARD_MONO("addon")
856821
857   MCFG_SAMPLES_ADD("samples", jf24_samples_interface)
822   MCFG_SOUND_ADD("samples", SAMPLES, 0)
823   MCFG_SAMPLES_CHANNELS(6)
824   MCFG_SAMPLES_NAMES(jf24_sample_names)
858825   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 0.50)
859826MACHINE_CONFIG_END
860827
r31905r31906
863830   // additional sound hardware
864831   MCFG_SPEAKER_STANDARD_MONO("addon")
865832
866   MCFG_SAMPLES_ADD("samples", jf29_samples_interface)
833   MCFG_SOUND_ADD("samples", SAMPLES, 0)
834   MCFG_SAMPLES_CHANNELS(20)
835   MCFG_SAMPLES_NAMES(jf29_sample_names)
867836   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 0.50)
868837MACHINE_CONFIG_END
869838
r31905r31906
872841   // additional sound hardware
873842   MCFG_SPEAKER_STANDARD_MONO("addon")
874843
875   MCFG_SAMPLES_ADD("samples", jf33_samples_interface)
844   MCFG_SOUND_ADD("samples", SAMPLES, 0)
845   MCFG_SAMPLES_CHANNELS(20)
846   MCFG_SAMPLES_NAMES(jf33_sample_names)
876847   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "addon", 0.50)
877848MACHINE_CONFIG_END
878849
trunk/src/mame/audio/triplhnt.c
r31905r31906
88#include "sound/discrete.h"
99
1010
11static const char *const triplhnt_sample_names[] =
11const char *const triplhnt_sample_names[] =
1212{
1313   "*triplhnt",
1414   "bear_rac",
r31905r31906
1616   0
1717};
1818
19const samples_interface triplhnt_samples_interface =
20{
21   2,  /* 2 channels */
22   triplhnt_sample_names
23};
24
25
2619/************************************************************************/
2720/* triplhnt Sound System Analog emulation                               */
2821/* Feb 2004, Derrick Renaud                                             */
trunk/src/mame/audio/mw8080bw.c
r31905r31906
140140   0
141141};
142142
143
144static const samples_interface seawolf_samples_interface =
145{
146   5,  /* 5 channels */
147   seawolf_sample_names
148};
149
150
151143MACHINE_CONFIG_FRAGMENT( seawolf_audio )
152144   MCFG_SOUND_START_OVERRIDE(mw8080bw_state, samples)
153145
154146   MCFG_SPEAKER_STANDARD_MONO("mono")
155   MCFG_SAMPLES_ADD("samples", seawolf_samples_interface)
147   MCFG_SOUND_ADD("samples", SAMPLES, 0)
148   MCFG_SAMPLES_CHANNELS(5)
149   MCFG_SAMPLES_NAMES(seawolf_sample_names)
156150   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.6)
157151MACHINE_CONFIG_END
158152
r31905r31906
200194};
201195
202196
203static const samples_interface gunfight_samples_interface =
204{
205   1,  /* 1 channel */
206   gunfight_sample_names
207};
208
209
210197MACHINE_CONFIG_FRAGMENT( gunfight_audio )
211198   MCFG_SOUND_START_OVERRIDE(mw8080bw_state, samples)
212199
213200   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
214201
215   MCFG_SAMPLES_ADD("samples1", gunfight_samples_interface)
202   MCFG_SOUND_ADD("samples1", SAMPLES, 0)
203   MCFG_SAMPLES_CHANNELS(1)
204   MCFG_SAMPLES_NAMES(gunfight_sample_names)
216205   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50)
217206
218   MCFG_SAMPLES_ADD("samples2", gunfight_samples_interface)
207   MCFG_SOUND_ADD("samples2", SAMPLES, 0)
208   MCFG_SAMPLES_CHANNELS(1)
209   MCFG_SAMPLES_NAMES(gunfight_sample_names)
219210   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50)
220211MACHINE_CONFIG_END
221212
r31905r31906
15521543   0
15531544};
15541545
1555
1556static const samples_interface gmissile_samples_interface =
1557{
1558   1,  /* 1 channel */
1559   gmissile_sample_names
1560};
1561
1562
15631546MACHINE_CONFIG_FRAGMENT( gmissile_audio )
15641547   MCFG_SOUND_START_OVERRIDE(mw8080bw_state, samples)
15651548
15661549   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
15671550
1568   MCFG_SAMPLES_ADD("samples1", gmissile_samples_interface)
1551   MCFG_SOUND_ADD("samples1", SAMPLES, 0)
1552   MCFG_SAMPLES_CHANNELS(1)
1553   MCFG_SAMPLES_NAMES(gmissile_sample_names)
15691554   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.9)
15701555
1571   MCFG_SAMPLES_ADD("samples2", gmissile_samples_interface)
1556   MCFG_SOUND_ADD("samples2", SAMPLES, 0)
1557   MCFG_SAMPLES_CHANNELS(1)
1558   MCFG_SAMPLES_NAMES(gmissile_sample_names)
15721559   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.9)
15731560MACHINE_CONFIG_END
15741561
r31905r31906
16491636};
16501637
16511638
1652static const samples_interface m4_samples_interface =
1653{
1654   2,  /* 2 channels */
1655   m4_sample_names
1656};
1657
1658
16591639MACHINE_CONFIG_FRAGMENT( m4_audio )
16601640   MCFG_SOUND_START_OVERRIDE(mw8080bw_state, samples)
16611641
16621642   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
16631643
1664   MCFG_SAMPLES_ADD("samples1", m4_samples_interface)
1644   MCFG_SOUND_ADD("samples1", SAMPLES, 0)
1645   MCFG_SAMPLES_CHANNELS(2)
1646   MCFG_SAMPLES_NAMES(m4_sample_names)
16651647   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1)
16661648
1667   MCFG_SAMPLES_ADD("samples2", m4_samples_interface)
1649   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1650   MCFG_SAMPLES_CHANNELS(2)
1651   MCFG_SAMPLES_NAMES(m4_sample_names)
16681652   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1)
16691653MACHINE_CONFIG_END
16701654
r31905r31906
19071891   0
19081892};
19091893
1910static const samples_interface clowns_samples_interface =
1911{
1912   1,  /* 1 channel */
1913   clowns_sample_names
1914};
1915
1916
19171894MACHINE_CONFIG_FRAGMENT( clowns_audio )
19181895   MCFG_SOUND_START_OVERRIDE(mw8080bw_state, samples)
19191896
19201897   MCFG_SPEAKER_STANDARD_MONO("mono")
19211898
1922   MCFG_SAMPLES_ADD("samples", clowns_samples_interface)
1899   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1900   MCFG_SAMPLES_CHANNELS(1)
1901   MCFG_SAMPLES_NAMES(clowns_sample_names)
19231902   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
19241903
19251904   MCFG_SOUND_ADD("discrete", DISCRETE, 0)
r31905r31906
33013280   0
33023281};
33033282
3304
3305static const samples_interface phantom2_samples_interface =
3306{
3307   2,  /* 2 channels */
3308   phantom2_sample_names
3309};
3310
3311
33123283MACHINE_CONFIG_FRAGMENT( phantom2_audio )
33133284   MCFG_SOUND_START_OVERRIDE(mw8080bw_state, samples)
33143285
33153286   MCFG_SPEAKER_STANDARD_MONO("mono")
3316   MCFG_SAMPLES_ADD("samples", phantom2_samples_interface)
3287   MCFG_SOUND_ADD("samples", SAMPLES, 0)
3288   MCFG_SAMPLES_CHANNELS(2)
3289   MCFG_SAMPLES_NAMES(phantom2_sample_names)
33173290   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1)
33183291MACHINE_CONFIG_END
33193292
r31905r31906
35803553};
35813554
35823555
3583static const samples_interface invaders_samples_interface =
3584{
3585   6,  /* 6 channels */
3586   invaders_sample_names
3587};
3588
3589
35903556/* left in for all games that hack into invaders samples for audio */
35913557MACHINE_CONFIG_FRAGMENT( invaders_samples_audio )
35923558   MCFG_SOUND_START_OVERRIDE(mw8080bw_state, samples)
r31905r31906
35973563   MCFG_SOUND_CONFIG(invaders_sn76477_interface)
35983564   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
35993565
3600   MCFG_SAMPLES_ADD("samples", invaders_samples_interface)
3566   MCFG_SOUND_ADD("samples", SAMPLES, 0)
3567   MCFG_SAMPLES_CHANNELS(6)
3568   MCFG_SAMPLES_NAMES(invaders_sample_names)
36013569   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
36023570MACHINE_CONFIG_END
36033571
trunk/src/mame/audio/invinco.c
r31905r31906
3434};
3535
3636
37static const samples_interface invinco_samples_interface =
38{
39   8,
40   invinco_sample_names
41};
4237
43
4438MACHINE_CONFIG_FRAGMENT( invinco_audio )
45   MCFG_SAMPLES_ADD("samples", invinco_samples_interface)
39   MCFG_SOUND_ADD("samples", SAMPLES, 0)
40   MCFG_SAMPLES_CHANNELS(8)
41   MCFG_SAMPLES_NAMES(invinco_sample_names)
4642   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
4743MACHINE_CONFIG_END
4844
trunk/src/mame/audio/cinemat.c
r31905r31906
129129   0
130130};
131131
132static const samples_interface spacewar_samples_interface =
133{
134   8,
135   spacewar_sample_names
136};
137
138132void cinemat_state::spacewar_sound_w(UINT8 sound_val, UINT8 bits_changed)
139133{
140134   /* Explosion - rising edge */
r31905r31906
184178
185179   MCFG_SPEAKER_STANDARD_MONO("mono")
186180
187   MCFG_SAMPLES_ADD("samples", spacewar_samples_interface)
181   MCFG_SOUND_ADD("samples", SAMPLES, 0)
182   MCFG_SAMPLES_CHANNELS(8)
183   MCFG_SAMPLES_NAMES(spacewar_sample_names)
188184   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
189185MACHINE_CONFIG_END
190186
r31905r31906
205201   0
206202};
207203
208static const samples_interface barrier_samples_interface =
209{
210   3,
211   barrier_sample_names
212};
213
214204void cinemat_state::barrier_sound_w(UINT8 sound_val, UINT8 bits_changed)
215205{
216206   /* Player die - rising edge */
r31905r31906
236226
237227   MCFG_SPEAKER_STANDARD_MONO("mono")
238228
239   MCFG_SAMPLES_ADD("samples", barrier_samples_interface)
229   MCFG_SOUND_ADD("samples", SAMPLES, 0)
230   MCFG_SAMPLES_CHANNELS(3)
231   MCFG_SAMPLES_NAMES(barrier_sample_names)
240232   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
241233MACHINE_CONFIG_END
242234
r31905r31906
255247   NULL
256248};
257249
258static const samples_interface speedfrk_samples_interface =
259{
260   1,
261   speedfrk_sample_names
262};
263
264250void cinemat_state::speedfrk_sound_w(UINT8 sound_val, UINT8 bits_changed)
265251{
266252   /* on the falling edge of bit 0x08, clock the inverse of bit 0x04 into the top of the shiftreg */
r31905r31906
293279
294280   MCFG_SPEAKER_STANDARD_MONO("mono")
295281
296   MCFG_SAMPLES_ADD("samples", speedfrk_samples_interface)
282   MCFG_SOUND_ADD("samples", SAMPLES, 0)
283   MCFG_SAMPLES_CHANNELS(1)
284   MCFG_SAMPLES_NAMES(speedfrk_sample_names)
297285   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
298286MACHINE_CONFIG_END
299287
r31905r31906
317305   NULL
318306};
319307
320static const samples_interface starhawk_samples_interface =
321{
322   5,
323   starhawk_sample_names
324};
325
326308void cinemat_state::starhawk_sound_w(UINT8 sound_val, UINT8 bits_changed)
327309{
328310   /* explosion - falling edge */
r31905r31906
366348
367349   MCFG_SPEAKER_STANDARD_MONO("mono")
368350
369   MCFG_SAMPLES_ADD("samples", starhawk_samples_interface)
351   MCFG_SOUND_ADD("samples", SAMPLES, 0)
352   MCFG_SAMPLES_CHANNELS(5)
353   MCFG_SAMPLES_NAMES(starhawk_sample_names)
370354   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
371355MACHINE_CONFIG_END
372356
r31905r31906
390374   0
391375};
392376
393static const samples_interface sundance_samples_interface =
394{
395   6,
396   sundance_sample_names
397};
398
399377void cinemat_state::sundance_sound_w(UINT8 sound_val, UINT8 bits_changed)
400378{
401379   /* bong - falling edge */
r31905r31906
433411
434412   MCFG_SPEAKER_STANDARD_MONO("mono")
435413
436   MCFG_SAMPLES_ADD("samples", sundance_samples_interface)
414   MCFG_SOUND_ADD("samples", SAMPLES, 0)
415   MCFG_SAMPLES_CHANNELS(6)
416   MCFG_SAMPLES_NAMES(sundance_sample_names)
437417   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
438418MACHINE_CONFIG_END
439419
r31905r31906
457437   NULL
458438};
459439
460static const samples_interface tailg_samples_interface =
461{
462   6,
463   tailg_sample_names
464};
465
466440void cinemat_state::tailg_sound_w(UINT8 sound_val, UINT8 bits_changed)
467441{
468442   /* the falling edge of bit 0x10 clocks bit 0x08 into the mux selected by bits 0x07 */
r31905r31906
519493
520494   MCFG_SPEAKER_STANDARD_MONO("mono")
521495
522   MCFG_SAMPLES_ADD("samples", tailg_samples_interface)
496   MCFG_SOUND_ADD("samples", SAMPLES, 0)
497   MCFG_SAMPLES_CHANNELS(6)
498   MCFG_SAMPLES_NAMES(tailg_sample_names)
523499   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
524500MACHINE_CONFIG_END
525501
r31905r31906
542518   NULL
543519};
544520
545static const samples_interface warrior_samples_interface =
546{
547   5,
548   warrior_sample_names
549};
550
551521void cinemat_state::warrior_sound_w(UINT8 sound_val, UINT8 bits_changed)
552522{
553523   /* normal level - 0=on, 1=off */
r31905r31906
585555
586556   MCFG_SPEAKER_STANDARD_MONO("mono")
587557
588   MCFG_SAMPLES_ADD("samples", warrior_samples_interface)
558   MCFG_SOUND_ADD("samples", SAMPLES, 0)
559   MCFG_SAMPLES_CHANNELS(5)
560   MCFG_SAMPLES_NAMES(warrior_sample_names)
589561   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
590562MACHINE_CONFIG_END
591563
r31905r31906
610582   NULL
611583};
612584
613static const samples_interface armora_samples_interface =
614{
615   7,
616   armora_sample_names
617};
618
619585void cinemat_state::armora_sound_w(UINT8 sound_val, UINT8 bits_changed)
620586{
621587   /* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
r31905r31906
677643
678644   MCFG_SPEAKER_STANDARD_MONO("mono")
679645
680   MCFG_SAMPLES_ADD("samples", armora_samples_interface)
646   MCFG_SOUND_ADD("samples", SAMPLES, 0)
647   MCFG_SAMPLES_CHANNELS(7)
648   MCFG_SAMPLES_NAMES(armora_sample_names)
681649   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
682650MACHINE_CONFIG_END
683651
r31905r31906
708676   NULL
709677};
710678
711static const samples_interface ripoff_samples_interface =
712{
713   6,
714   ripoff_sample_names
715};
716
717679void cinemat_state::ripoff_sound_w(UINT8 sound_val, UINT8 bits_changed)
718680{
719681   /* on the rising edge of bit 0x02, clock bit 0x01 into the shift register */
r31905r31906
766728
767729   MCFG_SPEAKER_STANDARD_MONO("mono")
768730
769   MCFG_SAMPLES_ADD("samples", ripoff_samples_interface)
731   MCFG_SOUND_ADD("samples", SAMPLES, 0)
732   MCFG_SAMPLES_CHANNELS(6)
733   MCFG_SAMPLES_NAMES(ripoff_sample_names)
770734   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
771735MACHINE_CONFIG_END
772736
r31905r31906
792756   0
793757};
794758
795static const samples_interface starcas_samples_interface =
796{
797   8,
798   starcas_sample_names
799};
800
801759void cinemat_state::starcas_sound_w(UINT8 sound_val, UINT8 bits_changed)
802760{
803761   UINT32 target_pitch;
r31905r31906
877835
878836   MCFG_SPEAKER_STANDARD_MONO("mono")
879837
880   MCFG_SAMPLES_ADD("samples", starcas_samples_interface)
838   MCFG_SOUND_ADD("samples", SAMPLES, 0)
839   MCFG_SAMPLES_CHANNELS(8)
840   MCFG_SAMPLES_NAMES(starcas_sample_names)
881841   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
882842MACHINE_CONFIG_END
883843
r31905r31906
903863   NULL
904864};
905865
906static const samples_interface solarq_samples_interface =
907{
908   8,
909   solarq_sample_names
910};
911
912866void cinemat_state::solarq_sound_w(UINT8 sound_val, UINT8 bits_changed)
913867{
914868   /* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
r31905r31906
1009963
1010964   MCFG_SPEAKER_STANDARD_MONO("mono")
1011965
1012   MCFG_SAMPLES_ADD("samples", solarq_samples_interface)
966   MCFG_SOUND_ADD("samples", SAMPLES, 0)
967   MCFG_SAMPLES_CHANNELS(8)
968   MCFG_SAMPLES_NAMES(solarq_sample_names)
1013969   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
1014970MACHINE_CONFIG_END
1015971
r31905r31906
1039995   NULL
1040996};
1041997
1042static const samples_interface boxingb_samples_interface =
1043{
1044   12,
1045   boxingb_sample_names
1046};
1047
1048998void cinemat_state::boxingb_sound_w(UINT8 sound_val, UINT8 bits_changed)
1049999{
10501000   /* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
r31905r31906
11411091
11421092   MCFG_SPEAKER_STANDARD_MONO("mono")
11431093
1144   MCFG_SAMPLES_ADD("samples", boxingb_samples_interface)
1094   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1095   MCFG_SAMPLES_CHANNELS(12)
1096   MCFG_SAMPLES_NAMES(boxingb_sample_names)
11451097   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
11461098MACHINE_CONFIG_END
11471099
r31905r31906
11671119   0
11681120};
11691121
1170static const samples_interface wotw_samples_interface =
1171{
1172   8,
1173   wotw_sample_names
1174};
1175
11761122void cinemat_state::wotw_sound_w(UINT8 sound_val, UINT8 bits_changed)
11771123{
11781124   UINT32 target_pitch;
r31905r31906
12521198
12531199   MCFG_SPEAKER_STANDARD_MONO("mono")
12541200
1255   MCFG_SAMPLES_ADD("samples", wotw_samples_interface)
1201   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1202   MCFG_SAMPLES_CHANNELS(8)
1203   MCFG_SAMPLES_NAMES(wotw_sample_names)
12561204   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
12571205MACHINE_CONFIG_END
12581206
trunk/src/mame/audio/snk6502.c
r31905r31906
2727#define FRAC_ONE    (1 << FRAC_BITS)
2828#define FRAC_MASK   (FRAC_ONE - 1)
2929
30static const char *const sasuke_sample_names[] =
30const char *const sasuke_sample_names[] =
3131{
3232   "*sasuke",
3333
r31905r31906
4040   0
4141};
4242
43const samples_interface sasuke_samples_interface =
43const char *const vanguard_sample_names[] =
4444{
45   4,  /* 4 channels */
46   sasuke_sample_names
47};
48
49static const char *const vanguard_sample_names[] =
50{
5145   "*vanguard",
5246
5347   // SN76477 and discrete
r31905r31906
7569   0
7670};
7771
78const samples_interface vanguard_samples_interface =
79{
80   3,  /* 3 channel */
81   vanguard_sample_names
82};
8372
84static const char *const fantasy_sample_names[] =
73const char *const fantasy_sample_names[] =
8574{
8675   "*fantasy",
8776
r31905r31906
10291   0
10392};
10493
105const samples_interface fantasy_samples_interface =
106{
107   1,  /* 1 channel */
108   fantasy_sample_names
109};
11094
111
11295const sn76477_interface sasuke_sn76477_intf_1 =
11396{
11497   RES_K(470),     /*  4  noise_res     */
r31905r31906
358341      m_tone_clock_expire(0),
359342      m_tone_clock(0),
360343      m_tone_stream(NULL),
344      m_samples(*this, ":samples"),
361345      m_ROM(NULL),
362346      m_Sound0StopOnRollover(0),
363347      m_LastPort1(0),
r31905r31906
384368
385369void snk6502_sound_device::device_start()
386370{
387   m_samples = machine().device<samples_device>("samples");
388371   m_ROM = machine().root_device().memregion("snk6502")->base();
389372
390373   // adjusted
trunk/src/mame/audio/vicdual.c
r31905r31906
110110   0
111111};
112112
113static const samples_interface frogs_samples_interface =
114{
115   5,  /* 5 channels */
116   frogs_sample_names
117};
118113
119
120114MACHINE_CONFIG_FRAGMENT( frogs_audio )
121   MCFG_SAMPLES_ADD("samples", frogs_samples_interface)
115   MCFG_SOUND_ADD("samples", SAMPLES, 0)
116   MCFG_SAMPLES_CHANNELS(5)
117   MCFG_SAMPLES_NAMES(frogs_sample_names)
122118   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35)
123119
124120   MCFG_SOUND_ADD("discrete", DISCRETE, 0)
trunk/src/mame/audio/meadows.c
r31905r31906
2828/************************************/
2929/* Sound handler start              */
3030/************************************/
31SAMPLES_START( meadows_sh_start )
31SAMPLES_START_CB_MEMBER(meadows_state::meadows_sh_start)
3232{
33   meadows_state *state = device.machine().driver_data<meadows_state>();
34   state->m_0c00 = state->m_0c01 = state->m_0c02 = state->m_0c03 = 0;
35   state->m_dac_data = 0;
36   state->m_dac_enable = 0;
37   state->m_channel = 0;
38   state->m_freq1 = state->m_freq2 = 1000;
39   state->m_latched_0c01 = state->m_latched_0c02 = state->m_latched_0c03 = 0;
33   m_0c00 = m_0c01 = m_0c02 = m_0c03 = 0;
34   m_dac_data = 0;
35   m_dac_enable = 0;
36   m_channel = 0;
37   m_freq1 = m_freq2 = 1000;
38   m_latched_0c01 = m_latched_0c02 = m_latched_0c03 = 0;
4039
41   device.set_volume(0,0);
42   device.start_raw(0,waveform,ARRAY_LENGTH(waveform),state->m_freq1,true);
43   device.set_volume(1,0);
44   device.start_raw(1,waveform,ARRAY_LENGTH(waveform),state->m_freq2,true);
40   m_samples->set_volume(0,0);
41   m_samples->start_raw(0,waveform,ARRAY_LENGTH(waveform),m_freq1,true);
42   m_samples->set_volume(1,0);
43   m_samples->start_raw(1,waveform,ARRAY_LENGTH(waveform),m_freq2,true);
4544}
4645
4746/************************************/
4847/* Sound handler update             */
4948/************************************/
50void meadows_sh_update(running_machine &machine)
49void meadows_state::meadows_sh_update()
5150{
52   meadows_state *state = machine.driver_data<meadows_state>();
5351   int preset, amp;
5452
55   if (state->m_latched_0c01 != state->m_0c01 || state->m_latched_0c03 != state->m_0c03)
53   if (m_latched_0c01 != m_0c01 || m_latched_0c03 != m_0c03)
5654   {
5755      /* amplitude is a combination of the upper 4 bits of 0c01 */
5856      /* and bit 4 merged from S2650's flag output */
59      amp = ((state->m_0c03 & ENABLE_CTR1) == 0) ? 0 : (state->m_0c01 & 0xf0) >> 1;
60      if( state->m_maincpu->state_int(S2650_FO) )
57      amp = ((m_0c03 & ENABLE_CTR1) == 0) ? 0 : (m_0c01 & 0xf0) >> 1;
58      if( m_maincpu->state_int(S2650_FO) )
6159         amp += 0x80;
6260      /* calculate frequency for counter #1 */
6361      /* bit 0..3 of 0c01 are ctr preset */
64      preset = (state->m_0c01 & 15) ^ 15;
62      preset = (m_0c01 & 15) ^ 15;
6563      if (preset)
66         state->m_freq1 = BASE_CTR1 / (preset + 1);
64         m_freq1 = BASE_CTR1 / (preset + 1);
6765      else amp = 0;
68      logerror("meadows ctr1 channel #%d preset:%3d freq:%5d amp:%d\n", state->m_channel, preset, state->m_freq1, amp);
69      state->m_samples->set_frequency(0, state->m_freq1 * sizeof(waveform)/2);
70      state->m_samples->set_volume(0,amp/255.0);
66      logerror("meadows ctr1 channel #%d preset:%3d freq:%5d amp:%d\n", m_channel, preset, m_freq1, amp);
67      m_samples->set_frequency(0, m_freq1 * sizeof(waveform)/2);
68      m_samples->set_volume(0,amp/255.0);
7169   }
7270
73   if (state->m_latched_0c02 != state->m_0c02 || state->m_latched_0c03 != state->m_0c03)
71   if (m_latched_0c02 != m_0c02 || m_latched_0c03 != m_0c03)
7472   {
7573      /* calculate frequency for counter #2 */
7674      /* 0c02 is ctr preset, 0c03 bit 0 enables division by 2 */
77      amp = ((state->m_0c03 & ENABLE_CTR2) != 0) ? 0xa0 : 0;
78      preset = state->m_0c02 ^ 0xff;
75      amp = ((m_0c03 & ENABLE_CTR2) != 0) ? 0xa0 : 0;
76      preset = m_0c02 ^ 0xff;
7977      if (preset)
8078      {
81         state->m_freq2 = BASE_CTR2 / (preset + 1) / 2;
82         if ((state->m_0c03 & DIV2OR4_CTR2) == 0)
83            state->m_freq2 >>= 1;
79         m_freq2 = BASE_CTR2 / (preset + 1) / 2;
80         if ((m_0c03 & DIV2OR4_CTR2) == 0)
81            m_freq2 >>= 1;
8482      }
8583      else amp = 0;
86      logerror("meadows ctr2 channel #%d preset:%3d freq:%5d amp:%d\n", state->m_channel+1, preset, state->m_freq2, amp);
87      state->m_samples->set_frequency(1, state->m_freq2 * sizeof(waveform));
88      state->m_samples->set_volume(1,amp/255.0);
84      logerror("meadows ctr2 channel #%d preset:%3d freq:%5d amp:%d\n", m_channel+1, preset, m_freq2, amp);
85      m_samples->set_frequency(1, m_freq2 * sizeof(waveform));
86      m_samples->set_volume(1,amp/255.0);
8987   }
9088
91   if (state->m_latched_0c03 != state->m_0c03)
89   if (m_latched_0c03 != m_0c03)
9290   {
93      state->m_dac_enable = state->m_0c03 & ENABLE_DAC;
91      m_dac_enable = m_0c03 & ENABLE_DAC;
9492
95      if (state->m_dac_enable)
96         state->m_dac->write_unsigned8(state->m_dac_data);
93      if (m_dac_enable)
94         m_dac->write_unsigned8(m_dac_data);
9795      else
98         state->m_dac->write_unsigned8(0);
96         m_dac->write_unsigned8(0);
9997   }
10098
101   state->m_latched_0c01 = state->m_0c01;
102   state->m_latched_0c02 = state->m_0c02;
103   state->m_latched_0c03 = state->m_0c03;
99   m_latched_0c01 = m_0c01;
100   m_latched_0c02 = m_0c02;
101   m_latched_0c03 = m_0c03;
104102}
105103
106104/************************************/
107105/* Write DAC value                  */
108106/************************************/
109void meadows_sh_dac_w(running_machine &machine, int data)
107void meadows_state::meadows_sh_dac_w(int data)
110108{
111   meadows_state *state = machine.driver_data<meadows_state>();
112   state->m_dac_data = data;
113   if (state->m_dac_enable)
114      state->m_dac->write_unsigned8(state->m_dac_data);
109   m_dac_data = data;
110   if (m_dac_enable)
111      m_dac->write_unsigned8(m_dac_data);
115112   else
116      state->m_dac->write_unsigned8(0);
113      m_dac->write_unsigned8(0);
117114}
trunk/src/mame/audio/carnival.c
r31905r31906
9393   0
9494};
9595
96
97static const samples_interface carnival_samples_interface =
98{
99   10,
100   carnival_sample_names
101};
102
103
10496/* sample IDs - must match sample file name table above */
10597enum
10698{
r31905r31906
296288   MCFG_SOUND_ADD("psg", AY8910, PSG_CLOCK)
297289   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
298290
299   MCFG_SAMPLES_ADD("samples", carnival_samples_interface)
291   MCFG_SOUND_ADD("samples", SAMPLES, 0)
292   MCFG_SAMPLES_CHANNELS(10)
293   MCFG_SAMPLES_NAMES(carnival_sample_names)
300294   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
301295MACHINE_CONFIG_END
trunk/src/mame/audio/blockade.c
r31905r31906
5555   return;
5656}
5757
58static const char *const blockade_sample_names[] =
58const char *const blockade_sample_names[] =
5959{
6060   "*blockade",
6161   "boom",
6262   0
6363};
64
65const samples_interface blockade_samples_interface =
66{
67   1,  /* 1 channel */
68   blockade_sample_names
69};
trunk/src/mame/audio/segag80r.c
r31905r31906
239239};
240240
241241
242static const samples_interface astrob_samples_interface =
243{
244   11,
245   astrob_sample_names
246};
247
248
249242MACHINE_CONFIG_FRAGMENT( astrob_sound_board )
250243
251244   /* sound hardware */
252   MCFG_SAMPLES_ADD("samples", astrob_samples_interface)
245   MCFG_SOUND_ADD("samples", SAMPLES, 0)
246   MCFG_SAMPLES_CHANNELS(11)
247   MCFG_SAMPLES_NAMES(astrob_sample_names)
253248   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
254249MACHINE_CONFIG_END
255250
r31905r31906
431426};
432427
433428
434static const samples_interface sega005_samples_interface =
435{
436   7,
437   sega005_sample_names
438};
439
440
441429MACHINE_CONFIG_FRAGMENT( 005_sound_board )
442430
443431   MCFG_DEVICE_ADD("ppi8255", I8255A, 0)
r31905r31906
446434
447435   /* sound hardware */
448436
449   MCFG_SAMPLES_ADD("samples", sega005_samples_interface)
437   MCFG_SOUND_ADD("samples", SAMPLES, 0)
438   MCFG_SAMPLES_CHANNELS(7)
439   MCFG_SAMPLES_NAMES(sega005_sample_names)
450440   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
451441
452442   MCFG_SOUND_ADD("005", SEGA005, 0)
r31905r31906
598588};
599589
600590
601static const samples_interface spaceod_samples_interface =
602{
603   11,
604   spaceod_sample_names
605};
606
607
608591MACHINE_CONFIG_FRAGMENT( spaceod_sound_board )
609592
610593   /* sound hardware */
611594
612   MCFG_SAMPLES_ADD("samples", spaceod_samples_interface)
595   MCFG_SOUND_ADD("samples", SAMPLES, 0)
596   MCFG_SAMPLES_CHANNELS(11)
597   MCFG_SAMPLES_NAMES(spaceod_sample_names)
613598   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
614599MACHINE_CONFIG_END
615600
r31905r31906
695680};
696681
697682
698static const samples_interface monsterb_samples_interface =
699{
700   2,
701   monsterb_sample_names
702};
703
704
705683/*************************************
706684 *
707685 *  N7751 memory maps
r31905r31906
740718
741719   /* sound hardware */
742720
743   MCFG_SAMPLES_ADD("samples", monsterb_samples_interface)
721   MCFG_SOUND_ADD("samples", SAMPLES, 0)
722   MCFG_SAMPLES_CHANNELS(2)
723   MCFG_SAMPLES_NAMES(monsterb_sample_names)
744724   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
745725
746726   MCFG_TMS36XX_ADD("music", 247)
trunk/src/mame/audio/gottlieb.c
r31905r31906
230230   0   /* end of array */
231231};
232232
233static const samples_interface reactor_samples_interface =
234{
235   1,  /* one channel */
236   reactor_sample_names
237};
238
239static const samples_interface qbert_samples_interface =
240{
241   1,  /* one channel */
242   qbert_sample_names
243};
244
245233MACHINE_CONFIG_FRAGMENT( reactor_samples )
246   MCFG_SAMPLES_ADD("samples", reactor_samples_interface)
234   MCFG_SOUND_ADD("samples", SAMPLES, 0)
235   MCFG_SAMPLES_CHANNELS(1)
236   MCFG_SAMPLES_NAMES(reactor_sample_names)
247237   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
248238MACHINE_CONFIG_END
249239
250240MACHINE_CONFIG_FRAGMENT( qbert_samples )
251   MCFG_SAMPLES_ADD("samples", qbert_samples_interface)
241   MCFG_SOUND_ADD("samples", SAMPLES, 0)
242   MCFG_SAMPLES_CHANNELS(1)
243   MCFG_SAMPLES_NAMES(qbert_sample_names)
252244   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
253245MACHINE_CONFIG_END
254246
r31905r31906
284276   0   /* end of array */
285277};
286278
287static const samples_interface qbert_knocker_interface =
288{
289   1,  /* one channel */
290   qbert_knocker_names
291};
292
293279MACHINE_CONFIG_FRAGMENT( qbert_knocker )
294280   MCFG_SPEAKER_ADD("knocker", 0.0, 0.0, 1.0)
295281
296   MCFG_SAMPLES_ADD("knocker_sam", qbert_knocker_interface)
282   MCFG_SOUND_ADD("knocker_sam", SAMPLES, 0)
283   MCFG_SAMPLES_CHANNELS(1)
284   MCFG_SAMPLES_NAMES(qbert_knocker_names)
297285   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "knocker", 1.0)
298286MACHINE_CONFIG_END
299287
trunk/src/mame/audio/8080bw.c
r31905r31906
119119/*                                                     */
120120/*******************************************************/
121121
122static const char *const lrescue_sample_names[] =
122const char *const lrescue_sample_names[] =
123123{
124124   "*lrescue",
125125   "alienexplosion",
r31905r31906
134134   0
135135};
136136
137const samples_interface lrescue_samples_interface =
138{
139   4,  /* 4 channels */
140   lrescue_sample_names
141};
142
143137WRITE8_MEMBER(_8080bw_state::lrescue_sh_port_1_w)
144138{
145139   UINT8 rising_bits = data & ~m_port_1_last_extra;
r31905r31906
11011095   1           /* 9  enable (variable)      */
11021096};
11031097
1104static const char *const lupin3_sample_names[] =
1098const char *const lupin3_sample_names[] =
11051099{
11061100   "*lupin3",
11071101   "cap",      /* go to jail */
r31905r31906
11141108   0
11151109};
11161110
1117
1118const samples_interface lupin3_samples_interface =
1119{
1120   4,  /* 4 channels */
1121   lupin3_sample_names
1122};
1123
11241111WRITE8_MEMBER( _8080bw_state::lupin3_00_w )
11251112{
11261113   m_discrete->write(space, INDIANBT_MUSIC_DATA, data);
trunk/src/mame/audio/targ.c
r31905r31906
144144}
145145
146146
147static SAMPLES_START( spectar_audio_start )
147SAMPLES_START_CB_MEMBER(exidy_state::spectar_audio_start)
148148{
149   running_machine &machine = device.machine();
150   exidy_state *state = machine.driver_data<exidy_state>();
151
152   state->common_audio_start(SPECTAR_MAXFREQ);
149   common_audio_start(SPECTAR_MAXFREQ);
153150}
154151
155152
156static SAMPLES_START( targ_audio_start )
153SAMPLES_START_CB_MEMBER(exidy_state::targ_audio_start)
157154{
158   running_machine &machine = device.machine();
159   exidy_state *state = machine.driver_data<exidy_state>();
155   common_audio_start(TARG_MAXFREQ);
160156
161   state->common_audio_start(TARG_MAXFREQ);
157   m_tone_pointer = 0;
162158
163   state->m_tone_pointer = 0;
164
165   state->save_item(NAME(state->m_tone_pointer));
159   save_item(NAME(m_tone_pointer));
166160}
167161
168162
169static const samples_interface spectar_samples_interface =
170{
171   4,  /* number of channel */
172   sample_names,
173   spectar_audio_start
174};
175
176
177static const samples_interface targ_samples_interface =
178{
179   4,  /* number of channel */
180   sample_names,
181   targ_audio_start
182};
183
184
185163MACHINE_CONFIG_FRAGMENT( spectar_audio )
186164
187165   MCFG_SPEAKER_STANDARD_MONO("mono")
188166
189   MCFG_SAMPLES_ADD("samples", spectar_samples_interface)
167   MCFG_SOUND_ADD("samples", SAMPLES, 0)
168   MCFG_SAMPLES_CHANNELS(4)
169   MCFG_SAMPLES_NAMES(sample_names)
170   MCFG_SAMPLES_START_CB(exidy_state, spectar_audio_start)
190171   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
191172
192173   MCFG_DAC_ADD("dac")
r31905r31906
198179
199180   MCFG_SPEAKER_STANDARD_MONO("mono")
200181
201   MCFG_SAMPLES_ADD("samples", targ_samples_interface)
182   MCFG_SOUND_ADD("samples", SAMPLES, 0)
183   MCFG_SAMPLES_CHANNELS(4)
184   MCFG_SAMPLES_NAMES(sample_names)
185   MCFG_SAMPLES_START_CB(exidy_state, targ_audio_start)
202186   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
203187
204188   MCFG_DAC_ADD("dac")
trunk/src/mame/audio/suna8.c
r31905r31906
1111#define FREQ_HZ 8000
1212#define SAMPLEN 0x1000
1313
14SAMPLES_START( suna8_sh_start )
14SAMPLES_START_CB_MEMBER(suna8_state::sh_start)
1515{
16   suna8_state *state = device.machine().driver_data<suna8_state>();
17   running_machine &machine = device.machine();
16   int i, len = memregion("samples")->bytes() * 2;  // 2 samples per byte
17   UINT8 *ROM = memregion("samples")->base();
1818
19   int i, len = state->memregion("samples")->bytes() * 2;  // 2 samples per byte
20   UINT8 *ROM = state->memregion("samples")->base();
19   m_samplebuf = auto_alloc_array(machine(), INT16, len);
2120
22   state->m_samplebuf = auto_alloc_array(machine, INT16, len);
23
2421   // Convert 4 bit to 16 bit samples
2522   for(i = 0; i < len; i++)
26      state->m_samplebuf[i] = (INT8)(((ROM[i/2] << ((i & 1)?0:4)) & 0xf0)  ^ 0x80) * 0x100;
23      m_samplebuf[i] = (INT8)(((ROM[i/2] << ((i & 1)?0:4)) & 0xf0)  ^ 0x80) * 0x100;
2724
28   state->m_numsamples = len / SAMPLEN;
25   m_numsamples = len / SAMPLEN;
2926}
3027
3128WRITE8_MEMBER(suna8_state::suna8_samples_number_w)
trunk/src/mame/audio/spacefb.c
r31905r31906
7272};
7373
7474
75static const samples_interface spacefb_samples_interface =
76{
77   3,
78   spacefb_sample_names
79};
80
81
8275MACHINE_CONFIG_FRAGMENT( spacefb_audio )
8376   MCFG_SPEAKER_STANDARD_MONO("mono")
8477
8578   MCFG_DAC_ADD("dac")
8679   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
8780
88   MCFG_SAMPLES_ADD("samples", spacefb_samples_interface)
81   MCFG_SOUND_ADD("samples", SAMPLES, 0)
82   MCFG_SAMPLES_CHANNELS(3)
83   MCFG_SAMPLES_NAMES(spacefb_sample_names)
8984   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
9085MACHINE_CONFIG_END
trunk/src/mame/audio/pulsar.c
r31905r31906
5151};
5252
5353
54static const samples_interface pulsar_samples_interface =
55{
56   12,
57   pulsar_sample_names
58};
59
60
6154MACHINE_CONFIG_FRAGMENT( pulsar_audio )
62   MCFG_SAMPLES_ADD("samples", pulsar_samples_interface)
55   MCFG_SOUND_ADD("samples", SAMPLES, 0)
56   MCFG_SAMPLES_CHANNELS(12)
57   MCFG_SAMPLES_NAMES(pulsar_sample_names)
6358   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
6459MACHINE_CONFIG_END
6560
trunk/src/mame/audio/zaxxon.c
r31905r31906
9090};
9191
9292
93static const samples_interface zaxxon_samples_interface =
94{
95   12,
96   zaxxon_sample_names
97};
98
99
10093MACHINE_CONFIG_FRAGMENT( zaxxon_samples )
101   MCFG_SAMPLES_ADD("samples", zaxxon_samples_interface)
94   MCFG_SOUND_ADD("samples", SAMPLES, 0)
95   MCFG_SAMPLES_CHANNELS(12)
96   MCFG_SAMPLES_NAMES(zaxxon_sample_names)
10297   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
10398MACHINE_CONFIG_END
10499
r31905r31906
195190};
196191
197192
198static const samples_interface congo_samples_interface =
199{
200   5,  /* 5 channels */
201   congo_sample_names
202};
203
204
205193MACHINE_CONFIG_FRAGMENT( congo_samples )
206   MCFG_SAMPLES_ADD("samples", congo_samples_interface)
194   MCFG_SOUND_ADD("samples", SAMPLES, 0)
195   MCFG_SAMPLES_CHANNELS(5)
196   MCFG_SAMPLES_NAMES(congo_sample_names)
207197   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
208198MACHINE_CONFIG_END
209199
trunk/src/mame/audio/circus.c
r31905r31906
22#include "sound/samples.h"
33#include "includes/circus.h"
44
5static const char *const circus_sample_names[] =
5const char *const circus_sample_names[] =
66{
77   "*circus",
88   "pop",
r31905r31906
1111   0
1212};
1313
14const samples_interface circus_samples_interface =
14const char *const crash_sample_names[] =
1515{
16   3,  /* 3 channels */
17   circus_sample_names
18};
19
20static const char *const crash_sample_names[] =
21{
2216   "*crash",
2317   "crash",
2418   0
2519};
2620
27const samples_interface crash_samples_interface =
21const char *const ripcord_sample_names[] =
2822{
29   1,  /* 1 channel */
30   crash_sample_names
31};
32
33static const char *const ripcord_sample_names[] =
34{
3523   "*ripcord",
3624   "splash",
3725   "scream",
r31905r31906
4028   0
4129};
4230
43const samples_interface ripcord_samples_interface =
31const char *const robotbwl_sample_names[] =
4432{
45   4,  /* 4 channels */
46   ripcord_sample_names
47};
48
49static const char *const robotbwl_sample_names[] =
50{
5133   "*robotbwl",
5234   "hit",
5335   "roll",
r31905r31906
5739   0
5840};
5941
60const samples_interface robotbwl_samples_interface =
61{
62   5,  /* 5 channels */
63   robotbwl_sample_names
64};
6542
6643/* Nodes - Inputs */
6744#define CIRCUS_MUSIC_BIT    NODE_01
trunk/src/mame/audio/turbo.c
r31905r31906
2121 *
2222 *************************************/
2323
24static void turbo_update_samples(turbo_state *state, samples_device *samples)
24void turbo_state::turbo_update_samples()
2525{
2626   /* accelerator sounds */
2727   /* BSEL == 3 --> off */
2828   /* BSEL == 2 --> standard */
2929   /* BSEL == 1 --> tunnel */
3030   /* BSEL == 0 --> ??? */
31   if (state->m_turbo_bsel == 3 && samples->playing(5))
32      samples->stop(5);
33   else if (state->m_turbo_bsel != 3 && !samples->playing(5))
34      samples->start(5, 7, true);
35   if (samples->playing(5))
36      samples->set_frequency(5, samples->base_frequency(5) * ((state->m_turbo_accel & 0x3f) / 5.25 + 1));
31   if (m_turbo_bsel == 3 && m_samples->playing(5))
32      m_samples->stop(5);
33   else if (m_turbo_bsel != 3 && !m_samples->playing(5))
34      m_samples->start(5, 7, true);
35   if (m_samples->playing(5))
36      m_samples->set_frequency(5, m_samples->base_frequency(5) * ((m_turbo_accel & 0x3f) / 5.25 + 1));
3737}
3838
3939
r31905r31906
107107   if ((diff & 0x80) && !(data & 0x80)) m_samples->start(3, 5);
108108
109109   /* update any samples */
110   turbo_update_samples(this, m_samples);
110   turbo_update_samples();
111111
112112#else
113113
r31905r31906
139139   if ((diff & 0x80) && !(data & 0x80)) m_samples->start(2, 6);
140140
141141   /* update any samples */
142   turbo_update_samples(this, m_samples);
142   turbo_update_samples();
143143}
144144
145145
r31905r31906
155155   output_set_value("speed", (data >> 4) & 0x0f);
156156
157157   /* update any samples */
158   turbo_update_samples(this, m_samples);
158   turbo_update_samples();
159159}
160160
161161
r31905r31906
182182};
183183
184184
185static const samples_interface turbo_samples_interface =
186{
187   10,
188   turbo_sample_names
189};
190
191
192185MACHINE_CONFIG_FRAGMENT( turbo_samples )
193186
194187   /* this is the cockpit speaker configuration */
r31905r31906
197190   MCFG_SPEAKER_ADD("lspeaker", -0.2, 0.0, 1.0)    /* left */
198191   MCFG_SPEAKER_ADD("rspeaker", 0.2, 0.0, 1.0)     /* right */
199192
200   MCFG_SAMPLES_ADD("samples", turbo_samples_interface)
193   MCFG_SOUND_ADD("samples", SAMPLES, 0)
194   MCFG_SAMPLES_CHANNELS(10)
195   MCFG_SAMPLES_NAMES(turbo_sample_names)
201196
202197   /* channel 0 = CRASH.S -> CRASH.S/SM */
203198   MCFG_SOUND_ROUTE(0, "fspeaker", 0.25)
r31905r31906
299294}
300295
301296
302INLINE void subroc3d_update_volume(samples_device *samples, int leftchan, UINT8 dis, UINT8 dir)
297inline void turbo_state::subroc3d_update_volume(int leftchan, UINT8 dis, UINT8 dir)
303298{
304299   float volume = (float)(15 - dis) / 16.0f;
305300   float lvol, rvol;
r31905r31906
314309      lvol = rvol = 0;
315310
316311   /* if the sample is playing, adjust it */
317   samples->set_volume(leftchan + 0, lvol);
318   samples->set_volume(leftchan + 1, rvol);
312   m_samples->set_volume(leftchan + 0, lvol);
313   m_samples->set_volume(leftchan + 1, rvol);
319314}
320315
321316
r31905r31906
334329         m_samples->start(0, 0, true);
335330         m_samples->start(1, 0, true);
336331      }
337      subroc3d_update_volume(m_samples, 0, m_subroc3d_mdis, m_subroc3d_mdir);
332      subroc3d_update_volume(0, m_subroc3d_mdis, m_subroc3d_mdir);
338333   }
339334
340335   /* bit 1 latches direction/volume for torpedo */
r31905r31906
347342         m_samples->start(2, 1, true);
348343         m_samples->start(3, 1, true);
349344      }
350      subroc3d_update_volume(m_samples, 2, m_subroc3d_tdis, m_subroc3d_tdir);
345      subroc3d_update_volume(2, m_subroc3d_tdis, m_subroc3d_tdir);
351346   }
352347
353348   /* bit 2 latches direction/volume for fighter */
r31905r31906
360355         m_samples->start(4, 2, true);
361356         m_samples->start(5, 2, true);
362357      }
363      subroc3d_update_volume(m_samples, 4, m_subroc3d_fdis, m_subroc3d_fdir);
358      subroc3d_update_volume(4, m_subroc3d_fdis, m_subroc3d_fdir);
364359   }
365360
366361   /* bit 3 latches direction/volume for hit */
r31905r31906
368363   {
369364      m_subroc3d_hdis = m_sound_state[0] & 0x0f;
370365      m_subroc3d_hdir = (m_sound_state[0] >> 4) & 0x07;
371      subroc3d_update_volume(m_samples, 6, m_subroc3d_hdis, m_subroc3d_hdir);
366      subroc3d_update_volume(6, m_subroc3d_hdis, m_subroc3d_hdir);
372367   }
373368}
374369
r31905r31906
433428   0
434429};
435430
436
437static const samples_interface subroc3d_samples_interface =
438{
439   12,
440   subroc3d_sample_names
441};
442
443
444431MACHINE_CONFIG_FRAGMENT( subroc3d_samples )
445432   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
446433
447   MCFG_SAMPLES_ADD("samples", subroc3d_samples_interface)
434   MCFG_SOUND_ADD("samples", SAMPLES, 0)
435   MCFG_SAMPLES_CHANNELS(12)
436   MCFG_SAMPLES_NAMES(subroc3d_sample_names)
448437
449438   /* MISSILE in channels 0 and 1 */
450439   MCFG_SOUND_ROUTE(0, "lspeaker",  0.25)
r31905r31906
487476 *
488477 *************************************/
489478
490static void buckrog_update_samples(turbo_state *state, samples_device *samples)
479void turbo_state::buckrog_update_samples()
491480{
492481   /* accelerator sounds */
493   if (samples->playing(5))
494      samples->set_frequency(5, samples->base_frequency(5) * (state->m_buckrog_myship / 100.25 + 1));
482   if (m_samples->playing(5))
483      m_samples->set_frequency(5, m_samples->base_frequency(5) * (m_buckrog_myship / 100.25 + 1));
495484}
496485
497486
r31905r31906
508497   if ((diff & 0x20) && (data & 0x20))
509498   {
510499      m_buckrog_myship = data & 0x0f;
511      buckrog_update_samples(this, m_samples);
500      buckrog_update_samples();
512501   }
513502
514503   /* /ALARM0: channel 0 */
r31905r31906
540529   if ((diff & 0x10) && !(data & 0x10))
541530   {
542531      m_samples->start(3, 7);
543      buckrog_update_samples(this, m_samples);
532      buckrog_update_samples();
544533   }
545534
546535   /* /REBOUND: channel 4 */
r31905r31906
550539   if ((diff & 0x40) &&  (data & 0x40) && !m_samples->playing(5))
551540   {
552541      m_samples->start(5, 8, true);
553      buckrog_update_samples(this, m_samples);
542      buckrog_update_samples();
554543   }
555544   if ((diff & 0x40) && !(data & 0x40) &&  m_samples->playing(5)) m_samples->stop(5);
556545
r31905r31906
584573};
585574
586575
587static const samples_interface buckrog_samples_interface =
588{
589   6,          /* 6 channels */
590   buckrog_sample_names
591};
592
593
594576MACHINE_CONFIG_FRAGMENT( buckrog_samples )
595577   MCFG_SPEAKER_STANDARD_MONO("mono")
596   MCFG_SAMPLES_ADD("samples", buckrog_samples_interface)
578   MCFG_SOUND_ADD("samples", SAMPLES, 0)
579   MCFG_SAMPLES_CHANNELS(6)
580   MCFG_SAMPLES_NAMES(buckrog_sample_names)
597581   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
598582MACHINE_CONFIG_END
599583
trunk/src/mame/audio/astrof.c
r31905r31906
136136   0
137137};
138138
139
140static const samples_interface astrof_samples_interface =
141{
142   4,  /* 4 channels */
143   astrof_sample_names
144};
145
146
147
148139MACHINE_CONFIG_FRAGMENT( astrof_audio )
149140   MCFG_SPEAKER_STANDARD_MONO("mono")
150   MCFG_SAMPLES_ADD("samples", astrof_samples_interface)
141   MCFG_SOUND_ADD("samples", SAMPLES, 0)
142   MCFG_SAMPLES_CHANNELS(4)
143   MCFG_SAMPLES_NAMES(astrof_sample_names)
151144   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
152145MACHINE_CONFIG_END
153146
trunk/src/mame/audio/polyplay.c
r31905r31906
1818
1919
2020
21SAMPLES_START( polyplay_sh_start )
21SAMPLES_START_CB_MEMBER(polyplay_state::sh_start)
2222{
23   polyplay_state *state = device.machine().driver_data<polyplay_state>();
2423   int i;
2524
2625   for (i = 0; i < SAMPLE_LENGTH / 2; i++) {
27      state->m_backgroundwave[i] = + SAMPLE_AMPLITUDE;
26      m_backgroundwave[i] = + SAMPLE_AMPLITUDE;
2827   }
2928   for (i = SAMPLE_LENGTH / 2; i < SAMPLE_LENGTH; i++) {
30      state->m_backgroundwave[i] = - SAMPLE_AMPLITUDE;
29      m_backgroundwave[i] = - SAMPLE_AMPLITUDE;
3130   }
32   state->m_freq1 = state->m_freq2 = 110;
33   state->m_channel_playing1 = 0;
34   state->m_channel_playing2 = 0;
31   m_freq1 = m_freq2 = 110;
32   m_channel_playing1 = 0;
33   m_channel_playing2 = 0;
3534}
3635
37void polyplay_set_channel1(running_machine &machine, int active)
36void polyplay_state::set_channel1(int active)
3837{
39   polyplay_state *state = machine.driver_data<polyplay_state>();
40   state->m_channel_playing1 = active;
38   m_channel_playing1 = active;
4139}
4240
43void polyplay_set_channel2(running_machine &machine, int active)
41void polyplay_state::set_channel2(int active)
4442{
45   polyplay_state *state = machine.driver_data<polyplay_state>();
46   state->m_channel_playing2 = active;
43   m_channel_playing2 = active;
4744}
4845
49void polyplay_play_channel1(running_machine &machine, int data)
46void polyplay_state::play_channel1(int data)
5047{
51   polyplay_state *state = machine.driver_data<polyplay_state>();
5248   if (data) {
53      state->m_freq1 = 2457600 / 16 / data / 8;
54      state->m_samples->set_volume(0, state->m_channel_playing1 * 1.0);
55      state->m_samples->start_raw(0, state->m_backgroundwave, ARRAY_LENGTH(state->m_backgroundwave), sizeof(state->m_backgroundwave)*state->m_freq1,true);
49      m_freq1 = 2457600 / 16 / data / 8;
50      m_samples->set_volume(0, m_channel_playing1 * 1.0);
51      m_samples->start_raw(0, m_backgroundwave, ARRAY_LENGTH(m_backgroundwave), sizeof(m_backgroundwave)*m_freq1,true);
5652   }
5753   else {
58      state->m_samples->stop(0);
59      state->m_samples->stop(1);
54      m_samples->stop(0);
55      m_samples->stop(1);
6056   }
6157}
6258
63void polyplay_play_channel2(running_machine &machine, int data)
59void polyplay_state::play_channel2(int data)
6460{
65   polyplay_state *state = machine.driver_data<polyplay_state>();
6661   if (data) {
67      state->m_freq2 = 2457600 / 16 / data / 8;
68      state->m_samples->set_volume(1, state->m_channel_playing2 * 1.0);
69      state->m_samples->start_raw(1, state->m_backgroundwave, ARRAY_LENGTH(state->m_backgroundwave), sizeof(state->m_backgroundwave)*state->m_freq2,true);
62      m_freq2 = 2457600 / 16 / data / 8;
63      m_samples->set_volume(1, m_channel_playing2 * 1.0);
64      m_samples->start_raw(1, m_backgroundwave, ARRAY_LENGTH(m_backgroundwave), sizeof(m_backgroundwave)*m_freq2,true);
7065   }
7166   else {
72      state->m_samples->stop(0);
73      state->m_samples->stop(1);
67      m_samples->stop(0);
68      m_samples->stop(1);
7469   }
7570}
trunk/src/mame/audio/depthch.c
r31905r31906
2828};
2929
3030
31static const samples_interface depthch_samples_interface =
32{
33   4,
34   depthch_sample_names
35};
36
37
3831MACHINE_CONFIG_FRAGMENT( depthch_audio )
39   MCFG_SAMPLES_ADD("samples", depthch_samples_interface)
32
33   MCFG_SOUND_ADD("samples", SAMPLES, 0)
34   MCFG_SAMPLES_CHANNELS(4)
35   MCFG_SAMPLES_NAMES(depthch_sample_names)
4036   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
4137MACHINE_CONFIG_END
4238
trunk/src/mame/audio/cclimber.c
r31905r31906
88
99#define SND_CLOCK 3072000   /* 3.072 MHz */
1010
11static INT16 *samplebuf;    /* buffer to decode samples at run time */
12
13static SAMPLES_START( cclimber_sh_start )
11SAMPLES_START_CB_MEMBER( cclimber_audio_device::sh_start )
1412{
15   running_machine &machine = device.machine();
16   samplebuf = 0;
17   if (machine.root_device().memregion("samples")->base())
18      samplebuf = auto_alloc_array(machine, INT16, 2 * machine.root_device().memregion("samples")->bytes());
13   if (machine().root_device().memregion("samples")->base())
14      m_sample_buf = auto_alloc_array(machine(), INT16, 2 * machine().root_device().memregion("samples")->bytes());
1915}
2016
21const samples_interface cclimber_samples_interface =
22{
23   1,
24   NULL,
25   cclimber_sh_start
26};
27
2817MACHINE_CONFIG_FRAGMENT( cclimber_audio )
2918   MCFG_SOUND_ADD("aysnd", AY8910, SND_CLOCK/2)
3019   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(cclimber_audio_device, sample_select_w))
3120   MCFG_SOUND_ROUTE(ALL_OUTPUTS, ":mono", 0.50)
3221
33   MCFG_SAMPLES_ADD("samples", cclimber_samples_interface)
22   MCFG_SOUND_ADD("samples", SAMPLES, 0)
23   MCFG_SAMPLES_CHANNELS(1)
24   MCFG_SAMPLES_START_CB(cclimber_audio_device, sh_start)
3425   MCFG_SOUND_ROUTE(ALL_OUTPUTS, ":mono", 0.5)
3526MACHINE_CONFIG_END
3627
r31905r31906
5142
5243cclimber_audio_device::cclimber_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
5344   : device_t(mconfig, CCLIMBER_AUDIO, "Crazy Climber Sound Board", tag, owner, clock, "cclimber_audio", __FILE__),
45   m_sample_buf(NULL),
5446   m_sample_num(0),
5547   m_sample_freq(0),
5648   m_sample_volume(0),
r31905r31906
116108      int sample;
117109
118110      sample = (rom[start + len] & 0xf0) >> 4;
119      samplebuf[2*len] = SAMPLE_CONV4(sample) * volume / 31;
111      m_sample_buf[2*len] = SAMPLE_CONV4(sample) * volume / 31;
120112
121113      sample = rom[start + len] & 0x0f;
122      samplebuf[2*len + 1] = SAMPLE_CONV4(sample) * volume / 31;
114      m_sample_buf[2*len + 1] = SAMPLE_CONV4(sample) * volume / 31;
123115
124116      len++;
125117   }
126118
127   m_samples->start_raw(0,samplebuf,2 * len,freq);
119   m_samples->start_raw(0,m_sample_buf,2 * len,freq);
128120}
trunk/src/mame/audio/cclimber.h
r31905r31906
4141   DECLARE_WRITE8_MEMBER( sample_rate_w );
4242   DECLARE_WRITE8_MEMBER( sample_volume_w );
4343   DECLARE_WRITE8_MEMBER( sample_select_w );
44   
45   SAMPLES_START_CB_MEMBER( sh_start );
4446
4547protected:
4648   // device level overrides
r31905r31906
4850   virtual machine_config_constructor device_mconfig_additions() const;
4951
5052   void play_sample(int start,int freq,int volume);
53   
5154private:
55   INT16 *m_sample_buf;    /* buffer to decode samples at run time */
5256   int m_sample_num;
5357   int m_sample_freq;
5458   int m_sample_volume;
trunk/src/mame/machine/genpin.c
r31905r31906
1010
1111MACHINE_CONFIG_FRAGMENT( genpin_audio )
1212   MCFG_SPEAKER_STANDARD_MONO("mechmono")
13   MCFG_SAMPLES_ADD("samples", genpin_samples_intf)
13   MCFG_SOUND_ADD("samples", SAMPLES, 0)
14   MCFG_SAMPLES_CHANNELS(6)
15   MCFG_SAMPLES_NAMES(genpin_sample_names)
1416   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mechmono", 1.0)
1517MACHINE_CONFIG_END
trunk/src/mame/machine/genpin.h
r31905r31906
77#include "machine/nvram.h"
88
99
10static const char *const genpin_sample_names[] =
10const char *const genpin_sample_names[] =
1111{
1212   "*genpin",
1313   "bumper",
r31905r31906
2222   0   /* end of array */
2323};
2424
25static const samples_interface genpin_samples_intf =
26{
27   6, // channels
28   genpin_sample_names
29};
30
31
3225MACHINE_CONFIG_EXTERN( genpin_audio );
3326
3427
trunk/src/mame/includes/exidy.h
r31905r31906
115115   DECLARE_WRITE8_MEMBER(spectar_audio_2_w);
116116   void adjust_sample(UINT8 freq);
117117   void common_audio_start(int freq);
118   SAMPLES_START_CB_MEMBER(spectar_audio_start);
119   SAMPLES_START_CB_MEMBER(targ_audio_start);
118120
119
120121protected:
121122   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
122123};
trunk/src/mame/includes/tnzs.h
r31905r31906
8585   DECLARE_WRITE8_MEMBER(kageki_csport_w);
8686   DECLARE_WRITE8_MEMBER(kabukiz_sound_bank_w);
8787   DECLARE_WRITE8_MEMBER(kabukiz_sample_w);
88
88   
8989   DECLARE_READ8_MEMBER(tnzs_ramrom_bank_r);
9090   DECLARE_WRITE8_MEMBER(tnzs_ramrom_bank_w);
91   
92   SAMPLES_START_CB_MEMBER(kageki_init_samples);
9193
9294   DECLARE_DRIVER_INIT(arknoid2);
9395   DECLARE_DRIVER_INIT(extrmatn);
trunk/src/mame/includes/snk6502.h
r31905r31906
126126   INT32 m_tone_clock;
127127   sound_stream * m_tone_stream;
128128
129   samples_device *m_samples;
129   optional_device<samples_device> m_samples;
130130   UINT8 *m_ROM;
131131   int m_Sound0StopOnRollover;
132132   UINT8 m_LastPort1;
r31905r31906
146146extern const device_type SNK6502;
147147
148148DISCRETE_SOUND_EXTERN( fantasy );
149extern const samples_interface sasuke_samples_interface;
150extern const samples_interface vanguard_samples_interface;
151extern const samples_interface fantasy_samples_interface;
149extern const char *const sasuke_sample_names[];
150extern const char *const vanguard_sample_names[];
151extern const char *const fantasy_sample_names[];
152152extern const sn76477_interface sasuke_sn76477_intf_1;
153153extern const sn76477_interface sasuke_sn76477_intf_2;
154154extern const sn76477_interface sasuke_sn76477_intf_3;
trunk/src/mame/includes/meadows.h
r31905r31906
1313public:
1414   meadows_state(const machine_config &mconfig, device_type type, const char *tag)
1515      : driver_device(mconfig, type, tag),
16      m_spriteram(*this, "spriteram"),
17      m_videoram(*this, "videoram"),
1816      m_maincpu(*this, "maincpu"),
1917      m_audiocpu(*this, "audiocpu"),
2018      m_dac(*this, "dac"),
2119      m_samples(*this, "samples"),
2220      m_gfxdecode(*this, "gfxdecode"),
2321      m_screen(*this, "screen"),
24      m_palette(*this, "palette")
22      m_palette(*this, "palette"),
23      m_spriteram(*this, "spriteram"),
24      m_videoram(*this, "videoram")
2525   {
2626   }
27   
28   required_device<s2650_device> m_maincpu;
29   optional_device<s2650_device> m_audiocpu;
30   optional_device<dac_device> m_dac;
31   optional_device<samples_device> m_samples;
32   required_device<gfxdecode_device> m_gfxdecode;
33   required_device<screen_device> m_screen;
34   required_device<palette_device> m_palette;
2735
2836   optional_shared_ptr<UINT8> m_spriteram;
2937   required_shared_ptr<UINT8> m_videoram;
38   
3039   UINT8 m_dac_data;
3140   int m_dac_enable;
3241   int m_channel;
r31905r31906
6069   INTERRUPT_GEN_MEMBER(minferno_interrupt);
6170   INTERRUPT_GEN_MEMBER(audio_interrupt);
6271   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip);
63   required_device<s2650_device> m_maincpu;
64   optional_device<s2650_device> m_audiocpu;
65   optional_device<dac_device> m_dac;
66   optional_device<samples_device> m_samples;
67   required_device<gfxdecode_device> m_gfxdecode;
68   required_device<screen_device> m_screen;
69   required_device<palette_device> m_palette;
72   void meadows_sh_dac_w(int data);
73   void meadows_sh_update();
74   SAMPLES_START_CB_MEMBER(meadows_sh_start);
7075};
71
72
73/*----------- defined in audio/meadows.c -----------*/
74
75SAMPLES_START( meadows_sh_start );
76void meadows_sh_dac_w(running_machine &machine, int data);
77void meadows_sh_update(running_machine &machine);
trunk/src/mame/includes/thief.h
r31905r31906
4343   UINT32 screen_update_thief(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4444   INTERRUPT_GEN_MEMBER(thief_interrupt);
4545   UINT16 fetch_image_addr( coprocessor_t &thief_coprocessor );
46   void tape_set_audio( samples_device *samples, int track, int bOn );
47   void tape_set_motor( samples_device *samples, int bOn );
46   void tape_set_audio( int track, int bOn );
47   void tape_set_motor( int bOn );
4848   required_device<cpu_device> m_maincpu;
4949   required_device<samples_device> m_samples;
5050   required_device<tms9927_device> m_tms;
trunk/src/mame/includes/blockade.h
r31905r31906
4141
4242/*----------- defined in audio/blockade.c -----------*/
4343
44extern const samples_interface blockade_samples_interface;
44extern const char *const blockade_sample_names[];
4545DISCRETE_SOUND_EXTERN( blockade );
trunk/src/mame/includes/8080bw.h
r31905r31906
159159
160160
161161/*----------- defined in audio/8080bw.c -----------*/
162extern const samples_interface lrescue_samples_interface;
163extern const samples_interface lupin3_samples_interface;
162extern const char *const lrescue_sample_names[];
163extern const char *const lupin3_sample_names[];
164164
165165DISCRETE_SOUND_EXTERN( ballbomb );
166166DISCRETE_SOUND_EXTERN( indianbt );
trunk/src/mame/includes/suna8.h
r31905r31906
147147   DECLARE_WRITE8_MEMBER(rranger_play_samples_w);
148148   DECLARE_WRITE8_MEMBER(suna8_samples_number_w);
149149   void play_sample(int index);
150   SAMPLES_START_CB_MEMBER(sh_start);
151   
150152   void draw_normal_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int which);
151153   void draw_text_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
152154   UINT8 *brickzn_decrypt();
153155   DECLARE_WRITE_LINE_MEMBER(soundirq);
154156};
155
156/*----------- defined in audio/suna8.c -----------*/
157
158SAMPLES_START( suna8_sh_start );
trunk/src/mame/includes/ninjakd2.h
r31905r31906
44
55******************************************************************************/
66
7#include "sound/samples.h"
8
79class ninjakd2_state : public driver_device
810{
911public:
r31905r31906
1113      : driver_device(mconfig, type, tag),
1214      m_maincpu(*this,"maincpu"),
1315      m_soundcpu(*this, "soundcpu"),
16      m_pcm(*this, "pcm"),
1417      m_bg_videoram(*this, "bg_videoram"),
1518      m_fg_videoram(*this, "fg_videoram"),
1619      m_spriteram(*this, "spriteram"),
r31905r31906
2124
2225   required_device<cpu_device> m_maincpu;
2326   required_device<cpu_device> m_soundcpu;
27   optional_device<samples_device> m_pcm;
2428   optional_shared_ptr<UINT8> m_bg_videoram;
2529   required_shared_ptr<UINT8> m_fg_videoram;
2630   required_shared_ptr<UINT8> m_spriteram;
r31905r31906
5963   DECLARE_WRITE8_MEMBER(ninjakd2_bankselect_w);
6064   DECLARE_WRITE8_MEMBER(ninjakd2_soundreset_w);
6165   DECLARE_WRITE8_MEMBER(ninjakd2_pcm_play_w);
66   SAMPLES_START_CB_MEMBER(ninjakd2_init_samples);
6267   DECLARE_READ8_MEMBER(omegaf_io_protection_r);
6368   DECLARE_READ8_MEMBER(robokid_motion_error_verbose_r);
6469   DECLARE_WRITE8_MEMBER(omegaf_io_protection_w);
trunk/src/mame/includes/circus.h
r31905r31906
6262DISCRETE_SOUND_EXTERN( circus );
6363DISCRETE_SOUND_EXTERN( robotbwl );
6464DISCRETE_SOUND_EXTERN( crash );
65extern const samples_interface circus_samples_interface;
66extern const samples_interface crash_samples_interface;
67extern const samples_interface ripcord_samples_interface;
68extern const samples_interface robotbwl_samples_interface;
65extern const char *const circus_sample_names[];
66extern const char *const crash_sample_names[];
67extern const char *const ripcord_sample_names[];
68extern const char *const robotbwl_sample_names[];
trunk/src/mame/includes/turbo.h
r31905r31906
168168   void buckrog_prepare_sprites(UINT8 y, sprite_info *info);
169169   UINT32 buckrog_get_sprite_bits(const UINT8 *sprite_gfxdata, sprite_info *sprinfo, UINT8 *plb);
170170   void turbo_rom_decode();
171   void turbo_update_samples();
172   inline void subroc3d_update_volume(int leftchan, UINT8 dis, UINT8 dir);
173   void buckrog_update_samples();
171174};
172175
173176
trunk/src/mame/includes/polyplay.h
r31905r31906
1515      m_palette(*this, "palette")  { }
1616
1717   required_shared_ptr<UINT8> m_videoram;
18   required_shared_ptr<UINT8> m_characterram;
19   
20   required_device<cpu_device> m_maincpu;
21   required_device<samples_device> m_samples;
22   required_device<gfxdecode_device> m_gfxdecode;
23   required_device<palette_device> m_palette;
24   
1825   int m_freq1;
1926   int m_freq2;
2027   int m_channel_playing1;
r31905r31906
2835   int m_channel2_const;
2936   timer_device* m_timer;
3037   int m_last;
31   required_shared_ptr<UINT8> m_characterram;
38   
3239   DECLARE_WRITE8_MEMBER(polyplay_sound_channel);
3340   DECLARE_WRITE8_MEMBER(polyplay_start_timer2);
3441   DECLARE_READ8_MEMBER(polyplay_random_read);
3542   DECLARE_WRITE8_MEMBER(polyplay_characterram_w);
43   SAMPLES_START_CB_MEMBER(sh_start);
44   void set_channel1(int active);
45   void set_channel2(int active);
46   void play_channel1(int data);
47   void play_channel2(int data);
3648   virtual void machine_reset();
3749   virtual void video_start();
3850   DECLARE_PALETTE_INIT(polyplay);
r31905r31906
4052   INTERRUPT_GEN_MEMBER(periodic_interrupt);
4153   INTERRUPT_GEN_MEMBER(coin_interrupt);
4254   TIMER_DEVICE_CALLBACK_MEMBER(polyplay_timer_callback);
43   required_device<cpu_device> m_maincpu;
44   required_device<samples_device> m_samples;
45   required_device<gfxdecode_device> m_gfxdecode;
46   required_device<palette_device> m_palette;
4755};
48
49
50/*----------- defined in audio/polyplay.c -----------*/
51
52void polyplay_set_channel1(running_machine &machine, int active);
53void polyplay_set_channel2(running_machine &machine, int active);
54void polyplay_play_channel1(running_machine &machine, int data);
55void polyplay_play_channel2(running_machine &machine, int data);
56SAMPLES_START( polyplay_sh_start );
trunk/src/mame/includes/superqix.h
r31905r31906
7777   DECLARE_READ8_MEMBER(bootleg_in0_r);
7878   DECLARE_READ8_MEMBER(hotsmash_ay_port_a_r);
7979   DECLARE_READ8_MEMBER(pbillian_ay_port_a_r);
80   SAMPLES_START_CB_MEMBER(pbillian_sh_start);
8081   DECLARE_DRIVER_INIT(sqix);
8182   DECLARE_DRIVER_INIT(perestro);
8283   DECLARE_DRIVER_INIT(sqixa);
trunk/src/mame/includes/tmnt.h
r31905r31906
181181   K052109_CB_MEMBER(tmnt_tile_callback);
182182   K052109_CB_MEMBER(ssbl_tile_callback);
183183   K052109_CB_MEMBER(blswhstl_tile_callback);
184   SAMPLES_START_CB_MEMBER(tmnt_decode_sample);
184185
185186protected:
186187   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
trunk/src/mame/includes/triplhnt.h
r31905r31906
7777
7878/*----------- defined in audio/triplhnt.c -----------*/
7979DISCRETE_SOUND_EXTERN( triplhnt );
80extern const samples_interface triplhnt_samples_interface;
80extern const char *const triplhnt_sample_names[];
trunk/src/mame/drivers/starcrus.c
r31905r31906
127127   0
128128};
129129
130static const samples_interface starcrus_samples_interface =
131{
132   4,  /* 4 channels */
133   starcrus_sample_names
134};
135130
136
137131static MACHINE_CONFIG_START( starcrus, starcrus_state )
138132
139133   /* basic machine hardware */
r31905r31906
158152   /* sound hardware */
159153   MCFG_SPEAKER_STANDARD_MONO("mono")
160154
161   MCFG_SAMPLES_ADD("samples", starcrus_samples_interface)
155   MCFG_SOUND_ADD("samples", SAMPLES, 0)
156   MCFG_SAMPLES_CHANNELS(4)
157   MCFG_SAMPLES_NAMES(starcrus_sample_names)
162158   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
163159MACHINE_CONFIG_END
164160
trunk/src/mame/drivers/mcr.c
r31905r31906
17381738   0
17391739};
17401740
1741static const samples_interface journey_samples_interface =
1742{
1743   1,
1744   journey_sample_names
1745};
1746
1747
17481741static const char *const twotiger_sample_names[] =
17491742{
17501743   "*twotiger",
r31905r31906
17531746   0
17541747};
17551748
1756static const samples_interface twotiger_samples_interface =
1757{
1758   2,
1759   twotiger_sample_names
1760};
1761
1762
1763
17641749/*************************************
17651750 *
17661751 *  Machine driver
r31905r31906
18381823static MACHINE_CONFIG_DERIVED( mcr_90010_tt, mcr_90010 )
18391824
18401825   /* sound hardware */
1841   MCFG_SAMPLES_ADD("samples", twotiger_samples_interface)
1826   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1827   MCFG_SAMPLES_CHANNELS(2)
1828   MCFG_SAMPLES_NAMES(twotiger_sample_names)
18421829   MCFG_SOUND_ROUTE(0, "lspeaker", 0.25)
18431830   MCFG_SOUND_ROUTE(1, "rspeaker", 0.25)
18441831MACHINE_CONFIG_END
r31905r31906
18531840   MCFG_PALETTE_FORMAT(xxxxRRRRBBBBGGGG)
18541841
18551842   /* sound hardware */
1856   MCFG_SAMPLES_ADD("samples", journey_samples_interface)
1843   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1844   MCFG_SAMPLES_CHANNELS(1)
1845   MCFG_SAMPLES_NAMES(journey_sample_names)
18571846   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25)
18581847   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.25)
18591848MACHINE_CONFIG_END
trunk/src/mame/drivers/blockade.c
r31905r31906
481481   /* sound hardware */
482482   MCFG_SPEAKER_STANDARD_MONO("mono")
483483
484   MCFG_SAMPLES_ADD("samples", blockade_samples_interface)
484   MCFG_SOUND_ADD("samples", SAMPLES, 0)
485   MCFG_SAMPLES_CHANNELS(1)
486   MCFG_SAMPLES_NAMES(blockade_sample_names)
485487   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
486488
487489   MCFG_SOUND_ADD("discrete", DISCRETE, 0)
trunk/src/mame/drivers/galaga.c
r31905r31906
15831583   0   /* end of array */
15841584};
15851585
1586static const samples_interface battles_samples_interface =
1587{
1588   1,  /* one channel */
1589   battles_sample_names
1590};
1591
1592
15931586INTERRUPT_GEN_MEMBER(galaga_state::main_vblank_irq)
15941587{
15951588   if(m_main_irq_mask)
r31905r31906
18671860   /* sound hardware */
18681861   MCFG_DEVICE_REMOVE("discrete")
18691862
1870   MCFG_SAMPLES_ADD("samples", battles_samples_interface)
1863   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1864   MCFG_SAMPLES_CHANNELS(1)
1865   MCFG_SAMPLES_NAMES(battles_sample_names)
18711866   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
18721867MACHINE_CONFIG_END
18731868
trunk/src/mame/drivers/8080bw.c
r31905r31906
10591059   /* sound hardware */
10601060   MCFG_SPEAKER_STANDARD_MONO("mono")
10611061
1062   MCFG_SAMPLES_ADD("samples", lrescue_samples_interface)
1062   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1063   MCFG_SAMPLES_CHANNELS(4)
1064   MCFG_SAMPLES_NAMES(lrescue_sample_names)
10631065   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
10641066
10651067   /* extra audio channel */
r31905r31906
16631665   MCFG_SOUND_CONFIG(lupin3_sn76477_interface)
16641666   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
16651667
1666   MCFG_SAMPLES_ADD("samples", lupin3_samples_interface)
1668   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1669   MCFG_SAMPLES_CHANNELS(4)
1670   MCFG_SAMPLES_NAMES(lupin3_sample_names)
16671671   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
16681672
16691673   MCFG_SOUND_ADD("discrete", DISCRETE, 0)
r31905r31906
16931697   MCFG_SOUND_CONFIG(lupin3_sn76477_interface)
16941698   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
16951699
1696   MCFG_SAMPLES_ADD("samples", lupin3_samples_interface)
1700   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1701   MCFG_SAMPLES_CHANNELS(4)
1702   MCFG_SAMPLES_NAMES(lupin3_sample_names)
16971703   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
16981704
16991705   MCFG_SOUND_ADD("discrete", DISCRETE, 0)
trunk/src/mame/drivers/gridlee.c
r31905r31906
400400   0   /* end of array */
401401};
402402
403static const samples_interface gridlee_samples_interface =
404{
405   8,  /* 8 channels */
406   sample_names
407};
408
409
410
411403/*************************************
412404 *
413405 *  Machine driver
r31905r31906
437429   MCFG_SOUND_ADD("gridlee", GRIDLEE, 0)
438430   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
439431
440   MCFG_SAMPLES_ADD("samples", gridlee_samples_interface)
432   MCFG_SOUND_ADD("samples", SAMPLES, 0)
433   MCFG_SAMPLES_CHANNELS(8)
434   MCFG_SAMPLES_NAMES(sample_names)
441435   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
442436MACHINE_CONFIG_END
443437
trunk/src/mame/drivers/snk6502.c
r31905r31906
827827   MCFG_SOUND_ADD("snk6502", SNK6502, 0)
828828   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
829829
830   MCFG_SAMPLES_ADD("samples", sasuke_samples_interface)
830   
831   MCFG_SOUND_ADD("samples", SAMPLES, 0)
832   MCFG_SAMPLES_CHANNELS(4)
833   MCFG_SAMPLES_NAMES(sasuke_sample_names)
831834   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.12)
832835
833836   MCFG_SOUND_ADD("sn76477.1", SN76477, 0)
r31905r31906
854857   MCFG_GFXDECODE_MODIFY("gfxdecode", satansat)
855858
856859   // sound hardware
857   MCFG_SAMPLES_REPLACE("samples", vanguard_samples_interface)
860   MCFG_SOUND_MODIFY("samples")
861   MCFG_SAMPLES_CHANNELS(3)
862   MCFG_SAMPLES_NAMES(vanguard_sample_names)
858863   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
859864
860865   MCFG_SOUND_REPLACE("sn76477.1", SN76477, 0)
r31905r31906
901906   MCFG_SOUND_ADD("snk6502", SNK6502, 0)
902907   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
903908
904   MCFG_SAMPLES_ADD("samples", vanguard_samples_interface)
909   MCFG_SOUND_ADD("samples", SAMPLES, 0)
910   MCFG_SAMPLES_CHANNELS(3)
911   MCFG_SAMPLES_NAMES(vanguard_sample_names)
905912   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
906913
907914   MCFG_SOUND_ADD("sn76477.1", SN76477, 0)
r31905r31906
919926   MCFG_CPU_PROGRAM_MAP(fantasy_map)
920927
921928   // sound hardware
922   MCFG_SAMPLES_REPLACE("samples", fantasy_samples_interface)
929   MCFG_SOUND_MODIFY("samples")
930   MCFG_SAMPLES_CHANNELS(1)
931   MCFG_SAMPLES_NAMES(fantasy_sample_names)
923932   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
924933
925934   MCFG_SOUND_REPLACE("sn76477.1", SN76477, 0)
trunk/src/mame/drivers/segag80v.c
r31905r31906
814814   0   /* end of array */
815815};
816816
817static const samples_interface elim2_samples_interface =
818{
819   8,  /* 8 channels */
820   elim_sample_names
821};
822817
823
824
825818/*************************************
826819 *
827820 *  Space Fury sound interfaces
r31905r31906
845838   0   /* end of array */
846839};
847840
848
849static const samples_interface spacfury_samples_interface =
850{
851   8,  /* 8 channels */
852   spacfury_sample_names
853};
854
855
856841/*************************************
857842 *
858843 *  Zektor sound interfaces
r31905r31906
877862};
878863
879864
880static const samples_interface zektor_samples_interface =
881{
882   8,
883   zektor_sample_names
884};
885
886
887
888865/*************************************
889866 *
890867 *  Machine drivers
r31905r31906
918895static MACHINE_CONFIG_DERIVED( elim2, g80v_base )
919896
920897   /* custom sound board */
921   MCFG_SAMPLES_ADD("samples", elim2_samples_interface)
898   MCFG_SOUND_ADD("samples", SAMPLES, 0)
899   MCFG_SAMPLES_CHANNELS(8)
900   MCFG_SAMPLES_NAMES(elim_sample_names)
922901   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
923902MACHINE_CONFIG_END
924903
r31905r31906
926905static MACHINE_CONFIG_DERIVED( spacfury, g80v_base )
927906
928907   /* custom sound board */
929   MCFG_SAMPLES_ADD("samples", spacfury_samples_interface)
908   MCFG_SOUND_ADD("samples", SAMPLES, 0)
909   MCFG_SAMPLES_CHANNELS(8)
910   MCFG_SAMPLES_NAMES(spacfury_sample_names)
930911   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
931912
932913   /* speech board */
r31905r31906
937918static MACHINE_CONFIG_DERIVED( zektor, g80v_base )
938919
939920   /* custom sound board */
940   MCFG_SAMPLES_ADD("samples", zektor_samples_interface)
921   MCFG_SOUND_ADD("samples", SAMPLES, 0)
922   MCFG_SAMPLES_CHANNELS(8)
923   MCFG_SAMPLES_NAMES(zektor_sample_names)
941924   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
942925
943926   MCFG_SOUND_ADD("aysnd", AY8910, CPU_CLOCK/2/2)
trunk/src/mame/drivers/astrocde.c
r31905r31906
12061206   0
12071207};
12081208
1209static const samples_interface seawolf2_samples_interface =
1210{
1211   10, /* 5*2 channels */
1212   seawolf_sample_names
1213};
1214
1215static const samples_interface wow_samples_interface =
1216{
1217   1,
1218   wow_sample_names
1219};
1220
1221static const samples_interface gorf_samples_interface =
1222{
1223   1,
1224   gorf_sample_names
1225};
1226
1227
1228
12291209/*************************************
12301210 *
12311211 *  CPU configurations
r31905r31906
13221302   /* sound hardware */
13231303   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
13241304
1325   MCFG_SAMPLES_ADD("samples", seawolf2_samples_interface)
1305   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1306   MCFG_SAMPLES_CHANNELS(10) /* 5*2 channels */
1307   MCFG_SAMPLES_NAMES(seawolf_sample_names)
13261308   MCFG_SOUND_ROUTE(0, "lspeaker", 0.25)
13271309   MCFG_SOUND_ROUTE(1, "lspeaker", 0.25)
13281310   MCFG_SOUND_ROUTE(2, "lspeaker", 0.25)
r31905r31906
13551337   MCFG_CPU_IO_MAP(port_map_mono_pattern)
13561338MACHINE_CONFIG_END
13571339
1358
1359#if !USE_FAKE_VOTRAX
1360static votrax_sc01_interface votrax_interface =
1361{
1362   DEVCB_NULL
1363};
1364#endif
1365
13661340static MACHINE_CONFIG_DERIVED( wow, astrocade_base )
13671341   MCFG_FRAGMENT_ADD(astrocade_stereo_sound)
13681342
r31905r31906
13801354   MCFG_SPEAKER_ADD("center", 0.0, 0.0, 1.0)
13811355
13821356#if USE_FAKE_VOTRAX
1383   MCFG_SAMPLES_ADD("samples", wow_samples_interface)
1357   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1358   MCFG_SAMPLES_CHANNELS(1)
1359   MCFG_SAMPLES_NAMES(wow_sample_names)
13841360#else
1385   MCFG_VOTRAX_SC01_ADD("votrax", 720000, votrax_interface)
1361   MCFG_VOTRAX_SC01_ADD("votrax", VOTRAX_SC01, 720000)
13861362#endif
13871363   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "center", 0.85)
13881364MACHINE_CONFIG_END
r31905r31906
14101386   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lower", 1.0)
14111387
14121388#if USE_FAKE_VOTRAX
1413   MCFG_SAMPLES_ADD("samples", gorf_samples_interface)
1389   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1390   MCFG_SAMPLES_CHANNELS(1)
1391   MCFG_SAMPLES_NAMES(gorf_sample_names)
14141392#else
1415   MCFG_VOTRAX_SC01_ADD("votrax", 720000, votrax_interface)
1393   MCFG_VOTRAX_SC01_ADD("votrax", VOTRAX_SC01, 720000)
14161394#endif
14171395   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "upper", 0.85)
14181396MACHINE_CONFIG_END
trunk/src/mame/drivers/circus.c
r31905r31906
300300   /* sound hardware */
301301   MCFG_SPEAKER_STANDARD_MONO("mono")
302302
303   MCFG_SAMPLES_ADD("samples", circus_samples_interface)
303   MCFG_SOUND_ADD("samples", SAMPLES, 0)
304   MCFG_SAMPLES_CHANNELS(3)
305   MCFG_SAMPLES_NAMES(circus_sample_names)
304306   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
305307
306308   MCFG_SOUND_ADD("discrete", DISCRETE, 0)
r31905r31906
333335   /* sound hardware */
334336   MCFG_SPEAKER_STANDARD_MONO("mono")
335337
336   MCFG_SAMPLES_ADD("samples", robotbwl_samples_interface)
338   MCFG_SOUND_ADD("samples", SAMPLES, 0)
339   MCFG_SAMPLES_CHANNELS(5)
340   MCFG_SAMPLES_NAMES(robotbwl_sample_names)
337341   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
338342
339343   MCFG_SOUND_ADD("discrete", DISCRETE, 0)
r31905r31906
373377   /* sound hardware */
374378   MCFG_SPEAKER_STANDARD_MONO("mono")
375379
376   MCFG_SAMPLES_ADD("samples", crash_samples_interface)
380   MCFG_SOUND_ADD("samples", SAMPLES, 0)
381   MCFG_SAMPLES_CHANNELS(1)
382   MCFG_SAMPLES_NAMES(crash_sample_names)
377383   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
378384
379385   MCFG_SOUND_ADD("discrete", DISCRETE, 0)
r31905r31906
405411   /* sound hardware */
406412   MCFG_SPEAKER_STANDARD_MONO("mono")
407413
408   MCFG_SAMPLES_ADD("samples", ripcord_samples_interface)
414   MCFG_SOUND_ADD("samples", SAMPLES, 0)
415   MCFG_SAMPLES_CHANNELS(4)
416   MCFG_SAMPLES_NAMES(ripcord_sample_names)
409417   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
410418
411419   MCFG_SOUND_ADD("discrete", DISCRETE, 0)
trunk/src/mame/drivers/gaplus.c
r31905r31906
474474   0
475475};
476476
477static const samples_interface gaplus_samples_interface =
478{
479   1,  /* one channel */
480   gaplus_sample_names
481};
482
483
484
485477/***************************************************************************
486478
487479  Custom I/O initialization
r31905r31906
580572   MCFG_NAMCO_AUDIO_VOICES(8)
581573   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
582574
583   MCFG_SAMPLES_ADD("samples", gaplus_samples_interface)
575   MCFG_SOUND_ADD("samples", SAMPLES, 0)
576   MCFG_SAMPLES_CHANNELS(1)
577   MCFG_SAMPLES_NAMES(gaplus_sample_names)
584578   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
585579MACHINE_CONFIG_END
586580
trunk/src/mame/drivers/triplhnt.c
r31905r31906
326326   /* sound hardware */
327327   MCFG_SPEAKER_STANDARD_MONO("mono")
328328
329   MCFG_SAMPLES_ADD("samples", triplhnt_samples_interface)
329   MCFG_SOUND_ADD("samples", SAMPLES, 0)
330   MCFG_SAMPLES_CHANNELS(2)  /* 2 channels */
331   MCFG_SAMPLES_NAMES(triplhnt_sample_names)
330332   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
331333
332334   MCFG_SOUND_ADD("discrete", DISCRETE, 0)
trunk/src/mame/drivers/tankbatt.c
r31905r31906
270270   0   /* end of array */
271271};
272272
273static const samples_interface tankbatt_samples_interface =
274{
275   3,  /* 3 channels */
276   tankbatt_sample_names
277};
278273
279
280
281274static MACHINE_CONFIG_START( tankbatt, tankbatt_state )
282275
283276   /* basic machine hardware */
r31905r31906
302295   /* sound hardware */
303296   MCFG_SPEAKER_STANDARD_MONO("mono")
304297
305   MCFG_SAMPLES_ADD("samples", tankbatt_samples_interface)
298   MCFG_SOUND_ADD("samples", SAMPLES, 0)
299   MCFG_SAMPLES_CHANNELS(3)
300   MCFG_SAMPLES_NAMES(tankbatt_sample_names)
306301   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
307302MACHINE_CONFIG_END
308303
trunk/src/mame/drivers/cosmic.c
r31905r31906
901901};
902902
903903
904static const samples_interface cosmica_samples_interface =
905{
906   13, /* 12 channels */
907   cosmica_sample_names
908};
909
910
911904static const char *const panic_sample_names[] =
912905{
913906   "*panic",
r31905r31906
925918   0
926919};
927920
928static const samples_interface panic_samples_interface =
929{
930   9,  /* 9 channels */
931   panic_sample_names
932};
933921
934922static const char *const cosmicg_sample_names[] =
935923{
r31905r31906
952940   0
953941};
954942
955static const samples_interface cosmicg_samples_interface =
956{
957   9,  /* 9 channels */
958   cosmicg_sample_names
959};
960943
961
962944MACHINE_START_MEMBER(cosmic_state,cosmic)
963945{
964946   save_item(NAME(m_sound_enabled));
r31905r31906
10381020   /* sound hardware */
10391021   MCFG_SPEAKER_STANDARD_MONO("mono")
10401022
1041   MCFG_SAMPLES_ADD("samples", panic_samples_interface)
1023   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1024   MCFG_SAMPLES_CHANNELS(9)
1025   MCFG_SAMPLES_NAMES(panic_sample_names)
10421026   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
10431027
10441028   MCFG_DAC_ADD("dac")
r31905r31906
10641048   /* sound hardware */
10651049   MCFG_SPEAKER_STANDARD_MONO("mono")
10661050
1067   MCFG_SAMPLES_ADD("samples", cosmica_samples_interface)
1051   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1052   MCFG_SAMPLES_CHANNELS(13)
1053   MCFG_SAMPLES_NAMES(cosmica_sample_names)
10681054   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
10691055
10701056   MCFG_DAC_ADD("dac")
r31905r31906
10981084   /* sound hardware */
10991085   MCFG_SPEAKER_STANDARD_MONO("mono")
11001086
1101   MCFG_SAMPLES_ADD("samples", cosmicg_samples_interface)
1087   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1088   MCFG_SAMPLES_CHANNELS(9)
1089   MCFG_SAMPLES_NAMES(cosmicg_sample_names)
11021090   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
11031091
11041092   MCFG_DAC_ADD("dac")
trunk/src/mame/drivers/gotya.c
r31905r31906
167167   0
168168};
169169
170static const samples_interface gotya_samples_interface =
171{
172   4,  /* 4 channels */
173   sample_names
174};
175
176
177170void gotya_state::machine_start()
178171{
179172   save_item(NAME(m_scroll_bit_8));
r31905r31906
211204   /* sound hardware */
212205   MCFG_SPEAKER_STANDARD_MONO("mono")
213206
214   MCFG_SAMPLES_ADD("samples", gotya_samples_interface)
207   MCFG_SOUND_ADD("samples", SAMPLES, 0)
208   MCFG_SAMPLES_CHANNELS(4)
209   MCFG_SAMPLES_NAMES(sample_names)
215210   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
216211MACHINE_CONFIG_END
217212
trunk/src/mame/drivers/rallyx.c
r31905r31906
804804   0   /* end of array */
805805};
806806
807static const samples_interface rallyx_samples_interface =
808{
809   1,  /* 1 channel */
810   rallyx_sample_names
811};
812
813
814
815807/*************************************
816808 *
817809 *  Machine driver
r31905r31906
877869   MCFG_NAMCO_AUDIO_VOICES(3)
878870   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
879871
880   MCFG_SAMPLES_ADD("samples", rallyx_samples_interface)
872   MCFG_SOUND_ADD("samples", SAMPLES, 0)
873   MCFG_SAMPLES_CHANNELS(1)
874   MCFG_SAMPLES_NAMES(rallyx_sample_names)
881875   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
882876MACHINE_CONFIG_END
883877
trunk/src/mame/drivers/m10.c
r31905r31906
797797   0
798798};
799799
800
801static const samples_interface m10_samples_interface =
802{
803   6,  /* 6 channels */
804   m10_sample_names
805};
806
807800/*************************************
808801 *
809802 *  Machine driver
r31905r31906
856849   /* sound hardware */
857850   MCFG_SPEAKER_STANDARD_MONO("mono")
858851
859   MCFG_SAMPLES_ADD("samples", m10_samples_interface)
852   MCFG_SOUND_ADD("samples", SAMPLES, 0)
853   MCFG_SAMPLES_CHANNELS(6)
854   MCFG_SAMPLES_NAMES(m10_sample_names)
860855   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
861856
862857MACHINE_CONFIG_END
r31905r31906
897892   /* sound hardware */
898893   MCFG_SPEAKER_STANDARD_MONO("mono")
899894
900   MCFG_SAMPLES_ADD("samples", m10_samples_interface)
895   MCFG_SOUND_ADD("samples", SAMPLES, 0)
896   MCFG_SAMPLES_CHANNELS(6)
897   MCFG_SAMPLES_NAMES(m10_sample_names)
901898   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
902899
903900MACHINE_CONFIG_END
trunk/src/mame/drivers/starfire.c
r31905r31906
315315   0
316316};
317317
318static const samples_interface starfire_samples_interface =
319{
320   5,  /* 5 channels */
321   starfire_sample_names
322};
323
324
325318INTERRUPT_GEN_MEMBER(starfire_state::vblank_int)
326319{
327320   // starfire has a jumper for disabling NMI, used to do a complete RAM test
r31905r31906
351344   /* sound hardware */
352345   MCFG_SPEAKER_STANDARD_MONO("mono")
353346
354   MCFG_SAMPLES_ADD("samples", starfire_samples_interface)
347   MCFG_SOUND_ADD("samples", SAMPLES, 0)
348   MCFG_SAMPLES_CHANNELS(5)
349   MCFG_SAMPLES_NAMES(starfire_sample_names)
355350   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
356351MACHINE_CONFIG_END
357352
trunk/src/mame/drivers/ninjakd2.c
r31905r31906
151151#include "emu.h"
152152#include "cpu/z80/z80.h"
153153#include "sound/2203intf.h"
154#include "sound/samples.h"
155154#include "machine/mc8123.h"
156155#include "includes/ninjakd2.h"
157156
r31905r31906
169168#define NE555_FREQUENCY 16300   // measured on PCB
170169//#define NE555_FREQUENCY   (1.0f / (0.693 * (560 + 2*51) * 0.1e-6))    // theoretical: this gives 21.8kHz which is too high
171170
172static SAMPLES_START( ninjakd2_init_samples )
171SAMPLES_START_CB_MEMBER(ninjakd2_state::ninjakd2_init_samples)
173172{
174   ninjakd2_state *state = device.machine().driver_data<ninjakd2_state>();
175   running_machine &machine = device.machine();
176   const UINT8* const rom = state->memregion("pcm")->base();
177   const int length = state->memregion("pcm")->bytes();
178   INT16* sampledata = auto_alloc_array(machine, INT16, length);
173   const UINT8* const rom = memregion("pcm")->base();
174   const int length = memregion("pcm")->bytes();
175   INT16* sampledata = auto_alloc_array(machine(), INT16, length);
179176
180177   // convert unsigned 8-bit PCM to signed 16-bit
181178   for (int i = 0; i < length; ++i)
182179      sampledata[i] = rom[i] << 7;
183180
184   state->m_sampledata = sampledata;
181   m_sampledata = sampledata;
185182}
186183
187184WRITE8_MEMBER(ninjakd2_state::ninjakd2_pcm_play_w)
188185{
189   samples_device *samples = machine().device<samples_device>("pcm");
190186   const UINT8* const rom = memregion("pcm")->base();
191187
192188   // only Ninja Kid II uses this
r31905r31906
201197         ++end;
202198
203199      if (end - start)
204         samples->start_raw(0, &m_sampledata[start], end - start, NE555_FREQUENCY);
200         m_pcm->start_raw(0, &m_sampledata[start], end - start, NE555_FREQUENCY);
205201      else
206         samples->stop(0);
202         m_pcm->stop(0);
207203   }
208204}
209205
r31905r31906
870866   m_soundcpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
871867}
872868
873static const samples_interface ninjakd2_samples_interface =
874{
875   1,  /* 1 channel */
876   NULL,
877   ninjakd2_init_samples
878};
879
880
881
882869/*************************************
883870 *
884871 *  Machine drivers
r31905r31906
961948   MCFG_SOUND_ROUTE(2, "mono", 0.10)
962949   MCFG_SOUND_ROUTE(3, "mono", 0.50)
963950
964   MCFG_SAMPLES_ADD("pcm", ninjakd2_samples_interface)
951   MCFG_SOUND_ADD("pcm", SAMPLES, 0)
952   MCFG_SAMPLES_CHANNELS(1)
953   MCFG_SAMPLES_START_CB(ninjakd2_state, ninjakd2_init_samples)
965954   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
966955MACHINE_CONFIG_END
967956
trunk/src/mame/drivers/meadows.c
r31905r31906
240240   switch (offset & 3)
241241   {
242242      case 0: /* DAC */
243         meadows_sh_dac_w(machine(), data ^ 0xff);
243         meadows_sh_dac_w(data ^ 0xff);
244244         break;
245245
246246      case 1: /* counter clk 5 MHz / 256 */
r31905r31906
248248            break;
249249         logerror("audio_w ctr1 preset $%x amp %d\n", data & 15, data >> 4);
250250         m_0c01 = data;
251         meadows_sh_update(machine());
251         meadows_sh_update();
252252         break;
253253
254254      case 2: /* counter clk 5 MHz / 32 (/ 2 or / 4) */
r31905r31906
256256            break;
257257         logerror("audio_w ctr2 preset $%02x\n", data);
258258         m_0c02 = data;
259         meadows_sh_update(machine());
259         meadows_sh_update();
260260         break;
261261
262262      case 3: /* audio enable */
r31905r31906
264264            break;
265265         logerror("audio_w enable ctr2/2:%d ctr2:%d dac:%d ctr1:%d\n", data&1, (data>>1)&1, (data>>2)&1, (data>>3)&1);
266266         m_0c03 = data;
267         meadows_sh_update(machine());
267         meadows_sh_update();
268268         break;
269269   }
270270}
r31905r31906
598598   0
599599};
600600
601
602static const samples_interface meadows_samples_interface =
603{
604   2,
605   NULL,
606   meadows_sh_start
607};
608
609
610static const samples_interface bowl3d_samples_interface =
611{
612   1,
613   bowl3d_sample_names
614};
615
616
617
618601/*************************************
619602 *
620603 *  Machine drivers
r31905r31906
651634   MCFG_DAC_ADD("dac")
652635   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
653636
654   MCFG_SAMPLES_ADD("samples", meadows_samples_interface)
637   MCFG_SOUND_ADD("samples", SAMPLES, 0)
638   MCFG_SAMPLES_CHANNELS(2)
639   MCFG_SAMPLES_START_CB(meadows_state, meadows_sh_start)
655640   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
656641MACHINE_CONFIG_END
657642
r31905r31906
710695   MCFG_DAC_ADD("dac")
711696   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
712697
713   MCFG_SAMPLES_ADD("samples", meadows_samples_interface)
698   MCFG_SOUND_ADD("samples", SAMPLES, 0)
699   MCFG_SAMPLES_CHANNELS(2)
700   MCFG_SAMPLES_START_CB(meadows_state, meadows_sh_start)
714701   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
715702
716   MCFG_SAMPLES_ADD("samples2", bowl3d_samples_interface)
703   MCFG_SOUND_ADD("samples2", SAMPLES, 0)
704   MCFG_SAMPLES_CHANNELS(1)
705   MCFG_SAMPLES_NAMES(bowl3d_sample_names)
717706   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
718707MACHINE_CONFIG_END
719708
trunk/src/mame/drivers/dai3wksi.c
r31905r31906
293293};
294294
295295
296static const samples_interface dai3wksi_samples_interface =
297{
298   6,  /* 6 channels */
299   dai3wksi_sample_names
300};
301
302296#else
303297
304298WRITE8_MEMBER(dai3wksi_state::dai3wksi_audio_1_w)
r31905r31906
610604   MCFG_SPEAKER_STANDARD_MONO("mono")
611605
612606#if (USE_SAMPLES)
613   MCFG_SAMPLES_ADD("samples", dai3wksi_samples_interface)
607   MCFG_SOUND_ADD("samples", SAMPLES, 0)
608   MCFG_SAMPLES_CHANNELS(6)
609   MCFG_SAMPLES_NAMES(dai3wksi_sample_names)
614610   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
615611#else
616612   MCFG_SOUND_ADD("ic76", SN76477, 0)
trunk/src/mame/drivers/safarir.c
r31905r31906
243243
244244WRITE8_MEMBER(safarir_state::safarir_audio_w)
245245{
246   samples_device *samples = m_samples;
247246   UINT8 rising_bits = data & ~m_port_last;
248247
249   if (rising_bits == 0x12) samples->start(CHANNEL_SOUND1, SAMPLE_SOUND1_1);
250   if (rising_bits == 0x02) samples->start(CHANNEL_SOUND1, SAMPLE_SOUND1_2);
251   if (rising_bits == 0x95) samples->start(CHANNEL_SOUND1, SAMPLE_SOUND6);
248   if (rising_bits == 0x12) m_samples->start(CHANNEL_SOUND1, SAMPLE_SOUND1_1);
249   if (rising_bits == 0x02) m_samples->start(CHANNEL_SOUND1, SAMPLE_SOUND1_2);
250   if (rising_bits == 0x95) m_samples->start(CHANNEL_SOUND1, SAMPLE_SOUND6);
252251
253   if (rising_bits == 0x04 && (data == 0x15 || data ==0x16)) samples->start(CHANNEL_SOUND2, SAMPLE_SOUND2);
252   if (rising_bits == 0x04 && (data == 0x15 || data ==0x16)) m_samples->start(CHANNEL_SOUND2, SAMPLE_SOUND2);
254253
255   if (data == 0x5f && (rising_bits == 0x49 || rising_bits == 0x5f)) samples->start(CHANNEL_SOUND3, SAMPLE_SOUND3, true);
256   if (data == 0x00 || rising_bits == 0x01) samples->stop(CHANNEL_SOUND3);
254   if (data == 0x5f && (rising_bits == 0x49 || rising_bits == 0x5f)) m_samples->start(CHANNEL_SOUND3, SAMPLE_SOUND3, true);
255   if (data == 0x00 || rising_bits == 0x01) m_samples->stop(CHANNEL_SOUND3);
257256
258257   if (data == 0x13)
259258   {
260259      if ((rising_bits == 0x13 && m_port_last != 0x04) || (rising_bits == 0x01 && m_port_last == 0x12))
261260      {
262         samples->start(CHANNEL_SOUND4, SAMPLE_SOUND7);
261         m_samples->start(CHANNEL_SOUND4, SAMPLE_SOUND7);
263262      }
264      else if (rising_bits == 0x03 && m_port_last2 == 0x15 && !samples->playing(CHANNEL_SOUND4))
263      else if (rising_bits == 0x03 && m_port_last2 == 0x15 && !m_samples->playing(CHANNEL_SOUND4))
265264      {
266         samples->start(CHANNEL_SOUND4, SAMPLE_SOUND4_1);
265         m_samples->start(CHANNEL_SOUND4, SAMPLE_SOUND4_1);
267266      }
268267   }
269   if (data == 0x53 && m_port_last == 0x55) samples->start(CHANNEL_SOUND4, SAMPLE_SOUND4_2);
268   if (data == 0x53 && m_port_last == 0x55) m_samples->start(CHANNEL_SOUND4, SAMPLE_SOUND4_2);
270269
271   if (data == 0x1f && rising_bits == 0x1f) samples->start(CHANNEL_SOUND5, SAMPLE_SOUND5_1);
272   if (data == 0x14 && (rising_bits == 0x14 || rising_bits == 0x04)) samples->start(CHANNEL_SOUND5, SAMPLE_SOUND5_2);
270   if (data == 0x1f && rising_bits == 0x1f) m_samples->start(CHANNEL_SOUND5, SAMPLE_SOUND5_1);
271   if (data == 0x14 && (rising_bits == 0x14 || rising_bits == 0x04)) m_samples->start(CHANNEL_SOUND5, SAMPLE_SOUND5_2);
273272
274   if (data == 0x07 && rising_bits == 0x07 && !samples->playing(CHANNEL_SOUND6))
275      samples->start(CHANNEL_SOUND6, SAMPLE_SOUND8);
273   if (data == 0x07 && rising_bits == 0x07 && !m_samples->playing(CHANNEL_SOUND6))
274      m_samples->start(CHANNEL_SOUND6, SAMPLE_SOUND8);
276275
277276   m_port_last2 = m_port_last;
278277   m_port_last = data;
r31905r31906
297296};
298297
299298
300static const samples_interface safarir_samples_interface =
301{
302   6,  /* 6 channels */
303   safarir_sample_names
304};
305
306
307299static MACHINE_CONFIG_FRAGMENT( safarir_audio )
308300   MCFG_SPEAKER_STANDARD_MONO("mono")
309   MCFG_SAMPLES_ADD("samples", safarir_samples_interface)
301   MCFG_SOUND_ADD("samples", SAMPLES, 0)
302   MCFG_SAMPLES_CHANNELS(6)
303   MCFG_SAMPLES_NAMES(safarir_sample_names)
310304   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
311305MACHINE_CONFIG_END
312306
trunk/src/mame/drivers/polyplay.c
r31905r31906
9090/* timer handling */
9191
9292
93
94
95
96/* Polyplay Sound Interface */
97static const samples_interface polyplay_samples_interface =
98{
99   2,
100   NULL,
101   polyplay_sh_start
102};
103
104
10593void polyplay_state::machine_reset()
10694{
10795   m_channel1_active = 0;
r31905r31906
10997   m_channel2_active = 0;
11098   m_channel2_const = 0;
11199
112   polyplay_set_channel1(machine(), 0);
113   polyplay_play_channel1(machine(), 0);
114   polyplay_set_channel2(machine(), 0);
115   polyplay_play_channel2(machine(), 0);
100   set_channel1(0);
101   play_channel1(0);
102   set_channel2(0);
103   play_channel2(0);
116104
117105   m_timer = machine().device<timer_device>("timer");
118106}
r31905r31906
178166   case 0x00:
179167      if (m_channel1_const) {
180168         if (data <= 1) {
181            polyplay_set_channel1(machine(), 0);
169            set_channel1(0);
182170         }
183171         m_channel1_const = 0;
184         polyplay_play_channel1(machine(), data*m_prescale1);
172         play_channel1(data*m_prescale1);
185173
186174      }
187175      else {
188176         m_prescale1 = (data & 0x20) ? 16 : 1;
189177         if (data & 0x04) {
190            polyplay_set_channel1(machine(), 1);
178            set_channel1(1);
191179            m_channel1_const = 1;
192180         }
193181         if ((data == 0x41) || (data == 0x65) || (data == 0x45)) {
194            polyplay_set_channel1(machine(), 0);
195            polyplay_play_channel1(machine(), 0);
182            set_channel1(0);
183            play_channel1(0);
196184         }
197185      }
198186      break;
199187   case 0x01:
200188      if (m_channel2_const) {
201189         if (data <= 1) {
202            polyplay_set_channel2(machine(), 0);
190            set_channel2(0);
203191         }
204192         m_channel2_const = 0;
205         polyplay_play_channel2(machine(), data*m_prescale2);
193         play_channel2(data*m_prescale2);
206194
207195      }
208196      else {
209197         m_prescale2 = (data & 0x20) ? 16 : 1;
210198         if (data & 0x04) {
211            polyplay_set_channel2(machine(), 1);
199            set_channel2(1);
212200            m_channel2_const = 1;
213201         }
214202         if ((data == 0x41) || (data == 0x65) || (data == 0x45)) {
215            polyplay_set_channel2(machine(), 0);
216            polyplay_play_channel2(machine(), 0);
203            set_channel2(0);
204            play_channel2(0);
217205         }
218206      }
219207      break;
r31905r31906
293281   /* sound hardware */
294282   MCFG_SPEAKER_STANDARD_MONO("mono")
295283
296   MCFG_SAMPLES_ADD("samples", polyplay_samples_interface)
284   MCFG_SOUND_ADD("samples", SAMPLES, 0)
285   MCFG_SAMPLES_CHANNELS(2)
286   MCFG_SAMPLES_START_CB(polyplay_state, sh_start)
297287   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
298288MACHINE_CONFIG_END
299289
trunk/src/mame/drivers/equites.c
r31905r31906
10981098   0
10991099};
11001100
1101static const samples_interface alphamc07_samples_interface =
1102{
1103   3,  /* 3 channels */
1104   alphamc07_sample_names
1105};
11061101
1107
11081102#define MSM5232_BASE_VOLUME 1.0
11091103
11101104// the sound board is the same in all games
r31905r31906
11431137   MCFG_DAC_ADD("dac2")
11441138   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
11451139
1146   MCFG_SAMPLES_ADD("samples", alphamc07_samples_interface)
1140   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1141   MCFG_SAMPLES_CHANNELS(3)
1142   MCFG_SAMPLES_NAMES(alphamc07_sample_names)
11471143   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
11481144MACHINE_CONFIG_END
11491145
trunk/src/mame/drivers/thief.c
r31905r31906
5858   kTalkTrack, kCrashTrack
5959};
6060
61void thief_state::tape_set_audio( samples_device *samples, int track, int bOn )
61void thief_state::tape_set_audio( int track, int bOn )
6262{
63   samples->set_volume(track, bOn ? 1.0 : 0.0 );
63   m_samples->set_volume(track, bOn ? 1.0 : 0.0 );
6464}
6565
66void thief_state::tape_set_motor( samples_device *samples, int bOn )
66void thief_state::tape_set_motor( int bOn )
6767{
6868   if( bOn )
6969   {
7070      /* If talk track is not playing, start it. */
71      if (! samples->playing( kTalkTrack ))
72         samples->start( 0, kTalkTrack, true );
71      if (! m_samples->playing( kTalkTrack ))
72         m_samples->start( 0, kTalkTrack, true );
7373
7474      /* Resume playback of talk track. */
75      samples->pause( kTalkTrack, false);
75      m_samples->pause( kTalkTrack, false);
7676
7777
7878      /* If crash track is not playing, start it. */
79      if (! samples->playing( kCrashTrack ))
80         samples->start( 1, kCrashTrack, true );
79      if (! m_samples->playing( kCrashTrack ))
80         m_samples->start( 1, kCrashTrack, true );
8181
8282      /* Resume playback of crash track. */
83      samples->pause( kCrashTrack, false);
83      m_samples->pause( kCrashTrack, false);
8484   }
8585   else
8686   {
8787      /* Pause both the talk and crash tracks. */
88      samples->pause( kTalkTrack, true );
89      samples->pause( kCrashTrack, true );
88      m_samples->pause( kTalkTrack, true );
89      m_samples->pause( kCrashTrack, true );
9090   }
9191}
9292
r31905r31906
111111      break;
112112
113113   case 0x08: /* talk track on */
114      tape_set_audio( m_samples, kTalkTrack, 1 );
114      tape_set_audio( kTalkTrack, 1 );
115115      break;
116116
117117   case 0x09: /* talk track off */
118      tape_set_audio( m_samples, kTalkTrack, 0 );
118      tape_set_audio( kTalkTrack, 0 );
119119      break;
120120
121121   case 0x0a: /* motor on */
122      tape_set_motor( m_samples, 1 );
122      tape_set_motor( 1 );
123123      break;
124124
125125   case 0x0b: /* motor off */
126      tape_set_motor( m_samples, 0 );
126      tape_set_motor( 0 );
127127      break;
128128
129129   case 0x0c: /* crash track on */
130      tape_set_audio( m_samples, kCrashTrack, 1 );
130      tape_set_audio( kCrashTrack, 1 );
131131      break;
132132
133133   case 0x0d: /* crash track off */
134      tape_set_audio( m_samples, kCrashTrack, 0 );
134      tape_set_audio( kCrashTrack, 0 );
135135      break;
136136   }
137137}
r31905r31906
386386   0   /* end of array */
387387};
388388
389static const samples_interface sharkatt_samples_interface =
390{
391   2,  /* number of channels */
392   sharkatt_sample_names
393};
394
395389/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
396390
397391static const char *const thief_sample_names[] =
r31905r31906
402396   0   /* end of array */
403397};
404398
405static const samples_interface thief_samples_interface =
406{
407   2,  /* number of channels */
408   thief_sample_names
409};
410
411399/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
412400
413401static const char *const natodef_sample_names[] =
r31905r31906
418406   0   /* end of array */
419407};
420408
421static const samples_interface natodef_samples_interface =
422{
423   2,  /* number of channels */
424   natodef_sample_names
425};
426409
427410static MACHINE_CONFIG_START( sharkatt, thief_state )
428411
r31905r31906
455438   MCFG_SOUND_ADD("ay2", AY8910, 4000000/4)
456439   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
457440
458   MCFG_SAMPLES_ADD("samples", sharkatt_samples_interface)
441   MCFG_SOUND_ADD("samples", SAMPLES, 0)
442   MCFG_SAMPLES_CHANNELS(2)
443   MCFG_SAMPLES_NAMES(sharkatt_sample_names)
459444   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
460445MACHINE_CONFIG_END
461446
r31905r31906
491476   MCFG_SOUND_ADD("ay2", AY8910, 4000000/4)
492477   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
493478
494   MCFG_SAMPLES_ADD("samples", thief_samples_interface)
479   MCFG_SOUND_ADD("samples", SAMPLES, 0)
480   MCFG_SAMPLES_CHANNELS(2)
481   MCFG_SAMPLES_NAMES(thief_sample_names)
495482   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
496483MACHINE_CONFIG_END
497484
r31905r31906
527514   MCFG_SOUND_ADD("ay2", AY8910, 4000000/4)
528515   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
529516
530   MCFG_SAMPLES_ADD("samples", natodef_samples_interface)
517   MCFG_SOUND_ADD("samples", SAMPLES, 0)
518   MCFG_SAMPLES_CHANNELS(2)
519   MCFG_SAMPLES_NAMES(natodef_sample_names)
531520   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
532521MACHINE_CONFIG_END
533522
trunk/src/mame/drivers/aristmk4.c
r31905r31906
677677   0
678678};
679679
680static const samples_interface meter_samples_interface =
681{
682   5,  /* one for each meter - can pulse simultaneously */
683   meter_sample_names
684};
685
686680/******************************************************************************
687681
688682VERSATILE INTERFACE ADAPTER CONFIGURATION
r31905r31906
17071701   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(aristmk4_state, pbltlp_out))  // Port B write - goes to lamps on the buttons x4 and light tower x4
17081702   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
17091703
1710   MCFG_SAMPLES_ADD("samples", meter_samples_interface)
1704   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1705   MCFG_SAMPLES_CHANNELS(5)  /* one for each meter - can pulse simultaneously */
1706   MCFG_SAMPLES_NAMES(meter_sample_names)   
17111707   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.05)
17121708
17131709MACHINE_CONFIG_END
trunk/src/mame/drivers/superqix.c
r31905r31906
108108#include "includes/superqix.h"
109109
110110
111static SAMPLES_START( pbillian_sh_start )
111SAMPLES_START_CB_MEMBER(superqix_state::pbillian_sh_start)
112112{
113   superqix_state *state = device.machine().driver_data<superqix_state>();
114   running_machine &machine = device.machine();
115   UINT8 *src = state->memregion("samples")->base();
116   int i, len = state->memregion("samples")->bytes();
113   UINT8 *src = memregion("samples")->base();
114   int i, len = memregion("samples")->bytes();
117115
118116   /* convert 8-bit unsigned samples to 8-bit signed */
119   state->m_samplebuf = auto_alloc_array(machine, INT16, len);
117   m_samplebuf = auto_alloc_array(machine(), INT16, len);
120118   for (i = 0;i < len;i++)
121      state->m_samplebuf[i] = (INT8)(src[i] ^ 0x80) * 256;
119      m_samplebuf[i] = (INT8)(src[i] ^ 0x80) * 256;
122120}
123121
124122WRITE8_MEMBER(superqix_state::pbillian_sample_trigger_w)
r31905r31906
908906GFXDECODE_END
909907
910908
911
912static const samples_interface pbillian_samples_interface =
913{
914   1,
915   NULL,
916   pbillian_sh_start
917};
918
919909INTERRUPT_GEN_MEMBER(superqix_state::vblank_irq)
920910{
921911   if(m_nmi_mask)
r31905r31906
960950   MCFG_AY8910_PORT_B_READ_CB(IOPORT("SYSTEM"))
961951   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
962952
963   MCFG_SAMPLES_ADD("samples", pbillian_samples_interface)
953   MCFG_SOUND_ADD("samples", SAMPLES, 0)
954   MCFG_SAMPLES_CHANNELS(1)
955   MCFG_SAMPLES_START_CB(superqix_state, pbillian_sh_start)
964956   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
965957MACHINE_CONFIG_END
966958
r31905r31906
997989   MCFG_AY8910_PORT_B_READ_CB(IOPORT("SYSTEM"))
998990   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
999991
1000   MCFG_SAMPLES_ADD("samples", pbillian_samples_interface)
992   MCFG_SOUND_ADD("samples", SAMPLES, 0)
993   MCFG_SAMPLES_CHANNELS(1)
994   MCFG_SAMPLES_START_CB(superqix_state, pbillian_sh_start)
1001995   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
1002996MACHINE_CONFIG_END
1003997
trunk/src/mame/drivers/astinvad.c
r31905r31906
618618   0
619619};
620620
621static const samples_interface astinvad_samples_interface =
622{
623   6,   /* channels */
624   astinvad_sample_names
625};
626621
627
628
629622/*************************************
630623 *
631624 *  Machine drivers
r31905r31906
659652   /* sound hardware */
660653   MCFG_SPEAKER_STANDARD_MONO("mono")
661654
662   MCFG_SAMPLES_ADD("samples", astinvad_samples_interface)
655   MCFG_SOUND_ADD("samples", SAMPLES, 0)
656   MCFG_SAMPLES_CHANNELS(6)
657   MCFG_SAMPLES_NAMES(astinvad_sample_names)
663658   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
664659MACHINE_CONFIG_END
665660
r31905r31906
701696   /* sound hardware */
702697   MCFG_SPEAKER_STANDARD_MONO("mono")
703698
704   MCFG_SAMPLES_ADD("samples", astinvad_samples_interface)
699   MCFG_SOUND_ADD("samples", SAMPLES, 0)
700   MCFG_SAMPLES_CHANNELS(6)
701   MCFG_SAMPLES_NAMES(astinvad_sample_names)
705702   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
706703MACHINE_CONFIG_END
707704
trunk/src/mame/drivers/homerun.c
r31905r31906
286286   0
287287};
288288
289static const samples_interface homerun_samples_interface =
290{
291   1,
292   homerun_sample_names
293};
294
295289/**************************************************************************/
296290
297291static const gfx_layout gfxlayout =
r31905r31906
388382   MCFG_SOUND_ADD("d7756", UPD7756, UPD7759_STANDARD_CLOCK)
389383   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
390384
391   MCFG_SAMPLES_ADD("samples", homerun_samples_interface)
385   MCFG_SOUND_ADD("samples", SAMPLES, 0)
386   MCFG_SAMPLES_CHANNELS(1)
387   MCFG_SAMPLES_NAMES(homerun_sample_names)
392388   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
393389MACHINE_CONFIG_END
394390
trunk/src/mame/drivers/tmnt.c
r31905r31906
221221   return m_upd7759->busy_r() ? 1 : 0;
222222}
223223
224
225static SAMPLES_START( tmnt_decode_sample )
224SAMPLES_START_CB_MEMBER(tmnt_state::tmnt_decode_sample)
226225{
227   running_machine &machine = device.machine();
228   tmnt_state *state = machine.driver_data<tmnt_state>();
229226   int i;
230   UINT8 *source = state->memregion("title")->base();
227   UINT8 *source = memregion("title")->base();
231228
232   state->save_item(NAME(state->m_sampledata));
229   save_item(NAME(m_sampledata));
233230
234231   /*  Sound sample for TMNT.D05 is stored in the following mode (ym3012 format):
235232    *
r31905r31906
249246
250247      val <<= (expo - 3);
251248
252      state->m_sampledata[i] = val;
249      m_sampledata[i] = val;
253250   }
254251}
255252
r31905r31906
19501947   m_k007232->set_volume(1, 0, (data & 0x0f) * 0x11);
19511948}
19521949
1953static const samples_interface tmnt_samples_interface =
1954{
1955   1,  /* 1 channel for the title music */
1956   NULL,
1957   tmnt_decode_sample
1958};
1959
19601950MACHINE_START_MEMBER(tmnt_state,common)
19611951{
19621952   save_item(NAME(m_toggle));
r31905r31906
21432133   MCFG_SOUND_ADD("upd", UPD7759, XTAL_640kHz)
21442134   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
21452135
2146   MCFG_SAMPLES_ADD("samples", tmnt_samples_interface)
2136   MCFG_SOUND_ADD("samples", SAMPLES, 0)
2137   MCFG_SAMPLES_CHANNELS(1) /* 1 channel for the title music */
2138   MCFG_SAMPLES_START_CB(tmnt_state, tmnt_decode_sample)
21472139   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
21482140MACHINE_CONFIG_END
21492141
trunk/src/mame/drivers/rotaryf.c
r31905r31906
8686};
8787
8888
89static const samples_interface rotaryf_samples_interface =
90{
91   6,  /* 6 channels */
92   rotaryf_sample_names
93};
94
9589READ8_MEMBER( rotaryf_state::port29_r )
9690{
9791   UINT8 data = ioport("INPUTS")->read();
r31905r31906
278272   MCFG_SOUND_ADD("snsnd", SN76477, 0)
279273   MCFG_SOUND_CONFIG(rotaryf_sn76477_interface)
280274   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
281   MCFG_SAMPLES_ADD("samples", rotaryf_samples_interface)
275   MCFG_SOUND_ADD("samples", SAMPLES, 0)
276   MCFG_SAMPLES_CHANNELS(6)
277   MCFG_SAMPLES_NAMES(rotaryf_sample_names)
282278   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
283279MACHINE_CONFIG_END
284280
trunk/src/mame/drivers/suna8.c
r31905r31906
18021802
18031803/* 1 x 24 MHz crystal */
18041804
1805static const samples_interface suna8_samples_interface =
1806{
1807   1,
1808   NULL,
1809   suna8_sh_start
1810};
18111805
18121806static MACHINE_CONFIG_START( hardhead, suna8_state )
18131807
r31905r31906
18511845   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30)
18521846   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30)
18531847
1854   MCFG_SAMPLES_ADD("samples", suna8_samples_interface)
1848   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1849   MCFG_SAMPLES_CHANNELS(1)
1850   MCFG_SAMPLES_START_CB(suna8_state, sh_start)
18551851   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50)
18561852   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50)
18571853MACHINE_CONFIG_END
r31905r31906
19061902   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.90)
19071903   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.90)
19081904
1909   MCFG_SAMPLES_ADD("samples", suna8_samples_interface)
1905   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1906   MCFG_SAMPLES_CHANNELS(1)
1907   MCFG_SAMPLES_START_CB(suna8_state, sh_start)
19101908   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50)
19111909   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50)
19121910MACHINE_CONFIG_END
r31905r31906
20662064   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50)
20672065   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50)
20682066
2069   MCFG_SAMPLES_ADD("samples", suna8_samples_interface)
2067   MCFG_SOUND_ADD("samples", SAMPLES, 0)
2068   MCFG_SAMPLES_CHANNELS(1)
2069   MCFG_SAMPLES_START_CB(suna8_state, sh_start)
20702070   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50)
20712071   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50)
20722072MACHINE_CONFIG_END
r31905r31906
21172117   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30)
21182118   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30)
21192119
2120   MCFG_SAMPLES_ADD("samples", suna8_samples_interface)
2120   MCFG_SOUND_ADD("samples", SAMPLES, 0)
2121   MCFG_SAMPLES_CHANNELS(1)
2122   MCFG_SAMPLES_START_CB(suna8_state, sh_start)
21212123   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50)
21222124   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50)
21232125MACHINE_CONFIG_END
trunk/src/mame/drivers/tnzs.c
r31905r31906
629629#include "includes/tnzs.h"
630630#include "sound/2151intf.h"
631631
632static SAMPLES_START( kageki_init_samples )
632SAMPLES_START_CB_MEMBER(tnzs_state::kageki_init_samples)
633633{
634   running_machine &machine = device.machine();
635   tnzs_state *state = machine.driver_data<tnzs_state>();
636634   UINT8 *scan, *src;
637635   INT16 *dest;
638636   int start, size;
639637   int i, n;
640638
641   src = state->memregion("samples")->base() + 0x0090;
639   src = memregion("samples")->base() + 0x0090;
642640   for (i = 0; i < MAX_SAMPLES; i++)
643641   {
644642      start = (src[(i * 2) + 1] * 256) + src[(i * 2)];
r31905r31906
655653      }
656654
657655      /* 2009-11 FP: should these be saved? */
658      state->m_sampledata[i] = auto_alloc_array(machine, INT16, size);
659      state->m_samplesize[i] = size;
656      m_sampledata[i] = auto_alloc_array(machine(), INT16, size);
657      m_samplesize[i] = size;
660658
661659
662660      if (start < 0x100)
663661         start = size = 0;
664662
665663      // signed 8-bit sample to unsigned 8-bit sample convert
666      dest = state->m_sampledata[i];
664      dest = m_sampledata[i];
667665      scan = &src[start];
668666      for (n = 0; n < size; n++)
669667      {
r31905r31906
15331531   m_audiocpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE);
15341532}
15351533
1536static const samples_interface tnzs_samples_interface =
1537{
1538   1,
1539   NULL,
1540   kageki_init_samples
1541};
1542
15431534static MACHINE_CONFIG_START( arknoid2, tnzs_state )
15441535
15451536   /* basic machine hardware */
r31905r31906
17671758   MCFG_SOUND_ROUTE(2, "mono", 0.15)
17681759   MCFG_SOUND_ROUTE(3, "mono", 0.35)
17691760
1770   MCFG_SAMPLES_ADD("samples", tnzs_samples_interface)
1761   MCFG_SOUND_ADD("samples", SAMPLES, 0)
1762   MCFG_SAMPLES_CHANNELS(1)
1763   MCFG_SAMPLES_START_CB(tnzs_state, kageki_init_samples)
17711764   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
17721765MACHINE_CONFIG_END
17731766
trunk/src/mame/drivers/m63.c
r31905r31906
181181   DECLARE_READ8_MEMBER(irq_r);
182182   DECLARE_READ8_MEMBER(snddata_r);
183183   DECLARE_WRITE8_MEMBER(fghtbskt_samples_w);
184   SAMPLES_START_CB_MEMBER(fghtbskt_sh_start);
184185   DECLARE_WRITE8_MEMBER(nmi_mask_w);
185186   DECLARE_DRIVER_INIT(wilytowr);
186187   DECLARE_DRIVER_INIT(fghtbskt);
r31905r31906
696697GFXDECODE_END
697698
698699
699static SAMPLES_START( fghtbskt_sh_start )
700SAMPLES_START_CB_MEMBER(m63_state::fghtbskt_sh_start)
700701{
701   running_machine &machine = device.machine();
702   m63_state *state = machine.driver_data<m63_state>();
703   int i, len = state->memregion("samples")->bytes();
704   UINT8 *ROM = state->memregion("samples")->base();
702   int i, len = memregion("samples")->bytes();
703   UINT8 *ROM = memregion("samples")->base();
705704
706   state->m_samplebuf = auto_alloc_array(machine, INT16, len);
707   state->save_pointer(NAME(state->m_samplebuf), len);
705   m_samplebuf = auto_alloc_array(machine(), INT16, len);
706   save_pointer(NAME(m_samplebuf), len);
708707
709708   for(i = 0; i < len; i++)
710      state->m_samplebuf[i] = ((INT8)(ROM[i] ^ 0x80)) * 256;
709      m_samplebuf[i] = ((INT8)(ROM[i] ^ 0x80)) * 256;
711710}
712711
713static const samples_interface fghtbskt_samples_interface =
714{
715   1,
716   NULL,
717   fghtbskt_sh_start
718};
719
720712INTERRUPT_GEN_MEMBER(m63_state::snd_irq)
721713{
722714   m_sound_irq = 1;
r31905r31906
831823   MCFG_SOUND_ADD("ay1", AY8910, XTAL_12MHz/8)
832824   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
833825
834   MCFG_SAMPLES_ADD("samples", fghtbskt_samples_interface)
826   MCFG_SOUND_ADD("samples", SAMPLES, 0)
827   MCFG_SAMPLES_CHANNELS(1)
828   MCFG_SAMPLES_START_CB(m63_state, fghtbskt_sh_start)
835829   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
836830MACHINE_CONFIG_END
837831

Previous 199869 Revisions Next


© 1997-2024 The MAME Team