mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-12-26 01:31:53 +01:00
Fix building with cubeb disabled
This commit is contained in:
parent
44c16e1c64
commit
b87465fd8a
@ -6,7 +6,9 @@
|
|||||||
#include "DirectSoundAPI.h"
|
#include "DirectSoundAPI.h"
|
||||||
#endif
|
#endif
|
||||||
#include "config/CemuConfig.h"
|
#include "config/CemuConfig.h"
|
||||||
|
#if HAS_CUBEB
|
||||||
#include "CubebAPI.h"
|
#include "CubebAPI.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
std::shared_mutex g_audioMutex;
|
std::shared_mutex g_audioMutex;
|
||||||
AudioAPIPtr g_tvAudio;
|
AudioAPIPtr g_tvAudio;
|
||||||
@ -80,7 +82,9 @@ void IAudioAPI::InitializeStatic()
|
|||||||
if(!s_availableApis[XAudio2]) // don't try to initialize the older lib if the newer version is available
|
if(!s_availableApis[XAudio2]) // don't try to initialize the older lib if the newer version is available
|
||||||
s_availableApis[XAudio27] = XAudio27API::InitializeStatic();
|
s_availableApis[XAudio27] = XAudio27API::InitializeStatic();
|
||||||
#endif
|
#endif
|
||||||
|
#if HAS_CUBEB
|
||||||
s_availableApis[Cubeb] = CubebAPI::InitializeStatic();
|
s_availableApis[Cubeb] = CubebAPI::InitializeStatic();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IAudioAPI::IsAudioAPIAvailable(AudioAPI api)
|
bool IAudioAPI::IsAudioAPIAvailable(AudioAPI api)
|
||||||
@ -118,11 +122,13 @@ AudioAPIPtr IAudioAPI::CreateDevice(AudioAPI api, const DeviceDescriptionPtr& de
|
|||||||
return std::make_unique<XAudio2API>(tmp->GetDeviceId(), samplerate, channels, samples_per_block, bits_per_sample);
|
return std::make_unique<XAudio2API>(tmp->GetDeviceId(), samplerate, channels, samples_per_block, bits_per_sample);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if HAS_CUBEB
|
||||||
case Cubeb:
|
case Cubeb:
|
||||||
{
|
{
|
||||||
const auto tmp = std::dynamic_pointer_cast<CubebAPI::CubebDeviceDescription>(device);
|
const auto tmp = std::dynamic_pointer_cast<CubebAPI::CubebDeviceDescription>(device);
|
||||||
return std::make_unique<CubebAPI>(tmp->GetDeviceId(), samplerate, channels, samples_per_block, bits_per_sample);
|
return std::make_unique<CubebAPI>(tmp->GetDeviceId(), samplerate, channels, samples_per_block, bits_per_sample);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
throw std::runtime_error(fmt::format("invalid audio api: {}", api));
|
throw std::runtime_error(fmt::format("invalid audio api: {}", api));
|
||||||
}
|
}
|
||||||
@ -149,10 +155,12 @@ std::vector<IAudioAPI::DeviceDescriptionPtr> IAudioAPI::GetDevices(AudioAPI api)
|
|||||||
return XAudio2API::GetDevices();
|
return XAudio2API::GetDevices();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if HAS_CUBEB
|
||||||
case Cubeb:
|
case Cubeb:
|
||||||
{
|
{
|
||||||
return CubebAPI::GetDevices();
|
return CubebAPI::GetDevices();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
throw std::runtime_error(fmt::format("invalid audio api: {}", api));
|
throw std::runtime_error(fmt::format("invalid audio api: {}", api));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "IAudioInputAPI.h"
|
#include "IAudioInputAPI.h"
|
||||||
|
#if HAS_CUBEB
|
||||||
#include "CubebInputAPI.h"
|
#include "CubebInputAPI.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
std::shared_mutex g_audioInputMutex;
|
std::shared_mutex g_audioInputMutex;
|
||||||
AudioInputAPIPtr g_inputAudio;
|
AudioInputAPIPtr g_inputAudio;
|
||||||
@ -20,7 +22,9 @@ void IAudioInputAPI::PrintLogging()
|
|||||||
|
|
||||||
void IAudioInputAPI::InitializeStatic()
|
void IAudioInputAPI::InitializeStatic()
|
||||||
{
|
{
|
||||||
|
#if HAS_CUBEB
|
||||||
s_availableApis[Cubeb] = CubebInputAPI::InitializeStatic();
|
s_availableApis[Cubeb] = CubebInputAPI::InitializeStatic();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IAudioInputAPI::IsAudioInputAPIAvailable(AudioInputAPI api)
|
bool IAudioInputAPI::IsAudioInputAPIAvailable(AudioInputAPI api)
|
||||||
@ -39,11 +43,13 @@ AudioInputAPIPtr IAudioInputAPI::CreateDevice(AudioInputAPI api, const DeviceDes
|
|||||||
|
|
||||||
switch(api)
|
switch(api)
|
||||||
{
|
{
|
||||||
|
#if HAS_CUBEB
|
||||||
case Cubeb:
|
case Cubeb:
|
||||||
{
|
{
|
||||||
const auto tmp = std::dynamic_pointer_cast<CubebInputAPI::CubebDeviceDescription>(device);
|
const auto tmp = std::dynamic_pointer_cast<CubebInputAPI::CubebDeviceDescription>(device);
|
||||||
return std::make_unique<CubebInputAPI>(tmp->GetDeviceId(), samplerate, channels, samples_per_block, bits_per_sample);
|
return std::make_unique<CubebInputAPI>(tmp->GetDeviceId(), samplerate, channels, samples_per_block, bits_per_sample);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
throw std::runtime_error(fmt::format("invalid audio api: {}", api));
|
throw std::runtime_error(fmt::format("invalid audio api: {}", api));
|
||||||
}
|
}
|
||||||
@ -56,10 +62,12 @@ std::vector<IAudioInputAPI::DeviceDescriptionPtr> IAudioInputAPI::GetDevices(Aud
|
|||||||
|
|
||||||
switch(api)
|
switch(api)
|
||||||
{
|
{
|
||||||
|
#if HAS_CUBEB
|
||||||
case Cubeb:
|
case Cubeb:
|
||||||
{
|
{
|
||||||
return CubebInputAPI::GetDevices();
|
return CubebInputAPI::GetDevices();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
throw std::runtime_error(fmt::format("invalid audio api: {}", api));
|
throw std::runtime_error(fmt::format("invalid audio api: {}", api));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user