finally clean up redundant codes
This commit is contained in:
parent
04dce78f53
commit
e91d1bf23c
|
@ -428,7 +428,7 @@ static inline void DSoundBufferTransferSettings(
|
||||||
}
|
}
|
||||||
|
|
||||||
// if sync current frequency used (then use pitch only).
|
// if sync current frequency used (then use pitch only).
|
||||||
uint32_t freq = XTL::converter_pitch2freq(Xb_Voice->GetPitch(Xb_Voice));
|
uint32_t freq = XTL::converter_pitch2freq(Xb_Voice->GetPitch());
|
||||||
pDSBufferNew->SetFrequency(freq);
|
pDSBufferNew->SetFrequency(freq);
|
||||||
|
|
||||||
pDSBufferOld->GetVolume(&lVolume);
|
pDSBufferOld->GetVolume(&lVolume);
|
||||||
|
@ -1125,7 +1125,7 @@ static inline HRESULT HybridDirectSoundBuffer_SetFrequency(
|
||||||
{
|
{
|
||||||
HRESULT hRet = S_OK;
|
HRESULT hRet = S_OK;
|
||||||
|
|
||||||
int32_t pitch = XTL::converter_freq2pitch((dwFrequency!=0 ? dwFrequency : Xb_Voice->GetFrequencyDefault(Xb_Voice)));
|
int32_t pitch = XTL::converter_freq2pitch((dwFrequency!=0 ? dwFrequency : Xb_Voice->GetFrequencyDefault()));
|
||||||
|
|
||||||
hRet = HybridDirectSoundBuffer_SetPitch(pDSBuffer, pitch, Xb_Voice);
|
hRet = HybridDirectSoundBuffer_SetPitch(pDSBuffer, pitch, Xb_Voice);
|
||||||
|
|
||||||
|
@ -1150,8 +1150,8 @@ static inline HRESULT HybridDirectSoundBuffer_SetHeadroom(
|
||||||
hRet = DSERR_INVALIDPARAM;
|
hRet = DSERR_INVALIDPARAM;
|
||||||
} else {
|
} else {
|
||||||
hRet = DS_OK;
|
hRet = DS_OK;
|
||||||
Xb_Voice->SetHeadroom(Xb_Voice, dwHeadroom);
|
Xb_Voice->SetHeadroom(dwHeadroom);
|
||||||
uint32_t volume = Xb_Voice->GetVolume(Xb_Voice);
|
uint32_t volume = Xb_Voice->GetVolume();
|
||||||
pDSBuffer->SetVolume(volume);
|
pDSBuffer->SetVolume(volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1340,7 +1340,7 @@ static inline HRESULT HybridDirectSoundBuffer_SetPitch(
|
||||||
XTL::CDirectSoundVoice* Xb_Voice)
|
XTL::CDirectSoundVoice* Xb_Voice)
|
||||||
{
|
{
|
||||||
|
|
||||||
Xb_Voice->SetPitch(Xb_Voice, lPitch);
|
Xb_Voice->SetPitch(lPitch);
|
||||||
// Convert pitch back to frequency
|
// Convert pitch back to frequency
|
||||||
uint32_t setFrequency = XTL::converter_pitch2freq(lPitch);
|
uint32_t setFrequency = XTL::converter_pitch2freq(lPitch);
|
||||||
|
|
||||||
|
@ -1436,8 +1436,8 @@ static inline HRESULT HybridDirectSoundBuffer_SetVolume(
|
||||||
printf("DEBUG: SetVolume | lVolume = %ld | volumeMixbin = %ld | dwHeadroom = %8u\n", lVolume, Xb_volumeMixbin, Xb_dwHeadroom);
|
printf("DEBUG: SetVolume | lVolume = %ld | volumeMixbin = %ld | dwHeadroom = %8u\n", lVolume, Xb_volumeMixbin, Xb_dwHeadroom);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Xb_Voice->SetVolume(Xb_Voice, lVolume);
|
Xb_Voice->SetVolume(lVolume);
|
||||||
lVolume = Xb_Voice->GetVolume(Xb_Voice);
|
lVolume = Xb_Voice->GetVolume();
|
||||||
lVolume += Xb_volumeMixbin;
|
lVolume += Xb_volumeMixbin;
|
||||||
|
|
||||||
if ((dwEmuFlags & DSE_FLAG_PCM) > 0) {
|
if ((dwEmuFlags & DSE_FLAG_PCM) > 0) {
|
||||||
|
|
|
@ -27,237 +27,174 @@
|
||||||
#include "XbInternalStruct.hpp"
|
#include "XbInternalStruct.hpp"
|
||||||
|
|
||||||
// Interface for get format
|
// Interface for get format
|
||||||
void GetFormat_4034_lower(XTL::CDirectSoundVoice::_u& u, XTL::audio_format& format)
|
template<class T>
|
||||||
|
void GetFormat_4034_lower(T& settings, XTL::audio_format& format)
|
||||||
{
|
{
|
||||||
format.audio_codec = u.settings_4034_lower.p_audio_format->wfx.wFormatTag = format.audio_codec;
|
format.audio_codec = settings.p_audio_format->wfx.wFormatTag = format.audio_codec;
|
||||||
format.nChannels = u.settings_4034_lower.p_audio_format->wfx.nChannels;
|
format.nChannels = settings.p_audio_format->wfx.nChannels;
|
||||||
format.cbSize = u.settings_4034_lower.p_audio_format->wfx.cbSize;
|
format.cbSize = settings.p_audio_format->wfx.cbSize;
|
||||||
format.nSamplesPerSec = u.settings_4034_lower.p_audio_format->wfx.nSamplesPerSec;
|
format.nSamplesPerSec = settings.p_audio_format->wfx.nSamplesPerSec;
|
||||||
format.bitsPerSample = u.settings_4034_lower.p_audio_format->wfx.wBitsPerSample;
|
format.bitsPerSample = settings.p_audio_format->wfx.wBitsPerSample;
|
||||||
}
|
}
|
||||||
void GetFormat_4039_only(XTL::CDirectSoundVoice::_u& u, XTL::audio_format& format)
|
template<class T>
|
||||||
|
void GetFormat_4039_upper(T& settings, XTL::audio_format& format)
|
||||||
{
|
{
|
||||||
format.audio_codec = u.settings_4039_only.audio_codec;
|
format.audio_codec = settings.audio_codec;
|
||||||
format.nChannels = u.settings_4039_only.nChannels;
|
format.nChannels = settings.nChannels;
|
||||||
format.cbSize = u.settings_4039_only.cbSize;
|
format.cbSize = settings.cbSize;
|
||||||
format.nSamplesPerSec = u.settings_4039_only.nSamplesPerSec_default;
|
format.nSamplesPerSec = settings.nSamplesPerSec_default;
|
||||||
format.bitsPerSample = u.settings_4039_only.bitsPerSample;
|
format.bitsPerSample = settings.bitsPerSample;
|
||||||
}
|
|
||||||
void GetFormat_4134_upper(XTL::CDirectSoundVoice::_u& u, XTL::audio_format& format)
|
|
||||||
{
|
|
||||||
format.audio_codec = u.settings_4134_upper.audio_codec;
|
|
||||||
format.nChannels = u.settings_4134_upper.nChannels;
|
|
||||||
format.cbSize = u.settings_4134_upper.cbSize;
|
|
||||||
format.nSamplesPerSec = u.settings_4134_upper.nSamplesPerSec_default;
|
|
||||||
format.bitsPerSample = u.settings_4134_upper.bitsPerSample;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interface for set format
|
// Interface for set format
|
||||||
void SetFormat_4034_lower(XTL::CDirectSoundVoice::_u& u, XTL::audio_format format)
|
template<class T>
|
||||||
|
void SetFormat_4034_lower(T& settings, XTL::audio_format format)
|
||||||
{
|
{
|
||||||
u.settings_4034_lower.p_audio_format->wfx.wFormatTag = format.audio_codec;
|
settings.p_audio_format->wfx.wFormatTag = format.audio_codec;
|
||||||
u.settings_4034_lower.p_audio_format->wfx.nChannels = static_cast<uint16_t>(format.nChannels);
|
settings.p_audio_format->wfx.nChannels = static_cast<uint16_t>(format.nChannels);
|
||||||
u.settings_4034_lower.p_audio_format->wfx.cbSize = static_cast<uint16_t>(format.cbSize);
|
settings.p_audio_format->wfx.cbSize = static_cast<uint16_t>(format.cbSize);
|
||||||
u.settings_4034_lower.p_audio_format->wfx.nSamplesPerSec = format.nSamplesPerSec;
|
settings.p_audio_format->wfx.nSamplesPerSec = format.nSamplesPerSec;
|
||||||
u.settings_4034_lower.p_audio_format->wfx.wBitsPerSample = static_cast<uint16_t>(format.bitsPerSample);
|
settings.p_audio_format->wfx.wBitsPerSample = static_cast<uint16_t>(format.bitsPerSample);
|
||||||
if (format.audio_codec == WAVE_FORMAT_XBOX_ADPCM) {
|
if (format.audio_codec == WAVE_FORMAT_XBOX_ADPCM) {
|
||||||
u.settings_4034_lower.p_audio_format->wSamplesPerBlock = 64;
|
settings.p_audio_format->wSamplesPerBlock = 64;
|
||||||
}
|
}
|
||||||
u.settings_4039_only.pitch = XTL::converter_freq2pitch(format.nSamplesPerSec);
|
settings.pitch = XTL::converter_freq2pitch(format.nSamplesPerSec);
|
||||||
}
|
}
|
||||||
void SetFormat_4039_only(XTL::CDirectSoundVoice::_u& u, XTL::audio_format format)
|
template<class T>
|
||||||
|
void SetFormat_4039_only(T& settings, XTL::audio_format format)
|
||||||
{
|
{
|
||||||
u.settings_4039_only.audio_codec = format.audio_codec;
|
settings.audio_codec = format.audio_codec;
|
||||||
u.settings_4039_only.nChannels = format.nChannels;
|
settings.nChannels = format.nChannels;
|
||||||
u.settings_4039_only.cbSize = format.cbSize;
|
settings.cbSize = format.cbSize;
|
||||||
u.settings_4039_only.nSamplesPerSec_default = format.nSamplesPerSec;
|
settings.nSamplesPerSec_default = format.nSamplesPerSec;
|
||||||
u.settings_4039_only.bitsPerSample = format.bitsPerSample;
|
settings.bitsPerSample = format.bitsPerSample;
|
||||||
u.settings_4039_only.pitch = XTL::converter_freq2pitch(format.nSamplesPerSec);
|
settings.pitch = XTL::converter_freq2pitch(format.nSamplesPerSec);
|
||||||
}
|
}
|
||||||
void SetFormat_4134_upper(XTL::CDirectSoundVoice::_u& u, XTL::audio_format format)
|
template<class T>
|
||||||
|
void SetFormat_4134_upper(T& settings, XTL::audio_format format)
|
||||||
{
|
{
|
||||||
u.settings_4134_upper.audio_codec = static_cast<uint16_t>(format.audio_codec);
|
settings.audio_codec = static_cast<uint16_t>(format.audio_codec);
|
||||||
u.settings_4134_upper.nChannels = static_cast<uint8_t>(format.nChannels);
|
settings.nChannels = static_cast<uint8_t>(format.nChannels);
|
||||||
u.settings_4134_upper.cbSize = static_cast<uint8_t>(format.cbSize);
|
settings.cbSize = static_cast<uint8_t>(format.cbSize);
|
||||||
u.settings_4134_upper.nSamplesPerSec_default = format.nSamplesPerSec;
|
settings.nSamplesPerSec_default = format.nSamplesPerSec;
|
||||||
u.settings_4134_upper.bitsPerSample = format.bitsPerSample;
|
settings.bitsPerSample = format.bitsPerSample;
|
||||||
u.settings_4134_upper.pitch = XTL::converter_freq2pitch(format.nSamplesPerSec);
|
settings.pitch = XTL::converter_freq2pitch(format.nSamplesPerSec);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interface for get frequency
|
// Interface for get frequency
|
||||||
uint32_t GetFrequencyDefault_4034_lower(XTL::CDirectSoundVoice::_u& u)
|
template<class T>
|
||||||
|
uint32_t GetFrequencyDefault_4034_lower(T& settings)
|
||||||
{
|
{
|
||||||
return u.settings_4034_lower.p_audio_format->wfx.nSamplesPerSec;
|
return settings.p_audio_format->wfx.nSamplesPerSec;
|
||||||
}
|
}
|
||||||
uint32_t GetFrequencyDefault_4039_only(XTL::CDirectSoundVoice::_u& u)
|
template<class T>
|
||||||
|
uint32_t GetFrequencyDefault_4039_upper(T& settings)
|
||||||
{
|
{
|
||||||
return u.settings_4039_only.nSamplesPerSec_default;
|
return settings.nSamplesPerSec_default;
|
||||||
}
|
|
||||||
uint32_t GetFrequencyDefault_4134_upper(XTL::CDirectSoundVoice::_u& u)
|
|
||||||
{
|
|
||||||
return u.settings_4134_upper.nSamplesPerSec_default;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interface for get pitch
|
// Interface for get pitch
|
||||||
int32_t GetPitch_4034_lower(XTL::CDirectSoundVoice::_u& u)
|
template<class T>
|
||||||
|
int32_t GetPitch(T& settings)
|
||||||
{
|
{
|
||||||
return u.settings_4034_lower.pitch;
|
return settings.pitch;
|
||||||
}
|
|
||||||
int32_t GetPitch_4039_only(XTL::CDirectSoundVoice::_u& u)
|
|
||||||
{
|
|
||||||
return u.settings_4039_only.pitch;
|
|
||||||
}
|
|
||||||
int32_t GetPitch_4134_upper(XTL::CDirectSoundVoice::_u& u)
|
|
||||||
{
|
|
||||||
return u.settings_4134_upper.pitch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interface for set pitch
|
// Interface for set pitch
|
||||||
void SetPitch_4034_lower(XTL::CDirectSoundVoice::_u& u, int32_t pitch)
|
template<class T>
|
||||||
|
void SetPitch(T& settings, int32_t pitch)
|
||||||
{
|
{
|
||||||
u.settings_4034_lower.pitch = pitch;
|
settings.pitch = pitch;
|
||||||
}
|
|
||||||
void SetPitch_4039_only(XTL::CDirectSoundVoice::_u& u, int32_t pitch)
|
|
||||||
{
|
|
||||||
u.settings_4039_only.pitch = pitch;
|
|
||||||
}
|
|
||||||
void SetPitch_4134_upper(XTL::CDirectSoundVoice::_u& u, int32_t pitch)
|
|
||||||
{
|
|
||||||
u.settings_4134_upper.pitch = pitch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interface for get volume
|
// Interface for get volume
|
||||||
uint32_t GetVolume_4034_lower(XTL::CDirectSoundVoice::_u& u)
|
template<class T>
|
||||||
|
uint32_t GetVolume(T& settings)
|
||||||
{
|
{
|
||||||
return u.settings_4034_lower.volume;
|
return settings.volume;
|
||||||
}
|
|
||||||
uint32_t GetVolume_4039_only(XTL::CDirectSoundVoice::_u& u)
|
|
||||||
{
|
|
||||||
return u.settings_4039_only.volume;
|
|
||||||
}
|
|
||||||
uint32_t GetVolume_4134_upper(XTL::CDirectSoundVoice::_u& u)
|
|
||||||
{
|
|
||||||
return u.settings_4134_upper.volume;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetVolume_calc(uint32_t& cur_volume, uint32_t headroom, uint32_t set_volume)
|
|
||||||
{
|
|
||||||
cur_volume = set_volume - headroom;
|
|
||||||
}
|
|
||||||
// Interface for set volume
|
// Interface for set volume
|
||||||
void SetVolume_4034_lower(XTL::CDirectSoundVoice::_u& u, uint32_t volume)
|
template<class T>
|
||||||
|
void SetVolume(T& settings, uint32_t volume)
|
||||||
{
|
{
|
||||||
SetVolume_calc(u.settings_4034_lower.volume, u.settings_4034_lower.headroom, volume);
|
settings.volume = volume - settings.headroom;
|
||||||
}
|
|
||||||
void SetVolume_4039_only(XTL::CDirectSoundVoice::_u& u, uint32_t volume)
|
|
||||||
{
|
|
||||||
SetVolume_calc(u.settings_4039_only.volume, u.settings_4039_only.headroom, volume);
|
|
||||||
}
|
|
||||||
void SetVolume_4134_upper(XTL::CDirectSoundVoice::_u& u, uint32_t volume)
|
|
||||||
{
|
|
||||||
SetVolume_calc(u.settings_4134_upper.volume, u.settings_4134_upper.headroom, volume);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interface for get headroom
|
// Interface for get headroom
|
||||||
uint32_t GetHeadroom_4034_lower(XTL::CDirectSoundVoice::_u& u)
|
template<class T>
|
||||||
|
uint32_t GetHeadroom(T& settings)
|
||||||
{
|
{
|
||||||
return u.settings_4034_lower.headroom;
|
return settings.headroom;
|
||||||
}
|
|
||||||
uint32_t GetHeadroom_4039_only(XTL::CDirectSoundVoice::_u& u)
|
|
||||||
{
|
|
||||||
return u.settings_4039_only.headroom;
|
|
||||||
}
|
|
||||||
uint32_t GetHeadroom_4134_upper(XTL::CDirectSoundVoice::_u& u)
|
|
||||||
{
|
|
||||||
return u.settings_4134_upper.headroom;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetHeadroom_calc(uint32_t& cur_headroom, uint32_t& volume, uint32_t set_headroom)
|
|
||||||
{
|
|
||||||
volume = volume - set_headroom - cur_headroom;
|
|
||||||
cur_headroom = set_headroom;
|
|
||||||
}
|
|
||||||
// Interface for set headroom
|
// Interface for set headroom
|
||||||
void SetHeadroom_4034_lower(XTL::CDirectSoundVoice::_u& u, uint32_t headroom)
|
template<class T>
|
||||||
|
void SetHeadroom(T& settings, uint32_t set_headroom)
|
||||||
{
|
{
|
||||||
SetHeadroom_calc(u.settings_4034_lower.headroom, u.settings_4034_lower.volume, headroom);
|
settings.volume = settings.volume - set_headroom - settings.headroom;
|
||||||
}
|
settings.headroom = set_headroom;
|
||||||
void SetHeadroom_4039_only(XTL::CDirectSoundVoice::_u& u, uint32_t headroom)
|
|
||||||
{
|
|
||||||
SetHeadroom_calc(u.settings_4039_only.headroom, u.settings_4039_only.volume, headroom);
|
|
||||||
}
|
|
||||||
void SetHeadroom_4134_upper(XTL::CDirectSoundVoice::_u& u, uint32_t headroom)
|
|
||||||
{
|
|
||||||
SetHeadroom_calc(u.settings_4134_upper.headroom, u.settings_4134_upper.volume, headroom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init_Headroom(uint32_t& headroom, bool is3D)
|
void Init_Headroom(uint32_t& headroom, bool is3D)
|
||||||
{
|
{
|
||||||
headroom = is3D? 0 : 600;
|
headroom = is3D? 0 : 600;
|
||||||
}
|
}
|
||||||
void Init_4034_lower(XTL::CDirectSoundVoice::_u::_settings_4034_lower& settings, bool is3D)
|
template<class T>
|
||||||
|
void Init(T& settings, bool is3D)
|
||||||
{
|
{
|
||||||
Init_Headroom(settings.headroom, is3D);
|
Init_Headroom(settings.headroom, is3D);
|
||||||
settings.volume = 0 - settings.headroom;
|
settings.volume = 0 - settings.headroom;
|
||||||
}
|
|
||||||
void Init_4039_only(XTL::CDirectSoundVoice::_u::_settings_4039_only& settings, bool is3D)
|
|
||||||
{
|
|
||||||
Init_Headroom(settings.headroom, is3D);
|
|
||||||
settings.volume = 0 - settings.headroom;
|
|
||||||
}
|
|
||||||
void Init_4134_upper(XTL::CDirectSoundVoice::_u::_settings_4134_upper& settings, bool is3D)
|
|
||||||
{
|
|
||||||
Init_Headroom(settings.headroom, is3D);
|
|
||||||
settings.volume = 0 - settings.headroom;
|
settings.volume = 0 - settings.headroom;
|
||||||
}
|
}
|
||||||
|
|
||||||
XTL::CDirectSoundVoice::CDirectSoundVoice(bool is3D)
|
XTL::CDirectSoundVoice::CDirectSoundVoice(bool is3D)
|
||||||
{
|
{
|
||||||
memset(u.settings_interface.unknown_08, 0, sizeof(u.settings_interface));
|
u = { 0 };
|
||||||
|
|
||||||
if (g_LibVersion_DSOUND < 4039) {
|
if (g_LibVersion_DSOUND < 4039) {
|
||||||
u.settings_4034_lower.p_audio_format = new XBOXADPCMWAVEFORMAT;
|
u.settings_4034_lower.p_audio_format = new XBOXADPCMWAVEFORMAT;
|
||||||
memset(&u.settings_4034_lower.p_audio_format->wfx, 0, sizeof(XBOXADPCMWAVEFORMAT));
|
memset(&u.settings_4034_lower.p_audio_format->wfx, 0, sizeof(XBOXADPCMWAVEFORMAT));
|
||||||
|
|
||||||
Init_4034_lower(u.settings_4034_lower, is3D);
|
Init<_u::_settings_4034_lower>(u.settings_4034_lower, is3D);
|
||||||
|
|
||||||
funcs.GetFormat = GetFormat_4034_lower;
|
funcs.GetFormat = reinterpret_cast<void(*)(_u&, audio_format&)>(::GetFormat_4034_lower<_u::_settings_4034_lower>);
|
||||||
funcs.SetFormat = SetFormat_4034_lower;
|
funcs.SetFormat = reinterpret_cast<void(*)(_u&, audio_format)>(::SetFormat_4034_lower<_u::_settings_4034_lower>);
|
||||||
funcs.GetFrequencyDefault = GetFrequencyDefault_4034_lower;
|
funcs.GetFrequencyDefault = reinterpret_cast<uint32_t(*)(_u&)>(::GetFrequencyDefault_4034_lower<_u::_settings_4034_lower>);
|
||||||
funcs.GetPitch = GetPitch_4034_lower;
|
funcs.GetPitch = reinterpret_cast<int32_t(*)(_u&)>(::GetPitch<_u::_settings_4034_lower>);
|
||||||
funcs.SetPitch = SetPitch_4034_lower;
|
funcs.SetPitch = reinterpret_cast<void(*)(_u&, int32_t)>(::SetPitch<_u::_settings_4034_lower>);
|
||||||
funcs.GetVolume = GetVolume_4034_lower;
|
funcs.GetVolume = reinterpret_cast<uint32_t(*)(_u&)>(::GetVolume<_u::_settings_4034_lower>);
|
||||||
funcs.SetVolume = SetVolume_4034_lower;
|
funcs.SetVolume = reinterpret_cast<void(*)(_u&, uint32_t)>(::SetVolume<_u::_settings_4034_lower>);
|
||||||
funcs.GetHeadroom = GetHeadroom_4034_lower;
|
funcs.GetHeadroom = reinterpret_cast<uint32_t(*)(_u&)>(::GetHeadroom<_u::_settings_4034_lower>);
|
||||||
funcs.SetHeadroom = SetHeadroom_4034_lower;
|
funcs.SetHeadroom = reinterpret_cast<void(*)(_u&, uint32_t)>(::SetHeadroom<_u::_settings_4034_lower>);
|
||||||
}
|
}
|
||||||
else if (g_LibVersion_DSOUND == 4039) {
|
else if (g_LibVersion_DSOUND == 4039) {
|
||||||
|
|
||||||
Init_4039_only(u.settings_4039_only, is3D);
|
Init<_u::_settings_4039_only>(u.settings_4039_only, is3D);
|
||||||
|
|
||||||
funcs.GetFormat = GetFormat_4039_only;
|
funcs.GetFormat = reinterpret_cast<void(*)(_u&, audio_format&)>(::GetFormat_4039_upper<_u::_settings_4039_only>);
|
||||||
funcs.SetFormat = SetFormat_4039_only;
|
funcs.SetFormat = reinterpret_cast<void(*)(_u&, audio_format)>(::SetFormat_4039_only<_u::_settings_4039_only>);
|
||||||
funcs.GetFrequencyDefault = GetFrequencyDefault_4039_only;
|
funcs.GetFrequencyDefault = reinterpret_cast<uint32_t(*)(_u&)>(::GetFrequencyDefault_4039_upper<_u::_settings_4039_only>);
|
||||||
funcs.GetPitch = GetPitch_4039_only;
|
funcs.GetPitch = reinterpret_cast<int32_t(*)(_u&)>(::GetPitch<_u::_settings_4039_only>);
|
||||||
funcs.SetPitch = SetPitch_4039_only;
|
funcs.SetPitch = reinterpret_cast<void(*)(_u&, int32_t)>(::SetPitch<_u::_settings_4039_only>);
|
||||||
funcs.GetVolume = GetVolume_4039_only;
|
funcs.GetVolume = reinterpret_cast<uint32_t(*)(_u&)>(::GetVolume<_u::_settings_4039_only>);
|
||||||
funcs.SetVolume = SetVolume_4039_only;
|
funcs.SetVolume = reinterpret_cast<void(*)(_u&, uint32_t)>(::SetVolume<_u::_settings_4039_only>);
|
||||||
funcs.GetHeadroom = GetHeadroom_4039_only;
|
funcs.GetHeadroom = reinterpret_cast<uint32_t(*)(_u&)>(::GetHeadroom<_u::_settings_4039_only>);
|
||||||
funcs.SetHeadroom = SetHeadroom_4039_only;
|
funcs.SetHeadroom = reinterpret_cast<void(*)(_u&, uint32_t)>(::SetHeadroom<_u::_settings_4039_only>);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
Init_4134_upper(u.settings_4134_upper, is3D);
|
Init<_u::_settings_4134_upper>(u.settings_4134_upper, is3D);
|
||||||
|
|
||||||
funcs.GetFormat = GetFormat_4134_upper;
|
funcs.GetFormat = reinterpret_cast<void(*)(_u&, audio_format&)>(::GetFormat_4039_upper<_u::_settings_4134_upper>);
|
||||||
funcs.SetFormat = SetFormat_4134_upper;
|
funcs.SetFormat = reinterpret_cast<void(*)(_u&, audio_format)>(::SetFormat_4134_upper<_u::_settings_4134_upper>);
|
||||||
funcs.GetFrequencyDefault = GetFrequencyDefault_4134_upper;
|
funcs.GetFrequencyDefault = reinterpret_cast<uint32_t(*)(_u&)>(::GetFrequencyDefault_4039_upper<_u::_settings_4134_upper>);
|
||||||
funcs.GetPitch = GetPitch_4134_upper;
|
funcs.GetPitch = reinterpret_cast<int32_t(*)(_u&)>(::GetPitch<_u::_settings_4134_upper>);
|
||||||
funcs.SetPitch = SetPitch_4134_upper;
|
funcs.SetPitch = reinterpret_cast<void(*)(_u&, int32_t)>(::SetPitch<_u::_settings_4134_upper>);
|
||||||
funcs.GetVolume = GetVolume_4134_upper;
|
funcs.GetVolume = reinterpret_cast<uint32_t(*)(_u&)>(::GetVolume<_u::_settings_4134_upper>);
|
||||||
funcs.SetVolume = SetVolume_4134_upper;
|
funcs.SetVolume = reinterpret_cast<void(*)(_u&, uint32_t)>(::SetVolume<_u::_settings_4134_upper>);
|
||||||
funcs.GetHeadroom = GetHeadroom_4134_upper;
|
funcs.GetHeadroom = reinterpret_cast<uint32_t(*)(_u&)>(::GetHeadroom<_u::_settings_4134_upper>);
|
||||||
funcs.SetHeadroom = SetHeadroom_4134_upper;
|
funcs.SetHeadroom = reinterpret_cast<void(*)(_u&, uint32_t)>(::SetHeadroom<_u::_settings_4134_upper>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,32 +148,32 @@ struct CDirectSoundVoice : CUnknownGenericManager {
|
||||||
} funcs;
|
} funcs;
|
||||||
static_assert(sizeof(funcs) == 0x24);
|
static_assert(sizeof(funcs) == 0x24);
|
||||||
|
|
||||||
static inline void GetFormat(CDirectSoundVoice* pThis, audio_format& format) {
|
inline void GetFormat(audio_format& format) {
|
||||||
pThis->funcs.GetFormat(pThis->u, format);
|
funcs.GetFormat(u, format);
|
||||||
};
|
};
|
||||||
static inline void SetFormat(CDirectSoundVoice* pThis, audio_format format) {
|
inline void SetFormat(audio_format format) {
|
||||||
pThis->funcs.SetFormat(pThis->u, format);
|
funcs.SetFormat(u, format);
|
||||||
};
|
};
|
||||||
static inline uint32_t GetFrequencyDefault(CDirectSoundVoice* pThis) {
|
inline uint32_t GetFrequencyDefault() {
|
||||||
return pThis->funcs.GetFrequencyDefault(pThis->u);
|
return funcs.GetFrequencyDefault(u);
|
||||||
};
|
};
|
||||||
static inline int32_t GetPitch(CDirectSoundVoice* pThis) {
|
inline int32_t GetPitch() {
|
||||||
return pThis->funcs.GetPitch(pThis->u);
|
return funcs.GetPitch(u);
|
||||||
};
|
};
|
||||||
static inline void SetPitch(CDirectSoundVoice* pThis, int32_t pitch) {
|
inline void SetPitch(int32_t pitch) {
|
||||||
pThis->funcs.SetPitch(pThis->u, pitch);
|
funcs.SetPitch(u, pitch);
|
||||||
};
|
};
|
||||||
static inline uint32_t GetVolume(CDirectSoundVoice* pThis) {
|
inline uint32_t GetVolume() {
|
||||||
return pThis->funcs.GetVolume(pThis->u);
|
return funcs.GetVolume(u);
|
||||||
};
|
};
|
||||||
static inline void SetVolume(CDirectSoundVoice* pThis, uint32_t volume) {
|
inline void SetVolume(uint32_t volume) {
|
||||||
pThis->funcs.SetVolume(pThis->u, volume);
|
funcs.SetVolume(u, volume);
|
||||||
};
|
};
|
||||||
static inline uint32_t GetHeadroom(CDirectSoundVoice* pThis) {
|
inline uint32_t GetHeadroom() {
|
||||||
return pThis->funcs.GetHeadroom(pThis->u);
|
return funcs.GetHeadroom(u);
|
||||||
};
|
};
|
||||||
static inline void SetHeadroom(CDirectSoundVoice* pThis, uint32_t headroom) {
|
inline void SetHeadroom(uint32_t headroom) {
|
||||||
pThis->funcs.SetHeadroom(pThis->u, headroom);
|
funcs.SetHeadroom(u, headroom);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
static_assert(sizeof(CDirectSoundVoice) == sizeof(CUnknownGenericManager) + sizeof(CDirectSoundVoice::_u) + sizeof(CDirectSoundVoice::funcs));
|
static_assert(sizeof(CDirectSoundVoice) == sizeof(CUnknownGenericManager) + sizeof(CDirectSoundVoice::_u) + sizeof(CDirectSoundVoice::funcs));
|
||||||
|
|
|
@ -340,7 +340,7 @@ static CODEC_FORMAT WFXformat_SyncHostFormat(
|
||||||
xb_format.cbSize = (codec_format_ret == CF_XADPCM ? 4 : 0);
|
xb_format.cbSize = (codec_format_ret == CF_XADPCM ? 4 : 0);
|
||||||
xb_format.nSamplesPerSec = Host_wfxFormat->Format.nSamplesPerSec;
|
xb_format.nSamplesPerSec = Host_wfxFormat->Format.nSamplesPerSec;
|
||||||
xb_format.bitsPerSample = (codec_format_ret == CF_XADPCM ? 4 : Host_wfxFormat->Format.wBitsPerSample);
|
xb_format.bitsPerSample = (codec_format_ret == CF_XADPCM ? 4 : Host_wfxFormat->Format.wBitsPerSample);
|
||||||
Xb_Voice->SetFormat(Xb_Voice, xb_format);
|
Xb_Voice->SetFormat(xb_format);
|
||||||
|
|
||||||
return codec_format_ret;
|
return codec_format_ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue