forward xbox audio format to internal voice class
This commit is contained in:
parent
18a22cd934
commit
04dce78f53
|
@ -290,7 +290,7 @@ static inline void GeneratePCMFormat(
|
||||||
|
|
||||||
dwEmuFlags = dwEmuFlags & ~DSE_FLAG_AUDIO_CODECS;
|
dwEmuFlags = dwEmuFlags & ~DSE_FLAG_AUDIO_CODECS;
|
||||||
|
|
||||||
CODEC_FORMAT cf_audio = WFXformat_SyncHostFormat(DSBufferDesc.lpwfxFormat, Xb_lpwfxFormat, X_BufferSizeRequest, Xb_flags);
|
CODEC_FORMAT cf_audio = WFXformat_SyncHostFormat(DSBufferDesc.lpwfxFormat, Xb_lpwfxFormat, X_BufferSizeRequest, Xb_flags, Xb_Voice);
|
||||||
if (cf_audio == CF_PCM) {
|
if (cf_audio == CF_PCM) {
|
||||||
dwEmuFlags |= DSE_FLAG_PCM;
|
dwEmuFlags |= DSE_FLAG_PCM;
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ static inline void GeneratePCMFormat(
|
||||||
} else {
|
} else {
|
||||||
dwEmuFlags |= DSE_FLAG_RECIEVEDATA;
|
dwEmuFlags |= DSE_FLAG_RECIEVEDATA;
|
||||||
|
|
||||||
(void)WFXformat_SyncHostFormat(DSBufferDesc.lpwfxFormat, Xb_lpwfxFormat, X_BufferSizeRequest, Xb_flags);
|
(void)WFXformat_SyncHostFormat(DSBufferDesc.lpwfxFormat, Xb_lpwfxFormat, X_BufferSizeRequest, Xb_flags, Xb_Voice);
|
||||||
|
|
||||||
DSBufferDesc.dwFlags = DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY;
|
DSBufferDesc.dwFlags = DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY;
|
||||||
DSBufferDesc.dwBufferBytes = 5 * DSBufferDesc.lpwfxFormat->nAvgBytesPerSec;
|
DSBufferDesc.dwBufferBytes = 5 * DSBufferDesc.lpwfxFormat->nAvgBytesPerSec;
|
||||||
|
|
|
@ -251,15 +251,17 @@ static void WFXformat_SanityFix(
|
||||||
}
|
}
|
||||||
|
|
||||||
static CODEC_FORMAT WFXformat_SyncHostFormat(
|
static CODEC_FORMAT WFXformat_SyncHostFormat(
|
||||||
void* Host_wfx_ptr,
|
void* Host_wfx_ptr,
|
||||||
const void* Xb_wfx_ptr,
|
const void* Xb_wfx_ptr,
|
||||||
uint32_t Xb_buffer_request_size,
|
uint32_t Xb_buffer_request_size,
|
||||||
uint32_t Xb_flags)
|
uint32_t Xb_flags,
|
||||||
|
XTL::CDirectSoundVoice* Xb_Voice)
|
||||||
{
|
{
|
||||||
PWAVEFORMATEXTENSIBLE Xb_wfxFormat = (PWAVEFORMATEXTENSIBLE)Xb_wfx_ptr;
|
PWAVEFORMATEXTENSIBLE Xb_wfxFormat = (PWAVEFORMATEXTENSIBLE)Xb_wfx_ptr;
|
||||||
PWAVEFORMATEXTENSIBLE Host_wfxFormat = (PWAVEFORMATEXTENSIBLE)Host_wfx_ptr;
|
PWAVEFORMATEXTENSIBLE Host_wfxFormat = (PWAVEFORMATEXTENSIBLE)Host_wfx_ptr;
|
||||||
CODEC_FORMAT codec_format_ret = CF_PCM;
|
CODEC_FORMAT codec_format_ret = CF_PCM;
|
||||||
bool require_validate = true;
|
bool require_validate = true;
|
||||||
|
XTL::audio_format xb_format;
|
||||||
|
|
||||||
// If no format is provided, then use default.
|
// If no format is provided, then use default.
|
||||||
if (Xb_wfx_ptr == xbnullptr) {
|
if (Xb_wfx_ptr == xbnullptr) {
|
||||||
|
@ -332,5 +334,13 @@ static CODEC_FORMAT WFXformat_SyncHostFormat(
|
||||||
WFXformat_GeneratePCMFormat(2, 44100, 16, Host_wfxFormat);
|
WFXformat_GeneratePCMFormat(2, 44100, 16, Host_wfxFormat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Forward xbox format to internal XTL::CDirectSoundVoice class.
|
||||||
|
xb_format.audio_codec = (codec_format_ret == CF_XADPCM ? WAVE_FORMAT_XBOX_ADPCM : WAVE_FORMAT_PCM);
|
||||||
|
xb_format.nChannels = Host_wfxFormat->Format.nChannels;
|
||||||
|
xb_format.cbSize = (codec_format_ret == CF_XADPCM ? 4 : 0);
|
||||||
|
xb_format.nSamplesPerSec = Host_wfxFormat->Format.nSamplesPerSec;
|
||||||
|
xb_format.bitsPerSample = (codec_format_ret == CF_XADPCM ? 4 : Host_wfxFormat->Format.wBitsPerSample);
|
||||||
|
Xb_Voice->SetFormat(Xb_Voice, xb_format);
|
||||||
|
|
||||||
return codec_format_ret;
|
return codec_format_ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue