danomatika / loaf

loaf: lua, osc, and openFrameworks
http://danomatika.com/code/loaf
GNU General Public License v3.0
53 stars 4 forks source link

Notes for building on RasPi #10

Open okyeron opened 1 year ago

okyeron commented 1 year ago

Spent a bunch of time trying to get loaf to compile/run on my RasPi 4 last night and wanted to write up some notes for you.

In config.make PROJECT_EXCLUSIONS would not work properly and syphonBindings.cpp would try to compile every time. PROJECT_EXCLUSIONS = $(PROJECT_ROOT)/src/bindings/syphonBindings.cpp

From searching the forum it seems that PROJECT_EXCLUSIONS will only work reliably for a directory (?)

So - I created a directory called exclude and moved syphonBindings.cpp to that directory and excluded that. Not an ideal solution, but wasn't sure how else to exclude that file.

config.make additions (which I suppose could go in an if Linux block at some point):

PROJECT_CFLAGS = -I$(OF_ROOT)/addons/ofxOsc/libs/oscpack/src/
PROJECT_CFLAGS += -I$(OF_ROOT)/addons/ofxOsc/libs/oscpack/src/osc
PROJECT_CFLAGS += -I$(OF_ROOT)/addons/ofxOsc/libs/oscpack/src/ip
PROJECT_CFLAGS += -I$(OF_ROOT)/addons/ofxOsc/libs/oscpack/src/ip/posix

PROJECT_EXCLUSIONS = $(PROJECT_ROOT)/src/bindings/exclude
PROJECT_EXCLUSIONS += $(OF_ROOT)/addons/ofxOsc/libs/oscpack/src/ip/win32

Then I commented out the ifeq Darwin block.

Then... In Syphon.cpp I had to change the last line to this to get it to compile

ofxSyphonServer *Syphon::getServer() {
    return server;
}

but after all that, I'm running. :)

danomatika commented 1 year ago

Spent a bunch of time trying to get loaf to compile/run on my RasPi 4 last night and wanted to write up some notes for you.

Thanks

In config.make PROJECT_EXCLUSIONS would not work properly and syphonBindings.cpp would try to compile every time. PROJECT_EXCLUSIONS = $(PROJECT_ROOT)/src/bindings/syphonBindings.cpp

From searching the forum it seems that PROJECT_EXCLUSIONS will only work reliably for a directory (?)

So - I created a directory called exclude and moved syphonBindings.cpp to that directory and excluded that. Not an ideal solution, but wasn't sure how else to exclude that file.

I could move the platform-specific stuff into subduers, in this instance maybe "macos", then it can be properly excluded.

config.make additions (which I suppose could go in an if Linux block at some point):

PROJECT_CFLAGS = -I$(OF_ROOT)/addons/ofxOsc/libs/oscpack/src/
PROJECT_CFLAGS += -I$(OF_ROOT)/addons/ofxOsc/libs/oscpack/src/osc
PROJECT_CFLAGS += -I$(OF_ROOT)/addons/ofxOsc/libs/oscpack/src/ip
PROJECT_CFLAGS += -I$(OF_ROOT)/addons/ofxOsc/libs/oscpack/src/ip/posix

PROJECT_EXCLUSIONS = $(PROJECT_ROOT)/src/bindings/exclude
PROJECT_EXCLUSIONS += $(OF_ROOT)/addons/ofxOsc/libs/oscpack/src/ip/win32

The following should be covered by ofxOsc/addon_config.mk, I would think... I assume you generated the project files with the project generator? I haven't used the makefiles myself. I should add a note that only the Xcode project is current.

Then I commented out the ifeq Darwin block.

Then... In Syphon.cpp I had to change the last line to this to get it to compile

ofxSyphonServer *Syphon::getServer() {
  return server;
}

Ok, I can fix this.

danomatika commented 1 year ago

Whoops, I am wrong about using the project generator. I got this project confused with another one and I just need to update config.make

danomatika commented 1 year ago

Ok, latest commits should solve syphon issues. I'm not sure about ofxOsc. This should be handled by the makefiles automatically when they read addons.config, then ofxOsc/addon_config.mk.

okyeron commented 1 year ago

Ok, latest commits should solve syphon issues. I'm not sure about ofxOsc.

Thanks!

This should be handled by the makefiles automatically when they read addons.config, then ofxOsc/addon_config.mk.

Yeah I was totally lost for good long while because it couldn't find OscTypes.h. Especially since the ofxOsc examples built OK.

I tried the command line project generator, but then ended up just comparing against other config.make files.

okyeron commented 1 year ago

More hacking and playing around with adding soundStream audio input (I put it in at the loaf application level as i figured it might be a bit slow going thru the lua interpreter - yes/no?)

Quickie example vid on instagram here

(i originally did this script on the openframeworks implementation on the Eyesy hardware)

danomatika commented 1 year ago

Ok, latest commits should solve syphon issues. I'm not sure about ofxOsc.

Thanks!

This should be handled by the makefiles automatically when they read addons.config, then ofxOsc/addon_config.mk.

Yeah I was totally lost for good long while because it couldn't find OscTypes.h. Especially since the ofxOsc examples built OK.

I tried the command line project generator, but then ended up just comparing against other config.make files.

Hmmm, I assumed everything would be found automagically since the Makefile build works on macOS, however it basically just calls xcodebuild to build the Xcode project which itself has all the paths set. For other platforms, we probably do need them in config.make. I can add this later today.

danomatika commented 1 year ago

More hacking and playing around with adding soundStream audio input (I put it in at the loaf application level as i figured it might be a bit slow going thru the lua interpreter - yes/no?)

Quickie example vid on instagram here

(i originally did this script on the openframeworks implementation on the Eyesy hardware)

Are you using the included lua or an optimized one like luajit? I didn't consider wrapping stuff running in the audio thread as I thought it would be too slow. However it seems to work now, so maybe it's worth making a PR, I assume to ofxLua and/or swig-openframeworks?

okyeron commented 1 year ago

I'm using the included lua (Lua 5.1.5 on this box)

I added the ofSoundStream stuff to the loaf ofApp.cpp - its currently hardcoded to my use case (using JACK). Pretty much like the oF audioInput Example and then i'm adding this in update()

    script.lua.setNumberVector("inL", audioLeft);
    script.lua.setNumberVector("inR", audioRight);
    script.lua.setNumber("peak", audioPeak);
    script.lua.setNumber("scaledVol", scaledVol);
    script.lua.setNumber("smoothedVol", smoothedVol);
    script.lua.setNumberVector("volHistory", volHistory);

Whats the best way to chat about features or whatnot? It looks like there's a way to load scripts via OSC? I'd be keen to make a touchOSC interface that could maybe list/load scripts or something.

Also - Quick Note - in your config.make change, PROJECT_ROOT should be uncommented, yes?