added DirectSound <> OpenAL selection

OpenAL can be excluded from build with #define NO_OAL
This commit is contained in:
spacy51 2007-12-05 23:22:37 +00:00
parent ba33eb122a
commit adf36092f7
10 changed files with 259 additions and 169 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Version="8,00"
Name="VisualBoyAdvance"
ProjectGUID="{6D4C5EC8-933F-4C05-A1BF-498E658576DF}"
RootNamespace="VBA"
@ -129,6 +129,115 @@
ExcludedFromBuild="true"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)_temp"
ConfigurationType="1"
UseOfMFC="1"
CharacterSet="2"
BuildLogFile="$(IntDir)\$(ProjectName)_BuildLog.htm"
>
<Tool
Name="VCPreBuildEventTool"
ExcludedFromBuild="true"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="false"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\dependencies\zlib;..\dependencies\libpng;&quot;..\dependencies\File_Extractor-0.4.2\fex&quot;;..\dependencies\cximage;..\dependencies\msvc"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;DEV_VERSION;BKPT_SUPPORT;CRT_SECURE_NO_WARNINGS;HAS_FILE_EXTRACTOR;C_CORE"
StringPooling="false"
MinimalRebuild="true"
BasicRuntimeChecks="3"
SmallerTypeCheck="false"
RuntimeLibrary="1"
StructMemberAlignment="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="false"
EnableEnhancedInstructionSet="0"
TreatWChar_tAsBuiltInType="false"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
AdditionalIncludeDirectories=""
/>
<Tool
Name="VCPreLinkEventTool"
ExcludedFromBuild="true"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="nafxcwd.lib LIBCMTD.lib Vfw32.Lib OpenGL32.Lib dinput8.lib dxguid.lib ddraw.lib winmm.lib Dsound.lib"
OutputFile="$(OutDir)\VisualBoyAdvance.exe"
Version=""
LinkIncremental="2"
AdditionalLibraryDirectories=""
GenerateManifest="true"
AdditionalManifestDependencies="type=&apos;win32&apos; name=&apos;Microsoft.Windows.Common-Controls&apos; version=&apos;6.0.0.0&apos; processorArchitecture=&apos;amd64&apos; publicKeyToken=&apos;6595b64144ccf1df&apos; language=&apos;*&apos;"
IgnoreDefaultLibraryNames="nafxcwd.lib;LIBCMTD.lib"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="1"
EnableCOMDATFolding="1"
OptimizeForWindows98="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
ExcludedFromBuild="true"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)"
@ -251,115 +360,6 @@
ExcludedFromBuild="true"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)_temp"
ConfigurationType="1"
UseOfMFC="1"
CharacterSet="2"
BuildLogFile="$(IntDir)\$(ProjectName)_BuildLog.htm"
>
<Tool
Name="VCPreBuildEventTool"
ExcludedFromBuild="true"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="MASM"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="false"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\dependencies\zlib;..\dependencies\libpng;&quot;..\dependencies\File_Extractor-0.4.2\fex&quot;;..\dependencies\cximage;..\dependencies\msvc"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;DEV_VERSION;BKPT_SUPPORT;CRT_SECURE_NO_WARNINGS;HAS_FILE_EXTRACTOR;C_CORE"
StringPooling="false"
MinimalRebuild="true"
BasicRuntimeChecks="3"
SmallerTypeCheck="false"
RuntimeLibrary="1"
StructMemberAlignment="0"
BufferSecurityCheck="false"
EnableFunctionLevelLinking="false"
EnableEnhancedInstructionSet="0"
TreatWChar_tAsBuiltInType="false"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
AdditionalIncludeDirectories=""
/>
<Tool
Name="VCPreLinkEventTool"
ExcludedFromBuild="true"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="nafxcwd.lib LIBCMTD.lib Vfw32.Lib OpenGL32.Lib dinput8.lib dxguid.lib ddraw.lib winmm.lib Dsound.lib"
OutputFile="$(OutDir)\VisualBoyAdvance.exe"
Version=""
LinkIncremental="2"
AdditionalLibraryDirectories=""
GenerateManifest="true"
AdditionalManifestDependencies="type=&apos;win32&apos; name=&apos;Microsoft.Windows.Common-Controls&apos; version=&apos;6.0.0.0&apos; processorArchitecture=&apos;amd64&apos; publicKeyToken=&apos;6595b64144ccf1df&apos; language=&apos;*&apos;"
IgnoreDefaultLibraryNames="nafxcwd.lib;LIBCMTD.lib"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="1"
EnableCOMDATFolding="1"
OptimizeForWindows98="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
ExcludedFromBuild="true"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)"
@ -528,16 +528,6 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputFileName)..."
CommandLine="nasm -D__DJGPP__ -f win32 -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -548,6 +538,16 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputFileName)..."
CommandLine="nasm -D__DJGPP__ -f win32 -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -623,16 +623,6 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputFileName)..."
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win32 -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -643,6 +633,16 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputFileName)..."
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win32 -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -667,16 +667,6 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputFileName)..."
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win32 -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -687,6 +677,16 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputFileName)..."
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win32 -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -711,16 +711,6 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputFileName)..."
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win32 -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -731,6 +721,16 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputFileName)..."
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win32 -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -755,16 +755,6 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputFileName)..."
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win32 -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
@ -775,6 +765,16 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Assembling $(InputFileName)..."
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win32 -o &quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
@ -1379,7 +1379,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
@ -1387,7 +1387,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
@ -1403,6 +1403,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\src\win32\OpenAL.cpp"
>
</File>
<File
RelativePath=".\src\win32\OpenGL.cpp"
>

View File

@ -452,6 +452,10 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_UPDATE_COMMAND_UI(ID_SKIN_USE, &MainWnd::OnUpdateSkinUse)
ON_COMMAND(ID_SKIN_SELECT, &MainWnd::OnSkinSelect)
ON_UPDATE_COMMAND_UI(ID_SKIN_SELECT, &MainWnd::OnUpdateSkinSelect)
ON_COMMAND(ID_OUTPUTAPI_DIRECTSOUND, &MainWnd::OnOutputapiDirectsound)
ON_UPDATE_COMMAND_UI(ID_OUTPUTAPI_DIRECTSOUND, &MainWnd::OnUpdateOutputapiDirectsound)
ON_COMMAND(ID_OUTPUTAPI_OPENAL, &MainWnd::OnOutputapiOpenal)
ON_UPDATE_COMMAND_UI(ID_OUTPUTAPI_OPENAL, &MainWnd::OnUpdateOutputapiOpenal)
END_MESSAGE_MAP()

View File

@ -452,6 +452,10 @@ public:
afx_msg void OnUpdateSkinUse(CCmdUI *pCmdUI);
afx_msg void OnSkinSelect();
afx_msg void OnUpdateSkinSelect(CCmdUI *pCmdUI);
afx_msg void OnOutputapiDirectsound();
afx_msg void OnUpdateOutputapiDirectsound(CCmdUI *pCmdUI);
afx_msg void OnOutputapiOpenal();
afx_msg void OnUpdateOutputapiOpenal(CCmdUI *pCmdUI);
};
/////////////////////////////////////////////////////////////////////////////

View File

@ -1975,3 +1975,35 @@ void MainWnd::OnUpdateSkinSelect(CCmdUI *pCmdUI)
);
#endif
}
void MainWnd::OnOutputapiDirectsound()
{
if( theApp.audioAPI != DIRECTSOUND ) {
theApp.audioAPI = DIRECTSOUND;
systemSoundShutdown();
systemSoundInit();
}
}
void MainWnd::OnUpdateOutputapiDirectsound(CCmdUI *pCmdUI)
{
pCmdUI->SetCheck( ( theApp.audioAPI == DIRECTSOUND ) ? 1 : 0 );
}
void MainWnd::OnOutputapiOpenal()
{
#ifndef NO_OAL
if( theApp.audioAPI != OPENAL ) {
theApp.audioAPI = OPENAL;
systemSoundShutdown();
systemSoundInit();
}
#endif
}
void MainWnd::OnUpdateOutputapiOpenal(CCmdUI *pCmdUI)
{
#ifndef NO_OAL
pCmdUI->SetCheck( ( theApp.audioAPI == OPENAL ) ? 1 : 0 );
#endif
}

View File

@ -15,7 +15,9 @@
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h" // includes VBA.h
#ifndef NO_OAL
#include "stdafx.h" // includes VBA.h for 'theApp.throttle'
// Interface
#include "Sound.h"
@ -26,7 +28,7 @@
#pragma comment( lib, "OpenAL32.lib" )
// Windows
#include <windows.h> // for Sleep() and OutputDebugString()
#include <windows.h> // for 'Sleep' function
// Internals
#include "../Sound.h"
@ -329,3 +331,5 @@ ISound *newOpenAL()
winlog( "newOpenAL\n" );
return new OpenAL();
}
#endif

View File

@ -20,6 +20,13 @@
#ifndef VBA_WIN32_SOUND_H
#define VBA_WIN32_SOUND_H
enum AUDIO_API {
DIRECTSOUND
#ifndef NO_OAL
, OPENAL
#endif
};
class ISound
{
public:

View File

@ -108,6 +108,9 @@ extern IDisplay *newDirect3DDisplay();
extern Input *newDirectInput();
extern ISound *newDirectSound();
#ifndef NO_OAL
extern ISound *newOpenAL();
#endif
extern void remoteStubSignal(int, int);
extern void remoteOutput(char *, u32);
@ -274,6 +277,7 @@ VBA::VBA()
changingVideoSize = false;
pVideoDriverGUID = NULL;
renderMethod = DIRECT_DRAW;
audioAPI = DIRECTSOUND;
iconic = false;
ddrawEmulationOnly = false;
ddrawUsingEmulationOnly = false;
@ -1189,7 +1193,18 @@ bool systemSoundInit()
if(theApp.sound)
delete theApp.sound;
theApp.sound = newDirectSound();
switch( theApp.audioAPI )
{
case DIRECTSOUND:
theApp.sound = newDirectSound();
break;
#ifndef NO_OAL
case OPENAL:
theApp.sound = newOpenAL();
break;
#endif
}
return theApp.sound->init();
}
@ -1396,6 +1411,15 @@ void VBA::loadSettings()
renderMethod = DIRECT_DRAW;
}
audioAPI = (AUDIO_API)regQueryDwordValue( "audioAPI", DIRECTSOUND );
if( ( audioAPI != DIRECTSOUND )
#ifndef NO_OAL
&& ( audioAPI != OPENAL )
#endif
) {
audioAPI = DIRECTSOUND;
}
windowPositionX = regQueryDwordValue("windowX", 0);
if(windowPositionX < 0)
windowPositionX = 0;
@ -2479,6 +2503,7 @@ void VBA::saveSettings()
regSetDwordValue("fsFrequency", fsFrequency);
regSetDwordValue("renderMethod", renderMethod);
regSetDwordValue( "audioAPI", audioAPI );
regSetDwordValue("windowX", windowPositionX);
regSetDwordValue("windowY", windowPositionY);

View File

@ -152,6 +152,7 @@ class VBA : public CWinApp
GUID videoDriverGUID;
GUID *pVideoDriverGUID;
DISPLAY_TYPE renderMethod;
AUDIO_API audioAPI;
bool iconic;
bool ddrawEmulationOnly;
bool ddrawUsingEmulationOnly;

View File

@ -1654,12 +1654,19 @@ BEGIN
END
POPUP "&Audio"
BEGIN
POPUP "Output API"
BEGIN
MENUITEM "DirectSound", ID_OUTPUTAPI_DIRECTSOUND
MENUITEM " Use &old synchronization", ID_OPTIONS_SOUND_USEOLDSYNCHRONIZATION
MENUITEM SEPARATOR
MENUITEM "OpenAL", ID_OUTPUTAPI_OPENAL
MENUITEM SEPARATOR
MENUITEM "&Sync game to audio", ID_OPTIONS_EMULATOR_SYNCHRONIZE
END
MENUITEM SEPARATOR
MENUITEM "&On", ID_OPTIONS_SOUND_ON
MENUITEM "O&ff", ID_OPTIONS_SOUND_OFF
MENUITEM SEPARATOR
MENUITEM "&Sync game to audio", ID_OPTIONS_EMULATOR_SYNCHRONIZE
MENUITEM "Use &old synchronization", ID_OPTIONS_SOUND_USEOLDSYNCHRONIZATION
MENUITEM SEPARATOR
POPUP "&Volume"
BEGIN
MENUITEM "&Mute", ID_OPTIONS_SOUND_MUTE

View File

@ -804,13 +804,15 @@
#define ID_OPTIONS_FILTER_PLUGIN 40343
#define ID_OPTIONS_SELECT_PLUGIN 40344
#define IDC_COMBO_PLUGIN 40345
#define ID_OUTPUTAPI_DIRECTSOUND 40346
#define ID_OUTPUTAPI_OPENAL 40347
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 159
#define _APS_NEXT_COMMAND_VALUE 40343
#define _APS_NEXT_COMMAND_VALUE 40348
#define _APS_NEXT_CONTROL_VALUE 1269
#define _APS_NEXT_SYMED_VALUE 103
#endif