Mercurial > hg > beaglert
changeset 349:6e454ebd9cc4 prerelease
Removed libpd_queued
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Wed, 08 Jun 2016 01:55:25 +0100 |
parents | db1e024858b0 |
children | ebaeffa5d493 |
files | examples/basic_libpd/render.cpp |
diffstat | 1 files changed, 6 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- 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 <PRU.h> #include <stdio.h> #include "z_libpd.h" -#include "z_queued.h" #include "s_stuff.h" #include <UdpServer.h> #include <Midi.h> @@ -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; }