Implement Initialize Audio Settings

First attempt to obtain audio settings configured by user request. At
the moment, selecting audio adapter device is functional. More to come
later on...
This commit is contained in:
RadWolfie 2017-07-14 11:55:55 -05:00
parent 4dad779758
commit d052a19690
3 changed files with 29 additions and 4 deletions

View File

@ -760,6 +760,8 @@ void CxbxKrnlInit
DbgPrintf("EmuMain: Initializing render window.\n");
XTL::CxbxInitWindow(pXbeHeader, dwXbeHeaderSize);
XTL::CxbxInitAudio();
EmuHLEIntercept(pXbeHeader);
if (bLLE_GPU)

View File

@ -128,6 +128,7 @@ XTL::X_XFileMediaObject::_vtbl XTL::X_XFileMediaObject::vtbl =
#define DSOUND_MAX_SYNCHPLAYBACK_AUDIO 29
// Static Variable(s)
XBAudio g_XBAudio = XBAudio();
extern LPDIRECTSOUND8 g_pDSound8 = NULL; //This is necessary in order to allow share with EmuDSoundInline.hpp
static LPDIRECTSOUNDBUFFER g_pDSoundPrimaryBuffer = NULL;
//TODO: RadWolfie - How to implement support if primary does not permit it for DSP usage?
@ -146,6 +147,19 @@ unsigned int g_iDSoundSynchPlaybackCounter = 0;
#include "EmuDSoundInline.hpp"
#ifdef __cplusplus
extern "C" {
#endif
void CxbxInitAudio()
{
g_EmuShared->GetXBAudio(&g_XBAudio);
}
#ifdef __cplusplus
}
#endif
// ******************************************************************
// * patch: DirectSoundCreate
// ******************************************************************
@ -179,7 +193,7 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreate)
g_bDSoundCreateCalled = TRUE;
if (!initialized || !g_pDSound8) {
hRet = DirectSoundCreate8(NULL, ppDirectSound, NULL);
hRet = DirectSoundCreate8(&g_XBAudio.GetAudioAdapter(), ppDirectSound, NULL);
if (FAILED(hRet)) {
CxbxKrnlCleanup("DirectSoundCreate8 Failed!");

View File

@ -34,12 +34,21 @@
#ifndef EMUDSOUND_H
#define EMUDSOUND_H
#include "Common/Xbe.h"
#undef FIELD_OFFSET // prevent macro redefinition warnings
#include <windows.h>
#include <dsound.h>
#include "CxbxKrnl.h"
#include "Emu.h"
#ifdef __cplusplus
extern "C" {
#endif
void CxbxInitAudio();
#ifdef __cplusplus
}
#endif
// EmuIDirectSoundBuffer_Play flags
#define X_DSBPLAY_LOOPING 0x00000001