Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@Ant1r
Copy link
Contributor

@Ant1r Ant1r commented Dec 10, 2025

This implements the native interface for the Oboe audio driver library.

It takes care of the buffer size conversion between Pd and Oboe, separately for input and output (since Oboe can provide less input samples than output ones, mainly on start).

It also extends the PdBase jni a bit, to allow selecting input and output audio devices (which Oboe offers), and setting the audio buffer size.

The new pdnativeoboe.so is now loaded by PdBase loader when on Android, replacing the previous pdnativeopensl.so.

Closes #284.

@danomatika
Copy link
Member

Looks good to me.

Copy link
Contributor

@joebowbeer joebowbeer left a comment

Choose a reason for hiding this comment

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

LGTM

@joebowbeer
Copy link
Contributor

joebowbeer commented Dec 12, 2025

I want to merge the pd-for-android piece (libpd/pd-for-android#167) now in order to create a 1.4.0-SNAPSHOT, and it refs this commit.

When to merge this?

@danomatika
Copy link
Member

Just to check: As this touches the Java wrapper, are there any changes to Java on desktop? Does it still build for "normal" Java?

@Ant1r
Copy link
Contributor Author

Ant1r commented Dec 12, 2025

yes, normal java still builds (on my machine).
I have added 3 new methods to PdBase API, but I filled empty corresponding functions in the various jni sources.

Of course, this is a breaking change for external users, if they use their own jni: they will have to add these new functions too, unless the app won't link.

@satoruf1
Copy link

Wow. This looks great! Unfortunately, due to family matters, I can't look into it in detail right now, but as soon as I have time, I'll definitely try it myself. Thank you so much!

@joebowbeer joebowbeer self-requested a review December 13, 2025 16:33
Copy link
Contributor

@joebowbeer joebowbeer left a comment

Choose a reason for hiding this comment

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

LGTM

@satoruf1
Copy link

When do we plan to merge this?

@joebowbeer
Copy link
Contributor

@danomatika I defer to you wrt merging this.

@danomatika
Copy link
Member

It would be good to have someone who uses libpd with Java desktop to check. I haven't done a Java build in a long time.

@Ant1r
Copy link
Contributor Author

Ant1r commented Dec 28, 2025

javalib, javasrc and javadoc all build without error here (btw, I imagine they could easily be added to CI?).

I would like to test the Java samples on desktop, unfortunately there's nothing about it in the docs, and I haven't been able to figure it out on my own.

Would someone know how to run the Java samples on desktop, via commandline (without using Eclipse)?

@Ant1r
Copy link
Contributor Author

Ant1r commented Dec 28, 2025

I'm now thinking that another solution might be better, that would imply less change in the Java API, maybe no change at all actually.
PdBase.openAudio() already provides a Map<String, String> options argument, which could be used to pass specific options to the native implementation, instead of adding new jni functions for setting the device ids or the buffer size.

I'm investigating this solution, I'm switching this to 'draft' in the mean time.

@Ant1r Ant1r marked this pull request as draft December 28, 2025 22:28
@danomatika
Copy link
Member

danomatika commented Dec 29, 2025

I don't think you need to change your approach, I just wanted to know that someone had checked that the desktop Java still builds ok. Are the new functions applicable to Android only? If so, why not wrap them in defines etc so they are available on Android only. If accepting new key/value controls works when opening audio, perhaps that's nicer. I defer to those using the Java API to decide but I always prefer if whatever is changed tries to stay consistent with the current design, naming, usage etc.

@Ant1r Ant1r mentioned this pull request Dec 30, 2025
@Ant1r
Copy link
Contributor Author

Ant1r commented Dec 30, 2025

stay consistent with the current design

I agree, that's why I think the new version #423 is better. It doesn't change the Java API, reusing an already existing possibility. I just should have thought of it before :-)

@Ant1r
Copy link
Contributor Author

Ant1r commented Jan 7, 2026

closing this in favor of #423

@Ant1r Ant1r closed this Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace OpenSL with Oboe for Android

4 participants