mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-27 20:14:17 +01:00
Add ifdef around cubeb for android. Address a few review comments
This commit is contained in:
parent
5c61d53047
commit
182d672c15
@ -2,10 +2,6 @@ add_library(audio_core STATIC
|
||||
audio_types.h
|
||||
codec.cpp
|
||||
codec.h
|
||||
cubeb_input.cpp
|
||||
cubeb_input.h
|
||||
cubeb_sink.cpp
|
||||
cubeb_sink.h
|
||||
dsp_interface.cpp
|
||||
dsp_interface.h
|
||||
hle/adts.h
|
||||
@ -34,7 +30,7 @@ add_library(audio_core STATIC
|
||||
time_stretch.h
|
||||
|
||||
$<$<BOOL:${SDL2_FOUND}>:sdl2_sink.cpp sdl2_sink.h>
|
||||
$<$<BOOL:${ENABLE_CUBEB}>:cubeb_sink.cpp cubeb_sink.h>
|
||||
$<$<BOOL:${ENABLE_CUBEB}>:cubeb_sink.cpp cubeb_sink.h cubeb_input.cpp cubeb_input.h>
|
||||
$<$<BOOL:${FFMPEG_FOUND}>:hle/ffmpeg_decoder.cpp hle/ffmpeg_decoder.h hle/ffmpeg_dl.cpp hle/ffmpeg_dl.h>
|
||||
$<$<BOOL:${ENABLE_MF}>:hle/wmf_decoder.cpp hle/wmf_decoder.h hle/wmf_decoder_utils.cpp hle/wmf_decoder_utils.h>
|
||||
)
|
||||
@ -65,6 +61,6 @@ endif()
|
||||
|
||||
if(ENABLE_CUBEB)
|
||||
target_link_libraries(audio_core PRIVATE cubeb)
|
||||
add_definitions(-DHAVE_CUBEB=1)
|
||||
target_compile_definitions(audio_core PUBLIC HAVE_CUBEB)
|
||||
endif()
|
||||
|
||||
|
@ -4,7 +4,9 @@
|
||||
|
||||
#include <memory>
|
||||
#include <QtGlobal>
|
||||
#ifdef HAVE_CUBEB
|
||||
#include "audio_core/cubeb_input.h"
|
||||
#endif
|
||||
#include "audio_core/sink.h"
|
||||
#include "audio_core/sink_details.h"
|
||||
#include "citra_qt/configuration/configure_audio.h"
|
||||
@ -32,10 +34,11 @@ ConfigureAudio::ConfigureAudio(QWidget* parent)
|
||||
|
||||
ui->input_device_combo_box->clear();
|
||||
ui->input_device_combo_box->addItem(tr("Default"));
|
||||
#ifdef HAVE_CUBEB
|
||||
for (const auto& device : AudioCore::ListCubebInputDevices()) {
|
||||
ui->input_device_combo_box->addItem(QString::fromStdString(device));
|
||||
}
|
||||
|
||||
#endif
|
||||
connect(ui->input_type_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
&ConfigureAudio::updateAudioInputDevices);
|
||||
|
||||
|
@ -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…
Reference in New Issue
Block a user