@@ -103,7 +103,7 @@ public: | |||||
ValueWithDefault androidJavaLibs, androidRepositories, androidDependencies, androidScreenOrientation, androidActivityClass, | ValueWithDefault androidJavaLibs, androidRepositories, androidDependencies, androidScreenOrientation, androidActivityClass, | ||||
androidActivitySubClassName, androidActivityBaseClassName, androidManifestCustomXmlElements, androidVersionCode, | androidActivitySubClassName, androidActivityBaseClassName, androidManifestCustomXmlElements, androidVersionCode, | ||||
androidMinimumSDK, androidTheme, androidSharedLibraries, androidStaticLibraries, androidExtraAssetsFolder, | androidMinimumSDK, androidTheme, androidSharedLibraries, androidStaticLibraries, androidExtraAssetsFolder, | ||||
androidInternetNeeded, androidMicNeeded, androidBluetoothNeeded, androidExternalReadPermission, | |||||
androidOboeRepositoryPath, androidInternetNeeded, androidMicNeeded, androidBluetoothNeeded, androidExternalReadPermission, | |||||
androidExternalWritePermission, androidInAppBillingPermission, androidVibratePermission,androidOtherPermissions, | androidExternalWritePermission, androidInAppBillingPermission, androidVibratePermission,androidOtherPermissions, | ||||
androidEnableRemoteNotifications, androidRemoteNotificationsConfigFile, androidEnableContentSharing, androidKeyStore, | androidEnableRemoteNotifications, androidRemoteNotificationsConfigFile, androidEnableContentSharing, androidKeyStore, | ||||
androidKeyStorePass, androidKeyAlias, androidKeyAliasPass, gradleVersion, gradleToolchain, androidPluginVersion, buildToolsVersion; | androidKeyStorePass, androidKeyAlias, androidKeyAliasPass, gradleVersion, gradleToolchain, androidPluginVersion, buildToolsVersion; | ||||
@@ -125,6 +125,7 @@ public: | |||||
androidSharedLibraries (settings, Ids::androidSharedLibraries, getUndoManager()), | androidSharedLibraries (settings, Ids::androidSharedLibraries, getUndoManager()), | ||||
androidStaticLibraries (settings, Ids::androidStaticLibraries, getUndoManager()), | androidStaticLibraries (settings, Ids::androidStaticLibraries, getUndoManager()), | ||||
androidExtraAssetsFolder (settings, Ids::androidExtraAssetsFolder, getUndoManager()), | androidExtraAssetsFolder (settings, Ids::androidExtraAssetsFolder, getUndoManager()), | ||||
androidOboeRepositoryPath (settings, Ids::androidOboeRepositoryPath, getUndoManager()), | |||||
androidInternetNeeded (settings, Ids::androidInternetNeeded, getUndoManager(), true), | androidInternetNeeded (settings, Ids::androidInternetNeeded, getUndoManager(), true), | ||||
androidMicNeeded (settings, Ids::microphonePermissionNeeded, getUndoManager(), false), | androidMicNeeded (settings, Ids::microphonePermissionNeeded, getUndoManager(), false), | ||||
androidBluetoothNeeded (settings, Ids::androidBluetoothNeeded, getUndoManager(), true), | androidBluetoothNeeded (settings, Ids::androidBluetoothNeeded, getUndoManager(), true), | ||||
@@ -402,6 +403,14 @@ private: | |||||
if (! isLibrary()) | if (! isLibrary()) | ||||
mo << "SET(BINARY_NAME \"juce_jni\")" << newLine << newLine; | 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"); | String cpufeaturesPath ("${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c"); | ||||
mo << "add_library(\"cpufeatures\" STATIC \"" << cpufeaturesPath << "\")" << newLine | mo << "add_library(\"cpufeatures\" STATIC \"" << cpufeaturesPath << "\")" << newLine | ||||
<< "set_source_files_properties(\"" << cpufeaturesPath << "\" PROPERTIES COMPILE_FLAGS \"-Wno-sign-conversion -Wno-gnu-statement-expression\")" << newLine << 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 << " \"" << escapeDirectoryForCmake (path) << "\"" << newLine; | ||||
mo << " \"${ANDROID_NDK}/sources/android/cpufeatures\"" << newLine; | mo << " \"${ANDROID_NDK}/sources/android/cpufeatures\"" << newLine; | ||||
if (project.getConfigFlag ("JUCE_USE_ANDROID_OBOE").get()) | |||||
mo << " \"${OBOE_DIR}/include\"" << newLine; | |||||
mo << ")" << newLine << newLine; | mo << ")" << newLine << newLine; | ||||
} | } | ||||
@@ -548,6 +561,10 @@ private: | |||||
mo << " \"cpufeatures\"" << newLine; | mo << " \"cpufeatures\"" << newLine; | ||||
} | } | ||||
if (project.getConfigFlag ("JUCE_USE_ANDROID_OBOE").get()) | |||||
mo << " \"oboe\"" << newLine; | |||||
mo << ")" << newLine; | mo << ")" << newLine; | ||||
overwriteFileIfDifferentOrThrow (file, mo); | overwriteFileIfDifferentOrThrow (file, mo); | ||||
@@ -892,6 +909,10 @@ private: | |||||
//============================================================================== | //============================================================================== | ||||
void createManifestExporterProperties (PropertyListBuilder& props) | 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"), | props.add (new ChoicePropertyComponent (androidInternetNeeded, "Internet Access"), | ||||
"If enabled, this will set the android.permission.INTERNET flag in the manifest."); | "If enabled, this will set the android.permission.INTERNET flag in the manifest."); | ||||
@@ -191,6 +191,7 @@ namespace Ids | |||||
DECLARE_ID (androidVersionCode); | DECLARE_ID (androidVersionCode); | ||||
DECLARE_ID (androidSDKPath); | DECLARE_ID (androidSDKPath); | ||||
DECLARE_ID (androidNDKPath); | DECLARE_ID (androidNDKPath); | ||||
DECLARE_ID (androidOboeRepositoryPath); | |||||
DECLARE_ID (androidInternetNeeded); | DECLARE_ID (androidInternetNeeded); | ||||
DECLARE_ID (androidArchitectures); | DECLARE_ID (androidArchitectures); | ||||
DECLARE_ID (androidManifestCustomXmlElements); | DECLARE_ID (androidManifestCustomXmlElements); | ||||
@@ -158,6 +158,7 @@ void AudioDeviceManager::createAudioDeviceTypes (OwnedArray<AudioIODeviceType>& | |||||
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_iOSAudio()); | addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_iOSAudio()); | ||||
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_ALSA()); | addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_ALSA()); | ||||
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_JACK()); | addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_JACK()); | ||||
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_Oboe()); | |||||
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_OpenSLES()); | addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_OpenSLES()); | ||||
addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_Android()); | addIfNotNull (list, AudioIODeviceType::createAudioIODeviceType_Android()); | ||||
} | } | ||||
@@ -78,4 +78,8 @@ AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_Android() | |||||
AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_OpenSLES() { return nullptr; } | AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_OpenSLES() { return nullptr; } | ||||
#endif | #endif | ||||
#if ! (JUCE_ANDROID && JUCE_USE_ANDROID_OBOE) | |||||
AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_Oboe() { return nullptr; } | |||||
#endif | |||||
} // namespace juce | } // namespace juce |
@@ -161,6 +161,8 @@ public: | |||||
static AudioIODeviceType* createAudioIODeviceType_Android(); | static AudioIODeviceType* createAudioIODeviceType_Android(); | ||||
/** Creates an Android OpenSLES device type if it's available on this platform, or returns null. */ | /** Creates an Android OpenSLES device type if it's available on this platform, or returns null. */ | ||||
static AudioIODeviceType* createAudioIODeviceType_OpenSLES(); | static AudioIODeviceType* createAudioIODeviceType_OpenSLES(); | ||||
/** Creates an Oboe device type if it's available on this platform, or returns null. */ | |||||
static AudioIODeviceType* createAudioIODeviceType_Oboe(); | |||||
protected: | protected: | ||||
explicit AudioIODeviceType (const String& typeName); | explicit AudioIODeviceType (const String& typeName); | ||||
@@ -153,6 +153,10 @@ | |||||
#include <SLES/OpenSLES_AndroidConfiguration.h> | #include <SLES/OpenSLES_AndroidConfiguration.h> | ||||
#endif | #endif | ||||
#if JUCE_USE_ANDROID_OBOE | |||||
#include <oboe/Oboe.h> | |||||
#endif | |||||
#endif | #endif | ||||
#include "audio_io/juce_AudioDeviceManager.cpp" | #include "audio_io/juce_AudioDeviceManager.cpp" | ||||
@@ -211,6 +215,10 @@ | |||||
#if JUCE_USE_ANDROID_OPENSLES | #if JUCE_USE_ANDROID_OPENSLES | ||||
#include "native/juce_android_OpenSL.cpp" | #include "native/juce_android_OpenSL.cpp" | ||||
#endif | #endif | ||||
#if JUCE_USE_ANDROID_OBOE | |||||
#include "native/juce_android_Oboe.cpp" | |||||
#endif | |||||
#endif | #endif | ||||
#if ! JUCE_SYSTEMAUDIOVOL_IMPLEMENTED | #if ! JUCE_SYSTEMAUDIOVOL_IMPLEMENTED | ||||
@@ -108,11 +108,31 @@ | |||||
#define JUCE_JACK 0 | #define JUCE_JACK 0 | ||||
#endif | #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 | /** Config: JUCE_USE_ANDROID_OPENSLES | ||||
Enables OpenSLES devices (Android only). | Enables OpenSLES devices (Android only). | ||||
*/ | */ | ||||
#ifndef JUCE_USE_ANDROID_OPENSLES | #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 | #define JUCE_USE_ANDROID_OPENSLES 1 | ||||
#else | #else | ||||
#define JUCE_USE_ANDROID_OPENSLES 0 | #define JUCE_USE_ANDROID_OPENSLES 0 | ||||
@@ -482,10 +482,16 @@ private: | |||||
//============================================================================== | //============================================================================== | ||||
extern bool isOboeAvailable(); | |||||
extern bool isOpenSLAvailable(); | extern bool isOpenSLAvailable(); | ||||
AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_Android() | AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_Android() | ||||
{ | { | ||||
#if JUCE_USE_ANDROID_OBOE | |||||
if (isOboeAvailable()) | |||||
return nullptr; | |||||
#endif | |||||
#if JUCE_USE_ANDROID_OPENSLES | #if JUCE_USE_ANDROID_OPENSLES | ||||
if (isOpenSLAvailable()) | if (isOpenSLAvailable()) | ||||
return nullptr; | return nullptr; | ||||
@@ -570,7 +570,8 @@ DECLARE_JNI_CLASS (JavaHashMap, "java/util/HashMap"); | |||||
#undef JNI_CLASS_MEMBERS | #undef JNI_CLASS_MEMBERS | ||||
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD) \ | #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"); | DECLARE_JNI_CLASS (JavaInteger, "java/lang/Integer"); | ||||
#undef JNI_CLASS_MEMBERS | #undef JNI_CLASS_MEMBERS | ||||
@@ -929,8 +929,11 @@ extern "C" void* threadEntryProc (void* userData) | |||||
return nullptr; | 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 | #endif | ||||
#if JUCE_ANDROID_REALTIME_THREAD_AVAILABLE | #if JUCE_ANDROID_REALTIME_THREAD_AVAILABLE | ||||
@@ -200,9 +200,9 @@ public: | |||||
for realtime audio processing. | for realtime audio processing. | ||||
Currently, this priority is identical to priority 9, except when building | 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. | specifically for realtime audio processing. | ||||
Note that this priority can only be set **before** the thread has | 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. | priority, is not supported under Android and will assert. | ||||
For best performance this thread should yield at regular intervals | 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 | @see startThread, setPriority, sleep, WaitableEvent | ||||
*/ | */ | ||||