Skip to content

Commit

Permalink
Merge branch 'master' into release/0.46
Browse files Browse the repository at this point in the history
  • Loading branch information
mfisher31 committed Feb 20, 2022
2 parents 2016b8d + c318e38 commit c59e477
Show file tree
Hide file tree
Showing 40 changed files with 232 additions and 118 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
custom: https://kushview.net/product/element-single-download/
custom: https://kushview.net/element/download/form/
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
[submodule "libs/kv"]
path = libs/kv
url = https://github.com/kushview/kv-modules
branch = develop
[submodule "libs/JUCE"]
path = libs/JUCE
url = https://github.com/kushview/JUCE
branch = master
[submodule "libs/jlv2"]
path = libs/jlv2
url = https://github.com/lvtk/jlv2
branch = master
[submodule "libs/lua-kv"]
path = libs/lua-kv
url = https://github.com/kushview/lua-kv
branch = master
11 changes: 9 additions & 2 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ __Dependencies__

The following packages are needed...
```
sudo apt-get install python git build-essential pkg-config libboost-signals-dev libfreetype6-dev libx11-dev libxext-dev libxrandr-dev libxcomposite-dev libxinerama-dev libxcursor-dev libasound2-dev lv2-dev liblilv-dev libsuil-dev ladspa-sdk libcurl4-openssl-dev
sudo apt-get install python git build-essential pkg-config libboost-dev libfreetype6-dev libx11-dev libxext-dev libxrandr-dev libxcomposite-dev libxinerama-dev libxcursor-dev libasound2-dev lv2-dev liblilv-dev libsuil-dev ladspa-sdk libcurl4-openssl-dev fonts-roboto
```

__Optional__
Expand Down Expand Up @@ -47,7 +47,7 @@ sudo ldconfig
Install these packages, then run the `waf` commands described above.

```
sudo pacman -S git lilv suil lv2 ladspa boost
sudo pacman -S git lilv suil lv2 ladspa boost ttf-mswin10
```

## Mac OSX
Expand All @@ -72,6 +72,13 @@ This produces `build/Applications/Element.app`.
open build/Applications/Element.app
```

__Apple Silicon__

Replace the `./waf configure` command above with this:
```
./waf configure CPPFLAGS="-I/opt/homebrew/include"
```

__Test__
```
./waf check
Expand Down
2 changes: 1 addition & 1 deletion libs/JUCE
Submodule JUCE updated from faf5ed to 314386
2 changes: 1 addition & 1 deletion libs/jlv2
9 changes: 7 additions & 2 deletions libs/lua/sol/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ the build system, or the command line options of your compiler.

#include <limits>

#define SOL_USING_CXX_LUA 0
#define SOL_EXCEPTIONS_SAFE_PROPAGATION 1
#define SOL_IN_DEBUG_DETECTED 0
#define SOL_SAFE_USERTYPE 0
#define SOL_SAFE_REFERENCES 0
#define SOL_SAFE_FUNCTION_CALLS 0

#define SOL_USING_CXX_LUA 0
#define SOL_EXCEPTIONS_SAFE_PROPAGATION 0

// end of sol/config.hpp

Expand Down
16 changes: 11 additions & 5 deletions src/DataPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ namespace Element
{
StringArray getSubDirs()
{
return StringArray ({ "Controllers", "Graphs", "Presets", "Templates", "Scripts", "Sessions" });
auto dirs = StringArray ({ "Controllers", "Graphs", "Presets", "Scripts" });
#if defined(EL_PRO)
dirs.add ("Sessions");
#endif
return dirs;
}

void initializeUserLibrary (const File& path)
Expand Down Expand Up @@ -74,11 +78,13 @@ namespace Element
#endif
}

const File DataPath::defaultLocation()
{
return defaultUserDataPath();
}
const File DataPath::defaultLocation() { return defaultUserDataPath(); }

const File DataPath::defaultGlobalMidiProgramsDir()
{
return defaultUserDataPath().getChildFile ("Cache/MIDI/Programs");
}

const File DataPath::defaultScriptsDir() { return defaultUserDataPath().getChildFile ("Scripts"); }
const File DataPath::defaultSessionDir() { return defaultUserDataPath().getChildFile ("Sessions"); }
const File DataPath::defaultGraphDir() { return defaultUserDataPath().getChildFile ("Graphs"); }
Expand Down
6 changes: 5 additions & 1 deletion src/DataPath.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of Element
Copyright (C) 2014-2019 Kushview, LLC. All rights reserved.
Copyright (C) 2014-2022 Kushview, LLC. All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -44,6 +44,9 @@ class DataPath
/** Returns the default user data path */
static const File defaultLocation();

/** Returns the default Node MIDI Presets directory */
static const File defaultGlobalMidiProgramsDir();

/** Returns the default User data path */
static const File defaultUserDataPath();

Expand All @@ -62,6 +65,7 @@ class DataPath
/** Returns the default Workspaces directory */
static const File workspacesDir();


/** Returns the installation directory. May return an invalid file,
especially when in debug mode. Use this sparingly.
*/
Expand Down
10 changes: 10 additions & 0 deletions src/controllers/AppController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ AppController::~AppController() { }

void AppController::activate()
{
// migrate global node midi programs.
auto progsdir = DataPath::defaultGlobalMidiProgramsDir();
auto olddir = DataPath::applicationDataDir().getChildFile ("NodeMidiPrograms");
if (! progsdir.exists() && olddir.exists())
{
progsdir.getParentDirectory().createDirectory();
olddir.copyDirectoryTo (progsdir);
}

// restore recents
const auto recentList = DataPath::applicationDataDir().getChildFile ("RecentFiles.txt");
if (recentList.existsAsFile())
{
Expand Down
4 changes: 0 additions & 4 deletions src/engine/AudioEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@ class AudioEngine::Private : public AudioIODeviceCallback,
ScopedLock lockMidiOut (engine.world.getMidiEngine().getMidiOutputLock());
if (auto* const midiOut = engine.world.getMidiEngine().getDefaultMidiOutput())
{
#if defined (EL_PRO)
if (sendMidiClockToInput.get() != 1 && generateMidiClock.get() == 1)
{
if (wasPlaying != transport.isPlaying())
Expand All @@ -526,7 +525,6 @@ class AudioEngine::Private : public AudioIODeviceCallback,
midiClockMaster.setTempo (transport.getTempo());
midiClockMaster.render (incomingMidi, numSamples);
}
#endif

const double delayMs = midiOutLatency.get();
if (! incomingMidi.isEmpty())
Expand All @@ -552,7 +550,6 @@ class AudioEngine::Private : public AudioIODeviceCallback,

if (shouldProcess)
{
#if defined (EL_PRO)
if (generateMidiClock.get() == 1 && sendMidiClockToInput.get() == 1)
{
if (wasPlaying != transport.isPlaying())
Expand All @@ -570,7 +567,6 @@ class AudioEngine::Private : public AudioIODeviceCallback,
midiClockMaster.setTempo (static_cast<double> (transport.getTempo()));
midiClockMaster.render (midi, numSamples);
}
#endif

if (currentGraph.get() != graphs.getCurrentGraphIndex())
graphs.setCurrentGraph (currentGraph.get());
Expand Down
2 changes: 1 addition & 1 deletion src/engine/GraphPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{
d.name = getName();
d.fileOrIdentifier = portType.getURI();
d.uid = d.fileOrIdentifier.hashCode();
d.uniqueId = d.fileOrIdentifier.hashCode();
d.category = "Ports";
d.pluginFormatName = "Internal";
d.manufacturerName = "Element Project";
Expand Down
4 changes: 2 additions & 2 deletions src/engine/GraphProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ void GraphProcessor::setStateInformation (const void* /*data*/, int /*sizeInByte
void GraphProcessor::fillInPluginDescription (PluginDescription& d) const
{
d.name = getName();
d.uid = d.name.hashCode();
d.uniqueId = d.name.hashCode();
d.category = "Graphs";
d.pluginFormatName = "Internal";
d.manufacturerName = "Kushview, LLC";
Expand Down Expand Up @@ -1575,7 +1575,7 @@ const String GraphProcessor::AudioGraphIOProcessor::getName() const
void GraphProcessor::AudioGraphIOProcessor::fillInPluginDescription (PluginDescription& d) const
{
d.name = getName();
d.uid = d.name.hashCode();
d.uniqueId = d.name.hashCode();
d.category = "I/O Devices";
d.pluginFormatName = "Internal";
d.manufacturerName = "Element";
Expand Down
14 changes: 0 additions & 14 deletions src/engine/InternalFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,18 @@ InternalFormat::InternalFormat (AudioEngine& e, MidiEngine& me)
IOP p (IOP::audioOutputNode);
p.fillInPluginDescription (audioOutDesc);
}

{
IOP p (IOP::audioInputNode);
p.fillInPluginDescription (audioInDesc);
}

{
IOP p (IOP::midiOutputNode);
p.fillInPluginDescription (midiOutDesc);
}

{
IOP p (IOP::midiInputNode);
p.fillInPluginDescription (midiInDesc);
}
#if defined (EL_PRO) || defined (EL_SOLO)
{
PlaceholderProcessor p;
p.fillInPluginDescription (placeholderDesc);
Expand All @@ -88,7 +84,6 @@ InternalFormat::InternalFormat (AudioEngine& e, MidiEngine& me)
MidiDeviceProcessor out (false, midi);
out.fillInPluginDescription (midiOutputDeviceDesc);
}
#endif
}

AudioPluginInstance* InternalFormat::instantiatePlugin (const PluginDescription& desc, double, int)
Expand All @@ -109,8 +104,6 @@ AudioPluginInstance* InternalFormat::instantiatePlugin (const PluginDescription&
{
return new IOP (IOP::midiOutputNode);
}

#if defined (EL_PRO) || defined (EL_SOLO)
else if (desc.fileOrIdentifier == "element.midiInputDevice")
{
return new MidiDeviceProcessor (true, midi);
Expand All @@ -123,7 +116,6 @@ AudioPluginInstance* InternalFormat::instantiatePlugin (const PluginDescription&
{
return new PlaceholderProcessor();
}
#endif // EL_FREE

return nullptr;
}
Expand Down Expand Up @@ -339,8 +331,6 @@ AudioPluginInstance* ElementAudioPluginFormat::instantiatePlugin (const PluginDe
base = new FreqSplitterProcessor();
else if (desc.fileOrIdentifier == EL_INTERNAL_ID_COMPRESSOR)
base = new CompressorProcessor();

#if defined (EL_PRO)
else if (desc.fileOrIdentifier == EL_INTERNAL_ID_GRAPH)
base = new SubGraphProcessor();
else if (desc.fileOrIdentifier == EL_INTERNAL_ID_AUDIO_MIXER)
Expand All @@ -349,16 +339,12 @@ AudioPluginInstance* ElementAudioPluginFormat::instantiatePlugin (const PluginDe
base = new ChannelizeProcessor();
else if (desc.fileOrIdentifier == EL_INTERNAL_ID_MIDI_CHANNEL_MAP)
base = new MidiChannelMapProcessor();
#endif // EL_PRO

#if defined (EL_PRO) || defined (EL_SOLO)
else if (desc.fileOrIdentifier == EL_INTERNAL_ID_AUDIO_FILE_PLAYER)
base = new AudioFilePlayerNode();
else if (desc.fileOrIdentifier == EL_INTERNAL_ID_MEDIA_PLAYER)
base = new MediaPlayerProcessor();
else if (desc.fileOrIdentifier == EL_INTERNAL_ID_PLACEHOLDER)
base = new PlaceholderProcessor();
#endif // EL_PRO || EL_SOLO

return base != nullptr ? base.release() : nullptr;
}
Expand Down
68 changes: 40 additions & 28 deletions src/engine/NodeObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ File NodeObject::getMidiProgramFile (int program) const
std::stringstream stream;
stream << uids.toStdString() << "_" << std::setfill('0') << std::setw(3) << program << ".eln";
String fileName = stream.str();
const File file (DataPath::applicationDataDir().getChildFile("NodeMidiPrograms").getChildFile(fileName));
const File file (DataPath::defaultGlobalMidiProgramsDir().getChildFile (fileName));
if (! file.getParentDirectory().exists())
file.getParentDirectory().createDirectory();
return file;
Expand Down Expand Up @@ -780,44 +780,49 @@ struct ChannelConnectionMap
void NodeObject::PortResetter::handleAsyncUpdate()
{
auto* const graph = node.getParentGraph();
jassert (graph != nullptr);

// Cache existing connections by channel.
OwnedArray<ChannelConnectionMap> sources, destinations;
for (int i = graph->getNumConnections(); --i >= 0;)
if (graph != nullptr)
{
const auto* const c = graph->getConnection (i);
if (c->destNode == node.nodeId)
// Cache existing connections by channel.
for (int i = graph->getNumConnections(); --i >= 0;)
{
auto* m = sources.add (new ChannelConnectionMap());
m->type = node.getPortType (c->destPort);
m->channel = node.getChannelPort (c->destPort);
m->otherNodeId = c->sourceNode;
m->otherNodePort = c->sourcePort;
}
else if (c->sourceNode == node.nodeId)
{
auto* d = destinations.add (new ChannelConnectionMap());
d->type = node.getPortType (c->sourcePort);
d->channel = node.getChannelPort (c->sourcePort);
d->otherNodeId = c->destNode;
d->otherNodePort = c->destPort;
const auto* const c = graph->getConnection (i);
if (c->destNode == node.nodeId)
{
auto* m = sources.add (new ChannelConnectionMap());
m->type = node.getPortType (c->destPort);
m->channel = node.getChannelPort (c->destPort);
m->otherNodeId = c->sourceNode;
m->otherNodePort = c->sourcePort;
}
else if (c->sourceNode == node.nodeId)
{
auto* d = destinations.add (new ChannelConnectionMap());
d->type = node.getPortType (c->sourcePort);
d->channel = node.getChannelPort (c->sourcePort);
d->otherNodeId = c->destNode;
d->otherNodePort = c->destPort;
}
}
}

node.resetPorts();

// Re-apply connections by channel
for (const auto* ccs : sources) {
graph->addConnection (ccs->otherNodeId, ccs->otherNodePort, node.nodeId,
node.getPortForChannel (ccs->type, ccs->channel, true));
}
if (graph != nullptr)
{
// Re-apply connections by channel
for (const auto* ccs : sources) {
graph->addConnection (ccs->otherNodeId, ccs->otherNodePort, node.nodeId,
node.getPortForChannel (ccs->type, ccs->channel, true));
}

for (const auto* dss : destinations) {
graph->addConnection (node.nodeId, node.getPortForChannel (dss->type, dss->channel, false),
dss->otherNodeId, dss->otherNodePort);
for (const auto* dss : destinations) {
graph->addConnection (node.nodeId, node.getPortForChannel (dss->type, dss->channel, false),
dss->otherNodeId, dss->otherNodePort);
}
graph->removeIllegalConnections();
}
graph->removeIllegalConnections();

// notify others
node.portsChanged();
Expand All @@ -829,6 +834,13 @@ void NodeObject::triggerPortReset()
portResetter.triggerAsyncUpdate();
}

void NodeObject::triggerPortReset (bool async)
{
triggerPortReset();
if (! async)
portResetter.handleUpdateNowIfNeeded();
}

//=========================================================================
int NodeObject::getLatencySamples() const
{
Expand Down
3 changes: 2 additions & 1 deletion src/engine/NodeObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ class NodeObject : public ReferenceCountedObject

//==========================================================================
void triggerPortReset();

void triggerPortReset (bool async);

kv::PortList ports;
ValueTree metadata;

Expand Down
Loading

0 comments on commit c59e477

Please sign in to comment.