/*** Sound based functions ***/ void S9xToggleSoundChannel(int c) { static int sound_switch = 255; if (c == 8) sound_switch = 255; else sound_switch ^= 1 << c; S9xSetSoundControl (sound_switch); }
void S9xToggleSoundChannel (int c) { static int channel_enable = 255; if (c == 8) channel_enable = 255; else channel_enable ^= 1 << c; S9xSetSoundControl(channel_enable); }
void SNESSystem::CPULoop() { if (soundEnableFlag != soundEnableFlagOld) { S9xSetSoundControl(soundEnableFlag); soundEnableFlagOld = soundEnableFlag; } S9xSyncSound(); S9xMainLoop(); unsigned bytes = (S9xGetSampleCount() << 1) & ~3; ZeroMemory(sound_buffer, bytes); S9xMixSamples(sound_buffer, bytes >> 1); if (m_output != NULL) { m_output->write(sound_buffer, bytes); } }
static void update_variables(void) { bool geometry_update = false; char key[256]; struct retro_variable var; var.key = "snes9x_overclock"; var.value = NULL; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var)) { int freq = atoi(var.value); Settings.SuperFXClockMultiplier = freq; } var.key = "snes9x_up_down_allowed"; var.value = NULL; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var)) { Settings.UpAndDown = !strcmp(var.value, "disabled") ? false : true; } else Settings.UpAndDown = false; int disabled_channels=0; strcpy(key, "snes9x_sndchan_x"); var.key=key; for (int i=0;i<8;i++) { key[strlen("snes9x_sndchan_")]='1'+i; var.value=NULL; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp("disabled", var.value)) disabled_channels|=1<<i; } S9xSetSoundControl(disabled_channels^0xFF); int disabled_layers=0; strcpy(key, "snes9x_layer_x"); for (int i=0;i<5;i++) { key[strlen("snes9x_layer_")]='1'+i; var.value=NULL; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp("disabled", var.value)) disabled_layers|=1<<i; } Settings.BG_Forced=disabled_layers; //for some reason, Transparency seems to control both the fixed color and the windowing registers? var.key="snes9x_gfx_clip"; var.value=NULL; Settings.DisableGraphicWindows=(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp("disabled", var.value)); var.key="snes9x_gfx_transp"; var.value=NULL; Settings.Transparency=!(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp("disabled", var.value)); var.key="snes9x_gfx_hires"; var.value=NULL; Settings.SupportHiRes=!(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp("disabled", var.value)); var.key = "snes9x_overscan"; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { overscan_mode newval = OVERSCAN_CROP_AUTO; if (strcmp(var.value, "enabled") == 0) newval = OVERSCAN_CROP_ON; else if (strcmp(var.value, "disabled") == 0) newval = OVERSCAN_CROP_OFF; if (newval != crop_overscan_mode) { crop_overscan_mode = newval; geometry_update = true; } } var.key = "snes9x_aspect"; if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) { aspect_mode newval = ASPECT_RATIO_AUTO; if (strcmp(var.value, "ntsc") == 0) newval = ASPECT_RATIO_NTSC; else if (strcmp(var.value, "pal") == 0) newval = ASPECT_RATIO_PAL; else if (strcmp(var.value, "4:3") == 0) newval = ASPECT_RATIO_4_3; else if (strcmp(var.value, "8:7") == 0) newval = ASPECT_RATIO_8_7; if (newval != aspect_ratio_mode) { aspect_ratio_mode = newval; geometry_update = true; } } if (geometry_update) update_geometry(); }