Merge pull request #1995 from CookiePLMonster/dsound-improvements-split
Dsound improvements (split)
This commit is contained in:
commit
d9ec4342d7
|
@ -748,11 +748,6 @@ xbox::hresult_xt WINAPI xbox::EMUPATCH(IDirectSoundBuffer_SetBufferData)
|
|||
pThis->X_lock.dwLockBytes2);
|
||||
}
|
||||
|
||||
//TODO: Current workaround method since dwBufferBytes do set to zero. Otherwise it will produce lock error message.
|
||||
if (dwBufferBytes == 0) {
|
||||
|
||||
return DS_OK;
|
||||
}
|
||||
HRESULT hRet = DSERR_OUTOFMEMORY;
|
||||
DWORD dwStatus;
|
||||
|
||||
|
@ -765,6 +760,12 @@ xbox::hresult_xt WINAPI xbox::EMUPATCH(IDirectSoundBuffer_SetBufferData)
|
|||
pThis->EmuDirectSoundBuffer8->GetStatus(&dwStatus);
|
||||
}
|
||||
|
||||
//TODO: Current workaround method since dwBufferBytes do set to zero. Otherwise it will produce lock error message.
|
||||
if (dwBufferBytes == 0) {
|
||||
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
// Allocate memory whenever made request internally
|
||||
if (pvBufferData == xbox::zeroptr && DSoundSGEMenAllocCheck(dwBufferBytes)) {
|
||||
|
||||
|
|
|
@ -28,22 +28,26 @@
|
|||
|
||||
// Interface for get format
|
||||
template<class T>
|
||||
void GetFormat_4034_lower(T& settings, xbox::audio_format& format)
|
||||
xbox::audio_format GetFormat_4034_lower(T& settings)
|
||||
{
|
||||
format.audio_codec = settings.p_audio_format->wfx.wFormatTag = format.audio_codec;
|
||||
xbox::audio_format format;
|
||||
format.audio_codec = settings.p_audio_format->wfx.wFormatTag;
|
||||
format.nChannels = settings.p_audio_format->wfx.nChannels;
|
||||
format.cbSize = settings.p_audio_format->wfx.cbSize;
|
||||
format.nSamplesPerSec = settings.p_audio_format->wfx.nSamplesPerSec;
|
||||
format.bitsPerSample = settings.p_audio_format->wfx.wBitsPerSample;
|
||||
return format;
|
||||
}
|
||||
template<class T>
|
||||
void GetFormat_4039_upper(T& settings, xbox::audio_format& format)
|
||||
xbox::audio_format GetFormat_4039_upper(T& settings)
|
||||
{
|
||||
xbox::audio_format format;
|
||||
format.audio_codec = settings.audio_codec;
|
||||
format.nChannels = settings.nChannels;
|
||||
format.cbSize = settings.cbSize;
|
||||
format.nSamplesPerSec = settings.nSamplesPerSec_default;
|
||||
format.bitsPerSample = settings.bitsPerSample;
|
||||
return format;
|
||||
}
|
||||
|
||||
// Interface for set format
|
||||
|
|
|
@ -146,7 +146,7 @@ struct CDirectSoundVoice : CUnknownGenericManager {
|
|||
static_assert(sizeof(_settings) == 0x300); // Not really require
|
||||
|
||||
// Generic interface without need to check xdk's build revision every time.
|
||||
typedef void (*pGetFormat)(_settings& settings, audio_format& format);
|
||||
typedef audio_format (*pGetFormat)(_settings& settings);
|
||||
typedef void (*pSetFormat)(_settings& settings, audio_format format);
|
||||
typedef uint32_t (*pGetUint32)(_settings& settings);
|
||||
typedef void (*pSetUint32)(_settings& settings, uint32_t value);
|
||||
|
@ -165,8 +165,8 @@ struct CDirectSoundVoice : CUnknownGenericManager {
|
|||
} funcs;
|
||||
static_assert(sizeof(funcs) == 0x24); // Not really require
|
||||
|
||||
inline void GetFormat(audio_format& format) {
|
||||
funcs.GetFormat(settings, format);
|
||||
inline audio_format GetFormat() {
|
||||
return funcs.GetFormat(settings);
|
||||
};
|
||||
inline void SetFormat(audio_format format) {
|
||||
funcs.SetFormat(settings, format);
|
||||
|
|
Loading…
Reference in New Issue