Windows build fixes and cleanups

This commit is contained in:
Jack Andersen
2018-05-24 20:30:42 -10:00
parent 721d10919b
commit 84df8af28c
24 changed files with 213 additions and 4549 deletions

View File

@@ -16,13 +16,8 @@ typedef union
#endif
} TVectorUnion;
static constexpr TVectorUnion ZeroVec = {};
static constexpr TVectorUnion Min16Vec = {INT16_MIN, INT16_MIN, INT16_MIN, INT16_MIN};
static constexpr TVectorUnion Max16Vec = {INT16_MAX, INT16_MAX, INT16_MAX, INT16_MAX};
static constexpr TVectorUnion Min32Vec = {INT32_MIN, INT32_MIN, INT32_MIN, INT32_MIN};
static constexpr TVectorUnion Max32Vec = {INT32_MAX, INT32_MAX, INT32_MAX, INT32_MAX};
static constexpr TVectorUnion MinFltVec = {-1.f, -1.f, -1.f, -1.f};
static constexpr TVectorUnion MaxFltVec = {1.f, 1.f, 1.f, 1.f};
static constexpr TVectorUnion Min32Vec = {{INT32_MIN, INT32_MIN, INT32_MIN, INT32_MIN}};
static constexpr TVectorUnion Max32Vec = {{INT32_MAX, INT32_MAX, INT32_MAX, INT32_MAX}};
void AudioMatrixMono::setDefaultMatrixCoefficients(AudioChannelSet acSet)
{

View File

@@ -11,7 +11,7 @@ namespace boo
{
AudioSubmix::AudioSubmix(BaseAudioVoiceEngine& root, IAudioSubmixCallback* cb, int busId, bool mainOut)
: ListNode<AudioSubmix, BaseAudioVoiceEngine*, IAudioSubmix>(&root), m_busId(busId), m_cb(cb), m_mainOut(mainOut)
: ListNode<AudioSubmix, BaseAudioVoiceEngine*, IAudioSubmix>(&root), m_busId(busId), m_mainOut(mainOut), m_cb(cb)
{
if (mainOut)
setSendLevel(m_head->m_mainSubmix.get(), 1.f, false);

View File

@@ -11,12 +11,12 @@ namespace boo
/** Pertinent information from audio backend about optimal mixed-audio representation */
struct AudioVoiceEngineMixInfo
{
double m_sampleRate;
soxr_datatype_t m_sampleFormat;
unsigned m_bitsPerSample;
AudioChannelSet m_channels;
ChannelMap m_channelMap;
size_t m_periodFrames;
double m_sampleRate = 32000.0;
soxr_datatype_t m_sampleFormat = SOXR_FLOAT32_I;
unsigned m_bitsPerSample = 32;
AudioChannelSet m_channels = AudioChannelSet::Stereo;
ChannelMap m_channelMap = {2, {AudioChannel::FrontLeft, AudioChannel::FrontRight}};
size_t m_periodFrames = 160;
};
}

View File

@@ -40,7 +40,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
std::vector<float> m_5msBuffer;
#if !WINDOWS_STORE
struct NotificationClient : public IMMNotificationClient
struct NotificationClient final : public IMMNotificationClient
{
WASAPIAudioVoiceEngine& m_parent;
@@ -138,14 +138,14 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
#if !WINDOWS_STORE
if (FAILED(m_enumerator->GetDefaultAudioEndpoint(eRender, eConsole, &m_device)))
{
Log.report(logvisor::Fatal, L"unable to obtain default audio device");
Log.report(logvisor::Error, L"unable to obtain default audio device");
m_device.Reset();
return;
}
if (FAILED(m_device->Activate(IID_IAudioClient, CLSCTX_ALL, nullptr, &m_audClient)))
{
Log.report(logvisor::Fatal, L"unable to create audio client from device");
Log.report(logvisor::Error, L"unable to create audio client from device");
m_device.Reset();
return;
}
@@ -154,7 +154,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
WAVEFORMATEXTENSIBLE* pwfx;
if (FAILED(m_audClient->GetMixFormat((WAVEFORMATEX**)&pwfx)))
{
Log.report(logvisor::Fatal, L"unable to obtain audio mix format from device");
Log.report(logvisor::Error, L"unable to obtain audio mix format from device");
#if !WINDOWS_STORE
m_device.Reset();
#endif
@@ -239,7 +239,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
(WAVEFORMATEX*)pwfx,
nullptr)))
{
Log.report(logvisor::Fatal, L"unable to initialize audio client");
Log.report(logvisor::Error, L"unable to initialize audio client");
#if !WINDOWS_STORE
m_device.Reset();
#endif
@@ -283,7 +283,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
}
else
{
Log.report(logvisor::Fatal, L"unsupported floating-point bits-per-sample %d", pwfx->Format.wBitsPerSample);
Log.report(logvisor::Error, L"unsupported floating-point bits-per-sample %d", pwfx->Format.wBitsPerSample);
#if !WINDOWS_STORE
m_device.Reset();
#endif
@@ -296,7 +296,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
UINT32 bufferFrameCount;
if (FAILED(m_audClient->GetBufferSize(&bufferFrameCount)))
{
Log.report(logvisor::Fatal, L"unable to get audio buffer frame count");
Log.report(logvisor::Error, L"unable to get audio buffer frame count");
#if !WINDOWS_STORE
m_device.Reset();
#endif
@@ -306,7 +306,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
if (FAILED(m_audClient->GetService(IID_IAudioRenderClient, &m_renderClient)))
{
Log.report(logvisor::Fatal, L"unable to create audio render client");
Log.report(logvisor::Error, L"unable to create audio render client");
#if !WINDOWS_STORE
m_device.Reset();
#endif
@@ -385,13 +385,13 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
CLSCTX_ALL, IID_IMMDeviceEnumerator,
&m_enumerator)))
{
Log.report(logvisor::Fatal, L"unable to create MMDeviceEnumerator instance");
Log.report(logvisor::Error, L"unable to create MMDeviceEnumerator instance");
return;
}
if (FAILED(m_enumerator->RegisterEndpointNotificationCallback(&m_notificationClient)))
{
Log.report(logvisor::Fatal, L"unable to register multimedia event callback");
Log.report(logvisor::Error, L"unable to register multimedia event callback");
m_device.Reset();
return;
}
@@ -431,6 +431,9 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
#if WINDOWS_STORE
if (!m_ready)
return;
#else
if (!m_device)
return;
#endif
int attempt = 0;
@@ -821,12 +824,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine
std::unique_ptr<IAudioVoiceEngine> NewAudioVoiceEngine()
{
std::unique_ptr<IAudioVoiceEngine> ret = std::make_unique<WASAPIAudioVoiceEngine>();
#if !WINDOWS_STORE
if (!static_cast<WASAPIAudioVoiceEngine&>(*ret).m_device)
return {};
#endif
return ret;
return std::make_unique<WASAPIAudioVoiceEngine>();
}
}