Merge pull request #3169 from thedax/soundInitFix

Overhaul the sound fix.
This commit is contained in:
Henrik Rydgård 2013-08-14 12:10:57 -07:00
commit b2b4c92333
6 changed files with 37 additions and 5 deletions

View File

@ -335,6 +335,14 @@ UI::EventReturn GameSettingsScreen::OnBack(UI::EventParams &e) {
if(PSP_IsInited() && !IsAudioInitialised())
Audio_Init();
}
// It doesn't matter if audio is inited or not, it'll still output no sound
// if the mixer isn't available, so go ahead and init/shutdown at our leisure.
if(Atrac3plus_Decoder::IsInstalled()) {
if(g_Config.bEnableAtrac3plus)
Atrac3plus_Decoder::Init();
else Atrac3plus_Decoder::Shutdown();
}
return UI::EVENT_DONE;
}

View File

@ -43,7 +43,7 @@ private:
UI::EventReturn OnDownloadPlugin(UI::EventParams &e);
UI::EventReturn OnControlMapping(UI::EventParams &e);
UI::EventReturn OnBack(UI::EventParams &e);
// Temporaries to convert bools to int settings
bool cap60FPS_;
};

View File

@ -861,14 +861,19 @@ void AudioScreen::render() {
int columnw = 400;
UICheckBox(GEN_ID, x, y += stride, a->T("Enable Sound"), ALIGN_TOPLEFT, &g_Config.bEnableSound);
if (g_Config.bEnableSound) {
if (Atrac3plus_Decoder::IsInstalled()) {
UICheckBox(GEN_ID, x, y += stride, a->T("Enable Atrac3+"), ALIGN_TOPLEFT, &g_Config.bEnableAtrac3plus);
}
if(PSP_IsInited() && !IsAudioInitialised()) {
Audio_Init();
}
if (Atrac3plus_Decoder::IsInstalled()) {
UICheckBox(GEN_ID, x, y += stride, a->T("Enable Atrac3+"), ALIGN_TOPLEFT, &g_Config.bEnableAtrac3plus);
if(g_Config.bEnableAtrac3plus)
Atrac3plus_Decoder::Init();
else Atrac3plus_Decoder::Shutdown();
}
// Show the download button even if not installed - might want to upgrade.
VLinear vlinear(30, 400, 20);
std::string atracString;

View File

@ -42,6 +42,7 @@
#include "Core/SaveState.h"
#include "Core/System.h"
#include "Core/Config.h"
#include "Core/HW/atrac3plus.h"
#include "Windows/EmuThread.h"
#include "resource.h"
@ -1029,6 +1030,23 @@ namespace MainWindow
case ID_EMULATION_SOUND:
g_Config.bEnableSound = !g_Config.bEnableSound;
if(!g_Config.bEnableSound) {
EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_GRAYED);
if(!IsAudioInitialised())
Audio_Init();
}
else
EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_ENABLED);
break;
case ID_EMULATION_ATRAC3_SOUND:
g_Config.bEnableAtrac3plus = !g_Config.bEnableAtrac3plus;
if(Atrac3plus_Decoder::IsInstalled()) {
if(g_Config.bEnableAtrac3plus)
Atrac3plus_Decoder::Init();
else Atrac3plus_Decoder::Shutdown();
}
break;
case ID_HELP_OPENWEBSITE:
@ -1217,6 +1235,7 @@ namespace MainWindow
CHECKITEM(ID_OPTIONS_TOPMOST, g_Config.bTopMost);
CHECKITEM(ID_EMULATION_SOUND, g_Config.bEnableSound);
CHECKITEM(ID_TEXTURESCALING_DEPOSTERIZE, g_Config.bTexDeposterize);
CHECKITEM(ID_EMULATION_ATRAC3_SOUND, g_Config.bEnableAtrac3plus);
static const int zoomitems[4] = {
ID_OPTIONS_SCREEN1X,

Binary file not shown.

Binary file not shown.