how to get SPU2 to compile on visual studio 2017 to run on windows 8 or higher. I've updated this guide a little bit
change WinConfig.h
0x602 == windows 8 == xaudio2.8
0x603 == windows 8.1 == xaudio2.8
0x0A00 == windows 10 == xaudio2.9
remove SndOut_XAudio2_27.cpp from the project. it straight up tells you to remove it if the windows version is 0x602 or higher
change SndOut.h by commenting out the line with xaudio2_27_out
change sndout.cpp by again commenting out the line about xaudio2_27 and adding "XAudio2OUT,"
comment out or remove this code from PS23-spu2.cpp
and remove or comment out this extremely similar code from spu2replay.cpp
SndOut_XAudio2.inl still includes references to Xaudio2_27_Out but because they are hidden behind preprocessor logic you don't really have to do anything if you don't want.
congrats. you should now be able to compile the spu-2 dll without the burdens of old Windows 7 code.
change WinConfig.h
0x602 == windows 8 == xaudio2.8
0x603 == windows 8.1 == xaudio2.8
0x0A00 == windows 10 == xaudio2.9
Code:
#ifndef _WIN32_WINNT
//#define _WIN32_WINNT 0x0600
#define _WIN32_WINNT 0x0602
#endif
remove SndOut_XAudio2_27.cpp from the project. it straight up tells you to remove it if the windows version is 0x602 or higher
Code:
#include "Global.h"
#include "Dialogs.h"
#if _WIN32_WINNT >= 0x602
#error Time to remove this module.
#endif
#include <xaudio2.h>
#include "SndOut_XAudio2.inl"
change SndOut.h by commenting out the line with xaudio2_27_out
Code:
#ifdef _MSC_VER
//internal
extern SndOutModule *WaveOut;
extern SndOutModule *DSoundOut;
//extern SndOutModule *XAudio2_27_Out;
extern SndOutModule *XAudio2Out;
#endif
extern SndOutModule *PortaudioOut;
#if defined(SPU2X_SDL) || defined(SPU2X_SDL2)
extern SndOutModule *const SDLOut;
#endif
#ifdef __linux__
extern SndOutModule *AlsaOut;
#endif
change sndout.cpp by again commenting out the line about xaudio2_27 and adding "XAudio2OUT,"
Code:
SndOutModule *mods[] =
{
&NullOut,
#ifdef _MSC_VER
//XAudio2_27_Out, // CHANGE THIS LINE TO THE ONE UNDER IT
XAudio2Out,
DSoundOut,
WaveOut,
#endif
PortaudioOut,
comment out or remove this code from PS23-spu2.cpp
Code:
#ifdef _WIN32
if (IsWindows8OrGreater()) {
for (int n = 0; mods[n] != nullptr; ++n) {
if (mods[n] == XAudio2_27_Out) {
mods[n] = XAudio2Out;
break;
}
}
}
#endif
and remove or comment out this extremely similar code from spu2replay.cpp
Code:
if (IsWindows8OrGreater()) {
for (int n = 0; mods[n] != nullptr; ++n) {
if (mods[n] == XAudio2_27_Out) {
mods[n] = XAudio2Out;
break;
}
}
}
SndOut_XAudio2.inl still includes references to Xaudio2_27_Out but because they are hidden behind preprocessor logic you don't really have to do anything if you don't want.
congrats. you should now be able to compile the spu-2 dll without the burdens of old Windows 7 code.