# HG changeset patch # User Giulio Moro # Date 1465347325 -3600 # Node ID 6e454ebd9cc4604374a429162e1f8f5412d6353e # Parent db1e024858b040403434162b095a05139e6ddbe5 Removed libpd_queued diff -r db1e024858b0 -r 6e454ebd9cc4 examples/basic_libpd/render.cpp --- a/examples/basic_libpd/render.cpp Tue Jun 07 22:28:23 2016 +0100 +++ b/examples/basic_libpd/render.cpp Wed Jun 08 01:55:25 2016 +0100 @@ -13,7 +13,6 @@ #include #include #include "z_libpd.h" -#include "z_queued.h" #include "s_stuff.h" #include #include @@ -47,8 +46,6 @@ #define PARSE_MIDI AuxiliaryTask libpdReadFilesTask; -AuxiliaryTask libpdProcessMessageQueueTask; -AuxiliaryTask libpdProcessMidiQueueTask; Midi midi; //UdpServer udpServer; @@ -96,11 +93,12 @@ fprintf(stderr, "Error: minimum block size must be %d\n", gLibpdBlockSize); return false; } - // init pd - libpd_set_queued_printhook(Bela_printHook); // set this before calling libpd_init - libpd_set_queued_noteonhook(pdnoteon); + // set hooks before calling libpd_init + libpd_set_printhook(Bela_printHook); + libpd_set_floathook(Bela_floatHook); + libpd_set_noteonhook(pdnoteon); //TODO: add hooks for other midi events and generate MIDI output appropriately - libpd_queued_init(); + libpd_init(); //TODO: ideally, we would analyse the ASCII of the patch file and find the in/outs to use libpd_init_audio(gChannelsInUse, gChannelsInUse, context->audioSampleRate); @@ -119,9 +117,7 @@ libpdReadFilesTask = Bela_createAuxiliaryTask(libpdReadFilesLoop, 60, "libpdReadFiles"); Bela_scheduleAuxiliaryTask(libpdReadFilesTask); - // Higher priority for the midi queue and lower priority for the message queue. Adjust to taste - libpdProcessMidiQueueTask = Bela_createAuxiliaryTask(libpd_queued_receive_midi_messages, 80, "libpdProcessMidiQueue"); - libpdProcessMessageQueueTask = Bela_createAuxiliaryTask(libpd_queued_receive_pd_messages, 70, "libpdProcessMessageQueue"); + return true; } @@ -210,12 +206,6 @@ } #endif /* PARSE_MIDI */ -/* - * NOTE: if you are only using audio (or only analogs) and you are using interleaved buffers - * and the blocksize of Bela is the same as gLibPdBlockSize, then you probably - * do not need the for loops before and after libpd_process_float, so you can save quite some - * memory operations. - */ static unsigned int numberOfPdBlocksToProcess = gBufLength / gLibpdBlockSize; for(unsigned int tick = 0; tick < numberOfPdBlocksToProcess; ++tick){ unsigned int audioFrameBase = gLibpdBlockSize * tick; @@ -319,8 +309,6 @@ } } } - Bela_scheduleAuxiliaryTask(libpdProcessMidiQueueTask); - Bela_scheduleAuxiliaryTask(libpdProcessMessageQueueTask); } // cleanup() is called once at the end, after the audio has stopped. @@ -328,6 +316,5 @@ void cleanup(BelaContext *context, void *userData) { - libpd_queued_release(); delete[] dtm; }