Skip to content

Commit

Permalink
Merge pull request #1207 from plugdata-team/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
timothyschoen authored Oct 4, 2023
2 parents 5818076 + 20b5900 commit ac37b15
Show file tree
Hide file tree
Showing 66 changed files with 878 additions and 265 deletions.
23 changes: 13 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ option(RUN_CLANG_TIDY "" OFF)
option(ENABLE_TESTING "" OFF)
option(ENABLE_SFONT "" ON)
option(ENABLE_SFIZZ "" ON)
option(ENABLE_ASAN "" OFF)
option(VERBOSE "" OFF)

set (CMAKE_CXX_STANDARD 20)
Expand All @@ -16,16 +17,6 @@ set (CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_C_VISIBILITY_PRESET hidden)

# Sfizz doesn't want to compile on aarch64 linux here...
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set(ENABLE_SFIZZ OFF)
endif()

# Sfizz doesn't want to compile on aarch64 linux here...
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set(ENABLE_SFIZZ OFF)
endif()

function(message)
if (NOT MESSAGE_QUIET)
_message(${ARGN})
Expand Down Expand Up @@ -59,6 +50,13 @@ set_property(GLOBAL PROPERTY USE_FOLDERS YES)

project(plugdata VERSION 0.8.0 LANGUAGES C CXX)

# Sfizz doesn't want to compile on aarch64 linux...
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
message(STATUS "Disabled sfizz")
set(ENABLE_SFIZZ OFF)
endif()


add_subdirectory(Libraries/ EXCLUDE_FROM_ALL)

cmake_policy(SET CMP0091 NEW)
Expand All @@ -69,6 +67,11 @@ if (CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=return-type")
endif()

if(ENABLE_ASAN)
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif()

message(STATUS "Preparing documentation")
execute_process(COMMAND python3 parse_documentation.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Scripts)

Expand Down
9 changes: 9 additions & 0 deletions Libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,20 @@ file(GLOB ELSE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/pd-else/Code_source/shared/*.c
)

file(GLOB_RECURSE CIRCUIT_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/pd-else/Code_source/Compiled/audio/circuit~/Source/circuit~.c
${CMAKE_CURRENT_SOURCE_DIR}/pd-else/Code_source/Compiled/audio/circuit~/Source/Simulator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pd-else/Code_source/Compiled/audio/circuit~/Libraries/**/*.c
)

file(GLOB_RECURSE PLAITS_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/pd-else/Code_source/Compiled/audio/plaits~/plaits~.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pd-else/Code_source/Compiled/audio/plaits~/*.cc
)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/pd-else/Code_source/Compiled/audio/circuit~/Libraries)

list(APPEND ELSE_SOURCES ${CIRCUIT_SOURCES})
list(APPEND ELSE_SOURCES ${PLAITS_SOURCES})

if(ENABLE_SFIZZ)
Expand Down
12 changes: 12 additions & 0 deletions Libraries/libpd/x_libpd_multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,12 @@ void setup_ptouch0x2eout();
void setup_spread0x2emc_tilde();
void setup_rotate0x2emc_tilde();
void pipe2_setup();
void circuit_tilde_setup();

void op2_tilde_setup();
void op4_tilde_setup();
void op6_tilde_setup();


#if ENABLE_SFIZZ
void sfz_tilde_setup();
Expand Down Expand Up @@ -1085,6 +1091,12 @@ void libpd_init_else(void)
setup_spread0x2emc_tilde();
setup_rotate0x2emc_tilde();
pipe2_setup();
circuit_tilde_setup();

/* Not yet!
op2_tilde_setup();
op4_tilde_setup();
op6_tilde_setup(); */
}

void libpd_init_cyclone(void)
Expand Down
2 changes: 1 addition & 1 deletion Libraries/pd-else
Submodule pd-else updated 205 files
14 changes: 12 additions & 2 deletions Resources/Documentation/vanilla/clone.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ categories:
see_also:
- poly
pdcategory: vanilla, UI, Data Management
last_update: '0.47'
last_update: '0.54'
inlets:
nth:
- type: list
Expand All @@ -18,14 +18,20 @@ outlets:
- type: data outlets
description: output with a prepended instance number
- type: signal outlets
description: output the sum of all instances' outputs
description: output from all instances either as multichannel signal or summed into mono signal

flags:
- name: -x
description: avoids including a first argument setting voice number
- name: -s <float>
description: sets starting voice number
default: 0
- name: -di
description: distribute multichannel input signals across cloned patches
- name: -do
description: combine signal outputs to make a multichannel signal
- name: -d
description: set both -di and -do flags

arguments:
- type: symbol
Expand All @@ -36,6 +42,10 @@ arguments:
description: optional arguments to the abstraction

methods:
- type: resize <float>
description: resizes the number of copies
- type: vis <list>
description: opens a copy, takes copy number and visualization status (1 to open, 0 to close)
- type: next <list>
description: forwards a message to the next instance's inlet (incrementing and repeating circularly)
- type: this <list>
Expand Down
28 changes: 28 additions & 0 deletions Resources/Documentation/vanilla/snake~-in.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: snake~, snake_in~
description: combine mono signals into multichannel signals
categories:
- object
pdcategory: vanilla, Mixing and Routing, Audio I/O
last_update: '0.54'
see_also:
- snake~ out
- inlet~
- clone
- throw~
- send~
arguments:
- description: number of channels
default: 2
type: float
inlets:
nth:
- type: float/signal
description: mono input to merge into a multichannel signal
outlets:
1st:
- type: signals
description: multichannel signal
draft: false
---
ssssssssss
28 changes: 28 additions & 0 deletions Resources/Documentation/vanilla/snake~-out.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: snake_out~
description: split multichannel signals into mono signals
categories:
- object
pdcategory: vanilla, Mixing and Routing, Audio I/O
last_update: '0.54'
see_also:
- snake~ out
- inlet~
- clone
- throw~
- send~
arguments:
- description: number of channels
default: 2
type: float
inlets:
1st:
- type: signals
description: a multichannel signal to break into mono tracks
outlets:
nth:
- type: signal
description: mono outputs
draft: false
---
ssssssssss
Binary file modified Resources/Fonts/IconFont.ttf
Binary file not shown.
2 changes: 2 additions & 0 deletions Resources/Scripts/package_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def splitFile(file, num_files):

globMove("./Abstractions/*-help.pd", "./Documentation/5.reference")
copyDir("../../Libraries/pd-else/Documentation/Help-files/", "./Documentation/9.else")
copyFile("../../Libraries/pd-else/Documentation/extra_files/f2s~-help.pd", "./Documentation/9.else")

#copyFile("../Patches/beat-help.pd", "./Documentation/5.reference")
copyFile("../Patches/param-help.pd", "./Documentation/5.reference")
Expand All @@ -99,6 +100,7 @@ def splitFile(file, num_files):
makeDir("Extra")
makeDir("Extra/GS")
copyDir("../../Libraries/pd-else/Documentation/extra_files", "Extra/else");
copyFile("../../Libraries/pd-else/Documentation/README.pdf", "Extra/else");
copyDir("../../Libraries/pd-else/Code_source/Compiled/audio/sfont~/sf", "Extra/else/sf");
copyDir("../Patches/Presets", "./Extra/Presets")
copyDir("../Patches/Palettes", "./Extra/palette")
Expand Down
13 changes: 9 additions & 4 deletions Source/Canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ Canvas::Canvas(PluginEditor* parent, pd::Patch::Ptr p, Component* parentGraph)

setSize(infiniteCanvasSize, infiniteCanvasSize);

// initialize per canvas zoom to 100% when first creating canvas
zoomScale.setValue(1.0f);
// initialize to default zoom
auto defaultZoom = SettingsFile::getInstance()->getPropertyAsValue("default_zoom");
zoomScale.setValue(getValue<float>(defaultZoom)/100.0f);
zoomScale.addListener(this);

// Add lasso component
Expand Down Expand Up @@ -275,7 +276,9 @@ void Canvas::zoomToFitAll()

void Canvas::lookAndFeelChanged()
{
lasso.setColour(LassoComponent<Object>::lassoFillColourId, findColour(PlugDataColour::objectSelectedOutlineColourId).withAlpha(0.3f));
lasso.setColour(LassoComponent<Object>::lassoFillColourId, findColour(PlugDataColour::objectSelectedOutlineColourId).withAlpha(0.125f));

lasso.setColour(LassoComponent<Object>::lassoOutlineColourId, findColour(PlugDataColour::objectSelectedOutlineColourId).withAlpha(0.8f));
}

void Canvas::paint(Graphics& g)
Expand Down Expand Up @@ -461,7 +464,9 @@ void Canvas::performSynchronise()
// Remove deleted objects
for (int n = objects.size() - 1; n >= 0; n--) {
auto* object = objects[n];
if (!object->getPointer() || patch.objectWasDeleted(object->getPointer())) {

// If the object is showing it's initial editor, meaning no object was assigned yet, allow it to exist without pointing to an object
if ((!object->getPointer()|| patch.objectWasDeleted(object->getPointer())) && !object->isInitialEditorShown()) {
setSelected(object, false, false);
objects.remove(n);
}
Expand Down
26 changes: 21 additions & 5 deletions Source/CanvasViewport.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,13 @@ class CanvasViewport : public Viewport {
{
isMouseDragging = true;
viewPosition = viewport->getViewPosition();
repaint();
}

void mouseUp(MouseEvent const& e) override
{
isMouseDragging = false;
if (e.mouseWasDraggedSinceMouseDown()) {
isMouseDragging = false;
if (!isMouseOver)
animator.shrink();
}
Expand Down Expand Up @@ -222,12 +223,22 @@ class CanvasViewport : public Viewport {

auto growingBounds = thumbBounds.reduced(1).withTop(thumbBounds.getY() + growPosition);
auto roundedCorner = growingBounds.getHeight() * 0.5f;
auto fullBounds = growingBounds.withX(2).withWidth(getWidth() - 4);

if (isVertical) {
growingBounds = thumbBounds.reduced(1).withLeft(thumbBounds.getX() + growPosition);
roundedCorner = growingBounds.getWidth() * 0.5f;
fullBounds = growingBounds.withY(2).withHeight(getHeight() - 4);
}

g.setColour(findColour(ScrollBar::ColourIds::thumbColourId));
auto canvasColour = findColour(PlugDataColour::canvasBackgroundColourId);
auto scrollbarColour = findColour(ScrollBar::ColourIds::thumbColourId);
auto activeScrollbarColour = scrollbarColour.interpolatedWith(canvasColour.contrasting(0.6f), 0.7f);

g.setColour(scrollbarColour.interpolatedWith(canvasColour, 0.7f).withAlpha(std::clamp(1.0f - growAnimation, 0.0f, 1.0f)));
g.fillRoundedRectangle(fullBounds, roundedCorner);

g.setColour(isMouseDragging ? activeScrollbarColour : scrollbarColour);
g.fillRoundedRectangle(growingBounds, roundedCorner);
}

Expand Down Expand Up @@ -373,6 +384,11 @@ class CanvasViewport : public Viewport {

adjustScrollbarBounds();

if (!SettingsFile::getInstance()->getProperty<bool>("center_resized_canvas")) {
Viewport::resized();
return;
}

float scale = std::sqrt(std::abs(cnv->getTransform().getDeterminant()));

// centre canvas when resizing viewport
Expand All @@ -384,12 +400,12 @@ class CanvasViewport : public Viewport {
return getViewArea().withZeroOrigin().getCentre();
};

auto currentCenter = getCentre(previousBounds);
auto currentCentre = getCentre(previousBounds);
previousBounds = getBounds();
Viewport::resized();
auto newCenter = getCentre(getBounds());
auto newCentre = getCentre(getBounds());

auto offset = currentCenter - newCenter;
auto offset = currentCentre - newCentre;
setViewPosition(getViewPosition() + offset);
}

Expand Down
4 changes: 2 additions & 2 deletions Source/Connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ bool Connection::hitTest(int x, int y)
if (Canvas::panningModifierDown())
return false;

if (locked == var(true) || !cnv->connectionsBeingCreated.isEmpty())
if (cnv->commandLocked == var(true) || locked == var(true) || !cnv->connectionsBeingCreated.isEmpty())
return false;

Point<float> position = Point<float>(static_cast<float>(x), static_cast<float>(y));
Expand Down Expand Up @@ -444,10 +444,10 @@ bool Connection::isSegmented() const
void Connection::setSegmented(bool isSegmented)
{
segmented = isSegmented;
pushPathState();
updatePath();
resizeToFit();
repaint();
pushPathState();
}

void Connection::setSelected(bool shouldBeSelected)
Expand Down
3 changes: 2 additions & 1 deletion Source/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct Icons {
inline static const String History = "X";
inline static const String Protection = "Y";
inline static const String DevTools = "{";
inline static const String Help = "\\";

inline static const String SavePatch = "Z";
inline static const String ClosePatch = "[";
Expand Down Expand Up @@ -381,7 +382,7 @@ const std::map<ObjectIDs, String> objectNames {
};

struct Corners {
inline static float const windowCornerRadius = 12.5f;
inline static float const windowCornerRadius = 12.0f;
inline static float const largeCornerRadius = 8.0f;
inline static float const defaultCornerRadius = 5.0f;
inline static float objectCornerRadius = 2.75f;
Expand Down
15 changes: 15 additions & 0 deletions Source/Dialogs/AdvancedSettingsPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ class AdvancedSettingsPanel : public Component
scaleValue.addListener(this);
otherProperties.add(new PropertiesPanel::EditableComponent<float>("Global scale factor", scaleValue));

defaultZoom = settingsFile->getProperty<float>("default_zoom");
defaultZoom.addListener(this);
otherProperties.add(new PropertiesPanel::EditableComponent<float>("Default zoom %", defaultZoom));

centerResized = settingsFile->getPropertyAsValue("center_resized_canvas");
centerResized.addListener(this);
otherProperties.add(new PropertiesPanel::BoolComponent("Center canvas when resized", centerResized, { "No", "Yes" }));

propertiesPanel.addSection("Other", otherProperties);

addAndMakeVisible(propertiesPanel);
Expand All @@ -85,6 +93,11 @@ class AdvancedSettingsPanel : public Component
SettingsFile::getInstance()->setGlobalScale(scale);
scaleValue = scale;
}
if (v.refersToSameSourceAs(defaultZoom)) {
auto zoom = std::clamp(getValue<float>(defaultZoom), 20.0f, 300.0f);
SettingsFile::getInstance()->setProperty("default_zoom", zoom);
defaultZoom = zoom;
}
}
Component* editor;

Expand All @@ -94,6 +107,8 @@ class AdvancedSettingsPanel : public Component
Value macTitlebarButtons;
Value reloadPatch;
Value scaleValue;
Value defaultZoom;
Value centerResized;

Value showPalettesValue;
Value autoPatchingValue;
Expand Down
1 change: 1 addition & 0 deletions Source/Dialogs/AudioSettingsPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ struct CallbackComboPropertyWithTestButton : public CallbackComboProperty {
: CallbackComboProperty(propertyName, options, currentOption, onChange)
{
testButton.setColour(ComboBox::outlineColourId, Colours::transparentBlack);
testButton.setColour(TextButton::textColourOnId, findColour(TextButton::textColourOffId));
testButton.onClick = [&deviceManager]() mutable {
deviceManager.playTestSound();
};
Expand Down
Loading

0 comments on commit ac37b15

Please sign in to comment.