Previous 15994 Revisions Next

r5879 Thursday 24th September, 2009 at 13:07:57 UTC by Miodrag Milanović
[B2M] Moved custom sound to using speaker.
[src/mess/drivers]b2m.c
[src/mess/includes]b2m.h
[src/mess/machine]b2m.c

src/mess/includes/b2m.h
r5878r5879
1010#include "machine/i8255a.h"
1111#include "machine/pit8253.h"
1212#include "machine/pic8259.h"
13#include "sound/speaker.h"
14#include "sound/wave.h"
1315
1416/*----------- defined in machine/b2m.c -----------*/
1517
r5878r5879
3335extern READ8_HANDLER( b2m_localmachine_r );
3436extern WRITE8_HANDLER( b2m_localmachine_w );
3537
36#define SOUND_B2M      DEVICE_GET_INFO_NAME( b2m_sound )
37
38DEVICE_GET_INFO( b2m_sound );
39
40
4138/*----------- defined in video/b2m.c -----------*/
4239
4340extern VIDEO_START( b2m );
src/mess/machine/b2m.c
r5878r5879
1515#include "machine/wd17xx.h"
1616#include "machine/pic8259.h"
1717#include "machine/msm8251.h"
18#include "streams.h"
1918#include "includes/b2m.h"
2019
2120static int b2m_8255_porta;
r5878r5879
3231static UINT8 b2m_color[4];
3332static UINT8 b2m_localmachine;
3433
35static int   b2m_sound_input;
36static sound_stream *mixer_channel;
3734
38
3935static READ8_HANDLER (b2m_keyboard_r )
4036{     
4137   UINT8 key = 0x00;
r5878r5879
164160
165161
166162static PIT8253_OUTPUT_CHANGED(bm2_pit_out1)
167{
168   if (mixer_channel!=NULL) {
169      stream_update( mixer_channel );
170   }
171   b2m_sound_input = state;
163{   
164   const device_config *speaker = devtag_get_device(device->machine, "speaker");
165   
166   speaker_level_w(speaker, state);
167
172168}
173169
174170static PIT8253_OUTPUT_CHANGED(bm2_pit_out2)
r5878r5879
350346
351347MACHINE_RESET(b2m)
352348{   
353   b2m_sound_input = 0;
354     
355349   b2m_side = 0;
356350   b2m_drive = 0;
357351
358352   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), b2m_irq_callback);
359353   b2m_set_bank(machine, 7);
360354}
361
362static STREAM_UPDATE( b2m_sh_update )
363{
364   INT16 channel_1_signal;
365
366   stream_sample_t *sample_left = outputs[0];
367
368   channel_1_signal = b2m_sound_input ? 3000 : -3000;
369
370   while (samples--)
371   {
372      *sample_left = channel_1_signal;     
373      sample_left++;
374   }
375}
376
377static DEVICE_START(b2m_sound)
378{
379   b2m_sound_input = 0;
380   mixer_channel = stream_create(device, 0, 1, device->machine->sample_rate, 0, b2m_sh_update);
381}
382
383
384DEVICE_GET_INFO( b2m_sound )
385{
386   switch (state)
387   {
388      /* --- the following bits of info are returned as pointers to data or functions --- */
389      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(b2m_sound);   break;
390
391      /* --- the following bits of info are returned as NULL-terminated strings --- */
392      case DEVINFO_STR_NAME:                     strcpy(info->s, "B2M Custom");            break;
393      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                  break;
394   }
395}
src/mess/drivers/b2m.c
r5878r5879
227227   
228228   /* sound */
229229    MDRV_SPEAKER_STANDARD_MONO("mono")
230   MDRV_SOUND_ADD("custom", B2M, 0)
230   MDRV_SOUND_ADD("speaker", SPEAKER, 0)   
231231   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)   
232232
233233   /* uart */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team