libpd / pd-for-android

Pure Data for Android
351 stars 91 forks source link

failing to run some externals #67

Open porres opened 7 years ago

porres commented 7 years ago

howdy, I've been testing libpd for android and some externals. I've managed to use pd's extra objects as well as a few objects from cyclone and also from another library of my own.

But the thing is that some externals will fail, and they're pretty simple so I can't see any reason why they fail, here's one I couldn't run, for instance: https://github.com/porres/pd-else/blob/master/classes/gbman~.c

What should I know or be careful about building external objects for android?

how can I get more information about my problem?

the object does compile and create and everything, I just do not hear any sound!

cheers

tkirshboim commented 7 years ago

Hey @porres , can you maybe provide an example project using this external? It would make it easier to try and debug the problem.

porres commented 7 years ago

hi, gbman~ is a chaotic signal generator

so you can have something as simple as

[gbman~] [*~ 0.1]

[dac~]

joebowbeer commented 7 years ago

@porres Please provide a link to an Android project. Preferably one that depends on JCenter's pd-for-android library artifact.

mgsx-dev commented 7 years ago

Seams to be related to libpd/libpd#130. You may need the LOCALE option in your compilation ... something messing with float parsing .... see https://github.com/libpd/libpd#known-issues

Note : You can quickly confirm this is related by replacing ~ 0.3 by ~ 1 or replacing gbman~ by a noise~ in your patch.

esantossilva commented 7 years ago

Hi @joebowbeer, I'm working alongside @porres in the Android Project and we're using the PdTest from pd-for-android as a base app. We simply cloned the repository and modified the pd patch usign other externals, like the [gbman~].

We put the gbman~.c file in the jni folder and modified the Android.mk like so:

LOCAL_PATH := $(call my-dir)

#---------------------------------------------------------------

include $(CLEAR_VARS)
LOCAL_MODULE := pd
LOCAL_EXPORT_C_INCLUDES := ../../PdCore/jni/libpd/pure-data/src
LOCAL_SRC_FILES := ../../PdCore/libs/$(TARGET_ARCH_ABI)/libpd.so
ifneq ($(MAKECMDGOALS),clean)
    include $(PREBUILT_SHARED_LIBRARY)
endif

#---------------------------------------------------------------

include $(CLEAR_VARS)
LOCAL_MODULE := gbman_tilde
LOCAL_CFLAGS := -DPD
LOCAL_SRC_FILES := gbman~.c
LOCAL_SHARED_LIBRARIES = pd
include $(BUILD_SHARED_LIBRARY)
#---------------------------------------------------------------

As @porres mentioned, this worked fine for some externals (like cyclone's pink~), but didn't work for others...

thanks for the help.

joebowbeer commented 7 years ago

Assuming this is due to not setting numeric LOCALE, Android needs to sync with recent commit?

https://github.com/libpd/libpd/commit/2b358fb840287ea8b41ba35a1f8017ff345dba92

mgsx-dev commented 7 years ago

@joebowbeer no needs to sync for now :

@porres @esantossilva could you add locale option in your make file ? : LOCAL_CFLAGS := -DPD -DLIBPD_SETLOCALE that would confirms this is related.

esantossilva commented 7 years ago

@mgsx-dev still the same. I tried modifying the Android.mk file and then I tried the Makefile for libpd and it remains the same.