Previous 15994 Revisions Next

r2945 Saturday 12th July, 2008 at 07:40:05 UTC by Wilbert Pol
Removed custom PC speaker implementation
[src/mess]mess.mak
[src/mess/audio]pc.c pc.h

src/mess/audio/pc.c
r2944r2945
1/***************************************************************************
2
3   audio/pc.c
4
5   Functions to emulate a PC PIC timer 2 used for simple tone generation
6
7   TODO:
8   Add support for the SN76496 used in the Tandy1000/PCjr
9   It most probably is on port 0xc0, but I'm not sure...
10
11****************************************************************************/
12
13#include "driver.h"
14#include "streams.h"
15#include "machine/pcshare.h"
16#include "machine/pit8253.h"
17#include "audio/pc.h"
18#include "deprecat.h"
19
20#define SND_LOG(n,m,a)
21#define BASECLOCK   1193180
22
23
24static void *pc_sh_custom_start(int clock, const struct CustomSound_interface *config);
25
26const struct CustomSound_interface pc_sound_interface =
27{
28   pc_sh_custom_start
29};
30
31static sound_stream *channel;
32static int speaker_gate = 0;
33static int input_state;
34
35
36
37/*************************************
38 *
39 *   Sound handler start
40 *
41 *************************************/
42
43static int pc_sh_start(void)
44{
45   logerror("pc_sh_start\n");
46   speaker_gate = 0;
47   input_state = 0;
48   channel = stream_create(0, 1, Machine->sample_rate, 0, pc_sh_update);
49    return 0;
50}
51
52
53
54static void *pc_sh_custom_start(int clock, const struct CustomSound_interface *config)
55{
56   pc_sh_start();
57   return (void *) ~0;
58}
59
60
61
62void pc_sh_speaker(running_machine *machine, int data)
63{
64   int mode = 0;
65
66   switch( data )
67   {
68      case 0: mode=0; break;
69      case 1: case 2: mode=1; break;
70      case 3: mode=2; break;
71   }
72
73   if( mode == speaker_gate )
74      return;
75
76    stream_update(channel);
77
78    switch( mode )
79   {
80      case 0: /* completely off */
81         SND_LOG(1,"PC_speaker",("off\n"));
82         speaker_gate = 0;
83            break;
84      case 1: /* completely on */
85         SND_LOG(1,"PC_speaker",("on\n"));
86         speaker_gate = 1;
87            break;
88      case 2: /* play the tone */
89         SND_LOG(1,"PC_speaker",("tone\n"));
90         speaker_gate = 2;
91            break;
92    }
93}
94
95
96void pc_sh_speaker_set_input(const device_config *device, int state)
97{
98   stream_update(channel);
99   input_state = state;
100}
101
102
103/*************************************
104 *
105 *   Sound handler update
106 *
107 *************************************/
108
109void pc_sh_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
110{
111   INT16 signal = input_state ? 0x7fff : -0x7fff;
112   stream_sample_t *buffer = outputs[0];
113   stream_sample_t *sample = buffer;
114
115   switch( speaker_gate ) {
116   case 0:
117      /* speaker off */
118      while( length-- > 0 )
119         *sample++ = 0;
120      break;
121
122   case 1:
123      /* speaker on */
124      while( length-- > 0 )
125         *sample++ = 0x7fff;
126      break;
127
128   case 2:
129      while( length-- > 0 )
130         *sample++ = signal;
131      break;
132   }
133}
134
src/mess/audio/pc.h
r2944r2945
1/***************************************************************************
2
3   audio/pc.h
4
5   Functions to emulate a PC PIC timer 2 used for simple tone generation
6
7   TODO:
8   Add support for the SN76496 used in the Tandy1000/PCjr
9   It most probably is on port 0xc0, but I'm not sure...
10
11****************************************************************************/
12
13#ifndef __AUDIO_PC_H__
14#define __AUDIO_PC_H__
15
16#include "driver.h"
17
18extern const struct CustomSound_interface pc_sound_interface;
19void pc_sh_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
20void pc_sh_speaker(running_machine *machine, int mode);
21
22void pc_sh_speaker_set_input(const device_config *device, int state);
23
24#endif /* __AUDIO_PC_H__ */
src/mess/mess.mak
r2944r2945
795795$(MESSOBJ)/pcshare.a:               \
796796   $(MAME_MACHINE)/pcshare.o   \
797797   $(MESS_MACHINE)/pc_turbo.o   \
798   $(MESS_AUDIO)/pc.o      \
799798   $(MESS_AUDIO)/sblaster.o   \
800799   $(MESS_MACHINE)/pc_fdc.o   \
801800   $(MESS_MACHINE)/pc_hdc.o   \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team