Mercurial > hg > beaglert
changeset 471:cbe68fc0e933 prerelease
merge
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 20 Jun 2016 18:06:29 +0100 |
parents | 5a936f8e9447 (diff) 898d57ac58a5 (current diff) |
children | c8dd56aed76d |
files | |
diffstat | 2 files changed, 17 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Mon Jun 20 17:32:05 2016 +0100 +++ b/Makefile Mon Jun 20 18:06:29 2016 +0100 @@ -210,9 +210,9 @@ $(OUTPUT_FILE): $(CORE_ASM_OBJS) $(CORE_OBJS) $(PROJECT_OBJS) $(STATIC_LIBS) $(DEFAULT_MAIN_OBJS) $(DEFAULT_PD_OBJS) $(eval DEFAULT_MAIN_CONDITIONAL :=\ $(shell bash -c '[ `nm $(PROJECT_OBJS) 2>/dev/null | grep -w T | grep -w main | wc -l` == '0' ] && echo "$(DEFAULT_MAIN_OBJS)" || : ')) - @#If there is a _main.pd file AND there is no "render" symbol then link in the $(DEFAULT_PD_OBJS) + @#If there is a .pd file AND there is no "render" symbol then link in the $(DEFAULT_PD_OBJS) $(eval DEFAULT_PD_CONDITIONAL :=\ - $(shell bash -c '{ [ -f "$(PROJECT_DIR)/_main.pd" ] && [ `nm $(PROJECT_OBJS) 2>/dev/null | grep -w T | grep "render.*BelaContext" | wc -l` -eq 0 ]; } && echo '$(DEFAULT_PD_OBJS)' || : ' )) + $(shell bash -c '{ ls $(PROJECT_DIR)/*.pd &>/dev/null && [ `nm $(PROJECT_OBJS) 2>/dev/null | grep -w T | grep "render.*BelaContext" | wc -l` -eq 0 ]; } && echo '$(DEFAULT_PD_OBJS)' || : ' )) @echo 'Linking...' $(CXX) $(SYNTAX_FLAG) -L/usr/xenomai/lib -L/usr/arm-linux-gnueabihf/lib -L/usr/arm-linux-gnueabihf/lib/xenomai -L/usr/lib/arm-linux-gnueabihf -pthread -Wpointer-arith -o "$(PROJECT_DIR)/$(PROJECT)" $(CORE_ASM_OBJS) $(CORE_OBJS) $(DEFAULT_MAIN_CONDITIONAL) $(DEFAULT_PD_CONDITIONAL) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(LIBS) @echo ' ...done'
--- a/core/default_libpd_render.cpp Mon Jun 20 17:32:05 2016 +0100 +++ b/core/default_libpd_render.cpp Mon Jun 20 18:06:29 2016 +0100 @@ -127,6 +127,16 @@ bool setup(BelaContext *context, void *userData) { + // Check first of all if file exists. Will actually open it later. + char file[] = "_main.pd"; + char folder[] = "./"; + unsigned int strSize = strlen(file) + strlen(folder) + 1; + char* str = (char*)malloc(sizeof(char) * strSize); + snprintf(str, strSize, "%s%s", folder, file); + if(access(str, F_OK) == -1 ) { + printf("Error file %s/%s not found. The %s file should be your main patch.\n", folder, file, file); + return false; + } dcm.setCallback(sendDigitalMessage); analogChannelsInUse = min(context->analogChannels, gChannelsInUse - context->audioChannels - context->digitalChannels); if(context->digitalChannels > 0){ @@ -189,10 +199,12 @@ libpd_bind("bela_digitalOut26"); libpd_bind("bela_setDigital"); - char file[] = "_main.pd"; - char folder[] = "./"; // open patch [; pd open file folder( - libpd_openfile(file, folder); + void* patch = libpd_openfile(file, folder); + if(patch == NULL){ + printf("Error: file %s/%s is corrupted.\n", folder, file); + return false; + } libpdReadFilesTask = Bela_createAuxiliaryTask(libpdReadFilesLoop, 60, "libpdReadFiles"); Bela_scheduleAuxiliaryTask(libpdReadFilesTask);