Previous 15994 Revisions Next

r2108 Tuesday 25th March, 2008 at 20:42:31 UTC by Justin Kerk
More messnew.txt & eol-style updates
[docs]messnew.txt
[src/mess/audio]special.c

src/mess/audio/special.c
r2107r2108
1/***************************************************************************
2 
3  audio/special.c
4 
5  Functions to emulate sound hardware of Specialist MX
6  ( based on code of DAI interface )
7 
8****************************************************************************/
9 
10#include "driver.h"
11#include "sound/custom.h"
12#include "machine/pit8253.h"
13#include "includes/dai.h"
14#include "streams.h"
15#include "deprecat.h"
16 
17static void *specimx_sh_start(int clock, const struct CustomSound_interface *config);
18static void specimx_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length);
19 
20static sound_stream *mixer_channel;
21 
22const struct CustomSound_interface specimx_sound_interface =
23{
24   specimx_sh_start,
25   NULL,
26   NULL
27};
28 
29static void *specimx_sh_start(int clock, const struct CustomSound_interface *config)
30{
31   mixer_channel = stream_create(0, 2, Machine->sample_rate, 0, specimx_sh_update);
32   return (void *) ~0;
33}
34 
35static void specimx_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **buffer,int length)
36{
37   INT16 channel_0_signal;
38   INT16 channel_1_signal;
39   INT16 channel_2_signal;
40   static int channel_0_incr = 0;
41   static int channel_1_incr = 0;
42   static int channel_2_incr = 0;
43   int channel_0_baseclock;
44   int channel_1_baseclock;
45   int channel_2_baseclock;
46 
47   int rate = Machine->sample_rate / 2;
48 
49   stream_sample_t *sample_left = buffer[0];
50   stream_sample_t *sample_right = buffer[1];
51 
52   channel_0_baseclock = pit8253_get_frequency(0, 0);
53   channel_1_baseclock = pit8253_get_frequency(0, 1);
54   channel_2_baseclock = pit8253_get_frequency(0, 2);
55 
56   channel_0_signal = pit8253_get_output (0,0) ? 3000 : -3000;
57   channel_1_signal = pit8253_get_output (0,1) ? 3000 : -3000;
58   channel_2_signal = pit8253_get_output (0,2) ? 3000 : -3000;
59 
60 
61   while (length--)
62   {
63      *sample_left = 0;
64      *sample_right = 0;
65 
66      /* music channel 0 */
67 
68      *sample_left += channel_0_signal;
69      channel_0_incr -= channel_0_baseclock;
70      while( channel_0_incr < 0 )
71      {
72         channel_0_incr += rate;
73         channel_0_signal = -channel_0_signal;
74      }
75 
76 
77      /* music channel 1 */
78 
79      *sample_left += channel_1_signal;
80      channel_1_incr -= channel_1_baseclock;
81      while( channel_1_incr < 0 )
82      {
83         channel_1_incr += rate;
84         channel_1_signal = -channel_1_signal;
85      }
86 
87      /* music channel 2 */
88 
89      *sample_left += channel_2_signal;
90      channel_2_incr -= channel_2_baseclock;
91      while( channel_2_incr < 0 )
92      {
93         channel_2_incr += rate;
94         channel_2_signal = -channel_2_signal;
95      }
96       
97      sample_left++;
98      sample_right++;
99   }
100}
101 
102void specimx_sh_change_clock(double clock)
103{
104   stream_update(mixer_channel);
105}
1/***************************************************************************
2
3  audio/special.c
4
5  Functions to emulate sound hardware of Specialist MX
6  ( based on code of DAI interface )
7
8****************************************************************************/
9
10#include "driver.h"
11#include "sound/custom.h"
12#include "machine/pit8253.h"
13#include "includes/dai.h"
14#include "streams.h"
15#include "deprecat.h"
16
17static void *specimx_sh_start(int clock, const struct CustomSound_interface *config);
18static void specimx_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length);
19
20static sound_stream *mixer_channel;
21
22const struct CustomSound_interface specimx_sound_interface =
23{
24   specimx_sh_start,
25   NULL,
26   NULL
27};
28
29static void *specimx_sh_start(int clock, const struct CustomSound_interface *config)
30{
31   mixer_channel = stream_create(0, 2, Machine->sample_rate, 0, specimx_sh_update);
32   return (void *) ~0;
33}
34
35static void specimx_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **buffer,int length)
36{
37   INT16 channel_0_signal;
38   INT16 channel_1_signal;
39   INT16 channel_2_signal;
40   static int channel_0_incr = 0;
41   static int channel_1_incr = 0;
42   static int channel_2_incr = 0;
43   int channel_0_baseclock;
44   int channel_1_baseclock;
45   int channel_2_baseclock;
46
47   int rate = Machine->sample_rate / 2;
48
49   stream_sample_t *sample_left = buffer[0];
50   stream_sample_t *sample_right = buffer[1];
51
52   channel_0_baseclock = pit8253_get_frequency(0, 0);
53   channel_1_baseclock = pit8253_get_frequency(0, 1);
54   channel_2_baseclock = pit8253_get_frequency(0, 2);
55
56   channel_0_signal = pit8253_get_output (0,0) ? 3000 : -3000;
57   channel_1_signal = pit8253_get_output (0,1) ? 3000 : -3000;
58   channel_2_signal = pit8253_get_output (0,2) ? 3000 : -3000;
59
60
61   while (length--)
62   {
63      *sample_left = 0;
64      *sample_right = 0;
65
66      /* music channel 0 */
67
68      *sample_left += channel_0_signal;
69      channel_0_incr -= channel_0_baseclock;
70      while( channel_0_incr < 0 )
71      {
72         channel_0_incr += rate;
73         channel_0_signal = -channel_0_signal;
74      }
75
76
77      /* music channel 1 */
78
79      *sample_left += channel_1_signal;
80      channel_1_incr -= channel_1_baseclock;
81      while( channel_1_incr < 0 )
82      {
83         channel_1_incr += rate;
84         channel_1_signal = -channel_1_signal;
85      }
86
87      /* music channel 2 */
88
89      *sample_left += channel_2_signal;
90      channel_2_incr -= channel_2_baseclock;
91      while( channel_2_incr < 0 )
92      {
93         channel_2_incr += rate;
94         channel_2_signal = -channel_2_signal;
95      }
96     
97      sample_left++;
98      sample_right++;
99   }
100}
101
102void specimx_sh_change_clock(double clock)
103{
104   stream_update(mixer_channel);
105}
docs/messnew.txt
r2107r2108
3838 
3939- [COCO] Added a quickload for .BIN files.  [Nate Woods]
4040
41- [EP128] Fixed 0.119 regression in graphics display. (bug #1478)
42  [Wilbert Pol]
43
4144- [GALAXY] Fixed regressions.  [Miodrag Milanovic]
4245
4346- [GAMEBOY] Added support for Korean MBC1 mapper variant.  [Wilbert Pol]
4447
48- [LYNX] Always recompute timer settings when a timer register is being
49  written. Fixes 0.118 regression in Gates of Zendocon (bug #1435).
50  [Wilbert Pol]
51
4552- [MBEE] Fixed colours, sound, Inverse and Underline modes. Enabled alternate
4653  characters. [Robbbert]
4754
r2107r2108
8996
9097Source Changes:
9198----------------
92- The core is based on MAME 0.124.  This incorporates all features of the
99- The core is based on MAME 0.124a.  This incorporates all features of the
93100  update to this core.  [MAME team]
94101
95102- Updated the Motorola MC68901 Multi Function Peripheral to use the new

Previous 15994 Revisions Next


© 1998-2018 The MESS Team