mirror of
https://github.com/libretro/nestopia.git
synced 2024-12-03 15:01:19 +00:00
Merge pull request #62 from keithbowes/mono-option
Added an option for mono output
This commit is contained in:
commit
d30c550522
@ -75,6 +75,11 @@ static enum {
|
||||
SHOW_CROSSHAIR_ON,
|
||||
} show_crosshair;
|
||||
|
||||
static enum {
|
||||
AUDIO_TYPE_MONO,
|
||||
AUDIO_TYPE_STEREO,
|
||||
} audio_type;
|
||||
|
||||
static bool libretro_supports_bitmasks = false;
|
||||
static bool show_advanced_av_settings = true;
|
||||
|
||||
@ -1207,7 +1212,20 @@ static void check_variables(void)
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||
{
|
||||
sound.SetVolume(Api::Sound::CHANNEL_S5B, atoi(var.value));
|
||||
}
|
||||
}
|
||||
|
||||
var.key = "nestopia_audio_type";
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
|
||||
{
|
||||
if (strcmp(var.value, "mono") == 0)
|
||||
{
|
||||
audio_type = AUDIO_TYPE_MONO;
|
||||
}
|
||||
else
|
||||
{
|
||||
audio_type = AUDIO_TYPE_STEREO;
|
||||
}
|
||||
}
|
||||
|
||||
/* "Show settings" are not required if categories are supported */
|
||||
option_display.visible = !libretro_supports_option_categories;
|
||||
@ -1264,8 +1282,10 @@ void retro_run(void)
|
||||
draw_crosshair(crossx, crossy);
|
||||
|
||||
unsigned frames = is_pal ? SAMPLERATE / 50 : SAMPLERATE / 60;
|
||||
for (unsigned i = 0; i < frames; i++)
|
||||
audio_stereo_buffer[(i << 1) + 0] = audio_stereo_buffer[(i << 1) + 1] = audio_buffer[i];
|
||||
for (unsigned i = 0; i < frames; i++) {
|
||||
audio_stereo_buffer[(i << 1) + 0] = audio_buffer[i];
|
||||
audio_stereo_buffer[(i << 1) + 1] = audio_type == AUDIO_TYPE_STEREO ? audio_buffer[i] : 0;
|
||||
}
|
||||
|
||||
bool updated = false;
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
|
||||
|
@ -509,6 +509,19 @@ struct retro_core_option_v2_definition option_defs_us[] = {
|
||||
},
|
||||
"100"
|
||||
},
|
||||
{
|
||||
"nestopia_audio_type",
|
||||
"Audio output",
|
||||
NULL,
|
||||
"Specify whether the audio output should be mono or stereo.",
|
||||
NULL,
|
||||
"audio",
|
||||
{
|
||||
{ "mono", NULL },
|
||||
{ "stereo", NULL },
|
||||
},
|
||||
"stereo"
|
||||
},
|
||||
|
||||
/* Input */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user