mirror of
https://github.com/holub/mame
synced 2025-06-02 10:59:52 +03:00
Converted the WAVE sound device to stereo (for MESS).
This commit is contained in:
parent
1067adb1a1
commit
91a7d9908b
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
#define ALWAYS_PLAY_SOUND 0
|
#define ALWAYS_PLAY_SOUND 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static STREAM_UPDATE( wave_sound_update )
|
static STREAM_UPDATE( wave_sound_update )
|
||||||
{
|
{
|
||||||
#ifdef MESS
|
#ifdef MESS
|
||||||
@ -29,26 +27,33 @@ static STREAM_UPDATE( wave_sound_update )
|
|||||||
cassette_state state;
|
cassette_state state;
|
||||||
double time_index;
|
double time_index;
|
||||||
double duration;
|
double duration;
|
||||||
stream_sample_t *buffer = outputs[0];
|
stream_sample_t *left_buffer = outputs[0];
|
||||||
|
stream_sample_t *right_buffer = outputs[1];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
state = cassette_get_state(image);
|
state = cassette_get_state(image);
|
||||||
|
|
||||||
state &= CASSETTE_MASK_UISTATE | CASSETTE_MASK_MOTOR | CASSETTE_MASK_SPEAKER;
|
state &= CASSETTE_MASK_UISTATE | CASSETTE_MASK_MOTOR | CASSETTE_MASK_SPEAKER;
|
||||||
|
|
||||||
if (image_exists(image) && (ALWAYS_PLAY_SOUND || (state == (CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED))))
|
if (image_exists(image) && (ALWAYS_PLAY_SOUND || (state == (CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED))))
|
||||||
{
|
{
|
||||||
cassette = cassette_get_image(image);
|
cassette = cassette_get_image(image);
|
||||||
time_index = cassette_get_position(image);
|
time_index = cassette_get_position(image);
|
||||||
duration = ((double) samples) / image->machine->sample_rate;
|
duration = ((double) samples) / image->machine->sample_rate;
|
||||||
|
|
||||||
cassette_get_samples(cassette, 0, time_index, duration, samples, 2, buffer, CASSETTE_WAVEFORM_16BIT);
|
cassette_get_samples(cassette, 0, time_index, duration, samples, 2, left_buffer, CASSETTE_WAVEFORM_16BIT);
|
||||||
|
cassette_get_samples(cassette, 1, time_index, duration, samples, 2, right_buffer, CASSETTE_WAVEFORM_16BIT);
|
||||||
|
|
||||||
for (i = samples-1; i >= 0; i--)
|
for (i = samples - 1; i >= 0; i--)
|
||||||
buffer[i] = ((INT16 *) buffer)[i];
|
{
|
||||||
|
left_buffer[i] = ((INT16 *) left_buffer)[i];
|
||||||
|
right_buffer[i] = ((INT16 *) right_buffer)[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memset(buffer, 0, sizeof(*buffer) * samples);
|
memset(left_buffer, 0, sizeof(*left_buffer) * samples);
|
||||||
|
memset(right_buffer, 0, sizeof(*right_buffer) * samples);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -65,7 +70,7 @@ static DEVICE_START( wave )
|
|||||||
#ifdef MESS
|
#ifdef MESS
|
||||||
image = devtag_get_device( device->machine, (const char *)device->static_config );
|
image = devtag_get_device( device->machine, (const char *)device->static_config );
|
||||||
#endif
|
#endif
|
||||||
stream_create(device, 0, 1, device->machine->sample_rate, (void *)image, wave_sound_update);
|
stream_create(device, 0, 2, device->machine->sample_rate, (void *)image, wave_sound_update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user