Fix a copypaste typo in GetFormat_4034_lower and change its signature

Allows GetFormat() to be used more cleanly
This commit is contained in:
Silent 2020-10-14 23:42:55 +02:00
parent 8ae094d730
commit 3dcf1e67e0
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1
2 changed files with 10 additions and 6 deletions

View File

@ -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

View File

@ -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);