Skip to content

Commit

Permalink
Files and Data structures in place for missing resolution
Browse files Browse the repository at this point in the history
1. Add missing resolution headers, workitem objects, streaming,
   messages, and ui screen
2. Implement a version of that which sends a structured readonly
   list of missing workitems to the UI on startup
3. Implement a screen which does a read only render of that structure

Still no "resolve" button. That's next, but maybe not today
  • Loading branch information
baconpaul committed Sep 25, 2024
1 parent b9280cf commit 72691c5
Show file tree
Hide file tree
Showing 19 changed files with 455 additions and 33 deletions.
2 changes: 2 additions & 0 deletions src-ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ add_library(${PROJECT_NAME} STATIC
app/edit-screen/components/mapping-pane/ZoneLayoutDisplay.cpp
app/edit-screen/components/mapping-pane/ZoneLayoutKeyboard.cpp

app/missing-resolution/MissingResolutionScreen.cpp

app/mixer-screen/MixerScreen.cpp
app/mixer-screen/components/BusPane.cpp
app/mixer-screen/components/ChannelStrip.cpp
Expand Down
7 changes: 7 additions & 0 deletions src-ui/app/SCXTEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ namespace play_screen
{
struct PlayScreen;
}
namespace missing_resolution
{
struct MissingResolutionScreen;
}
namespace other_screens
{
struct WelcomeScreen;
Expand Down Expand Up @@ -142,6 +146,7 @@ struct SCXTEditor : sst::jucegui::components::WindowPanel, juce::DragAndDropCont
std::unique_ptr<other_screens::AboutScreen> aboutScreen;
std::unique_ptr<other_screens::WelcomeScreen> welcomeScreen;
std::unique_ptr<other_screens::LogScreen> logScreen;
std::unique_ptr<missing_resolution::MissingResolutionScreen> missingResolutionScreen;

std::unique_ptr<sst::jucegui::components::ToolTip> toolTip;

Expand Down Expand Up @@ -243,6 +248,8 @@ struct SCXTEditor : sst::jucegui::components::WindowPanel, juce::DragAndDropCont
void onMacroFullState(const scxt::messaging::client::macroFullState_t &);
void onMacroValue(const scxt::messaging::client::macroValue_t &);

void onMissingResolutionWorkItemList(const std::vector<engine::MissingResolutionWorkItem> &);

// Originate client to serialization messages
void doSelectionAction(const selection::SelectionManager::ZoneAddress &, bool selecting,
bool distinct, bool asLead);
Expand Down
7 changes: 6 additions & 1 deletion src-ui/app/editor-impl/SCXTEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include "melatonin_inspector/melatonin_inspector.h"
#endif

#include "SCXTJuceLookAndFeel.h"

#include "app/SCXTEditor.h"

#include "app/play-screen/PlayScreen.h"
Expand All @@ -43,7 +45,7 @@
#include "app/other-screens/AboutScreen.h"
#include "app/other-screens/LogScreen.h"
#include "app/other-screens/WelcomeScreen.h"
#include "SCXTJuceLookAndFeel.h"
#include "app/missing-resolution/MissingResolutionScreen.h"
#include "sst/jucegui/components/ToolTip.h"
#include <sst/jucegui/components/DiscreteParamMenuBuilder.h>

Expand Down Expand Up @@ -124,6 +126,9 @@ SCXTEditor::SCXTEditor(messaging::MessageController &e, infrastructure::Defaults
logScreen = std::make_unique<other_screens::LogScreen>(this);
addChildComponent(*logScreen);

missingResolutionScreen = std::make_unique<missing_resolution::MissingResolutionScreen>(this);
addChildComponent(*missingResolutionScreen);

setStyle(style());

auto zfi = defaultsProvider.getUserDefaultValue(infrastructure::DefaultKeys::zoomLevel, 100);
Expand Down
21 changes: 21 additions & 0 deletions src-ui/app/editor-impl/SCXTEditorResponseHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,4 +415,25 @@ void SCXTEditor::onActivityNotification(
// SCLOG((idx == 1 ? "Open" : (idx == 0 ? "Close" : "Update")) << " [" << msg << "]");
SCLOG_ONCE("Update activity messages currently ignored");
}

void SCXTEditor::onMissingResolutionWorkItemList(
const std::vector<engine::MissingResolutionWorkItem> &items)
{
for (const auto &wi : items)
{
SCLOG("Missing resolution work item");
SCLOG(" path : " << wi.path.u8string());
SCLOG(" zone : " << wi.address);
SCLOG(" var : " << wi.variant);
SCLOG(" md5 : " << wi.md5sum);
}

if (!items.empty())
{
missingResolutionScreen->setWorkItemList(items);
missingResolutionScreen->setBounds(getLocalBounds());
missingResolutionScreen->setVisible(true);
missingResolutionScreen->toFront(true);
}
}
} // namespace scxt::ui::app
96 changes: 96 additions & 0 deletions src-ui/app/missing-resolution/MissingResolutionScreen.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* Shortcircuit XT - a Surge Synth Team product
*
* A fully featured creative sampler, available as a standalone
* and plugin for multiple platforms.
*
* Copyright 2019 - 2024, Various authors, as described in the github
* transaction log.
*
* ShortcircuitXT is released under the Gnu General Public Licence
* V3 or later (GPL-3.0-or-later). The license is found in the file
* "LICENSE" in the root of this repository or at
* https://www.gnu.org/licenses/gpl-3.0.en.html
*
* Individual sections of code which comprises ShortcircuitXT in this
* repository may also be used under an MIT license. Please see the
* section "Licensing" in "README.md" for details.
*
* ShortcircuitXT is inspired by, and shares code with, the
* commercial product Shortcircuit 1 and 2, released by VemberTech
* in the mid 2000s. The code for Shortcircuit 2 was opensourced in
* 2020 at the outset of this project.
*
* All source for ShortcircuitXT is available at
* https://github.com/surge-synthesizer/shortcircuit-xt
*/

#include "MissingResolutionScreen.h"

#include <sst/jucegui/components/NamedPanel.h>
#include <sst/jucegui/components/TextPushButton.h>

namespace scxt::ui::app::missing_resolution
{

struct Contents : juce::Component, HasEditor
{
MissingResolutionScreen *parent{nullptr};
std::unique_ptr<sst::jucegui::components::TextPushButton> okButton;
Contents(MissingResolutionScreen *p, SCXTEditor *e) : parent(p), HasEditor(e)
{
okButton = std::make_unique<sst::jucegui::components::TextPushButton>();
okButton->setLabel("OK");
okButton->setOnCallback([w = juce::Component::SafePointer(parent)]() {
if (!w)
return;
w->setVisible(false);
});
addAndMakeVisible(*okButton);
}

void resized() override
{
auto b = getLocalBounds();
b = b.withTrimmedTop(b.getHeight() - 22).withTrimmedLeft(b.getWidth() - 100);
okButton->setBounds(b);
}
void paint(juce::Graphics &g) override
{
int bxH = 40;
auto bx = getLocalBounds().reduced(2, 2).withHeight(bxH);
for (const auto &i : parent->workItems)
{
auto bd = bx.reduced(2, 2);
g.setFont(editor->themeApplier.interBoldFor(14));
g.setColour(editor->themeColor(theme::ColorMap::generic_content_high));
g.drawText(i.path.u8string(), bd, juce::Justification::topLeft);

g.setFont(editor->themeApplier.interMediumFor(12));
g.setColour(editor->themeColor(theme::ColorMap::generic_content_medium));
g.drawText(i.md5sum, bd, juce::Justification::bottomLeft);

g.setColour(editor->themeColor(theme::ColorMap::generic_content_low));
g.drawRect(bx, 1);

bx = bx.translated(0, bxH + 4);
}
}
};

MissingResolutionScreen::MissingResolutionScreen(SCXTEditor *e) : HasEditor(e)
{
auto ct = std::make_unique<sst::jucegui::components::NamedPanel>("Missing Sample Resolution");
addAndMakeVisible(*ct);

auto contents = std::make_unique<Contents>(this, e);
ct->setContentAreaComponent(std::move(contents));
contentsArea = std::move(ct);
}

void MissingResolutionScreen::resized()
{
contentsArea->setBounds(getLocalBounds().reduced(100, 80));
}

} // namespace scxt::ui::app::missing_resolution
62 changes: 62 additions & 0 deletions src-ui/app/missing-resolution/MissingResolutionScreen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Shortcircuit XT - a Surge Synth Team product
*
* A fully featured creative sampler, available as a standalone
* and plugin for multiple platforms.
*
* Copyright 2019 - 2024, Various authors, as described in the github
* transaction log.
*
* ShortcircuitXT is released under the Gnu General Public Licence
* V3 or later (GPL-3.0-or-later). The license is found in the file
* "LICENSE" in the root of this repository or at
* https://www.gnu.org/licenses/gpl-3.0.en.html
*
* Individual sections of code which comprises ShortcircuitXT in this
* repository may also be used under an MIT license. Please see the
* section "Licensing" in "README.md" for details.
*
* ShortcircuitXT is inspired by, and shares code with, the
* commercial product Shortcircuit 1 and 2, released by VemberTech
* in the mid 2000s. The code for Shortcircuit 2 was opensourced in
* 2020 at the outset of this project.
*
* All source for ShortcircuitXT is available at
* https://github.com/surge-synthesizer/shortcircuit-xt
*/

#ifndef SCXT_SRC_UI_APP_MISSING_RESOLUTION_MISSINGRESOLUTIONSCREEN_H
#define SCXT_SRC_UI_APP_MISSING_RESOLUTION_MISSINGRESOLUTIONSCREEN_H

#include "app/HasEditor.h"
#include <juce_gui_basics/juce_gui_basics.h>
#include <vector>
#include "engine/missing_resolution.h"

namespace scxt::ui::app::missing_resolution
{

struct MissingResolutionScreen : juce::Component, HasEditor
{
std::unique_ptr<juce::Component> contentsArea;
MissingResolutionScreen(SCXTEditor *e);

void paint(juce::Graphics &g) override
{
g.fillAll(juce::Colour(0x90, 0x90, 0x90).withAlpha(0.3f));
}

void resized() override;
void mouseUp(const juce::MouseEvent &) override { setVisible(false); }

void setWorkItemList(const std::vector<engine::MissingResolutionWorkItem> &l)
{
workItems = l;
repaint();
}

std::vector<engine::MissingResolutionWorkItem> workItems;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MissingResolutionScreen);
};
} // namespace scxt::ui::app::missing_resolution
#endif // MISSINGRESOLUTIONSCREEN_H
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ add_library(${PROJECT_NAME} STATIC
engine/part.cpp
engine/patch.cpp
engine/memory_pool.cpp
engine/missing_resolution.cpp
engine/bus.cpp
engine/macros.cpp

Expand Down
8 changes: 8 additions & 0 deletions src/engine/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include <mutex>
#include "messaging/client/client_serial.h"
#include "feature_enums.h"
#include "missing_resolution.h"

namespace scxt::engine
{
Expand Down Expand Up @@ -1083,6 +1084,13 @@ void Engine::sendFullRefreshToClient() const
getSelectionManager()->sendSelectedZonesToClient();
getSelectionManager()->sendSelectedPartMacrosToClient();
getSelectionManager()->sendOtherTabsSelectionToClient();

auto missing = collectMissingResolutionWorkItems(*this);
if (!missing.empty())
{
serializationSendToClient(messaging::client::s2c_send_missing_resolution_workitem_list,
missing, *(getMessageController()));
}
}

void Engine::clearAll()
Expand Down
33 changes: 28 additions & 5 deletions src/engine/feature_enums.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
//
// Created by Paul Walker on 9/24/24.
//
/*
* Shortcircuit XT - a Surge Synth Team product
*
* A fully featured creative sampler, available as a standalone
* and plugin for multiple platforms.
*
* Copyright 2019 - 2024, Various authors, as described in the github
* transaction log.
*
* ShortcircuitXT is released under the Gnu General Public Licence
* V3 or later (GPL-3.0-or-later). The license is found in the file
* "LICENSE" in the root of this repository or at
* https://www.gnu.org/licenses/gpl-3.0.en.html
*
* Individual sections of code which comprises ShortcircuitXT in this
* repository may also be used under an MIT license. Please see the
* section "Licensing" in "README.md" for details.
*
* ShortcircuitXT is inspired by, and shares code with, the
* commercial product Shortcircuit 1 and 2, released by VemberTech
* in the mid 2000s. The code for Shortcircuit 2 was opensourced in
* 2020 at the outset of this project.
*
* All source for ShortcircuitXT is available at
* https://github.com/surge-synthesizer/shortcircuit-xt
*/

#ifndef FEATURE_ENUMS_H
#define FEATURE_ENUMS_H
#ifndef SCXT_SRC_ENGINE_FEATURE_ENUMS_H
#define SCXT_SRC_ENGINE_FEATURE_ENUMS_H

namespace scxt::engine
{
Expand Down
69 changes: 69 additions & 0 deletions src/engine/missing_resolution.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Shortcircuit XT - a Surge Synth Team product
*
* A fully featured creative sampler, available as a standalone
* and plugin for multiple platforms.
*
* Copyright 2019 - 2024, Various authors, as described in the github
* transaction log.
*
* ShortcircuitXT is released under the Gnu General Public Licence
* V3 or later (GPL-3.0-or-later). The license is found in the file
* "LICENSE" in the root of this repository or at
* https://www.gnu.org/licenses/gpl-3.0.en.html
*
* Individual sections of code which comprises ShortcircuitXT in this
* repository may also be used under an MIT license. Please see the
* section "Licensing" in "README.md" for details.
*
* ShortcircuitXT is inspired by, and shares code with, the
* commercial product Shortcircuit 1 and 2, released by VemberTech
* in the mid 2000s. The code for Shortcircuit 2 was opensourced in
* 2020 at the outset of this project.
*
* All source for ShortcircuitXT is available at
* https://github.com/surge-synthesizer/shortcircuit-xt
*/

#include "missing_resolution.h"

namespace scxt::engine
{
std::vector<MissingResolutionWorkItem> collectMissingResolutionWorkItems(const Engine &e)
{
std::vector<MissingResolutionWorkItem> res;

int pidx{0};
for (const auto &p : *(e.getPatch()))
{
int gidx{0};
for (const auto &g : *p)
{
int zidx{0};
for (const auto &z : *g)
{
int idx{0};
for (const auto &v : z->variantData.variants)
{
if (v.active && z->samplePointers[idx]->isMissingPlaceholder)
{
auto &sm = z->samplePointers[idx];
MissingResolutionWorkItem wf;
wf.address = {pidx, gidx, zidx};
wf.variant = idx;
wf.path = sm->mFileName;
wf.md5sum = sm->md5Sum;
res.push_back(wf);
}
idx++;
}
zidx++;
}
gidx++;
}
pidx++;
}

return res;
}
} // namespace scxt::engine
Loading

0 comments on commit 72691c5

Please sign in to comment.