Skip to content

Commit 25b090c

Browse files
Merge pull request #2305 from plugdata-team/v0.9.3-1
Fixes for v0.9.3 release
2 parents fa10d01 + 6676d2b commit 25b090c

8 files changed

Lines changed: 77 additions & 49 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ endif()
413413

414414
list(APPEND PLUGDATA_COMPILE_DEFINITIONS JUCE_MODAL_LOOPS_PERMITTED=1)
415415

416-
list(APPEND PLUGDATA_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/ELSE/sfont~/")
416+
list(APPEND PLUGDATA_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/pd-else/Source/Audio/sfont~/")
417417
list(APPEND PLUGDATA_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/pure-data/src")
418418
list(APPEND PLUGDATA_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/JUCE/modules")
419419
list(APPEND PLUGDATA_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Libraries/readerwriterqueue/")
@@ -429,7 +429,7 @@ add_library(plugdata_core STATIC ${plugdata_sources})
429429
target_compile_definitions(plugdata_core PUBLIC ${PLUGDATA_COMPILE_DEFINITIONS})
430430
target_include_directories(plugdata_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Tests ${CMAKE_CURRENT_SOURCE_DIR}/Libraries/raw-keyboard-input-module ${CMAKE_CURRENT_SOURCE_DIR}/Libraries/pure-data/src ${CMAKE_CURRENT_SOURCE_DIR}/Libraries/pure-data/src ${CMAKE_CURRENT_SOURCE_DIR}/Source ${CMAKE_CURRENT_SOURCE_DIR}/Libraries)
431431
target_link_libraries(plugdata_core PUBLIC ${libs})
432-
target_include_directories(plugdata_core PUBLIC "$<BUILD_INTERFACE:${PLUGDATA_INCLUDE_DIRECTORY}>")
432+
target_include_directories(plugdata_core PUBLIC ${PLUGDATA_INCLUDE_DIRECTORY})
433433
include_directories(./Libraries/nanovg/src/)
434434

435435
foreach(core_SOURCE ${plugdata_sources})
@@ -716,12 +716,12 @@ if(APPLE)
716716
target_compile_definitions(plugdata_midi PUBLIC ${PLUGDATA_COMPILE_DEFINITIONS} PLUGDATA_MIDI=1)
717717
endif()
718718

719-
target_include_directories(plugdata_standalone PUBLIC "$<BUILD_INTERFACE:${PLUGDATA_INCLUDE_DIRECTORY}>")
720-
target_include_directories(plugdata PUBLIC "$<BUILD_INTERFACE:${PLUGDATA_INCLUDE_DIRECTORY}>")
721-
target_include_directories(plugdata_fx PUBLIC "$<BUILD_INTERFACE:${PLUGDATA_INCLUDE_DIRECTORY}>")
719+
target_include_directories(plugdata_standalone PUBLIC ${PLUGDATA_INCLUDE_DIRECTORY})
720+
target_include_directories(plugdata PUBLIC ${PLUGDATA_INCLUDE_DIRECTORY})
721+
target_include_directories(plugdata_fx PUBLIC ${PLUGDATA_INCLUDE_DIRECTORY})
722722

723723
if(APPLE)
724-
target_include_directories(plugdata_midi PUBLIC "$<BUILD_INTERFACE:${PLUGDATA_INCLUDE_DIRECTORY}>")
724+
target_include_directories(plugdata_midi PUBLIC ${PLUGDATA_INCLUDE_DIRECTORY})
725725
endif()
726726

727727
# Add pd file icons for mac
@@ -906,7 +906,7 @@ elseif(UNIX AND NOT APPLE) # Linux or BSD
906906
install(FILES ${CMAKE_SOURCE_DIR}/Resources/Installer/plugdata.desktop DESTINATION share/applications)
907907
install(PROGRAMS ${PLUGDATA_PLUGINS_LOCATION}/Standalone/plugdata DESTINATION bin)
908908
if(APPLE)
909-
target_include_directories(plugdata_midi PUBLIC "$<BUILD_INTERFACE:${PLUGDATA_INCLUDE_DIRECTORY}>")
909+
target_include_directories(plugdata_midi PUBLIC ${PLUGDATA_INCLUDE_DIRECTORY})
910910
endif()
911911
else()
912912
install(DIRECTORY ${PLUGDATA_PLUGINS_LOCATION}/VST3/plugdata.vst3 DESTINATION "$ENV{HOME}/.vst3")

Libraries/pd-lua

Submodule pd-lua updated 1 file

Source/Dialogs/PatchStore.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ class DownloadPool final : public DeletedAtShutdown {
211211

212212
auto const patchesDir = ProjectInfo::appDataDir.getChildFile("Patches");
213213

214-
auto extractedDir = File::createTempFile("");
215-
auto result = zip.uncompressTo(extractedDir, true);
214+
auto extractedDir = TemporaryFile(patchesDir.getChildFile(info.getNameInPatchFolder()), TemporaryFile::useHiddenFile);
215+
auto result = zip.uncompressTo(extractedDir.getFile(), true);
216216

217-
for(auto downloadedPatch : OSUtils::iterateDirectory(extractedDir, false, false))
217+
for(auto downloadedPatch : OSUtils::iterateDirectory(extractedDir.getFile(), false, false))
218218
{
219219
if(!downloadedPatch.isDirectory() || downloadedPatch.getFileName() == "__MACOSX") continue;
220220

Source/Dialogs/TextEditorDialog.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,9 @@ SmallArray<TextDocument::RowData> TextDocument::findRowsIntersecting(Rectangle<f
19991999
}
20002000
rows.add(data);
20012001
}
2002-
lineNumber += lines.isNewLine(n);
2002+
if(lines.size() > n) {
2003+
lineNumber += lines.isNewLine(n);
2004+
}
20032005
}
20042006
return rows;
20052007
}
@@ -2517,7 +2519,7 @@ void PlugDataTextEditor::paint(Graphics& g)
25172519

25182520
AttributedString s;
25192521
if (!enableSyntaxHighlighting) {
2520-
s.append(line, font, findColour(PlugDataColour::panelTextColourId));
2522+
s.append(line, font, findColour(PlugDataColour::canvasBackgroundColourId).contrasting(0.95));
25212523
} else {
25222524
// Build the full logical line by backtracking to the start
25232525
String fullLine;
@@ -2908,7 +2910,7 @@ MouseCursor PlugDataTextEditor::getMouseCursor()
29082910

29092911
CodeEditorComponent::ColourScheme PlugDataTextEditor::getSyntaxColourScheme()
29102912
{
2911-
auto const textColour = findColour(PlugDataColour::canvasTextColourId);
2913+
auto const textColour = findColour(PlugDataColour::canvasBackgroundColourId).contrasting(0.95f);
29122914
if (findColour(PlugDataColour::canvasBackgroundColourId).getPerceivedBrightness() > 0.5f) {
29132915
static CodeEditorComponent::ColourScheme::TokenType const types[] = {
29142916
{ "Error", Colour(0xffcc0000) },

Source/NVGSurface.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,7 @@ void NVGSurface::initialise()
151151

152152
return;
153153
}
154-
155-
updateWindowContextVisibility();
156-
154+
157155
surfaces[nvg] = this;
158156

159157
nvgAtlasTextThreshold(nvg, 32.0f);
@@ -163,6 +161,8 @@ void NVGSurface::initialise()
163161
nvgCreateFontMem(nvg, "Inter-SemiBold", (unsigned char*)BinaryData::InterSemiBold_ttf, BinaryData::InterSemiBold_ttfSize, 0);
164162
nvgCreateFontMem(nvg, "Inter-Tabular", (unsigned char*)BinaryData::InterTabular_ttf, BinaryData::InterTabular_ttfSize, 0);
165163
nvgCreateFontMem(nvg, "icon_font-Regular", (unsigned char*)BinaryData::IconFont_ttf, BinaryData::IconFont_ttfSize, 0);
164+
165+
updateWindowContextVisibility();
166166
}
167167

168168
void NVGSurface::updateWindowContextVisibility()

Source/Objects/GraphOnParent.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class GraphOnParent final : public ObjectBase {
198198
}
199199

200200
auto text = getText();
201-
if(text != "graph" && !text.isNotEmpty()) {
201+
if(text != "graph" && text.isNotEmpty()) {
202202
textRenderer.prepareLayout(getText(), Fonts::getDefaultFont().withHeight(13), cnv->editor->getLookAndFeel().findColour(PlugDataColour::canvasTextColourId), getWidth(), getWidth(), false);
203203
}
204204
updateCanvas();
@@ -211,7 +211,7 @@ class GraphOnParent final : public ObjectBase {
211211
void lookAndFeelChanged() override
212212
{
213213
auto text = getText();
214-
if(text != "graph" && !text.isNotEmpty()) {
214+
if(text != "graph" && text.isNotEmpty()) {
215215
textRenderer.prepareLayout(getText(), Fonts::getDefaultFont().withHeight(13), cnv->editor->getLookAndFeel().findColour(PlugDataColour::canvasTextColourId), getWidth(), getWidth(), false);
216216
}
217217
}

Source/PluginProcessor.cpp

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,8 @@ String PluginProcessor::findLostPatch(String const& patchPath) const
13391339
}
13401340

13411341
SmallArray<std::pair<File, var>> libraryMetaFiles;
1342+
SmallArray<std::pair<String, File>> candidates;
1343+
13421344
for(auto dir : OSUtils::iterateDirectory(patchesDir, false, false))
13431345
{
13441346
auto meta = dir.getChildFile("meta.json");
@@ -1354,19 +1356,40 @@ String PluginProcessor::findLostPatch(String const& patchPath) const
13541356
for(auto [dir, meta] : libraryMetaFiles)
13551357
{
13561358
if(meta["Title"].toString().toLowerCase().replace(" ", "-") == hashedDirName)
1357-
return dir.getChildFile(meta["Patch"].toString()).getFullPathName();
1359+
candidates.add({meta["Version"].toString(), dir.getChildFile(meta["Patch"].toString())});
13581360

13591361
if(meta["Title"].toString() == dirName)
1360-
return dir.getChildFile(meta["Patch"].toString()).getFullPathName();
1362+
candidates.add({meta["Version"].toString(), dir.getChildFile(meta["Patch"].toString())});
13611363
}
13621364

13631365
// Last resort, find a patch with a matching name
13641366
for(auto [dir, meta] : libraryMetaFiles)
13651367
{
13661368
if(meta["Patch"].toString() == patchName)
1367-
return dir.getChildFile(meta["Patch"].toString()).getFullPathName();
1369+
candidates.add({meta["Version"].toString(), dir.getChildFile(meta["Patch"].toString()).getFullPathName()});
1370+
}
1371+
1372+
if(candidates.size()) {
1373+
candidates.sort([](std::pair<String, File> const& versionA, std::pair<String, File> const& versionB) -> bool {
1374+
auto versionTokensA = StringArray::fromTokens(versionA.first, ".", "");
1375+
auto versionTokensB = StringArray::fromTokens(versionB.first, ".", "");
1376+
1377+
for(int i = 0; i < std::max(versionTokensA.size(), versionTokensB.size()); i++)
1378+
{
1379+
int v1 = i < versionTokensA.size() && versionTokensA[i].containsOnly("0123456789") ? versionTokensA[i].getIntValue() : 0;
1380+
int v2 = i < versionTokensB.size() && versionTokensB[i].containsOnly("0123456789") ? versionTokensB[i].getIntValue() : 0;
1381+
1382+
if(v1 != v2)
1383+
return v1 < v2;
1384+
}
1385+
1386+
return false;
1387+
});
1388+
1389+
return candidates[0].second.getFullPathName();
13681390
}
13691391

1392+
13701393
return patchPath.replace("${PATCHES_DIR}", patchesDir.getFullPathName());
13711394
}
13721395

@@ -1477,6 +1500,10 @@ void PluginProcessor::setStateInformation(void const* data, int const sizeInByte
14771500
location = location.replace("${PRESET_DIR}", presetDir.getFullPathName());
14781501

14791502
auto patchesDir = ProjectInfo::appDataDir.getChildFile("Patches");
1503+
#if !JUCE_WINDOWS
1504+
location = location.replaceCharacter('\\', '/');
1505+
#endif
1506+
14801507
if(location.contains("${PATCHES_DIR}")) {
14811508
auto newLocation = location.replace("${PATCHES_DIR}", patchesDir.getFullPathName());
14821509
if(File(newLocation).existsAsFile())
@@ -1488,9 +1515,12 @@ void PluginProcessor::setStateInformation(void const* data, int const sizeInByte
14881515
}
14891516
}
14901517

1491-
#if !JUCE_WINDOWS
1492-
location = location.replaceCharacter('\\', '/');
1493-
#endif
1518+
// If a patch has a meta file, always load from file instead of from content
1519+
if(File(location).getSiblingFile("meta.json").existsAsFile())
1520+
{
1521+
content.clear();
1522+
}
1523+
14941524
openPatch(content, location, pluginMode, pluginModeScale, splitIndex);
14951525

14961526
}

Source/Standalone/InternalSynth.cpp

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@
55
*/
66

77
#include "InternalSynth.h"
8-
9-
#if PLUGDATA_STANDALONE
10-
# include <FluidLite/include/fluidlite.h>
11-
# include <FluidLite/src/fluid_sfont.h>
12-
#endif
8+
#include <FluidLite/include/fluidlite.h>
9+
#include <FluidLite/src/fluid_sfont.h>
1310

1411
// InternalSynth is an internal General MIDI synthesizer that can be used as a MIDI output device
1512
// The goal is to get something similar to the "AU DLS Synth" in Max/MSP on macOS, but cross-platform
1613
// Since fluidsynth is alraedy included for the sfont~ object, we can reuse it here to read a GM soundfont
1714
InternalSynth::InternalSynth()
1815
: Thread("InternalSynthInit")
1916
{
20-
#ifndef PLUGDATA_STANDALONE
17+
if(!ProjectInfo::isStandalone)
18+
return;
19+
2120
ignoreUnused(synth);
2221
ignoreUnused(settings);
23-
#endif
2422
}
2523

2624
InternalSynth::~InternalSynth()
2725
{
28-
#ifdef PLUGDATA_STANDALONE
26+
if(!ProjectInfo::isStandalone)
27+
return;
28+
2929
stopThread(6000);
3030

3131
if (ready) {
@@ -34,13 +34,13 @@ InternalSynth::~InternalSynth()
3434
if (settings)
3535
delete_fluid_settings(settings);
3636
}
37-
#endif
3837
}
3938

4039
// Initialise fluidsynth on another thread, because it takes a while
4140
void InternalSynth::run()
4241
{
43-
#ifdef PLUGDATA_STANDALONE
42+
if(!ProjectInfo::isStandalone)
43+
return;
4444

4545
unprepareLock.lock();
4646

@@ -72,13 +72,12 @@ void InternalSynth::run()
7272
}
7373

7474
unprepareLock.unlock();
75-
76-
#endif
7775
}
7876

7977
void InternalSynth::unprepare()
8078
{
81-
#ifdef PLUGDATA_STANDALONE
79+
if(!ProjectInfo::isStandalone)
80+
return;
8281

8382
unprepareLock.lock();
8483

@@ -98,8 +97,6 @@ void InternalSynth::unprepare()
9897
}
9998

10099
unprepareLock.unlock();
101-
102-
#endif
103100
}
104101

105102
void InternalSynth::handleAsyncUpdate()
@@ -110,20 +107,22 @@ void InternalSynth::handleAsyncUpdate()
110107

111108
void InternalSynth::prepare(int const sampleRate, int const blockSize)
112109
{
113-
#ifdef PLUGDATA_STANDALONE
110+
if(!ProjectInfo::isStandalone)
111+
return;
112+
114113
if (sampleRate == lastSampleRate && blockSize == lastBlockSize) {
115114
return;
116115
} else {
117116
lastSampleRate = sampleRate;
118117
lastBlockSize = blockSize;
119118
triggerAsyncUpdate();
120119
}
121-
#endif
122120
}
123121

124122
void InternalSynth::process(AudioBuffer<float>& buffer, MidiBuffer const& midiMessages)
125123
{
126-
#ifdef PLUGDATA_STANDALONE
124+
if(!ProjectInfo::isStandalone)
125+
return;
127126

128127
if (buffer.getNumSamples() > lastBlockSize) {
129128
unprepare();
@@ -175,15 +174,12 @@ void InternalSynth::process(AudioBuffer<float>& buffer, MidiBuffer const& midiMe
175174
}
176175

177176
unprepareLock.unlock();
178-
179-
#endif
180177
}
181178

182179
bool InternalSynth::isReady()
183180
{
184-
#ifndef PLUGDATA_STANDALONE
185-
return false;
186-
#else
181+
if(!ProjectInfo::isStandalone)
182+
return false;
183+
187184
return ready;
188-
#endif
189185
}

0 commit comments

Comments
 (0)