Browse Source

Dynamic UI name, description and version

pull/116/head
falkTX 7 years ago
parent
commit
c80050fe01
3 changed files with 147 additions and 14 deletions
  1. +14
    -1
      Makefile.plugins.mk
  2. +22
    -13
      distrho/src/DistrhoPluginAU.r
  3. +111
    -0
      distrho/src/DistrhoPluginAUexport.cpp

+ 14
- 1
Makefile.plugins.mk View File

@@ -188,6 +188,11 @@ $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.o: $(DPF_PATH)/distrho/DistrhoUIMain.cpp
@echo "Compiling DistrhoUIMain.cpp (DSSI)"
@$(CXX) $< $(BUILD_CXX_FLAGS) $(shell $(PKG_CONFIG) --cflags liblo) -DDISTRHO_PLUGIN_TARGET_DSSI -c -o $@

$(BUILD_DIR)/DistrhoPluginAUexport.cpp.o: $(DPF_PATH)/distrho/src/DistrhoPluginAUexport.cpp
-@mkdir -p $(BUILD_DIR)
@echo "Compiling DistrhoPluginAUexport.cpp"
$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@

# ---------------------------------------------------------------------------------------------------------------------
# JACK

@@ -299,7 +304,7 @@ $(BUILD_DIR)/step2.rsrc: $(BUILD_DIR)/step1.rsrc
@echo "Creating AU rsrc for $(NAME) (part 2/3)"
ResMerger -dstIs DF $< -o $@

$(BUILD_DIR)/step1.rsrc: $(DPF_PATH)/distrho/src/DistrhoPluginAU.r $(OBJS_DSP) $(au_pkginfo) $(au_plist)
$(BUILD_DIR)/step1.rsrc: $(DPF_PATH)/distrho/src/DistrhoPluginAU.r $(BUILD_DIR)/DistrhoPluginInfo.r $(OBJS_DSP)
-@mkdir -p $(shell dirname $@)
@echo "Creating AU rsrc for $(NAME) (part 1/3)"
Rez $< \
@@ -307,6 +312,7 @@ $(BUILD_DIR)/step1.rsrc: $(DPF_PATH)/distrho/src/DistrhoPluginAU.r $(OBJS_DSP) $
-useDF -script Roman \
-d x86_64_YES -d i386_YES -arch x86_64 -arch i386 \
-i . \
-i $(BUILD_DIR) \
-i $(DPF_PATH)/distrho/src/CoreAudio106/AudioUnits/AUPublic \
-i $(DPF_PATH)/distrho/src/CoreAudio106/AudioUnits/AUPublic/AUBase \
-i $(DPF_PATH)/distrho/src/CoreAudio106/AudioUnits/AUPublic/OtherBases \
@@ -315,6 +321,13 @@ $(BUILD_DIR)/step1.rsrc: $(DPF_PATH)/distrho/src/DistrhoPluginAU.r $(OBJS_DSP) $
-I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers \
-o $@

$(BUILD_DIR)/DistrhoPluginInfo.r: $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginAUexport.cpp.o
-@mkdir -p $(shell dirname $@)
@echo "Creating DistrhoPluginInfo.r for $(NAME)"
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $(BUILD_DIR)/DistrhoPluginInfoGenerator && \
$(BUILD_DIR)/DistrhoPluginInfoGenerator "$(BUILD_DIR)" && \
rm $(BUILD_DIR)/DistrhoPluginInfoGenerator

# ---------------------------------------------------------------------------------------------------------------------

-include $(OBJS_DSP:%.o=%.d)


+ 22
- 13
distrho/src/DistrhoPluginAU.r View File

@@ -2,25 +2,34 @@
#include <AudioUnit/AudioUnit.r>

#include "DistrhoPluginInfo.h"
#include "DistrhoPluginInfo.r"

#ifdef DEBUG
#define VERSION 0xFFFFFFFF
#else
#define VERSION 0x00010000
#ifndef DISTRHO_PLUGIN_AU_TYPE
#define DISTRHO_PLUGIN_AU_TYPE kAudioUnitType_Effect
#endif

// Note that resource IDs must be spaced 2 apart for the 'STR ' name and description
#define kAudioUnitResID_dpfplugin 1000
#ifndef DISTRHO_PLUGIN_AU_SUBTYPE
#define DISTRHO_PLUGIN_AU_SUBTYPE '????'
#endif

#ifndef DISTRHO_PLUGIN_AU_MANUF
#define DISTRHO_PLUGIN_AU_MANUF '????'
#endif

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ dpfplugin~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#ifndef DISTRHO_PLUGIN_AU_RES_ID
#define DISTRHO_PLUGIN_AU_RES_ID 1000
#endif

// Note that resource IDs must be spaced 2 apart for the 'STR ' name and description
#define RES_ID DISTRHO_PLUGIN_AU_RES_ID

#define RES_ID kAudioUnitResID_dpfplugin
#define COMP_TYPE kAudioUnitType_Effect
#define COMP_SUBTYPE 'FuCk'
#define COMP_MANUF 'ShIt'
#define COMP_TYPE DISTRHO_PLUGIN_AU_TYPE
#define COMP_SUBTYPE DISTRHO_PLUGIN_AU_SUBTYPE
#define COMP_MANUF DISTRHO_PLUGIN_AU_MANUF

#define NAME DISTRHO_PLUGIN_BRAND ": " DISTRHO_PLUGIN_NAME
#define DESCRIPTION DISTRHO_PLUGIN_NAME " AU"
#define NAME DISTRHO_PLUGIN_FULL_NAME
#define DESCRIPTION DISTRHO_PLUGIN_DESCRIPTION
#define VERSION DISTRHO_PLUGIN_VERSION
#define ENTRY_POINT "PluginAUEntry"

#include "AUResources.r"

+ 111
- 0
distrho/src/DistrhoPluginAUexport.cpp View File

@@ -0,0 +1,111 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#include "DistrhoPluginInternal.hpp"

#include <fstream>
#include <iostream>

// -----------------------------------------------------------------------

void au_generate_r(const char* const basename)
{
USE_NAMESPACE_DISTRHO

// Dummy plugin to get data from
d_lastBufferSize = 512;
d_lastSampleRate = 44100.0;
PluginExporter plugin(nullptr, nullptr);
d_lastBufferSize = 0;
d_lastSampleRate = 0.0;

String filename(basename);
if (! filename.endsWith("/"))
filename += "/";
filename += "DistrhoPluginInfo.r";

// ---------------------------------------------

std::cout << "Writing DistrhoPluginInfo.r..."; std::cout.flush();
std::fstream rFile(filename, std::ios::out);

// full name
{
String fullname(plugin.getMaker());

if (fullname.isEmpty())
fullname = "DPF";

fullname += ": ";
fullname += plugin.getName();

rFile << "#define DISTRHO_PLUGIN_FULL_NAME \"" + fullname + "\"\n";
}

// description
{
String description(plugin.getDescription());

if (description.isNotEmpty())
{
description.replace('\n', ' ').replace('"', '\'');
}
else
{
description = plugin.getName();
description += " AU";
}

rFile << "#define DISTRHO_PLUGIN_DESCRIPTION \"" + description + "\"\n";
}

#ifndef DEBUG
// version
{
String version(plugin.getVersion());

if (version.isEmpty())
version = "0";

rFile << "#define DISTRHO_PLUGIN_VERSION " + version + "\n";
}
#else
rFile << "#define DISTRHO_PLUGIN_VERSION 0xFFFFFFFF\n";
#endif

rFile.close();
std::cout << " done!" << std::endl;
}

// -----------------------------------------------------------------------

int main(int argc, char* argv[])
{
if (argc != 2)
{
std::cout << "Single argument (output path) required!" << std::endl;
return 1;
}

au_generate_r(argv[1]);
return 0;
}

// -----------------------------------------------------------------------

#include "DistrhoPlugin.cpp"

// -----------------------------------------------------------------------

Loading…
Cancel
Save