Previous 15994 Revisions Next

r8295 Saturday 19th June, 2010 at 11:35:00 UTC by Robbbert
Fixed bad cassette wave sound, been there since at 0.132
[src/emu/sound]wave.c

src/emu/sound/wave.c
r8294r8295
66    Functions to handle loading, creation, recording and playback
77    of wave samples for IO_CASSETTE
88
9    2010-06-19 - Found that since 0.132, the right channel is badly out of
10    sync on a mono system, causing bad sound. Added code to disable
11    the second channel on a mono system.
12
13
914****************************************************************************/
1015
1116#include "emu.h"
r8294r8295
2328{
2429#ifdef MESS
2530   running_device *image = (running_device *)param;
31   int speakers = speaker_output_count(image->machine->config);
2632   cassette_image *cassette;
2733   cassette_state state;
2834   double time_index;
r8294r8295
4248      duration = ((double) samples) / image->machine->sample_rate;
4349
4450      cassette_get_samples(cassette, 0, time_index, duration, samples, 2, left_buffer, CASSETTE_WAVEFORM_16BIT);
45      cassette_get_samples(cassette, 1, time_index, duration, samples, 2, right_buffer, CASSETTE_WAVEFORM_16BIT);
51      if (speakers > 1)
52         cassette_get_samples(cassette, 1, time_index, duration, samples, 2, right_buffer, CASSETTE_WAVEFORM_16BIT);
4653
4754      for (i = samples - 1; i >= 0; i--)
4855      {
4956         left_buffer[i] = ((INT16 *) left_buffer)[i];
50         right_buffer[i] = ((INT16 *) right_buffer)[i];
57         if (speakers > 1)
58            right_buffer[i] = ((INT16 *) right_buffer)[i];
5159      }
5260   }
5361   else
5462   {
5563      memset(left_buffer, 0, sizeof(*left_buffer) * samples);
56      memset(right_buffer, 0, sizeof(*right_buffer) * samples);
64      if (speakers > 1)
65         memset(right_buffer, 0, sizeof(*right_buffer) * samples);
5766   }
5867#endif
5968}
r8294r8295
6675
6776   assert( device != NULL );
6877   assert( device->baseconfig().static_config != NULL );
69
78   int speakers = speaker_output_count(device->machine->config);
7079#ifdef MESS
7180   image = device->machine->device( (const char *)device->baseconfig().static_config );
7281#endif
73   stream_create(device, 0, 2, device->machine->sample_rate, (void *)image, wave_sound_update);
82   if (speakers > 1)
83      stream_create(device, 0, 2, device->machine->sample_rate, (void *)image, wave_sound_update);
84   else
85      stream_create(device, 0, 1, device->machine->sample_rate, (void *)image, wave_sound_update);
7486}
7587
7688

Previous 15994 Revisions Next


© 1998-2018 The MESS Team