Skip to content

[PCM Offload, DRAFT] PowerPlay Sample App Implementation #2197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/LiveEffect/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ target_link_options(liveEffect PRIVATE "-Wl,-z,max-page-size=16384")

# Enable optimization flags: if having problems with source level debugging,
# disable -Ofast ( and debug ), re-enable it after done debugging.
target_compile_options(liveEffect PRIVATE -Wall -Werror "$<$<CONFIG:RELEASE>:-Ofast>")
target_compile_options(liveEffect PRIVATE -Wall -Werror "$<$<CONFIG:RELEASE>:-O3 -ffast-math>")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be a great change. But it seems unrelated to the new PowerPlay app. If you see room for improvement, it would be easier to submit those as separate PRs.


2 changes: 1 addition & 1 deletion samples/MegaDrone/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ target_link_options(megadrone PRIVATE "-Wl,-z,max-page-size=16384")

# Enable optimization flags: if having problems with source level debugging,
# disable -Ofast ( and debug ), re-enable it after done debugging.
target_compile_options(megadrone PRIVATE -Wall -Werror -Ofast)
target_compile_options(megadrone PRIVATE -Wall -Werror -O3 -ffast-math)
2 changes: 1 addition & 1 deletion samples/SoundBoard/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ target_link_options(soundboard PRIVATE "-Wl,-z,max-page-size=16384")

# Enable optimization flags: if having problems with source level debugging,
# disable -Ofast ( and debug ), re-enable it after done debugging.
target_compile_options(soundboard PRIVATE -Wall -Werror -Ofast)
target_compile_options(soundboard PRIVATE -Wall -Werror -O3 -ffast-math)
2 changes: 1 addition & 1 deletion samples/drumthumper/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ add_library(drumthumper SHARED

# 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_compile_options(drumthumper PRIVATE -Wall -Werror "$<$<CONFIG:RELEASE>:-O3 -ffast-math>")

target_link_libraries( # Specifies the target library.
drumthumper
Expand Down
6 changes: 3 additions & 3 deletions samples/drumthumper/src/main/cpp/DrumPlayerJNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static SimpleMultiPlayer sDTPlayer;
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);
sDTPlayer.setupAudioStream(numChannels, oboe::PerformanceMode::LowLatency);
}

JNIEXPORT void JNICALL
Expand Down Expand Up @@ -106,7 +106,7 @@ JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_unloadW
* Native (JNI) implementation of DrumPlayer.trigger()
*/
JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_trigger(JNIEnv* env, jobject, jint index) {
sDTPlayer.triggerDown(index);
sDTPlayer.triggerDown(index, oboe::PerformanceMode::LowLatency);
}

/**
Expand Down Expand Up @@ -135,7 +135,7 @@ JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_clearOu
*/
JNIEXPORT void JNICALL Java_com_plausiblesoftware_drumthumper_DrumPlayer_restartStream(JNIEnv*, jobject) {
sDTPlayer.resetAll();
if (sDTPlayer.openStream() && sDTPlayer.startStream()){
if (sDTPlayer.openStream(oboe::PerformanceMode::LowLatency) && sDTPlayer.startStream()){
__android_log_print(ANDROID_LOG_INFO, TAG, "openStream successful");
} else {
__android_log_print(ANDROID_LOG_ERROR, TAG, "openStream failed");
Expand Down
1 change: 1 addition & 0 deletions samples/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
org.gradle.configuration-cache=true
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
2 changes: 1 addition & 1 deletion samples/hello-oboe/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ target_link_options(hello-oboe PRIVATE "-Wl,-z,max-page-size=16384")

# Enable optimization flags: if having problems with source level debugging,
# disable -Ofast ( and debug ), re-enable after done debugging.
target_compile_options(hello-oboe PRIVATE -Wall -Werror "$<$<CONFIG:RELEASE>:-Ofast>")
target_compile_options(hello-oboe PRIVATE -Wall -Werror "$<$<CONFIG:RELEASE>:-O3 -ffast-math>")
7 changes: 6 additions & 1 deletion samples/iolib/src/main/cpp/player/SampleSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ class SampleSource: public DataSource {
virtual ~SampleSource() {}

void setPlayMode() { mCurSampleIndex = 0; mIsPlaying = true; }
void setStopMode() { mIsPlaying = false; mCurSampleIndex = 0; }
void setStopMode(bool isPause = false) {
mIsPlaying = false;
if (!isPause) {
mCurSampleIndex = 0;
}
}

void setLoopMode(bool isLoopMode) { mIsLoopMode = isLoopMode; }

Expand Down
Loading
Loading