libpd / puredatap5

Tentative Processing support for libpd; use at your own risk.
GNU General Public License v2.0
60 stars 11 forks source link

Any chance to get this into the Processing "Contribution Manager" #16

Open mxa opened 7 years ago

mxa commented 7 years ago

This library would be nice to be made available as an easy install through the Processing Contribution Manager. Is that possible?

b2renger commented 6 years ago

Well I defintely agree with this. Considering that no audio library for processing is working both for desktop and android it would a great addition to the collection of available libs for processing.

As it goes the latest versions of the build works on linux and mac, but not on windows and I think the compatibility with android is also broken. So to get this in the processing contribution manager we would need to fix it for windows and android.

I hope to be able to work on this soon, but if anyone is also up for it let's discuss !

b2renger commented 6 years ago

Hello All,

I would really love to get this working and try to maintain it. I'm pretty much at ease with processing and pd, but I'm probably lacking some basic knowledge on how to create a cross-plateforme lib for desktop and android with processing, and with jni.

@nettoyeurny could you provide me some information on why this was never released ? I dug around and tested it and found out that the android mode was broken as well as the windows version.

Concerning the windows version I'm pretty sure that recompilling the dll would be enough.

Concerning android the project builds but crashes on launch with this error :

FATAL EXCEPTION: main Process: processing.test.hellopd, PID: 7283 java.lang.RuntimeException: Unable to start activity ComponentInfo{processing.test.hellopd/processing.test.hellopd.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:359) at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:328) at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:298) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:150) at processing.test.hellopd.MainActivity.onCreate(MainActivity.java:21) at android.app.Activity.performCreate(Activity.java:6999) at android.app.Activity.performCreate(Activity.java:6990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) ... 9

Would you have any pointers and places to look at or stuff to read to help me get started ?

joebowbeer commented 6 years ago

The stack trace refers to a theming problem, which seems unrelated to the lib:

https://stackoverflow.com/q/21814825/901597

b2renger commented 6 years ago

hum right, I'll try to investigate. It's probably linked to the way processing packages the project for android. But it's weird that I don't get this error when trying to compile other examples from other libs.

b2renger commented 6 years ago

@joebowbeer I rebuild the lib with the "make javalib" command and replaced the libpd.jar by the one build with this command.

the example still works on mac but now I get this error when building for android :


FATAL EXCEPTION: Animation Thread
Process: processing.test.hellopd, PID: 15915
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/processing.test.hellopd-oM0l6etJ7Maj_q_Ix5WWzg==/base.apk"],nativeLibraryDirectories=[/data/app/processing.test.hellopd-oM0l6etJ7Maj_q_Ix5WWzg==/lib/arm64, /system/lib64]]] couldn't find "libpd.so"
    at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
    at java.lang.System.loadLibrary(System.java:1657)
    at org.puredata.core.PdBaseLoader$1.load(PdBaseloader.java:34)
    at org.puredata.core.PdBase.<clinit>(PdBase.java:51)
    at org.puredata.core.PdBase.implementsAudio(Native Method)
    at org.puredata.processing.PureData.<init>(Unknown Source:17)
    at processing.test.hellopd.HelloPd.setup(HelloPd.java:36)
    at processing.core.PApplet.handleDraw(Unknown Source:75)
    at processing.core.PSurfaceNone.callDraw(Unknown Source:19)
    at processing.core.PSurfaceNone$AnimationThread.run(Unknown Source:55)
java.lang.NoClassDefFoundError: org.puredata.core.PdBase
    at org.puredata.core.PdBase.pauseAudio(Native Method)
    at org.puredata.processing.PureData.stop(Unknown Source:0)
    at org.puredata.processing.PureData.dispose(Unknown Source:0)
    at java.lang.reflect.Method.invoke(Native Method)
    at processing.core.PApplet$RegisteredMethods.handle(Unknown Source:14)
    at processing.core.PApplet$RegisteredMethods.handle(Unknown Source:2)
    at processing.core.PApplet.handleMethods(Unknown Source:10)
    at processing.core.PApplet.dispose(Unknown Source:29)
    at processing.core.PApplet.onDestroy(Unknown Source:6)
    at processing.android.PFragment.onDestroy(Unknown Source:9)
    at android.support.v4.app.Fragment.performDestroy(Fragment.java:2586)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1557)
    at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)
    at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3217)
    at android.support.v4.app.FragmentManagerImpl.dispatchDestroy(FragmentManager.java:3208)
    at android.support.v4.app.FragmentController.dispatchDestroy(FragmentController.java:262)
    at android.support.v4.app.FragmentActivity.onDestroy(FragmentActivity.java:343)
    at android.support.v7.app.AppCompatActivity.onDestroy(AppCompatActivity.java:209)
    at android.app.Activity.performDestroy(Activity.java:7208)
    at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1249)
    at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4370)
    at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4401)
    at android.app.ActivityThread.-wrap5(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1649)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/processing.test.hellopd-oM0l6etJ7Maj_q_Ix5WWzg==/base.apk"],nativeLibraryDirectories=[/data/app/processing.test.hellopd-oM0l6etJ7Maj_q_Ix5WWzg==/lib/arm64, /system/lib64]]] couldn't find "libpd.so"
    at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
    at java.lang.System.loadLibrary(System.java:1657)
    at org.puredata.core.PdBaseLoader$1.load(PdBaseloader.java:34)
    at org.puredata.core.PdBase.<clinit>(PdBase.java:51)
    at org.puredata.core.PdBase.implementsAudio(Native Method)
    at org.puredata.processing.PureData.<init>(Unknown Source:17)
    at processing.test.hellopd.HelloPd.setup(HelloPd.java:36)
    at processing.core.PApplet.handleDraw(Unknown Source:75)
    at processing.core.PSurfaceNone.callDraw(Unknown Source:19)
    at processing.core.PSurfaceNone$AnimationThread.run(Unknown Source:55)

it looks like it doesn't find a native extension for android, any idea where I should look to fix this ?

joebowbeer commented 6 years ago

@b2renger Some work is needed before pd-for-android works smoothly with processing. See below. Also, your apk will need to be built with gradle and should depend on pd-for-android as a library dependency. See examples in pd-for-android.

Pasting a TODO list that @nettoyeurny sent a while ago:

b2renger commented 6 years ago

@joebowbeer thanks for the feedback, I'll look into it and chime back in here.

coderofsalvation commented 4 years ago

To build for android, I was able to get rid of the first Theme.AppCompat-error by updating the AndroidManfest.xml in the example-directory:

<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="">
    <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="28"/>
    <application android:debuggable="true" android:icon="@mipmap/ic_launcher" android:label="" android:theme="@style/Theme.AppCompat">
        <activity android:name=".MainActivity">android:theme="@android:style/Theme.AppCompat.Light.NoActionBar"&gt;<intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

However, I too got stuck at the missing libpd.so error. The pd-for-android direction pulls me into the rabbithole I was trying to avoid by this repo :) Anyways, just wanted to let you know there's interest for this repo 👍