Suggestion - Getting rid of ruby dependency for Audio Unit

SDK for VST 3 audio plug-in and host development.
pongasoft
Posts: 43
Joined: Sun Mar 11, 2018 5:57 pm

Suggestion - Getting rid of ruby dependency for Audio Unit

Postby pongasoft » Sat Sep 29, 2018 5:11 pm

The auwrapper CMakeLists.txt file uses ruby to generate a file which contains a define based on the current time.

My question is: why is this necessary exactly? Why generate a different namespace (SMTG_AU_NAMESPACE) every time cmake is run? (which also means that no 2 builds will be identical even if NOTHING changes).

If it is absolutely necessary, here is how you can do it WITHOUT depending on ruby (using cmake):

Code: Select all

string(TIMESTAMP MY_TIMESTAMP "%s")
file(WRITE "${CMAKE_CURRENT_LIST_DIR}/aucocoaclassprefix.h" "#define SMTG_AU_NAMESPACE SMTGAUCocoa${MY_TIMESTAMP}_\n")


Yan

Arne Scheffler
Posts: 201
Joined: Mon Jun 20, 2016 7:53 am

Re: Suggestion - Getting rid of ruby dependency for Audio Unit

Postby Arne Scheffler » Mon Oct 15, 2018 9:52 am

Hi Yan,
the SMTG_AU_NAMESPACE macro needs to be different for every build because Objective-C has no two-level namespace mechanism as c++. When a dynamic library is loaded with the same Objective-C class names then the last dynamic lib is using the class from the first dynamic lib.

We use ruby here, because we use this script also independently from cmake.

I hope this makes this clear,
Arne

pongasoft
Posts: 43
Joined: Sun Mar 11, 2018 5:57 pm

Re: Suggestion - Getting rid of ruby dependency for Audio Unit

Postby pongasoft » Mon Oct 15, 2018 1:38 pm

I guess I understand why it would have to be different from plugin to plugin but I don't understand why it would have to be from build to build:

* I start Logic load my plugin... need to make some changes
* I close Logic, rebuild my plugin, deploy my plugin in the same location with the same name
* I reopen Logic, reload my plugin... why would Logic load an old one?

If you are trying to prevent the use case close/open, then I am not sure it is worth it... even with only C++ that never seems to work: if I build and deploy a VST plugin, I must close/reopen Maschine or Reason, in order for it to be reloaded since they only scan plugins when they open.

I think it is overkill to do it at every build and makes builds non reproducible since even if you don't change a single line of code, you will have a different binary. I ended up changing for my own use to be the md5 of the main target of the project.. That way it is different for every plugin but not build to build.

I understand that you use this script outside cmake so you can't rely on cmake. But I think it is unfortunate to have to depend on ruby for doing such a simple task which can be accomplished with a simple shell script...

Code: Select all

#!/usr/bin/env bash

if [ -z "$1" ]; then
  echo "Cannot resolve output directory"
  exit 1
fi

NOW=`date "+%s"`
echo "#define SMTG_AU_NAMESPACE SMTGAUCocoa${NOW}_\n" > $1/aucocoaclassprefix.h


Yan

Arne Scheffler
Posts: 201
Joined: Mon Jun 20, 2016 7:53 am

Re: Suggestion - Getting rid of ruby dependency for Audio Unit

Postby Arne Scheffler » Mon Oct 15, 2018 4:11 pm

Hi Yan,
we have requirements here to have more than one version of a plugin to work in a host at the same time. So we absolutely make sure that at every build the Objective-C class names are different, to prevent issues in this area, which did cost us a few days in the past.

Cheers,
Arne


Return to “VST 3 SDK”

Who is online

Users browsing this forum: No registered users and 1 guest