Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions include/element/session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ class Session : public Model,
Session();
friend class Context;

/** Set a property. */
inline void setProperty (const juce::Identifier& prop, const juce::var& val) { objectData.setProperty (prop, val, nullptr); }

friend class juce::ValueTree;
virtual void valueTreePropertyChanged (juce::ValueTree& treeWhosePropertyHasChanged, const juce::Identifier& property);
virtual void valueTreeChildAdded (juce::ValueTree& parentTree, juce::ValueTree& childWhichHasBeenAdded);
Expand Down
12 changes: 6 additions & 6 deletions include/element/ui/preferences.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

#include <element/juce/gui_basics.hpp>

#define EL_GENERAL_SETTINGS_NAME "General"
#define EL_AUDIO_SETTINGS_NAME "Audio"
#define EL_MIDI_SETTINGS_NAME "MIDI"
#define EL_OSC_SETTINGS_NAME "OSC"
#define EL_PLUGINS_PREFERENCE_NAME "Plugins"
#define EL_REPOSITORY_PREFERENCE_NAME "Updates"
#define ELEMENT_GENERAL_SETTINGS_NAME "General"
#define ELEMENT_AUDIO_SETTINGS_NAME "Audio"
#define ELEMENT_MIDI_SETTINGS_NAME "MIDI"
#define ELEMENT_OSC_SETTINGS_NAME "OSC"
#define ELEMENT_PLUGINS_PREFERENCE_NAME "Plugins"
#define ELEMENT_REPOSITORY_PREFERENCE_NAME "Updates"

namespace element {

Expand Down
15 changes: 14 additions & 1 deletion src/el/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// @classmod el.Session
// @pragma nostrip

#include <algorithm>

#include <element/element.h>
#include <element/node.hpp>
#include <element/session.hpp>
Expand All @@ -31,14 +33,25 @@ int luaopen_el_Session (lua_State* L)
: std::shared_ptr<Node>();
},

/// The sessions name.
/// The session's name.
// @tfield string Session.name
// @within Attributes
"name", sol::property (
[](Session& self) { return self.getName().toStdString(); },
[](Session& self, const char* name) { self.setName (name); }
),

/// The session's current tempo.
// @tfield string Session.tempo
// @within Attributes
"tempo", sol::property (
[](Session& self) { return self.getProperty(tags::tempo).toString().toStdString(); },
[](Session& self, double tempo) {
tempo = std::clamp (tempo, 20.0, 999.0);
self.setProperty (tags::tempo, tempo);
}
),

/// Convert to an XML string.
// @function Session:toXmlString
// @treturn string XML string of the session data.
Expand Down
10 changes: 5 additions & 5 deletions src/nodes/midisetlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ void MidiSetListProcessor::maybeSendTempoAndPosition (int program)
if (auto* entry = entries[program])
{
if (entry->tempo >= 20.0)
s->getValueTree().setProperty (tags::tempo, entry->tempo, nullptr);
s->setProperty (tags::tempo, entry->tempo);

if (entry->tsNum > 0 && entry->tsDen > 0)
{
const int div = BeatType::fromDivisor (entry->tsDen); // raw denom -> BeatType enum
s->getValueTree().setProperty (tags::beatsPerBar, entry->tsNum, nullptr);
s->getValueTree().setProperty (tags::beatDivisor, div, nullptr);
const auto beatType = BeatType::fromDivisor (entry->tsDen);
s->setProperty (tags::beatsPerBar, entry->tsNum);
s->setProperty (tags::beatDivisor, beatType);
if (auto e = _context.audio())
e->setMeter (entry->tsNum, div);
e->setMeter (entry->tsNum, beatType);
}

if (auto e = _context.audio())
Expand Down
2 changes: 1 addition & 1 deletion src/services/deviceservice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#pragma once

#include <element/juce/audio_devices.hpp>
#include <element/services.hpp>
#include <element/signals.hpp>
#include <element/juce/audio_devices.hpp>

namespace element {

Expand Down
6 changes: 3 additions & 3 deletions src/services/engineservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

#include <element/context.hpp>
#include <element/devices.hpp>
#include <element/engine.hpp>
#include <element/graph.hpp>
#include <element/node.hpp>
#include <element/plugins.hpp>
#include <element/services.hpp>
#include <element/settings.hpp>
#include <element/ui.hpp>

#include "engine/graphmanager.hpp"
#include "nodes/mididevice.hpp"
#include "engine/rootgraph.hpp"
#include <element/engine.hpp>
#include <element/ui.hpp>
#include "nodes/mididevice.hpp"

#define ELEMENT_TRACE_SESSION_LOAD 0

Expand Down
10 changes: 4 additions & 6 deletions src/services/guiservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include <element/engine.hpp>
#include <element/services.hpp>
#include <element/settings.hpp>
#include <element/version.hpp>

#include <element/ui.hpp>
#include <element/ui/commands.hpp>
#include <element/ui/content.hpp>
Expand All @@ -16,8 +14,8 @@
#include <element/ui/standard.hpp>
#include <element/ui/style.hpp>
#include <element/ui/updater.hpp>
#include <element/version.hpp>

#include "appinfo.hpp"
#include "auth.hpp"
#include "engine/midipanic.hpp"
#include "messages.hpp"
Expand All @@ -30,8 +28,8 @@
#include "ui/virtualkeyboardview.hpp"
#include "ui/windowmanager.hpp"

#ifndef EL_USE_SYSTEM_TRAY
#define EL_USE_SYSTEM_TRAY 1
#ifndef ELEMENT_USE_SYSTEM_TRAY
#define ELEMENT_USE_SYSTEM_TRAY 1
#endif

namespace element {
Expand Down Expand Up @@ -1124,7 +1122,7 @@ void GuiService::refreshSystemTray()
{
// stabilize systray
auto& settings = context().settings();
#if EL_USE_SYSTEM_TRAY
#if ELEMENT_USE_SYSTEM_TRAY
SystemTray::setEnabled (settings.isSystrayEnabled());
#else
juce::ignoreUnused (settings);
Expand Down
16 changes: 9 additions & 7 deletions src/services/mappingservice.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// Copyright 2023 Kushview, LLC <info@kushview.net>
// SPDX-License-Identifier: GPL-3.0-or-later

#include "services/mappingservice.hpp"
#include "services/deviceservice.hpp"
#include "services/sessionservice.hpp"
#include <element/ui.hpp>
#include "engine/mappingengine.hpp"
#include <element/juce/audio_devices.hpp>

#include <element/context.hpp>
#include <element/session.hpp>
#include <element/signals.hpp>
#include <element/juce/audio_devices.hpp>
#include <element/ui.hpp>

#include "engine/mappingengine.hpp"
#include "services/deviceservice.hpp"
#include "services/mappingservice.hpp"
#include "services/sessionservice.hpp"

using namespace juce;

Expand Down Expand Up @@ -349,7 +351,7 @@ void MappingService::tapTempo()
{
if (auto bpm = context().mapping().tapTempo (Time::getMillisecondCounterHiRes()))
if (auto session = context().session())
session->data().setProperty (tags::tempo, *bpm, nullptr);
session->setProperty (tags::tempo, *bpm);
}

void MappingService::learnTempo()
Expand Down
4 changes: 2 additions & 2 deletions src/services/mappingservice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

#pragma once

#include <element/services.hpp>
#include <element/processor.hpp>
#include <element/midimapping.hpp>
#include <element/processor.hpp>
#include <element/services.hpp>
#include <element/signals.hpp>

namespace element {
Expand Down
11 changes: 5 additions & 6 deletions src/services/oscservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@

#include <element/juce/osc.hpp>

#include <element/ui/commands.hpp>

#include <element/context.hpp>
#include <element/devices.hpp>
#include <element/settings.hpp>
#include <element/ui/commands.hpp>

#include "services/oscservice.hpp"

#define EL_OSC_ADDRESS_COMMAND "/element/command"
#define EL_OSC_ADDRESS_ENGINE "/element/engine"
#define ELEMENT_OSC_ADDRESS_COMMAND "/element/command"
#define ELEMENT_OSC_ADDRESS_ENGINE "/element/engine"

using namespace juce;

Expand Down Expand Up @@ -137,10 +136,10 @@ class OSCService::Impl
return;

application.reset (new CommandOSCListener (owner.context()));
receiver.addListener (application.get(), EL_OSC_ADDRESS_COMMAND);
receiver.addListener (application.get(), ELEMENT_OSC_ADDRESS_COMMAND);

engine.reset (new EngineOSCListener (owner.context()));
receiver.addListener (engine.get(), EL_OSC_ADDRESS_ENGINE);
receiver.addListener (engine.get(), ELEMENT_OSC_ADDRESS_ENGINE);

listenersReady = true;
}
Expand Down
8 changes: 4 additions & 4 deletions src/services/presetservice.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Copyright 2023 Kushview, LLC <info@kushview.net>
// SPDX-License-Identifier: GPL-3.0-or-later

#include <element/context.hpp>
#include <element/datapath.hpp>
#include <element/session.hpp>
#include <element/ui.hpp>
#include <element/ui/content.hpp>
#include <element/session.hpp>
#include "presetmanager.hpp"
#include <element/context.hpp>

#include <element/datapath.hpp>
#include "presetmanager.hpp"
#include "services/presetservice.hpp"

using juce::String;
Expand Down
6 changes: 3 additions & 3 deletions src/services/sessionservice.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright 2023 Kushview, LLC <info@kushview.net>
// SPDX-License-Identifier: GPL-3.0-or-later

#include <element/context.hpp>
#include <element/engine.hpp>
#include <element/graph.hpp>
#include <element/node.hpp>
#include <element/context.hpp>
#include <element/settings.hpp>
#include <element/services.hpp>
#include <element/engine.hpp>
#include <element/settings.hpp>
#include <element/ui.hpp>
#include <element/ui/content.hpp>

Expand Down
1 change: 0 additions & 1 deletion src/ui/buttons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <element/ui/style.hpp>
#include <element/node.hpp>

// #include "ElementApp.h"
#include "ui/icons.hpp"
#include "tempo.hpp"

Expand Down
4 changes: 2 additions & 2 deletions src/ui/emptyview.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class EmptyContentView : public ContentView
setName ("EmptyView");
}

inline void paint (Graphics& g) override
inline void paint (juce::Graphics& g) override
{
g.fillAll (Colors::contentBackgroundColor);
g.setColour (Colors::textColor);
Expand All @@ -27,7 +27,7 @@ class EmptyContentView : public ContentView
#else
const String msg ("Session is empty.\nPress Shift+Ctl+N to add a graph.");
#endif
g.drawFittedText (msg, 0, 0, getWidth(), getHeight(), Justification::centred, 2);
g.drawFittedText (msg, 0, 0, getWidth(), getHeight(), juce::Justification::centred, 2);
}
};

Expand Down
24 changes: 12 additions & 12 deletions src/ui/preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1394,28 +1394,28 @@ void Preferences::addPage (const String& name)

Component* Preferences::createPageForName (const String& name)
{
if (name == EL_GENERAL_SETTINGS_NAME)
if (name == ELEMENT_GENERAL_SETTINGS_NAME)
{
return new GeneralSettingsPage (_context, _ui);
}
else if (name == EL_AUDIO_SETTINGS_NAME)
else if (name == ELEMENT_AUDIO_SETTINGS_NAME)
{
return new AudioSettingsComponent (_context.devices());
}
else if (name == EL_PLUGINS_PREFERENCE_NAME)
else if (name == ELEMENT_PLUGINS_PREFERENCE_NAME)
{
return new PluginSettingsComponent (_context);
}
else if (name == EL_MIDI_SETTINGS_NAME)
else if (name == ELEMENT_MIDI_SETTINGS_NAME)
{
return new MidiSettingsPage (_context);
}
else if (name == EL_OSC_SETTINGS_NAME)
else if (name == ELEMENT_OSC_SETTINGS_NAME)
{
return new OSCSettingsPage (_context, _ui);
}
#if ELEMENT_UPDATER
else if (name == EL_REPOSITORY_PREFERENCE_NAME)
else if (name == ELEMENT_REPOSITORY_PREFERENCE_NAME)
{
return new UpdatesSettingsPage (_context);
}
Expand All @@ -1428,17 +1428,17 @@ void Preferences::addDefaultPages()
if (pageList->getNumRows() > 0)
return;

addPage (EL_GENERAL_SETTINGS_NAME);
addPage (EL_AUDIO_SETTINGS_NAME);
addPage (EL_MIDI_SETTINGS_NAME);
addPage (ELEMENT_GENERAL_SETTINGS_NAME);
addPage (ELEMENT_AUDIO_SETTINGS_NAME);
addPage (ELEMENT_MIDI_SETTINGS_NAME);
#if ! ELEMENT_SE
addPage (EL_OSC_SETTINGS_NAME);
addPage (ELEMENT_OSC_SETTINGS_NAME);
#endif
#if ELEMENT_UPDATER
addPage (EL_REPOSITORY_PREFERENCE_NAME);
addPage (ELEMENT_REPOSITORY_PREFERENCE_NAME);
#endif

setPage (EL_GENERAL_SETTINGS_NAME);
setPage (ELEMENT_GENERAL_SETTINGS_NAME);
}

void Preferences::setPage (const String& name)
Expand Down
Loading