├── .gitignore
├── .gitmodules
├── .idea
├── codeStyles
│ └── Project.xml
├── compiler.xml
├── gradle.xml
├── jarRepositories.xml
├── misc.xml
└── vcs.xml
├── DelayEffect
├── .gitignore
├── CMakeLists.txt
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── ntrack
│ │ └── audioroute
│ │ └── delayeffect
│ │ ├── EffectModule.kt
│ │ └── MainActivity.kt
│ ├── jni
│ └── jni_bridge.cpp
│ └── res
│ ├── drawable-v24
│ └── ic_launcher_foreground.xml
│ ├── drawable-xxhdpi
│ └── ic_launcher.png
│ ├── drawable
│ └── ic_launcher_background.xml
│ ├── layout
│ └── activity_main.xml
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
├── Developer Guide.html
├── LICENSE
├── README.md
├── SimpleSynth
├── .!44864!ic_launcher-web.png
├── .!44883!ic_launcher-web.png
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── CMakeLists.txt
├── Makefile
├── build.gradle
├── ic_launcher-web.png
├── proguard-project.txt
├── project.properties
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── ntrack
│ │ └── audioroute
│ │ └── simplesynth
│ │ ├── Finger.java
│ │ ├── Key.java
│ │ ├── Piano.java
│ │ ├── SimpleSynthActivity.java
│ │ └── SimpleSynthModule.java
│ ├── jni
│ ├── Application.mk
│ ├── SimpleSynthActivity.cpp
│ ├── simplesynth.cpp
│ └── simplesynth.h
│ ├── libs
│ └── android-support-v4.jar
│ └── res
│ ├── drawable-xxhdpi
│ ├── app_icon.png
│ ├── key_black.xml
│ ├── key_black_depressed.xml
│ ├── key_black_pressed.xml
│ ├── key_white.xml
│ ├── key_white_depressed.xml
│ └── key_white_pressed.xml
│ ├── layout
│ └── activity_main.xml
│ ├── menu
│ └── main.xml
│ ├── values-sw600dp
│ └── dimens.xml
│ ├── values-sw720dp-land
│ └── dimens.xml
│ ├── values-v11
│ ├── attrs.xml
│ └── styles.xml
│ ├── values-v14
│ └── styles.xml
│ └── values
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── Transformation sample
├── After
│ ├── .gitignore
│ ├── .idea
│ │ ├── caches
│ │ │ └── build_file_checksums.ser
│ │ ├── codeStyles
│ │ │ └── Project.xml
│ │ ├── gradle.xml
│ │ ├── misc.xml
│ │ ├── runConfigurations.xml
│ │ └── vcs.xml
│ ├── OpenSLES_Synth
│ │ ├── .!44864!ic_launcher-web.png
│ │ ├── .!44883!ic_launcher-web.png
│ │ ├── .classpath
│ │ ├── .project
│ │ ├── .settings
│ │ │ └── org.eclipse.jdt.core.prefs
│ │ ├── CMakeLists.txt
│ │ ├── Makefile
│ │ ├── build.gradle
│ │ ├── ic_launcher-web.png
│ │ ├── proguard-project.txt
│ │ ├── project.properties
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── ntrack
│ │ │ │ └── audioroute
│ │ │ │ └── demo_opensl_synth
│ │ │ │ ├── Finger.java
│ │ │ │ ├── Key.java
│ │ │ │ ├── MyAppAudioModule.java
│ │ │ │ ├── OpenSLSynthActivity.java
│ │ │ │ └── Piano.java
│ │ │ ├── jni
│ │ │ ├── Android.mk
│ │ │ ├── Application.mk
│ │ │ ├── demo_opensl_synth.cpp
│ │ │ ├── demo_opensl_synth.h
│ │ │ └── demo_opensl_synthActivity.cpp
│ │ │ ├── libs
│ │ │ └── .gitignore
│ │ │ └── res
│ │ │ ├── drawable-xxhdpi
│ │ │ ├── app_icon.png
│ │ │ ├── key_black.xml
│ │ │ ├── key_black_depressed.xml
│ │ │ ├── key_black_pressed.xml
│ │ │ ├── key_white.xml
│ │ │ ├── key_white_depressed.xml
│ │ │ └── key_white_pressed.xml
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── menu
│ │ │ └── main.xml
│ │ │ ├── values-sw600dp
│ │ │ └── dimens.xml
│ │ │ ├── values-sw720dp-land
│ │ │ └── dimens.xml
│ │ │ ├── values-v11
│ │ │ ├── attrs.xml
│ │ │ └── styles.xml
│ │ │ ├── values-v14
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── Before
│ ├── .gitignore
│ ├── .idea
│ │ ├── caches
│ │ │ └── build_file_checksums.ser
│ │ ├── codeStyles
│ │ │ └── Project.xml
│ │ ├── gradle.xml
│ │ ├── misc.xml
│ │ ├── runConfigurations.xml
│ │ └── vcs.xml
│ ├── OpenSLES_Synth
│ │ ├── .!44864!ic_launcher-web.png
│ │ ├── .!44883!ic_launcher-web.png
│ │ ├── .classpath
│ │ ├── .project
│ │ ├── .settings
│ │ │ └── org.eclipse.jdt.core.prefs
│ │ ├── CMakeLists.txt
│ │ ├── Makefile
│ │ ├── build.gradle
│ │ ├── ic_launcher-web.png
│ │ ├── proguard-project.txt
│ │ ├── project.properties
│ │ └── src
│ │ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── ntrack
│ │ │ │ └── audioroute
│ │ │ │ └── demo_opensl_synth
│ │ │ │ ├── Finger.java
│ │ │ │ ├── Key.java
│ │ │ │ ├── OpenSLSynthActivity.java
│ │ │ │ └── Piano.java
│ │ │ ├── jni
│ │ │ ├── Android.mk
│ │ │ ├── Application.mk
│ │ │ ├── demo_opensl_synth.cpp
│ │ │ ├── demo_opensl_synth.h
│ │ │ └── demo_opensl_synthActivity.cpp
│ │ │ ├── libs
│ │ │ └── android-support-v4.jar
│ │ │ └── res
│ │ │ ├── drawable-xxhdpi
│ │ │ ├── app_icon.png
│ │ │ ├── key_black.xml
│ │ │ ├── key_black_depressed.xml
│ │ │ ├── key_black_pressed.xml
│ │ │ ├── key_white.xml
│ │ │ ├── key_white_depressed.xml
│ │ │ └── key_white_pressed.xml
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── menu
│ │ │ └── main.xml
│ │ │ ├── values-sw600dp
│ │ │ └── dimens.xml
│ │ │ ├── values-sw720dp-land
│ │ │ └── dimens.xml
│ │ │ ├── values-v11
│ │ │ ├── attrs.xml
│ │ │ └── styles.xml
│ │ │ ├── values-v14
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
└── README
├── audioroute
├── CMakeLists.txt
├── build.gradle
├── gradle.properties
├── include
│ └── audio_module.h
├── lib
│ ├── arm64-v8a
│ │ └── libaudiomodule.so
│ ├── armeabi-v7a
│ │ └── libaudiomodule.so
│ ├── x86
│ │ └── libaudiomodule.so
│ └── x86_64
│ │ └── libaudiomodule.so
├── maven-push.gradle
├── proguard-rules.txt
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── aidl
│ └── com
│ │ └── ntrack
│ │ └── audioroute
│ │ ├── IAudiorouteClient.aidl
│ │ ├── IAudiorouteService.aidl
│ │ └── RemoteModule.java
│ ├── java
│ └── com
│ │ └── ntrack
│ │ └── audioroute
│ │ ├── AudioModule.java
│ │ ├── AudioModuleForegroundService.java
│ │ ├── AudioRouteHostController.java
│ │ ├── Audioroute.java
│ │ ├── AudiorouteActivity.java
│ │ ├── AudiorouteActivityController.java
│ │ ├── AudiorouteException.java
│ │ ├── UrlTask.java
│ │ └── internal
│ │ ├── OpenSlParams.java
│ │ └── SharedMemoryUtils.java
│ ├── jni
│ ├── audio_module.h
│ ├── internal
│ │ ├── audio_module.cpp
│ │ ├── audio_module_internal.cpp
│ │ ├── audio_module_internal.h
│ │ ├── audio_module_jni.cpp
│ │ ├── audio_module_jni.h
│ │ ├── audioroute.c
│ │ ├── audioroute.h
│ │ ├── shared_memory_internal.c
│ │ ├── shared_memory_internal.h
│ │ ├── shared_memory_utils.c
│ │ ├── shared_memory_utils.h
│ │ ├── simple_barrier.c
│ │ └── simple_barrier.h
│ └── opensl_stream
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── opensl_stream.c
│ │ └── opensl_stream.h
│ └── res
│ ├── drawable-xhdpi
│ └── audioroute_logo.png
│ ├── values-v11
│ └── styles.xml
│ ├── values-v14
│ └── styles.xml
│ └── values
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── externals
└── README
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── hostsample
├── .gitignore
├── CMakeLists.txt
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── audioroute
│ │ └── hostsample
│ │ ├── AppListActivity.kt
│ │ ├── AudioEngine.kt
│ │ ├── Finger.java
│ │ ├── Key.java
│ │ ├── MainActivity.kt
│ │ ├── MyData.kt
│ │ ├── Piano.java
│ │ └── RecyclerViewAdapter.kt
│ ├── jni
│ ├── LiveEffectEngine.cpp
│ ├── LiveEffectEngine.h
│ ├── LockFreeQueue.h
│ └── jni_bridge.cpp
│ └── res
│ ├── animator
│ ├── zoomin.xml
│ └── zoomout.xml
│ ├── drawable-v24
│ └── ic_launcher_foreground.xml
│ ├── drawable
│ ├── eject.png
│ ├── ic_launcher_background.xml
│ ├── key_black.xml
│ ├── key_black_depressed.xml
│ ├── key_black_pressed.xml
│ ├── key_white.xml
│ ├── key_white_depressed.xml
│ ├── key_white_pressed.xml
│ ├── mic.png
│ ├── piano.png
│ ├── piano_on.png
│ ├── plus_circle.png
│ └── speakers.png
│ ├── layout
│ ├── activity_app_list.xml
│ ├── activity_main.xml
│ ├── activity_piano.xml
│ └── list_item.xml
│ ├── menu
│ └── items.xml
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ └── values
│ ├── attrs.xml
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | .externalNativeBuild
3 | .gradle
4 | .idea/workspace.xml
5 | Oboe/*
6 | LowpassSample/.DS_Store
7 | SimpleSynth/src/main/java/com/ntrack/audioroute/.DS_Store
8 | SimpleSynth/src/.DS_Store
9 | hostsamplekotlin/.DS_Store
10 | .idea/workspace.xml
11 | externals/.DS_Store
12 | .DS_Store
13 | delayeffect/src/main/.DS_Store
14 | delayeffect/src/.DS_Store
15 | delayeffect/.DS_Store
16 | .DS_Store
17 | delayeffect/.DS_Store
18 | *.iml
19 | .idea/caches
20 | .idea/modules.xml
21 | .idea/workspace.xml
22 | .idea/libraries
23 | audioroute/.idea/workspace.xml
24 | audioroute/include/*
25 | audioroute/lib/*
26 | mapping.zip
27 | audioroute/build.zip
28 | *.cxx
29 | non-repo
30 | local.properties
31 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "externals/oboe"]
2 | path = externals/oboe
3 | url = https://github.com/google/oboe.git
4 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
22 |
23 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/DelayEffect/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/DelayEffect/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # For more information about using CMake with Android Studio, read the
2 | # documentation: https://d.android.com/studio/projects/add-native-code.html
3 |
4 | # Sets the minimum version of CMake required to build the native library.
5 |
6 | cmake_minimum_required(VERSION 3.4.1)
7 |
8 | # Creates and names a library, sets it as either STATIC
9 | # or SHARED, and provides the relative paths to its source code.
10 | # You can define multiple libraries, and CMake builds them for you.
11 | # Gradle automatically packages shared libraries with your APK.
12 |
13 | include_directories(src/main/jni)
14 | include_directories(../audioroute/include)
15 |
16 | add_library( # Sets the name of the library.
17 | delayEffect
18 |
19 | # Sets the library as a shared library.
20 | SHARED
21 |
22 | # Provides a relative path to your source file(s).
23 | src/main/jni/jni_bridge.cpp
24 | )
25 |
26 | # Searches for a specified prebuilt library and stores the path as a
27 | # variable. Because CMake includes system libraries in the search path by
28 | # default, you only need to specify the name of the public NDK library
29 | # you want to add. CMake verifies that the library exists before
30 | # completing its build.
31 |
32 | find_library( # Sets the name of the path variable.
33 | log-lib
34 |
35 | # Specifies the name of the NDK library that
36 | # you want CMake to locate.
37 | log
38 | )
39 |
40 |
41 | # Specifies libraries CMake should link to your target library. You
42 | # can link multiple libraries, such as libraries you define in this
43 | # build script, prebuilt third-party libraries, or system libraries.
44 |
45 | target_link_libraries( # Specifies the target library.
46 | delayEffect
47 |
48 | # Links the target library to the log library
49 | # included in the NDK.
50 | ${log-lib}
51 | OpenSLES
52 | android
53 | atomic
54 | log
55 | )
56 |
--------------------------------------------------------------------------------
/DelayEffect/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 | android {
5 | compileSdkVersion 34
6 |
7 |
8 |
9 | defaultConfig {
10 | applicationId "com.audioroute.delay"
11 | minSdkVersion 21
12 | targetSdkVersion 34
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17 |
18 | }
19 | signingConfigs {
20 | config {
21 | keyAlias 'androiddebugkey'
22 | keyPassword 'android'
23 | storeFile file('../../private/codesigning/ntrack_debug_key.keystore')
24 | storePassword 'android'
25 | }
26 | }
27 | buildTypes {
28 | release {
29 | minifyEnabled false
30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
31 | signingConfig signingConfigs.config
32 | }
33 | debug {
34 | minifyEnabled false
35 | jniDebuggable = true
36 | ndk {
37 | //abiFilters "armeabi-v7a".
38 | }
39 | }
40 | }
41 |
42 | externalNativeBuild {
43 | cmake {
44 | path "CMakeLists.txt"
45 | }
46 | }
47 | ndkVersion = '26.3.11579264'
48 | namespace 'com.audioroute.delay'
49 |
50 | }
51 |
52 | dependencies {
53 | implementation fileTree(include: ['*.jar'], dir: 'libs')
54 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
55 | implementation 'com.android.support:appcompat-v7:28.0.0'
56 | implementation 'com.android.support.constraint:constraint-layout:1.1.2'
57 | testImplementation 'junit:junit:4.12'
58 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
59 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
60 | implementation 'com.android.support:support-annotations:28.0.0'
61 | // Switch which of the two lines below are commented to change from using the Maven version of the Audioroute lib to the one built from sources
62 | implementation project(':audioroute')
63 | //implementation 'com.ntrack.audioroute:audioroute:1.0.0'
64 | }
65 |
--------------------------------------------------------------------------------
/DelayEffect/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/DelayEffect/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/DelayEffect/src/main/java/com/ntrack/audioroute/delayeffect/EffectModule.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 n-Track S.r.l.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.audioroute.delay
18 |
19 | import android.util.Log
20 | import com.ntrack.audioroute.AudioModule
21 |
22 |
23 | class EffectModule : AudioModule() {
24 |
25 | var ptr: Long = 0
26 | var channels: Int = 2
27 |
28 | init {
29 | System.loadLibrary("delayEffect")
30 | }
31 |
32 | override fun configure_module(name: String, handle: Long): Boolean {
33 | if (ptr != 0L) {
34 | throw IllegalStateException("Module has already been configured.")
35 | }
36 | ptr = configureNativeComponents(handle, channels)
37 | return ptr != 0L
38 | }
39 |
40 | override fun getInputChannels(): Int {
41 | return 2
42 | }
43 |
44 | override fun getOutputChannels(): Int {
45 | return 2
46 | }
47 |
48 | override fun release() {
49 |
50 | }
51 |
52 | fun setParameter(feedback: Float, time: Float) {
53 | if (ptr == 0L) {
54 | Log.d("Audioroute effect", "Module is not configured.")
55 | return
56 | }
57 |
58 | setParameter(ptr, feedback, time)
59 | }
60 |
61 |
62 |
63 | external fun configureNativeComponents(handle: Long, channels: Int): Long
64 | external fun setParameter(ptr: Long, feedback: Float, time: Float)
65 |
66 | }
--------------------------------------------------------------------------------
/DelayEffect/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/DelayEffect/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/DelayEffect/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DelayEffect/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
29 |
30 |
41 |
42 |
52 |
53 |
62 |
63 |
--------------------------------------------------------------------------------
/DelayEffect/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/DelayEffect/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | DelayEffect
3 |
4 |
--------------------------------------------------------------------------------
/DelayEffect/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Developer Guide.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 | Redirecting
7 |
8 |
9 |
10 |
11 | Please wait....
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2019 n-Track S.r.l.
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
15 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AudioRoute
2 |
3 | Connect Android Audio apps
4 |
5 | To add AudioRoute SDK to your music app please check the Developer guide
6 | https://audioroute.ntrack.com/developer-guide.php
7 |
8 | Linking to the .so files is required only for host apps. Hosted apps only need to include the header files.
9 |
10 | ©2018-2019 n-Track S.r.l.
11 | Loosely based on Patchfield written by Peter Brinkmann ©2013 Google: https://github.com/google/patchfield
12 |
13 |
14 |
--------------------------------------------------------------------------------
/SimpleSynth/.!44864!ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/SimpleSynth/.!44864!ic_launcher-web.png
--------------------------------------------------------------------------------
/SimpleSynth/.!44883!ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/SimpleSynth/.!44883!ic_launcher-web.png
--------------------------------------------------------------------------------
/SimpleSynth/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/SimpleSynth/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | LowpassSample
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/SimpleSynth/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3 | org.eclipse.jdt.core.compiler.compliance=1.6
4 | org.eclipse.jdt.core.compiler.source=1.6
5 |
--------------------------------------------------------------------------------
/SimpleSynth/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # For more information about using CMake with Android Studio, read the
2 | # documentation: https://d.android.com/studio/projects/add-native-code.html
3 |
4 | # Sets the minimum version of CMake required to build the native library.
5 |
6 | cmake_minimum_required(VERSION 3.4.1)
7 |
8 | # Creates and names a library, sets it as either STATIC
9 | # or SHARED, and provides the relative paths to its source code.
10 | # You can define multiple libraries, and CMake builds them for you.
11 | # Gradle automatically packages shared libraries with your APK.
12 |
13 | # Set the path to the Oboe directory.
14 | set (OBOE_DIR ../externals/oboe)
15 |
16 | # Add the Oboe library as a subdirectory in your project.
17 | add_subdirectory (${OBOE_DIR} ./externals/oboe)
18 |
19 | # Specify the path to the Oboe header files.
20 | include_directories (${OBOE_DIR}/include)
21 |
22 | include_directories(src/main/jni)
23 | include_directories(../audioroute/src/main/jni)
24 |
25 | add_library( # Sets the name of the library.
26 | simplesynth
27 |
28 | # Sets the library as a shared library.
29 | SHARED
30 |
31 | # Provides a relative path to your source file(s).
32 | src/main/jni/simplesynth.cpp
33 | src/main/jni/SimpleSynthActivity.cpp
34 | )
35 | #add_library( audiomodule SHARED IMPORTED)
36 | #string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LCASE)
37 |
38 | #set_target_properties( audiomodule PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../audioroute/lib/${ANDROID_ABI}/libaudiomodule.so )
39 |
40 | # Searches for a specified prebuilt library and stores the path as a
41 | # variable. Because CMake includes system libraries in the search path by
42 | # default, you only need to specify the name of the public NDK library
43 | # you want to add. CMake verifies that the library exists before
44 | # completing its build.
45 |
46 | find_library( # Sets the name of the path variable.
47 | log-lib
48 |
49 | # Specifies the name of the NDK library that
50 | # you want CMake to locate.
51 | log
52 | )
53 |
54 |
55 | # Specifies libraries CMake should link to your target library. You
56 | # can link multiple libraries, such as libraries you define in this
57 | # build script, prebuilt third-party libraries, or system libraries.
58 |
59 | target_link_libraries( # Specifies the target library.
60 | simplesynth
61 |
62 | # Links the target library to the log library
63 | # included in the NDK.
64 | ${log-lib}
65 | OpenSLES
66 | #audiomodule
67 | oboe
68 | )
69 |
--------------------------------------------------------------------------------
/SimpleSynth/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | -javah -classpath bin/classes -o jni/lowpass.h \
3 | com.ntrack.audioroute.lowpass.SimpleSynthModule
4 | env NDK_MODULE_PATH=$(CURDIR)/.. ndk-build
5 |
--------------------------------------------------------------------------------
/SimpleSynth/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 |
6 | defaultConfig {
7 | applicationId "com.ntrack.audioroute.simplesynth"
8 | minSdkVersion 21
9 | targetSdkVersion 34
10 | }
11 | signingConfigs {
12 | config {
13 | keyAlias 'androiddebugkey'
14 | keyPassword 'android'
15 | storeFile file('../../private/codesigning/ntrack_debug_key.keystore')
16 | storePassword 'android'
17 | }
18 | }
19 | buildTypes {
20 | release {
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
22 | signingConfig signingConfigs.config
23 | }
24 | debug {
25 | jniDebuggable = true
26 | ndk {
27 | //abiFilters "armeabi-v7a"
28 | }
29 | }
30 | }
31 | lintOptions {
32 | abortOnError false
33 | }
34 |
35 | externalNativeBuild {
36 | cmake {
37 | path "CMakeLists.txt"
38 | }
39 | }
40 | ndkVersion = '26.3.11579264'
41 | namespace 'com.ntrack.audioroute.simplesynth'
42 | }
43 |
44 | dependencies {
45 | implementation 'com.android.support:appcompat-v7:28.0.0'
46 | // Switch which of the two lines below are commented to change from using the Maven version of the Audioroute lib to the one built from sources
47 | implementation project(':audioroute')
48 | //implementation 'com.ntrack.audioroute:audioroute:1.0.0'
49 | }
50 |
--------------------------------------------------------------------------------
/SimpleSynth/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/SimpleSynth/ic_launcher-web.png
--------------------------------------------------------------------------------
/SimpleSynth/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/SimpleSynth/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-17
15 | android.library.reference.1=../audioroute
16 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
13 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/java/com/ntrack/audioroute/simplesynth/Finger.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 n-Track S.r.l.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.ntrack.audioroute.simplesynth;
17 |
18 | import java.util.ArrayList;
19 |
20 | public class Finger {
21 | private ArrayList keys = new ArrayList();
22 |
23 | public Boolean isPressing(Key key){
24 | return this.keys.contains(key);
25 | }
26 |
27 | public void press(Key key) {
28 |
29 | if(key==null || this.isPressing(key)){
30 | return;
31 | }
32 |
33 | key.press(this);
34 | this.keys.add(key);
35 | }
36 |
37 | public void lift(){
38 | for(Key key : keys){
39 | key.depress(this);
40 | }
41 | keys.clear();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/java/com/ntrack/audioroute/simplesynth/Key.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 n-Track S.r.l.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.ntrack.audioroute.simplesynth;
18 |
19 | import android.graphics.drawable.Drawable;
20 |
21 | import java.util.ArrayList;
22 |
23 | public class Key {
24 |
25 | private Drawable drawable;
26 | private Piano piano;
27 | private Piano.PianoKeyListener listener;
28 | private ArrayList fingers = new ArrayList();;
29 | private int id;
30 |
31 | public static final int ACTION_KEY_DOWN = 0;
32 | public static final int ACTION_KEY_UP = 1;
33 |
34 | public Key(int id, Piano piano) {
35 | this.id = id;
36 | this.piano = piano;
37 | }
38 |
39 | public Boolean isPressed() {
40 | return fingers.size() > 0;
41 | }
42 |
43 | public void press(Finger finger) {
44 | this.fingers.add(finger);
45 | this.piano.invalidate();
46 | if (listener != null) {
47 | this.listener.keyPressed(id, Key.ACTION_KEY_DOWN);
48 | }
49 | }
50 |
51 | public void depress(Finger finger) {
52 | this.fingers.remove(finger);
53 | if (!isPressed()) {
54 | this.piano.invalidate();
55 | if (listener != null) {
56 | this.listener.keyPressed(id, Key.ACTION_KEY_UP);
57 | }
58 | }
59 | }
60 |
61 | public Drawable getDrawable() {
62 | return drawable;
63 | }
64 |
65 | public void setDrawable(Drawable drawable) {
66 | this.drawable = drawable;
67 | }
68 |
69 | public void setPianoKeyListener(Piano.PianoKeyListener listener) {
70 | this.listener = listener;
71 | }
72 |
73 | }
--------------------------------------------------------------------------------
/SimpleSynth/src/main/java/com/ntrack/audioroute/simplesynth/SimpleSynthModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 n-Track S.r.l. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 | * in compliance with the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License
10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 | * or implied. See the License for the specific language governing permissions and limitations under
12 | * the License.
13 | */
14 |
15 | package com.ntrack.audioroute.simplesynth;
16 |
17 | import android.app.Notification;
18 | import android.util.Log;
19 |
20 | import com.ntrack.audioroute.AudioModule;
21 |
22 | /**
23 | * A simple audioroute compatible synth
24 | */
25 |
26 | public class SimpleSynthModule extends AudioModule {
27 | private long ptr = 0;
28 | private final int channels;
29 |
30 | SimpleSynthActivity theActivity;
31 | public SimpleSynthModule(int channels, SimpleSynthActivity theActivity) {
32 | this.theActivity=theActivity;
33 | if (channels < 1) {
34 | throw new IllegalArgumentException("Channel count must be at least one.");
35 | }
36 | this.channels = channels;
37 | }
38 |
39 | @Override
40 | protected boolean configure_module(String name, long handle) {
41 | if (ptr != 0) {
42 | throw new IllegalStateException("Module has already been configured.");
43 | }
44 | ptr = configureNativeComponents(handle, channels);
45 | return ptr != 0;
46 | }
47 | @Override public void createNewInstanceIndex()
48 | {
49 | super.createNewInstanceIndex();
50 | if (ptr == 0) {
51 | Log.d("AudiorouteSimpleSynth", "Module has not been configured.");
52 | return;
53 | }
54 | configureNativeInstance(handle, ptr, instanceIndex);
55 | }
56 |
57 | @Override
58 | protected void release() {
59 | theActivity.checkStartAudio();
60 | if (ptr != 0) {
61 | release(ptr);
62 | ptr = 0;
63 | }
64 | }
65 |
66 | @Override
67 | public int getInputChannels() {
68 | return channels;
69 | }
70 |
71 | @Override
72 | public int getOutputChannels() {
73 | return channels;
74 | }
75 |
76 | /**
77 | * Sets the cutoff frequency of the lowpass filter.
78 | *
79 | * @param q cutoff frequency as a fraction of the sample rate.
80 | */
81 | public void setSimulateHang()
82 | {
83 | if (ptr == 0) return;
84 | setParameter(ptr, getCurrentInstanceId(), 1, 1);
85 | try {
86 | Thread.sleep(2000);
87 | }
88 | catch(InterruptedException e)
89 | {
90 |
91 | }
92 | setParameter(ptr, getCurrentInstanceId(), 1, 0);
93 | }
94 | public void setWaveform(int mode) {
95 | if (ptr == 0) return;
96 | setParameter(ptr, getCurrentInstanceId(), 0, mode);
97 | }
98 | public int getWaveform()
99 | {
100 | if (ptr == 0) {
101 | return 0;
102 | //throw new IllegalStateException("Module is not configured.");
103 | }
104 | return (int)getParameter(ptr, 0, getCurrentInstanceId());
105 | }
106 |
107 | private native long configureNativeComponents(long handle, int channels);
108 |
109 | private native void configureNativeInstance(long handle, long ptr, int instanceIndex);
110 |
111 | private native void release(long ptr);
112 |
113 | private native void setParameter(long ptr, long instance_index, int parameter, double alpha);
114 | private native double getParameter(long ptr, int parameter, long instance_index);
115 | }
116 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_OPTIM := release
2 | APP_ABI := armeabi armeabi-v7a x86
3 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/jni/simplesynth.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 n-Track S.r.l. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy
6 | * of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #include "simplesynth.h"
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 |
24 | #include "audio_module.h"
25 |
26 | static int pause_processing=0;
27 |
28 | float notesfrequencies[128]={0};
29 | simplesynth_data simplesynthData;
30 |
31 | static void init_func(void *context, int sample_rate, int framesPerBuffer, int instance_index, int connectedInputBuses[MaxNumBuses], int connectedOutputBuses[MaxNumBuses])
32 | {
33 | LOGI("simplesynth initializing processing instance %d: channels: %d framesperbuffer: %d sampling freq: %d", instance_index, connectedOutputBuses[0], framesPerBuffer, sample_rate);
34 | simplesynth_instance &data = ((simplesynth_data *) context)->instance[instance_index];
35 | if(data.samplerate!=sample_rate)
36 | {
37 | data.samplerate=sample_rate;
38 | for(int i=0; iinstance[instance_index];
47 | while(pause_processing) sleep(7);
48 | data.process(output_buffer, output_channels>1? (output_buffer+framesPerBuffer) : NULL, framesPerBuffer, 1, sample_rate, events, eventsNum);
49 | }
50 |
51 | SIMPLESINTH_NATIVE jlong JNICALL
52 | Java_com_ntrack_audioroute_simplesynth_SimpleSynthModule_configureNativeComponents
53 | (JNIEnv *env, jobject obj, jlong handle, jint channels) {
54 | audioroute_configure_java(env, obj, process_func, init_func, &simplesynthData);
55 | return (jlong) &simplesynthData;
56 | }
57 |
58 | SIMPLESINTH_NATIVE void JNICALL
59 | Java_com_ntrack_audioroute_simplesynth_SimpleSynthModule_configureNativeInstance
60 | (JNIEnv *env, jobject obj, jlong handle, jlong ptr, jint newInstance) {
61 |
62 | simplesynth_data *data = (simplesynth_data *)ptr;
63 | data->instance[newInstance].initialize();
64 | }
65 |
66 |
67 |
68 | SIMPLESINTH_NATIVE void JNICALL
69 | Java_com_ntrack_audioroute_simplesynth_SimpleSynthModule_release
70 | (JNIEnv *env, jobject obj, jlong p) {
71 | // Release resources here
72 | }
73 |
74 | SIMPLESINTH_NATIVE void JNICALL
75 | Java_com_ntrack_audioroute_simplesynth_SimpleSynthModule_setParameter
76 | (JNIEnv *env, jobject obj, jlong p, jlong instanceIndex, jint param, jdouble val) {
77 | simplesynth_data *data = (simplesynth_data *) p;
78 | if(param==0) {
79 | __sync_bool_compare_and_swap(&data->instance[instanceIndex].waveform,
80 | data->instance[instanceIndex].waveform, (int) (RANGE * val));
81 | }
82 | else {
83 | __sync_bool_compare_and_swap(&pause_processing,
84 | pause_processing, (int)val);
85 | }
86 | }
87 |
88 |
89 | SIMPLESINTH_NATIVE jdouble JNICALL
90 | Java_com_ntrack_audioroute_simplesynth_SimpleSynthModule_getParameter
91 | (JNIEnv *env, jobject obj, jlong p, jint param, jlong instanceIndex) {
92 | simplesynth_data *data = (simplesynth_data *) p;
93 | return data->instance[instanceIndex].waveform/RANGE;
94 | }
--------------------------------------------------------------------------------
/SimpleSynth/src/main/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/SimpleSynth/src/main/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/drawable-xxhdpi/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/SimpleSynth/src/main/res/drawable-xxhdpi/app_icon.png
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/drawable-xxhdpi/key_black.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/drawable-xxhdpi/key_black_depressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/drawable-xxhdpi/key_black_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/drawable-xxhdpi/key_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/drawable-xxhdpi/key_white_depressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/drawable-xxhdpi/key_white_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
18 |
26 |
27 |
35 |
41 |
42 |
50 |
51 |
59 |
60 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 128dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/values-v11/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Simple Synth Sample
5 | Settings
6 | Play me!
7 | AudiorouteService
8 |
9 |
10 |
--------------------------------------------------------------------------------
/SimpleSynth/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Transformation sample/After/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/libraries
5 | /.idea/modules.xml
6 | /.idea/workspace.xml
7 | .DS_Store
8 | /build
9 | /captures
10 | .externalNativeBuild
11 |
--------------------------------------------------------------------------------
/Transformation sample/After/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/Transformation sample/After/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/Transformation sample/After/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Transformation sample/After/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Transformation sample/After/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Transformation sample/After/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Transformation sample/After/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/.!44864!ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/Transformation sample/After/OpenSLES_Synth/.!44864!ic_launcher-web.png
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/.!44883!ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/Transformation sample/After/OpenSLES_Synth/.!44883!ic_launcher-web.png
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | LowpassSample
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3 | org.eclipse.jdt.core.compiler.compliance=1.6
4 | org.eclipse.jdt.core.compiler.source=1.6
5 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # For more information about using CMake with Android Studio, read the
2 | # documentation: https://d.android.com/studio/projects/add-native-code.html
3 |
4 | # Sets the minimum version of CMake required to build the native library.
5 |
6 | cmake_minimum_required(VERSION 3.4.1)
7 |
8 | # Creates and names a library, sets it as either STATIC
9 | # or SHARED, and provides the relative paths to its source code.
10 | # You can define multiple libraries, and CMake builds them for you.
11 | # Gradle automatically packages shared libraries with your APK.
12 |
13 | include_directories(src/main/jni)
14 | include_directories(../audioroute/include)
15 |
16 | add_library( # Sets the name of the library.
17 | demo_opensl_synth
18 |
19 | # Sets the library as a shared library.
20 | SHARED
21 |
22 | # Provides a relative path to your source file(s).
23 | src/main/jni/demo_opensl_synth.cpp
24 | src/main/jni/demo_opensl_synthActivity.cpp
25 | )
26 | #string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LCASE)
27 |
28 | # Searches for a specified prebuilt library and stores the path as a
29 | # variable. Because CMake includes system libraries in the search path by
30 | # default, you only need to specify the name of the public NDK library
31 | # you want to add. CMake verifies that the library exists before
32 | # completing its build.
33 |
34 | find_library( # Sets the name of the path variable.
35 | log-lib
36 |
37 | # Specifies the name of the NDK library that
38 | # you want CMake to locate.
39 | log
40 | )
41 |
42 |
43 | # Specifies libraries CMake should link to your target library. You
44 | # can link multiple libraries, such as libraries you define in this
45 | # build script, prebuilt third-party libraries, or system libraries.
46 |
47 | target_link_libraries( # Specifies the target library.
48 | demo_opensl_synth
49 |
50 | # Links the target library to the log library
51 | # included in the NDK.
52 | ${log-lib}
53 | OpenSLES
54 | )
55 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | -javah -classpath bin/classes -o jni/lowpass.h \
3 | com.ntrack.audioroute.lowpass.SimpleSynthModule
4 | env NDK_MODULE_PATH=$(CURDIR)/.. ndk-build
5 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | buildToolsVersion '28.0.3'
6 |
7 | defaultConfig {
8 | applicationId "com.ntrack.audioroute.demo_opensl_synth"
9 | minSdkVersion 16
10 | targetSdkVersion 28
11 | }
12 | signingConfigs {
13 | config {
14 | keyAlias 'androiddebugkey'
15 | keyPassword 'android'
16 | storeFile file('../codesigning/ntrack_debug_key.keystore')
17 | storePassword 'android'
18 | }
19 | }
20 | buildTypes {
21 | release {
22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
23 | signingConfig signingConfigs.config
24 | }
25 | debug {
26 | ndk {
27 | //abiFilters "armeabi-v7a"
28 | }
29 | }
30 | }
31 | lintOptions {
32 | abortOnError false
33 | }
34 |
35 | externalNativeBuild {
36 | cmake {
37 | path "CMakeLists.txt"
38 | }
39 | }
40 | }
41 |
42 | dependencies {
43 | implementation 'com.android.support:appcompat-v7:26.1.0'
44 | implementation 'com.ntrack.audioroute:audioroute:0.9.8'
45 | }
46 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/Transformation sample/After/OpenSLES_Synth/ic_launcher-web.png
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-17
15 | android.library.reference.1=../audioroute
16 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
14 |
15 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/java/com/ntrack/audioroute/demo_opensl_synth/Finger.java:
--------------------------------------------------------------------------------
1 | package com.ntrack.audioroute.demo_opensl_synth;
2 |
3 | import java.util.ArrayList;
4 |
5 | public class Finger {
6 | private ArrayList keys = new ArrayList();
7 |
8 | public Boolean isPressing(Key key){
9 | return this.keys.contains(key);
10 | }
11 |
12 | public void press(Key key) {
13 |
14 | if(key==null || this.isPressing(key)){
15 | return;
16 | }
17 |
18 | key.press(this);
19 | this.keys.add(key);
20 | }
21 |
22 | public void lift(){
23 | for(Key key : keys){
24 | key.depress(this);
25 | }
26 | keys.clear();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/java/com/ntrack/audioroute/demo_opensl_synth/Key.java:
--------------------------------------------------------------------------------
1 | package com.ntrack.audioroute.demo_opensl_synth;
2 |
3 | import android.graphics.drawable.Drawable;
4 |
5 | import java.util.ArrayList;
6 |
7 | public class Key {
8 |
9 | private Drawable drawable;
10 | private Piano piano;
11 | private Piano.PianoKeyListener listener;
12 | private ArrayList fingers = new ArrayList();;
13 | private int id;
14 |
15 | public static final int ACTION_KEY_DOWN = 0;
16 | public static final int ACTION_KEY_UP = 1;
17 |
18 | public Key(int id, Piano piano) {
19 | this.id = id;
20 | this.piano = piano;
21 | }
22 |
23 | public Boolean isPressed() {
24 | return fingers.size() > 0;
25 | }
26 |
27 | public void press(Finger finger) {
28 | this.fingers.add(finger);
29 | this.piano.invalidate();
30 | if (listener != null) {
31 | this.listener.keyPressed(id, Key.ACTION_KEY_DOWN);
32 | }
33 | }
34 |
35 | public void depress(Finger finger) {
36 | this.fingers.remove(finger);
37 | if (!isPressed()) {
38 | this.piano.invalidate();
39 | if (listener != null) {
40 | this.listener.keyPressed(id, Key.ACTION_KEY_UP);
41 | }
42 | }
43 | }
44 |
45 | public Drawable getDrawable() {
46 | return drawable;
47 | }
48 |
49 | public void setDrawable(Drawable drawable) {
50 | this.drawable = drawable;
51 | }
52 |
53 | public void setPianoKeyListener(Piano.PianoKeyListener listener) {
54 | this.listener = listener;
55 | }
56 |
57 | }
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/java/com/ntrack/audioroute/demo_opensl_synth/MyAppAudioModule.java:
--------------------------------------------------------------------------------
1 | package com.ntrack.audioroute.demo_opensl_synth;
2 | import com.ntrack.audioroute.AudioModule;
3 |
4 | public class MyAppAudioModule extends AudioModule {
5 | private long my_native_resources = 0;
6 |
7 | @Override
8 | protected boolean configure_module(String name, long handle) {
9 | my_native_resources = configureNativeComponents(handle, 2);
10 |
11 | return my_native_resources != 0;
12 | }
13 |
14 | @Override
15 | protected void release() {
16 | if (my_native_resources != 0) {
17 | release(my_native_resources);
18 | my_native_resources = 0;
19 | }
20 | }
21 |
22 | private native long configureNativeComponents(long handle, int channels);
23 |
24 | private native void release(long native_resources_pointer);
25 | }
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/jni/Android.mk:
--------------------------------------------------------------------------------
1 | # Note that NDK_MODULE_PATH must contain the audioroute parent directory. The
2 | # makefile in AudioroutePcmSample implicitly takes care of this.
3 |
4 | LOCAL_PATH := $(call my-dir)
5 |
6 | include $(CLEAR_VARS)
7 |
8 | LOCAL_MODULE := demo_opensl_synth
9 | LOCAL_LDLIBS := -llog
10 | LOCAL_SRC_FILES := demo_opensl_synth.c
11 | LOCAL_STATIC_LIBRARIES := audiomodule
12 | include $(BUILD_SHARED_LIBRARY)
13 | $(call import-module,Audioroute/jni)
14 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_OPTIM := release
2 | APP_ABI := armeabi armeabi-v7a x86
3 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/jni/demo_opensl_synth.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 n-Track S.r.l.. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy
6 | * of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #include "demo_opensl_synth.h"
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 |
24 | static int pause_processing=0;
25 |
26 | float notesfrequencies[128]={0};
27 |
28 | #include "audio_module.h"
29 |
30 |
31 | struct my_native_data
32 | {
33 | int data_you_may_need_for_audioroute;
34 | };
35 |
36 | // My audio callback
37 | void process_func(void *context, int sample_rate, int framesPerBuffer,
38 | int input_channels, const float *input_buffer,
39 | int output_channels, float *output_buffer, MusicEvent *events, int eventsNum, int instance_index, struct AudiorouteTimeInfo *timeInfo);
40 |
41 | // Audio processing initialization (called before the actual processing starts)
42 | // NOTE: the init_func may be called by an arbitrary thread. If you need to update UI inside this function make sure
43 | // you invoke the code responsible for updating the UI in the UI thread
44 | static void init_func(void *context, int sample_rate, int framesPerBuffer, int instance_index, int connectedInputBuses[MaxNumBuses], int connectedOutputBuses[MaxNumBuses])
45 | {
46 | // do your initialization stuff here, allocate resources based on sample_rate and framesPerBuffers etc.
47 | }
48 |
49 | // Tell Audioroute what your initialization and process callbacks are
50 | extern "C" JNIEXPORT jlong JNICALL
51 | Java_com_ntrack_audioroute_demo_1opensl_1synth_MyAppAudioModule_configureNativeComponents
52 | (JNIEnv *env, jobject obj, jlong handle, jint channels) {
53 | my_native_data *data = new my_native_data();
54 | audioroute_configure_java(env, obj, process_func, init_func, data);
55 | return (jlong) data;
56 | }
57 |
58 |
59 | // Release data allocated when connected to Audioroute
60 | extern "C" JNIEXPORT void JNICALL
61 | Java_com_ntrack_audioroute_demo_1opensl_1synth_MyAppAudioModule_release__J
62 | (JNIEnv *env, jobject obj, jlong p) {
63 | my_native_data *data = (my_native_data *) p;
64 | if(data) delete data;
65 | }
66 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/libs/.gitignore:
--------------------------------------------------------------------------------
1 | *.jar
2 |
3 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/drawable-xxhdpi/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/Transformation sample/After/OpenSLES_Synth/src/main/res/drawable-xxhdpi/app_icon.png
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/drawable-xxhdpi/key_black.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/drawable-xxhdpi/key_black_depressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/drawable-xxhdpi/key_black_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/drawable-xxhdpi/key_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/drawable-xxhdpi/key_white_depressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/drawable-xxhdpi/key_white_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
18 |
19 |
27 |
28 |
36 |
37 |
45 |
46 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 128dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/values-v11/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | OpenSLES Synth Sample
5 | Settings
6 | Play me!
7 |
8 |
--------------------------------------------------------------------------------
/Transformation sample/After/OpenSLES_Synth/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Transformation sample/After/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.5.0-beta01'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/Transformation sample/After/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
--------------------------------------------------------------------------------
/Transformation sample/After/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/Transformation sample/After/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Transformation sample/After/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Sep 25 17:21:19 CEST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
7 |
--------------------------------------------------------------------------------
/Transformation sample/After/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/Transformation sample/After/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':OpenSLES_Synth'
2 |
--------------------------------------------------------------------------------
/Transformation sample/Before/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/libraries
5 | /.idea/modules.xml
6 | /.idea/workspace.xml
7 | .DS_Store
8 | /build
9 | /captures
10 | .externalNativeBuild
11 |
--------------------------------------------------------------------------------
/Transformation sample/Before/.idea/caches/build_file_checksums.ser:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/Transformation sample/Before/.idea/caches/build_file_checksums.ser
--------------------------------------------------------------------------------
/Transformation sample/Before/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Transformation sample/Before/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Transformation sample/Before/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Transformation sample/Before/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Transformation sample/Before/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/.!44864!ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/Transformation sample/Before/OpenSLES_Synth/.!44864!ic_launcher-web.png
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/.!44883!ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/Transformation sample/Before/OpenSLES_Synth/.!44883!ic_launcher-web.png
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | LowpassSample
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3 | org.eclipse.jdt.core.compiler.compliance=1.6
4 | org.eclipse.jdt.core.compiler.source=1.6
5 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # For more information about using CMake with Android Studio, read the
2 | # documentation: https://d.android.com/studio/projects/add-native-code.html
3 |
4 | # Sets the minimum version of CMake required to build the native library.
5 |
6 | cmake_minimum_required(VERSION 3.4.1)
7 |
8 | # Creates and names a library, sets it as either STATIC
9 | # or SHARED, and provides the relative paths to its source code.
10 | # You can define multiple libraries, and CMake builds them for you.
11 | # Gradle automatically packages shared libraries with your APK.
12 |
13 | include_directories(src/main/jni)
14 | include_directories(../audioroute/src/main/jni)
15 |
16 | add_library( # Sets the name of the library.
17 | demo_opensl_synth
18 |
19 | # Sets the library as a shared library.
20 | SHARED
21 |
22 | # Provides a relative path to your source file(s).
23 | src/main/jni/demo_opensl_synth.cpp
24 | src/main/jni/demo_opensl_synthActivity.cpp
25 | )
26 | #string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LCASE)
27 |
28 | # Searches for a specified prebuilt library and stores the path as a
29 | # variable. Because CMake includes system libraries in the search path by
30 | # default, you only need to specify the name of the public NDK library
31 | # you want to add. CMake verifies that the library exists before
32 | # completing its build.
33 |
34 | find_library( # Sets the name of the path variable.
35 | log-lib
36 |
37 | # Specifies the name of the NDK library that
38 | # you want CMake to locate.
39 | log
40 | )
41 |
42 |
43 | # Specifies libraries CMake should link to your target library. You
44 | # can link multiple libraries, such as libraries you define in this
45 | # build script, prebuilt third-party libraries, or system libraries.
46 |
47 | target_link_libraries( # Specifies the target library.
48 | demo_opensl_synth
49 |
50 | # Links the target library to the log library
51 | # included in the NDK.
52 | ${log-lib}
53 | OpenSLES
54 | )
55 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/Makefile:
--------------------------------------------------------------------------------
1 | all:
2 | -javah -classpath bin/classes -o jni/lowpass.h \
3 | com.ntrack.audioroute.lowpass.SimpleSynthModule
4 | env NDK_MODULE_PATH=$(CURDIR)/.. ndk-build
5 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 |
6 | defaultConfig {
7 | applicationId "com.ntrack.audioroute.demo_opensl_synth"
8 | minSdkVersion 16
9 | targetSdkVersion 28
10 | }
11 | signingConfigs {
12 | config {
13 | keyAlias 'androiddebugkey'
14 | keyPassword 'android'
15 | storeFile file('../../../codesigning/ntrack_debug_key.keystore')
16 | storePassword 'android'
17 | }
18 | }
19 | buildTypes {
20 | release {
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
22 | signingConfig signingConfigs.config
23 | }
24 | debug {
25 | ndk {
26 | //abiFilters "armeabi-v7a"
27 | }
28 | }
29 | }
30 | lintOptions {
31 | abortOnError false
32 | }
33 |
34 | externalNativeBuild {
35 | cmake {
36 | path "CMakeLists.txt"
37 | }
38 | }
39 | }
40 |
41 | dependencies {
42 | implementation 'com.android.support:appcompat-v7:26.1.0'
43 | }
44 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/Transformation sample/Before/OpenSLES_Synth/ic_launcher-web.png
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-17
15 | android.library.reference.1=../audioroute
16 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/java/com/ntrack/audioroute/demo_opensl_synth/Finger.java:
--------------------------------------------------------------------------------
1 | package com.ntrack.audioroute.demo_opensl_synth;
2 |
3 | import java.util.ArrayList;
4 |
5 | public class Finger {
6 | private ArrayList keys = new ArrayList();
7 |
8 | public Boolean isPressing(Key key){
9 | return this.keys.contains(key);
10 | }
11 |
12 | public void press(Key key) {
13 |
14 | if(key==null || this.isPressing(key)){
15 | return;
16 | }
17 |
18 | key.press(this);
19 | this.keys.add(key);
20 | }
21 |
22 | public void lift(){
23 | for(Key key : keys){
24 | key.depress(this);
25 | }
26 | keys.clear();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/java/com/ntrack/audioroute/demo_opensl_synth/Key.java:
--------------------------------------------------------------------------------
1 | package com.ntrack.audioroute.demo_opensl_synth;
2 |
3 | import android.graphics.drawable.Drawable;
4 |
5 | import java.util.ArrayList;
6 |
7 | public class Key {
8 |
9 | private Drawable drawable;
10 | private Piano piano;
11 | private Piano.PianoKeyListener listener;
12 | private ArrayList fingers = new ArrayList();;
13 | private int id;
14 |
15 | public static final int ACTION_KEY_DOWN = 0;
16 | public static final int ACTION_KEY_UP = 1;
17 |
18 | public Key(int id, Piano piano) {
19 | this.id = id;
20 | this.piano = piano;
21 | }
22 |
23 | public Boolean isPressed() {
24 | return fingers.size() > 0;
25 | }
26 |
27 | public void press(Finger finger) {
28 | this.fingers.add(finger);
29 | this.piano.invalidate();
30 | if (listener != null) {
31 | this.listener.keyPressed(id, Key.ACTION_KEY_DOWN);
32 | }
33 | }
34 |
35 | public void depress(Finger finger) {
36 | this.fingers.remove(finger);
37 | if (!isPressed()) {
38 | this.piano.invalidate();
39 | if (listener != null) {
40 | this.listener.keyPressed(id, Key.ACTION_KEY_UP);
41 | }
42 | }
43 | }
44 |
45 | public Drawable getDrawable() {
46 | return drawable;
47 | }
48 |
49 | public void setDrawable(Drawable drawable) {
50 | this.drawable = drawable;
51 | }
52 |
53 | public void setPianoKeyListener(Piano.PianoKeyListener listener) {
54 | this.listener = listener;
55 | }
56 |
57 | }
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/jni/Android.mk:
--------------------------------------------------------------------------------
1 | # Note that NDK_MODULE_PATH must contain the audioroute parent directory. The
2 | # makefile in AudioroutePcmSample implicitly takes care of this.
3 |
4 | LOCAL_PATH := $(call my-dir)
5 |
6 | include $(CLEAR_VARS)
7 |
8 | LOCAL_MODULE := demo_opensl_synth
9 | LOCAL_LDLIBS := -llog
10 | LOCAL_SRC_FILES := demo_opensl_synth.c
11 | LOCAL_STATIC_LIBRARIES := audiomodule
12 | include $(BUILD_SHARED_LIBRARY)
13 | $(call import-module,Audioroute/jni)
14 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_OPTIM := release
2 | APP_ABI := armeabi armeabi-v7a x86
3 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/jni/demo_opensl_synth.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 n-Track S.r.l.. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 | * use this file except in compliance with the License. You may obtain a copy
6 | * of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #include "demo_opensl_synth.h"
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 |
24 | static int pause_processing=0;
25 |
26 | float notesfrequencies[128]={0};
27 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/Transformation sample/Before/OpenSLES_Synth/src/main/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/drawable-xxhdpi/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/Transformation sample/Before/OpenSLES_Synth/src/main/res/drawable-xxhdpi/app_icon.png
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/drawable-xxhdpi/key_black.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/drawable-xxhdpi/key_black_depressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/drawable-xxhdpi/key_black_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/drawable-xxhdpi/key_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/drawable-xxhdpi/key_white_depressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/drawable-xxhdpi/key_white_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
18 |
19 |
27 |
28 |
36 |
37 |
45 |
46 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | 128dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/values-v11/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | OpenSLES Synth Sample
5 | Settings
6 | Play me!
7 |
8 |
--------------------------------------------------------------------------------
/Transformation sample/Before/OpenSLES_Synth/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Transformation sample/Before/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.5.0-beta01'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/Transformation sample/Before/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
--------------------------------------------------------------------------------
/Transformation sample/Before/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/Transformation sample/Before/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Transformation sample/Before/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Sep 28 15:53:03 CEST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
7 |
--------------------------------------------------------------------------------
/Transformation sample/Before/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/Transformation sample/Before/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':OpenSLES_Synth'
2 |
--------------------------------------------------------------------------------
/Transformation sample/README:
--------------------------------------------------------------------------------
1 | This are the projects used in the Audioroute Tutorial video
2 |
--------------------------------------------------------------------------------
/audioroute/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # For more information about using CMake with Android Studio, read the
2 | # documentation: https://d.android.com/studio/projects/add-native-code.html
3 |
4 | # Sets the minimum version of CMake required to build the native library.
5 |
6 | cmake_minimum_required(VERSION 3.4.1)
7 |
8 | # Creates and names a library, sets it as either STATIC
9 | # or SHARED, and provides the relative paths to its source code.
10 | # You can define multiple libraries, and CMake builds them for you.
11 | # Gradle automatically packages shared libraries with your APK.
12 |
13 |
14 | add_library( # Sets the name of the library.
15 | audiomodule_static
16 |
17 | # Sets the library as a shared library.
18 | STATIC
19 |
20 | # Provides a relative path to your source file(s).
21 | src/main/jni/internal/audio_module.cpp
22 | src/main/jni/internal/audio_module_internal.cpp
23 | src/main/jni/internal/audio_module_jni.cpp
24 | src/main/jni/internal/audioroute.c
25 | src/main/jni/internal/shared_memory_internal.c
26 | src/main/jni/internal/shared_memory_utils.c
27 | src/main/jni/internal/simple_barrier.c
28 | src/main/jni/opensl_stream/opensl_stream.c
29 | )
30 |
31 | include_directories(src/main/jni)
32 |
33 | add_library( # Sets the name of the library.
34 | audiomodule
35 |
36 | # Sets the library as a shared library.
37 | SHARED
38 |
39 | # Provides a relative path to your source file(s).
40 | src/main/jni/internal/audio_module.cpp
41 | src/main/jni/internal/audio_module_internal.cpp
42 | src/main/jni/internal/audio_module_jni.cpp
43 | src/main/jni/internal/audioroute.c
44 | src/main/jni/internal/shared_memory_internal.c
45 | src/main/jni/internal/shared_memory_utils.c
46 | src/main/jni/internal/simple_barrier.c
47 | src/main/jni/opensl_stream/opensl_stream.c
48 | )
49 |
50 |
51 |
52 | # Searches for a specified prebuilt library and stores the path as a
53 | # variable. Because CMake includes system libraries in the search path by
54 | # default, you only need to specify the name of the public NDK library
55 | # you want to add. CMake verifies that the library exists before
56 | # completing its build.
57 |
58 | find_library( # Sets the name of the path variable.
59 | log-lib
60 | # Specifies the name of the NDK library that
61 | # you want CMake to locate.
62 | log )
63 |
64 |
65 | # Specifies libraries CMake should link to your target library. You
66 | # can link multiple libraries, such as libraries you define in this
67 | # build script, prebuilt third-party libraries, or system libraries.
68 |
69 | target_link_libraries( # Specifies the target library.
70 | audiomodule
71 | audiomodule_static
72 |
73 | # Links the target library to the log library
74 | # included in the NDK.
75 | ${log-lib}
76 | OpenSLES
77 | )
--------------------------------------------------------------------------------
/audioroute/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | //apply from: 'maven-push.gradle'
3 |
4 | android {
5 | signingConfigs {
6 | release {
7 | storeFile file('../../private/codesigning/ntrack_debug_key.keystore')
8 | storePassword 'android'
9 | keyPassword 'android'
10 | keyAlias = 'androiddebugkey'
11 | }
12 | }
13 | compileSdkVersion 29
14 |
15 | defaultConfig {
16 | minSdkVersion 21
17 | targetSdkVersion 34
18 |
19 | ndk {
20 | moduleName "audiomodule"
21 | }
22 | }
23 |
24 | buildTypes {
25 | release {
26 | minifyEnabled true
27 | proguardFiles 'proguard-rules.txt'
28 | //getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
29 | }
30 | debug {
31 | minifyEnabled false
32 | jniDebuggable = true
33 | }
34 | }
35 | externalNativeBuild {
36 | cmake {
37 | path "CMakeLists.txt"
38 | }
39 | }
40 | ndkVersion "26.3.11579264"
41 | lintOptions {
42 | // Turns off checks for the issue IDs you specify.
43 | quiet true
44 | // if set to true (default), stops the build if errors are found.
45 | abortOnError false
46 | // if true, only report errors.
47 | ignoreWarnings true
48 | }
49 | buildFeatures {
50 | aidl true
51 | }
52 | namespace 'com.ntrack.audioroute'
53 | }
54 |
55 | dependencies {
56 | implementation 'com.android.support:support-v4:28.0.0'
57 | }
58 |
--------------------------------------------------------------------------------
/audioroute/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_NAME=AudioRoute
2 | POM_ARTIFACT_ID=audioroute
3 | POM_PACKAGING=aar
--------------------------------------------------------------------------------
/audioroute/lib/arm64-v8a/libaudiomodule.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/audioroute/lib/arm64-v8a/libaudiomodule.so
--------------------------------------------------------------------------------
/audioroute/lib/armeabi-v7a/libaudiomodule.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/audioroute/lib/armeabi-v7a/libaudiomodule.so
--------------------------------------------------------------------------------
/audioroute/lib/x86/libaudiomodule.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/audioroute/lib/x86/libaudiomodule.so
--------------------------------------------------------------------------------
/audioroute/lib/x86_64/libaudiomodule.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/audioroute/lib/x86_64/libaudiomodule.so
--------------------------------------------------------------------------------
/audioroute/maven-push.gradle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/audioroute/maven-push.gradle
--------------------------------------------------------------------------------
/audioroute/proguard-rules.txt:
--------------------------------------------------------------------------------
1 | #
2 | # This ProGuard configuration file illustrates how to process a program
3 | # library, such that it remains usable as a library.
4 | # Usage:
5 | # java -jar proguard.jar @library.pro
6 | #
7 |
8 | # Save the obfuscation mapping to a file, so we can de-obfuscate any stack
9 | # traces later on. Keep a fixed source file attribute and all line number
10 | # tables to get line numbers in the stack traces.
11 | # You can comment this out if you're not interested in stack traces.
12 |
13 | -printmapping deobfuscate.map
14 | -keepparameternames
15 | -renamesourcefileattribute SourceFile
16 | -keepattributes Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,EnclosingMethod
17 |
18 | # Preserve all annotations.
19 |
20 | #-keepattributes *Annotation*
21 |
22 | # Preserve all public classes, and their public and protected fields and
23 | # methods.
24 |
25 | -keep public class * {
26 | public protected *;
27 | }
28 |
29 | # Preserve all .class method names.
30 |
31 | -keepclassmembernames class * {
32 | java.lang.Class class$(java.lang.String);
33 | java.lang.Class class$(java.lang.String, boolean);
34 | }
35 |
36 | # Preserve all native method names and the names of their classes.
37 |
38 | -keepclasseswithmembernames class * {
39 | native ;
40 | }
41 |
42 | # Preserve the special static methods that are required in all enumeration
43 | # classes.
44 |
45 | -keepclassmembers class * extends java.lang.Enum {
46 | public static **[] values();
47 | public static ** valueOf(java.lang.String);
48 | }
49 |
50 | # Explicitly preserve all serialization members. The Serializable interface
51 | # is only a marker interface, so it wouldn't save them.
52 | # You can comment this out if your library doesn't use serialization.
53 | # If your code contains serializable classes that have to be backward
54 | # compatible, please refer to the manual.
55 |
56 | -keepclassmembers class * implements java.io.Serializable {
57 | static final long serialVersionUID;
58 | static final java.io.ObjectStreamField[] serialPersistentFields;
59 | private void writeObject(java.io.ObjectOutputStream);
60 | private void readObject(java.io.ObjectInputStream);
61 | java.lang.Object writeReplace();
62 | java.lang.Object readResolve();
63 | }
64 |
65 | # Your library may contain more items that need to be preserved;
66 | # typically classes that are dynamically created using Class.forName:
67 |
68 | # -keep public class mypackage.MyClass
69 | # -keep public interface mypackage.MyInterface
70 | # -keep public class * implements mypackage.MyInterface
71 |
72 |
--------------------------------------------------------------------------------
/audioroute/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/audioroute/src/main/aidl/com/ntrack/audioroute/IAudiorouteClient.aidl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 n-Track S.r.l. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 | * in compliance with the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License
10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 | * or implied. See the License for the specific language governing permissions and limitations under
12 | * the License.
13 | */
14 |
15 | package com.ntrack.audioroute;
16 |
17 | import android.app.Notification;
18 |
19 | /**
20 | * Audioroute client interface for handling notifications when the state of the
21 | * audioroute changes. All methods are straightforward counterparts of methods
22 | * IAudiorouteService.aidl.
23 | */
24 | oneway interface IAudiorouteClient {
25 |
26 | void onModuleCreated(String name, int inputChannels, int outputChannels, in Notification notification);
27 | void onModuleDeleted(String name);
28 |
29 | void onModuleActivated(String name, int samplerate, int buffersize, in int[] connectedInputBuses, in int[] connectedOutputBuses);
30 | void onModuleDeactivated(String name);
31 |
32 | void onPortsConnected(String source, int sourcePort, String sink, int sinkPort);
33 | void onPortsDisconnected(String source, int sourcePort, String sink, int sinkPort);
34 |
35 | void onStart();
36 | void onStop();
37 | }
38 |
--------------------------------------------------------------------------------
/audioroute/src/main/aidl/com/ntrack/audioroute/RemoteModule.java:
--------------------------------------------------------------------------------
1 | package com.ntrack.audioroute;
2 |
3 | class RemoteModule {
4 | int inputBuses;
5 | int outputBuses;
6 | long nativePointer;
7 | String friendlyName;
8 | }
9 |
--------------------------------------------------------------------------------
/audioroute/src/main/java/com/ntrack/audioroute/Audioroute.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Google Inc. All Rights Reserved.
3 | * Copyright 2019 n-Track S.r.l.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 |
19 | package com.ntrack.audioroute;
20 |
21 | import android.content.Context;
22 | import android.util.Log;
23 |
24 | import com.ntrack.audioroute.internal.OpenSlParams;
25 |
26 | class Audioroute {
27 |
28 | public static final String ProductName = "AudioRoute";
29 | private static final String TAG = ProductName;
30 |
31 | public static native boolean isAlive(long context);
32 |
33 | public static native int getEngineData(long streamPtr);
34 |
35 | public static long getAudiorouteInstance(Context context, int inputChannels, int outputChannels)
36 | {
37 | OpenSlParams params = OpenSlParams.createInstance(context);
38 | long streamPtr = createInstance(params.getSampleRate(), params.getBufferSize(), inputChannels, outputChannels);
39 | Log.i(TAG, "Created stream with ptr " + streamPtr);
40 | return streamPtr;
41 | }
42 |
43 | public static synchronized void release(long streamPtr, int instance_index) {
44 | if (streamPtr != 0) {
45 | releaseInstance(streamPtr, instance_index);
46 | streamPtr = 0;
47 | }
48 | }
49 |
50 | public static synchronized int sendSharedMemoryFileDescriptor(long streamPtr) {
51 | if (streamPtr == 0) {
52 | throw new IllegalStateException("Stream closed.");
53 | }
54 | return AudiorouteException.successOrFailure(doSendSharedMemoryFileDescriptor(streamPtr));
55 | }
56 |
57 | private static native long createInstance(int sampleRate, int bufferSize, int inputChannels, int outputChannels);
58 |
59 | private static native void releaseInstance(long streamPtr, int instanceId);
60 |
61 | private static native int getProtocolVersion(long streamPtr);
62 | private static native int doSendSharedMemoryFileDescriptor(long streamPtr);
63 | protected static native boolean isModuleConnected(long streamPtr);
64 |
65 | protected static boolean isModuleConnectedPtr(long streamPtr)
66 | {
67 | return isModuleConnected(streamPtr);
68 | }
69 | }
70 |
71 |
--------------------------------------------------------------------------------
/audioroute/src/main/java/com/ntrack/audioroute/AudiorouteActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Google Inc. All Rights Reserved.
3 | * Copyright 2019 n-Track S.r.l.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 |
19 | package com.ntrack.audioroute;
20 |
21 | import android.app.Activity;
22 | import android.content.Intent;
23 | import android.graphics.Bitmap;
24 | import android.os.Bundle;
25 | import android.view.KeyEvent;
26 |
27 | /**
28 | * This convenience class encapsulates two common features of activities that use Audioroute, the
29 | * connection to the Audioroute service and routing of activity events to Audioroute.
30 | */
31 |
32 | public abstract class AudiorouteActivity extends Activity {
33 |
34 | protected AudiorouteActivityController controller;
35 |
36 | protected abstract String getModuleLabel();
37 | protected abstract Bitmap getModuleImage();
38 | @Override
39 | protected void onCreate(Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 | controller= AudiorouteActivityController.getInstance();
42 | controller.setModuleLabel(getModuleLabel());
43 | controller.setModuleImage(getModuleImage());
44 | controller.setListener(new AudiorouteActivityController.Listener() {
45 | @Override
46 | public void onRouteConnected() {
47 | onAudiorouteConnected();
48 | }
49 |
50 | @Override
51 | public void onRouteDisconnected() {
52 | onAudiorouteDisconnected();
53 | }
54 |
55 | @Override
56 | public AudioModule createAudioModule() {
57 | return createModule();
58 | }
59 | });
60 | controller.onActivityCreated(this, false);
61 | }
62 | @Override
63 | protected void onResume()
64 | {
65 | super.onResume();
66 | controller.onResume();
67 | }
68 | @Override protected void onNewIntent (Intent intent)
69 | {
70 | super.onNewIntent(intent);
71 | controller.onNewIntent(intent);
72 | }
73 | protected void onAudiorouteDisconnected()
74 | {
75 |
76 | }
77 | protected void onAudiorouteConnected()
78 | {
79 | }
80 |
81 | protected abstract AudioModule createModule();
82 | /**
83 | * When overriding the onDestroy method, make sure to invoke this parent method _at the end_.
84 | */
85 | @Override
86 | protected void onDestroy() {
87 | //controller.disconnect(this);
88 | super.onDestroy();
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/audioroute/src/main/java/com/ntrack/audioroute/AudiorouteException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Google Inc. All Rights Reserved.
3 | * Copyright 2019 n-Track S.r.l.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 |
19 | package com.ntrack.audioroute;
20 |
21 | /**
22 | * Checked exception for Java-style handling of error codes from Audioroute. The {@link Audioroute}
23 | * class itself doesn't throw exceptions but returns C-style error codes because exceptions can't be
24 | * thrown via AIDL. If, however, you prefer to use exceptions in Java, you can convert error codes
25 | * by wrapping calls to Audioroute in the throwOnError method below.
26 | */
27 | public class AudiorouteException extends Exception {
28 |
29 | // WARNING: Do not change these constants without updating references in audioroute.c.
30 | public static final int SUCCESS = 0;
31 | public static final int FAILURE = -1;
32 | public static final int INVALID_PARAMETERS = -2;
33 | public static final int NO_SUCH_MODULE = -3;
34 | public static final int MODULE_NAME_TAKEN = -4;
35 | public static final int TOO_MANY_MODULES = -5;
36 | public static final int PORT_OUT_OF_RANGE = -6;
37 | public static final int TOO_MANY_CONNECTIONS = -7;
38 | public static final int CYCLIC_DEPENDENCY = -8;
39 | public static final int OUT_OF_BUFFER_SPACE = -9;
40 | public static final int PROTOCOL_VERSION_MISMATCH = -10;
41 |
42 | private static final long serialVersionUID = 1L;
43 | private final int code;
44 |
45 | public AudiorouteException(int code) {
46 | this.code = code;
47 | }
48 |
49 | public int getCode() {
50 | return code;
51 | }
52 |
53 | public static int successOrFailure(int n) {
54 | return (n >= 0) ? SUCCESS : FAILURE;
55 | }
56 |
57 | public static int throwOnError(int code) throws AudiorouteException {
58 | if (code < 0) {
59 | throw new AudiorouteException(code);
60 | }
61 | return code;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/audioroute/src/main/java/com/ntrack/audioroute/internal/OpenSlParams.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Google. All Rights Reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 | * in compliance with the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License
10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 | * or implied. See the License for the specific language governing permissions and limitations under
12 | * the License.
13 | */
14 |
15 | package com.ntrack.audioroute.internal;
16 |
17 | import android.annotation.TargetApi;
18 | import android.content.Context;
19 | import android.media.AudioManager;
20 | import android.os.Build;
21 | import android.util.Log;
22 |
23 | /**
24 | * This class illustrates how to query OpenSL config parameters on Jelly Bean MR1 while maintaining
25 | * backward compatibility with older versions of Android. The trick is to place the new API calls in
26 | * an inner class that will only be loaded if we're running on JB MR1 or later.
27 | */
28 | public abstract class OpenSlParams {
29 |
30 | /**
31 | * @return The recommended sample rate in Hz.
32 | */
33 | public abstract int getSampleRate();
34 |
35 | /**
36 | * @return The recommended buffer size in frames.
37 | */
38 | public abstract int getBufferSize();
39 |
40 | /**
41 | * @param context, e.g., the current activity.
42 | * @return OpenSlParams instance for the given context.
43 | */
44 | public static OpenSlParams createInstance(Context context) {
45 | return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
46 | ? new JellyBeanMr1OpenSlParams(context)
47 | : new DefaultOpenSlParams();
48 | }
49 |
50 | private OpenSlParams() {
51 | // Not meant to be instantiated except here.
52 | }
53 |
54 | // Implementation for Jelly Bean MR1 or later.
55 | @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
56 | private static class JellyBeanMr1OpenSlParams extends OpenSlParams {
57 |
58 | private final int sampleRate;
59 | private final int bufferSize;
60 |
61 | private JellyBeanMr1OpenSlParams(Context context) {
62 | AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
63 | // Provide default values in case config lookup fails.
64 | int sr = 44100;
65 | int bs = 64;
66 | try {
67 | // If possible, query the native sample rate and buffer size.
68 | sr = Integer.parseInt(am.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE));
69 | bs = Integer.parseInt(am.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER));
70 | } catch (NumberFormatException e) {
71 | Log.w(getClass().getName(), "Failed to read native OpenSL config: " + e);
72 | }
73 | sampleRate = sr;
74 | bufferSize = bs;
75 | }
76 |
77 | @Override
78 | public int getSampleRate() {
79 | return sampleRate;
80 | }
81 |
82 | @Override
83 | public int getBufferSize() {
84 | return bufferSize;
85 | }
86 | };
87 |
88 | // Default factory for Jelly Bean or older.
89 | private static class DefaultOpenSlParams extends OpenSlParams {
90 | @Override
91 | public int getSampleRate() {
92 | return 44100;
93 | }
94 |
95 | @Override
96 | public int getBufferSize() {
97 | return 64;
98 | }
99 | };
100 | }
101 |
--------------------------------------------------------------------------------
/audioroute/src/main/java/com/ntrack/audioroute/internal/SharedMemoryUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Google Inc. All Rights Reserved.
3 | * Copyright 2019 n-Track S.r.l. All Rights Reserved.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6 | * in compliance with the License. You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software distributed under the License
11 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 | * or implied. See the License for the specific language governing permissions and limitations under
13 | * the License.
14 | */
15 |
16 | package com.ntrack.audioroute.internal;
17 |
18 | /**
19 | * Utilities for receiving file descriptors from the Audioroute service.
20 | */
21 | public class SharedMemoryUtils {
22 |
23 | static {
24 | //System.loadLibrary("shared_memory_utils");
25 | }
26 |
27 | public static native int receiveSharedMemoryFileDescriptor();
28 |
29 | public static native int closeSharedMemoryFileDescriptor(int fd);
30 | }
31 |
--------------------------------------------------------------------------------
/audioroute/src/main/jni/internal/audio_module.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Google Inc. All Rights Reserved.
3 | * Copyright 2019 n-Track S.r.l. All Rights Reserved.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 | * use this file except in compliance with the License. You may obtain a copy
7 | * of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * License for the specific language governing permissions and limitations
15 | * under the License.
16 | */
17 |
18 | #include "audio_module.h"
19 |
20 | #include "internal/audio_module_internal.h"
21 |
22 | void audioroute_configure(void *handle, audio_module_process_t process, initialize_processing_t initialize_processing, void *context, audioroute_engine **e) {
23 | audio_module_runner *amr = (audio_module_runner *) handle;
24 | amr->process = process;
25 | amr->initialize_processing=initialize_processing;
26 | amr->context = context;
27 | if(e) {
28 | *e = new audioroute_engine();
29 | (*e)->shm_ptr = amr->shm_ptr;
30 | }
31 | }
32 |
33 | void audioroute_configure(void *handle, audio_module_process_t process, initialize_processing_t initialize_processing, void *context)
34 | {
35 | audioroute_configure(handle, process, initialize_processing, context, NULL);
36 | }
--------------------------------------------------------------------------------
/audioroute/src/main/jni/internal/audio_module_jni.h:
--------------------------------------------------------------------------------
1 | /* DO NOT EDIT THIS FILE - it is machine generated */
2 | #include
3 | /* Header for class com_ntrack_audioroute_audioroute_AudioModule */
4 |
5 | #ifndef _Included_com_ntrack_audioroute_audioroute_AudioModule
6 | #define _Included_com_ntrack_audioroute_audioroute_AudioModule
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 | /*
11 | * Class: com_ntrack_audioroute_audioroute_AudioModule
12 | * Method: getProtocolVersion
13 | * Signature: ()I
14 | */
15 | JNIEXPORT jint JNICALL Java_com_ntrack_audioroute_AudioModule_getProtocolVersion
16 | (JNIEnv *, jclass);
17 |
18 | /*
19 | * Class: com_ntrack_audioroute_audioroute_AudioModule
20 | * Method: createRunner
21 | * Signature: (III)J
22 | */
23 | JNIEXPORT jlong JNICALL Java_com_ntrack_audioroute_AudioModule_createRunner
24 | (JNIEnv *, jobject, jint, jint, jint);
25 |
26 | /*
27 | * Class: com_ntrack_audioroute_audioroute_AudioModule
28 | * Method: release
29 | * Signature: (J)V
30 | */
31 | JNIEXPORT void JNICALL Java_com_ntrack_audioroute_AudioModule_release
32 | (JNIEnv *, jobject, jlong);
33 |
34 | /*
35 | * Class: com_ntrack_audioroute_audioroute_AudioModule
36 | * Method: hasTimedOut
37 | * Signature: (J)Z
38 | */
39 | JNIEXPORT jboolean JNICALL Java_com_ntrack_audioroute_AudioModule_hasTimedOut
40 | (JNIEnv *, jobject, jlong);
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 | #endif
46 | /* Header for class com_ntrack_audioroute_audioroute_AudioModule_FdReceiverThread */
47 |
48 | #ifndef _Included_com_ntrack_audioroute_audioroute_AudioModule_FdReceiverThread
49 | #define _Included_com_ntrack_audioroute_audioroute_AudioModule_FdReceiverThread
50 | #ifdef __cplusplus
51 | extern "C" {
52 | #endif
53 | #undef com_ntrack_audioroute_audioroute_AudioModule_FdReceiverThread_MIN_PRIORITY
54 | #define com_ntrack_audioroute_audioroute_AudioModule_FdReceiverThread_MIN_PRIORITY 1L
55 | #undef com_ntrack_audioroute_audioroute_AudioModule_FdReceiverThread_NORM_PRIORITY
56 | #define com_ntrack_audioroute_audioroute_AudioModule_FdReceiverThread_NORM_PRIORITY 5L
57 | #undef com_ntrack_audioroute_audioroute_AudioModule_FdReceiverThread_MAX_PRIORITY
58 | #define com_ntrack_audioroute_audioroute_AudioModule_FdReceiverThread_MAX_PRIORITY 10L
59 | #ifdef __cplusplus
60 | }
61 | #endif
62 | #endif
63 |
--------------------------------------------------------------------------------
/audioroute/src/main/jni/internal/shared_memory_internal.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Google Inc. All Rights Reserved.
3 | * Copyright 2019 n-Track S.r.l. All Rights Reserved.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 | * use this file except in compliance with the License. You may obtain a copy
7 | * of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * License for the specific language governing permissions and limitations
15 | * under the License.
16 | */
17 |
18 | /*
19 | * Tools for handling shared memory with ashmem. Most functions simply wrap
20 | * basic system calls, except for smi_{send,receive}, which serve to pass the
21 | * ashmem file descriptor across process boundaries using Unix domain sockets.
22 | */
23 |
24 | #ifndef __SHARED_MEMORY_INTERNAL_H__
25 | #define __SHARED_MEMORY_INTERNAL_H__
26 |
27 | #include
28 |
29 | #ifdef __cplusplus
30 | extern "C" {
31 | #endif
32 |
33 | int smi_create();
34 |
35 | void *smi_map(int fd);
36 |
37 | int smi_unmap(void *p);
38 |
39 | int smi_lock(void *p);
40 |
41 | int smi_unlock(void *p);
42 |
43 | int smi_protect(void *p, size_t n);
44 |
45 | int smi_send(int fd);
46 |
47 | int smi_receive();
48 |
49 | long smi_get_size();
50 |
51 | #endif
52 |
53 | #ifdef __cplusplus
54 | }
55 | #endif
56 |
--------------------------------------------------------------------------------
/audioroute/src/main/jni/internal/shared_memory_utils.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Google Inc. All Rights Reserved.
3 | * Copyright 2019 n-Track S.r.l. All Rights Reserved.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 | * use this file except in compliance with the License. You may obtain a copy
7 | * of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * License for the specific language governing permissions and limitations
15 | * under the License.
16 | */
17 |
18 | #include "shared_memory_utils.h"
19 |
20 | #include "internal/shared_memory_internal.h"
21 |
22 | #include
23 |
24 | JNIEXPORT jint JNICALL
25 | Java_com_ntrack_audioroute_internal_SharedMemoryUtils_receiveSharedMemoryFileDescriptor
26 | (JNIEnv *env, jclass cls) {
27 | return smi_receive();
28 | }
29 |
30 | JNIEXPORT jint JNICALL
31 | Java_com_ntrack_audioroute_internal_SharedMemoryUtils_closeSharedMemoryFileDescriptor
32 | (JNIEnv *env, jclass cls, jint fd) {
33 | return close(fd);
34 | }
35 |
--------------------------------------------------------------------------------
/audioroute/src/main/jni/internal/shared_memory_utils.h:
--------------------------------------------------------------------------------
1 | /* DO NOT EDIT THIS FILE - it is machine generated */
2 | #include
3 | /* Header for class com_ntrack_audioroute_audioroute_internal_SharedMemoryUtils */
4 |
5 | #ifndef _Included_com_ntrack_audioroute_audioroute_internal_SharedMemoryUtils
6 | #define _Included_com_ntrack_audioroute_audioroute_internal_SharedMemoryUtils
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 | /*
11 | * Class: com_ntrack_audioroute_audioroute_internal_SharedMemoryUtils
12 | * Method: receiveSharedMemoryFileDescriptor
13 | * Signature: ()I
14 | */
15 | JNIEXPORT jint JNICALL Java_com_ntrack_audioroute_internal_SharedMemoryUtils_receiveSharedMemoryFileDescriptor
16 | (JNIEnv *, jclass);
17 |
18 | /*
19 | * Class: com_ntrack_audioroute_audioroute_internal_SharedMemoryUtils
20 | * Method: closeSharedMemoryFileDescriptor
21 | * Signature: (I)I
22 | */
23 | JNIEXPORT jint JNICALL Java_com_ntrack_audioroute_internal_SharedMemoryUtils_closeSharedMemoryFileDescriptor
24 | (JNIEnv *, jclass, jint);
25 |
26 | #ifdef __cplusplus
27 | }
28 | #endif
29 | #endif
30 |
--------------------------------------------------------------------------------
/audioroute/src/main/jni/internal/simple_barrier.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Google Inc. All Rights Reserved.
3 | * Copyright 2019 n-Track S.r.l. All Rights Reserved.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 | * use this file except in compliance with the License. You may obtain a copy
7 | * of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 | * License for the specific language governing permissions and limitations
15 | * under the License.
16 | */
17 |
18 | /*
19 | * An atomic blocking boolean, designed to be robust when the underlying memory
20 | * location is overwritten by buggy or malicious code. Integer return values
21 | * are 0 for success, -1 for failure (due to timeouts), and -2 for errors (if
22 | * the memory location has been tampered with).
23 | */
24 |
25 | #ifndef __SIMPLE_BARRIER_H__
26 | #define __SIMPLE_BARRIER_H__
27 |
28 | #include
29 | #include
30 | #define LOGI(...) \
31 | __android_log_print(ANDROID_LOG_INFO, "audioroute_internal", __VA_ARGS__)
32 | #define LOGW(...) \
33 | __android_log_print(ANDROID_LOG_WARN, "audioroute_internal", __VA_ARGS__)
34 | #define LOGD(...) \
35 | __android_log_print(ANDROID_LOG_DEBUG, "audioroute_internal", __VA_ARGS__)
36 |
37 | #ifdef NDEBUG
38 | #define _ASSERT(x)
39 | #else
40 | #define _ASSERT(x) { if(!x) raise(SIGTRAP); }
41 | #endif
42 |
43 | //#define USE_OLD_LOCK
44 | #ifdef USE_OLD_LOCK
45 | #define AUDIOROUTE_LOCK_TIMEBASE CLOCK_MONOTONIC
46 | #else
47 | #define AUDIOROUTE_LOCK_TIMEBASE CLOCK_REALTIME
48 | #endif
49 |
50 | #ifdef __cplusplus
51 | extern "C" {
52 | #endif
53 | /*
54 | * Abstract data type representing a barrier.
55 | */
56 | typedef int simple_barrier_t;
57 | /*
58 | * If *p == 0, wait for another thread to invoke sb_wake(p). If *p == 1, return
59 | * immediately. The deadline is either NULL (i.e., no deadline) or an absolute
60 | * time measured with CLOCK_MONOTONIC.
61 | *
62 | * Use this function if multiple threads may be waiting on p.
63 | */
64 | int sb_wait(simple_barrier_t *p, struct timespec *abstime);
65 |
66 | /*
67 | * Like sb_wait, except it clears *p right after *p has become 1.
68 | *
69 | * Use this function if the current thread is the only thread waiting on p.
70 | */
71 | int sb_wait_and_clear(simple_barrier_t *p, struct timespec *abstime);
72 |
73 | /*
74 | * If *p == 0, set it to 1 and wake all threads waiting on p. If *p == 1, do
75 | * nothing.
76 | */
77 | int sb_wake(simple_barrier_t *p);
78 |
79 | /*
80 | * Clears *p, regardless of whether any threads are waiting on p.
81 | */
82 | void sb_clobber(simple_barrier_t *p);
83 |
84 | struct simple_lock_barrier_t{
85 | int barrier;
86 | int runnerThreadId;
87 | };
88 |
89 | int sb_wait_lock(struct simple_lock_barrier_t *p, struct timespec *abstime);
90 | int sb_wait_and_reset_lock(struct simple_lock_barrier_t *p, struct timespec *abstime);
91 | int sb_wake_lock(struct simple_lock_barrier_t *p);
92 | void sb_clobber_lock(struct simple_lock_barrier_t *p);
93 | void sb_init_lock(struct simple_lock_barrier_t *p, int runnerTid);
94 | void sb_sanity_check_log(struct simple_lock_barrier_t *p, char *msg);
95 | #ifdef __cplusplus
96 | }
97 | #endif
98 |
99 | #endif
100 |
--------------------------------------------------------------------------------
/audioroute/src/main/jni/opensl_stream/.gitignore:
--------------------------------------------------------------------------------
1 | # Object files
2 | *.o
3 |
4 | # Libraries
5 | *.lib
6 | *.a
7 |
8 | # Shared objects (inc. Windows DLLs)
9 | *.dll
10 | *.so
11 | *.so.*
12 | *.dylib
13 |
14 | # Executables
15 | *.exe
16 | *.out
17 | *.app
18 |
--------------------------------------------------------------------------------
/audioroute/src/main/jni/opensl_stream/README.md:
--------------------------------------------------------------------------------
1 | opensl_stream
2 | =============
3 |
4 | A simple callback-driven audio API for Android that sits on top of OpenSL and provides a credible illusion of synchronized input and output.
5 |
6 | Make sure to include "-lOpenSLES -llog" in LOCAL_LDLIBS.
7 |
8 | This library only requires Android 2.3 or later, i.e., it will work on all Android devices that support OpenSL.
9 |
10 | Sample code, including Java code for properly configuring OpenSL: https://github.com/nettoyeurny/opensl_stream_sample
11 |
12 | Important
13 | ---------
14 |
15 | Internally, OpenSL operates at a device-dependent native sample rate and buffer size. If at all possible, you should have opensl_stream operate at the native sample rate and buffer size, or else you'll risk suboptimal performance or even glitches.
16 |
17 | Jelly Bean MR1 introduced an API for detecting the native sample rate and buffer size; the sample project for opensl_stream shows how to use it. If you're targeting older devices, or if your synthesis library will not work at the native buffer size, then a sample rate of 44100Hz and a buffer size of 64 frames is a reasonable default. When in doubt, choose a smaller buffer size; larger buffers do not improve stability.
18 |
19 | Known issues
20 | ------------
21 |
22 | * At 48000Hz, Galaxy Nexus and Nexus 10 produce glitchy output.
23 | * At 44100Hz, Galaxy Nexus tends to glitch when switching activities or bringing up large dialogs.
24 | * Touch sounds occasionally cause OpenSL to glitch. It's probably a good idea to disable touch sounds in audio apps.
25 |
26 | These problems are not specific to opensl_stream and have been reproduced in other settings.
27 |
--------------------------------------------------------------------------------
/audioroute/src/main/jni/opensl_stream/opensl_stream.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Peter Brinkmann (peter.brinkmann@gmail.com)
3 | *
4 | * Based on sample code by Victor Lazzarini, available at
5 | * http://audioprograming.wordpress.com/2012/03/03/android-audio-streaming-with-opensl-es-and-the-ndk/
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | */
19 |
20 | #ifndef __OPENSL_STREAM_H__
21 | #define __OPENSL_STREAM_H__
22 |
23 | #ifdef __cplusplus
24 | extern "C" {
25 | #endif
26 |
27 | /*
28 | * Processing callback; takes a processing context (which is just a pointer to
29 | * whatever data you want to pass to the callback), the sample rate, the
30 | * buffer size in frames, the number of input and output channels, as well as
31 | * input and output buffers whose size will be the number of channels times
32 | * the number of frames per buffer.
33 | *
34 | * This function will be invoked on a dedicated audio thread, and so any data in
35 | * the context that may be modified concurrently must be protected (e.g., by gcc
36 | * atomics) to prevent race conditions.
37 | */
38 | typedef void (*opensl_process_t)
39 | (void *context, int sample_rate, int buffer_frames,
40 | int input_channels, const short *input_buffer,
41 | int output_channels, short *output_buffer);
42 |
43 | /*
44 | * Abstract data type for streaming audio with OpenSL.
45 | */
46 | typedef struct _opensl_stream OPENSL_STREAM;
47 |
48 | /*
49 | * Opens the audio device for the given sample rate and channel configuration;
50 | * registers an audio processing callback that will receive a context pointer
51 | * (which may be NULL if no context is needed). The context is owned by the
52 | * caller.
53 | *
54 | * The buffer size is the buffer size (in frames) at which OpenSL will operate.
55 | * Ideally, it should be the native buffer size of OpenSL. As of Android 4.2,
56 | * the AudioManager class in Java offers a method that will yield the
57 | * recommended sample rate and buffer size for OpenSL.
58 | *
59 | * If you don't know the native buffer size, or if your processing callback
60 | * cannot operate at the native buffer size, then you should use a smallish
61 | * buffer size, e.g., 64 frames. Somewhat surprisingly, large buffers will not
62 | * improve stability.
63 | *
64 | * For the time being, the number of input and output channels must be 0, 1,
65 | * or 2; at least one of the channel numbers must be positive.
66 | *
67 | * Returns NULL on failure.
68 | */
69 | OPENSL_STREAM *opensl_open(
70 | int sample_rate, int input_channels, int output_channels,
71 | int callback_buffer_size, opensl_process_t proc, void *context);
72 |
73 | /*
74 | * Stops playback and frees all resources associated with the given stream,
75 | * except for the context pointer, which is owned by the caller; the cleanup of
76 | * the context (if any) is the responsibility of the caller.
77 | */
78 | void opensl_close(OPENSL_STREAM *p);
79 |
80 | /*
81 | * Returns nonzero value if the given stream is currently running.
82 | */
83 | int opensl_is_running(OPENSL_STREAM *p);
84 |
85 | /*
86 | * Starts the audio stream.
87 | *
88 | * Returns 0 on success.
89 | */
90 | int opensl_start(OPENSL_STREAM *p);
91 |
92 | /*
93 | * Pauses the audio stream.
94 | */
95 | void opensl_pause(OPENSL_STREAM *p);
96 |
97 | #ifdef __cplusplus
98 | };
99 | #endif
100 |
101 | #endif // #ifndef __OPENSL_STREAM_H__
102 |
--------------------------------------------------------------------------------
/audioroute/src/main/res/drawable-xhdpi/audioroute_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/audioroute/src/main/res/drawable-xhdpi/audioroute_logo.png
--------------------------------------------------------------------------------
/audioroute/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/audioroute/src/main/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/audioroute/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Audioroute
4 |
5 |
6 |
--------------------------------------------------------------------------------
/audioroute/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | ext.kotlin_version = '1.6.21'
4 |
5 | repositories {
6 | jcenter()
7 | google()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:8.3.0'
11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | google()
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/externals/README:
--------------------------------------------------------------------------------
1 | Clone Oboe here: https://github.com/google/oboe
2 | Used by hostsample project
3 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | VERSION_NAME=1.0.2
21 | VERSION_CODE=100000200
22 | GROUP=com.ntrack.audioroute
23 |
24 | POM_DESCRIPTION=AudioRoute library
25 | POM_URL=https://audioroute.ntrack.com
26 | POM_SCM_URL=https://github.com/AudioRoute
27 | POM_SCM_CONNECTION=scm:git@github.com:AudioRoute/AudioRoute.git
28 | POM_SCM_DEV_CONNECTION=scm:git@github.com:AudioRoute/AudioRoute.git
29 | POM_LICENCE_NAME=AudioRoute SDK License, Version 1.0
30 | POM_LICENCE_URL=https://audioroute.ntrack.com/license.php
31 | POM_LICENCE_DIST=repo
32 | POM_DEVELOPER_ID=AudioRoute
33 | POM_DEVELOPER_NAME=nTrack
34 |
35 | NEXUS_USERNAME=AudioRoute
36 | NEXUS_PASSWORD=
37 |
38 | #Artifact signing key
39 | signing.keyId=
40 | signing.password=
41 | signing.secretKeyRingFile=
42 | android.defaults.buildfeatures.buildconfig=true
43 | android.nonTransitiveRClass=false
44 | android.nonFinalResIds=false
45 | #org.gradle.daemon=true
46 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/hostsample/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/hostsample/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # For more information about using CMake with Android Studio, read the
2 | # documentation: https://d.android.com/studio/projects/add-native-code.html
3 |
4 | # Sets the minimum version of CMake required to build the native library.
5 |
6 | cmake_minimum_required(VERSION 3.4.1)
7 |
8 | # Creates and names a library, sets it as either STATIC
9 | # or SHARED, and provides the relative paths to its source code.
10 | # You can define multiple libraries, and CMake builds them for you.
11 | # Gradle automatically packages shared libraries with your APK.
12 |
13 | include_directories(src/main/jni)
14 | include_directories(../audioroute/src/main/jni)
15 |
16 | add_library( # Sets the name of the library.
17 | hostsample
18 |
19 | # Sets the library as a shared library.
20 | SHARED
21 |
22 | # Provides a relative path to your source file(s).
23 | src/main/jni/LiveEffectEngine.cpp
24 | src/main/jni/jni_bridge.cpp
25 |
26 | )
27 | # Set the path to the Oboe directory.
28 | set (OBOE_DIR ../externals/oboe)
29 |
30 | # Add the Oboe library as a subdirectory in your project.
31 | add_subdirectory (${OBOE_DIR} ./externals/oboe)
32 |
33 | # Specify the path to the Oboe header files.
34 | include_directories (${OBOE_DIR}/include)
35 |
36 |
37 | add_library( audiomodule SHARED IMPORTED)
38 | string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LCASE)
39 |
40 | set(AUDIOROUTE_BUILDTYPE ${CMAKE_BUILD_TYPE_LCASE})
41 | if(${AUDIOROUTE_BUILDTYPE} STREQUAL "relwithdebinfo" )
42 | set(AUDIOROUTE_BUILDTYPE "release")
43 | else()
44 | set(AUDIOROUTE_BUILDTYPE "debug")
45 | endif()
46 |
47 | set_target_properties( audiomodule PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../audioroute/build/intermediates/cmake/${AUDIOROUTE_BUILDTYPE}/obj/${ANDROID_ABI}/libaudiomodule.so )
48 |
49 | # Searches for a specified prebuilt library and stores the path as a
50 | # variable. Because CMake includes system libraries in the search path by
51 | # default, you only need to specify the name of the public NDK library
52 | # you want to add. CMake verifies that the library exists before
53 | # completing its build.
54 |
55 | find_library( # Sets the name of the path variable.
56 | log-lib
57 |
58 | # Specifies the name of the NDK library that
59 | # you want CMake to locate.
60 | log
61 | )
62 |
63 |
64 | # Specifies libraries CMake should link to your target library. You
65 | # can link multiple libraries, such as libraries you define in this
66 | # build script, prebuilt third-party libraries, or system libraries.
67 |
68 | target_link_libraries( # Specifies the target library.
69 | hostsample
70 |
71 | # Links the target library to the log library
72 | # included in the NDK.
73 | ${log-lib}
74 | OpenSLES
75 | android
76 | atomic
77 | log
78 | oboe
79 | audiomodule
80 | )
81 |
--------------------------------------------------------------------------------
/hostsample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 | android {
5 | compileSdkVersion 28
6 |
7 |
8 |
9 | defaultConfig {
10 | applicationId "com.audioroute.hostsample"
11 | minSdkVersion 23
12 | targetSdkVersion 34
13 | versionCode 5
14 | versionName "1.4"
15 |
16 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17 |
18 | externalNativeBuild {
19 | cmake {
20 | cppFlags "-DOBOE_ENABLE_AAUDIO=0"
21 | }
22 | }
23 |
24 | }
25 | signingConfigs {
26 | config {
27 | keyAlias 'androiddebugkey'
28 | keyPassword 'android'
29 | storeFile file('../../private/codesigning/ntrack_debug_key.keystore')
30 | storePassword 'android'
31 | }
32 | }
33 | buildTypes {
34 | release {
35 | minifyEnabled false
36 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
37 | signingConfig signingConfigs.config
38 |
39 | }
40 | debug {
41 | jniDebuggable = true
42 | }
43 | }
44 |
45 | lintOptions {
46 | abortOnError false
47 | }
48 |
49 | externalNativeBuild {
50 | cmake {
51 | path "CMakeLists.txt"
52 | }
53 | }
54 | ndkVersion = '26.3.11579264'
55 | namespace 'com.audioroute.hostsample'
56 | }
57 |
58 | dependencies {
59 | implementation fileTree(include: ['*.jar'], dir: 'libs')
60 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
61 | implementation 'com.android.support:appcompat-v7:28.0.0'
62 | implementation 'com.android.support.constraint:constraint-layout:1.1.2'
63 | testImplementation 'junit:junit:4.12'
64 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
65 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
66 | implementation 'com.android.support:recyclerview-v7:28.0.0'
67 | implementation 'com.android.support:cardview-v7:28.0.0'
68 | implementation 'com.android.support:support-annotations:28.0.0'
69 | // Switch which of the two lines below are commented to change from using the Maven version of the Audioroute lib to the one built from sources
70 | implementation project(':audioroute')
71 | //implementation 'com.ntrack.audioroute:audioroute:1.0.0'
72 | }
--------------------------------------------------------------------------------
/hostsample/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/hostsample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
10 |
13 |
14 |
15 |
16 |
17 |
19 |
25 |
26 |
27 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
44 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/hostsample/src/main/java/com/audioroute/hostsample/Finger.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 n-Track S.r.l.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.audioroute.hostsample;
18 |
19 | import java.util.ArrayList;
20 |
21 | public class Finger {
22 | private ArrayList keys = new ArrayList();
23 |
24 | public Boolean isPressing(Key key){
25 | return this.keys.contains(key);
26 | }
27 |
28 | public void press(Key key) {
29 |
30 | if(key==null || this.isPressing(key)){
31 | return;
32 | }
33 |
34 | key.press(this);
35 | this.keys.add(key);
36 | }
37 |
38 | public void lift(){
39 | for(Key key : keys){
40 | key.depress(this);
41 | }
42 | keys.clear();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/hostsample/src/main/java/com/audioroute/hostsample/Key.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 n-Track S.r.l.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.audioroute.hostsample;
18 |
19 | import java.util.ArrayList;
20 |
21 | import android.graphics.drawable.Drawable;
22 |
23 | public class Key {
24 |
25 | private Drawable drawable;
26 | private Piano piano;
27 | private Piano.PianoKeyListener listener;
28 | private ArrayList fingers = new ArrayList();;
29 | private int id;
30 |
31 | public static final int ACTION_KEY_DOWN = 0;
32 | public static final int ACTION_KEY_UP = 1;
33 |
34 | public Key(int id, Piano piano) {
35 | this.id = id;
36 | this.piano = piano;
37 | }
38 |
39 | public Boolean isPressed() {
40 | return fingers.size() > 0;
41 | }
42 |
43 | public void press(Finger finger) {
44 | this.fingers.add(finger);
45 | this.piano.invalidate();
46 | if (listener != null) {
47 | this.listener.keyPressed(id, Key.ACTION_KEY_DOWN);
48 | }
49 | }
50 |
51 | public void depress(Finger finger) {
52 | this.fingers.remove(finger);
53 | if (!isPressed()) {
54 | this.piano.invalidate();
55 | if (listener != null) {
56 | this.listener.keyPressed(id, Key.ACTION_KEY_UP);
57 | }
58 | }
59 | }
60 |
61 | public Drawable getDrawable() {
62 | return drawable;
63 | }
64 |
65 | public void setDrawable(Drawable drawable) {
66 | this.drawable = drawable;
67 | }
68 |
69 | public void setPianoKeyListener(Piano.PianoKeyListener listener) {
70 | this.listener = listener;
71 | }
72 |
73 | }
--------------------------------------------------------------------------------
/hostsample/src/main/java/com/audioroute/hostsample/MyData.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 n-Track S.r.l.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.audioroute.hostsample
18 |
19 | import android.graphics.Bitmap
20 | import java.io.Serializable
21 |
22 | data class MyData(var text:String, var packageName:String, var image:Bitmap) : Serializable
--------------------------------------------------------------------------------
/hostsample/src/main/java/com/audioroute/hostsample/RecyclerViewAdapter.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 n-Track S.r.l.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.audioroute.hostsample
18 |
19 | import android.support.v7.widget.RecyclerView
20 | import android.util.Log
21 | import android.view.LayoutInflater
22 | import android.view.View
23 | import android.view.ViewGroup
24 | import android.widget.ImageView
25 | import android.widget.TextView
26 |
27 |
28 | class RecyclerViewAdapter(val list: ArrayList, val clickListener: (MyData) -> Unit) :
29 | RecyclerView.Adapter() {
30 |
31 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerViewAdapter.ViewHolder {
32 | val v = LayoutInflater.from(parent.context).inflate(R.layout.list_item, parent, false)
33 | return ViewHolder(v)
34 | }
35 |
36 | //this method is giving the size of the list
37 | override fun getItemCount(): Int {
38 | return list.size
39 | }
40 |
41 | class ViewHolder(view: View): RecyclerView.ViewHolder(view) {
42 | fun bindItems(data : MyData, clickListener: (MyData) -> Unit){
43 | val _textView:TextView = itemView.findViewById(R.id.textview)
44 | val _imageView:ImageView = itemView.findViewById(R.id.imageview)
45 | _textView.text = data.text
46 | _imageView.setImageBitmap(data.image)
47 | _imageView.scaleType=ImageView.ScaleType.CENTER_INSIDE
48 | //set the onclick listener for the singlt list item
49 | itemView.setOnClickListener({
50 | clickListener(data)
51 | })
52 | }
53 |
54 | }
55 |
56 | //this method is binding the data on the list
57 | override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
58 | (holder as ViewHolder).bindItems(list[position], clickListener)
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/hostsample/src/main/jni/LiveEffectEngine.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 n-Track S.r.l.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #ifndef OBOE_LIVEEFFECTENGINE_H
18 | #define OBOE_LIVEEFFECTENGINE_H
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | class Module {
28 |
29 | public:
30 | void* engineRef;
31 | int moduleIndex;
32 | int instanceIndex;
33 | bool connected=false;
34 | bool statusError=false;
35 | Module() {};
36 | };
37 |
38 | class LiveEffectEngine : public oboe::AudioStreamCallback {
39 | public:
40 | bool sendNoteMidi=true;
41 | float *mBufferInterleaved;
42 | LiveEffectEngine();
43 | ~LiveEffectEngine();
44 | void setRecordingDeviceId(int32_t deviceId);
45 | void setPlaybackDeviceId(int32_t deviceId);
46 | void setEngineOn(bool isOn);
47 | void InitModule(void *shm_ptr, int index, int instance_index, bool isInput, bool isOutput);
48 | void DisconnectModule(void *shm_ptr, int index, int instance_index);
49 | bool isModuleAlive(void *shm_ptr, int index, int instance_index);
50 | void SendMidiNoteOn(int note, bool noteOn);
51 | Module *inputModule, *effectModule, *outputModule;
52 | /*
53 | * oboe::AudioStreamCallback interface implementation
54 | */
55 | oboe::DataCallbackResult onAudioReady(oboe::AudioStream *oboeStream,
56 | void *audioData, int32_t numFrames);
57 | void onErrorBeforeClose(oboe::AudioStream *oboeStream, oboe::Result error);
58 | void onErrorAfterClose(oboe::AudioStream *oboeStream, oboe::Result error);
59 |
60 | bool setAudioApi(oboe::AudioApi);
61 | bool isAAudioSupported(void);
62 |
63 | bool AttachInput(bool enabled);
64 | bool AttachOutput(bool enabled);
65 |
66 | void FillMidiEvents();
67 | private:
68 |
69 | MusicEvent events[128];
70 | int numEvents=0;
71 | bool micEnabled=false;
72 | bool speakersEnabled=false;
73 | bool mIsEffectOn = false;
74 | uint64_t mProcessedFrameCount = 0;
75 | uint64_t mSystemStartupFrames = 0;
76 | int32_t mRecordingDeviceId = oboe::kUnspecified;
77 | int32_t mPlaybackDeviceId = oboe::kUnspecified;
78 | oboe::AudioFormat mFormat = oboe::AudioFormat::I16;
79 | int32_t mSampleRate = oboe::kUnspecified;
80 | int32_t mInputChannelCount = oboe::ChannelCount::Stereo;
81 | int32_t mOutputChannelCount = oboe::ChannelCount::Stereo;
82 | oboe::AudioStream *mRecordingStream = nullptr;
83 | oboe::AudioStream *mPlayStream = nullptr;
84 | std::mutex mRestartingLock;
85 | oboe::AudioApi mAudioApi = oboe::AudioApi::AAudio;
86 |
87 | void openRecordingStream();
88 | void openPlaybackStream();
89 |
90 | void startStream(oboe::AudioStream *stream);
91 | void stopStream(oboe::AudioStream *stream);
92 | void closeStream(oboe::AudioStream *stream);
93 |
94 | void openAllStreams();
95 | void closeAllStreams();
96 | void restartStreams();
97 |
98 | oboe::AudioStreamBuilder *setupCommonStreamParameters(
99 | oboe::AudioStreamBuilder *builder);
100 | oboe::AudioStreamBuilder *setupRecordingStreamParameters(
101 | oboe::AudioStreamBuilder *builder);
102 | oboe::AudioStreamBuilder *setupPlaybackStreamParameters(
103 | oboe::AudioStreamBuilder *builder);
104 | void warnIfNotLowLatency(oboe::AudioStream *stream);
105 | };
106 |
107 | #endif // OBOE_LIVEEFFECTENGINE_H
108 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/animator/zoomin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
13 |
22 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/animator/zoomout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
12 |
13 |
22 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/drawable/eject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/hostsample/src/main/res/drawable/eject.png
--------------------------------------------------------------------------------
/hostsample/src/main/res/drawable/key_black.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/drawable/key_black_depressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/drawable/key_black_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/drawable/key_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/drawable/key_white_depressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/drawable/key_white_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/drawable/mic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/hostsample/src/main/res/drawable/mic.png
--------------------------------------------------------------------------------
/hostsample/src/main/res/drawable/piano.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/hostsample/src/main/res/drawable/piano.png
--------------------------------------------------------------------------------
/hostsample/src/main/res/drawable/piano_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/hostsample/src/main/res/drawable/piano_on.png
--------------------------------------------------------------------------------
/hostsample/src/main/res/drawable/plus_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/hostsample/src/main/res/drawable/plus_circle.png
--------------------------------------------------------------------------------
/hostsample/src/main/res/drawable/speakers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/hostsample/src/main/res/drawable/speakers.png
--------------------------------------------------------------------------------
/hostsample/src/main/res/layout/activity_app_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/layout/activity_piano.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/layout/list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
15 |
16 |
20 |
21 |
27 |
28 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/menu/items.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/hostsample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/hostsample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AudioRoute/AudioRoute-SDK/af01cc2a2f5a4d2a071f02b2c47720aa8ba0bdd9/hostsample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/hostsample/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #252528
4 | #252528
5 | #FF4081
6 | #E9991C
7 |
8 |
9 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | HostSample
3 |
4 |
--------------------------------------------------------------------------------
/hostsample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':audioroute'
2 | include ':hostsample'
3 | include ':DelayEffect'
4 | include ':SimpleSynth'
5 |
--------------------------------------------------------------------------------