Skip to content
Permalink
Browse files

add "Disable mute on unfocus" option to audio settings

  • Loading branch information...
RadWolfie committed Apr 12, 2019
1 parent b19fc40 commit 82909b939ff002e101b12b737c92c7794439ba22
@@ -300,14 +300,16 @@ CAPTION "Cxbx-Reloaded : Audio Configuration"
FONT 8, "Verdana", 0, 0, 0x1
BEGIN
COMBOBOX IDC_AC_AUDIO_ADAPTER,76,12,173,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable PCM",IDC_AC_PCM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,36,54,10
CONTROL "Enable XADPCM",IDC_AC_XADPCM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,48,69,10
CONTROL "Enable Unknown Codec",IDC_AC_UNKNOWN_CODEC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,60,93,10
CONTROL "Enable PCM",IDC_AC_PCM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,34,54,10
CONTROL "Enable XADPCM",IDC_AC_XADPCM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,133,34,69,10
CONTROL "Enable Unknown Codec",IDC_AC_UNKNOWN_CODEC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,45,93,10
PUSHBUTTON "Cancel",IDC_AC_CANCEL,146,102,50,14,BS_FLAT
PUSHBUTTON "Accept",IDC_AC_ACCEPT,206,102,50,14,BS_FLAT
GROUPBOX "DirectSound Configuration",IDC_STATIC,4,1,250,98,BS_CENTER
LTEXT "Audio Adapter:",IDC_STATIC,13,14,57,8,0,WS_EX_RIGHT
LTEXT "Other Options:",IDC_STATIC,13,33,57,8,0,WS_EX_RIGHT
LTEXT "Codec Options:",IDC_STATIC,13,34,57,8,0,WS_EX_RIGHT
LTEXT "Other Options:",IDC_STATIC,13,60,57,8,0,WS_EX_RIGHT
CONTROL "Disable mute on unfocus",IDC_AC_MUTE_ON_UNFOCUS_DISABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,60,97,10
END

IDD_NETWORK_CFG DIALOGEX 0, 0, 404, 76
@@ -93,6 +93,7 @@ static struct {
const char* codec_pcm = "PCM";
const char* codec_xadpcm = "XADPCM";
const char* codec_unknown = "UnknownCodec";
const char* mute_on_unfocus = "MuteOnUnfocus";
} sect_audio_keys;

static const char* section_network = "network";
@@ -424,7 +425,9 @@ bool Settings::LoadConfig()

m_audio.codec_pcm = m_si.GetBoolValue(section_audio, sect_audio_keys.codec_pcm, /*Default=*/true, nullptr);
m_audio.codec_xadpcm = m_si.GetBoolValue(section_audio, sect_audio_keys.codec_xadpcm, /*Default=*/true, nullptr);
m_audio.codec_unknown = m_si.GetBoolValue(section_audio, sect_audio_keys.codec_unknown, /*Default=*/true, nullptr);
m_audio.codec_unknown = m_si.GetBoolValue(section_audio, sect_audio_keys.codec_unknown, /*Default=*/true, nullptr);

m_audio.mute_on_unfocus = m_si.GetBoolValue(section_audio, sect_audio_keys.mute_on_unfocus, /*Default=*/true, nullptr);

// ==== Audio End ===========

@@ -574,6 +577,7 @@ bool Settings::Save(std::string file_path)
m_si.SetBoolValue(section_audio, sect_audio_keys.codec_pcm, m_audio.codec_pcm, nullptr, true);
m_si.SetBoolValue(section_audio, sect_audio_keys.codec_xadpcm, m_audio.codec_xadpcm, nullptr, true);
m_si.SetBoolValue(section_audio, sect_audio_keys.codec_unknown, m_audio.codec_unknown, nullptr, true);
m_si.SetBoolValue(section_audio, sect_audio_keys.mute_on_unfocus, m_audio.mute_on_unfocus, nullptr, true);

// ==== Audio End ===========

@@ -170,7 +170,7 @@ class Settings
bool codec_pcm ;
bool codec_xadpcm;
bool codec_unknown;
bool Reserved4 = 0;
bool mute_on_unfocus;
int Reserved99[14] = { 0 };
} m_audio;

@@ -920,7 +920,8 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateBuffer)
}

DSBufferDesc.dwSize = sizeof(DSBUFFERDESC);
DSBufferDesc.dwFlags = (pdsbd->dwFlags & dwAcceptableMask) | DSBCAPS_CTRLVOLUME | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLFREQUENCY;
DSBufferDesc.dwFlags = (pdsbd->dwFlags & dwAcceptableMask) | DSBCAPS_CTRLVOLUME | DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLFREQUENCY |
(g_XBAudio.mute_on_unfocus ? 0 : DSBCAPS_GLOBALFOCUS);

// TODO: Garbage Collection
*ppBuffer = new X_CDirectSoundBuffer();
@@ -1714,7 +1715,8 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateStream)
}
DSBufferDesc.dwSize = sizeof(DSBUFFERDESC);
//DSBufferDesc->dwFlags = (pdssd->dwFlags & dwAcceptableMask) | DSBCAPS_CTRLVOLUME | DSBCAPS_GETCURRENTPOSITION2;
DSBufferDesc.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY | DSBCAPS_GETCURRENTPOSITION2; //aka DSBCAPS_DEFAULT + control position
DSBufferDesc.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY | DSBCAPS_GETCURRENTPOSITION2 | //aka DSBCAPS_DEFAULT + control position
(g_XBAudio.mute_on_unfocus ? 0 : DSBCAPS_GLOBALFOCUS);

if ((pdssd->dwFlags & DSBCAPS_CTRL3D) > 0) {
DSBufferDesc.dwFlags |= DSBCAPS_CTRL3D;
@@ -112,6 +112,8 @@ INT_PTR CALLBACK DlgAudioConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPAR
SendMessage(GetDlgItem(hWndDlg, IDC_AC_XADPCM), BM_SETCHECK, (WPARAM)g_XBAudio.codec_xadpcm, 0);

SendMessage(GetDlgItem(hWndDlg, IDC_AC_UNKNOWN_CODEC), BM_SETCHECK, (WPARAM)g_XBAudio.codec_unknown, 0);

SendMessage(GetDlgItem(hWndDlg, IDC_AC_MUTE_ON_UNFOCUS_DISABLE), BM_SETCHECK, (WPARAM)g_XBAudio.mute_on_unfocus==0, 0);
}
}
break;
@@ -165,6 +167,10 @@ INT_PTR CALLBACK DlgAudioConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPAR
lRet = SendMessage(GetDlgItem(hWndDlg, IDC_AC_UNKNOWN_CODEC), BM_GETCHECK, 0, 0);

g_XBAudio.codec_unknown = (lRet == BST_CHECKED);

lRet = SendMessage(GetDlgItem(hWndDlg, IDC_AC_MUTE_ON_UNFOCUS_DISABLE), BM_GETCHECK, 0, 0);

g_XBAudio.mute_on_unfocus = (lRet != BST_CHECKED);
}

/*! save audio configuration */
@@ -186,6 +186,7 @@
#define ID_GUI_STATUS_LLE_FLAGS 1097
#define ID_GUI_STATUS_XBOX_LED_COLOUR 1098
#define ID_GUI_STATUS_LOG_ENABLED 1099
#define IDC_AC_MUTE_ON_UNFOCUS_DISABLE 1100
#define IDC_XBOX_PORT_0 1158
#define IDC_HOST_NOTCONNECT_0_0 1159
#define IDC_HOST_XINPUT_0_0 1160

0 comments on commit 82909b9

Please sign in to comment.
You can’t perform that action at this time.