Skip to content

Commit

Permalink
- fixed new compile dialog on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Hart committed Jan 23, 2025
1 parent e4e5659 commit c696a2b
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 26 deletions.
2 changes: 2 additions & 0 deletions hi_backend/backend/BackendComponents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ multipage::EncodedDialogBase::EncodedDialogBase(BackendRootWindow* bpe_, bool ad

addChildComponent(minimizeButton);

minimizeButton.setTooltip("Minimize this task to the status bar");

minimizeButton.onClick = [this]()
{
findParentComponentOfClass<BackendRootWindow>()->minimizeModalComponent(true, state.get());
Expand Down
10 changes: 6 additions & 4 deletions hi_backend/backend/CompileExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ CompileExporter::ErrorCodes CompileExporter::exportInternal(TargetTypes type, Bu

setProgress(0.5);

logMessage("> Launch system compi");
logMessage("> Launch system compiler...");

result = compileSolution(option, type, manager);

Expand Down Expand Up @@ -1175,7 +1175,7 @@ CompileExporter::BuildOption CompileExporter::showCompilePopup(TargetTypes type)

CompileExporter::ErrorCodes CompileExporter::compileSolution(BuildOption buildOption, TargetTypes types, ChildProcessManager* manager)
{
BatchFileCreator::createBatchFile(this, buildOption, types, manager != nullptr);
BatchFileCreator::createBatchFile(this, buildOption, types, manager);

File batchFile = BatchFileCreator::getBatchFile(this, manager);

Expand Down Expand Up @@ -2480,13 +2480,15 @@ int CppBuilder::exportValueTreeAsCpp(const File &sourceDirectory, const File &de

#define ADD_LINE(x) (batchContent << x << NewLine::getDefault())

void CompileExporter::BatchFileCreator::createBatchFile(CompileExporter* exporter, BuildOption buildOption, TargetTypes types, bool hasChildProcessManager)
void CompileExporter::BatchFileCreator::createBatchFile(CompileExporter* exporter, BuildOption buildOption, TargetTypes types, ChildProcessManager* manager)
{
ModulatorSynthChain* chainToExport = exporter->chainToExport;
ignoreUnused(chainToExport);

File batchFile = getBatchFile(exporter);
File batchFile = getBatchFile(exporter, manager);

auto hasChildProcessManager = manager != nullptr;

if (!exporter->shouldBeSilent() && batchFile.existsAsFile())
{
if (!PresetHandler::showYesNoWindow("Batch File already found", "Do you want to rewrite the batch file for the compile process?"))
Expand Down
2 changes: 1 addition & 1 deletion hi_backend/backend/CompileExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class CompileExporter: public BaseExporter

struct BatchFileCreator
{
static void createBatchFile(CompileExporter* exporter, BuildOption buildOption, TargetTypes types, bool hasChildProcessManager=false);
static void createBatchFile(CompileExporter* exporter, BuildOption buildOption, TargetTypes types, ChildProcessManager* m=nullptr);
static File getBatchFile(CompileExporter* exporter, ChildProcessManager* m=nullptr);
};

Expand Down
64 changes: 54 additions & 10 deletions hi_backend/backend/dialog_library/dialog_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,8 @@ CompileProjectDialog::~CompileProjectDialog()
if(killFunction)
killFunction();

dialog = nullptr;

state->clearCompletedJobs();

}
Expand Down Expand Up @@ -1025,7 +1027,7 @@ var CompileProjectDialog::onInit(const var::NativeFunctionArgs& args)
if(type.isNotEmpty())
writeState("projectType", type);

setElementProperty("OutputFile", mpid::Text, getTargetFile().getFullPathName());
refreshOutputFile();

return var();
}
Expand Down Expand Up @@ -1062,7 +1064,7 @@ var CompileProjectDialog::onPluginType(const var::NativeFunctionArgs& args)
{
auto flags = getBuildFlag();

setElementProperty("OutputFile", mpid::Text, getTargetFile().getFullPathName());
refreshOutputFile();

if(IS_FLAG(isAAX))
{
Expand Down Expand Up @@ -1097,29 +1099,45 @@ var CompileProjectDialog::onShowPluginFolder(const var::NativeFunctionArgs& args
{
auto flags = getBuildFlag();

File folder;


#if JUCE_WINDOWS
File folder = File::getSpecialLocation(File::SpecialLocationType::globalApplicationsDirectory);
#elif JUCE_MAC
File folder = File::getSpecialLocation(File::SpecialLocationType::commonApplicationDataDirectory).getChildFile("Audio/Plug-Ins");
#endif

if(IS_FLAG(isVST))
{
auto isVST3 = (bool)GET_HISE_SETTING(getMainController()->getMainSynthChain(), HiseSettings::Project::VST3Support);

folder = File::getSpecialLocation(File::SpecialLocationType::globalApplicationsDirectory);

#if JUCE_WINDOWS
if(isVST3)
{
folder = folder.getChildFile("Common Files").getChildFile("VST3");
}
else
{
// not a real default folder, but hey...
folder = folder.getChildFile("VSTPlugins");
}
#elif JUCE_MAC
folder = folder.getChildFile(isVST3 ? "VST3" : "VST");
#else
// DAVID...
jassertfalse;
#endif
}
if(IS_FLAG(isAAX))
{
folder = File::getSpecialLocation(File::SpecialLocationType::globalApplicationsDirectory);
#if JUCE_WINDOWS
folder = folder.getChildFile("Common Files").getChildFile("Avid").getChildFile("Audio").getChildFile("Plug-Ins");
#elif JUCE_MAC
folder = File("/Library/Application Support/Avid/Audio/Plug-Ins");
#endif
}
if(IS_FLAG(isAU))
{
folder = folder.getChildFile("Components");
}

if(folder.isDirectory())
{
Expand Down Expand Up @@ -1166,20 +1184,46 @@ File CompileProjectDialog::getTargetFile() const

if(IS_FLAG(isStandalone))
{
#if JUCE_WINDOWS
auto compiledFile = binaries.getChildFile("Compiled").getChildFile("App");
return compiledFile.getChildFile(filename).withFileExtension(".exe");
#elif JUCE_MAC
auto compiledFile = binaries.getChildFile("Compiled");
return compiledFile.getChildFile(filename).withFileExtension(".app");
#else
// David...
return File();
#endif
}
if(IS_FLAG(isVST))
{
{
auto isVST3 = (bool)GET_HISE_SETTING(getMainController()->getMainSynthChain(), HiseSettings::Project::VST3Support);

#if JUCE_WINDOWS
auto compiledFile = binaries.getChildFile("Compiled").getChildFile(isVST3 ? "VST3" : "VST");
return compiledFile.getChildFile(filename).withFileExtension(isVST3 ? ".vst3" : ".dll");
#elif JUCE_MAC
auto compiledFile = binaries.getChildFile("Builds/MacOSX/build/Release");
return compiledFile.getChildFile(filename).withFileExtension(isVST3 ? ".vst3" : ".vst");
#else
// David...
return File();
#endif
}
if(IS_FLAG(isAU))
{
auto compiledFile = binaries.getChildFile("Builds/MacOSX/build/Release");
return compiledFile.getChildFile(filename).withFileExtension(".component");
}
if(IS_FLAG(isAAX))
{
#if JUCE_WINDOWS
auto compiledFile = binaries.getChildFile("Compiled").getChildFile("AAX");
return compiledFile.getChildFile(filename).withFileExtension(".aaxplugin");
#elif JUCE_MAC
auto compiledFile = binaries.getChildFile("Builds/MacOSX/build/Release");
return compiledFile.getChildFile(filename).withFileExtension(".aaxplugin");
#endif
}

return File();
Expand All @@ -1196,7 +1240,7 @@ var CompileProjectDialog::onExportType(const var::NativeFunctionArgs& args)
setElementProperty("projectType", mpid::Enabled, !enabled);
setElementProperty("pluginType", mpid::Enabled, !enabled);

setElementProperty("OutputFile", mpid::Text, getTargetFile().getFullPathName());
refreshOutputFile();

return var();
}
Expand Down
47 changes: 38 additions & 9 deletions hi_backend/backend/dialog_library/dialog_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,39 @@ class ChildProcessManager: public AsyncUpdater
currentMessage = {};
}

void logMessage(const String& message)
void logMessage(String message)
{
{
SimpleReadWriteLock::ScopedWriteLock sl(logLock);

if(message.contains("error"))
currentMessage << "!";

auto isLinkerMessage = message.contains("Generating code") ||
#if JUCE_MAC
if(message.contains("[!]"))
{
message = message.fromFirstOccurrenceOf("[!]", false, false);

auto isWarning = message.contains("[-W") ||
message.contains("was built for newer macOS version"); // AAX linker warning

if(isWarning)
currentMessage << "\t";
else
currentMessage << "!";
}
#elif JUCE_WINDOWS
if(message.contains("warning"))
currentMessage << "\t";
if((message.contains("error"))
currentMessage << "!";
#endif
auto isLinkerMessage = message.contains("Generating code") ||
message.contains("Linking ");

if(isLinkerMessage)
{
currentMessage << "> ";
setProgress(0.8);
}

if(message.contains("warning"))
currentMessage << "\t";


currentMessage << message;
if(!message.containsChar('\n'))
currentMessage << '\n';
Expand Down Expand Up @@ -441,6 +454,22 @@ struct CompileProjectDialog: public EncodedDialogBase,
}
}

void refreshOutputFile()
{
auto targetFile = getTargetFile();
auto content = targetFile.getFullPathName();

auto w = GLOBAL_BOLD_FONT().getStringWidth(content);

if(w > 480)
{
auto root = getMainController()->getActiveFileHandler()->getRootFolder();
content = targetFile.getRelativePathFrom(root);
}

setElementProperty("OutputFile", mpid::Text, content);
}

var onInit(const var::NativeFunctionArgs& args);
var compileTask(const var::NativeFunctionArgs& args);
var onExportType(const var::NativeFunctionArgs& args);
Expand Down
1 change: 1 addition & 0 deletions hi_scripting/scripting/api/ScriptingApiContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6171,6 +6171,7 @@ void ScriptingApi::Content::ScriptMultipageDialog::onMultipageLog(ScriptMultipag
{
auto p = m.getScriptProcessor()->getMainController_()->getMainSynthChain();
debugToConsole(p, message);
ignoreUnused(p);
}
}

Expand Down
4 changes: 2 additions & 2 deletions hi_tools/hi_neural/hi_neural.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,6 @@ struct NAMModel: public NeuralNetwork::ModelBase
#endif
};

using Dilations = wavenet::Dilations<1, 2, 4, 8, 16, 32, 64, 128, 256, 512>;

NAMModel(const var& data_):
ModelBase(),
jsonData(data_)
Expand Down Expand Up @@ -564,6 +562,8 @@ struct NAMModel: public NeuralNetwork::ModelBase
{
return Result::fail(e.what());
}

return Result::ok();
};

wavenet::Wavenet_Model<float,
Expand Down

0 comments on commit c696a2b

Please sign in to comment.