Previous 199869 Revisions Next

r31051 Friday 20th June, 2014 at 18:48:05 UTC by Wilbert Pol
Styling, no functional changes (nw)
[src/mess/audio]wswan.c

trunk/src/mess/audio/wswan.c
r31050r31051
141141   {
142142      left = right = 0;
143143
144      if ( m_audio1.on ) {
144      if ( m_audio1.on )
145      {
145146         sample = m_audio1.signal;
146147         m_audio1.pos++;
147         if ( m_audio1.pos >= m_audio1.period / 2 ) {
148         if ( m_audio1.pos >= m_audio1.period / 2 )
149         {
148150            m_audio1.pos = 0;
149151            m_audio1.signal = -m_audio1.signal;
150152         }
r31050r31051
152154         right += m_audio1.vol_right * sample;
153155      }
154156
155      if ( m_audio2.on ) {
156         if ( m_audio2_voice ) {
157      if ( m_audio2.on )
158      {
159         if ( m_audio2_voice )
160         {
157161            left += (m_voice_data - 128)*(m_master_volume & 0x0f);
158162            right += (m_voice_data - 128)*(m_master_volume & 0x0f);
159         } else {
163         }
164         else
165         {
160166            sample = m_audio2.signal;
161167            m_audio2.pos++;
162            if ( m_audio2.pos >= m_audio2.period / 2 ) {
168            if ( m_audio2.pos >= m_audio2.period / 2 )
169            {
163170               m_audio2.pos = 0;
164171               m_audio2.signal = -m_audio2.signal;
165172            }
r31050r31051
168175         }
169176      }
170177
171      if ( m_audio3.on ) {
178      if ( m_audio3.on )
179      {
172180         sample = m_audio3.signal;
173181         m_audio3.pos++;
174         if ( m_audio3.pos >= m_audio3.period / 2 ) {
182         if ( m_audio3.pos >= m_audio3.period / 2 )
183         {
175184            m_audio3.pos = 0;
176185            m_audio3.signal = -m_audio3.signal;
177186         }
178         if ( m_audio3_sweep && m_sweep_time ) {
187         if ( m_audio3_sweep && m_sweep_time )
188         {
179189            m_sweep_count++;
180            if ( m_sweep_count >= m_sweep_time ) {
190            if ( m_sweep_count >= m_sweep_time )
191            {
181192               m_sweep_count = 0;
182193               m_audio3.freq += m_sweep_step;
183194               m_audio3.period = machine().sample_rate() / (3072000  / ((2048 - (m_audio3.freq & 0x7ff)) << 5));
r31050r31051
187198         right += m_audio3.vol_right * sample;
188199      }
189200
190      if ( m_audio4.on ) {
191         if ( m_audio4_noise ) {
201      if ( m_audio4.on )
202      {
203         if ( m_audio4_noise )
204         {
192205            sample = 0;
193         } else {
206         }
207         else
208         {
194209            sample = m_audio4.signal;
195210            m_audio4.pos++;
196            if ( m_audio4.pos >= m_audio4.period / 2 ) {
211            if ( m_audio4.pos >= m_audio4.period / 2 )
212            {
197213               m_audio4.pos = 0;
198214               m_audio4.signal = -m_audio4.signal;
199215            }
r31050r31051
222238{
223239   m_channel->update();
224240
225   switch( offset ) {
226   case 0x80:              /* Audio 1 freq (lo) */
227      wswan_ch_set_freq(&m_audio1, (m_audio1.freq & 0xff00) | data);
228      break;
229   case 0x81:              /* Audio 1 freq (hi) */
230      wswan_ch_set_freq(&m_audio1, (data << 8 ) | (m_audio1.freq & 0x00ff));
231      break;
232   case 0x82:              /* Audio 2 freq (lo) */
233      wswan_ch_set_freq(&m_audio2, (m_audio2.freq & 0xff00) | data);
234      break;
235   case 0x83:              /* Audio 2 freq (hi) */
236      wswan_ch_set_freq(&m_audio2, (data << 8 ) | (m_audio2.freq & 0x00ff));
237      break;
238   case 0x84:              /* Audio 3 freq (lo) */
239      wswan_ch_set_freq(&m_audio3, (m_audio3.freq & 0xff00) | data);
240      break;
241   case 0x85:              /* Audio 3 freq (hi) */
242      wswan_ch_set_freq(&m_audio3, (data << 8) | (m_audio3.freq & 0x00ff));
243      break;
244   case 0x86:              /* Audio 4 freq (lo) */
245      wswan_ch_set_freq(&m_audio4, (m_audio4.freq & 0xff00) | data);
246      break;
247   case 0x87:              /* Audio 4 freq (hi) */
248      wswan_ch_set_freq(&m_audio4, (data << 8) | (m_audio4.freq & 0x00ff));
249      break;
250   case 0x88:              /* Audio 1 volume */
251      m_audio1.vol_left = ( data & 0xF0 ) >> 4;
252      m_audio1.vol_right = data & 0x0F;
253      break;
254   case 0x89:              /* Audio 2 volume */
255      m_voice_data = data;
256      m_audio2.vol_left = ( data & 0xF0 ) >> 4;
257      m_audio2.vol_right = data & 0x0F;
258      break;
259   case 0x8A:              /* Audio 3 volume */
260      m_audio3.vol_left = ( data & 0xF0 ) >> 4;
261      m_audio3.vol_right = data & 0x0F;
262      break;
263   case 0x8B:              /* Audio 4 volume */
264      m_audio4.vol_left = ( data & 0xF0 ) >> 4;
265      m_audio4.vol_right = data & 0x0F;
266      break;
267   case 0x8C:              /* Sweep step */
268      m_sweep_step = (INT8)data;
269      break;
270   case 0x8D:              /* Sweep time */
271      m_sweep_time = space.machine().sample_rate() / ( 3072000 / ( 8192 * (data + 1) ) );
272      break;
273   case 0x8E:              /* Noise control */
274      m_noise_type = data & 0x07;
275      m_noise_reset = ( data & 0x08 ) >> 3;
276      m_noise_enable = ( data & 0x10 ) >> 4;
277      break;
278   case 0x8F:              /* Sample location */
279      m_sample_address = data << 6;
280      break;
281   case 0x90:              /* Audio control */
282      m_audio1.on = data & 0x01;
283      m_audio2.on = ( data & 0x02 ) >> 1;
284      m_audio3.on = ( data & 0x04 ) >> 2;
285      m_audio4.on = ( data & 0x08 ) >> 3;
286      m_audio2_voice = ( data & 0x20 ) >> 5;
287      m_audio3_sweep = ( data & 0x40 ) >> 6;
288      m_audio4_noise = ( data & 0x80 ) >> 7;
289      break;
290   case 0x91:              /* Audio output */
291      m_mono = data & 0x01;
292      m_output_volume = ( data & 0x06 ) >> 1;
293      m_external_stereo = ( data & 0x08 ) >> 3;
294      m_external_speaker = 1;
295      break;
296   case 0x92:              /* Noise counter shift register (lo) */
297      m_noise_shift = ( m_noise_shift & 0xFF00 ) | data;
298      break;
299   case 0x93:              /* Noise counter shift register (hi) */
300      m_noise_shift = ( data << 8 ) | ( m_noise_shift & 0x00FF );
301      break;
302   case 0x94:              /* Master volume */
303      m_master_volume = data;
304      break;
241   switch( offset )
242   {
243      case 0x80:              /* Audio 1 freq (lo) */
244         wswan_ch_set_freq(&m_audio1, (m_audio1.freq & 0xff00) | data);
245         break;
246
247      case 0x81:              /* Audio 1 freq (hi) */
248         wswan_ch_set_freq(&m_audio1, (data << 8 ) | (m_audio1.freq & 0x00ff));
249         break;
250
251      case 0x82:              /* Audio 2 freq (lo) */
252         wswan_ch_set_freq(&m_audio2, (m_audio2.freq & 0xff00) | data);
253         break;
254
255      case 0x83:              /* Audio 2 freq (hi) */
256         wswan_ch_set_freq(&m_audio2, (data << 8 ) | (m_audio2.freq & 0x00ff));
257         break;
258
259      case 0x84:              /* Audio 3 freq (lo) */
260         wswan_ch_set_freq(&m_audio3, (m_audio3.freq & 0xff00) | data);
261         break;
262
263      case 0x85:              /* Audio 3 freq (hi) */
264         wswan_ch_set_freq(&m_audio3, (data << 8) | (m_audio3.freq & 0x00ff));
265         break;
266
267      case 0x86:              /* Audio 4 freq (lo) */
268         wswan_ch_set_freq(&m_audio4, (m_audio4.freq & 0xff00) | data);
269         break;
270
271      case 0x87:              /* Audio 4 freq (hi) */
272         wswan_ch_set_freq(&m_audio4, (data << 8) | (m_audio4.freq & 0x00ff));
273         break;
274
275      case 0x88:              /* Audio 1 volume */
276         m_audio1.vol_left = ( data & 0xF0 ) >> 4;
277         m_audio1.vol_right = data & 0x0F;
278         break;
279
280      case 0x89:              /* Audio 2 volume */
281         m_voice_data = data;
282         m_audio2.vol_left = ( data & 0xF0 ) >> 4;
283         m_audio2.vol_right = data & 0x0F;
284         break;
285
286      case 0x8A:              /* Audio 3 volume */
287         m_audio3.vol_left = ( data & 0xF0 ) >> 4;
288         m_audio3.vol_right = data & 0x0F;
289         break;
290
291      case 0x8B:              /* Audio 4 volume */
292         m_audio4.vol_left = ( data & 0xF0 ) >> 4;
293         m_audio4.vol_right = data & 0x0F;
294         break;
295
296      case 0x8C:              /* Sweep step */
297         m_sweep_step = (INT8)data;
298         break;
299
300      case 0x8D:              /* Sweep time */
301         m_sweep_time = space.machine().sample_rate() / ( 3072000 / ( 8192 * (data + 1) ) );
302         break;
303
304      case 0x8E:              /* Noise control */
305         m_noise_type = data & 0x07;
306         m_noise_reset = ( data & 0x08 ) >> 3;
307         m_noise_enable = ( data & 0x10 ) >> 4;
308         break;
309
310      case 0x8F:              /* Sample location */
311         m_sample_address = data << 6;
312         break;
313
314      case 0x90:              /* Audio control */
315         m_audio1.on = data & 0x01;
316         m_audio2.on = ( data & 0x02 ) >> 1;
317         m_audio3.on = ( data & 0x04 ) >> 2;
318         m_audio4.on = ( data & 0x08 ) >> 3;
319         m_audio2_voice = ( data & 0x20 ) >> 5;
320         m_audio3_sweep = ( data & 0x40 ) >> 6;
321         m_audio4_noise = ( data & 0x80 ) >> 7;
322         break;
323
324      case 0x91:              /* Audio output */
325         m_mono = data & 0x01;
326         m_output_volume = ( data & 0x06 ) >> 1;
327         m_external_stereo = ( data & 0x08 ) >> 3;
328         m_external_speaker = 1;
329         break;
330
331      case 0x92:              /* Noise counter shift register (lo) */
332         m_noise_shift = ( m_noise_shift & 0xFF00 ) | data;
333         break;
334
335      case 0x93:              /* Noise counter shift register (hi) */
336         m_noise_shift = ( data << 8 ) | ( m_noise_shift & 0x00FF );
337         break;
338
339      case 0x94:              /* Master volume */
340         m_master_volume = data;
341         break;
305342   }
306343}

Previous 199869 Revisions Next


© 1997-2024 The MAME Team