feat: audio resources

This commit is contained in:
2026-03-03 12:04:17 +01:00
parent d2c9a7b2ff
commit bc8002fd59
7 changed files with 109 additions and 9 deletions

View File

@@ -30,15 +30,13 @@ extern "C" {
JNIEXPORT jlong JNICALL
Java_at_lockstep_pb_PlaybackEngine_native_1createEngine(
JNIEnv *env,
jclass /*unused*/) {
/*
jclass /*unused*/, jstring filesDir) {
const char* filesDirTemp = env->GetStringUTFChars(filesDir, NULL);
std::string filesDirString(filesDirTemp);
env->ReleaseStringUTFChars(filesDir, filesDirTemp);
*/
// We use std::nothrow so `new` returns a nullptr if the engine creation fails
auto *engine = new(std::nothrow) PlaybackEngine();
auto *engine = new(std::nothrow) PlaybackEngine(filesDirString);
return reinterpret_cast<jlong>(engine);
}
@@ -51,4 +49,13 @@ jlong engineHandle) {
delete reinterpret_cast<PlaybackEngine *>(engineHandle);
}
JNIEXPORT void JNICALL
Java_at_lockstep_pb_PlaybackEngine_native_1setDefaultStreamValues(JNIEnv *env,
jclass type,
jint sampleRate,
jint framesPerBurst) {
oboe::DefaultStreamValues::SampleRate = (int32_t) sampleRate;
oboe::DefaultStreamValues::FramesPerBurst = (int32_t) framesPerBurst;
}
} // extern "C"