Move dead submodules in-tree

Signed-off-by: swurl <swurl@swurl.xyz>
This commit is contained in:
swurl 2025-05-31 02:33:02 -04:00
parent c0cceff365
commit 6c655321e6
No known key found for this signature in database
GPG key ID: A5A7629F109C8FD1
4081 changed files with 1185566 additions and 45 deletions

View file

@ -0,0 +1,74 @@
#
# Copyright 2019 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.
#
cmake_minimum_required(VERSION 3.4.1)
# Pull in parselib
set (PARSELIB_DIR ../../../../parselib)
#message("PARSELIB_DIR = " + ${PARSELIB_DIR})
# Pull in iolib
set (IOLIB_DIR ../../../../iolib)
#message("IOLIB_DIR = " + ${IOLIB_DIR})
# Set the path to the Oboe library directory
set (OBOE_DIR ../../../../../)
#message("OBOE_DIR = " + ${OBOE_DIR})
add_subdirectory(${OBOE_DIR} ./oboe-bin)
# include folders
include_directories(
${OBOE_DIR}/include
${CMAKE_CURRENT_LIST_DIR}
)
include(${PARSELIB_DIR}/src/main/cpp/CMakeLists.txt)
include(${IOLIB_DIR}/src/main/cpp/CMakeLists.txt)
# Include the WavLib headers and shared sample code
include_directories(
${PARSELIB_DIR}/src/main/cpp
${IOLIB_DIR}/src/main/cpp)
# App specific sources
set (APP_SOURCES
DrumPlayerJNI.cpp
)
# Build the drumthumper (native) library
add_library(drumthumper SHARED
${APP_SOURCES}
)
# Enable optimization flags: if having problems with source level debugging,
# disable -Ofast ( and debug ), re-enable after done debugging.
target_compile_options(drumthumper PRIVATE -Wall -Werror "$<$<CONFIG:RELEASE>:-Ofast>")
target_link_libraries( # Specifies the target library.
drumthumper
-Wl,--whole-archive
iolib
parselib
-Wl,--no-whole-archive
oboe
# Links the target library to the log library
# included in the NDK.
log)
target_link_options(drumthumper PRIVATE "-Wl,-z,max-page-size=16384")

View file

@ -0,0 +1,172 @@
/*
* Copyright 2019 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.
*/
#include <jni.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <android/log.h>
// parselib includes
#include <stream/MemInputStream.h>
#include <wav/WavStreamReader.h>
#include <player/OneShotSampleSource.h>
#include <player/SimpleMultiPlayer.h>
static const char* TAG = "DrumPlayerJNI";
// JNI functions are "C" calling convention
#ifdef __cplusplus
extern "C" {
#endif
using namespace iolib;
using namespace parselib;
static SimpleMultiPlayer sDTPlayer;
/**
* Native (JNI) implementation of DrumPlayer.setupAudioStreamNative()
*/
JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_setupAudioStreamNative(
JNIEnv* env, jobject, jint numChannels) {
__android_log_print(ANDROID_LOG_INFO, TAG, "%s", "init()");
sDTPlayer.setupAudioStream(numChannels);
}
JNIEXPORT void JNICALL
Java_com_plausiblesoftware_drumthumper_DrumPlayer_startAudioStreamNative(
JNIEnv *env, jobject thiz) {
sDTPlayer.startStream();
}
/**
* Native (JNI) implementation of DrumPlayer.teardownAudioStreamNative()
*/
JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_teardownAudioStreamNative(JNIEnv* , jobject) {
__android_log_print(ANDROID_LOG_INFO, TAG, "%s", "deinit()");
// we know in this case that the sample buffers are all 1-channel, 44.1K
sDTPlayer.teardownAudioStream();
}
/**
* Native (JNI) implementation of DrumPlayer.allocSampleDataNative()
*/
/**
* Native (JNI) implementation of DrumPlayer.loadWavAssetNative()
*/
JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_loadWavAssetNative(
JNIEnv* env, jobject, jbyteArray bytearray, jint index, jfloat pan) {
int len = env->GetArrayLength (bytearray);
unsigned char* buf = new unsigned char[len];
env->GetByteArrayRegion (bytearray, 0, len, reinterpret_cast<jbyte*>(buf));
MemInputStream stream(buf, len);
WavStreamReader reader(&stream);
reader.parse();
reader.getNumChannels();
SampleBuffer* sampleBuffer = new SampleBuffer();
sampleBuffer->loadSampleData(&reader);
OneShotSampleSource* source = new OneShotSampleSource(sampleBuffer, pan);
sDTPlayer.addSampleSource(source, sampleBuffer);
delete[] buf;
}
/**
* Native (JNI) implementation of DrumPlayer.unloadWavAssetsNative()
*/
JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_unloadWavAssetsNative(JNIEnv* env, jobject) {
sDTPlayer.unloadSampleData();
}
/**
* Native (JNI) implementation of DrumPlayer.trigger()
*/
JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_trigger(JNIEnv* env, jobject, jint index) {
sDTPlayer.triggerDown(index);
}
/**
* Native (JNI) implementation of DrumPlayer.trigger()
*/
JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_stopTrigger(JNIEnv* env, jobject, jint index) {
sDTPlayer.triggerUp(index);
}
/**
* Native (JNI) implementation of DrumPlayer.getOutputReset()
*/
JNIEXPORT jboolean JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_getOutputReset(JNIEnv*, jobject) {
return sDTPlayer.getOutputReset();
}
/**
* Native (JNI) implementation of DrumPlayer.clearOutputReset()
*/
JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_clearOutputReset(JNIEnv*, jobject) {
sDTPlayer.clearOutputReset();
}
/**
* Native (JNI) implementation of DrumPlayer.restartStream()
*/
JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_restartStream(JNIEnv*, jobject) {
sDTPlayer.resetAll();
if (sDTPlayer.openStream() && sDTPlayer.startStream()){
__android_log_print(ANDROID_LOG_INFO, TAG, "openStream successful");
} else {
__android_log_print(ANDROID_LOG_ERROR, TAG, "openStream failed");
}
}
JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_setPan(
JNIEnv *env, jobject thiz, jint index, jfloat pan) {
sDTPlayer.setPan(index, pan);
}
JNIEXPORT jfloat JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_getPan(
JNIEnv *env, jobject thiz, jint index) {
return sDTPlayer.getPan(index);
}
JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_setGain(
JNIEnv *env, jobject thiz, jint index, jfloat gain) {
sDTPlayer.setGain(index, gain);
}
JNIEXPORT jfloat JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_getGain(
JNIEnv *env, jobject thiz, jint index) {
return sDTPlayer.getGain(index);
}
JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_setLoopMode(
JNIEnv *env, jobject thiz, jint index, jboolean isLoopMode) {
sDTPlayer.setLoopMode(index, isLoopMode);
}
#ifdef __cplusplus
}
#endif