mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-01 18:53:17 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 07c4f78389 |
@@ -1,13 +0,0 @@
|
|||||||
diff --git a/libs/cobalt/include/boost/cobalt/concepts.hpp b/libs/cobalt/include/boost/cobalt/concepts.hpp
|
|
||||||
index d49f2ec..a9bdb80 100644
|
|
||||||
--- a/libs/cobalt/include/boost/cobalt/concepts.hpp
|
|
||||||
+++ b/libs/cobalt/include/boost/cobalt/concepts.hpp
|
|
||||||
@@ -62,7 +62,7 @@ struct enable_awaitables
|
|
||||||
template <typename T>
|
|
||||||
concept with_get_executor = requires (T& t)
|
|
||||||
{
|
|
||||||
- {t.get_executor()} -> asio::execution::executor;
|
|
||||||
+ t.get_executor();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
+3
-7
@@ -414,12 +414,9 @@ AddJsonPackage(boost)
|
|||||||
set(BOOST_NO_HEADERS ${Boost_ADDED})
|
set(BOOST_NO_HEADERS ${Boost_ADDED})
|
||||||
|
|
||||||
if (Boost_ADDED)
|
if (Boost_ADDED)
|
||||||
if (MSVC OR ANDROID)
|
add_compile_definitions(YUZU_BOOST_v1)
|
||||||
add_compile_definitions(YUZU_BOOST_v1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT MSVC OR CXX_CLANG)
|
if (NOT MSVC OR CXX_CLANG)
|
||||||
# boost sucks
|
# solaris sucks
|
||||||
if (SOLARIS)
|
if (SOLARIS)
|
||||||
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-pthreads>)
|
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-pthreads>)
|
||||||
endif()
|
endif()
|
||||||
@@ -428,8 +425,7 @@ if (Boost_ADDED)
|
|||||||
target_compile_options(boost_icl INTERFACE $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-shadow>)
|
target_compile_options(boost_icl INTERFACE $<$<COMPILE_LANGUAGE:C,CXX>:-Wno-shadow>)
|
||||||
target_compile_options(boost_asio INTERFACE
|
target_compile_options(boost_asio INTERFACE
|
||||||
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-conversion>
|
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-conversion>
|
||||||
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-implicit-fallthrough>
|
$<$<COMPILE_LANGUAGE:C,CXX>:-Wno-implicit-fallthrough>)
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
+12
-9
@@ -6,22 +6,19 @@
|
|||||||
"version": "v0.19.0"
|
"version": "v0.19.0"
|
||||||
},
|
},
|
||||||
"boost": {
|
"boost": {
|
||||||
"artifact": "%VERSION%-cmake.tar.xz",
|
"artifact": "boost-%VERSION%.tar.zst",
|
||||||
"find_args": "CONFIG OPTIONAL_COMPONENTS headers context system fiber filesystem",
|
"find_args": "CONFIG OPTIONAL_COMPONENTS headers context system fiber filesystem",
|
||||||
"hash": "6ae6e94664fe7f2fb01976b59b276ac5df8085c7503fa829d810fbfe495960cfec44fa2c36e2cb23480bc19c956ed199d4952b02639a00a6c07625d4e7130c2d",
|
"hash": "077ad58b3d336041c05ad5f2b1de7db9fe1d35af3da85cd99496c35ddeca080ecd0ae5c8058319077bda892361b38624d89f70bc9bfec6713aae2aabc17f2a43",
|
||||||
"min_version": "1.57",
|
"min_version": "1.57",
|
||||||
"package": "Boost",
|
"package": "Boost",
|
||||||
"patches": [
|
"repo": "eden-emulator/ext-boost",
|
||||||
"0001-clang-cl.patch"
|
"version": "1.91.0-1"
|
||||||
],
|
|
||||||
"repo": "boostorg/boost",
|
|
||||||
"version": "boost-1.90.0"
|
|
||||||
},
|
},
|
||||||
"boost_headers": {
|
"boost_headers": {
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"hash": "4ef845775e2277a8104ded6ddf749aa262ce52cf8438042869a048f9a0156dd772fbbcfa74efa1378fecef339b7286f6fe4b4feb5c45d49966b35d08e3e83507",
|
"hash": "c5fa2cd72f6e6666b7963b97bc359c75284b8fb540c30f3629a028b85270c9bc66c8a051383964f2bd4c1e005a4691593d15696e7ef39ea87cf6cff9e5691fb2",
|
||||||
"repo": "boostorg/headers",
|
"repo": "boostorg/headers",
|
||||||
"version": "boost-1.90.0"
|
"version": "boost-1.91.0"
|
||||||
},
|
},
|
||||||
"catch2": {
|
"catch2": {
|
||||||
"hash": "7eea385d79d88a5690cde131fe7ccda97d5c54ea09d6f515000d7bf07c828809d61c1ac99912c1ee507cf933f61c1c47ecdcc45df7850ffa82714034b0fccf35",
|
"hash": "7eea385d79d88a5690cde131fe7ccda97d5c54ea09d6f515000d7bf07c828809d61c1ac99912c1ee507cf933f61c1c47ecdcc45df7850ffa82714034b0fccf35",
|
||||||
@@ -179,6 +176,12 @@
|
|||||||
"repo": "eden-emulator/oaknut",
|
"repo": "eden-emulator/oaknut",
|
||||||
"version": "v2.0.3"
|
"version": "v2.0.3"
|
||||||
},
|
},
|
||||||
|
"oboe": {
|
||||||
|
"bundled": true,
|
||||||
|
"hash": "ce4011afe7345370d4ead3b891cd69a5ef224b129535783586c0ca75051d303ed446e6c7f10bde8da31fff58d6e307f1732a3ffd03b249f9ef1fd48fd4132715",
|
||||||
|
"repo": "google/oboe",
|
||||||
|
"version": "1.10.0"
|
||||||
|
},
|
||||||
"openssl": {
|
"openssl": {
|
||||||
"hash": "29002ce50cb95a4f4f1d0e9d3f684401fbd4eac34203dc2eef3b6334af5d44aa46bf788b63a6f5c139c383eafb7269ae87a58a9a3ad5912903b9773e545ccc0a",
|
"hash": "29002ce50cb95a4f4f1d0e9d3f684401fbd4eac34203dc2eef3b6334af5d44aa46bf788b63a6f5c139c383eafb7269ae87a58a9a3ad5912903b9773e545ccc0a",
|
||||||
"min_version": "3.0.0",
|
"min_version": "3.0.0",
|
||||||
|
|||||||
Vendored
+7
@@ -388,6 +388,13 @@ if (YUZU_CRASH_DUMPS AND NOT TARGET libbreakpad_client)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# oboe
|
||||||
|
if (ANDROID)
|
||||||
|
AddJsonPackage(oboe)
|
||||||
|
|
||||||
|
add_library(oboe::oboe ALIAS oboe)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
# moltenvk
|
# moltenvk
|
||||||
if (NOT YUZU_USE_BUNDLED_MOLTENVK)
|
if (NOT YUZU_USE_BUNDLED_MOLTENVK)
|
||||||
|
|||||||
@@ -799,6 +799,10 @@
|
|||||||
<string name="theme_mode_light">روشن</string>
|
<string name="theme_mode_light">روشن</string>
|
||||||
<string name="theme_mode_dark">تاریک</string>
|
<string name="theme_mode_dark">تاریک</string>
|
||||||
|
|
||||||
|
<!-- Audio output engines -->
|
||||||
|
<string name="oboe">oboe</string>
|
||||||
|
<string name="cubeb">cubeb</string>
|
||||||
|
|
||||||
<!-- Anisotropic filtering options -->
|
<!-- Anisotropic filtering options -->
|
||||||
<string name="multiplier_x2">x2</string>
|
<string name="multiplier_x2">x2</string>
|
||||||
<string name="multiplier_x4">x4</string>
|
<string name="multiplier_x4">x4</string>
|
||||||
|
|||||||
@@ -465,14 +465,14 @@
|
|||||||
|
|
||||||
<string-array name="outputEngineEntries">
|
<string-array name="outputEngineEntries">
|
||||||
<item>@string/auto</item>
|
<item>@string/auto</item>
|
||||||
|
<item>@string/oboe</item>
|
||||||
<item>@string/cubeb</item>
|
<item>@string/cubeb</item>
|
||||||
<item>@string/sdl3</item>
|
|
||||||
<item>@string/string_null</item>
|
<item>@string/string_null</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<integer-array name="outputEngineValues">
|
<integer-array name="outputEngineValues">
|
||||||
<item>0</item>
|
<item>0</item>
|
||||||
|
<item>4</item>
|
||||||
<item>1</item>
|
<item>1</item>
|
||||||
<item>2</item>
|
|
||||||
<item>3</item>
|
<item>3</item>
|
||||||
</integer-array>
|
</integer-array>
|
||||||
|
|
||||||
|
|||||||
@@ -1240,7 +1240,7 @@
|
|||||||
<string name="theme_mode_dark">Dark</string>
|
<string name="theme_mode_dark">Dark</string>
|
||||||
|
|
||||||
<!-- Audio output engines -->
|
<!-- Audio output engines -->
|
||||||
<string name="sdl3" translatable="false">sdl3</string>
|
<string name="oboe" translatable="false">oboe</string>
|
||||||
<string name="cubeb" translatable="false">cubeb</string>
|
<string name="cubeb" translatable="false">cubeb</string>
|
||||||
|
|
||||||
<!-- Anisotropic filtering options -->
|
<!-- Anisotropic filtering options -->
|
||||||
|
|||||||
@@ -238,10 +238,20 @@ if (ENABLE_CUBEB)
|
|||||||
target_compile_definitions(audio_core PRIVATE HAVE_CUBEB=1)
|
target_compile_definitions(audio_core PRIVATE HAVE_CUBEB=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_sources(audio_core PRIVATE
|
if(ANDROID)
|
||||||
sink/sdl3_sink.cpp
|
target_sources(audio_core PRIVATE
|
||||||
sink/sdl3_sink.h)
|
sink/oboe_sink.cpp
|
||||||
target_link_libraries(audio_core PRIVATE SDL3::SDL3)
|
sink/oboe_sink.h)
|
||||||
target_compile_definitions(audio_core PRIVATE HAVE_SDL3)
|
|
||||||
|
target_link_libraries(audio_core PRIVATE oboe)
|
||||||
|
target_compile_definitions(audio_core PUBLIC HAVE_OBOE)
|
||||||
|
else()
|
||||||
|
target_sources(audio_core PRIVATE
|
||||||
|
sink/sdl3_sink.cpp
|
||||||
|
sink/sdl3_sink.h)
|
||||||
|
|
||||||
|
target_link_libraries(audio_core PRIVATE SDL3::SDL3)
|
||||||
|
target_compile_definitions(audio_core PRIVATE HAVE_SDL3)
|
||||||
|
endif()
|
||||||
|
|
||||||
create_target_directory_groups(audio_core)
|
create_target_directory_groups(audio_core)
|
||||||
|
|||||||
@@ -0,0 +1,230 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include <span>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <oboe/Oboe.h>
|
||||||
|
|
||||||
|
#include "audio_core/common/common.h"
|
||||||
|
#include "audio_core/sink/oboe_sink.h"
|
||||||
|
#include "audio_core/sink/sink_stream.h"
|
||||||
|
#include "common/logging.h"
|
||||||
|
#include "common/scope_exit.h"
|
||||||
|
#include "core/core.h"
|
||||||
|
|
||||||
|
namespace AudioCore::Sink {
|
||||||
|
|
||||||
|
class OboeSinkStream final : public SinkStream,
|
||||||
|
public oboe::AudioStreamDataCallback,
|
||||||
|
public oboe::AudioStreamErrorCallback {
|
||||||
|
public:
|
||||||
|
explicit OboeSinkStream(Core::System& system_, StreamType type_, const std::string& name_,
|
||||||
|
u32 system_channels_)
|
||||||
|
: SinkStream(system_, type_) {
|
||||||
|
name = name_;
|
||||||
|
system_channels = system_channels_;
|
||||||
|
|
||||||
|
this->OpenStream();
|
||||||
|
}
|
||||||
|
|
||||||
|
~OboeSinkStream() override {
|
||||||
|
LOG_INFO(Audio_Sink, "Destroyed Oboe stream");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Finalize() override {
|
||||||
|
this->Stop();
|
||||||
|
m_stream.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Start(bool resume = false) override {
|
||||||
|
if (!m_stream || !paused) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
paused = false;
|
||||||
|
|
||||||
|
if (m_stream->start() != oboe::Result::OK) {
|
||||||
|
LOG_CRITICAL(Audio_Sink, "Error starting Oboe stream");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Stop() override {
|
||||||
|
if (!m_stream || paused) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->SignalPause();
|
||||||
|
|
||||||
|
if (m_stream->stop() != oboe::Result::OK) {
|
||||||
|
LOG_CRITICAL(Audio_Sink, "Error stopping Oboe stream");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
static s32 QueryChannelCount(oboe::Direction direction) {
|
||||||
|
std::shared_ptr<oboe::AudioStream> temp_stream;
|
||||||
|
oboe::AudioStreamBuilder builder;
|
||||||
|
|
||||||
|
const auto result = ConfigureBuilder(builder, direction)->openStream(temp_stream);
|
||||||
|
if (result == oboe::Result::OK) {
|
||||||
|
return temp_stream->getChannelCount() >= 6 ? 6 : 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_ERROR(Audio_Sink, "Failed to open {} stream. Using default channel count 2",
|
||||||
|
direction == oboe::Direction::Output ? "output" : "input");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
oboe::DataCallbackResult onAudioReady(oboe::AudioStream*, void* audio_data,
|
||||||
|
s32 num_buffer_frames) override {
|
||||||
|
const size_t num_channels = this->GetDeviceChannels();
|
||||||
|
const size_t frame_size = num_channels;
|
||||||
|
const size_t num_frames = static_cast<size_t>(num_buffer_frames);
|
||||||
|
|
||||||
|
if (type == StreamType::In) {
|
||||||
|
std::span<const s16> input_buffer{reinterpret_cast<const s16*>(audio_data),
|
||||||
|
num_frames * frame_size};
|
||||||
|
this->ProcessAudioIn(input_buffer, num_frames);
|
||||||
|
} else {
|
||||||
|
std::span<s16> output_buffer{reinterpret_cast<s16*>(audio_data),
|
||||||
|
num_frames * frame_size};
|
||||||
|
this->ProcessAudioOutAndRender(output_buffer, num_frames);
|
||||||
|
}
|
||||||
|
|
||||||
|
return oboe::DataCallbackResult::Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void onErrorAfterClose(oboe::AudioStream*, oboe::Result) override {
|
||||||
|
LOG_INFO(Audio_Sink, "Audio stream closed, reinitializing");
|
||||||
|
|
||||||
|
if (this->OpenStream()) {
|
||||||
|
m_stream->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static oboe::AudioStreamBuilder* ConfigureBuilder(oboe::AudioStreamBuilder& builder,
|
||||||
|
oboe::Direction direction) {
|
||||||
|
// TODO: investigate callback delay issues when using AAudio
|
||||||
|
return builder.setPerformanceMode(oboe::PerformanceMode::LowLatency)
|
||||||
|
->setAudioApi(oboe::AudioApi::OpenSLES)
|
||||||
|
->setDirection(direction)
|
||||||
|
->setSampleRate(TargetSampleRate)
|
||||||
|
->setSampleRateConversionQuality(oboe::SampleRateConversionQuality::High)
|
||||||
|
->setFormat(oboe::AudioFormat::I16)
|
||||||
|
->setFormatConversionAllowed(true)
|
||||||
|
->setUsage(oboe::Usage::Game)
|
||||||
|
->setBufferCapacityInFrames(TargetSampleCount * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OpenStream() {
|
||||||
|
const auto direction = [&]() {
|
||||||
|
switch (type) {
|
||||||
|
case StreamType::In:
|
||||||
|
return oboe::Direction::Input;
|
||||||
|
case StreamType::Out:
|
||||||
|
case StreamType::Render:
|
||||||
|
return oboe::Direction::Output;
|
||||||
|
default:
|
||||||
|
ASSERT(false);
|
||||||
|
return oboe::Direction::Output;
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
const auto expected_channels = QueryChannelCount(direction);
|
||||||
|
const auto expected_mask = [&]() {
|
||||||
|
switch (expected_channels) {
|
||||||
|
case 1:
|
||||||
|
return oboe::ChannelMask::Mono;
|
||||||
|
case 2:
|
||||||
|
return oboe::ChannelMask::Stereo;
|
||||||
|
case 6:
|
||||||
|
return oboe::ChannelMask::CM5Point1;
|
||||||
|
default:
|
||||||
|
ASSERT(false);
|
||||||
|
return oboe::ChannelMask::Unspecified;
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
oboe::AudioStreamBuilder builder;
|
||||||
|
const auto result = ConfigureBuilder(builder, direction)
|
||||||
|
->setChannelCount(expected_channels)
|
||||||
|
->setChannelMask(expected_mask)
|
||||||
|
->setChannelConversionAllowed(true)
|
||||||
|
->setDataCallback(this)
|
||||||
|
->setErrorCallback(this)
|
||||||
|
->openStream(m_stream);
|
||||||
|
ASSERT(result == oboe::Result::OK);
|
||||||
|
return result == oboe::Result::OK && this->SetStreamProperties();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SetStreamProperties() {
|
||||||
|
ASSERT(m_stream);
|
||||||
|
|
||||||
|
m_stream->setBufferSizeInFrames(TargetSampleCount * 2);
|
||||||
|
device_channels = m_stream->getChannelCount();
|
||||||
|
|
||||||
|
const auto sample_rate = m_stream->getSampleRate();
|
||||||
|
const auto buffer_capacity = m_stream->getBufferCapacityInFrames();
|
||||||
|
const auto stream_backend =
|
||||||
|
m_stream->getAudioApi() == oboe::AudioApi::AAudio ? "AAudio" : "OpenSLES";
|
||||||
|
|
||||||
|
LOG_INFO(Audio_Sink, "Opened Oboe {} stream with {} channels sample rate {} capacity {}",
|
||||||
|
stream_backend, device_channels, sample_rate, buffer_capacity);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<oboe::AudioStream> m_stream{};
|
||||||
|
};
|
||||||
|
|
||||||
|
OboeSink::OboeSink() {
|
||||||
|
// TODO: This is not generally knowable
|
||||||
|
// The channel count is distinct based on direction and can change
|
||||||
|
device_channels = OboeSinkStream::QueryChannelCount(oboe::Direction::Output);
|
||||||
|
}
|
||||||
|
|
||||||
|
OboeSink::~OboeSink() = default;
|
||||||
|
|
||||||
|
SinkStream* OboeSink::AcquireSinkStream(Core::System& system, u32 system_channels,
|
||||||
|
const std::string& name, StreamType type) {
|
||||||
|
SinkStreamPtr& stream = sink_streams.emplace_back(
|
||||||
|
std::make_unique<OboeSinkStream>(system, type, name, system_channels));
|
||||||
|
|
||||||
|
return stream.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OboeSink::CloseStream(SinkStream* to_remove) {
|
||||||
|
sink_streams.remove_if([&](auto& stream) { return stream.get() == to_remove; });
|
||||||
|
}
|
||||||
|
|
||||||
|
void OboeSink::CloseStreams() {
|
||||||
|
sink_streams.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
f32 OboeSink::GetDeviceVolume() const {
|
||||||
|
if (sink_streams.empty()) {
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sink_streams.front()->GetDeviceVolume();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OboeSink::SetDeviceVolume(f32 volume) {
|
||||||
|
for (auto& stream : sink_streams) {
|
||||||
|
stream->SetDeviceVolume(volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OboeSink::SetSystemVolume(f32 volume) {
|
||||||
|
for (auto& stream : sink_streams) {
|
||||||
|
stream->SetSystemVolume(volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace AudioCore::Sink
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "audio_core/sink/sink.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class System;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace AudioCore::Sink {
|
||||||
|
class SinkStream;
|
||||||
|
|
||||||
|
class OboeSink final : public Sink {
|
||||||
|
public:
|
||||||
|
explicit OboeSink();
|
||||||
|
~OboeSink() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new sink stream.
|
||||||
|
*
|
||||||
|
* @param system - Core system.
|
||||||
|
* @param system_channels - Number of channels the audio system expects.
|
||||||
|
* May differ from the device's channel count.
|
||||||
|
* @param name - Name of this stream.
|
||||||
|
* @param type - Type of this stream, render/in/out.
|
||||||
|
*
|
||||||
|
* @return A pointer to the created SinkStream
|
||||||
|
*/
|
||||||
|
SinkStream* AcquireSinkStream(Core::System& system, u32 system_channels,
|
||||||
|
const std::string& name, StreamType type) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close a given stream.
|
||||||
|
*
|
||||||
|
* @param stream - The stream to close.
|
||||||
|
*/
|
||||||
|
void CloseStream(SinkStream* stream) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close all streams.
|
||||||
|
*/
|
||||||
|
void CloseStreams() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the device volume. Set from calls to the IAudioDevice service.
|
||||||
|
*
|
||||||
|
* @return Volume of the device.
|
||||||
|
*/
|
||||||
|
f32 GetDeviceVolume() const override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the device volume. Set from calls to the IAudioDevice service.
|
||||||
|
*
|
||||||
|
* @param volume - New volume of the device.
|
||||||
|
*/
|
||||||
|
void SetDeviceVolume(f32 volume) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the system volume. Comes from the audio system using this stream.
|
||||||
|
*
|
||||||
|
* @param volume - New volume of the system.
|
||||||
|
*/
|
||||||
|
void SetSystemVolume(f32 volume) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/// List of streams managed by this sink
|
||||||
|
std::list<SinkStreamPtr> sink_streams{};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace AudioCore::Sink
|
||||||
@@ -10,6 +10,9 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "audio_core/sink/sink_details.h"
|
#include "audio_core/sink/sink_details.h"
|
||||||
|
#ifdef HAVE_OBOE
|
||||||
|
#include "audio_core/sink/oboe_sink.h"
|
||||||
|
#endif
|
||||||
#ifdef HAVE_CUBEB
|
#ifdef HAVE_CUBEB
|
||||||
#include "audio_core/sink/cubeb_sink.h"
|
#include "audio_core/sink/cubeb_sink.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -48,6 +51,16 @@ struct SinkDetails {
|
|||||||
|
|
||||||
// sink_details is ordered in terms of desirability, with the best choice at the top.
|
// sink_details is ordered in terms of desirability, with the best choice at the top.
|
||||||
constexpr SinkDetails sink_details[] = {
|
constexpr SinkDetails sink_details[] = {
|
||||||
|
#ifdef HAVE_OBOE
|
||||||
|
SinkDetails{
|
||||||
|
Settings::AudioEngine::Oboe,
|
||||||
|
[](std::string_view device_id) -> std::unique_ptr<Sink> {
|
||||||
|
return std::make_unique<OboeSink>();
|
||||||
|
},
|
||||||
|
[](bool capture) { return std::vector<std::string>{"Default"}; },
|
||||||
|
[]() { return 0u; },
|
||||||
|
},
|
||||||
|
#endif
|
||||||
#ifdef HAVE_CUBEB
|
#ifdef HAVE_CUBEB
|
||||||
SinkDetails{
|
SinkDetails{
|
||||||
Settings::AudioEngine::Cubeb,
|
Settings::AudioEngine::Cubeb,
|
||||||
|
|||||||
@@ -92,14 +92,14 @@ struct EnumMetadata {
|
|||||||
// AudioEngine must be specified discretely due to having existing but slightly different
|
// AudioEngine must be specified discretely due to having existing but slightly different
|
||||||
// canonicalizations
|
// canonicalizations
|
||||||
// TODO (lat9nq): Remove explicit definition of AudioEngine/sink_id
|
// TODO (lat9nq): Remove explicit definition of AudioEngine/sink_id
|
||||||
enum class AudioEngine : u32 { Auto, Cubeb, Sdl3, Null, };
|
enum class AudioEngine : u32 { Auto, Cubeb, Sdl3, Null, Oboe, };
|
||||||
template<>
|
template<>
|
||||||
inline std::vector<std::pair<std::string_view, AudioEngine>> EnumMetadata<AudioEngine>::Canonicalizations() {
|
inline std::vector<std::pair<std::string_view, AudioEngine>> EnumMetadata<AudioEngine>::Canonicalizations() {
|
||||||
return {
|
return {
|
||||||
{"auto", AudioEngine::Auto},
|
{"auto", AudioEngine::Auto},
|
||||||
{"cubeb", AudioEngine::Cubeb},
|
{"cubeb", AudioEngine::Cubeb},
|
||||||
{"sdl3", AudioEngine::Sdl3},
|
{"sdl3", AudioEngine::Sdl3},
|
||||||
{"null", AudioEngine::Null},
|
{"null", AudioEngine::Null}, {"oboe", AudioEngine::Oboe},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
/// @brief This is just a sufficiently large number that is more than the number of other enums declared here
|
/// @brief This is just a sufficiently large number that is more than the number of other enums declared here
|
||||||
@@ -113,7 +113,7 @@ inline AudioEngine EnumMetadata<AudioEngine>::GetFirst() {
|
|||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
inline AudioEngine EnumMetadata<AudioEngine>::GetLast() {
|
inline AudioEngine EnumMetadata<AudioEngine>::GetLast() {
|
||||||
return AudioEngine::Null;
|
return AudioEngine::Oboe;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENUM(AudioMode, Mono, Stereo, Surround);
|
ENUM(AudioMode, Mono, Stereo, Surround);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# update cached cpmfile content
|
# update cached cpmfile content
|
||||||
string(JSON cpmfile SET "${cpmfile}" "${key}" "${new_object}")
|
string(JSON cpmfile SET "${cpmfile}" "${KEY}" "${new_object}")
|
||||||
|
|
||||||
# write cached cpmfile
|
# write cached cpmfile
|
||||||
get_cpmfile_path(file)
|
get_cpmfile_path(file)
|
||||||
|
|||||||
Reference in New Issue
Block a user