added OpenAL device enumeration & selection

This commit is contained in:
spacy51 2007-12-06 14:23:43 +00:00
parent 4d85dab10b
commit 30b1edf84d
11 changed files with 411 additions and 216 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8.00" Version="8,00"
Name="VisualBoyAdvance" Name="VisualBoyAdvance"
ProjectGUID="{6D4C5EC8-933F-4C05-A1BF-498E658576DF}" ProjectGUID="{6D4C5EC8-933F-4C05-A1BF-498E658576DF}"
RootNamespace="VBA" RootNamespace="VBA"
@ -129,6 +129,115 @@
ExcludedFromBuild="true" ExcludedFromBuild="true"
/> />
</Configuration> </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 <Configuration
Name="Release|Win32" Name="Release|Win32"
OutputDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)" OutputDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)"
@ -251,115 +360,6 @@
ExcludedFromBuild="true" ExcludedFromBuild="true"
/> />
</Configuration> </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 <Configuration
Name="Release|x64" Name="Release|x64"
OutputDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)" OutputDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)"
@ -528,16 +528,6 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;" Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/> />
</FileConfiguration> </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 <FileConfiguration
Name="Debug|x64" Name="Debug|x64"
> >
@ -548,6 +538,16 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;" Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/> />
</FileConfiguration> </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 <FileConfiguration
Name="Release|x64" Name="Release|x64"
> >
@ -623,16 +623,6 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;" Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/> />
</FileConfiguration> </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 <FileConfiguration
Name="Debug|x64" Name="Debug|x64"
> >
@ -643,6 +633,16 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;" Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/> />
</FileConfiguration> </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 <FileConfiguration
Name="Release|x64" Name="Release|x64"
> >
@ -667,16 +667,6 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;" Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/> />
</FileConfiguration> </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 <FileConfiguration
Name="Debug|x64" Name="Debug|x64"
> >
@ -687,6 +677,16 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;" Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/> />
</FileConfiguration> </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 <FileConfiguration
Name="Release|x64" Name="Release|x64"
> >
@ -711,16 +711,6 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;" Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/> />
</FileConfiguration> </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 <FileConfiguration
Name="Debug|x64" Name="Debug|x64"
> >
@ -731,6 +721,16 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;" Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/> />
</FileConfiguration> </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 <FileConfiguration
Name="Release|x64" Name="Release|x64"
> >
@ -755,16 +755,6 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;" Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/> />
</FileConfiguration> </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 <FileConfiguration
Name="Debug|x64" Name="Debug|x64"
> >
@ -775,6 +765,16 @@
Outputs="&quot;$(IntDir)\$(InputName).obj&quot;" Outputs="&quot;$(IntDir)\$(InputName).obj&quot;"
/> />
</FileConfiguration> </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 <FileConfiguration
Name="Release|x64" Name="Release|x64"
> >
@ -1175,30 +1175,6 @@
RelativePath=".\src\win32\Logging.cpp" RelativePath=".\src\win32\Logging.cpp"
> >
</File> </File>
<File
RelativePath=".\src\win32\MainWnd.cpp"
>
</File>
<File
RelativePath=".\src\win32\MainWndCheats.cpp"
>
</File>
<File
RelativePath=".\src\win32\MainWndFile.cpp"
>
</File>
<File
RelativePath=".\src\win32\MainWndHelp.cpp"
>
</File>
<File
RelativePath=".\src\win32\MainWndOptions.cpp"
>
</File>
<File
RelativePath=".\src\win32\MainWndTools.cpp"
>
</File>
<File <File
RelativePath=".\src\win32\MapView.cpp" RelativePath=".\src\win32\MapView.cpp"
> >
@ -1223,6 +1199,10 @@
RelativePath=".\src\win32\ModeConfirm.cpp" RelativePath=".\src\win32\ModeConfirm.cpp"
> >
</File> </File>
<File
RelativePath=".\src\win32\OALConfig.cpp"
>
</File>
<File <File
RelativePath=".\src\win32\OamView.cpp" RelativePath=".\src\win32\OamView.cpp"
> >
@ -1331,6 +1311,34 @@
> >
</File> </File>
</Filter> </Filter>
<Filter
Name="MainWnd"
>
<File
RelativePath=".\src\win32\MainWnd.cpp"
>
</File>
<File
RelativePath=".\src\win32\MainWndCheats.cpp"
>
</File>
<File
RelativePath=".\src\win32\MainWndFile.cpp"
>
</File>
<File
RelativePath=".\src\win32\MainWndHelp.cpp"
>
</File>
<File
RelativePath=".\src\win32\MainWndOptions.cpp"
>
</File>
<File
RelativePath=".\src\win32\MainWndTools.cpp"
>
</File>
</Filter>
</Filter> </Filter>
<Filter <Filter
Name="Main" Name="Main"
@ -1379,7 +1387,7 @@
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
Name="Release|Win32" Name="Debug|x64"
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
@ -1387,7 +1395,7 @@
/> />
</FileConfiguration> </FileConfiguration>
<FileConfiguration <FileConfiguration
Name="Debug|x64" Name="Release|Win32"
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
@ -1737,6 +1745,10 @@
RelativePath=".\src\win32\ModeConfirm.h" RelativePath=".\src\win32\ModeConfirm.h"
> >
</File> </File>
<File
RelativePath=".\src\win32\OALConfig.h"
>
</File>
<File <File
RelativePath=".\src\win32\OamView.h" RelativePath=".\src\win32\OamView.h"
> >

View File

@ -456,6 +456,7 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_UPDATE_COMMAND_UI(ID_OUTPUTAPI_DIRECTSOUND, &MainWnd::OnUpdateOutputapiDirectsound) ON_UPDATE_COMMAND_UI(ID_OUTPUTAPI_DIRECTSOUND, &MainWnd::OnUpdateOutputapiDirectsound)
ON_COMMAND(ID_OUTPUTAPI_OPENAL, &MainWnd::OnOutputapiOpenal) ON_COMMAND(ID_OUTPUTAPI_OPENAL, &MainWnd::OnOutputapiOpenal)
ON_UPDATE_COMMAND_UI(ID_OUTPUTAPI_OPENAL, &MainWnd::OnUpdateOutputapiOpenal) ON_UPDATE_COMMAND_UI(ID_OUTPUTAPI_OPENAL, &MainWnd::OnUpdateOutputapiOpenal)
ON_COMMAND(ID_OUTPUTAPI_OALCONFIGURATION, &MainWnd::OnOutputapiOalconfiguration)
END_MESSAGE_MAP() END_MESSAGE_MAP()

View File

@ -456,6 +456,7 @@ public:
afx_msg void OnUpdateOutputapiDirectsound(CCmdUI *pCmdUI); afx_msg void OnUpdateOutputapiDirectsound(CCmdUI *pCmdUI);
afx_msg void OnOutputapiOpenal(); afx_msg void OnOutputapiOpenal();
afx_msg void OnUpdateOutputapiOpenal(CCmdUI *pCmdUI); afx_msg void OnUpdateOutputapiOpenal(CCmdUI *pCmdUI);
afx_msg void OnOutputapiOalconfiguration();
}; };
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@ -34,6 +34,7 @@
#include "Throttle.h" #include "Throttle.h"
#include "WinResUtil.h" #include "WinResUtil.h"
#include "SelectPlugin.h" #include "SelectPlugin.h"
#include "OALConfig.h"
#include "../System.h" #include "../System.h"
#include "../agbprint.h" #include "../agbprint.h"
@ -1990,3 +1991,24 @@ void MainWnd::OnUpdateOutputapiOpenal(CCmdUI *pCmdUI)
#endif #endif
} }
void MainWnd::OnOutputapiOalconfiguration()
{
#ifndef NO_OAL
OALConfig dlg;
dlg.selectedDevice = theApp.oalDevice;
if( dlg.DoModal() == IDOK ) {
if( theApp.oalDevice ) {
free( theApp.oalDevice );
theApp.oalDevice = NULL;
}
theApp.oalDevice = (TCHAR*)malloc( (dlg.selectedDevice.GetLength() + 1) * sizeof( TCHAR ) );
_tcscpy( theApp.oalDevice, dlg.selectedDevice.GetBuffer() );
systemSoundShutdown();
systemSoundInit();
}
#endif
}

67
src/win32/OALConfig.cpp Normal file
View File

@ -0,0 +1,67 @@
// src/win32/OALConfig.cpp : implementation file
//
#ifndef NO_OAL
#include "stdafx.h"
#include "OALConfig.h"
// OpenAL
#include <al.h>
#include <alc.h>
#pragma comment( lib, "OpenAL32.lib" )
// OALConfig dialog
IMPLEMENT_DYNAMIC(OALConfig, CDialog)
OALConfig::OALConfig(CWnd* pParent /*=NULL*/)
: CDialog(OALConfig::IDD, pParent)
, selectedDevice(_T(""))
{
}
OALConfig::~OALConfig()
{
}
void OALConfig::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_DEVICE, cbDevice);
if( !pDX->m_bSaveAndValidate ) {
// enumerate devices
const ALchar *devices = NULL;
devices = alcGetString( NULL, ALC_DEVICE_SPECIFIER );
if( strlen( devices ) ) {
while( *devices ) {
cbDevice.AddString( devices );
devices += strlen( devices ) + 1;
}
} else {
systemMessage( IDS_OAL_NODEVICE, "There are no sound devices present on this system." );
}
}
DDX_CBString(pDX, IDC_DEVICE, selectedDevice);
}
BOOL OALConfig::OnInitDialog()
{
CDialog::OnInitDialog();
return TRUE;
}
BEGIN_MESSAGE_MAP(OALConfig, CDialog)
END_MESSAGE_MAP()
// OALConfig message handlers
#endif

31
src/win32/OALConfig.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef NO_OAL
#pragma once
#include "afxwin.h"
// OALConfig dialog
class OALConfig : public CDialog
{
DECLARE_DYNAMIC(OALConfig)
public:
OALConfig(CWnd* pParent = NULL); // standard constructor
virtual ~OALConfig();
// Dialog Data
enum { IDD = IDD_OAL_CONFIG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()
private:
CComboBox cbDevice;
public:
CString selectedDevice;
};
#endif

View File

@ -62,7 +62,6 @@ public:
private: private:
bool initialized; bool initialized;
bool buffersLoaded; bool buffersLoaded;
bool playing;
ALCdevice *device; ALCdevice *device;
ALCcontext *context; ALCcontext *context;
ALuint buffer[NBUFFERS]; ALuint buffer[NBUFFERS];
@ -80,7 +79,6 @@ OpenAL::OpenAL()
{ {
initialized = false; initialized = false;
buffersLoaded = false; buffersLoaded = false;
playing = false;
device = NULL; device = NULL;
context = NULL; context = NULL;
memset( buffer, 0, NBUFFERS * sizeof( ALuint ) ); memset( buffer, 0, NBUFFERS * sizeof( ALuint ) );
@ -121,7 +119,7 @@ void OpenAL::debugState()
alGetSourcei( source, AL_SOURCE_STATE, &value ); alGetSourcei( source, AL_SOURCE_STATE, &value );
assert( AL_NO_ERROR == alGetError() ); assert( AL_NO_ERROR == alGetError() );
winlog( " playing = %i\n", playing ); winlog( " soundPaused = %i\n", soundPaused );
winlog( " Source:\n" ); winlog( " Source:\n" );
winlog( " State: " ); winlog( " State: " );
switch( value ) switch( value )
@ -160,7 +158,11 @@ bool OpenAL::init()
winlog( "OpenAL::init\n" ); winlog( "OpenAL::init\n" );
assert( initialized == false ); assert( initialized == false );
device = alcOpenDevice( theApp.OpenALAudiomixing ? "Generic Software" : NULL ); if( theApp.oalDevice ) {
device = alcOpenDevice( theApp.oalDevice );
} else {
device = alcOpenDevice( NULL );
}
assert( device != NULL ); assert( device != NULL );
context = alcCreateContext( device, NULL ); context = alcCreateContext( device, NULL );
@ -175,20 +177,7 @@ bool OpenAL::init()
alGenSources( 1, &source ); alGenSources( 1, &source );
assert( AL_NO_ERROR == alGetError() ); assert( AL_NO_ERROR == alGetError() );
switch( soundQuality ) freq = 44100 / soundQuality;
{
case 4:
freq = 11025;
break;
case 2:
freq = 22050;
break;
default:
soundQuality = 1;
case 1:
freq = 44100;
break;
}
soundBufferLen = freq * 2 * 2 / 60; soundBufferLen = freq * 2 * 2 / 60;
// 16bit stereo, buffer can store the sound for 1 frame in 60Hz // 16bit stereo, buffer can store the sound for 1 frame in 60Hz
@ -204,7 +193,6 @@ void OpenAL::resume()
{ {
winlog( "OpenAL::resume\n" ); winlog( "OpenAL::resume\n" );
assert( initialized ); assert( initialized );
playing = true;
if( !buffersLoaded ) return; if( !buffersLoaded ) return;
debugState(); debugState();
@ -224,7 +212,6 @@ void OpenAL::pause()
{ {
winlog( "OpenAL::pause\n" ); winlog( "OpenAL::pause\n" );
assert( initialized ); assert( initialized );
playing = false;
if( !buffersLoaded ) return; if( !buffersLoaded ) return;
debugState(); debugState();
@ -244,7 +231,6 @@ void OpenAL::reset()
{ {
winlog( "OpenAL::reset\n" ); winlog( "OpenAL::reset\n" );
assert( initialized ); assert( initialized );
playing = false;
if( !buffersLoaded ) return; if( !buffersLoaded ) return;
debugState(); debugState();
@ -319,7 +305,7 @@ void OpenAL::write()
// start playing the source if necessary // start playing the source if necessary
alGetSourcei( source, AL_SOURCE_STATE, &sourceState ); alGetSourcei( source, AL_SOURCE_STATE, &sourceState );
assert( AL_NO_ERROR == alGetError() ); assert( AL_NO_ERROR == alGetError() );
if( playing && ( sourceState != AL_PLAYING ) ) { if( !soundPaused && ( sourceState != AL_PLAYING ) ) {
alSourcePlay( source ); alSourcePlay( source );
assert( AL_NO_ERROR == alGetError() ); assert( AL_NO_ERROR == alGetError() );
} }

View File

@ -278,6 +278,9 @@ VBA::VBA()
pVideoDriverGUID = NULL; pVideoDriverGUID = NULL;
renderMethod = DIRECT_DRAW; renderMethod = DIRECT_DRAW;
audioAPI = DIRECTSOUND; audioAPI = DIRECTSOUND;
#ifndef NO_OAL
oalDevice = NULL;
#endif
iconic = false; iconic = false;
ddrawEmulationOnly = false; ddrawEmulationOnly = false;
ddrawUsingEmulationOnly = false; ddrawUsingEmulationOnly = false;
@ -304,7 +307,6 @@ VBA::VBA()
input = NULL; input = NULL;
joypadDefault = 0; joypadDefault = 0;
autoFire = 0; autoFire = 0;
OpenALAudiomixing = false;
autoFireToggle = false; autoFireToggle = false;
winPauseNextFrame = false; winPauseNextFrame = false;
soundRecording = false; soundRecording = false;
@ -418,6 +420,12 @@ VBA::~VBA()
if(rewindMemory) if(rewindMemory)
free(rewindMemory); free(rewindMemory);
#ifndef NO_OAL
if( oalDevice ) {
free( oalDevice );
}
#endif
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -1421,7 +1429,6 @@ void VBA::loadSettings()
audioAPI = DIRECTSOUND; audioAPI = DIRECTSOUND;
} }
OpenALAudiomixing = regQueryDwordValue( "OpenALAudiomixing", 0 );
windowPositionX = regQueryDwordValue("windowX", 0); windowPositionX = regQueryDwordValue("windowX", 0);
if(windowPositionX < 0) if(windowPositionX < 0)
windowPositionX = 0; windowPositionX = 0;
@ -1649,6 +1656,15 @@ void VBA::loadSettings()
} }
Sm60FPS::bSaveMoreCPU = regQueryDwordValue("saveMoreCPU", 0); Sm60FPS::bSaveMoreCPU = regQueryDwordValue("saveMoreCPU", 0);
#ifndef NO_OAL
buffer = regQueryStringValue( "oalDevice", "" );
if( oalDevice ) {
free( oalDevice );
}
oalDevice = (TCHAR*)malloc( ( buffer.GetLength() + 1 ) * sizeof( TCHAR ) );
_tcscpy( oalDevice, buffer.GetBuffer() );
#endif
} }
void VBA::updateFrameSkip() void VBA::updateFrameSkip()
@ -2484,8 +2500,6 @@ void VBA::saveSettings()
regSetDwordValue("autoFrameSkip", autoFrameSkip); regSetDwordValue("autoFrameSkip", autoFrameSkip);
regSetDwordValue( "OpenALAudiomixing", OpenALAudiomixing);
regSetDwordValue("vsync", vsync); regSetDwordValue("vsync", vsync);
regSetDwordValue("synchronize", synchronize); regSetDwordValue("synchronize", synchronize);
regSetDwordValue("stretch", fullScreenStretch); regSetDwordValue("stretch", fullScreenStretch);
@ -2620,6 +2634,10 @@ void VBA::saveSettings()
regSetDwordValue("Linklog", linklog); regSetDwordValue("Linklog", linklog);
regSetDwordValue("RFU", adapter); regSetDwordValue("RFU", adapter);
regSetDwordValue("linkEnabled", linkenable); regSetDwordValue("linkEnabled", linkenable);
#ifndef NO_OAL
regSetStringValue( "oalDevice", oalDevice );
#endif
} }
void winSignal(int, int) void winSignal(int, int)

View File

@ -148,12 +148,14 @@ class VBA : public CWinApp
u32 autoFrameSkipLastTime; u32 autoFrameSkipLastTime;
bool autoFrameSkip; bool autoFrameSkip;
bool vsync; bool vsync;
bool OpenALAudiomixing;
bool changingVideoSize; bool changingVideoSize;
GUID videoDriverGUID; GUID videoDriverGUID;
GUID *pVideoDriverGUID; GUID *pVideoDriverGUID;
DISPLAY_TYPE renderMethod; DISPLAY_TYPE renderMethod;
AUDIO_API audioAPI; AUDIO_API audioAPI;
#ifndef NO_OAL
TCHAR *oalDevice;
#endif
bool iconic; bool iconic;
bool ddrawEmulationOnly; bool ddrawEmulationOnly;
bool ddrawUsingEmulationOnly; bool ddrawUsingEmulationOnly;

View File

@ -12,6 +12,54 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// German (Germany) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
#ifdef _WIN32
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_OAL_CONFIG DIALOGEX 0, 0, 167, 53
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "OpenAL configuration"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,66,36,48,12
PUSHBUTTON "Cancel",IDCANCEL,114,36,48,12
COMBOBOX IDC_DEVICE,6,18,156,36,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Select device:",IDC_STATIC,6,6,156,12
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_OAL_CONFIG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 160
TOPMARGIN, 7
BOTTOMMARGIN, 46
END
END
#endif // APSTUDIO_INVOKED
#endif // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources // English (U.S.) resources
@ -1660,6 +1708,7 @@ BEGIN
MENUITEM " Use &old synchronization", ID_OPTIONS_SOUND_USEOLDSYNCHRONIZATION MENUITEM " Use &old synchronization", ID_OPTIONS_SOUND_USEOLDSYNCHRONIZATION
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "OpenAL", ID_OUTPUTAPI_OPENAL MENUITEM "OpenAL", ID_OUTPUTAPI_OPENAL
MENUITEM " Configuration...", ID_OUTPUTAPI_OALCONFIGURATION
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Sync game to audio", ID_OPTIONS_EMULATOR_SYNCHRONIZE MENUITEM "&Sync game to audio", ID_OPTIONS_EMULATOR_SYNCHRONIZE
END END
@ -2151,6 +2200,7 @@ BEGIN
"Invalid rewind interval value. Please enter a number between 0 and 600 seconds." "Invalid rewind interval value. Please enter a number between 0 and 600 seconds."
IDS_REGISTRY "VisualBoyAdvance no longer uses the registry to store its settings. Your previous settings have been exported into the file: %s" IDS_REGISTRY "VisualBoyAdvance no longer uses the registry to store its settings. Your previous settings have been exported into the file: %s"
IDS_MOVIE_PLAY "Playing a movie will load a save state which may erase your previous battery saves. Please be sure to have a saved state if you don't want to loose any previous data." IDS_MOVIE_PLAY "Playing a movie will load a save state which may erase your previous battery saves. Please be sure to have a saved state if you don't want to loose any previous data."
IDS_OAL_NODEVICE "There are no sound devices present on this system."
END END
#endif // English (U.S.) resources #endif // English (U.S.) resources

View File

@ -97,6 +97,7 @@
#define IDD_GAME_OVERRIDES 156 #define IDD_GAME_OVERRIDES 156
#define IDD_SELECT 159 #define IDD_SELECT 159
#define IDD_SELECT_PLUGIN 159 #define IDD_SELECT_PLUGIN 159
#define IDD_OAL_CONFIG 160
#define IDC_R0 1000 #define IDC_R0 1000
#define IDC_EDIT_UP 1000 #define IDC_EDIT_UP 1000
#define IDC_R1 1001 #define IDC_R1 1001
@ -379,6 +380,7 @@
#define IDC_SAVE_OBJ 1138 #define IDC_SAVE_OBJ 1138
#define IDC_MAP_VIEW_ZOOM 1138 #define IDC_MAP_VIEW_ZOOM 1138
#define IDS_MOVIE_PLAY 1138 #define IDS_MOVIE_PLAY 1138
#define IDS_OAL_NODEVICE 1139
#define IDC_VIEWER 1140 #define IDC_VIEWER 1140
#define IDC_ADDRESSES 1141 #define IDC_ADDRESSES 1141
#define IDC_GO 1143 #define IDC_GO 1143
@ -508,6 +510,7 @@
#define IDC_MIRRORING 1266 #define IDC_MIRRORING 1266
#define IDC_LY 1267 #define IDC_LY 1267
#define IDC_APPENDMODE 1268 #define IDC_APPENDMODE 1268
#define IDC_DEVICE 1269
#define ID_HELP_ABOUT 40001 #define ID_HELP_ABOUT 40001
#define ID_FILE_EXIT 40002 #define ID_FILE_EXIT 40002
#define ID_OPTIONS_VIDEO_FRAMESKIP_0 40003 #define ID_OPTIONS_VIDEO_FRAMESKIP_0 40003
@ -807,14 +810,16 @@
#define ID_OUTPUTAPI_DIRECTSOUND 40346 #define ID_OUTPUTAPI_DIRECTSOUND 40346
#define ID_OUTPUTAPI_OPENAL 40347 #define ID_OUTPUTAPI_OPENAL 40347
#define ID_OUTPUTAPI_SOFTWAREMIXING 40348 #define ID_OUTPUTAPI_SOFTWAREMIXING 40348
#define ID_OUTPUTAPI_CONFIGURATION 40349
#define ID_OUTPUTAPI_OALCONFIGURATION 40350
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 159 #define _APS_NEXT_RESOURCE_VALUE 161
#define _APS_NEXT_COMMAND_VALUE 40349 #define _APS_NEXT_COMMAND_VALUE 40351
#define _APS_NEXT_CONTROL_VALUE 1269 #define _APS_NEXT_CONTROL_VALUE 1270
#define _APS_NEXT_SYMED_VALUE 103 #define _APS_NEXT_SYMED_VALUE 103
#endif #endif
#endif #endif