Add ifdef around cubeb for android. Address a few review comments
This commit is contained in:
parent
5c61d53047
commit
182d672c15
5 changed files with 18 additions and 21 deletions
|
@ -8,9 +8,8 @@
|
|||
|
||||
namespace Frontend::Mic {
|
||||
|
||||
constexpr std::array<u8, 32> NOISE_SAMPLE_8_BIT = {
|
||||
0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF5, 0xFF, 0xFF, 0xFF, 0xFF, 0x8E, 0xFF,
|
||||
0xF4, 0xE1, 0xBF, 0x9A, 0x71, 0x58, 0x5B, 0x5F, 0x62, 0xC2, 0x25, 0x05, 0x01, 0x01, 0x01, 0x01};
|
||||
constexpr std::array<u8, 16> NOISE_SAMPLE_8_BIT = {0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xF5, 0xFF, 0xFF, 0xFF, 0xFF, 0x8E, 0xFF};
|
||||
|
||||
constexpr std::array<u8, 32> NOISE_SAMPLE_16_BIT = {
|
||||
0x64, 0x61, 0x74, 0x61, 0x56, 0xD7, 0x00, 0x00, 0x48, 0xF7, 0x86, 0x05, 0x77, 0x1A, 0xF4, 0x1F,
|
||||
|
|
|
@ -47,13 +47,8 @@ constexpr u32 GetSampleRateInHz(SampleRate sample_rate) {
|
|||
}
|
||||
}
|
||||
|
||||
// The following buffer write rates were found by hardware test on o3ds and n3ds.
|
||||
// The 3ds writes to the sharedmem roughly every 15 samples
|
||||
constexpr u64 BufferUpdateRate8180 = BASE_CLOCK_RATE_ARM11 / 511;
|
||||
constexpr u64 BufferUpdateRate10910 = BASE_CLOCK_RATE_ARM11 / 681;
|
||||
constexpr u64 BufferUpdateRate16360 = BASE_CLOCK_RATE_ARM11 / 1022;
|
||||
constexpr u64 BufferUpdateRate32730 = BASE_CLOCK_RATE_ARM11 / 2045;
|
||||
|
||||
// The 3ds hardware was tested to write to the sharedmem every 15 samples regardless of sample_rate.
|
||||
// So we can just divide the sample rate by 16 and that'll give the correct timing for the event
|
||||
constexpr u64 GetBufferUpdateRate(SampleRate sample_rate) {
|
||||
return GetSampleRateInHz(sample_rate) / 16;
|
||||
}
|
||||
|
@ -183,7 +178,7 @@ struct MIC_U::Impl {
|
|||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
LOG_TRACE(Service_MIC,
|
||||
"StartSampling called, encoding={}, sample_rate={}, "
|
||||
"called, encoding={}, sample_rate={}, "
|
||||
"audio_buffer_offset={}, audio_buffer_size={}, audio_buffer_loop={}",
|
||||
static_cast<u32>(encoding), static_cast<u32>(sample_rate), audio_buffer_offset,
|
||||
audio_buffer_size, audio_buffer_loop);
|
||||
|
@ -196,7 +191,7 @@ struct MIC_U::Impl {
|
|||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
LOG_TRACE(Service_MIC, "AdjustSampling sample_rate={}", static_cast<u32>(sample_rate));
|
||||
LOG_TRACE(Service_MIC, "sample_rate={}", static_cast<u32>(sample_rate));
|
||||
}
|
||||
|
||||
void StopSampling(Kernel::HLERequestContext& ctx) {
|
||||
|
@ -206,7 +201,7 @@ struct MIC_U::Impl {
|
|||
rb.Push(RESULT_SUCCESS);
|
||||
mic->StopSampling();
|
||||
timing.RemoveEvent(buffer_write_event);
|
||||
LOG_TRACE(Service_MIC, "StopSampling called");
|
||||
LOG_TRACE(Service_MIC, "called");
|
||||
}
|
||||
|
||||
void IsSampling(Kernel::HLERequestContext& ctx) {
|
||||
|
@ -265,7 +260,7 @@ struct MIC_U::Impl {
|
|||
rb.Push(RESULT_SUCCESS);
|
||||
bool mic_power = mic->GetPower();
|
||||
rb.Push<u8>(mic_power);
|
||||
LOG_TRACE(Service_MIC, "GetPower called");
|
||||
LOG_TRACE(Service_MIC, "called");
|
||||
}
|
||||
|
||||
void SetIirFilterMic(Kernel::HLERequestContext& ctx) {
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <utility>
|
||||
#if HAVE_CUBEB
|
||||
#include "audio_core/cubeb_input.h"
|
||||
#endif
|
||||
#include "audio_core/dsp_interface.h"
|
||||
#include "core/core.h"
|
||||
#include "core/frontend/emu_window.h"
|
||||
|
@ -66,7 +68,9 @@ void Apply() {
|
|||
Frontend::Mic::RegisterMic(std::make_shared<Frontend::Mic::NullMic>());
|
||||
break;
|
||||
case Settings::MicInputType::Real:
|
||||
#if HAVE_CUBEB
|
||||
Frontend::Mic::RegisterMic(std::make_shared<AudioCore::CubebInput>());
|
||||
#endif
|
||||
break;
|
||||
case Settings::MicInputType::Static:
|
||||
Frontend::Mic::RegisterMic(std::make_shared<Frontend::Mic::StaticMic>());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue