mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Android: add support for Google Oboe (developer preview).
This commit is contained in:
parent
4aa7e318bb
commit
c859b4af1d
12 changed files with 1565 additions and 8 deletions
|
|
@ -103,7 +103,7 @@ public:
|
|||
ValueWithDefault androidJavaLibs, androidRepositories, androidDependencies, androidScreenOrientation, androidActivityClass,
|
||||
androidActivitySubClassName, androidActivityBaseClassName, androidManifestCustomXmlElements, androidVersionCode,
|
||||
androidMinimumSDK, androidTheme, androidSharedLibraries, androidStaticLibraries, androidExtraAssetsFolder,
|
||||
androidInternetNeeded, androidMicNeeded, androidBluetoothNeeded, androidExternalReadPermission,
|
||||
androidOboeRepositoryPath, androidInternetNeeded, androidMicNeeded, androidBluetoothNeeded, androidExternalReadPermission,
|
||||
androidExternalWritePermission, androidInAppBillingPermission, androidVibratePermission,androidOtherPermissions,
|
||||
androidEnableRemoteNotifications, androidRemoteNotificationsConfigFile, androidEnableContentSharing, androidKeyStore,
|
||||
androidKeyStorePass, androidKeyAlias, androidKeyAliasPass, gradleVersion, gradleToolchain, androidPluginVersion, buildToolsVersion;
|
||||
|
|
@ -125,6 +125,7 @@ public:
|
|||
androidSharedLibraries (settings, Ids::androidSharedLibraries, getUndoManager()),
|
||||
androidStaticLibraries (settings, Ids::androidStaticLibraries, getUndoManager()),
|
||||
androidExtraAssetsFolder (settings, Ids::androidExtraAssetsFolder, getUndoManager()),
|
||||
androidOboeRepositoryPath (settings, Ids::androidOboeRepositoryPath, getUndoManager()),
|
||||
androidInternetNeeded (settings, Ids::androidInternetNeeded, getUndoManager(), true),
|
||||
androidMicNeeded (settings, Ids::microphonePermissionNeeded, getUndoManager(), false),
|
||||
androidBluetoothNeeded (settings, Ids::androidBluetoothNeeded, getUndoManager(), true),
|
||||
|
|
@ -402,6 +403,14 @@ private:
|
|||
if (! isLibrary())
|
||||
mo << "SET(BINARY_NAME \"juce_jni\")" << newLine << newLine;
|
||||
|
||||
if (project.getConfigFlag ("JUCE_USE_ANDROID_OBOE").get())
|
||||
{
|
||||
String oboePath (androidOboeRepositoryPath.get().toString().quoted());
|
||||
|
||||
mo << "SET(OBOE_DIR " << oboePath << ")" << newLine << newLine;
|
||||
mo << "add_subdirectory (${OBOE_DIR} ./oboe)" << newLine << newLine;
|
||||
}
|
||||
|
||||
String cpufeaturesPath ("${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c");
|
||||
mo << "add_library(\"cpufeatures\" STATIC \"" << cpufeaturesPath << "\")" << newLine
|
||||
<< "set_source_files_properties(\"" << cpufeaturesPath << "\" PROPERTIES COMPILE_FLAGS \"-Wno-sign-conversion -Wno-gnu-statement-expression\")" << newLine << newLine;
|
||||
|
|
@ -419,6 +428,10 @@ private:
|
|||
mo << " \"" << escapeDirectoryForCmake (path) << "\"" << newLine;
|
||||
|
||||
mo << " \"${ANDROID_NDK}/sources/android/cpufeatures\"" << newLine;
|
||||
|
||||
if (project.getConfigFlag ("JUCE_USE_ANDROID_OBOE").get())
|
||||
mo << " \"${OBOE_DIR}/include\"" << newLine;
|
||||
|
||||
mo << ")" << newLine << newLine;
|
||||
}
|
||||
|
||||
|
|
@ -548,6 +561,10 @@ private:
|
|||
|
||||
mo << " \"cpufeatures\"" << newLine;
|
||||
}
|
||||
|
||||
if (project.getConfigFlag ("JUCE_USE_ANDROID_OBOE").get())
|
||||
mo << " \"oboe\"" << newLine;
|
||||
|
||||
mo << ")" << newLine;
|
||||
|
||||
overwriteFileIfDifferentOrThrow (file, mo);
|
||||
|
|
@ -892,6 +909,10 @@ private:
|
|||
//==============================================================================
|
||||
void createManifestExporterProperties (PropertyListBuilder& props)
|
||||
{
|
||||
props.add (new TextPropertyComponent (androidOboeRepositoryPath, "Oboe repository path", 2048, false),
|
||||
"Path to the root of Oboe repository. Make sure to point Oboe repository to "
|
||||
"commit with SHA 44c6b6ea9c8fa9b5b74cbd60f355068b57b50b37 before building.");
|
||||
|
||||
props.add (new ChoicePropertyComponent (androidInternetNeeded, "Internet Access"),
|
||||
"If enabled, this will set the android.permission.INTERNET flag in the manifest.");
|
||||
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ namespace Ids
|
|||
DECLARE_ID (androidVersionCode);
|
||||
DECLARE_ID (androidSDKPath);
|
||||
DECLARE_ID (androidNDKPath);
|
||||
DECLARE_ID (androidOboeRepositoryPath);
|
||||
DECLARE_ID (androidInternetNeeded);
|
||||
DECLARE_ID (androidArchitectures);
|
||||
DECLARE_ID (androidManifestCustomXmlElements);
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ void AudioDeviceManager::createAudioDeviceTypes (OwnedArray<AudioIODeviceType>&
|
|||
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_iOSAudio());
|
||||
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_ALSA());
|
||||
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_JACK());
|
||||
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_Oboe());
|
||||
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_OpenSLES());
|
||||
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_Android());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,4 +78,8 @@ AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_Android()
|
|||
AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_OpenSLES() { return nullptr; }
|
||||
#endif
|
||||
|
||||
#if ! (JUCE_ANDROID && JUCE_USE_ANDROID_OBOE)
|
||||
AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_Oboe() { return nullptr; }
|
||||
#endif
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
|
|
@ -161,6 +161,8 @@ public:
|
|||
static AudioIODeviceType* createAudioIODeviceType_Android();
|
||||
/** Creates an Android OpenSLES device type if it's available on this platform, or returns null. */
|
||||
static AudioIODeviceType* createAudioIODeviceType_OpenSLES();
|
||||
/** Creates an Oboe device type if it's available on this platform, or returns null. */
|
||||
static AudioIODeviceType* createAudioIODeviceType_Oboe();
|
||||
|
||||
protected:
|
||||
explicit AudioIODeviceType (const String& typeName);
|
||||
|
|
|
|||
|
|
@ -153,6 +153,10 @@
|
|||
#include <SLES/OpenSLES_AndroidConfiguration.h>
|
||||
#endif
|
||||
|
||||
#if JUCE_USE_ANDROID_OBOE
|
||||
#include <oboe/Oboe.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include "audio_io/juce_AudioDeviceManager.cpp"
|
||||
|
|
@ -211,6 +215,10 @@
|
|||
#if JUCE_USE_ANDROID_OPENSLES
|
||||
#include "native/juce_android_OpenSL.cpp"
|
||||
#endif
|
||||
|
||||
#if JUCE_USE_ANDROID_OBOE
|
||||
#include "native/juce_android_Oboe.cpp"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ! JUCE_SYSTEMAUDIOVOL_IMPLEMENTED
|
||||
|
|
|
|||
|
|
@ -108,11 +108,31 @@
|
|||
#define JUCE_JACK 0
|
||||
#endif
|
||||
|
||||
/** Config: JUCE_USE_ANDROID_OBOE
|
||||
***
|
||||
DEVELOPER PREVIEW - Oboe is currently in developer preview and
|
||||
is in active development. This preview allows for early access
|
||||
and evaluation for developers targeting Android platform.
|
||||
***
|
||||
|
||||
Enables Oboe devices (Android only, API 16 or above). Requires
|
||||
Oboe repository path to be specified in Android exporter.
|
||||
*/
|
||||
|
||||
#ifndef JUCE_USE_ANDROID_OBOE
|
||||
#define JUCE_USE_ANDROID_OBOE 0
|
||||
#endif
|
||||
|
||||
#if JUCE_USE_ANDROID_OBOE && JUCE_ANDROID_API_VERSION < 16
|
||||
#undef JUCE_USE_ANDROID_OBOE
|
||||
#define JUCE_USE_ANDROID_OBOE 0
|
||||
#endif
|
||||
|
||||
/** Config: JUCE_USE_ANDROID_OPENSLES
|
||||
Enables OpenSLES devices (Android only).
|
||||
*/
|
||||
#ifndef JUCE_USE_ANDROID_OPENSLES
|
||||
#if JUCE_ANDROID_API_VERSION > 8
|
||||
#if ! JUCE_USE_ANDROID_OBOE && JUCE_ANDROID_API_VERSION >= 9
|
||||
#define JUCE_USE_ANDROID_OPENSLES 1
|
||||
#else
|
||||
#define JUCE_USE_ANDROID_OPENSLES 0
|
||||
|
|
|
|||
|
|
@ -482,10 +482,16 @@ private:
|
|||
|
||||
|
||||
//==============================================================================
|
||||
extern bool isOboeAvailable();
|
||||
extern bool isOpenSLAvailable();
|
||||
|
||||
AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_Android()
|
||||
{
|
||||
#if JUCE_USE_ANDROID_OBOE
|
||||
if (isOboeAvailable())
|
||||
return nullptr;
|
||||
#endif
|
||||
|
||||
#if JUCE_USE_ANDROID_OPENSLES
|
||||
if (isOpenSLAvailable())
|
||||
return nullptr;
|
||||
|
|
|
|||
1490
modules/juce_audio_devices/native/juce_android_Oboe.cpp
Normal file
1490
modules/juce_audio_devices/native/juce_android_Oboe.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -570,7 +570,8 @@ DECLARE_JNI_CLASS (JavaHashMap, "java/util/HashMap");
|
|||
#undef JNI_CLASS_MEMBERS
|
||||
|
||||
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD) \
|
||||
STATICMETHOD (valueOf, "valueOf", "(I)Ljava/lang/Integer;")
|
||||
STATICMETHOD (parseInt, "parseInt", "(Ljava/lang/String;I)I") \
|
||||
STATICMETHOD (valueOf, "valueOf", "(I)Ljava/lang/Integer;")
|
||||
|
||||
DECLARE_JNI_CLASS (JavaInteger, "java/lang/Integer");
|
||||
#undef JNI_CLASS_MEMBERS
|
||||
|
|
|
|||
|
|
@ -929,8 +929,11 @@ extern "C" void* threadEntryProc (void* userData)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
#if JUCE_ANDROID && JUCE_MODULE_AVAILABLE_juce_audio_devices && (JUCE_USE_ANDROID_OPENSLES || (! defined(JUCE_USE_ANDROID_OPENSLES) && JUCE_ANDROID_API_VERSION > 8))
|
||||
#define JUCE_ANDROID_REALTIME_THREAD_AVAILABLE 1
|
||||
#if JUCE_ANDROID && JUCE_MODULE_AVAILABLE_juce_audio_devices && \
|
||||
((JUCE_USE_ANDROID_OPENSLES || (! defined(JUCE_USE_ANDROID_OPENSLES) && JUCE_ANDROID_API_VERSION > 8)) \
|
||||
|| (JUCE_USE_ANDROID_OBOE || (! defined(JUCE_USE_ANDROID_OBOE) && JUCE_ANDROID_API_VERSION > 15)))
|
||||
|
||||
#define JUCE_ANDROID_REALTIME_THREAD_AVAILABLE 1
|
||||
#endif
|
||||
|
||||
#if JUCE_ANDROID_REALTIME_THREAD_AVAILABLE
|
||||
|
|
|
|||
|
|
@ -200,9 +200,9 @@ public:
|
|||
for realtime audio processing.
|
||||
|
||||
Currently, this priority is identical to priority 9, except when building
|
||||
for Android with OpenSL support.
|
||||
for Android with OpenSL/Oboe support.
|
||||
|
||||
In this case, JUCE will ask OpenSL to construct a super high priority thread
|
||||
In this case, JUCE will ask OpenSL/Oboe to construct a super high priority thread
|
||||
specifically for realtime audio processing.
|
||||
|
||||
Note that this priority can only be set **before** the thread has
|
||||
|
|
@ -210,7 +210,7 @@ public:
|
|||
priority, is not supported under Android and will assert.
|
||||
|
||||
For best performance this thread should yield at regular intervals
|
||||
and not call any blocking APIS.
|
||||
and not call any blocking APIs.
|
||||
|
||||
@see startThread, setPriority, sleep, WaitableEvent
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue