libpd / pd-for-android

Pure Data for Android
351 stars 91 forks source link

Fiddle / pd externals not working on arm64-v8a devices #32

Closed deepkanwal closed 8 years ago

deepkanwal commented 8 years ago

I have a simple patch using fiddle which looks like this:

screen shot 2015-12-19 at 3 26 50 pm

However, when I attempt to use this patch with pd-for-android, I get the following error:

12-19 15:58:15.426 30182-30182/com.deepkanwal.fiddletest I/PdUiDispatcher: print: 
12-19 15:58:15.426 30182-30182/com.deepkanwal.fiddletest I/PdUiDispatcher: print:  
12-19 15:58:15.426 30182-30182/com.deepkanwal.fiddletest I/PdUiDispatcher: print: fiddle~
12-19 15:58:15.426 30182-30182/com.deepkanwal.fiddletest I/PdUiDispatcher: print:  
12-19 15:58:15.426 30182-30182/com.deepkanwal.fiddletest I/PdUiDispatcher: print: 2048
12-19 15:58:15.426 30182-30182/com.deepkanwal.fiddletest I/PdUiDispatcher: print: 
12-19 15:58:15.426 30182-30182/com.deepkanwal.fiddletest I/PdUiDispatcher: print: error: ... couldn't create
12-19 15:58:15.426 30182-30182/com.deepkanwal.fiddletest I/PdUiDispatcher: print: error: signal outlet connect to nonsignal inlet (ignored)
12-19 15:58:15.426 30182-30182/com.deepkanwal.fiddletest I/PdUiDispatcher: print: verbose(4): ... you might be able to track this down from the Find menu.

The patch works fine when running via Pure Data.

I am using PDService, which from what I understand, will handle installing standard externals.

Here's a link to the activity in which I'm doing all my pure data logic right now: https://github.com/deepkanwal/pure-data-fiddle-test/blob/master/app/src/main/java/com/deepkanwal/fiddletest/FiddleTest.java

Here's a link to a simple test project which I'm using to try loading fiddle: https://github.com/deepkanwal/pure-data-fiddle-test

Any ideas as to what the issue might be?

tkirshboim commented 8 years ago

I just cloned the your test project on Android Studio 1.5 and it seems to work fine. Fiddle is created and seems to work. See the logcat print out:

12-20 01:50:04.032 20061-20061/com.deepkanwal.fiddletest I/opensl_stream: Created OPENSL_STREAM(44100, 1, 2, 64)
12-20 01:50:04.032 20061-20061/com.deepkanwal.fiddletest I/opensl_stream: numBuffers: 2
12-20 01:50:04.042 20061-20061/com.deepkanwal.fiddletest I/opensl_stream: Starting player queue.
12-20 01:50:04.042 20061-20061/com.deepkanwal.fiddletest I/opensl_stream: Starting recorder queue.
12-20 01:50:04.212 20061-20061/com.deepkanwal.fiddletest I/PdUiDispatcher: print: fiddle version 1.1 TEST4
12-20 01:50:13.332 20061-20061/com.deepkanwal.fiddletest I/com.deepkanwal.fiddletest.FiddleTest$2: Recieved Pitch: 54.03334
12-20 01:50:15.474 20061-20061/com.deepkanwal.fiddletest I/com.deepkanwal.fiddletest.FiddleTest$2: Recieved Pitch: 49.070118

Maybe try to clone your repository to a new folder and import it as a project in Android Studio? I can't explain it otherwise and also can't reproduce it..

deepkanwal commented 8 years ago

Interesting, it actually works fine if I run in via Genymotion. The issue only occurs on my device (Moto X Pure - XT1575 running 5.1.1). Here's the full logcat from app start up.

12-19 17:12:45.260 31236-31236/? I/art: Late-enabling -Xcheck:jni
12-19 17:12:45.364 31236-31258/com.deepkanwal.fiddletest D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
12-19 17:12:45.367 31236-31236/com.deepkanwal.fiddletest D/Atlas: Validating map...
12-19 17:12:45.421 31236-31236/com.deepkanwal.fiddletest I/AudioParameters: sample rate: 48000, buffer size: 240
12-19 17:12:45.430 31236-31236/com.deepkanwal.fiddletest I/System.out: loading pdnativeopensl for Android
12-19 17:12:45.461 31236-31258/com.deepkanwal.fiddletest I/Adreno: QUALCOMM build                   : 7fcf94b, Ib2e715f795
                                                                   Build Date                       : 07/01/15
                                                                   OpenGL ES Shader Compiler Version: E031.25.03.09
                                                                   Local Branch                     : mybranch11543913
                                                                   Remote Branch                    : quic/LA.BF64.1.2.1_rb2.21
                                                                   Remote Branch                    : NONE
                                                                   Reconstruct Branch               : NOTHING
12-19 17:12:45.469 31236-31258/com.deepkanwal.fiddletest I/OpenGLRenderer: Initialized EGL, version 1.4
12-19 17:12:45.477 31236-31258/com.deepkanwal.fiddletest D/OpenGLRenderer: Enabling debug mode 0
12-19 17:12:45.503 31236-31236/com.deepkanwal.fiddletest W/libOpenSLES: class OutputMix interface 0 requested but unavailable MPH=43
12-19 17:12:45.504 31236-31236/com.deepkanwal.fiddletest I/opensl_stream: Created OPENSL_STREAM(48000, 1, 2, 64)
12-19 17:12:45.505 31236-31236/com.deepkanwal.fiddletest I/opensl_stream: numBuffers: 2
12-19 17:12:45.510 31236-31236/com.deepkanwal.fiddletest I/opensl_stream: Starting player queue.
12-19 17:12:45.513 31236-31236/com.deepkanwal.fiddletest I/opensl_stream: Starting recorder queue.
12-19 17:12:45.549 31236-31236/com.deepkanwal.fiddletest I/PdUiDispatcher: print: 
12-19 17:12:45.549 31236-31236/com.deepkanwal.fiddletest I/PdUiDispatcher: print:  
12-19 17:12:45.549 31236-31236/com.deepkanwal.fiddletest I/PdUiDispatcher: print: fiddle~
12-19 17:12:45.549 31236-31236/com.deepkanwal.fiddletest I/PdUiDispatcher: print:  
12-19 17:12:45.549 31236-31236/com.deepkanwal.fiddletest I/PdUiDispatcher: print: 2048
12-19 17:12:45.549 31236-31236/com.deepkanwal.fiddletest I/PdUiDispatcher: print: 
12-19 17:12:45.549 31236-31236/com.deepkanwal.fiddletest I/PdUiDispatcher: print: error: ... couldn't create
12-19 17:12:45.549 31236-31236/com.deepkanwal.fiddletest I/PdUiDispatcher: print: error: signal outlet connect to nonsignal inlet (ignored)
12-19 17:12:45.549 31236-31236/com.deepkanwal.fiddletest I/PdUiDispatcher: print: verbose(4): ... you might be able to track this down from the Find menu.
tkirshboim commented 8 years ago

Strange.. Did you manage to get any other libpd based app to run and produce sound on that device? Can you get the PdTest app to work on that device?

deepkanwal commented 8 years ago

Yes, PdTest does work on the device. Play back of the sine waves works and patch mic results in a distorted, high pitched sound.

tkirshboim commented 8 years ago

I really can't think of an explanation for this then.. If you can I would suggest trying another real device with the your test app. Another thing you could try is to edit the patch used by PdTest and add a fiddle object to it. If it fails to create it you'll see an error message on the screen. You could also add another object that does not exist just to be sure that you see the error message. Something like:

joebowbeer commented 8 years ago

I strongly suspect a permissions problem, given that Genymotion works and a real device doesn't.

By the looks of it, IoUtils.extractZipResource needs write permission.

joebowbeer commented 8 years ago

PdTest accesses a single .pd file, and so uses:

IoUtils.extractResource(in, "test.pd", getCacheDir());

deepkanwal commented 8 years ago

I am getting the seeing the same error message on screen when adding fiddle to the test.pd patch file in PdTest. Here's the patch file:

screen shot 2015-12-19 at 6 31 15 pm

I'll try testing on another device soon.

tkirshboim commented 8 years ago

@deepkanwal Like Joe suggests - try then to add <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> to you AndroidManifest.xml and see if it fixes the problem.

tkirshboim commented 8 years ago

@mgsx-dev @deepkanwal @b2renger @joebowbeer I suspect this is related to the cpu type of the device. I could reproduce the issue that fiddle as well as the helloworld external are not created with PdTest when using an arm64-v8a device. Perhaps related to #33 ?

tkirshboim commented 8 years ago

referencing #14 because it's related @rayalu

joebowbeer commented 8 years ago

@tkirshboim The cpu type idea makes sense to me. Genymotion is x86.

b2renger commented 8 years ago

@deepkanwal @joebowbeer @tkirshboim

removing the '/arm64-v8a' folder from /libs enabled me to build on the nexus 9 with no issues. So we are indeed facing an issue related to cpu type in the building of externals.

tkirshboim commented 8 years ago

From @b2renger in the gitter chat room:

testing a little further, removing the 'arm64-v8a' folder, cleaning and building again resolved the issue on the nexus 9, so I guess if present it takes 'arm64-v8a' which seem to have a compilation issue, and if not it takes the basic 'arm' folder which works fine

I can confirm that if I remove arm64-v8a from the ABI that NDK builds the problem is solved on the arm64-v8a I use for testing. These should probably be done both for PdCore as well as for the pd external example in PdTest. I can do this later today and create a PR.

tkirshboim commented 8 years ago

@mrjohs - I thought I'd tag you here in case you're interested in following up on this issue as well.

tkirshboim commented 8 years ago

I released 1.0.0-rc4 version where this issue is fixed.