android - remove oboe

This commit is contained in:
Emmanuel Hansen 2023-11-11 18:33:14 +00:00
parent c6e2e16e0b
commit 038ee1a6dd
8 changed files with 9 additions and 185 deletions

View File

@ -6,6 +6,7 @@ using LibRyujinx.Jni.Values;
using LibRyujinx.Shared.Audio.Oboe;
using Microsoft.Win32.SafeHandles;
using Rxmxnx.PInvoke;
using Ryujinx.Audio.Backends.OpenAL;
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging;
using Ryujinx.Common.Logging.Targets;
@ -137,7 +138,7 @@ namespace LibRyujinx
JBoolean ignoreMissingServices)
{
Logger.Trace?.Print(LogClass.Application, "Jni Function Call");
AudioDriver = new OboeHardwareDeviceDriver();
AudioDriver = new OpenALHardwareDeviceDriver();//new OboeHardwareDeviceDriver();
return InitializeDevice(isHostMapped,
useNce,
(SystemLanguage)(int)systemLanguage,

View File

@ -26,6 +26,7 @@ using LibHac.FsSystem;
using LibHac.Fs;
using Path = System.IO.Path;
using LibHac;
using OpenTK.Audio.OpenAL;
using Ryujinx.Common.Configuration.Multiplayer;
using Ryujinx.HLE.Loaders.Npdm;
using Ryujinx.Common.Utilities;
@ -95,6 +96,8 @@ namespace LibRyujinx
return false;
}
OpenALLibraryNameContainer.OverridePath = "libopenal.so";
Logger.Notice.Print(LogClass.Application, "RyujinxAndroid is ready!");
return true;

View File

@ -16,6 +16,7 @@
<OptimizationPreference>Speed</OptimizationPreference>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Ryujinx.Audio.Backends.OpenAL\Ryujinx.Audio.Backends.OpenAL.csproj" />
<ProjectReference Include="..\Ryujinx.Audio.Backends.SDL2\Ryujinx.Audio.Backends.SDL2.csproj" />
<ProjectReference Include="..\Ryujinx.Input\Ryujinx.Input.csproj" />
<ProjectReference Include="..\Ryujinx.Common\Ryujinx.Common.csproj" />

View File

@ -11,8 +11,8 @@ android {
applicationId "org.ryujinx.android"
minSdk 30
targetSdk 33
versionCode 10003
versionName '1.0.3'
versionCode 10004
versionName '1.0.4'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
@ -94,7 +94,6 @@ dependencies {
implementation 'androidx.compose.material3:material3'
implementation 'com.github.swordfish90:radialgamepad:2.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.oboe:oboe:1.7.0'
implementation "com.anggrayudi:storage:1.5.5"
implementation "androidx.preference:preference-ktx:1.2.0"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.2'

View File

@ -28,7 +28,6 @@ add_library( # Sets the name of the library.
# Provides a relative path to your source file(s).
vulkan_wrapper.cpp
oboe.cpp
string_helper.cpp
ryujinx.cpp)
@ -45,8 +44,6 @@ find_library( # Sets the name of the path variable.
# you want CMake to locate.
log )
find_package (oboe REQUIRED CONFIG)
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
@ -55,7 +52,6 @@ target_link_libraries( # Specifies the target library.
ryujinxjni
# Links the target library to the log library
# included in the NDK.
oboe::oboe
${log-lib}
-lvulkan
-landroid

View File

@ -1,147 +0,0 @@
//
// Created by Emmanuel Hansen on 6/27/2023.
//
#include "oboe.h"
static int s_device_id = 0;
void AudioSession::initialize() {
}
void AudioSession::destroy() {
if(stream == nullptr)
return;
stream->close();
stream = nullptr;
}
void AudioSession::start() {
isStarted = true;
stream->requestStart();
}
void AudioSession::stop() {
isStarted = false;
stream->requestStop();
}
void AudioSession::read(uint64_t data, uint64_t samples) {
int timeout = INT32_MAX;
stream->write((void*)data, samples, timeout);
}
extern "C"
{
JNIEXPORT void JNICALL
Java_org_ryujinx_android_NativeHelpers_setDeviceId(
JNIEnv *env,
jobject instance,
jint device_id) {
s_device_id = device_id;
}
AudioSession *create_session(int sample_format,
uint sample_rate,
uint channel_count) {
using namespace oboe;
AudioStreamBuilder builder;
AudioFormat format;
switch (sample_format) {
case 0:
format = AudioFormat::Invalid;
break;
case 1:
case 2:
format = AudioFormat::I16;
break;
case 3:
format = AudioFormat::I24;
break;
case 4:
format = AudioFormat::I32;
break;
case 5:
format = AudioFormat::Float;
break;
default:
std::ostringstream string;
string << "Invalid Format" << sample_format;
throw std::runtime_error(string.str());
}
auto session = new AudioSession();
session->initialize();
session->format = format;
session->channelCount = channel_count;
builder.setDirection(Direction::Output)
->setPerformanceMode(PerformanceMode::LowLatency)
->setSharingMode(SharingMode::Shared)
->setFormat(format)
->setChannelCount(channel_count)
->setSampleRate(sample_rate);
AudioStream *stream;
if (builder.openStream(&stream) != oboe::Result::OK) {
delete session;
session = nullptr;
return nullptr;
}
session->stream = stream;
return session;
}
void start_session(AudioSession *session) {
if (session == nullptr)
return;
session->start();
}
void stop_session(AudioSession *session) {
if (session == nullptr)
return;
session->stop();
}
void set_session_volume(AudioSession *session, float volume) {
if (session == nullptr)
return;
session->volume = volume;
}
float get_session_volume(AudioSession *session) {
if (session == nullptr)
return 0;
return session->volume;
}
void close_session(AudioSession *session) {
if (session == nullptr)
return;
session->destroy();
delete session;
}
bool is_playing(AudioSession *session) {
if (session == nullptr)
return false;
return session->isStarted;
}
void write_to_session(AudioSession *session, uint64_t data, uint64_t samples) {
if (session == nullptr)
return;
session->read(data, samples);
}
}

View File

@ -1,29 +0,0 @@
//
// Created by Emmanuel Hansen on 6/27/2023.
//
#ifndef RYUJINXNATIVE_OBOE_H
#define RYUJINXNATIVE_OBOE_H
#include <oboe/Oboe.h>
#include <stdlib.h>
#include <stdio.h>
#include <jni.h>
#include <queue>
class AudioSession {
public:
oboe::AudioStream* stream;
float volume = 1.0f;
bool isStarted;
oboe::AudioFormat format;
uint channelCount;
void initialize();
void destroy();
void start();
void stop();
void read(uint64_t data, uint64_t samples);
};
#endif //RYUJINXNATIVE_OBOE_H

View File

@ -226,7 +226,7 @@ class HomeViews {
}
}
/*val showAppletMenu = remember { mutableStateOf(false) }
/*\val showAppletMenu = remember { mutableStateOf(false) }
Box {
IconButton(onClick = {
showAppletMenu.value = true