mirror of
https://github.com/skyline-emu/skyline.git
synced 2025-02-05 22:20:29 +03:00
Add possibility to disable audio output
This commit is contained in:
parent
70109f8fbd
commit
e8e1b910c3
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
namespace skyline::audio {
|
namespace skyline::audio {
|
||||||
Audio::Audio(const DeviceState &state) : oboe::AudioStreamCallback() {
|
Audio::Audio(const DeviceState &state) : oboe::AudioStreamCallback() {
|
||||||
|
settings = std::shared_ptr<Settings>{state.settings};
|
||||||
|
|
||||||
builder.setChannelCount(constant::StereoChannelCount);
|
builder.setChannelCount(constant::StereoChannelCount);
|
||||||
builder.setSampleRate(constant::SampleRate);
|
builder.setSampleRate(constant::SampleRate);
|
||||||
builder.setFormat(constant::PcmFormat);
|
builder.setFormat(constant::PcmFormat);
|
||||||
@ -50,6 +52,7 @@ namespace skyline::audio {
|
|||||||
|
|
||||||
std::scoped_lock bufferGuard{track->bufferLock};
|
std::scoped_lock bufferGuard{track->bufferLock};
|
||||||
|
|
||||||
|
if (!*settings->isAudioOutputDisabled) {
|
||||||
auto trackSamples{track->samples.Read(span(destBuffer, streamSamples), [](i16 *source, i16 *destination) {
|
auto trackSamples{track->samples.Read(span(destBuffer, streamSamples), [](i16 *source, i16 *destination) {
|
||||||
*destination = Saturate<i16, i32>(static_cast<u32>(*destination) + static_cast<u32>(*source));
|
*destination = Saturate<i16, i32>(static_cast<u32>(*destination) + static_cast<u32>(*source));
|
||||||
}, static_cast<ssize_t>(writtenSamples))};
|
}, static_cast<ssize_t>(writtenSamples))};
|
||||||
@ -57,6 +60,9 @@ namespace skyline::audio {
|
|||||||
writtenSamples = std::max(trackSamples, writtenSamples);
|
writtenSamples = std::max(trackSamples, writtenSamples);
|
||||||
|
|
||||||
track->sampleCounter += trackSamples;
|
track->sampleCounter += trackSamples;
|
||||||
|
} else {
|
||||||
|
track->sampleCounter += streamSamples;
|
||||||
|
}
|
||||||
track->CheckReleasedBuffers();
|
track->CheckReleasedBuffers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <common/settings.h>
|
||||||
#include <audio/track.h>
|
#include <audio/track.h>
|
||||||
|
|
||||||
namespace skyline::audio {
|
namespace skyline::audio {
|
||||||
@ -15,6 +16,7 @@ namespace skyline::audio {
|
|||||||
oboe::ManagedStream outputStream;
|
oboe::ManagedStream outputStream;
|
||||||
std::vector<std::shared_ptr<AudioTrack>> audioTracks;
|
std::vector<std::shared_ptr<AudioTrack>> audioTracks;
|
||||||
std::mutex trackLock; //!< Synchronizes modifications to the audio tracks
|
std::mutex trackLock; //!< Synchronizes modifications to the audio tracks
|
||||||
|
std::shared_ptr<Settings> settings;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Audio(const DeviceState &state);
|
Audio(const DeviceState &state);
|
||||||
|
@ -41,6 +41,7 @@ namespace skyline {
|
|||||||
gpuDriverLibraryName = ktSettings.GetString("gpuDriverLibraryName");
|
gpuDriverLibraryName = ktSettings.GetString("gpuDriverLibraryName");
|
||||||
executorSlotCount = ktSettings.GetInt<u32>("executorSlotCount");
|
executorSlotCount = ktSettings.GetInt<u32>("executorSlotCount");
|
||||||
enableTextureReadbackHack = ktSettings.GetBool("enableTextureReadbackHack");
|
enableTextureReadbackHack = ktSettings.GetBool("enableTextureReadbackHack");
|
||||||
|
isAudioOutputDisabled = ktSettings.GetBool("isAudioOutputDisabled");
|
||||||
validationLayer = ktSettings.GetBool("validationLayer");
|
validationLayer = ktSettings.GetBool("validationLayer");
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -74,6 +74,9 @@ namespace skyline {
|
|||||||
Setting<u32> executorSlotCount; //!< Number of GPU executor slots that can be used concurrently
|
Setting<u32> executorSlotCount; //!< Number of GPU executor slots that can be used concurrently
|
||||||
Setting<bool> enableTextureReadbackHack; //!< If the CPU texture readback skipping hack should be used
|
Setting<bool> enableTextureReadbackHack; //!< If the CPU texture readback skipping hack should be used
|
||||||
|
|
||||||
|
// Audio
|
||||||
|
Setting<bool> isAudioOutputDisabled; //!< Disables audio output
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
Setting<bool> validationLayer; //!< If the vulkan validation layer is enabled
|
Setting<bool> validationLayer; //!< If the vulkan validation layer is enabled
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||||
|
|
||||||
|
#include <common/settings.h>
|
||||||
#include <kernel/types/KProcess.h>
|
#include <kernel/types/KProcess.h>
|
||||||
#include "IAudioRenderer.h"
|
#include "IAudioRenderer.h"
|
||||||
|
|
||||||
@ -68,6 +69,7 @@ namespace skyline::service::audio::IAudioRenderer {
|
|||||||
for (u32 i{}; i < effectsIn.size(); i++)
|
for (u32 i{}; i < effectsIn.size(); i++)
|
||||||
effects[i].ProcessInput(effectsIn[i]);
|
effects[i].ProcessInput(effectsIn[i]);
|
||||||
|
|
||||||
|
if (!*state.settings->isAudioOutputDisabled)
|
||||||
UpdateAudio();
|
UpdateAudio();
|
||||||
|
|
||||||
UpdateDataHeader outputHeader{
|
UpdateDataHeader outputHeader{
|
||||||
|
@ -28,6 +28,9 @@ class NativeSettings(context : Context, pref : PreferenceSettings) {
|
|||||||
var executorSlotCount : Int = pref.executorSlotCount
|
var executorSlotCount : Int = pref.executorSlotCount
|
||||||
var enableTextureReadbackHack : Boolean = pref.enableTextureReadbackHack
|
var enableTextureReadbackHack : Boolean = pref.enableTextureReadbackHack
|
||||||
|
|
||||||
|
// Audio
|
||||||
|
var isAudioOutputDisabled : Boolean = pref.isAudioOutputDisabled
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
var validationLayer : Boolean = BuildConfig.BUILD_TYPE != "release" && pref.validationLayer
|
var validationLayer : Boolean = BuildConfig.BUILD_TYPE != "release" && pref.validationLayer
|
||||||
|
|
||||||
|
@ -41,6 +41,9 @@ class PreferenceSettings @Inject constructor(@ApplicationContext private val con
|
|||||||
var executorSlotCount by sharedPreferences(context, 6)
|
var executorSlotCount by sharedPreferences(context, 6)
|
||||||
var enableTextureReadbackHack by sharedPreferences(context, false)
|
var enableTextureReadbackHack by sharedPreferences(context, false)
|
||||||
|
|
||||||
|
// Audio
|
||||||
|
var isAudioOutputDisabled by sharedPreferences(context, false)
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
var validationLayer by sharedPreferences(context, false)
|
var validationLayer by sharedPreferences(context, false)
|
||||||
|
|
||||||
|
@ -78,6 +78,11 @@
|
|||||||
<string name="enable_texture_readback_hack">Enable Texture Readback Hack</string>
|
<string name="enable_texture_readback_hack">Enable Texture Readback Hack</string>
|
||||||
<string name="enable_texture_readback_hack_enabled">Texture readback hack is enabled (Will break some games but others will have higher performance)</string>
|
<string name="enable_texture_readback_hack_enabled">Texture readback hack is enabled (Will break some games but others will have higher performance)</string>
|
||||||
<string name="enable_texture_readback_hack_disabled">Texture readback hack is disabled (Ensures highest accuracy)</string>
|
<string name="enable_texture_readback_hack_disabled">Texture readback hack is disabled (Ensures highest accuracy)</string>
|
||||||
|
<!-- Settings - Audio -->
|
||||||
|
<string name="audio">Audio</string>
|
||||||
|
<string name="disable_audio_output">Disable Audio Output</string>
|
||||||
|
<string name="disable_audio_output_enabled">Audio output is disabled</string>
|
||||||
|
<string name="disable_audio_output_disabled">Audio output is enabled</string>
|
||||||
<!-- Settings - Debug -->
|
<!-- Settings - Debug -->
|
||||||
<string name="debug">Debug</string>
|
<string name="debug">Debug</string>
|
||||||
<string name="validation_layer">Enable validation layer</string>
|
<string name="validation_layer">Enable validation layer</string>
|
||||||
|
@ -142,6 +142,17 @@
|
|||||||
app:key="enable_texture_readback_hack"
|
app:key="enable_texture_readback_hack"
|
||||||
app:title="@string/enable_texture_readback_hack" />
|
app:title="@string/enable_texture_readback_hack" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="category_audio"
|
||||||
|
android:title="@string/audio"
|
||||||
|
app:isPreferenceVisible="true">
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:summaryOff="@string/disable_audio_output_disabled"
|
||||||
|
android:summaryOn="@string/disable_audio_output_enabled"
|
||||||
|
app:key="is_audio_output_disabled"
|
||||||
|
app:title="@string/disable_audio_output" />
|
||||||
|
</PreferenceCategory>
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="category_debug"
|
android:key="category_debug"
|
||||||
android:title="@string/debug"
|
android:title="@string/debug"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user