Move dead submodules in-tree
Signed-off-by: swurl <swurl@swurl.xyz>
1
externals/oboe/apps/fxlab/app/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
79
externals/oboe/apps/fxlab/app/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
# For more information about using CMake with Android Studio, read the
|
||||
# documentation: https://d.android.com/studio/projects/add-native-code.html
|
||||
|
||||
# Sets the minimum version of CMake required to build the native library.
|
||||
|
||||
cmake_minimum_required(VERSION 3.4.1)
|
||||
|
||||
# Require C++17 compiler with no extensions
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
link_directories(${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
|
||||
# Creates and names a library, sets it as either STATIC
|
||||
# or SHARED, and provides the relative paths to its source code.
|
||||
# You can define multiple libraries, and CMake builds them for you.
|
||||
# Gradle automatically packages shared libraries with your APK.
|
||||
|
||||
add_library( # Sets the name of the library.
|
||||
native-lib
|
||||
# Sets the library as a shared library.
|
||||
SHARED
|
||||
# Provides a relative path to your source file(s).
|
||||
src/main/cpp/native-lib.cpp
|
||||
src/main/cpp/DuplexEngine.cpp
|
||||
)
|
||||
|
||||
# Compile with warnings for safety
|
||||
if(MSVC)
|
||||
target_compile_options(native-lib PRIVATE /W4 /WX)
|
||||
else()
|
||||
target_compile_options(native-lib PRIVATE -Wall -Wextra -pedantic)
|
||||
endif()
|
||||
|
||||
target_compile_options(native-lib PRIVATE -Ofast)
|
||||
|
||||
# Searches for a specified prebuilt library and stores the path as a
|
||||
# variable. Because CMake includes system libraries in the search path by
|
||||
# default, you only need to specify the name of the public NDK library
|
||||
# you want to add. CMake verifies that the library exists before
|
||||
# completing its build.
|
||||
|
||||
find_library( # Sets the name of the path variable.
|
||||
log-lib
|
||||
# Specifies the name of the NDK library that
|
||||
# you want CMake to locate.
|
||||
log)
|
||||
|
||||
|
||||
### INCLUDE OBOE LIBRARY ###
|
||||
|
||||
# Set the path to the Oboe library directory
|
||||
set (OBOE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
|
||||
|
||||
# Add the Oboe library as a subproject. Since Oboe is an out-of-tree source library we must also
|
||||
# specify a binary directory
|
||||
add_subdirectory(${OBOE_DIR} ./oboe-bin)
|
||||
|
||||
# Specify the path to the Oboe header files and the source.
|
||||
include_directories(
|
||||
${OBOE_DIR}/include
|
||||
${OBOE_DIR}/src
|
||||
)
|
||||
|
||||
### END OBOE INCLUDE SECTION ###
|
||||
|
||||
|
||||
# Specifies libraries CMake should link to your target library. You
|
||||
# can link multiple libraries, such as libraries you define in this
|
||||
# build script, prebuilt third-party libraries, or system libraries.
|
||||
|
||||
target_link_libraries( # Specifies the target library.
|
||||
native-lib
|
||||
oboe
|
||||
# Links the target library to the log library
|
||||
# included in the NDK.
|
||||
${log-lib})
|
||||
target_link_options(native-lib PRIVATE "-Wl,-z,max-page-size=16384")
|
69
externals/oboe/apps/fxlab/app/build.gradle
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
apply plugin: 'kotlin-kapt'
|
||||
|
||||
android {
|
||||
compileSdkVersion 35
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.mobileer.androidfxlab"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 35
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_18
|
||||
targetCompatibility = JavaVersion.VERSION_18
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "18"
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path "./CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
dataBinding {
|
||||
enabled = true
|
||||
}
|
||||
namespace 'com.mobileer.androidfxlab'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||
implementation 'androidx.core:core-ktx:1.15.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.4.0'
|
||||
implementation 'com.google.android.material:material:1.12.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test:runner:1.6.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
|
||||
}
|
21
externals/oboe/apps/fxlab/app/proguard-rules.pro
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
40
externals/oboe/apps/fxlab/app/src/main/AndroidManifest.xml
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name="com.mobileer.androidfxlab.MainActivity"
|
||||
android:exported="true"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
|
||||
</manifest>
|
80
externals/oboe/apps/fxlab/app/src/main/cpp/DuplexCallback.h
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_DUPLEXCALLBACK_H
|
||||
#define ANDROID_FXLAB_DUPLEXCALLBACK_H
|
||||
|
||||
#include <oboe/Oboe.h>
|
||||
|
||||
|
||||
|
||||
// This callback handles mono in, stereo out synchronized audio passthrough.
|
||||
// It takes a function which operates on two pointers (beginning and end)
|
||||
// of underlying data.
|
||||
|
||||
template<class numeric_type>
|
||||
class DuplexCallback : public oboe::AudioStreamCallback {
|
||||
public:
|
||||
|
||||
DuplexCallback(oboe::AudioStream &inStream,
|
||||
std::function<void(numeric_type *, numeric_type *)> fun,
|
||||
size_t buffer_size, std::function<void(void)> restartFunction) :
|
||||
kBufferSize(buffer_size), inRef(inStream), f(fun), restart(restartFunction) {}
|
||||
|
||||
|
||||
oboe::DataCallbackResult
|
||||
onAudioReady(oboe::AudioStream *outputStream, void *audioData, int32_t numFrames) override {
|
||||
auto *outputData = static_cast<numeric_type *>(audioData);
|
||||
auto outputChannelCount = outputStream->getChannelCount();
|
||||
|
||||
// Silence first to simplify glitch detection
|
||||
std::fill(outputData, outputData + numFrames * outputChannelCount, 0);
|
||||
oboe::ResultWithValue<int32_t> result = inRef.read(inputBuffer.get(), numFrames, 0);
|
||||
int32_t framesRead = result.value();
|
||||
if (!result) {
|
||||
inRef.requestStop();
|
||||
return oboe::DataCallbackResult::Stop;
|
||||
}
|
||||
if (mSpinUpCallbacks > 0 && framesRead > 0) {
|
||||
mSpinUpCallbacks--;
|
||||
return oboe::DataCallbackResult::Continue;
|
||||
}
|
||||
f(inputBuffer.get(), inputBuffer.get() + framesRead);
|
||||
for (int i = 0; i < framesRead; i++) {
|
||||
for (size_t j = 0; j < outputChannelCount; j++) {
|
||||
*outputData++ = inputBuffer[i];
|
||||
}
|
||||
}
|
||||
return oboe::DataCallbackResult::Continue;
|
||||
}
|
||||
|
||||
void onErrorAfterClose(oboe::AudioStream *, oboe::Result result) override {
|
||||
inRef.close();
|
||||
if (result == oboe::Result::ErrorDisconnected) {
|
||||
restart();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
int mSpinUpCallbacks = 10; // We will let the streams sync for the first few valid frames
|
||||
const size_t kBufferSize;
|
||||
oboe::AudioStream &inRef;
|
||||
std::function<void(numeric_type *, numeric_type *)> f;
|
||||
std::function<void(void)> restart;
|
||||
std::unique_ptr<numeric_type[]> inputBuffer = std::make_unique<numeric_type[]>(kBufferSize);
|
||||
};
|
||||
|
||||
#endif //ANDROID_FXLAB_DUPLEXCALLBACK_H
|
93
externals/oboe/apps/fxlab/app/src/main/cpp/DuplexEngine.cpp
vendored
Normal file
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "DuplexEngine.h"
|
||||
#include "effects/Effects.h"
|
||||
|
||||
DuplexEngine::DuplexEngine() {
|
||||
beginStreams();
|
||||
}
|
||||
|
||||
void DuplexEngine::beginStreams() {
|
||||
// This ordering is extremely important
|
||||
openInStream();
|
||||
if (inStream->getFormat() == oboe::AudioFormat::Float) {
|
||||
functionList.emplace<FunctionList<float *>>();
|
||||
createCallback<float_t>();
|
||||
} else if (inStream->getFormat() == oboe::AudioFormat::I16) {
|
||||
createCallback<int16_t>();
|
||||
} else {
|
||||
stopStreams();
|
||||
}
|
||||
SAMPLE_RATE = inStream->getSampleRate();
|
||||
openOutStream();
|
||||
|
||||
oboe::Result result = startStreams();
|
||||
if (result != oboe::Result::OK) stopStreams();
|
||||
}
|
||||
|
||||
template<class numeric>
|
||||
void DuplexEngine::createCallback() {
|
||||
mCallback = std::make_unique<DuplexCallback<numeric>>(
|
||||
*inStream, [&functionStack = this->functionList](numeric *beg, numeric *end) {
|
||||
std::get<FunctionList<numeric *>>(functionStack)(beg, end);
|
||||
},
|
||||
inStream->getBufferCapacityInFrames(),
|
||||
std::bind(&DuplexEngine::beginStreams, this));
|
||||
}
|
||||
|
||||
|
||||
oboe::AudioStreamBuilder DuplexEngine::defaultBuilder() {
|
||||
return *oboe::AudioStreamBuilder()
|
||||
.setPerformanceMode(oboe::PerformanceMode::LowLatency)
|
||||
->setSharingMode(oboe::SharingMode::Exclusive);
|
||||
}
|
||||
|
||||
void DuplexEngine::openInStream() {
|
||||
defaultBuilder().setDirection(oboe::Direction::Input)
|
||||
->setFormat(oboe::AudioFormat::Float) // For now
|
||||
->setChannelCount(1) // Mono in for effects processing
|
||||
->openManagedStream(inStream);
|
||||
}
|
||||
|
||||
void DuplexEngine::openOutStream() {
|
||||
defaultBuilder().setCallback(mCallback.get())
|
||||
->setSampleRate(inStream->getSampleRate())
|
||||
->setFormat(inStream->getFormat())
|
||||
->setChannelCount(2) // Stereo out
|
||||
->openManagedStream(outStream);
|
||||
}
|
||||
|
||||
oboe::Result DuplexEngine::startStreams() {
|
||||
oboe::Result result = outStream->requestStart();
|
||||
int64_t timeoutNanos = 500 * 1000000; // arbitrary 1/2 second
|
||||
auto currentState = outStream->getState();
|
||||
auto nextState = oboe::StreamState::Unknown;
|
||||
while (result == oboe::Result::OK && currentState != oboe::StreamState::Started) {
|
||||
result = outStream->waitForStateChange(currentState, &nextState, timeoutNanos);
|
||||
currentState = nextState;
|
||||
}
|
||||
if (result != oboe::Result::OK) return result;
|
||||
return inStream->requestStart();
|
||||
}
|
||||
|
||||
oboe::Result DuplexEngine::stopStreams() {
|
||||
oboe::Result outputResult = inStream->requestStop();
|
||||
oboe::Result inputResult = outStream->requestStop();
|
||||
if (outputResult != oboe::Result::OK) return outputResult;
|
||||
return inputResult;
|
||||
}
|
||||
|
64
externals/oboe/apps/fxlab/app/src/main/cpp/DuplexEngine.h
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef EFFECTS_APP_DUPLEXSTREAM_H
|
||||
#define EFFECTS_APP_DUPLEXSTREAM_H
|
||||
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
#include <variant>
|
||||
|
||||
#include <oboe/Oboe.h>
|
||||
#include "FunctionList.h"
|
||||
#include "DuplexCallback.h"
|
||||
|
||||
|
||||
class DuplexEngine {
|
||||
public:
|
||||
DuplexEngine();
|
||||
|
||||
void beginStreams();
|
||||
|
||||
virtual ~DuplexEngine() = default;
|
||||
|
||||
oboe::Result startStreams();
|
||||
|
||||
oboe::Result stopStreams();
|
||||
|
||||
|
||||
std::variant<FunctionList<int16_t *>, FunctionList<float *>> functionList{
|
||||
std::in_place_type<FunctionList<int16_t *>>};
|
||||
|
||||
private:
|
||||
|
||||
void openInStream();
|
||||
|
||||
void openOutStream();
|
||||
|
||||
static oboe::AudioStreamBuilder defaultBuilder();
|
||||
|
||||
template<class numeric>
|
||||
void createCallback();
|
||||
|
||||
oboe::ManagedStream inStream;
|
||||
std::unique_ptr<oboe::AudioStreamCallback> mCallback;
|
||||
oboe::ManagedStream outStream;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //EFFECTS_APP_DUPLEXSTREAM_H
|
85
externals/oboe/apps/fxlab/app/src/main/cpp/FunctionList.h
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_FXLAB_FUNCTIONLIST_H
|
||||
#define ANDROID_FXLAB_FUNCTIONLIST_H
|
||||
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include <array>
|
||||
|
||||
template<class iter_type>
|
||||
class FunctionList {
|
||||
std::vector<std::pair<std::function<void(iter_type, iter_type)>, bool>> functionList;
|
||||
bool muted = false;
|
||||
public:
|
||||
FunctionList() = default;
|
||||
|
||||
FunctionList(const FunctionList &) = delete;
|
||||
|
||||
FunctionList &operator=(const FunctionList &) = delete;
|
||||
|
||||
|
||||
void operator()(iter_type begin, iter_type end) {
|
||||
for (auto &f : functionList) {
|
||||
if (f.second == true) std::get<0>(f)(begin, end);
|
||||
}
|
||||
if (muted) std::fill(begin, end, 0);
|
||||
}
|
||||
|
||||
void addEffect(std::function<void(iter_type, iter_type)> f) {
|
||||
functionList.emplace_back(std::move(f), true);
|
||||
}
|
||||
|
||||
void removeEffectAt(unsigned int index) {
|
||||
if (index < functionList.size()) {
|
||||
functionList.erase(std::next(functionList.begin(), index));
|
||||
}
|
||||
}
|
||||
|
||||
void rotateEffectAt(unsigned int from, unsigned int to) {
|
||||
auto &v = functionList;
|
||||
if (from >= v.size() || to >= v.size()) return;
|
||||
if (from <= to) {
|
||||
std::rotate(v.begin() + from, v.begin() + from + 1, v.begin() + to + 1);
|
||||
} else {
|
||||
from = v.size() - 1 - from;
|
||||
to = v.size() - 1 - to;
|
||||
std::rotate(v.rbegin() + from, v.rbegin() + from + 1, v.rbegin() + to + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void modifyEffectAt(size_t index, std::function<void(iter_type, iter_type)> fun) {
|
||||
functionList[index] = {std::move(fun), functionList[index].second};
|
||||
}
|
||||
|
||||
void enableEffectAt(size_t index, bool enable) {
|
||||
functionList[index].second = enable;
|
||||
}
|
||||
|
||||
void mute(bool toMute) {
|
||||
muted = toMute;
|
||||
}
|
||||
|
||||
auto getType() {
|
||||
return iter_type();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //ANDROID_FXLAB_FUNCTIONLIST_H
|
||||
|
53
externals/oboe/apps/fxlab/app/src/main/cpp/effects/CombFilter.h
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_COMBFILTER_H
|
||||
#define ANDROID_FXLAB_COMBFILTER_H
|
||||
|
||||
#include "utils/DelayLine.h"
|
||||
|
||||
template <class iter_type>
|
||||
class CombFilter {
|
||||
|
||||
public:
|
||||
// delay > 0 in samples
|
||||
CombFilter(float blend, float feedForward, float feedBack, int delay) :
|
||||
kBlend(blend),
|
||||
kFeedForward(feedForward),
|
||||
kFeedBack(feedBack),
|
||||
kDelay(static_cast<size_t>(delay)) {}
|
||||
|
||||
|
||||
void operator () (typename std::iterator_traits<iter_type>::reference x) {
|
||||
auto delayOutput = delayLine[kDelay];
|
||||
auto delayInput = x + kFeedBack * delayOutput;
|
||||
delayLine.push(delayInput);
|
||||
x = delayInput * kBlend + delayOutput * kFeedForward;
|
||||
}
|
||||
void operator () (iter_type begin, iter_type end) {
|
||||
for (; begin != end; ++begin) {
|
||||
operator()(*begin);
|
||||
}
|
||||
}
|
||||
private:
|
||||
// Weights
|
||||
const float kBlend;
|
||||
const float kFeedForward;
|
||||
const float kFeedBack;
|
||||
const size_t kDelay;
|
||||
|
||||
DelayLine<typename std::iterator_traits<iter_type>::value_type> delayLine {kDelay + 1};
|
||||
};
|
||||
#endif //ANDROID_FXLAB_COMBFILTER_H
|
79
externals/oboe/apps/fxlab/app/src/main/cpp/effects/DelayLineEffect.h
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_FXLAB_DELAYLINEEFFECT_H
|
||||
#define ANDROID_FXLAB_DELAYLINEEFFECT_H
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "utils/SineWave.h"
|
||||
#include "utils/DelayLine.h"
|
||||
|
||||
// Abstract class for implementing delay line based effects
|
||||
// This functor retains state (it must be used sequentially)
|
||||
// Effects are float, mono, 48000 hz
|
||||
template <class iter_type>
|
||||
class DelayLineEffect {
|
||||
|
||||
public:
|
||||
// delay > 0, depth in samples, mod is control signal
|
||||
DelayLineEffect(float blend, float feedForward, float feedBack, int delay, int depth, std::function<float()> &&mod) :
|
||||
kBlend(blend),
|
||||
kFeedForward(feedForward),
|
||||
kFeedBack(feedBack),
|
||||
kDelay(delay),
|
||||
kDepth(depth),
|
||||
mMod(mod) { }
|
||||
|
||||
|
||||
void operator () (typename std::iterator_traits<iter_type>::reference x) {
|
||||
auto delayInput = x + kFeedBack * delayLine[kTap];
|
||||
auto variableDelay = mMod() * kDepth + kTap;
|
||||
int index = static_cast<int>(variableDelay);
|
||||
auto fracComp = 1 - (variableDelay - index);
|
||||
//linear
|
||||
// auto interpolated = fracComp * delayLine[index] + (1 - fracComp) * delayLine[index + 1];
|
||||
// all - pass
|
||||
float interpolated = fracComp * delayLine[index] + delayLine[index + 1]
|
||||
- fracComp * prevInterpolated;
|
||||
|
||||
prevInterpolated = interpolated;
|
||||
delayLine.push(delayInput);
|
||||
x = interpolated * kFeedForward + kBlend * delayInput;
|
||||
}
|
||||
void operator () (iter_type begin, iter_type end) {
|
||||
for (; begin != end; ++begin) {
|
||||
operator()(*begin);
|
||||
}
|
||||
}
|
||||
private:
|
||||
// Weights
|
||||
const float kBlend;
|
||||
const float kFeedForward;
|
||||
const float kFeedBack;
|
||||
const int kDelay;
|
||||
const int kDepth;
|
||||
const int kTap = kDelay + kDepth;
|
||||
|
||||
// Control function
|
||||
const std::function<float()> mMod;
|
||||
|
||||
// Memory
|
||||
float prevInterpolated = 0; // for all pass interp
|
||||
const size_t kDelayLineSize = kTap + kDepth + 1; // index one is immediate prev sample
|
||||
DelayLine<typename std::iterator_traits<iter_type>::value_type> delayLine {kDelayLineSize};
|
||||
};
|
||||
#endif //ANDROID_FXLAB_DELAYLINEEFFECT_H
|
34
externals/oboe/apps/fxlab/app/src/main/cpp/effects/DoublingEffect.h
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_DOUBLINGEFFECT_H
|
||||
#define ANDROID_FXLAB_DOUBLINGEFFECT_H
|
||||
|
||||
#include "DelayLineEffect.h"
|
||||
#include "utils/WhiteNoise.h"
|
||||
|
||||
|
||||
template <class iter_type>
|
||||
class DoublingEffect: public DelayLineEffect<iter_type> {
|
||||
public:
|
||||
DoublingEffect(float depth_ms, float delay_ms, float noise_pass):
|
||||
DelayLineEffect<iter_type> {0.7071, 0.7071, 0,
|
||||
static_cast<int>(delay_ms * SAMPLE_RATE / 1000),
|
||||
static_cast<int>(depth_ms * SAMPLE_RATE / 1000),
|
||||
std::function<float()>{WhiteNoise{static_cast<int>(4800 * noise_pass)}}}
|
||||
{}
|
||||
};
|
||||
#
|
||||
#endif //ANDROID_FXLAB_DOUBLINGEFFECT_H
|
41
externals/oboe/apps/fxlab/app/src/main/cpp/effects/DriveControl.h
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_DRIVECONTROL_H
|
||||
#define ANDROID_FXLAB_DRIVECONTROL_H
|
||||
|
||||
|
||||
#include <functional>
|
||||
|
||||
template <class iter_type>
|
||||
|
||||
class DriveControl {
|
||||
public:
|
||||
|
||||
DriveControl(std::function<void(iter_type, iter_type)> function, double scale):
|
||||
mFunction(function), kScale(scale) {}
|
||||
|
||||
void operator() (iter_type beg, iter_type end) {
|
||||
std::for_each(beg, end, [this](auto &x){x *= kScale;});
|
||||
mFunction(beg, end);
|
||||
std::for_each(beg, end, [this](auto &x){x *= recip;});
|
||||
}
|
||||
|
||||
private:
|
||||
std::function<void(iter_type, iter_type)> mFunction;
|
||||
const double kScale;
|
||||
const double recip = 1 / kScale;
|
||||
};
|
||||
#endif //ANDROID_FXLAB_DRIVECONTROL_H
|
33
externals/oboe/apps/fxlab/app/src/main/cpp/effects/EchoEffect.h
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_ECHOEFFECT_H
|
||||
#define ANDROID_FXLAB_ECHOEFFECT_H
|
||||
|
||||
#include "DelayLineEffect.h"
|
||||
#include "utils/WhiteNoise.h"
|
||||
|
||||
|
||||
template <class iter_type>
|
||||
class EchoEffect: public DelayLineEffect<iter_type> {
|
||||
public:
|
||||
EchoEffect(float feedback, float delay_ms):
|
||||
DelayLineEffect<iter_type> {1, 0, feedback,
|
||||
static_cast<int>(delay_ms * SAMPLE_RATE / 1000),
|
||||
0,
|
||||
std::function<float()>{[](){return 0.0;}}}
|
||||
{}
|
||||
};
|
||||
#endif //ANDROID_FXLAB_ECHOEFFECT_H
|
61
externals/oboe/apps/fxlab/app/src/main/cpp/effects/Effects.h
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_FXLAB_EFFECTS_H
|
||||
#define ANDROID_FXLAB_EFFECTS_H
|
||||
|
||||
|
||||
// The Sample Rate for effects
|
||||
static int SAMPLE_RATE = 48000;
|
||||
|
||||
// This header should include the various effect descriptions
|
||||
#include "descrip/EffectDescription.h"
|
||||
#include "descrip/PassthroughDescription.h"
|
||||
#include "descrip/VibratoDescription.h"
|
||||
#include "descrip/TremoloDescription.h"
|
||||
#include "descrip/GainDescription.h"
|
||||
#include "descrip/FlangerDescription.h"
|
||||
#include "descrip/WhiteChorusDescription.h"
|
||||
#include "descrip/FIRDescription.h"
|
||||
#include "descrip/IIRDescription.h"
|
||||
#include "descrip/AllPassDescription.h"
|
||||
#include "descrip/DoublingDescription.h"
|
||||
#include "descrip/OverdriveDescription.h"
|
||||
#include "descrip/DistortionDescription.h"
|
||||
#include "descrip/EchoDescription.h"
|
||||
#include "descrip/SlapbackDescription.h"
|
||||
|
||||
constexpr std::tuple<
|
||||
Effect::PassthroughDescription,
|
||||
Effect::TremoloDescription,
|
||||
Effect::VibratoDescription,
|
||||
Effect::GainDescription,
|
||||
Effect::FlangerDescription,
|
||||
Effect::WhiteChorusDescription,
|
||||
Effect::FIRDescription,
|
||||
Effect::IIRDescription,
|
||||
Effect::AllPassDescription,
|
||||
Effect::DoublingDescription,
|
||||
Effect::OverdriveDescription,
|
||||
Effect::DistortionDescription,
|
||||
Effect::EchoDescription,
|
||||
Effect::SlapbackDescription
|
||||
> EffectsTuple{};
|
||||
|
||||
constexpr size_t numEffects = std::tuple_size<decltype(EffectsTuple)>::value;
|
||||
|
||||
|
||||
#endif //ANDROID_FXLAB_EFFECTS_H
|
29
externals/oboe/apps/fxlab/app/src/main/cpp/effects/FlangerEffect.h
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_FLANGEREFFECT_H
|
||||
#define ANDROID_FXLAB_FLANGEREFFECT_H
|
||||
|
||||
#include "DelayLineEffect.h"
|
||||
|
||||
template<class iter_type>
|
||||
class FlangerEffect : public DelayLineEffect<iter_type> {
|
||||
public:
|
||||
// feedback should be 0.7071
|
||||
FlangerEffect(float depth_ms, float frequency, float feedback):
|
||||
DelayLineEffect<iter_type>(feedback, feedback, feedback, 0, depth_ms * SAMPLE_RATE / 1000,
|
||||
SineWave {frequency, 1, SAMPLE_RATE}) { }
|
||||
};
|
||||
#endif //ANDROID_FXLAB_FLANGEREFFECT_H
|
56
externals/oboe/apps/fxlab/app/src/main/cpp/effects/SingleFunctionEffects.h
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_SINGLEFUNCTIONEFFECTS_H
|
||||
#define ANDROID_FXLAB_SINGLEFUNCTIONEFFECTS_H
|
||||
|
||||
#include <list>
|
||||
|
||||
namespace SingleFunctionEffects {
|
||||
|
||||
template<class floating>
|
||||
void _overdrive (floating &x) {
|
||||
static constexpr double third = (1.0 / 3.0);
|
||||
auto abs = std::abs(x);
|
||||
if (abs <= third) {
|
||||
x *= 2;
|
||||
} else if (abs <= 2 * third) {
|
||||
x = std::copysign((3 - (2 - 3 * abs) * (2 - 3 * abs)) * third, x);
|
||||
} else {
|
||||
x = std::copysign(1, x);
|
||||
}
|
||||
}
|
||||
|
||||
template <class iter_type>
|
||||
void overdrive(iter_type beg, iter_type end) {
|
||||
for (; beg != end; ++beg){
|
||||
_overdrive(*beg);
|
||||
}
|
||||
}
|
||||
|
||||
template <class floating>
|
||||
void _distortion (floating &x) {
|
||||
x = std::copysign(-std::expm1(-std::abs(x)), x);
|
||||
}
|
||||
|
||||
template <class iter_type>
|
||||
void distortion(iter_type beg, iter_type end) {
|
||||
for (; beg != end; ++beg) {
|
||||
_distortion(*beg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif //ANDROID_FXLAB_SINGLEFUNCTIONEFFECTS_H
|
30
externals/oboe/apps/fxlab/app/src/main/cpp/effects/SlapbackEffect.h
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_FXLAB_SLAPBACKEFFECT_H
|
||||
#define ANDROID_FXLAB_SLAPBACKEFFECT_H
|
||||
|
||||
template <class iter_type>
|
||||
class SlapbackEffect: public DelayLineEffect<iter_type> {
|
||||
public:
|
||||
SlapbackEffect(float feedforward, float delay_ms):
|
||||
DelayLineEffect<iter_type> {1, feedforward, 0,
|
||||
static_cast<int>(delay_ms * SAMPLE_RATE / 1000),
|
||||
0,
|
||||
std::function<float()>{[](){return 0.0;}}}
|
||||
{}
|
||||
};
|
||||
#endif //ANDROID_FXLAB_SLAPBACKEFFECT_H
|
43
externals/oboe/apps/fxlab/app/src/main/cpp/effects/TremoloEffect.h
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_FXLAB_TREMOLOEFFECT_H
|
||||
#define ANDROID_FXLAB_TREMOLOEFFECT_H
|
||||
|
||||
|
||||
#include "utils/SineWave.h"
|
||||
|
||||
class TremoloEffect {
|
||||
public:
|
||||
TremoloEffect(float frequency, float height):
|
||||
kCenter(1 - height),
|
||||
kSignal {SineWave{frequency, height, SAMPLE_RATE}} { }
|
||||
|
||||
template <class numeric_type>
|
||||
void operator () (numeric_type &x) {
|
||||
x = x * (kSignal() + kCenter);
|
||||
}
|
||||
template <class iter_type>
|
||||
void operator () (iter_type begin, iter_type end) {
|
||||
for (; begin != end; ++begin) {
|
||||
operator()(*begin);
|
||||
}
|
||||
}
|
||||
private:
|
||||
const float kCenter;
|
||||
std::function<float()> kSignal;
|
||||
};
|
||||
#endif //ANDROID_FXLAB_TREMOLOEFFECT_H
|
27
externals/oboe/apps/fxlab/app/src/main/cpp/effects/VibratroEffect.h
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_VIBRATROEFFECT_H
|
||||
#define ANDROID_FXLAB_VIBRATROEFFECT_H
|
||||
|
||||
#include "DelayLineEffect.h"
|
||||
template <class iter_type>
|
||||
class VibratoEffect : public DelayLineEffect<iter_type> {
|
||||
public:
|
||||
VibratoEffect(float depth_ms, float frequency):
|
||||
DelayLineEffect<iter_type>(0, 1, 0, 1, depth_ms * SAMPLE_RATE / 1000,
|
||||
SineWave {frequency, 1, SAMPLE_RATE}) { }
|
||||
};
|
||||
#endif //ANDROID_FXLAB_VIBRATROEFFECT_H
|
32
externals/oboe/apps/fxlab/app/src/main/cpp/effects/WhiteChorusEffect.h
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_WHITECHORUSEFFECT_H
|
||||
#define ANDROID_FXLAB_WHITECHORUSEFFECT_H
|
||||
|
||||
#include "DelayLineEffect.h"
|
||||
#include "utils/WhiteNoise.h"
|
||||
|
||||
template <class iter_type>
|
||||
class WhiteChorusEffect : public DelayLineEffect<iter_type> {
|
||||
public:
|
||||
WhiteChorusEffect(float depth_ms, float delay_ms, float noise_pass):
|
||||
DelayLineEffect<iter_type> {0.7071, 1, -0.7071f,
|
||||
static_cast<int>(delay_ms * SAMPLE_RATE / 1000),
|
||||
static_cast<int>(depth_ms * SAMPLE_RATE / 1000),
|
||||
std::function<float()>{WhiteNoise{static_cast<int>(4800 * noise_pass)}}}
|
||||
{}
|
||||
};
|
||||
#endif //ANDROID_FXLAB_WHITECHORUSEFFECT_H
|
48
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/AllPassDescription.h
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_ALLPASSDESCRIPTION_H
|
||||
#define ANDROID_FXLAB_ALLPASSDESCRIPTION_H
|
||||
|
||||
|
||||
#include "EffectDescription.h"
|
||||
#include "../CombFilter.h"
|
||||
namespace Effect {
|
||||
class AllPassDescription: public EffectDescription<AllPassDescription, 2> {
|
||||
public:
|
||||
static constexpr std::string_view getName() {
|
||||
return std::string_view("AllPass");
|
||||
}
|
||||
|
||||
static constexpr std::string_view getCategory() {
|
||||
return std::string_view("Comb");
|
||||
}
|
||||
|
||||
static constexpr std::array<ParamType, getNumParams()> getParams() {
|
||||
return std::array<ParamType, getNumParams()> {
|
||||
ParamType("Delay (samples)", 1, 500, 10),
|
||||
ParamType("Scale", 0.01, 0.99, 0.5),
|
||||
};
|
||||
}
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, getNumParams()> paramArr) {
|
||||
return _ef<iter_type> {
|
||||
CombFilter<iter_type>{paramArr[1], 1, -(paramArr[1]), static_cast<int>(paramArr[0])}
|
||||
};
|
||||
}
|
||||
};
|
||||
} //namespace Effect
|
||||
|
||||
#endif //ANDROID_FXLAB_ALLPASSDESCRIPTION_H
|
46
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/DistortionDescription.h
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_DISTORTIONDESCRIPTION_H
|
||||
#define ANDROID_FXLAB_DISTORTIONDESCRIPTION_H
|
||||
|
||||
#include "EffectDescription.h"
|
||||
#include "../SingleFunctionEffects.h"
|
||||
|
||||
namespace Effect {
|
||||
class DistortionDescription: public EffectDescription<DistortionDescription, 1> {
|
||||
public:
|
||||
static constexpr std::string_view getName() {
|
||||
return std::string_view("Distortion");
|
||||
}
|
||||
|
||||
static constexpr std::string_view getCategory() {
|
||||
return std::string_view("Nonlinear");
|
||||
}
|
||||
|
||||
static constexpr std::array<ParamType, getNumParams()> getParams() {
|
||||
return std::array<ParamType, getNumParams()> {
|
||||
ParamType("Drive (db)", -10, 50, 0)
|
||||
};
|
||||
}
|
||||
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, getNumParams()> paramArr) {
|
||||
double scale = pow(2.0, paramArr[0] / 10);
|
||||
return DriveControl<iter_type> {SingleFunctionEffects::distortion<iter_type>, scale};
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif //ANDROID_FXLAB_DISTORTIONDESCRIPTION_H
|
33
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/DoublingDescription.h
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
#ifndef ANDROID_FXLAB_DOUBLINGDESCRIPTION_H
|
||||
#define ANDROID_FXLAB_DOUBLINGDESCRIPTION_H
|
||||
|
||||
#include "EffectDescription.h"
|
||||
#include "../DoublingEffect.h"
|
||||
|
||||
namespace Effect {
|
||||
class DoublingDescription: public EffectDescription<DoublingDescription, 3> {
|
||||
public:
|
||||
static constexpr std::string_view getName() {
|
||||
return std::string_view("Doubling");
|
||||
}
|
||||
|
||||
static constexpr std::string_view getCategory() {
|
||||
return std::string_view("Delay");
|
||||
}
|
||||
|
||||
static constexpr std::array<ParamType, getNumParams()> getParams() {
|
||||
return std::array<ParamType, getNumParams()> {
|
||||
ParamType("Depth (ms)", 10, 100, 40),
|
||||
ParamType("Delay (ms)", 1, 100, 40),
|
||||
ParamType("Noise pass", 1, 10, 4),
|
||||
};
|
||||
}
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, getNumParams()> paramArr) {
|
||||
return _ef<iter_type> {
|
||||
DoublingEffect<iter_type>{paramArr[0], paramArr[1], paramArr[2]}
|
||||
};
|
||||
}
|
||||
};
|
||||
} //namespace Effect
|
||||
#endif //ANDROID_FXLAB_DOUBLINGDESCRIPTION_H
|
48
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/EchoDescription.h
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_ECHODESCRIPTION_H
|
||||
#define ANDROID_FXLAB_ECHODESCRIPTION_H
|
||||
|
||||
#include "../EchoEffect.h"
|
||||
|
||||
namespace Effect {
|
||||
|
||||
class EchoDescription: public EffectDescription<EchoDescription, 2> {
|
||||
public:
|
||||
static constexpr std::string_view getName() {
|
||||
return std::string_view("Echo");
|
||||
}
|
||||
|
||||
static constexpr std::string_view getCategory() {
|
||||
return std::string_view("Delay");
|
||||
}
|
||||
|
||||
static constexpr std::array<ParamType, getNumParams()> getParams() {
|
||||
return std::array<ParamType, getNumParams()> {
|
||||
ParamType("Feedback", 0, 1, 0.5),
|
||||
ParamType("Delay (ms)", 50, 500, 100),
|
||||
};
|
||||
}
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, getNumParams()> paramArr) {
|
||||
return _ef<iter_type> {
|
||||
EchoEffect<iter_type>{paramArr[0], paramArr[1]}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace Effect
|
||||
#endif //ANDROID_FXLAB_ECHODESCRIPTION_H
|
107
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/EffectDescription.h
vendored
Normal file
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_FXLAB_EFFECTDESCRIPTION_H
|
||||
#define ANDROID_FXLAB_EFFECTDESCRIPTION_H
|
||||
|
||||
#include <functional>
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <string_view>
|
||||
|
||||
template<class iter_type>
|
||||
using _ef = std::function<void(iter_type, iter_type)>;
|
||||
|
||||
// Only Effect Descriptions should use this namespace
|
||||
namespace Effect {
|
||||
|
||||
class ParamType {
|
||||
public:
|
||||
constexpr ParamType(std::string_view name, float minVal, float maxVal, float defVal) :
|
||||
kName(name),
|
||||
kMinVal(minVal),
|
||||
kMaxVal(maxVal),
|
||||
kDefVal(defVal) {}
|
||||
|
||||
constexpr ParamType(const ParamType &other) = delete;
|
||||
|
||||
ParamType &operator=(const ParamType &other) = delete;
|
||||
|
||||
constexpr ParamType(ParamType &&other) = default;
|
||||
|
||||
constexpr ParamType &operator=(ParamType &&other) = delete;
|
||||
|
||||
const std::string_view kName;
|
||||
const float kMinVal, kMaxVal, kDefVal;
|
||||
};
|
||||
|
||||
|
||||
// EffectType is the description subclass, N is num of params
|
||||
// Function implementations in this class contain shared behavior
|
||||
// Which can be shadowed.
|
||||
template<class EffectType, size_t N>
|
||||
class EffectDescription {
|
||||
public:
|
||||
// These methods will be shadowed by subclasses
|
||||
|
||||
static constexpr size_t getNumParams() {
|
||||
return N;
|
||||
}
|
||||
|
||||
static constexpr std::array<float, N> getEmptyParams() {
|
||||
return std::array<float, EffectType::getNumParams()>();
|
||||
}
|
||||
|
||||
static constexpr std::string_view getName();
|
||||
|
||||
static constexpr std::string_view getCategory();
|
||||
|
||||
static constexpr std::array<ParamType, N> getParams();
|
||||
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, N> paramArr);
|
||||
|
||||
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildDefaultEffect() {
|
||||
auto params = EffectType::getEmptyParams();
|
||||
int i = 0;
|
||||
for (ParamType &mParam: EffectType::getParams()) {
|
||||
params[i++] = mParam.kDefVal;
|
||||
}
|
||||
return EffectType::template buildEffect<iter_type>(params);
|
||||
}
|
||||
|
||||
// The default behavior is new effect, can be shadowed
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> modifyEffect(
|
||||
_ef<iter_type> /* effect */, std::array<float, N> paramArr) {
|
||||
return EffectType::template buildEffect<iter_type>(std::move(paramArr));
|
||||
}
|
||||
template <class iter_type>
|
||||
static _ef<iter_type> modifyEffectVec(
|
||||
_ef<iter_type> effect, std::vector<float> paramVec) {
|
||||
std::array<float, N> arr;
|
||||
std::copy_n(paramVec.begin(), N, arr.begin());
|
||||
return EffectType::template modifyEffect<iter_type>(
|
||||
std::move(effect), std::move(arr));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace effect
|
||||
|
||||
|
||||
#endif //ANDROID_FXLAB_EFFECTDESCRIPTION_H
|
46
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/FIRDescription.h
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_FIRDESCRIPTION_H
|
||||
#define ANDROID_FXLAB_FIRDESCRIPTION_H
|
||||
|
||||
#include "EffectDescription.h"
|
||||
#include "../CombFilter.h"
|
||||
namespace Effect {
|
||||
class FIRDescription: public EffectDescription<FIRDescription, 2> {
|
||||
public:
|
||||
static constexpr std::string_view getName() {
|
||||
return std::string_view("FIR");
|
||||
}
|
||||
|
||||
static constexpr std::string_view getCategory() {
|
||||
return std::string_view("Comb");
|
||||
}
|
||||
|
||||
static constexpr std::array<ParamType, getNumParams()> getParams() {
|
||||
return std::array<ParamType, getNumParams()> {
|
||||
ParamType("Delay (samples)", 1, 500, 10),
|
||||
ParamType("Gain", 0, 0.99, 0.5),
|
||||
};
|
||||
}
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, getNumParams()> paramArr) {
|
||||
return _ef<iter_type> {
|
||||
CombFilter<iter_type>{1, paramArr[1], 0, static_cast<int>(paramArr[0])}
|
||||
};
|
||||
}
|
||||
};
|
||||
} //namespace Effect
|
||||
#endif //ANDROID_FXLAB_FIRDESCRIPTION_H
|
50
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/FlangerDescription.h
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_FLANGERDESCRIPTION_H
|
||||
#define ANDROID_FXLAB_FLANGERDESCRIPTION_H
|
||||
|
||||
#include "EffectDescription.h"
|
||||
#include "../FlangerEffect.h"
|
||||
|
||||
namespace Effect {
|
||||
class FlangerDescription : public EffectDescription<FlangerDescription, 3> {
|
||||
public:
|
||||
static constexpr std::string_view getName() {
|
||||
return std::string_view("Flanger");
|
||||
}
|
||||
|
||||
static constexpr std::string_view getCategory() {
|
||||
return std::string_view("Delay");
|
||||
}
|
||||
|
||||
static constexpr std::array<ParamType, getNumParams()> getParams() {
|
||||
return std::array<ParamType, 3> {
|
||||
ParamType("Depth (ms)", 0.1, 2, 1),
|
||||
ParamType("Frequency", 0.1, 1, 0.2),
|
||||
ParamType("Feedback", 0, 0.95, 0.7071),
|
||||
};
|
||||
}
|
||||
|
||||
template <class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, getNumParams()> paramArr) {
|
||||
return std::function<void(iter_type, iter_type)> {
|
||||
FlangerEffect<iter_type>{paramArr[0], paramArr[1], paramArr[2]}
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
} // namespace Effect
|
||||
#endif //ANDROID_FXLAB_FLANGERDESCRIPTION_H
|
50
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/GainDescription.h
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_GAINDESCRIPTION_H
|
||||
#define ANDROID_FXLAB_GAINDESCRIPTION_H
|
||||
#include "EffectDescription.h"
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
namespace Effect {
|
||||
class GainDescription : public EffectDescription<GainDescription, 1> {
|
||||
public:
|
||||
static constexpr std::string_view getName() {
|
||||
return std::string_view("Gain");
|
||||
}
|
||||
|
||||
static constexpr std::string_view getCategory() {
|
||||
return std::string_view("None");
|
||||
}
|
||||
|
||||
static constexpr std::array<ParamType, getNumParams()> getParams() {
|
||||
return std::array <ParamType, getNumParams()> {
|
||||
ParamType("Gain", -30, 20, 0)
|
||||
};
|
||||
}
|
||||
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, getNumParams()> paramArr) {
|
||||
float scale = paramArr[0] / 10;
|
||||
return _ef<iter_type> {
|
||||
[=](iter_type beg, iter_type end) {
|
||||
for (; beg != end; ++beg) *beg *= pow(2.0, scale);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
} // namespace Effect
|
||||
#endif //ANDROID_FXLAB_GAINDESCRIPTION_H
|
50
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/IIRDescription.h
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_FXLAB_IIRDESCRIPTION_H
|
||||
#define ANDROID_FXLAB_IIRDESCRIPTION_H
|
||||
|
||||
|
||||
#include "../CombFilter.h"
|
||||
|
||||
namespace Effect {
|
||||
class IIRDescription: public EffectDescription<IIRDescription, 3> {
|
||||
public:
|
||||
static constexpr std::string_view getName() {
|
||||
return std::string_view("IIR");
|
||||
}
|
||||
|
||||
static constexpr std::string_view getCategory() {
|
||||
return std::string_view("Comb");
|
||||
}
|
||||
|
||||
static constexpr std::array<ParamType, getNumParams()> getParams() {
|
||||
return std::array<ParamType, getNumParams()> {
|
||||
ParamType("Delay (samples)", 1, 500, 10),
|
||||
ParamType("Gain", 0, 0.99, 0.5),
|
||||
ParamType("Scale", 0.25, 0.99, 0.5)
|
||||
};
|
||||
}
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, getNumParams()> paramArr) {
|
||||
return _ef<iter_type> {
|
||||
CombFilter<iter_type>{paramArr[2], 0, paramArr[1], static_cast<int>(paramArr[0])}
|
||||
};
|
||||
}
|
||||
};
|
||||
} //namespace Effect
|
||||
#
|
||||
#endif //ANDROID_FXLAB_IIRDESCRIPTION_H
|
51
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/OverdriveDescription.h
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_OVERDRIVEDESCRIPTION_H
|
||||
#define ANDROID_FXLAB_OVERDRIVEDESCRIPTION_H
|
||||
|
||||
#include <limits>
|
||||
#include <cmath>
|
||||
#include <iterator>
|
||||
|
||||
#include "EffectDescription.h"
|
||||
#include "../SingleFunctionEffects.h"
|
||||
#include "../DriveControl.h"
|
||||
|
||||
namespace Effect {
|
||||
class OverdriveDescription : public EffectDescription<OverdriveDescription, 1> {
|
||||
public:
|
||||
static constexpr std::string_view getName() {
|
||||
return std::string_view("Overdrive");
|
||||
}
|
||||
|
||||
static constexpr std::string_view getCategory() {
|
||||
return std::string_view("Nonlinear");
|
||||
}
|
||||
|
||||
static constexpr std::array<ParamType, getNumParams()> getParams() {
|
||||
return std::array<ParamType, getNumParams()>{
|
||||
ParamType("Drive (db)", -10, 50, 0)
|
||||
};
|
||||
}
|
||||
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, getNumParams()> paramArr) {
|
||||
double scale = pow(2.0, paramArr[0] / 10);
|
||||
return DriveControl<iter_type> {SingleFunctionEffects::overdrive<iter_type>, scale};
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif //ANDROID_FXLAB_OVERDRIVEDESCRIPTION_H
|
48
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/PassthroughDescription.h
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_PASSTHROUGHDESCRIPTION_H
|
||||
#define ANDROID_FXLAB_PASSTHROUGHDESCRIPTION_H
|
||||
|
||||
|
||||
#include "EffectDescription.h"
|
||||
|
||||
namespace Effect {
|
||||
|
||||
class PassthroughDescription : public EffectDescription<PassthroughDescription, 0> {
|
||||
public:
|
||||
|
||||
static constexpr std::string_view getName() {
|
||||
return std::string_view("Passthrough");
|
||||
}
|
||||
|
||||
static constexpr std::string_view getCategory() {
|
||||
return std::string_view("None");
|
||||
}
|
||||
|
||||
static constexpr std::array<ParamType, getNumParams()> getParams() {
|
||||
return std::array<ParamType, 0>();
|
||||
}
|
||||
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, getNumParams()> ) {
|
||||
return [](iter_type, iter_type) {};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // namespace Effect
|
||||
|
||||
#endif //ANDROID_FXLAB_PASSTHROUGHDESCRIPTION_H
|
50
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/SlapbackDescription.h
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_SLAPBACKDESCRIPTION_H
|
||||
#define ANDROID_FXLAB_SLAPBACKDESCRIPTION_H
|
||||
|
||||
#include "EffectDescription.h"
|
||||
#include "../SlapbackEffect.h"
|
||||
|
||||
|
||||
namespace Effect {
|
||||
|
||||
class SlapbackDescription: public EffectDescription<SlapbackDescription, 2> {
|
||||
public:
|
||||
static constexpr std::string_view getName() {
|
||||
return std::string_view("Slapback");
|
||||
}
|
||||
|
||||
static constexpr std::string_view getCategory() {
|
||||
return std::string_view("Delay");
|
||||
}
|
||||
|
||||
static constexpr std::array<ParamType, getNumParams()> getParams() {
|
||||
return std::array<ParamType, getNumParams()> {
|
||||
ParamType("Feedforward", 0, 2, 0.5),
|
||||
ParamType("Delay (ms)", 30, 100, 50),
|
||||
};
|
||||
}
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, getNumParams()> paramArr) {
|
||||
return _ef<iter_type> {
|
||||
SlapbackEffect<iter_type>{paramArr[0], paramArr[1]}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace Effect
|
||||
#endif //ANDROID_FXLAB_SLAPBACKDESCRIPTION_H
|
46
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/TremoloDescription.h
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_TREMOLODESCRIPTION_H
|
||||
#define ANDROID_FXLAB_TREMOLODESCRIPTION_H
|
||||
|
||||
#include "EffectDescription.h"
|
||||
#include "../TremoloEffect.h"
|
||||
namespace Effect {
|
||||
class TremoloDescription : public EffectDescription<TremoloDescription, 2> {
|
||||
public:
|
||||
static constexpr std::string_view getName() {
|
||||
return std::string_view("Tremolo");
|
||||
}
|
||||
|
||||
static constexpr std::string_view getCategory() {
|
||||
return std::string_view("None");
|
||||
}
|
||||
|
||||
static constexpr std::array<ParamType, getNumParams()> getParams() {
|
||||
return std::array<ParamType, getNumParams()> {
|
||||
ParamType("Frequency", 0.1, 5.0, 2),
|
||||
ParamType("Height", 0.05, 0.45, 0.25)
|
||||
};
|
||||
}
|
||||
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, getNumParams()> paramArr ) {
|
||||
return _ef<iter_type> {
|
||||
TremoloEffect {paramArr[0], paramArr[1]}};
|
||||
}
|
||||
};
|
||||
} // namespace Effect
|
||||
#endif // ANDROID_FXLAB_TREMOLODESCRIPTION_H
|
47
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/VibratoDescription.h
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_VIBRATODESCRIPTION_H
|
||||
#define ANDROID_FXLAB_VIBRATODESCRIPTION_H
|
||||
|
||||
#include "EffectDescription.h"
|
||||
#include "../VibratroEffect.h"
|
||||
|
||||
namespace Effect {
|
||||
class VibratoDescription : public EffectDescription<VibratoDescription, 2> {
|
||||
public:
|
||||
static constexpr std::string_view getName() {
|
||||
return std::string_view("Vibrato");
|
||||
}
|
||||
|
||||
static constexpr std::string_view getCategory() {
|
||||
return std::string_view("Delay");
|
||||
}
|
||||
|
||||
static constexpr std::array<ParamType, getNumParams()> getParams() {
|
||||
return std::array<ParamType, getNumParams()> {
|
||||
ParamType("Depth (ms)", 0, 3, 1),
|
||||
ParamType("Frequency", 0.1, 5, 1)
|
||||
};
|
||||
}
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, getNumParams()> paramArr) {
|
||||
return _ef<iter_type> {
|
||||
VibratoEffect<iter_type>{paramArr[0], paramArr[1]}
|
||||
};
|
||||
}
|
||||
};
|
||||
} //namespace Effect
|
||||
#endif //ANDROID_FXLAB_VIBRATODESCRIPTION_H
|
49
externals/oboe/apps/fxlab/app/src/main/cpp/effects/descrip/WhiteChorusDescription.h
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_WHITECHORUSDESCRIPTION_H
|
||||
#define ANDROID_FXLAB_WHITECHORUSDESCRIPTION_H
|
||||
|
||||
#include "EffectDescription.h"
|
||||
#include "../WhiteChorusEffect.h"
|
||||
|
||||
namespace Effect {
|
||||
class WhiteChorusDescription : public EffectDescription<WhiteChorusDescription, 3> {
|
||||
public:
|
||||
static constexpr std::string_view getName() {
|
||||
return std::string_view("White Chorus");
|
||||
}
|
||||
|
||||
static constexpr std::string_view getCategory() {
|
||||
return std::string_view("Delay");
|
||||
}
|
||||
|
||||
static constexpr std::array<ParamType, getNumParams()> getParams() {
|
||||
return std::array<ParamType, getNumParams()> {
|
||||
ParamType("Depth (ms)", 1, 30, 10),
|
||||
ParamType("Delay (ms)", 1, 30, 10),
|
||||
ParamType("Noise pass", 1, 10, 4),
|
||||
};
|
||||
}
|
||||
template<class iter_type>
|
||||
static _ef<iter_type> buildEffect(std::array<float, getNumParams()> paramArr) {
|
||||
return _ef<iter_type> {
|
||||
WhiteChorusEffect<iter_type>{paramArr[0], paramArr[1], paramArr[2]}
|
||||
};
|
||||
}
|
||||
};
|
||||
} //namespace Effect
|
||||
|
||||
#endif //ANDROID_FXLAB_WHITECHORUSDESCRIPTION_H
|
44
externals/oboe/apps/fxlab/app/src/main/cpp/effects/utils/DelayLine.h
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_FXLAB_DELAYLINE_H
|
||||
#define ANDROID_FXLAB_DELAYLINE_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
template<class T>
|
||||
class DelayLine {
|
||||
public:
|
||||
DelayLine(std::size_t size): N(size), mArr(N, 0) { }
|
||||
void push(const T& value) {
|
||||
mArr[mfront++] = value;
|
||||
if (mfront == N) mfront = 0;
|
||||
}
|
||||
// indexed from last value written backwards
|
||||
// i.e T-1 to T-N
|
||||
const T& operator[](int i) {
|
||||
int index = mfront - i;
|
||||
if (index < 0) index += N;
|
||||
return mArr[index];
|
||||
}
|
||||
|
||||
private:
|
||||
const int N;
|
||||
int mfront = 0;
|
||||
std::vector<T> mArr;
|
||||
};
|
||||
#endif //ANDROID_FXLAB_DELAYLINE_H
|
41
externals/oboe/apps/fxlab/app/src/main/cpp/effects/utils/PhaseAccumulator.h
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_FXLAB_PHASEACCUMULATOR_H
|
||||
#define ANDROID_FXLAB_PHASEACCUMULATOR_H
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
|
||||
class PhaseAccumulator {
|
||||
public:
|
||||
PhaseAccumulator(float frequency, float sampleRate):
|
||||
f(frequency),
|
||||
fs(sampleRate) { }
|
||||
float incrementPhase() {
|
||||
mPhase += kDelta;
|
||||
if (mPhase >= kTwoPi) mPhase -= kTwoPi;
|
||||
return mPhase;
|
||||
}
|
||||
private:
|
||||
float mPhase = 0;
|
||||
const float f;
|
||||
const float fs;
|
||||
static constexpr float kTwoPi = M_PI * 2;
|
||||
const float kDelta = kTwoPi * f / fs;
|
||||
};
|
||||
#endif //ANDROID_FXLAB_PHASEACCUMULATOR_H
|
37
externals/oboe/apps/fxlab/app/src/main/cpp/effects/utils/SineWave.h
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_FXLAB_SINEWAVE_H
|
||||
#define ANDROID_FXLAB_SINEWAVE_H
|
||||
|
||||
#include "PhaseAccumulator.h"
|
||||
|
||||
class SineWave {
|
||||
public:
|
||||
// freq in hz
|
||||
SineWave(float frequency, float amplitude, int sampleRate):
|
||||
mPhasor(frequency, sampleRate),
|
||||
kAmplitude(amplitude) { }
|
||||
|
||||
float operator() () {
|
||||
return kAmplitude * sinf(mPhasor.incrementPhase());
|
||||
}
|
||||
|
||||
private:
|
||||
PhaseAccumulator mPhasor;
|
||||
const float kAmplitude;
|
||||
};
|
||||
#endif //ANDROID_FXLAB_SINEWAVE_H
|
36
externals/oboe/apps/fxlab/app/src/main/cpp/effects/utils/WhiteNoise.h
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_WHITENOISE_H
|
||||
#define ANDROID_FXLAB_WHITENOISE_H
|
||||
class WhiteNoise {
|
||||
const int kScale;
|
||||
public:
|
||||
WhiteNoise(int scale): kScale(scale) {}
|
||||
float operator() () {
|
||||
static int counter = 0;
|
||||
static float r_0, r_1 = 0;
|
||||
if (counter == 0) {
|
||||
r_0 = r_1;
|
||||
r_1 = (static_cast <float> (rand()) / static_cast <float> (RAND_MAX)) * 2 - 1;
|
||||
}
|
||||
float ret = r_0 + counter * (r_1 - r_0) / kScale;
|
||||
if (++counter == kScale) counter = 0;
|
||||
if (ret > 0.99) return 0.99f;
|
||||
if (ret < -0.99) return -0.99f;
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
#endif //ANDROID_FXLAB_WHITENOISE_H
|
46
externals/oboe/apps/fxlab/app/src/main/cpp/logging_macros.h
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
#ifndef __SAMPLE_ANDROID_DEBUG_H__
|
||||
#define __SAMPLE_ANDROID_DEBUG_H__
|
||||
#include <android/log.h>
|
||||
|
||||
#if 1
|
||||
#ifndef MODULE_NAME
|
||||
#define MODULE_NAME "AUDIO-APP"
|
||||
#endif
|
||||
|
||||
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, MODULE_NAME, __VA_ARGS__)
|
||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, MODULE_NAME, __VA_ARGS__)
|
||||
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, MODULE_NAME, __VA_ARGS__)
|
||||
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN,MODULE_NAME, __VA_ARGS__)
|
||||
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,MODULE_NAME, __VA_ARGS__)
|
||||
#define LOGF(...) __android_log_print(ANDROID_LOG_FATAL,MODULE_NAME, __VA_ARGS__)
|
||||
|
||||
#define ASSERT(cond, ...) if (!(cond)) {__android_log_assert(#cond, MODULE_NAME, __VA_ARGS__);}
|
||||
#else
|
||||
|
||||
#define LOGV(...)
|
||||
#define LOGD(...)
|
||||
#define LOGI(...)
|
||||
#define LOGW(...)
|
||||
#define LOGE(...)
|
||||
#define LOGF(...)
|
||||
#define ASSERT(cond, ...)
|
||||
|
||||
#endif
|
||||
|
||||
#endif // __SAMPLE_ANDROID_DEBUG_H__
|
160
externals/oboe/apps/fxlab/app/src/main/cpp/native-lib.cpp
vendored
Normal file
|
@ -0,0 +1,160 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "DuplexEngine.h"
|
||||
#include "effects/Effects.h"
|
||||
#include "FunctionList.h"
|
||||
|
||||
|
||||
// JNI Utility functions and globals
|
||||
static DuplexEngine *enginePtr = nullptr;
|
||||
|
||||
// Actual JNI interface
|
||||
extern "C" {
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mobileer_androidfxlab_NativeInterface_createAudioEngine(
|
||||
JNIEnv,
|
||||
jobject /* this */) {
|
||||
enginePtr = new DuplexEngine();
|
||||
}
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mobileer_androidfxlab_NativeInterface_destroyAudioEngine(
|
||||
JNIEnv,
|
||||
jobject /* this */) {
|
||||
if (!enginePtr) return;
|
||||
delete enginePtr;
|
||||
enginePtr = nullptr;
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
Java_com_mobileer_androidfxlab_NativeInterface_getEffects(JNIEnv *env, jobject) {
|
||||
jclass jcl = env->FindClass("com/mobileer/androidfxlab/datatype/EffectDescription");
|
||||
jclass jparamcl = env->FindClass("com/mobileer/androidfxlab/datatype/ParamDescription");
|
||||
assert (jcl != nullptr && jparamcl != nullptr);
|
||||
|
||||
auto jparamMethodId = env->GetMethodID(jparamcl, "<init>", "(Ljava/lang/String;FFF)V");
|
||||
auto jMethodId = env->GetMethodID(jcl, "<init>",
|
||||
"(Ljava/lang/String;Ljava/lang/String;I[Lcom/mobileer/androidfxlab/datatype/ParamDescription;)V");
|
||||
|
||||
auto arr = env->NewObjectArray(numEffects, jcl, nullptr);
|
||||
auto lambda = [&](auto &arg, int i) {
|
||||
const auto ¶mArr = arg.getParams();
|
||||
auto jparamArr = env->NewObjectArray(paramArr.size(), jparamcl, nullptr);
|
||||
int c = 0;
|
||||
for (auto const &elem: paramArr) {
|
||||
jobject j = env->NewObject(jparamcl, jparamMethodId,
|
||||
env->NewStringUTF(std::string(elem.kName).c_str()),
|
||||
elem.kMinVal, elem.kMaxVal, elem.kDefVal);
|
||||
assert(j != nullptr);
|
||||
env->SetObjectArrayElement(jparamArr, c++, j);
|
||||
}
|
||||
jobject j = env->NewObject(jcl, jMethodId,
|
||||
env->NewStringUTF(std::string(arg.getName()).c_str()),
|
||||
env->NewStringUTF(std::string(arg.getCategory()).c_str()),
|
||||
i, jparamArr);
|
||||
assert(j != nullptr);
|
||||
env->SetObjectArrayElement(arr, i, j);
|
||||
};
|
||||
int i = 0;
|
||||
std::apply([&i, &lambda](auto &&... args) mutable { ((lambda(args, i++)), ...); },
|
||||
EffectsTuple);
|
||||
return arr;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mobileer_androidfxlab_NativeInterface_addDefaultEffectNative(JNIEnv *, jobject, jint jid) {
|
||||
if (!enginePtr) return;
|
||||
auto id = static_cast<int>(jid);
|
||||
|
||||
std::visit([id](auto &&stack) {
|
||||
std::function<void(decltype(stack.getType()), decltype(stack.getType()))> f;
|
||||
int i = 0;
|
||||
std::apply([id, &f, &i](auto &&... args) mutable {
|
||||
((f = (i++ == id) ?
|
||||
args.template buildDefaultEffect<decltype(stack.getType())>() : f), ...);
|
||||
}, EffectsTuple);
|
||||
stack.addEffect(std::move(f));
|
||||
}, enginePtr->functionList);
|
||||
}
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mobileer_androidfxlab_NativeInterface_removeEffectNative(JNIEnv *, jobject, jint jind) {
|
||||
if (!enginePtr) return;
|
||||
auto ind = static_cast<size_t>(jind);
|
||||
std::visit([ind](auto &&arg) {
|
||||
arg.removeEffectAt(ind);
|
||||
}, enginePtr->functionList);
|
||||
}
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mobileer_androidfxlab_NativeInterface_rotateEffectNative(JNIEnv *, jobject,
|
||||
jint jfrom, jint jto) {
|
||||
if (!enginePtr) return;
|
||||
auto from = static_cast<size_t>(jfrom);
|
||||
auto to = static_cast<size_t>(jto);
|
||||
|
||||
std::visit([from, to](auto &&arg) {
|
||||
arg.rotateEffectAt(from, to);
|
||||
}, enginePtr->functionList);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mobileer_androidfxlab_NativeInterface_modifyEffectNative(
|
||||
JNIEnv *env, jobject, jint jid, jint jindex, jfloatArray params) {
|
||||
if (!enginePtr) return;
|
||||
int id = static_cast<int>(jid);
|
||||
int index = static_cast<size_t>(jindex);
|
||||
|
||||
jfloat *data = env->GetFloatArrayElements(params, nullptr);
|
||||
std::vector<float> arr{data, data + env->GetArrayLength(params)};
|
||||
env->ReleaseFloatArrayElements(params, data, 0);
|
||||
std::visit([&arr, &id, &index](auto &&stack) {
|
||||
std::function<void(decltype(stack.getType()), decltype(stack.getType()))> ef;
|
||||
int i = 0;
|
||||
std::apply([&](auto &&... args) mutable {
|
||||
((ef = (i++ == id) ?
|
||||
args.modifyEffectVec(ef, arr) : ef), ...);
|
||||
}, EffectsTuple);
|
||||
stack.modifyEffectAt(index, std::move(ef));
|
||||
}, enginePtr->functionList);
|
||||
}
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mobileer_androidfxlab_NativeInterface_enableEffectNative(
|
||||
JNIEnv *, jobject, jint jindex, jboolean jenable) {
|
||||
if (!enginePtr) return;
|
||||
auto ind = static_cast<size_t>(jindex);
|
||||
auto enable = static_cast<bool>(jenable);
|
||||
std::visit([ind, enable](auto &&args) {
|
||||
args.enableEffectAt(ind, enable);
|
||||
}, enginePtr->functionList);
|
||||
}
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mobileer_androidfxlab_NativeInterface_enablePassthroughNative(
|
||||
JNIEnv *, jobject, jboolean jenable) {
|
||||
if (!enginePtr) return;
|
||||
std::visit([enable = static_cast<bool>(jenable)](auto &&args) {
|
||||
args.mute(!enable);
|
||||
}, enginePtr->functionList);
|
||||
}
|
||||
} //extern C
|
||||
|
5
externals/oboe/apps/fxlab/app/src/main/cpp/tests/.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
CMakeFiles/
|
||||
CMakeCache.txt
|
||||
cmake_install.cmake
|
||||
Makefile
|
||||
runTests
|
15
externals/oboe/apps/fxlab/app/src/main/cpp/tests/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
cmake_minimum_required(VERSION 3.4.1)
|
||||
|
||||
project(Effects_Tests)
|
||||
# We need C++17 to test
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
# Locate GTest
|
||||
find_package(GTest REQUIRED)
|
||||
include_directories(${GTEST_INCLUDE_DIRS})
|
||||
|
||||
# Link runTests with what we want to test and the GTest and pthread library
|
||||
add_executable(runTests testEffects.cpp)
|
||||
target_link_libraries(runTests ${GTEST_LIBRARIES} pthread)
|
52
externals/oboe/apps/fxlab/app/src/main/cpp/tests/DelayLineEffectTest.h
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_FXLAB_DELAYLINEEFFECTTEST_H
|
||||
#define ANDROID_FXLAB_DELAYLINEEFFECTTEST_H
|
||||
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../effects/DelayLineEffect.h"
|
||||
|
||||
|
||||
namespace {
|
||||
TEST(DelayLineEffectTest, SingleFeedForwardTest) {
|
||||
DelayLineEffect<float*> e1 {0, 1, 0, 1, 0, [](){return 0;}};
|
||||
std::array<float, 5> inputData {1, 0, 0.5, 0.25, 0};
|
||||
for (int i = 0; i < 5; i++){
|
||||
e1(inputData[i]);
|
||||
}
|
||||
EXPECT_EQ(inputData[0], 0);
|
||||
EXPECT_EQ(inputData[1], 1);
|
||||
EXPECT_EQ(inputData[2], 0);
|
||||
EXPECT_EQ(inputData[3], 0.5);
|
||||
EXPECT_EQ(inputData[4], 0.25);
|
||||
}
|
||||
TEST(DelayLineEffectTest, FFandBlendTest) {
|
||||
DelayLineEffect<float*> e1 {1, 1, 0, 1, 0, [](){return 0;}};
|
||||
std::array<float, 5> inputData {1, 0, 0.5, 0.25, 0};
|
||||
for (int i = 0; i < 5; i++) {
|
||||
e1(inputData[i]);
|
||||
}
|
||||
EXPECT_EQ(inputData[0], 1);
|
||||
EXPECT_EQ(inputData[1], 1);
|
||||
EXPECT_EQ(inputData[2], 0.5);
|
||||
EXPECT_EQ(inputData[3], 0.75);
|
||||
EXPECT_EQ(inputData[4], 0.25);
|
||||
}
|
||||
}
|
||||
#endif //ANDROID_FXLAB_DELAYLINEEFFECTTEST_H
|
61
externals/oboe/apps/fxlab/app/src/main/cpp/tests/DelayLineTest.h
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_FXLAB_DELAYLINETEST_H
|
||||
#define ANDROID_FXLAB_DELAYLINETEST_H
|
||||
|
||||
#include "../effects/utils/DelayLine.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace {
|
||||
TEST(DelayLineTest, CreateAndAdd) {
|
||||
DelayLine<float> d1{10};
|
||||
d1.push(1.0);
|
||||
EXPECT_EQ(d1[1], 1.0);
|
||||
}
|
||||
TEST(DelayLineTest, UnfilledAddSequence) {
|
||||
DelayLine<float> d1{10};
|
||||
d1.push(1.0);
|
||||
d1.push(2.0);
|
||||
d1.push(3.0);
|
||||
EXPECT_EQ(d1[1], 3.0);
|
||||
EXPECT_EQ(d1[2], 2.0);
|
||||
EXPECT_EQ(d1[3], 1.0);
|
||||
}
|
||||
TEST(DelayLineTest, FilledAddSequence) {
|
||||
DelayLine<float> d1{4};
|
||||
d1.push(1.0);
|
||||
d1.push(2.0);
|
||||
d1.push(3.0);
|
||||
d1.push(4.0);
|
||||
EXPECT_EQ(d1[1], 4.0);
|
||||
EXPECT_EQ(d1[2], 3.0);
|
||||
EXPECT_EQ(d1[3], 2.0);
|
||||
EXPECT_EQ(d1[4], 1.0);
|
||||
d1.push(5.0);
|
||||
EXPECT_EQ(d1[1], 5.0);
|
||||
EXPECT_EQ(d1[2], 4.0);
|
||||
EXPECT_EQ(d1[3], 3.0);
|
||||
EXPECT_EQ(d1[4], 2.0);
|
||||
d1.push(6.0);
|
||||
EXPECT_EQ(d1[1], 6.0);
|
||||
EXPECT_EQ(d1[2], 5.0);
|
||||
EXPECT_EQ(d1[3], 4.0);
|
||||
EXPECT_EQ(d1[4], 3.0);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
#endif //ANDROID_FXLAB_DELAYLINETEST_H
|
54
externals/oboe/apps/fxlab/app/src/main/cpp/tests/TypeTests.h
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef ANDROID_FXLAB_TYPETESTS_H
|
||||
#define ANDROID_FXLAB_TYPETESTS_H
|
||||
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../effects/Effects.h"
|
||||
#include "../FunctionList.h"
|
||||
namespace {
|
||||
TEST(TypeTests, Templating) {
|
||||
TremoloEffect t {1, 2};
|
||||
VibratoEffect<float*> v {1, 2};
|
||||
float x = 5;
|
||||
t(x);
|
||||
auto pass = std::get<0>(EffectsTuple);
|
||||
auto descrip = std::get<1>(EffectsTuple);
|
||||
auto vibdes = std::get<2>(EffectsTuple);
|
||||
auto gaindes = std::get<3>(EffectsTuple);
|
||||
auto f = descrip.buildDefaultEffect<float*>();
|
||||
auto g = vibdes.buildDefaultEffect<float*>();
|
||||
auto h = vibdes.buildDefaultEffect<float*>();
|
||||
f(&x, &x + 1); g(&x, &x + 1); h(&x, &x + 1);
|
||||
auto j = gaindes.buildDefaultEffect<float*>();
|
||||
auto k = gaindes.modifyEffect<float*>(j, std::array<float, 1> {10});
|
||||
float floatArr[4] = {1,2,3, 4};
|
||||
for (int i =0; i < 4; i++) {
|
||||
k(floatArr + i, floatArr + i + 1);
|
||||
}
|
||||
auto arr = std::array<float, 1> {10};
|
||||
auto data = std::array<int, 5> {1, 2, 3, 4, 5};
|
||||
std::function<void(int*, int*)> fe = std::get<Effect::GainDescription>(EffectsTuple).buildEffect<int*>(arr);
|
||||
fe(data.begin(), data.end());
|
||||
EXPECT_EQ(data[0], 2);
|
||||
|
||||
}
|
||||
}
|
||||
#endif //ANDROID_FXLAB_TYPETESTS_H
|
29
externals/oboe/apps/fxlab/app/src/main/cpp/tests/testEffects.cpp
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "DelayLineTest.h"
|
||||
#include "DelayLineEffectTest.h"
|
||||
#include "TypeTests.h"
|
||||
// This is the runner for the various unit tests in the test directory
|
||||
// Currently it is designed to be run on the development machine via CMAKE
|
||||
// Since this tests effects, it should be independent of Android, and simply test locally
|
||||
int main(int argc, char **argv) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
210
externals/oboe/apps/fxlab/app/src/main/kotlin/com/mobileer/androidfxlab/EffectsAdapter.kt
vendored
Normal file
|
@ -0,0 +1,210 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mobileer.androidfxlab
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.SeekBar
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.switchmaterial.SwitchMaterial
|
||||
import com.mobileer.androidfxlab.datatype.Effect
|
||||
import java.util.*
|
||||
import kotlin.concurrent.timerTask
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
object EffectsAdapter :
|
||||
RecyclerView.Adapter<EffectsAdapter.EffectsHolder>() {
|
||||
val effectList = arrayListOf<Effect>()
|
||||
lateinit var mRecyclerView: RecyclerView
|
||||
|
||||
// This class adapts view in effect_view.xml for Effect class
|
||||
class EffectsHolder(val parentView: ViewGroup) : RecyclerView.ViewHolder(parentView) {
|
||||
private val layoutContainer: LinearLayout = parentView.findViewById(R.id.effectContainer)
|
||||
lateinit var effect: Effect
|
||||
private val floatFormat = "%4.2f"
|
||||
private var index: Int = -1
|
||||
fun bindEffect(bindedEffect: Effect, position: Int) {
|
||||
effect = bindedEffect
|
||||
index = position
|
||||
// Clear all views
|
||||
layoutContainer.removeAllViews()
|
||||
View.inflate(layoutContainer.context,
|
||||
R.layout.effect_header, layoutContainer)
|
||||
val header: LinearLayout = layoutContainer.findViewById(R.id.effectHeader)
|
||||
val dragHandleView: View = header.findViewById(R.id.cat_card_list_item_drag_handle)
|
||||
val checkBoxView: SwitchMaterial = header.findViewById(R.id.effectEnabled)
|
||||
val label: TextView = header.findViewById(R.id.effectLabel)
|
||||
// Bind header views
|
||||
label.text = effect.name
|
||||
checkBoxView.isChecked = effectList[index].enable
|
||||
checkBoxView.setOnCheckedChangeListener { _, checked ->
|
||||
effectList[index].enable = checked
|
||||
NativeInterface.enableEffectAt(checked, index)
|
||||
}
|
||||
dragHandleView.setOnTouchListener { _, event ->
|
||||
if (event.action == MotionEvent.ACTION_DOWN) {
|
||||
itemTouchHelper.startDrag(this@EffectsHolder)
|
||||
return@setOnTouchListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
header.setOnTouchListener { _, event ->
|
||||
if (event.action == MotionEvent.ACTION_DOWN) {
|
||||
itemTouchHelper.startSwipe(this@EffectsHolder)
|
||||
return@setOnTouchListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
// Add correct number of SeekBars based on effect
|
||||
for (ind in effect.effectDescription.paramValues.withIndex()) {
|
||||
val param = ind.value
|
||||
val counter = ind.index
|
||||
val view = View.inflate(layoutContainer.context,
|
||||
R.layout.param_seek, null)
|
||||
layoutContainer.addView(view)
|
||||
val paramWrapper: LinearLayout = view.findViewById(R.id.paramWrapper)
|
||||
val paramLabelView: TextView = paramWrapper.findViewById(R.id.paramLabel)
|
||||
val minLabelView: TextView = paramWrapper.findViewById(R.id.minLabel)
|
||||
val maxLabelView: TextView = paramWrapper.findViewById(R.id.maxLabel)
|
||||
val curLabelView: TextView = paramWrapper.findViewById(R.id.curLabel)
|
||||
val seekBar: SeekBar = paramWrapper.findViewById(R.id.seekBar)
|
||||
paramLabelView.text = param.paramName
|
||||
minLabelView.text = floatFormat.format(param.minValue)
|
||||
maxLabelView.text = floatFormat.format(param.maxValue)
|
||||
seekBar.progress =
|
||||
((effectList[index].paramValues[counter] - param.minValue) * 100 / (param.maxValue
|
||||
- param.minValue)).toInt()
|
||||
curLabelView.text = floatFormat.format(effectList[index].paramValues[counter])
|
||||
// Bind param listeners to effects
|
||||
seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
|
||||
val paramInd = counter
|
||||
var timer : Timer? = null
|
||||
|
||||
override fun onStartTrackingTouch(p0: SeekBar?) {}
|
||||
|
||||
override fun onStopTrackingTouch(seekbar: SeekBar?) {}
|
||||
|
||||
override fun onProgressChanged(
|
||||
seekBar: SeekBar?, progress: Int, fromUser: Boolean
|
||||
) {
|
||||
val fracprogress =
|
||||
((seekBar!!.progress / 100f) * (param.maxValue - param.minValue) + param.minValue)
|
||||
curLabelView.text = floatFormat.format(fracprogress)
|
||||
|
||||
timer?.cancel()
|
||||
timer = Timer()
|
||||
timer?.schedule(timerTask { updateEffectParam(fracprogress) }, 100)
|
||||
}
|
||||
|
||||
fun updateEffectParam(fracprogress : Float){
|
||||
effectList[index].paramValues[paramInd] = fracprogress
|
||||
NativeInterface.updateParamsAt(effect, index)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): EffectsHolder {
|
||||
val myView = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.effect_view, parent, false)
|
||||
return EffectsHolder(myView as ViewGroup)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: EffectsHolder, position: Int) {
|
||||
holder.bindEffect(effectList[position], position)
|
||||
}
|
||||
|
||||
override fun getItemCount() = effectList.size
|
||||
|
||||
override fun onAttachedToRecyclerView(recyclerView: RecyclerView) {
|
||||
super.onAttachedToRecyclerView(recyclerView)
|
||||
mRecyclerView = recyclerView
|
||||
itemTouchHelper.attachToRecyclerView(mRecyclerView)
|
||||
}
|
||||
|
||||
private val itemTouchHelper = ItemTouchHelper(object : ItemTouchHelper.SimpleCallback(
|
||||
ItemTouchHelper.UP or ItemTouchHelper.DOWN, ItemTouchHelper.RIGHT or ItemTouchHelper.LEFT
|
||||
) {
|
||||
|
||||
var dragFrom = -1
|
||||
var dragTo = -1
|
||||
override fun onMove(
|
||||
recyclerView: RecyclerView,
|
||||
viewHolder: RecyclerView.ViewHolder,
|
||||
target: RecyclerView.ViewHolder
|
||||
): Boolean {
|
||||
|
||||
val fromPos = viewHolder.adapterPosition
|
||||
val toPos = target.adapterPosition
|
||||
if (dragFrom == -1) {
|
||||
dragFrom = fromPos
|
||||
}
|
||||
dragTo = toPos
|
||||
effectList.add(toPos, effectList.removeAt(fromPos))
|
||||
recyclerView.adapter?.notifyItemMoved(fromPos, toPos)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
|
||||
val position = viewHolder.adapterPosition
|
||||
effectList.removeAt(position)
|
||||
mRecyclerView.adapter?.notifyItemRemoved(position)
|
||||
NativeInterface.removeEffectAt(position)
|
||||
for (i in position until effectList.size) {
|
||||
var holder = mRecyclerView.findViewHolderForAdapterPosition(i) as EffectsHolder
|
||||
holder.bindEffect(holder.effect, i)
|
||||
}
|
||||
}
|
||||
|
||||
override fun clearView(
|
||||
recyclerView: RecyclerView,
|
||||
viewHolder: RecyclerView.ViewHolder
|
||||
) {
|
||||
super.clearView(recyclerView, viewHolder)
|
||||
if (dragFrom != -1 && dragTo != -1 && dragFrom != dragTo) {
|
||||
rotateItems(dragFrom, dragTo)
|
||||
}
|
||||
dragFrom = -1
|
||||
dragTo = -1
|
||||
}
|
||||
|
||||
override fun isLongPressDragEnabled(): Boolean = false
|
||||
override fun isItemViewSwipeEnabled(): Boolean = false
|
||||
|
||||
fun rotateItems(fromPos: Int, toPos: Int) {
|
||||
val a = min(fromPos, toPos)
|
||||
val b = max(fromPos, toPos)
|
||||
for (i in a..b) {
|
||||
var holder = mRecyclerView.findViewHolderForAdapterPosition(i) as EffectsHolder
|
||||
holder.bindEffect(holder.effect, i)
|
||||
}
|
||||
NativeInterface.rotateEffectAt(fromPos, toPos)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
219
externals/oboe/apps/fxlab/app/src/main/kotlin/com/mobileer/androidfxlab/MainActivity.kt
vendored
Normal file
|
@ -0,0 +1,219 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mobileer.androidfxlab
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.media.midi.MidiDeviceInfo
|
||||
import android.media.midi.MidiManager
|
||||
import android.media.midi.MidiReceiver
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.util.Log
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.SubMenu
|
||||
import android.view.WindowManager
|
||||
import android.widget.PopupMenu
|
||||
import android.widget.SeekBar
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import com.mobileer.androidfxlab.databinding.ActivityMainBinding
|
||||
import com.mobileer.androidfxlab.datatype.Effect
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
private var TAG: String = this.toString()
|
||||
lateinit var binding: ActivityMainBinding
|
||||
private var isAudioEnabled: Boolean = false
|
||||
|
||||
val MY_PERMISSIONS_RECORD_AUDIO = 17
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
|
||||
setSupportActionBar(binding.toolbar)
|
||||
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
|
||||
!= PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
ActivityCompat.requestPermissions(
|
||||
this,
|
||||
arrayOf(Manifest.permission.RECORD_AUDIO),
|
||||
MY_PERMISSIONS_RECORD_AUDIO
|
||||
)
|
||||
}
|
||||
|
||||
binding.effectListView.adapter = EffectsAdapter
|
||||
|
||||
binding.floatingAddButton.setOnClickListener { view ->
|
||||
val popup = PopupMenu(this, view)
|
||||
popup.menuInflater.inflate(R.menu.add_menu, popup.menu)
|
||||
val menuMap = HashMap<String, SubMenu>()
|
||||
for (effectName in NativeInterface.effectDescriptionMap.keys) {
|
||||
val cat = NativeInterface.effectDescriptionMap.getValue(effectName).category
|
||||
if (cat == "None") {
|
||||
popup.menu.add(effectName)
|
||||
} else {
|
||||
val subMenu = menuMap[cat] ?: popup.menu.addSubMenu(cat)
|
||||
subMenu.add(effectName)
|
||||
menuMap[cat] = subMenu
|
||||
}
|
||||
}
|
||||
popup.setOnMenuItemClickListener { menuItem ->
|
||||
NativeInterface.effectDescriptionMap[menuItem.title]?.let {
|
||||
val toAdd = Effect(it)
|
||||
EffectsAdapter.effectList.add(toAdd)
|
||||
NativeInterface.addEffect(toAdd)
|
||||
EffectsAdapter.notifyItemInserted(EffectsAdapter.effectList.size - 1)
|
||||
true
|
||||
}
|
||||
false
|
||||
}
|
||||
popup.show()
|
||||
}
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
|
||||
handleMidiDevices()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
// Clear the FX UI
|
||||
EffectsAdapter.effectList.clear()
|
||||
EffectsAdapter.notifyDataSetChanged()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
// Shutdown Engine
|
||||
NativeInterface.destroyAudioEngine()
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
// Startup Engine
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
|
||||
== PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
NativeInterface.createAudioEngine()
|
||||
NativeInterface.enable(isAudioEnabled)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<out String>,
|
||||
grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
when (requestCode) {
|
||||
MY_PERMISSIONS_RECORD_AUDIO -> {
|
||||
if ((grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED)) {
|
||||
NativeInterface.createAudioEngine()
|
||||
} else {
|
||||
val builder = AlertDialog.Builder(this).apply {
|
||||
setMessage(
|
||||
"Audio effects require audio input permissions! \n" +
|
||||
"Enable permissions and restart app to use."
|
||||
)
|
||||
setTitle("Permission Error")
|
||||
}
|
||||
builder.create().show()
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
private fun handleMidiDevices() {
|
||||
|
||||
val midiManager = getSystemService(Context.MIDI_SERVICE) as MidiManager
|
||||
midiManager.registerDeviceCallback(object : MidiManager.DeviceCallback() {
|
||||
override fun onDeviceAdded(device: MidiDeviceInfo) {
|
||||
|
||||
// open this device
|
||||
midiManager.openDevice(device, {
|
||||
Log.d(TAG, "Opened MIDI device")
|
||||
|
||||
val targetSeekBar = findViewById<SeekBar>(R.id.seekBar)
|
||||
if (targetSeekBar != null) {
|
||||
|
||||
val midiReceiver = MyMidiReceiver(targetSeekBar)
|
||||
val outputPort = it.openOutputPort(0)
|
||||
outputPort?.connect(midiReceiver)
|
||||
}
|
||||
|
||||
}, Handler())
|
||||
}
|
||||
}, Handler())
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
getMenuInflater().inflate(R.menu.toolbar_menu, menu)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) {
|
||||
R.id.action_toggle_mute -> {
|
||||
isAudioEnabled = !isAudioEnabled
|
||||
NativeInterface.enable(isAudioEnabled)
|
||||
|
||||
if (isAudioEnabled) {
|
||||
item.setIcon(R.drawable.ic_baseline_audio_is_enabled_24)
|
||||
} else {
|
||||
item.setIcon(R.drawable.ic_baseline_audio_is_disabled_24)
|
||||
}
|
||||
true
|
||||
}
|
||||
else -> {
|
||||
super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
class MyMidiReceiver(var seekBar: SeekBar) : MidiReceiver() {
|
||||
|
||||
private val TAG: String = "MyMidiReceiver"
|
||||
|
||||
override fun onSend(data: ByteArray?, offset: Int, count: Int, timestamp: Long) {
|
||||
|
||||
Log.d(TAG, "Got midi message, offset " + offset + " count " + count)
|
||||
Log.d(TAG, "Byte 0 " + Integer.toHexString(data!![offset].toInt()))
|
||||
Log.d(TAG, "Byte 1 " + Integer.toHexString(data[offset+1].toInt()))
|
||||
Log.d(TAG, "Byte 2 " + data[offset+2].toInt())
|
||||
|
||||
val CONTROL_CHANGE_CH1 : Byte = 0xB0.toByte()
|
||||
|
||||
if (data[offset] == CONTROL_CHANGE_CH1){
|
||||
seekBar.progress = (data[offset+2].toInt() / 1.27).toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
110
externals/oboe/apps/fxlab/app/src/main/kotlin/com/mobileer/androidfxlab/NativeInterface.kt
vendored
Normal file
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mobileer.androidfxlab
|
||||
|
||||
import android.util.Log
|
||||
import com.mobileer.androidfxlab.datatype.Effect
|
||||
import com.mobileer.androidfxlab.datatype.EffectDescription
|
||||
|
||||
object NativeInterface {
|
||||
// Used to load the 'native-lib' library on application startup.
|
||||
val effectDescriptionMap: Map<String, EffectDescription>
|
||||
|
||||
init {
|
||||
System.loadLibrary("native-lib")
|
||||
effectDescriptionMap = getEffects()
|
||||
.associateBy { it.name }
|
||||
Log.d("MAP", effectDescriptionMap.toString())
|
||||
}
|
||||
|
||||
// Functions/Members called by UI code
|
||||
// Adds effect at end of effect list
|
||||
fun addEffect(effect: Effect) {
|
||||
Log.d("INTERFACE", String.format("Effect %s added", effect.name))
|
||||
addDefaultEffectNative(
|
||||
convertEffectToId(
|
||||
effect
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// Enables effect at index
|
||||
fun enableEffectAt(turnOn: Boolean, index: Int) {
|
||||
Log.d("INTERFACE", String.format("Effect %b at index %d", turnOn, index))
|
||||
enableEffectNative(index, turnOn)
|
||||
}
|
||||
|
||||
// Signals params were updated at index
|
||||
fun updateParamsAt(effect: Effect, index: Int) {
|
||||
Log.d(
|
||||
"INTERFACE",
|
||||
String.format(
|
||||
"Params were updated at index %d to %f",
|
||||
index,
|
||||
effect.paramValues[0]
|
||||
)
|
||||
)
|
||||
modifyEffectNative(
|
||||
convertEffectToId(
|
||||
effect
|
||||
), index, effect.paramValues
|
||||
)
|
||||
}
|
||||
|
||||
// Removes effect at index
|
||||
fun removeEffectAt(index: Int) {
|
||||
Log.d("INTERFACE", String.format("Effect was removed at index %d", index))
|
||||
removeEffectNative(index)
|
||||
}
|
||||
|
||||
// Rotates existing effect from index to another
|
||||
fun rotateEffectAt(from: Int, to: Int) {
|
||||
Log.d("INTERFACE", String.format("Effect was rotated from %d to %d", from, to))
|
||||
rotateEffectNative(from, to)
|
||||
}
|
||||
|
||||
fun enable(enable: Boolean) {
|
||||
Log.d("INTERFACE", "Enabling effects: $enable")
|
||||
enablePassthroughNative(enable)
|
||||
}
|
||||
|
||||
// State of audio engine
|
||||
external fun createAudioEngine()
|
||||
|
||||
external fun destroyAudioEngine()
|
||||
|
||||
// These functions populate effectDescriptionMap
|
||||
private external fun getEffects(): Array<EffectDescription>
|
||||
|
||||
// These functions mutate the function list
|
||||
// Adds effect at index
|
||||
private external fun addDefaultEffectNative(id: Int)
|
||||
|
||||
private external fun removeEffectNative(index: Int)
|
||||
|
||||
private external fun rotateEffectNative(from: Int, to: Int)
|
||||
|
||||
private external fun modifyEffectNative(id: Int, index: Int, params: FloatArray)
|
||||
|
||||
private external fun enableEffectNative(index: Int, enable: Boolean)
|
||||
|
||||
private external fun enablePassthroughNative(enable: Boolean)
|
||||
|
||||
// These are utility functions
|
||||
private fun convertEffectToId(effect: Effect): Int =
|
||||
effectDescriptionMap[effect.name]?.id ?: -1
|
||||
}
|
28
externals/oboe/apps/fxlab/app/src/main/kotlin/com/mobileer/androidfxlab/datatype/Effect.kt
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mobileer.androidfxlab.datatype
|
||||
|
||||
/**
|
||||
* Class which represents an audio effect
|
||||
*/
|
||||
data class Effect(val effectDescription: EffectDescription) {
|
||||
val name = effectDescription.name
|
||||
val paramValues = FloatArray(effectDescription.paramValues.size) {
|
||||
i -> effectDescription.paramValues[i].defaultValue
|
||||
}
|
||||
var enable: Boolean = true
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mobileer.androidfxlab.datatype
|
||||
|
||||
data class EffectDescription(
|
||||
val name: String,
|
||||
val category: String,
|
||||
val id: Int,
|
||||
val paramValues: Array<ParamDescription>
|
||||
) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
other as EffectDescription
|
||||
if (id != other.id) return false
|
||||
return true
|
||||
}
|
||||
override fun hashCode(): Int = id
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright 2019 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.mobileer.androidfxlab.datatype
|
||||
|
||||
data class ParamDescription (
|
||||
val paramName: String,
|
||||
val minValue: Float,
|
||||
val maxValue: Float,
|
||||
val defaultValue: Float)
|
50
externals/oboe/apps/fxlab/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0"/>
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1"/>
|
||||
</vector>
|
25
externals/oboe/apps/fxlab/app/src/main/res/drawable/ic_add.xml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||
</vector>
|
10
externals/oboe/apps/fxlab/app/src/main/res/drawable/ic_baseline_audio_is_disabled_24.xml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v2.21l2.45,2.45c0.03,-0.2 0.05,-0.41 0.05,-0.63zM19,12c0,0.94 -0.2,1.82 -0.54,2.64l1.51,1.51C20.63,14.91 21,13.5 21,12c0,-4.28 -2.99,-7.86 -7,-8.77v2.06c2.89,0.86 5,3.54 5,6.71zM4.27,3L3,4.27 7.73,9L3,9v6h4l5,5v-6.73l4.25,4.25c-0.67,0.52 -1.42,0.93 -2.25,1.18v2.06c1.38,-0.31 2.63,-0.95 3.69,-1.81L19.73,21 21,19.73l-9,-9L4.27,3zM12,4L9.91,6.09 12,8.18L12,4z"/>
|
||||
</vector>
|
10
externals/oboe/apps/fxlab/app/src/main/res/drawable/ic_baseline_audio_is_enabled_24.xml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M3,9v6h4l5,5L12,4L7,9L3,9zM16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM14,3.23v2.06c2.89,0.86 5,3.54 5,6.71s-2.11,5.85 -5,6.71v2.06c4.01,-0.91 7,-4.49 7,-8.77s-2.99,-7.86 -7,-8.77z"/>
|
||||
</vector>
|
25
externals/oboe/apps/fxlab/app/src/main/res/drawable/ic_baseline_drag_indicator.xml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@color/colorAccent"
|
||||
android:pathData="M11,18c0,1.1 -0.9,2 -2,2s-2,-0.9 -2,-2 0.9,-2 2,-2 2,0.9 2,2zM9,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM9,4c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM15,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM15,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM15,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
|
||||
</vector>
|
90
externals/oboe/apps/fxlab/app/src/main/res/drawable/ic_launcher_background.xml
vendored
Normal file
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="108dp"
|
||||
android:width="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path android:fillColor="#008577"
|
||||
android:pathData="M0,0h108v108h-108z"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
</vector>
|
63
externals/oboe/apps/fxlab/app/src/main/res/layout/activity_main.xml
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<layout>
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/appBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.ActionBar">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
app:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.MaterialComponents.Light"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
<!-- Main content -->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/effect_list_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="vertical"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/floating_add_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:layout_margin="16dp"
|
||||
app:srcCompat="@drawable/ic_add" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</layout>
|
65
externals/oboe/apps/fxlab/app/src/main/res/layout/effect_header.xml
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/effectHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/effectLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?attr/textAppearanceHeadline6" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/effectEnabled"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:enabled="true" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="right"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cat_card_list_item_drag_handle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
app:srcCompat="@drawable/ic_baseline_drag_indicator"
|
||||
tools:targetApi="jelly_bean" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
38
externals/oboe/apps/fxlab/app/src/main/res/layout/effect_view.xml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/cat_card_list_item_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:minHeight="118dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/effectContainer"
|
||||
android:orientation="vertical"/>
|
||||
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
59
externals/oboe/apps/fxlab/app/src/main/res/layout/param_seek.xml
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/paramWrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/paramLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/curLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/minLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.25"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption" />
|
||||
|
||||
<SeekBar
|
||||
android:id="@+id/seekBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/maxLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.25"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption" />
|
||||
|
||||
</LinearLayout>
|
19
externals/oboe/apps/fxlab/app/src/main/res/menu/add_menu.xml
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<menu>
|
||||
</menu>
|
12
externals/oboe/apps/fxlab/app/src/main/res/menu/toolbar_menu.xml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<!-- Add a mute toggle action to our Toolbar-->
|
||||
<item
|
||||
android:id="@+id/action_toggle_mute"
|
||||
android:icon="@drawable/ic_baseline_audio_is_disabled_24"
|
||||
android:title="@string/action_toggle_mute"
|
||||
app:showAsAction="ifRoom"
|
||||
/>
|
||||
</menu>
|
21
externals/oboe/apps/fxlab/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
21
externals/oboe/apps/fxlab/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
BIN
externals/oboe/apps/fxlab/app/src/main/res/mipmap-hdpi/ic_launcher.png
vendored
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
externals/oboe/apps/fxlab/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
vendored
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
externals/oboe/apps/fxlab/app/src/main/res/mipmap-mdpi/ic_launcher.png
vendored
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
externals/oboe/apps/fxlab/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
vendored
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
externals/oboe/apps/fxlab/app/src/main/res/mipmap-xhdpi/ic_launcher.png
vendored
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
externals/oboe/apps/fxlab/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
vendored
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
externals/oboe/apps/fxlab/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
vendored
Normal file
After Width: | Height: | Size: 6.2 KiB |
BIN
externals/oboe/apps/fxlab/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
vendored
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
externals/oboe/apps/fxlab/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
vendored
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
externals/oboe/apps/fxlab/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
vendored
Normal file
After Width: | Height: | Size: 15 KiB |
23
externals/oboe/apps/fxlab/app/src/main/res/values/colors.xml
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<color name="colorPrimary">#6200EE</color>
|
||||
<color name="colorPrimaryDark">#3700B3</color>
|
||||
<color name="colorAccent">#03DAC6</color>
|
||||
<color name="colorAccentDark">#018786</color>
|
||||
</resources>
|
20
externals/oboe/apps/fxlab/app/src/main/res/values/strings.xml
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="app_name">AndroidFX Lab</string>
|
||||
<string name="action_toggle_mute">Toggle volume</string>
|
||||
</resources>
|
27
externals/oboe/apps/fxlab/app/src/main/res/values/styles.xml
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
<!--
|
||||
~ Copyright 2019 Google LLC
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ https://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|