utokusa / OS-251

OS-251 is a synthesizer plugin

Home Page:https://onsenaudio.com/products/os251

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Os251AudioProcessorEditor::getBundle(): path to source directory is referenced at run time

atsushieno opened this issue · comments

I'm trying to build OS-251 for Android (as an example port of my framework project) and it's getting closer to working state. But I'm stuck at Os251AudioProcessorEditor::getBundle() which tries to load resources from my local development host (which does not exist on the target device):

89eccbf#diff-578bbcf45713dbccea501c1c5258f5ee4969efffd9a8ad487ec734271664498aR95

I'm sure this won't work when it is distributed as binaries either. Maybe that resource should be generated and bundled at build time? I'm not sure how typical react-juce projects deal with it though...

Thanks for trying out OS-251!

Did you try release build?
If you build the debug version, it tries to use main.js in the local development host.
But when it's release version, it uses main.js embedded in the plugins' binary.

In details, it does following:

  1. When it's built, main.js is embedded in the plugin's binary using JUCE's BinaryData.
  2. When the plugin editor is constructed, OS-251 will export main.js to File::tempDirectory using createTempFile
  3. The file created in 2 is assigned to the variable bundle
  4. OS-251 gets main.js based on the bundle's value

2 and 3 are done in 89eccbf#diff-578bbcf45713dbccea501c1c5258f5ee4969efffd9a8ad487ec734271664498aR85-R92

I don't know much about JUCE with Android, but for other OSs which OS-251 supports, it works fine because File::tempDirectory is determined at runtime.

Ah, I missed that #if JUCE_DEBUG section. Alright, for debugging it should work fine on non-cross-compiling environment.

I have added the following changes (among other messy changes for Android) in CMakeLists.txt and changed the condition to #if JUCE_DEBUG && !OS251_CROSSCOMPILING and fixed the problem.

+if (CMAKE_CROSSCOMPILING)
+add_compile_definitions(OS251_CROSSCOMPILING=1)
+endif (CMAKE_CROSSCOMPILING)

I'm not sure if that is an ideal solution with CMake but works. (Not really as a plugin yet, needs more investigation.)

image

Glad to hear that you can run OS-251 now!

I am looking for a better way too :)