diff --git a/build/win32/Cxbx.vcxproj b/build/win32/Cxbx.vcxproj
index c4863fb0e..388fe7044 100644
--- a/build/win32/Cxbx.vcxproj
+++ b/build/win32/Cxbx.vcxproj
@@ -190,6 +190,7 @@ $(SOLUTIONDIR)Export.bat
+
@@ -297,6 +298,7 @@ $(SOLUTIONDIR)Export.bat
+
@@ -382,6 +384,7 @@ $(SOLUTIONDIR)Export.bat
+
@@ -559,6 +562,7 @@ $(SOLUTIONDIR)Export.bat
%(PreprocessorDefinitions)
+
%(AdditionalIncludeDirectories)
%(PreprocessorDefinitions)
diff --git a/build/win32/Cxbx.vcxproj.filters b/build/win32/Cxbx.vcxproj.filters
index b576f1568..9c564ca13 100644
--- a/build/win32/Cxbx.vcxproj.filters
+++ b/build/win32/Cxbx.vcxproj.filters
@@ -205,6 +205,12 @@
Emulator
+
+ GUI
+
+
+ Shared
+
@@ -558,6 +564,18 @@
Emulator
+
+ Shared
+
+
+ Emulator
+
+
+ GUI
+
+
+ Shared
+
diff --git a/resource/Cxbx.rc b/resource/Cxbx.rc
index 33a38969b..824c81e26 100644
--- a/resource/Cxbx.rc
+++ b/resource/Cxbx.rc
@@ -128,8 +128,8 @@ BEGIN
POPUP "&Settings"
BEGIN
MENUITEM "Config &Controller...", ID_SETTINGS_CONFIG_CONTROLLER
- MENUITEM "Config &Audio...", ID_SETTINGS_CONFIGURESOUND, GRAYED
MENUITEM "Config &Video...", ID_SETTINGS_CONFIG_VIDEO
+ MENUITEM "Config &Audio...", ID_SETTINGS_CONFIG_AUDIO
MENUITEM SEPARATOR
MENUITEM "Use XInput", ID_SETTINGS_XINPUT
MENUITEM SEPARATOR
@@ -232,6 +232,11 @@ BEGIN
PUSHBUTTON "Click to configure all input...",IDC_CONFIGURE_ALL,6,102,210,14,BS_FLAT
END
+/////////////////////////////////////////////////////////////////////////////
+//
+// Video Configuration
+//
+
IDD_VIDEO_CFG DIALOGEX 0, 0, 259, 121
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cxbx : Video Configuration"
@@ -251,6 +256,31 @@ BEGIN
LTEXT "Other Options:",IDC_STATIC,21,71,49,8,0,WS_EX_RIGHT
CONTROL "Enable Hardware YUV Overlays",IDC_CV_HARDWAREYUV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,84,123,11
END
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Audio Configuration
+//
+
+IDD_AUDIO_CFG DIALOGEX 0, 0, 259, 121
+STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Cxbx : 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, 76, 46, 65, 10
+CONTROL "Enable XADPCM", IDC_AC_XADPCM, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 76, 59, 123, 11
+CONTROL "Enable Unknown Codec", IDC_AC_UNKNOWN_CODEC, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 76, 72, 98, 10
+CONTROL "Use Legacy Audio Hack", IDC_AC_LEGACY_AUDIO_HACK, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 76, 33, 98, 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
+END
+/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/Common/Win32/EmuShared.cpp b/src/Common/Win32/EmuShared.cpp
index 38ed67033..9108837db 100644
--- a/src/Common/Win32/EmuShared.cpp
+++ b/src/Common/Win32/EmuShared.cpp
@@ -151,10 +151,12 @@ void EmuShared::Load()
{
m_XBController.Load("Software\\Cxbx-Reloaded\\XBController");
m_XBVideo.Load("Software\\Cxbx-Reloaded\\XBVideo");
+ m_XBAudio.Load("Software\\Cxbx-Reloaded\\XBAudio");
}
void EmuShared::Save()
{
m_XBController.Save("Software\\Cxbx-Reloaded\\XBController");
m_XBVideo.Save("Software\\Cxbx-Reloaded\\XBVideo");
+ m_XBAudio.Save("Software\\Cxbx-Reloaded\\XBAudio");
}
\ No newline at end of file
diff --git a/src/Common/Win32/XBAudio.cpp b/src/Common/Win32/XBAudio.cpp
new file mode 100644
index 000000000..4dcac8c35
--- /dev/null
+++ b/src/Common/Win32/XBAudio.cpp
@@ -0,0 +1,123 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check it.
+// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+// ******************************************************************
+// *
+// * .,-::::: .,:: .::::::::. .,:: .:
+// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
+// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
+// * $$$ Y$$$P $$""""Y$$ Y$$$P
+// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
+// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
+// *
+// * Cxbx->Common->Win32->XBAudio.cpp
+// *
+// * This file is part of the Cxbx project.
+// *
+// * Cxbx and Cxbe are free software; you can redistribute them
+// * and/or modify them under the terms of the GNU General Public
+// * License as published by the Free Software Foundation; either
+// * version 2 of the license, or (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have recieved a copy of the GNU General Public License
+// * along with this program; see the file COPYING.
+// * If not, write to the Free Software Foundation, Inc.,
+// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
+// *
+// * (c) 2017 RadWolfie
+// *
+// * All rights reserved
+// *
+// ******************************************************************
+#include "XBAudio.h"
+
+#include
+
+// ******************************************************************
+// * func: XBAudio::XBAudio
+// ******************************************************************
+XBAudio::XBAudio() : m_bLegacyAudioHack(false), m_bPCM(true), m_bXADPCM(false), m_bUnknownCodec(false)
+{
+ m_binAudioAdapter = { 0 };
+}
+
+// ******************************************************************
+// * func: XBAudio::~XBAudio
+// ******************************************************************
+XBAudio::~XBAudio()
+{
+}
+
+// ******************************************************************
+// * func: XBAudio::Load
+// ******************************************************************
+void XBAudio::Load(const char *szRegistryKey)
+{
+ // ******************************************************************
+ // * Load Configuration from Registry
+ // ******************************************************************
+ {
+ DWORD dwDisposition, dwType, dwSize;
+ HKEY hKey;
+
+ if(RegCreateKeyEx(HKEY_CURRENT_USER, szRegistryKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_QUERY_VALUE, NULL, &hKey, &dwDisposition) == ERROR_SUCCESS)
+ {
+
+ dwType = REG_DWORD; dwSize = sizeof(m_binAudioAdapter);
+ RegQueryValueEx(hKey, "AudioAdapter", NULL, &dwType, (PBYTE)&m_binAudioAdapter, &dwSize);
+
+ dwType = REG_DWORD; dwSize = sizeof(m_bLegacyAudioHack);
+ RegQueryValueEx(hKey, "LegacyAudioHack", NULL, &dwType, (PBYTE)&m_bLegacyAudioHack, &dwSize);
+
+ dwType = REG_DWORD; dwSize = sizeof(m_bPCM);
+ RegQueryValueEx(hKey, "PCM", NULL, &dwType, (PBYTE)&m_bPCM, &dwSize);
+
+ dwType = REG_DWORD; dwSize = sizeof(m_bXADPCM);
+ RegQueryValueEx(hKey, "XADPCM", NULL, &dwType, (PBYTE)&m_bXADPCM, &dwSize);
+
+ dwType = REG_DWORD; dwSize = sizeof(m_bUnknownCodec);
+ RegQueryValueEx(hKey, "UnknownCodec", NULL, &dwType, (PBYTE)&m_bUnknownCodec, &dwSize);
+
+ RegCloseKey(hKey);
+ }
+ }
+}
+
+// ******************************************************************
+// * func: XBAudio::Save
+// ******************************************************************
+void XBAudio::Save(const char *szRegistryKey)
+{
+ // ******************************************************************
+ // * Save Configuration to Registry
+ // ******************************************************************
+ {
+ DWORD dwDisposition, dwType, dwSize;
+ HKEY hKey;
+
+ if(RegCreateKeyEx(HKEY_CURRENT_USER, szRegistryKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, &dwDisposition) == ERROR_SUCCESS)
+ {
+
+ dwType = REG_BINARY; dwSize = sizeof(m_binAudioAdapter);
+ RegSetValueEx(hKey, "AudioAdapter", 0, dwType, (PBYTE)&m_binAudioAdapter, dwSize);
+
+ dwType = REG_DWORD; dwSize = sizeof(m_bLegacyAudioHack);
+ RegSetValueEx(hKey, "LegacyAudioHack", 0, dwType, (PBYTE)&m_bLegacyAudioHack, dwSize);
+
+ dwType = REG_DWORD; dwSize = sizeof(m_bPCM);
+ RegSetValueEx(hKey, "PCM", 0, dwType, (PBYTE)&m_bPCM, dwSize);
+
+ dwType = REG_DWORD; dwSize = sizeof(m_bXADPCM);
+ RegSetValueEx(hKey, "XADPCM", 0, dwType, (PBYTE)&m_bXADPCM, dwSize);
+
+ dwType = REG_DWORD; dwSize = sizeof(m_bUnknownCodec);
+ RegSetValueEx(hKey, "UnknownCodec", 0, dwType, (PBYTE)&m_bUnknownCodec, dwSize);
+
+ RegCloseKey(hKey);
+ }
+ }
+}
diff --git a/src/Common/Win32/XBAudio.h b/src/Common/Win32/XBAudio.h
new file mode 100644
index 000000000..4bebb5fe4
--- /dev/null
+++ b/src/Common/Win32/XBAudio.h
@@ -0,0 +1,100 @@
+// ******************************************************************
+// *
+// * .,-::::: .,:: .::::::::. .,:: .:
+// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
+// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
+// * $$$ Y$$$P $$""""Y$$ Y$$$P
+// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
+// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
+// *
+// * Cxbx->Common->Win32->Cxbx->XBAudio.h
+// *
+// * This file is part of the Cxbx project.
+// *
+// * Cxbx and Cxbe are free software; you can redistribute them
+// * and/or modify them under the terms of the GNU General Public
+// * License as published by the Free Software Foundation; either
+// * version 2 of the license, or (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have recieved a copy of the GNU General Public License
+// * along with this program; see the file COPYING.
+// * If not, write to the Free Software Foundation, Inc.,
+// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
+// *
+// * (c) 2017 RadWolfie
+// *
+// * All rights reserved
+// *
+// ******************************************************************
+#ifndef XBAUDIO_H
+#define XBAUDIO_H
+
+#include "Cxbx.h"
+#include "Common/Error.h"
+#include "Mutex.h"
+
+// ******************************************************************
+// * class: XBAudio
+// ******************************************************************
+class XBAudio : public Error
+{
+ public:
+ // ******************************************************************
+ // * Initialization
+ // ******************************************************************
+ XBAudio();
+ ~XBAudio();
+
+ // ******************************************************************
+ // * Registry Load/Save
+ // ******************************************************************
+ void Load(const char *szRegistryKey);
+ void Save(const char *szRegistryKey);
+
+ // ******************************************************************
+ // * SetAudioAdapter
+ // ******************************************************************
+ void SetAudioAdapter(GUID binAudioAdapter) { m_binAudioAdapter = binAudioAdapter; }
+ GUID GetAudioAdapter() const { return m_binAudioAdapter; }
+
+ // ******************************************************************
+ // * Audio Hack Toggling
+ // ******************************************************************
+ void SetLegacyAudioHack(BOOL bAudioHack) { m_bLegacyAudioHack = bAudioHack; }
+ BOOL GetLegacyAudioHack() const { return m_bLegacyAudioHack; }
+
+ // ******************************************************************
+ // * PCM Toggling
+ // ******************************************************************
+ void SetPCM(BOOL bPCM) { m_bPCM = bPCM; }
+ BOOL GetPCM() const { return m_bPCM; }
+
+ // ******************************************************************
+ // * XADPCM Toggling
+ // ******************************************************************
+ void SetXADPCM(BOOL bXADPCM) { m_bXADPCM = bXADPCM; }
+ BOOL GetXADPCM() const { return m_bXADPCM; }
+
+ // ******************************************************************
+ // * Unknown Codec Toggling
+ // ******************************************************************
+ void SetUnknownCodec(BOOL bUnknownCodec) { m_bUnknownCodec = bUnknownCodec; }
+ BOOL GetUnknownCodec() const { return m_bUnknownCodec; }
+
+ private:
+ // ******************************************************************
+ // * Configuration
+ // ******************************************************************
+ GUID m_binAudioAdapter;
+ BOOL m_bLegacyAudioHack;
+ BOOL m_bPCM;
+ BOOL m_bXADPCM;
+ BOOL m_bUnknownCodec;
+};
+
+#endif
diff --git a/src/Cxbx/DlgAudioConfig.cpp b/src/Cxbx/DlgAudioConfig.cpp
new file mode 100644
index 000000000..da8a80f27
--- /dev/null
+++ b/src/Cxbx/DlgAudioConfig.cpp
@@ -0,0 +1,233 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check it.
+// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+// ******************************************************************
+// *
+// * .,-::::: .,:: .::::::::. .,:: .:
+// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
+// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
+// * $$$ Y$$$P $$""""Y$$ Y$$$P
+// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
+// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
+// *
+// * Cxbx->Cxbx->DlgAudioConfig.cpp
+// *
+// * This file is part of the Cxbx project.
+// *
+// * Cxbx and Cxbe are free software; you can redistribute them
+// * and/or modify them under the terms of the GNU General Public
+// * License as published by the Free Software Foundation; either
+// * version 2 of the license, or (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have recieved a copy of the GNU General Public License
+// * along with this program; see the file COPYING.
+// * If not, write to the Free Software Foundation, Inc.,
+// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
+// *
+// * (c) 2017 RadWolfie
+// *
+// * All rights reserved
+// *
+// ******************************************************************
+
+#include "CxbxKrnl/EmuShared.h"
+
+#include "DlgAudioConfig.h"
+#include "ResCxbx.h"
+
+#include
+
+/*! windows dialog procedure */
+static INT_PTR CALLBACK DlgAudioConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
+/*! directsound audio devices procedure*/
+static BOOL CALLBACK DSEnumProc(LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrvName, LPVOID lpContext);
+/*! refresh UI based on selected audio adapter */
+static VOID RefreshAudioAdapter();
+
+/*! audio configuration */
+static XBAudio g_XBAudio;
+/*! changes flag */
+static BOOL g_bHasChanges = FALSE;
+/*! handle to audio adapter list window */
+static HWND g_hAudioAdapter = nullptr;
+
+VOID ShowAudioConfig(HWND hwnd)
+{
+ /*! reset changes flag */
+ g_bHasChanges = FALSE;
+
+ /*! retrieve audio configuration */
+ g_EmuShared->GetXBAudio(&g_XBAudio);
+
+ /*! show dialog box */
+ DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_AUDIO_CFG), hwnd, DlgAudioConfigProc);
+}
+
+BOOL CALLBACK DSEnumProc(LPGUID lpGUID, LPCTSTR lpszDesc, LPCTSTR lpszDrvName, LPVOID lpContext)
+{
+ /*! enumerate audio adapters */
+
+ LRESULT counter = SendMessage(g_hAudioAdapter, CB_ADDSTRING, 0, (LPARAM)lpszDesc);
+ SendMessage(g_hAudioAdapter, CB_SETITEMDATA, counter, (LPARAM)lpGUID);
+
+ GUID binGUID;
+
+ if (lpGUID != nullptr) {
+ binGUID = *lpGUID;
+ } else {
+ binGUID = { 0 };
+ }
+
+ GUID curGUID = g_XBAudio.GetAudioAdapter();
+
+ /*! activate configured audio adapter */
+ if (curGUID == binGUID) {
+ SendMessage(g_hAudioAdapter, CB_SETCURSEL, counter, 0);
+ }
+
+ return TRUE;
+}
+
+INT_PTR CALLBACK DlgAudioConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ g_hAudioAdapter = GetDlgItem(hWndDlg, IDC_AC_AUDIO_ADAPTER);
+
+ /*! set window icon */
+ SetClassLong(hWndDlg, GCL_HICON, (LONG)LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_CXBX)));
+
+ /*! enumerate audio adapters */
+ {
+
+ SendMessage(g_hAudioAdapter, CB_RESETCONTENT, 0, 0);
+
+ XTL::DirectSoundEnumerate(&DSEnumProc, NULL);
+ }
+
+ /*! refresh UI based on currently selected audio adapter */
+ RefreshAudioAdapter();
+
+ /*! check appropriate options */
+ {
+ SendMessage(GetDlgItem(hWndDlg, IDC_AC_LEGACY_AUDIO_HACK), BM_SETCHECK, (WPARAM)g_XBAudio.GetLegacyAudioHack(), 0);
+
+ SendMessage(GetDlgItem(hWndDlg, IDC_AC_PCM), BM_SETCHECK, (WPARAM)g_XBAudio.GetPCM(), 0);
+
+ SendMessage(GetDlgItem(hWndDlg, IDC_AC_XADPCM), BM_SETCHECK, (WPARAM)g_XBAudio.GetXADPCM(), 0);
+
+ SendMessage(GetDlgItem(hWndDlg, IDC_AC_UNKNOWN_CODEC), BM_SETCHECK, (WPARAM)g_XBAudio.GetUnknownCodec(), 0);
+ }
+ }
+ break;
+
+ case WM_CLOSE:
+ {
+ /*! if changes have been made, check if the user wants to save them */
+ if(g_bHasChanges)
+ {
+ int ret = MessageBox(hWndDlg, "Do you wish to apply your changes?", "Cxbx-Reloaded", MB_ICONQUESTION | MB_YESNOCANCEL);
+
+ switch(ret)
+ {
+ case IDYES:
+ PostMessage(hWndDlg, WM_COMMAND, IDC_AC_ACCEPT, 0);
+ break;
+ case IDNO:
+ PostMessage(hWndDlg, WM_COMMAND, IDC_AC_CANCEL, 0);
+ break;
+ }
+ break;
+ }
+
+ PostMessage(hWndDlg, WM_COMMAND, IDC_AC_CANCEL, 0);
+ }
+ break;
+
+ case WM_COMMAND:
+ {
+ HWND hWndButton = GetDlgItem(hWndDlg, LOWORD(wParam));
+
+ switch(LOWORD(wParam))
+ {
+ case IDC_AC_CANCEL:
+ EndDialog(hWndDlg, wParam);
+ break;
+
+ case IDC_AC_ACCEPT:
+ {
+
+ /*! save LegacyAudioHack/PCM/XADPCM/UnknownCodec options */
+ {
+ LRESULT lRet = SendMessage(GetDlgItem(hWndDlg, IDC_AC_LEGACY_AUDIO_HACK), BM_GETCHECK, 0, 0);
+
+ g_XBAudio.SetLegacyAudioHack(lRet == BST_CHECKED);
+
+ lRet = SendMessage(GetDlgItem(hWndDlg, IDC_AC_PCM), BM_GETCHECK, 0, 0);
+
+ g_XBAudio.SetPCM(lRet == BST_CHECKED);
+
+ lRet = SendMessage(GetDlgItem(hWndDlg, IDC_AC_XADPCM), BM_GETCHECK, 0, 0);
+
+ g_XBAudio.SetXADPCM(lRet == BST_CHECKED);
+
+ lRet = SendMessage(GetDlgItem(hWndDlg, IDC_AC_UNKNOWN_CODEC), BM_GETCHECK, 0, 0);
+
+ g_XBAudio.SetUnknownCodec(lRet == BST_CHECKED);
+ }
+
+ /*! save audio configuration */
+ g_EmuShared->SetXBAudio(&g_XBAudio);
+
+ EndDialog(hWndDlg, wParam);
+ }
+ break;
+
+ case IDC_AC_AUDIO_ADAPTER:
+ {
+ if(HIWORD(wParam) == CBN_SELCHANGE)
+ {
+ RefreshAudioAdapter();
+ break;
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
+ return FALSE;
+}
+
+VOID RefreshAudioAdapter()
+{
+ /*! save configured audio adapter */
+ {
+ GUID oldGUID = g_XBAudio.GetAudioAdapter();
+
+ DWORD dwAudioAdapter = (DWORD)SendMessage(g_hAudioAdapter, CB_GETCURSEL, 0, 0);
+
+ LPGUID pGUID = (LPGUID)SendMessage(g_hAudioAdapter, CB_GETITEMDATA, dwAudioAdapter, 0);
+
+ GUID binGUID;
+
+ if (pGUID) {
+ binGUID = *pGUID;
+ } else {
+ binGUID = { 0 };
+ }
+
+ if(binGUID != oldGUID)
+ {
+ g_bHasChanges = TRUE;
+
+ g_XBAudio.SetAudioAdapter(binGUID);
+ }
+ }
+}
diff --git a/src/Cxbx/DlgAudioConfig.h b/src/Cxbx/DlgAudioConfig.h
new file mode 100644
index 000000000..ff12b1447
--- /dev/null
+++ b/src/Cxbx/DlgAudioConfig.h
@@ -0,0 +1,42 @@
+// ******************************************************************
+// *
+// * .,-::::: .,:: .::::::::. .,:: .:
+// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
+// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
+// * $$$ Y$$$P $$""""Y$$ Y$$$P
+// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
+// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
+// *
+// * Cxbx->Cxbx->DlgAudioConfig.h
+// *
+// * This file is part of the Cxbx project.
+// *
+// * Cxbx and Cxbe are free software; you can redistribute them
+// * and/or modify them under the terms of the GNU General Public
+// * License as published by the Free Software Foundation; either
+// * version 2 of the license, or (at your option) any later version.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have recieved a copy of the GNU General Public License
+// * along with this program; see the file COPYING.
+// * If not, write to the Free Software Foundation, Inc.,
+// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
+// *
+// * (c) 2017 RadWolfie
+// *
+// * All rights reserved
+// *
+// ******************************************************************
+#ifndef DLGAUDIOCONFIG_H
+#define DLGAUDIOCONFIG_H
+
+#include
+
+/*! show audio configuration dialog */
+extern VOID ShowAudioConfig(HWND hwnd);
+
+#endif
diff --git a/src/Cxbx/ResCxbx.h b/src/Cxbx/ResCxbx.h
index 3a69c20ed..3d721bd67 100644
--- a/src/Cxbx/ResCxbx.h
+++ b/src/Cxbx/ResCxbx.h
@@ -9,6 +9,7 @@
#define IDB_ABOUT 108
#define IDD_CONTROLLER_CFG 111
#define IDD_VIDEO_CFG 113
+#define IDD_AUDIO_CFG 114
#define IDR_JPEG_ABOUT 116
#define IDR_JPEG_SPLASH 118
#define IDD_ABOUT 119
@@ -55,6 +56,13 @@
#define IDC_LIST2 1055
#define IDC_ABOUT 1056
#define IDC_TAB1 1057
+#define IDC_AC_ACCEPT 1058
+#define IDC_AC_CANCEL 1059
+#define IDC_AC_AUDIO_ADAPTER 1060
+#define IDC_AC_LEGACY_AUDIO_HACK 1061
+#define IDC_AC_PCM 1062
+#define IDC_AC_XADPCM 1063
+#define IDC_AC_UNKNOWN_CODEC 1064
#define ID_FILE_EXIT 40005
#define ID_HELP_ABOUT 40008
#define ID_EMULATION_START 40009
@@ -76,7 +84,7 @@
#define ID_EMULATION_LLE_JIT 40041
#define ID_SETTINGS_CONFIG_CONTROLLER 40046
#define ID_SETTINGS_CONFIG_VIDEO 40047
-#define ID_SETTINGS_CONFIGURESOUND 40048
+#define ID_SETTINGS_CONFIG_AUDIO 40048
#define ID_FILE_RXBE_0 40050
#define ID_FILE_RXBE_1 40051
#define ID_FILE_RXBE_2 40052
diff --git a/src/Cxbx/WndMain.cpp b/src/Cxbx/WndMain.cpp
index 1064a2dbf..40f86a406 100644
--- a/src/Cxbx/WndMain.cpp
+++ b/src/Cxbx/WndMain.cpp
@@ -37,6 +37,7 @@
#include "DlgAbout.h"
#include "DlgControllerConfig.h"
#include "DlgVideoConfig.h"
+#include "DlgAudioConfig.h"
#include "CxbxKrnl/EmuShared.h"
#include "ResCxbx.h"
#include "CxbxVersion.h"
@@ -904,6 +905,10 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
ShowVideoConfig(hwnd);
break;
+ case ID_SETTINGS_CONFIG_AUDIO:
+ ShowAudioConfig(hwnd);
+ break;
+
case ID_CACHE_CLEARHLECACHE_ALL:
{
ClearHLECache();
diff --git a/src/CxbxKrnl/EmuShared.h b/src/CxbxKrnl/EmuShared.h
index 8c72f32ee..ba39a50aa 100644
--- a/src/CxbxKrnl/EmuShared.h
+++ b/src/CxbxKrnl/EmuShared.h
@@ -37,6 +37,7 @@
#include "Cxbx.h"
#include "Common/Win32/XBController.h"
#include "Common/Win32/XBVideo.h"
+#include "Common/Win32/XBAudio.h"
#include
@@ -73,6 +74,12 @@ class EmuShared : public Mutex
void GetXBVideo( XBVideo *video) { Lock(); memcpy(video, &m_XBVideo, sizeof(XBVideo)); Unlock(); }
void SetXBVideo(const XBVideo *video) { Lock(); memcpy(&m_XBVideo, video, sizeof(XBVideo)); Unlock(); }
+ // ******************************************************************
+ // * Xbox Audio Accessors
+ // ******************************************************************
+ void GetXBAudio( XBAudio *audio) { Lock(); memcpy(audio, &m_XBAudio, sizeof(XBAudio)); Unlock(); }
+ void SetXBAudio(const XBAudio *audio) { Lock(); memcpy(&m_XBAudio, audio, sizeof(XBAudio)); Unlock(); }
+
// ******************************************************************
// * Xbox Controller Accessors
// ******************************************************************
@@ -109,6 +116,7 @@ class EmuShared : public Mutex
// ******************************************************************
XBController m_XBController;
XBVideo m_XBVideo;
+ XBAudio m_XBAudio;
char m_XbePath[MAX_PATH];
int m_FlagsLLE;
int m_XInputEnabled;