New upstream version 0.20.1+ds1
authorIOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org>
Thu, 24 Feb 2022 14:29:57 +0000 (15:29 +0100)
committerIOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org>
Thu, 24 Feb 2022 14:29:57 +0000 (15:29 +0100)
344 files changed:
CMakeLists.txt
ChangeLog
README.md
src/core/actions/action.h
src/core/actions/actionRecorder.cpp
src/core/actions/actionRecorder.h
src/core/actions/actions.cpp
src/core/actions/actions.h
src/core/channels/audioReceiver.cpp
src/core/channels/audioReceiver.h
src/core/channels/channel.cpp
src/core/channels/channel.h
src/core/channels/channelManager.cpp
src/core/channels/channelManager.h
src/core/channels/midiActionRecorder.cpp
src/core/channels/midiActionRecorder.h
src/core/channels/midiController.cpp
src/core/channels/midiController.h
src/core/channels/midiLearner.cpp
src/core/channels/midiLearner.h
src/core/channels/midiLighter.cpp
src/core/channels/midiLighter.h
src/core/channels/midiReceiver.cpp
src/core/channels/midiReceiver.h
src/core/channels/midiSender.cpp
src/core/channels/midiSender.h
src/core/channels/sampleActionRecorder.cpp
src/core/channels/sampleActionRecorder.h
src/core/channels/samplePlayer.cpp
src/core/channels/samplePlayer.h
src/core/channels/waveReader.cpp
src/core/channels/waveReader.h
src/core/conf.cpp
src/core/conf.h
src/core/const.h
src/core/engine.cpp
src/core/engine.h
src/core/eventDispatcher.h
src/core/graphics.cpp
src/core/graphics.h
src/core/idManager.cpp
src/core/idManager.h
src/core/init.cpp
src/core/init.h
src/core/jackTransport.cpp
src/core/jackTransport.h
src/core/kernelAudio.cpp
src/core/kernelAudio.h
src/core/kernelMidi.cpp
src/core/kernelMidi.h
src/core/metronome.cpp
src/core/metronome.h
src/core/midiDispatcher.cpp
src/core/midiDispatcher.h
src/core/midiEvent.cpp
src/core/midiEvent.h
src/core/midiLearnParam.cpp
src/core/midiLearnParam.h
src/core/midiMapper.cpp
src/core/midiMapper.h
src/core/mixer.cpp
src/core/mixer.h
src/core/mixerHandler.cpp
src/core/mixerHandler.h
src/core/model/mixer.cpp
src/core/model/mixer.h
src/core/model/model.cpp
src/core/model/model.h
src/core/model/recorder.cpp
src/core/model/recorder.h
src/core/model/sequencer.cpp
src/core/model/sequencer.h
src/core/model/storage.cpp
src/core/model/storage.h
src/core/patch.cpp
src/core/patch.h
src/core/plugins/plugin.cpp
src/core/plugins/plugin.h
src/core/plugins/pluginHost.cpp
src/core/plugins/pluginHost.h
src/core/plugins/pluginManager.cpp
src/core/plugins/pluginManager.h
src/core/plugins/pluginState.cpp
src/core/plugins/pluginState.h
src/core/quantizer.cpp
src/core/quantizer.h
src/core/range.h
src/core/recorder.cpp
src/core/recorder.h
src/core/resampler.cpp
src/core/resampler.h
src/core/ringBuffer.h
src/core/sequencer.cpp
src/core/sequencer.h
src/core/synchronizer.cpp
src/core/synchronizer.h
src/core/types.h
src/core/wave.cpp
src/core/wave.h
src/core/waveFx.cpp
src/core/waveFx.h
src/core/waveManager.cpp
src/core/waveManager.h
src/glue/actionEditor.cpp
src/glue/actionEditor.h
src/glue/channel.cpp
src/glue/channel.h
src/glue/config.cpp
src/glue/config.h
src/glue/events.cpp
src/glue/events.h
src/glue/io.cpp
src/glue/io.h
src/glue/layout.cpp
src/glue/layout.h
src/glue/main.cpp
src/glue/main.h
src/glue/plugin.cpp
src/glue/plugin.h
src/glue/recorder.cpp
src/glue/recorder.h
src/glue/sampleEditor.cpp
src/glue/sampleEditor.h
src/glue/storage.cpp
src/glue/storage.h
src/gui/dialogs/about.cpp
src/gui/dialogs/about.h
src/gui/dialogs/actionEditor/baseActionEditor.cpp
src/gui/dialogs/actionEditor/baseActionEditor.h
src/gui/dialogs/actionEditor/midiActionEditor.cpp
src/gui/dialogs/actionEditor/midiActionEditor.h
src/gui/dialogs/actionEditor/sampleActionEditor.cpp
src/gui/dialogs/actionEditor/sampleActionEditor.h
src/gui/dialogs/beatsInput.cpp
src/gui/dialogs/beatsInput.h
src/gui/dialogs/bpmInput.cpp
src/gui/dialogs/bpmInput.h
src/gui/dialogs/browser/browserBase.cpp
src/gui/dialogs/browser/browserBase.h
src/gui/dialogs/browser/browserDir.cpp
src/gui/dialogs/browser/browserDir.h
src/gui/dialogs/browser/browserLoad.cpp
src/gui/dialogs/browser/browserLoad.h
src/gui/dialogs/browser/browserSave.cpp
src/gui/dialogs/browser/browserSave.h
src/gui/dialogs/channelNameInput.cpp
src/gui/dialogs/channelNameInput.h
src/gui/dialogs/config.cpp
src/gui/dialogs/config.h
src/gui/dialogs/keyGrabber.cpp
src/gui/dialogs/keyGrabber.h
src/gui/dialogs/mainWindow.cpp
src/gui/dialogs/mainWindow.h
src/gui/dialogs/midiIO/midiInputBase.cpp
src/gui/dialogs/midiIO/midiInputBase.h
src/gui/dialogs/midiIO/midiInputChannel.cpp
src/gui/dialogs/midiIO/midiInputChannel.h
src/gui/dialogs/midiIO/midiInputMaster.cpp
src/gui/dialogs/midiIO/midiInputMaster.h
src/gui/dialogs/midiIO/midiOutputBase.cpp
src/gui/dialogs/midiIO/midiOutputBase.h
src/gui/dialogs/midiIO/midiOutputMidiCh.cpp
src/gui/dialogs/midiIO/midiOutputMidiCh.h
src/gui/dialogs/midiIO/midiOutputSampleCh.cpp
src/gui/dialogs/midiIO/midiOutputSampleCh.h
src/gui/dialogs/missingAssets.cpp [new file with mode: 0644]
src/gui/dialogs/missingAssets.h [new file with mode: 0644]
src/gui/dialogs/pluginChooser.cpp
src/gui/dialogs/pluginChooser.h
src/gui/dialogs/pluginList.cpp
src/gui/dialogs/pluginList.h
src/gui/dialogs/pluginWindow.cpp
src/gui/dialogs/pluginWindow.h
src/gui/dialogs/pluginWindowGUI.cpp
src/gui/dialogs/pluginWindowGUI.h
src/gui/dialogs/progress.cpp
src/gui/dialogs/progress.h
src/gui/dialogs/sampleEditor.cpp
src/gui/dialogs/sampleEditor.h
src/gui/dialogs/warnings.cpp
src/gui/dialogs/warnings.h
src/gui/dialogs/window.cpp
src/gui/dialogs/window.h
src/gui/dispatcher.cpp
src/gui/dispatcher.h
src/gui/drawing.cpp
src/gui/drawing.h
src/gui/elems/actionEditor/baseAction.cpp
src/gui/elems/actionEditor/baseAction.h
src/gui/elems/actionEditor/baseActionEditor.cpp
src/gui/elems/actionEditor/baseActionEditor.h
src/gui/elems/actionEditor/envelopeEditor.cpp
src/gui/elems/actionEditor/envelopeEditor.h
src/gui/elems/actionEditor/envelopePoint.cpp
src/gui/elems/actionEditor/envelopePoint.h
src/gui/elems/actionEditor/gridTool.cpp
src/gui/elems/actionEditor/gridTool.h
src/gui/elems/actionEditor/pianoItem.cpp
src/gui/elems/actionEditor/pianoItem.h
src/gui/elems/actionEditor/pianoRoll.cpp
src/gui/elems/actionEditor/pianoRoll.h
src/gui/elems/actionEditor/sampleAction.cpp
src/gui/elems/actionEditor/sampleAction.h
src/gui/elems/actionEditor/sampleActionEditor.cpp
src/gui/elems/actionEditor/sampleActionEditor.h
src/gui/elems/actionEditor/splitScroll.cpp
src/gui/elems/actionEditor/splitScroll.h
src/gui/elems/actionEditor/velocityEditor.cpp
src/gui/elems/actionEditor/velocityEditor.h
src/gui/elems/basics/box.cpp
src/gui/elems/basics/box.h
src/gui/elems/basics/boxtypes.cpp
src/gui/elems/basics/boxtypes.h
src/gui/elems/basics/browser.cpp [new file with mode: 0644]
src/gui/elems/basics/browser.h [new file with mode: 0644]
src/gui/elems/basics/button.cpp
src/gui/elems/basics/button.h
src/gui/elems/basics/check.cpp
src/gui/elems/basics/check.h
src/gui/elems/basics/choice.cpp
src/gui/elems/basics/choice.h
src/gui/elems/basics/dial.cpp
src/gui/elems/basics/dial.h
src/gui/elems/basics/flex.cpp [new file with mode: 0644]
src/gui/elems/basics/flex.h [new file with mode: 0644]
src/gui/elems/basics/group.cpp
src/gui/elems/basics/group.h
src/gui/elems/basics/input.cpp
src/gui/elems/basics/input.h
src/gui/elems/basics/liquidScroll.cpp
src/gui/elems/basics/liquidScroll.h
src/gui/elems/basics/pack.cpp
src/gui/elems/basics/pack.h
src/gui/elems/basics/progress.cpp
src/gui/elems/basics/progress.h
src/gui/elems/basics/resizerBar.cpp
src/gui/elems/basics/resizerBar.h
src/gui/elems/basics/scroll.cpp
src/gui/elems/basics/scroll.h
src/gui/elems/basics/scrollPack.cpp
src/gui/elems/basics/scrollPack.h
src/gui/elems/basics/slider.cpp
src/gui/elems/basics/slider.h
src/gui/elems/basics/split.cpp
src/gui/elems/basics/split.h
src/gui/elems/basics/statusButton.cpp
src/gui/elems/basics/statusButton.h
src/gui/elems/browser.cpp [deleted file]
src/gui/elems/browser.h [deleted file]
src/gui/elems/config/tabAudio.cpp
src/gui/elems/config/tabAudio.h
src/gui/elems/config/tabBehaviors.cpp
src/gui/elems/config/tabBehaviors.h
src/gui/elems/config/tabMidi.cpp
src/gui/elems/config/tabMidi.h
src/gui/elems/config/tabMisc.cpp
src/gui/elems/config/tabMisc.h
src/gui/elems/config/tabPlugins.cpp
src/gui/elems/config/tabPlugins.h
src/gui/elems/fileBrowser.cpp [new file with mode: 0644]
src/gui/elems/fileBrowser.h [new file with mode: 0644]
src/gui/elems/mainWindow/keyboard/channel.cpp
src/gui/elems/mainWindow/keyboard/channel.h
src/gui/elems/mainWindow/keyboard/channelButton.cpp
src/gui/elems/mainWindow/keyboard/channelButton.h
src/gui/elems/mainWindow/keyboard/channelMode.cpp
src/gui/elems/mainWindow/keyboard/channelMode.h
src/gui/elems/mainWindow/keyboard/channelStatus.cpp
src/gui/elems/mainWindow/keyboard/channelStatus.h
src/gui/elems/mainWindow/keyboard/column.cpp
src/gui/elems/mainWindow/keyboard/column.h
src/gui/elems/mainWindow/keyboard/keyboard.cpp
src/gui/elems/mainWindow/keyboard/keyboard.h
src/gui/elems/mainWindow/keyboard/midiActivity.cpp [new file with mode: 0644]
src/gui/elems/mainWindow/keyboard/midiActivity.h [new file with mode: 0644]
src/gui/elems/mainWindow/keyboard/midiChannel.cpp
src/gui/elems/mainWindow/keyboard/midiChannel.h
src/gui/elems/mainWindow/keyboard/midiChannelButton.cpp
src/gui/elems/mainWindow/keyboard/midiChannelButton.h
src/gui/elems/mainWindow/keyboard/sampleChannel.cpp
src/gui/elems/mainWindow/keyboard/sampleChannel.h
src/gui/elems/mainWindow/keyboard/sampleChannelButton.cpp
src/gui/elems/mainWindow/keyboard/sampleChannelButton.h
src/gui/elems/mainWindow/mainIO.cpp
src/gui/elems/mainWindow/mainIO.h
src/gui/elems/mainWindow/mainMenu.cpp
src/gui/elems/mainWindow/mainMenu.h
src/gui/elems/mainWindow/mainTimer.cpp
src/gui/elems/mainWindow/mainTimer.h
src/gui/elems/mainWindow/mainTransport.cpp
src/gui/elems/mainWindow/mainTransport.h
src/gui/elems/mainWindow/sequencer.cpp
src/gui/elems/mainWindow/sequencer.h
src/gui/elems/midiIO/midiLearner.cpp
src/gui/elems/midiIO/midiLearner.h
src/gui/elems/midiIO/midiLearnerPack.cpp
src/gui/elems/midiIO/midiLearnerPack.h
src/gui/elems/plugin/pluginBrowser.cpp
src/gui/elems/plugin/pluginBrowser.h
src/gui/elems/plugin/pluginElement.cpp
src/gui/elems/plugin/pluginElement.h
src/gui/elems/plugin/pluginParameter.cpp
src/gui/elems/plugin/pluginParameter.h
src/gui/elems/sampleEditor/boostTool.cpp
src/gui/elems/sampleEditor/boostTool.h
src/gui/elems/sampleEditor/panTool.cpp
src/gui/elems/sampleEditor/panTool.h
src/gui/elems/sampleEditor/pitchTool.cpp
src/gui/elems/sampleEditor/pitchTool.h
src/gui/elems/sampleEditor/rangeTool.cpp
src/gui/elems/sampleEditor/rangeTool.h
src/gui/elems/sampleEditor/shiftTool.cpp
src/gui/elems/sampleEditor/shiftTool.h
src/gui/elems/sampleEditor/volumeTool.cpp
src/gui/elems/sampleEditor/volumeTool.h
src/gui/elems/sampleEditor/waveTools.cpp
src/gui/elems/sampleEditor/waveTools.h
src/gui/elems/sampleEditor/waveform.cpp
src/gui/elems/sampleEditor/waveform.h
src/gui/elems/soundMeter.cpp
src/gui/elems/soundMeter.h
src/gui/types.h
src/gui/ui.cpp
src/gui/ui.h
src/gui/updater.cpp
src/gui/updater.h
src/main.cpp
src/utils/cocoa.h
src/utils/fs.cpp
src/utils/fs.h
src/utils/gui.cpp
src/utils/gui.h
src/utils/log.cpp
src/utils/log.h
src/utils/math.cpp
src/utils/math.h
src/utils/string.cpp
src/utils/string.h
src/utils/time.cpp
src/utils/time.h
src/utils/vector.h
src/utils/ver.cpp
src/utils/ver.h
tests/midiLighter.cpp

index 1a0ca06fec318b1553fea479c6518de9cfe735f9..4aeb5e3b90e2b6553f2f8c6b3ac2acf56af65972 100644 (file)
@@ -114,6 +114,7 @@ list(APPEND SOURCES
        src/gui/dialogs/sampleEditor.cpp
        src/gui/dialogs/pluginWindowGUI.cpp
        src/gui/dialogs/pluginChooser.cpp
+       src/gui/dialogs/missingAssets.cpp
        src/gui/dialogs/actionEditor/baseActionEditor.cpp
        src/gui/dialogs/actionEditor/sampleActionEditor.cpp
        src/gui/dialogs/actionEditor/midiActionEditor.cpp
@@ -129,7 +130,7 @@ list(APPEND SOURCES
        src/gui/dialogs/midiIO/midiInputMaster.cpp
        src/gui/elems/midiIO/midiLearner.cpp
        src/gui/elems/midiIO/midiLearnerPack.cpp
-       src/gui/elems/browser.cpp
+    src/gui/elems/fileBrowser.cpp
        src/gui/elems/soundMeter.cpp
        src/gui/elems/plugin/pluginBrowser.cpp
        src/gui/elems/plugin/pluginParameter.cpp
@@ -168,6 +169,7 @@ list(APPEND SOURCES
        src/gui/elems/mainWindow/keyboard/channel.cpp
        src/gui/elems/mainWindow/keyboard/sampleChannelButton.cpp
        src/gui/elems/mainWindow/keyboard/midiChannelButton.cpp
+       src/gui/elems/mainWindow/keyboard/midiActivity.cpp
        src/gui/elems/config/tabMisc.cpp
        src/gui/elems/config/tabMidi.cpp
        src/gui/elems/config/tabAudio.cpp
@@ -190,6 +192,8 @@ list(APPEND SOURCES
        src/gui/elems/basics/progress.cpp
        src/gui/elems/basics/check.cpp
        src/gui/elems/basics/split.cpp
+       src/gui/elems/basics/browser.cpp
+       src/gui/elems/basics/flex.cpp
        src/utils/log.cpp
        src/utils/time.cpp
        src/utils/math.cpp
index 4adddd470929b9e57068c4b68621449d7d7cbed2..77bd5923ed5759b11fa76f665327494da9518b6b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 --------------------------------------------------------------------------------
 
 
+0.20.1 --- 2022 . 02 . 21
+- New MIDI I/O activity LEDs on channels (#143)
+- New "Missing Assets" alert window (#344)
+- Many smaller improvements and cleanups in UI code
+- Add ability to sort installed plug-ins by Format (VST, VST3, ...)
+- Update JUCE to 6.1.5
+- Update custom RtAudio submodule (now pointing to 6.0.0beta1)
+- Optimize internal buffer Giada <-> JUCE conversion
+- Remove old plug-in parameter storage used in old patches
+- Fix deadlock when using JACK transport
+- Fix Action Editor grid refresh when changing BPM while the editor window is open (#547)
+- Fix plug-in clone operation while cloning a channel (#551)
+
+
 0.20.0 --- 2022 . 01 . 24
 - Show progress bar for long operations 
 - Improved rendering algorithm for sample channels
index c63ef217d85bc49f501591f26eb39d41fb4eb0c7..f2562da150b4d31a1755e3f5523d7e3906abbd47 100644 (file)
--- a/README.md
+++ b/README.md
@@ -65,7 +65,7 @@ Feel free to ask anything in the [discussions area](https://github.com/monocasua
 
 ## Copyright
 
-Giada is Copyright (C) 2010-2021 by Giovanni A. Zuliani | Monocasual Laboratories
+Giada is Copyright (C) 2010-2022 by Giovanni A. Zuliani | Monocasual Laboratories
 
 Giada - Your Hardcore Loopmachine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 
index 5c3d2e662d82d332071f64571e7052fa0788ea45..ba960b861dd612c9c094b0f936dd5de3a860cab9 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 38f7b3f143ed02b0469412d8b8e57e17ab35983e..9043034e3629457967faddb250ffd95825fd6a82 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index c0ee704d7df642fe8dfefcd350eb95540e48da59..ebbe27bc55075a4ff809a1b42ebdbb5966495307 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index dc3bdb05b7743ca22f5920c510c183a6135acc92..04d1dc9b4d601e3bb4202b1b70430da20a4d2d68 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 12c224b89645c48f36cdfa90664e32e2733ff51b..d098eaeb3793d916b343fcf402a32b585ecf71b2 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index c0957a7c5942847df72dcd408cfd8b0186e1aa38..bdaf232eb3fb5509e60b0e48debd71d6f9f7bd2d 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 99e4e9d42f6f062e52ef3f78f43324a42526da3e..eec25bcd9551c7deadd9c9e78b5f4f1950c3f454 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 6c9cb87c2324b48a52d8dda7adbee125295fd736..7cf70817500d7c2909ca4bf9c24b33389a3ffc4f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -404,10 +404,8 @@ void Channel::render(mcl::AudioBuffer* out, mcl::AudioBuffer* in, bool audible)
 {
        if (id == Mixer::MASTER_OUT_CHANNEL_ID)
                renderMasterOut(*out);
-#ifdef WITH_VST
        else if (id == Mixer::MASTER_IN_CHANNEL_ID)
                renderMasterIn(*in);
-#endif
        else
                renderChannel(*out, *in, audible);
 }
@@ -426,15 +424,15 @@ void Channel::renderMasterOut(mcl::AudioBuffer& out) const
 
 /* -------------------------------------------------------------------------- */
 
-#ifdef WITH_VST
-
 void Channel::renderMasterIn(mcl::AudioBuffer& in) const
 {
+#ifdef WITH_VST
        if (plugins.size() > 0)
                g_engine.pluginHost.processStack(in, plugins, nullptr);
-}
-
+#else
+       (void)in;
 #endif
+}
 
 /* -------------------------------------------------------------------------- */
 
index aa91a9a5c209db514fba5276c86681c83f2746d8..020ba9eb2f20cd6154d8a1388026316f217ee933 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 30c5578b68a663ca3c0f39e509896c2defbf6584..51d42e8fbbbbe522d23da9425696fc3261e64fe2 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -34,7 +34,9 @@
 #include "core/plugins/plugin.h"
 #include "core/plugins/pluginHost.h"
 #include "core/wave.h"
+#include "glue/channel.h"
 #include <cassert>
+#include <memory>
 
 namespace giada::m
 {
@@ -68,6 +70,8 @@ Channel ChannelManager::create(ID channelId, ChannelType type, ID columnId, int
        if (out.audioReceiver)
                out.audioReceiver->overdubProtection = m_conf.overdubProtectionDefaultOn;
 
+       c::channel::setCallbacks(out); // UI callbacks
+
        return out;
 }
 
@@ -80,6 +84,8 @@ Channel ChannelManager::create(const Channel& o, int bufferSize)
        out.id     = m_channelId.generate();
        out.shared = &makeShared(o.type, bufferSize);
 
+       c::channel::setCallbacks(out); // UI callbacks
+
        return out;
 }
 
@@ -88,7 +94,11 @@ Channel ChannelManager::create(const Channel& o, int bufferSize)
 Channel ChannelManager::deserializeChannel(const Patch::Channel& pch, float samplerateRatio, int bufferSize)
 {
        m_channelId.set(pch.id);
-       return Channel(pch, makeShared(pch.type, bufferSize), samplerateRatio, m_model.findShared<Wave>(pch.waveId));
+
+       Channel out = Channel(pch, makeShared(pch.type, bufferSize), samplerateRatio, m_model.findShared<Wave>(pch.waveId));
+       c::channel::setCallbacks(out); // UI callbacks
+
+       return out;
 }
 
 /* -------------------------------------------------------------------------- */
index 2e1e5826c166b1db5f964e01b473cee21cbf934d..29b829062fe4d0cbd828e3a7ed75a7c2df6a7ca9 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 61d29250918675c31b9d28e6ff6e091a85548347..0b5286e89c51c0fdbfd833bc7493818dffb1f41d 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 8abc229f2449c3b6bbbbb769ddc780282b03284d..62f980794197c4f74906417d152f5d825a9e6564 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index ffc86a5c358028ad41d0059ff7cf468af921344b..3ad920d3b5a9ea434f32d32605eab7c2d2623cfa 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 48b1a7975a0a7f6a1dcf883144550c81aa0bea5b..61c701e541226bfaae7e71dffb36084953bd1eb3 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index bb5492d242844fd96d9c7dcbc6aef2524b4a54ce..3c6d92f48160db9db3a1001ac7b773ecc1567d06 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 286b3cc4b9560d7149f1e64d8f2955332edd3c65..4bd64a159b0f47ff6efafc2ce43ff4dbd3c3b698 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 687c059765942ea46d1a33cdfef41514a9cf9276..45056e8fbb973c4e30440554c4e93cf8ac95bde4 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -33,6 +33,7 @@ namespace giada::m
 template <typename KernelMidiI>
 MidiLighter<KernelMidiI>::MidiLighter(MidiMapper<KernelMidiI>& m)
 : enabled(false)
+, onSend(nullptr)
 , m_midiMapper(&m)
 {
 }
@@ -63,19 +64,19 @@ void MidiLighter<KernelMidiI>::sendStatus(ChannelStatus status, bool audible)
        switch (status)
        {
        case ChannelStatus::OFF:
-               m_midiMapper->sendMidiLightning(l_playing, midiMap.stopped);
+               send(l_playing, midiMap.stopped);
                break;
 
        case ChannelStatus::WAIT:
-               m_midiMapper->sendMidiLightning(l_playing, midiMap.waiting);
+               send(l_playing, midiMap.waiting);
                break;
 
        case ChannelStatus::ENDING:
-               m_midiMapper->sendMidiLightning(l_playing, midiMap.stopping);
+               send(l_playing, midiMap.stopping);
                break;
 
        case ChannelStatus::PLAY:
-               m_midiMapper->sendMidiLightning(l_playing, audible ? midiMap.playing : midiMap.playingInaudible);
+               send(l_playing, audible ? midiMap.playing : midiMap.playingInaudible);
                break;
 
        default:
@@ -92,7 +93,7 @@ void MidiLighter<KernelMidiI>::sendMute(bool isMuted)
        const uint32_t l_mute  = mute.getValue();
 
        if (l_mute != 0x0)
-               m_midiMapper->sendMidiLightning(l_mute, isMuted ? midiMap.muteOn : midiMap.muteOff);
+               send(l_mute, isMuted ? midiMap.muteOn : midiMap.muteOff);
 }
 
 /* -------------------------------------------------------------------------- */
@@ -104,7 +105,18 @@ void MidiLighter<KernelMidiI>::sendSolo(bool isSoloed)
        const uint32_t l_solo  = solo.getValue();
 
        if (l_solo != 0x0)
-               m_midiMapper->sendMidiLightning(l_solo, isSoloed ? midiMap.soloOn : midiMap.soloOff);
+               send(l_solo, isSoloed ? midiMap.soloOn : midiMap.soloOff);
+}
+
+/* -------------------------------------------------------------------------- */
+
+template <typename KernelMidiI>
+void MidiLighter<KernelMidiI>::send(uint32_t learnt, const MidiMap::Message& msg)
+{
+       assert(onSend != nullptr);
+
+       m_midiMapper->sendMidiLightning(learnt, msg);
+       onSend();
 }
 
 /* -------------------------------------------------------------------------- */
index b34dbc0a20ea191ce40889be422e06b37ee5a915..a58b39f51df364374058c8b8968edc018546f94c 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -57,7 +57,14 @@ public:
        MidiLearnParam mute;
        MidiLearnParam solo;
 
+       /* onSend
+       Callback fired when a MIDI signal has been sent. */
+
+       std::function<void()> onSend;
+
 private:
+       void send(uint32_t learnt, const MidiMap::Message&);
+
        MidiMapper<KernelMidiI>* m_midiMapper;
 };
 
index ada713a3c97b637fffe7fcefffe8a365c85dbe82..599f2ca5dd9a6c19b4ad1ecd98297411025f3e11 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 050bc4f773ccff0957ab9231460bea28211ae045..4f8fdb5cfc9e065a9509937cfc7bce21a48bfe40 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index b50fc9ab1e8ebf1a2fc18ade960781e0edfbf076..6eee0baebe0c90b99b7ba463122b0b2824429a67 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -35,6 +35,7 @@ MidiSender::MidiSender(KernelMidi& k)
 : kernelMidi(&k)
 , enabled(false)
 , filter(0)
+, onSend(nullptr)
 {
 }
 
@@ -73,8 +74,11 @@ void MidiSender::advance(const Channel& ch, const Sequencer::Event& e) const
 
 void MidiSender::send(MidiEvent e) const
 {
+       assert(onSend != nullptr);
+
        e.setChannel(filter);
        kernelMidi->send(e.getRaw());
+       onSend();
 }
 
 /* -------------------------------------------------------------------------- */
index a405aff4987b6615d4c7c6e27df8718a5edfe5ba..140f29127926f7d21501426f02f1c226575d8a3f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -56,6 +56,11 @@ public:
 
        int filter;
 
+       /* onSend
+       Callback fired when a MIDI signal has been sent. */
+
+       std::function<void()> onSend;
+
 private:
        void send(MidiEvent e) const;
        void parseActions(const Channel& ch, const std::vector<Action>& as) const;
index cb0445cdbb92dc3833e1bd90fa0cae56fde84332..d03c7521a68833f777c7946ac3d80147583e8644 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 7f86b099315933feb0d2c83efc50e1dc786f9274..a780c02b1ae7f384c87d2af07d9cf6d28a4892c3 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 108a8ef1d6f13878ac32f993a5e3e6a47b23fd4e..bf87e556ebb7930a9b03c045cd846368506476d9 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 2e18b1740f0e4e2e0c106c0ecd2d60c62a5b3a39..f6256abbed4d7286e6cbcd6e25a1b60eb062a17f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 0d7946ba5e548c7e4193f44aeede1451437cf1f2..bbc206dc1005ba9581fdfa72088024b319c92e2c 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 9af720d8390559fe03cdc5237b77a876b72a790d..d12dfffd3a083709d8dfc1528f999068cb6e5b57 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 7240433c01cb1ae77ca7446267130ce4478ec3f4..cf8437dd8e6df14ec00b09d1da5b0420d12ffe9f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index a34b544efa15a1c9d9911a919479edc1db0663cd..20e032ddf1c807e15ad6f00b1f22e27096cd87b8 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index a2e7356aaf391178ee3a53299fc0a7ffeb5088ce..e77db0c8a205609522ba563227d886e02f0a1137 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 
 /* -- version --------------------------------------------------------------- */
 constexpr auto G_APP_NAME      = "Giada";
-constexpr auto G_VERSION_STR   = "0.20.0";
+constexpr auto G_VERSION_STR   = "0.20.1";
 constexpr int  G_VERSION_MAJOR = 0;
 constexpr int  G_VERSION_MINOR = 20;
-constexpr int  G_VERSION_PATCH = 0;
+constexpr int  G_VERSION_PATCH = 1;
 
 constexpr auto CONF_FILENAME = "giada.conf";
 
@@ -82,8 +82,8 @@ live input latency, keep it small! */
 constexpr int G_EVENT_DISPATCHER_RATE_MS = 5;
 
 /* -- GUI ------------------------------------------------------------------- */
-constexpr float G_GUI_REFRESH_RATE   = 1 / 30.0f; // 30 fps
-constexpr float G_GUI_PLUGIN_RATE    = 1 / 30.0f; // 30 fps
+constexpr int   G_GUI_FPS            = 30;
+constexpr float G_GUI_REFRESH_RATE   = 1 / static_cast<float>(G_GUI_FPS);
 constexpr int   G_GUI_FONT_SIZE_BASE = 12;
 constexpr int   G_GUI_INNER_MARGIN   = 4;
 constexpr int   G_GUI_OUTER_MARGIN   = 8;
@@ -193,20 +193,21 @@ constexpr int LOG_MODE_FILE   = 2;
 
 /* -- unique IDs of mainWin's subwindows ------------------------------------ */
 /* -- wid > 0 are reserved by gg_keyboard ----------------------------------- */
-constexpr int WID_BEATS         = -1;
-constexpr int WID_BPM           = -2;
-constexpr int WID_ABOUT         = -3;
-constexpr int WID_FILE_BROWSER  = -4;
-constexpr int WID_CONFIG        = -5;
-constexpr int WID_FX_LIST       = -6;
-constexpr int WID_ACTION_EDITOR = -7;
-constexpr int WID_SAMPLE_EDITOR = -8;
-constexpr int WID_FX            = -9;
-constexpr int WID_KEY_GRABBER   = -10;
-constexpr int WID_SAMPLE_NAME   = -11;
-constexpr int WID_FX_CHOOSER    = -12;
-constexpr int WID_MIDI_INPUT    = -13;
-constexpr int WID_MIDI_OUTPUT   = -14;
+constexpr int WID_BEATS          = -1;
+constexpr int WID_BPM            = -2;
+constexpr int WID_ABOUT          = -3;
+constexpr int WID_FILE_BROWSER   = -4;
+constexpr int WID_CONFIG         = -5;
+constexpr int WID_FX_LIST        = -6;
+constexpr int WID_ACTION_EDITOR  = -7;
+constexpr int WID_SAMPLE_EDITOR  = -8;
+constexpr int WID_FX             = -9;
+constexpr int WID_KEY_GRABBER    = -10;
+constexpr int WID_SAMPLE_NAME    = -11;
+constexpr int WID_FX_CHOOSER     = -12;
+constexpr int WID_MIDI_INPUT     = -13;
+constexpr int WID_MIDI_OUTPUT    = -14;
+constexpr int WID_MISSING_ASSETS = -15;
 
 /* -- patch signals --------------------------------------------------------- */
 constexpr int G_PATCH_UNSUPPORTED = -2;
index 31394438600e2dbe6d037d75d690b7ec7e12dc0e..2b05d8f60a1320b7e4dc88a48d06dbd7fb1b29dc 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include "core/model/storage.h"
 #include "utils/fs.h"
 #include "utils/log.h"
+#include <memory>
 
 namespace giada::m
 {
+bool LoadState::isGood() const
+{
+       return patch == G_PATCH_OK && missingWaves.empty() && missingPlugins.empty();
+}
+
+/* -------------------------------------------------------------------------- */
+/* -------------------------------------------------------------------------- */
+/* -------------------------------------------------------------------------- */
+
 Engine::Engine()
 : midiMapper(kernelMidi)
 , channelManager(conf.data, model)
@@ -53,13 +63,18 @@ Engine::Engine()
        kernelMidi.onMidiReceived = [this](uint32_t msg) { midiDispatcher.dispatch(msg); };
 
 #ifdef WITH_AUDIO_JACK
-       if (kernelAudio.getAPI() == G_SYS_API_JACK)
-               jackTransport.setHandle(kernelAudio.getJackHandle());
-
-       synchronizer.onJackRewind    = [this]() { sequencer.rawRewind(); };
-       synchronizer.onJackChangeBpm = [this](float bpm) { sequencer.rawSetBpm(bpm, kernelAudio.getSampleRate()); };
-       synchronizer.onJackStart     = [this]() { sequencer.rawStart(); };
-       synchronizer.onJackStop      = [this]() { sequencer.rawStop(); };
+       synchronizer.onJackRewind = [this]() {
+               eventDispatcher.pumpMidiEvent({EventDispatcher::EventType::SEQUENCER_REWIND_JACK});
+       };
+       synchronizer.onJackChangeBpm = [this](float bpm) {
+               eventDispatcher.pumpMidiEvent({EventDispatcher::EventType::SEQUENCER_BPM_JACK, 0, 0, bpm});
+       };
+       synchronizer.onJackStart = [this]() {
+               eventDispatcher.pumpMidiEvent({EventDispatcher::EventType::SEQUENCER_START_JACK});
+       };
+       synchronizer.onJackStop = [this]() {
+               eventDispatcher.pumpMidiEvent({EventDispatcher::EventType::SEQUENCER_STOP_JACK});
+       };
 #endif
 
        eventDispatcher.onMidiLearn       = [this](const MidiEvent& e) { midiDispatcher.learn(e); };
@@ -70,7 +85,7 @@ Engine::Engine()
                model.swap(model::SwapType::SOFT);
        };
        eventDispatcher.onProcessSequencer = [this](const EventDispatcher::EventBuffer& eb) {
-               sequencer.react(eb);
+               sequencer.react(eb, kernelAudio.getSampleRate());
        };
        eventDispatcher.onMixerSignalCallback = [this]() {
                recorder.startInputRecOnCallback();
@@ -169,6 +184,11 @@ void Engine::init()
        if (!kernelAudio.isReady())
                return;
 
+#ifdef WITH_AUDIO_JACK
+       if (kernelAudio.getAPI() == G_SYS_API_JACK)
+               jackTransport.setHandle(kernelAudio.getJackHandle());
+#endif
+
        mixerHandler.reset(sequencer.getMaxFramesInLoop(kernelAudio.getSampleRate()),
            kernelAudio.getBufferSize(), channelManager);
        sequencer.reset(kernelAudio.getSampleRate());
@@ -355,7 +375,7 @@ bool Engine::store(const std::string& projectName, const std::string& projectPat
 
 /* -------------------------------------------------------------------------- */
 
-int Engine::load(const std::string& projectPath, const std::string& patchPath,
+LoadState Engine::load(const std::string& projectPath, const std::string& patchPath,
     std::function<void(float)> progress)
 {
        u::log::print("[Engine::load] Load project from %s\n", projectPath);
@@ -364,7 +384,7 @@ int Engine::load(const std::string& projectPath, const std::string& patchPath,
 
        patch.reset();
        if (int res = patch.read(patchPath, projectPath); res != G_PATCH_OK)
-               return res;
+               return {res};
 
        progress(0.3f);
 
@@ -372,7 +392,7 @@ int Engine::load(const std::string& projectPath, const std::string& patchPath,
 
        mixer.disable();
        reset();
-       m::model::load(patch.data);
+       LoadState state = m::model::load(patch.data);
 
        progress(0.6f);
 
@@ -398,7 +418,8 @@ int Engine::load(const std::string& projectPath, const std::string& patchPath,
 
        progress(1.0f);
 
-       return G_PATCH_OK;
+       state.patch = G_PATCH_OK;
+       return state;
 }
 
-} // namespace giada::m
\ No newline at end of file
+} // namespace giada::m
index 5fa6ae5ded2b5e629521fdd09c15a2633775125e..c7d242ea927f802fa6ede4dc76748d88cd7d4b98 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 
 namespace giada::m
 {
+struct LoadState
+{
+       bool isGood() const;
+
+       int                      patch          = G_PATCH_OK;
+       std::vector<std::string> missingWaves   = {};
+       std::vector<std::string> missingPlugins = {};
+};
+
 class Engine final
 {
 public:
@@ -69,9 +78,9 @@ public:
 
        /* load
        Reads a Patch from file and then de-serialize its content into the model. 
-       Returns G_PATCH_OK on success or any G_PATCH_* on failure. */
+       Returns a LoadState object. */
 
-       int load(const std::string& projectPath, const std::string& patchPath,
+       LoadState load(const std::string& projectPath, const std::string& patchPath,
            std::function<void(float)> progress);
 
        /* updateMixerModel
index b980537b445c3312ef9ac681a65626c9b6302df3..34622017a8b5d7e753b2d1001b410d9d3842a289 100644 (file)
@@ -56,6 +56,12 @@ public:
                SEQUENCER_START,
                SEQUENCER_STOP,
                SEQUENCER_REWIND,
+#ifdef WITH_AUDIO_JACK
+               SEQUENCER_START_JACK,
+               SEQUENCER_STOP_JACK,
+               SEQUENCER_REWIND_JACK,
+               SEQUENCER_BPM_JACK,
+#endif
                MIDI,
                MIDI_DISPATCHER_LEARN,
                MIDI_DISPATCHER_PROCESS,
index eb41137287a5eec898024d069fa1d98785e2f1df..10eb1b007949819e73c201625fbecc68b06a587b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 6fb2c050b086db2b226da24706d7e1e718528d1d..7e18e5f39b78083df6551f0a13c9a1a8355d72c3 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 2e34592bb58ecc6a69f48f72c0467b0a229bc135..87f62bbf907f118cd6ae5fbe1abe9f17b7c69651 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 6fe9c6ec7aec515edeee63b31b035f580113c96f..32bf1ae2e3e30e20dc9595dde99308752eecd2a5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index bd4b98f110b2299368aab0e413fdfc58816d8782..ccd97f0b087d08c98678aa84be287dbcef0b434b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index c29e6efdc8a69f0d5646da81f07c03c4007ec24d..1c587e213160b5429f763b69fe274a6cdbcd9529 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 45c1c7cc256bbf2629c44c2295d2fe34aa3e1ac6..9ebcac678e1b0d8d9864ef31729acd4eced3069f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 5e6f7f7a7d8faddf41d0246e3e593c4012779a8c..b73347418bb8e1d8a187c428049ebc7ac4d1b077 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 4a52d8806a25060280d89b9513ff004c87e38cc8..8c10d8e0abdb614c7ffe7cf5396e533419b08be9 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 706d662f76080ad3d66cf03785b19bb206473495..ce3c57bdf86e0742c81d810b3ec3d6e905bf96c9 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index fd2458774c5fa3a41ec94291dfcf3b3512668770..040b0e2cf1db0fe012030ab1d3d98e0de6a539d1 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -28,6 +28,7 @@
 #include "core/const.h"
 #include "utils/log.h"
 #include <cassert>
+#include <memory>
 
 namespace giada::m
 {
index 88f98ed944bcbe678d631209aa1312d66f75b67f..ac10e22f907d432dba048f3dac2d4117a0541623 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 1ed5cd75217f4c570b7e9d166980c5727d8e5104..7b5fbb0d794f8db92835be8b7e619126eba0127a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 7c8c2a7f149117d0cef0dad72b5af750f9ad471b..01bee5781d438774a9258231e5c21f1ac7c7752d 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 239e2348bdfe6845c2836e414fe31bd9e46acff1..0d065214a8cafe973c8cea8bb58f7ee83d8aa857 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -162,7 +162,8 @@ bool MidiDispatcher::isChannelMidiInAllowed(ID channelId, int c)
 
 #ifdef WITH_VST
 
-void MidiDispatcher::processPlugins(const std::vector<Plugin*>& plugins, const MidiEvent& midiEvent)
+void MidiDispatcher::processPlugins(ID channelId, const std::vector<Plugin*>& plugins,
+    const MidiEvent& midiEvent)
 {
        uint32_t pure = midiEvent.getRawNoVelocity();
        float    vf   = u::math::map(midiEvent.getVelocity(), G_MAX_VELOCITY, 1.0f);
@@ -178,7 +179,7 @@ void MidiDispatcher::processPlugins(const std::vector<Plugin*>& plugins, const M
                {
                        if (pure != param.getValue())
                                continue;
-                       c::events::setPluginParameter(p->id, param.getIndex(), vf, /*gui=*/false);
+                       c::events::setPluginParameter(channelId, p->id, param.getIndex(), vf, Thread::MIDI);
                        u::log::print("  >>> [pluginId=%d paramIndex=%d] (pure=0x%X, value=%d, float=%f)\n",
                            p->id, param.getIndex(), pure, midiEvent.getVelocity(), vf);
                }
@@ -253,7 +254,7 @@ void MidiDispatcher::processChannels(const MidiEvent& midiEvent)
 
 #ifdef WITH_VST
                /* Process learned plugins parameters. */
-               processPlugins(c.plugins, midiEvent);
+               processPlugins(c.id, c.plugins, midiEvent);
 #endif
 
                /* Redirect raw MIDI message (pure + velocity) to plug-ins in armed
index b7d0a1d16f5bb510f843b253ae3ee75ef0163927..2a52c0d7d91a1d71e3921d9d3fc0f0fb04a484f5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -89,8 +89,10 @@ private:
        void learnMaster(MidiEvent e, int param, std::function<void()> doneCb);
 
 #ifdef WITH_VST
-       void processPlugins(const std::vector<Plugin*>& plugins, const MidiEvent& midiEvent);
-       void learnPlugin(MidiEvent e, std::size_t paramIndex, ID pluginId, std::function<void()> doneCb);
+       void processPlugins(ID channelId, const std::vector<Plugin*>& plugins,
+           const MidiEvent& midiEvent);
+       void learnPlugin(MidiEvent e, std::size_t paramIndex, ID pluginId,
+           std::function<void()> doneCb);
 #endif
 
        /* cb_midiLearn
index 22aef5616ad7f82c76610765dce979eda3c0b523..761106ac114bfd6140ab1153d02fdb2b247fad0a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 48e967ad862820550fd3a22efc9096d331478be0..15ff0e7fe2d8306ca2a7f62021e006054317b855 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 54dfcbf527d6cf0aeefa5fbdf730111340849592..83c820a28a0cdf39e3a3e5dccdb4d1b6f990e814 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index b6f04304df071e3e688827790fbe9ef0ea2eadc7..f2e7738805623c67238042f05e2e62bd321373e0 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index a11bd389b1877459e4ecc5d5e80ced66ed6b9681..bee78b87ce40bee50b5c4cd06889ad3295c0f32b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -178,7 +178,7 @@ void MidiMapper<KernelMidiI>::sendMidiLightning(uint32_t learnt, const MidiMap::
 
        if (!isMessageDefined(m))
        {
-               u::log::print("[MidiMapper::sendMidiLightning] message skipped (not defined in midiMap)");
+               u::log::print("[MidiMapper::sendMidiLightning] message skipped (not defined in midiMap)\n");
                return;
        }
 
index 694ffe5257f4dd95d624082e168bb9faf8d4c293..f8f2c13f2e2f6c48a8fc364f61b1b7246887abe3 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 7b8cd5416e5e993a7c35a0ecfcf559b91795a924..bd49e43de6dcb2b4a5f66c4c9d6ca28957a74457 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -293,7 +293,12 @@ void Mixer::renderChannels(const std::vector<Channel>& channels, mcl::AudioBuffe
 
 void Mixer::renderMasterIn(const Channel& ch, mcl::AudioBuffer& in) const
 {
+#ifdef WITH_VST
        ch.render(nullptr, &in, true);
+#else
+       (void)ch;
+       (void)in;
+#endif
 }
 
 void Mixer::renderMasterOut(const Channel& ch, mcl::AudioBuffer& out) const
index 6ed46358c6f57eadd61f35ef621578d203e8a7c9..d10c93325a75489064b89814fcf7143da0313485 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index d636775a006515dd0716a033eefbd048416d20b9..af88cf2785ce67d92c41c9c9780bc4996bdb07bf 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -39,6 +39,7 @@
 #include "utils/vector.h"
 #include <algorithm>
 #include <cassert>
+#include <memory>
 #include <vector>
 
 namespace giada::m
@@ -146,11 +147,18 @@ void MixerHandler::cloneChannel(ID channelId, int bufferSize, ChannelManager& ch
        }
 
 #ifdef WITH_VST
+
+       /* Overwrite existing plug-ins in new channel with a new vector of plug-ins,
+       as currently new channel has cloned plug-ins from the old one (with same ID). */
+
+       std::vector<Plugin*> newPlugins;
        for (const Plugin* plugin : oldChannel.plugins)
        {
                m_model.addShared(pluginManager.makePlugin(*plugin, sampleRate, bufferSize, sequencer));
-               newChannel.plugins.push_back(&m_model.backShared<Plugin>());
+               newPlugins.push_back(&m_model.backShared<Plugin>());
        }
+       newChannel.plugins = newPlugins;
+
 #endif
 
        /* Then push the new channel in the channels vector. */
index b9513568b7dec71fa3fef9aa2f90d26d879ba4e3..65364c9c91b03d59f87cddf97c76d8f4532c0ddc 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index e667c3f099b0cccc7cbeaf104102f0cd32faad82..7ed5dd7e2c9e0abd890c56a065fa6cef5f97cfb5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index a1377b1fcd60e5e7be7614f67262e395c40deb0e..a5a7499d5ebd1454b9fa6e8b4614ebedb07ce37c 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 75a30e0778b060825769c7a3687306637abcad8f..ca27e4cb484491f671ffb784e473661af1ea2bb6 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -26,6 +26,7 @@
 
 #include "core/model/model.h"
 #include <cassert>
+#include <memory>
 #ifdef G_DEBUG_MODE
 #include "core/channels/channelManager.h"
 #endif
index 12e0f3ad8956375dfa1eb001977799e9da272f50..28b7c6bd7f97bda867eff1146ba60a95242378ba 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -39,6 +39,7 @@
 #include "deps/mcl-audio-buffer/src/audioBuffer.hpp"
 #include "src/core/actions/actions.h"
 #include "utils/vector.h"
+#include <memory>
 
 namespace giada::m::model
 {
index d7835b6950936747aa4b0753dc9cfbef4631181b..5d714fe049ea23a71ab24b83e56d6e4439ab7965 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index d4112ce6c9073fc3dba264ae91c3283db9c8f408..aca24e9107901ed602d0af9fd26a0ba5ba767cb0 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index d2a5b2fc1b6aab0f3f1526ac469944258011b6c4..426f9d738fa5754a2b1a46bbc9cda4d4dedab804 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 5526f3b3a6aa0e21cb39f6fc9b1f37d76c18639d..5389e86d9bb997ae0e22c1d82d7abcd25a3cdb97 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index d2e5e7366a28922d4668a8e539f5d69673bdf6b4..c0cc3c8dfab8b6c084296943d18597f3f2891cbe 100644 (file)
@@ -36,6 +36,7 @@
 #include "core/waveManager.h"
 #include "src/core/actions/actionRecorder.h"
 #include <cassert>
+#include <memory>
 
 extern giada::m::Engine g_engine;
 
@@ -113,7 +114,7 @@ void store(Conf::Data& conf)
 
 /* -------------------------------------------------------------------------- */
 
-void load(const Patch::Data& patch)
+LoadState load(const Patch::Data& patch)
 {
        DataLock lock = g_engine.model.lockData();
 
@@ -122,13 +123,22 @@ void load(const Patch::Data& patch)
        g_engine.model.get().channels = {};
        g_engine.model.getAllShared<ChannelSharedPtrs>().clear();
 
+       LoadState state;
+
        /* Load external data first: plug-ins and waves. */
 
 #ifdef WITH_VST
        g_engine.model.getAllShared<PluginPtrs>().clear();
        for (const Patch::Plugin& pplugin : patch.plugins)
-               g_engine.model.getAllShared<PluginPtrs>().push_back(g_engine.pluginManager.deserializePlugin(
-                   pplugin, patch.version, g_engine.kernelAudio.getSampleRate(), g_engine.kernelAudio.getBufferSize(), g_engine.sequencer));
+       {
+               std::unique_ptr<Plugin> p = g_engine.pluginManager.deserializePlugin(
+                   pplugin, g_engine.kernelAudio.getSampleRate(), g_engine.kernelAudio.getBufferSize(), g_engine.sequencer);
+
+               if (!p->valid)
+                       state.missingPlugins.push_back(pplugin.path);
+
+               g_engine.model.getAllShared<PluginPtrs>().push_back(std::move(p));
+       }
 #endif
 
        g_engine.model.getAllShared<WavePtrs>().clear();
@@ -136,8 +146,11 @@ void load(const Patch::Data& patch)
        {
                std::unique_ptr<Wave> w = g_engine.waveManager.deserializeWave(pwave, g_engine.kernelAudio.getSampleRate(),
                    g_engine.conf.data.rsmpQuality);
+
                if (w != nullptr)
                        g_engine.model.getAllShared<WavePtrs>().push_back(std::move(w));
+               else
+                       state.missingWaves.push_back(pwave.path);
        }
 
        /* Then load up channels, actions and global properties. */
@@ -150,6 +163,8 @@ void load(const Patch::Data& patch)
        g_engine.model.get().sequencer.beats    = patch.beats;
        g_engine.model.get().sequencer.bpm      = patch.bpm;
        g_engine.model.get().sequencer.quantize = patch.quantize;
+
+       return state;
 }
 
 /* -------------------------------------------------------------------------- */
index e69d14095b0f31869c7ca1b5e518432a28ce5273..aa1ce014096fc984f844c2e9e45e335ea6c008f2 100644 (file)
 #ifndef G_MODEL_STORAGE_H
 #define G_MODEL_STORAGE_H
 
-#include "core/patch.h"
 #include "core/conf.h"
+#include "core/engine.h"
+#include "core/patch.h"
 
 namespace giada::m::model
 {
-void store(Conf::Data& c);
-void store(Patch::Data& p);
-void load(const Patch::Data& p);
-void load(const Conf::Data& c);
+void      store(Conf::Data& c);
+void      store(Patch::Data& p);
+LoadState load(const Patch::Data& p);
+void      load(const Conf::Data& c);
 } // namespace giada::m::model
 
 #endif
index 2db30e4d71bf6a3918d7f006d494c8164b6d4248..498b12fbb320d04e5733dcbdaa831b53c150dfe5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index a9e22f17359b56ca586009ffce0f9d6801b13f6d..f3592514265d1b21320ec8adedaeabecff3159f5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 31f75c408ad0aab74f6c8f6be7d6d08a746ea08b..23c07cdfc77dc1fa00f63d88606c1cdd2cc52615 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -32,6 +32,7 @@
 #include "utils/time.h"
 #include <FL/Fl.H>
 #include <cassert>
+#include <memory>
 
 namespace giada::m
 {
index d65136b8c45860d3d2d8264ad2e6ee192e909297..6f1758df53d27d8ef4fa15f88e0cf03a545f6b79 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -34,6 +34,7 @@
 #include "core/plugins/pluginHost.h"
 #include "core/plugins/pluginState.h"
 #include "deps/juce-config.h"
+#include <memory>
 #include <vector>
 
 namespace giada::m
index 6533ad1c88169c92e1b7a9637bafafa55e4bd941..76c58e55e9231c41f3e582278e250fad6dce7ab5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -36,6 +36,7 @@
 #include "utils/log.h"
 #include "utils/vector.h"
 #include <cassert>
+#include <memory>
 
 namespace giada::m
 {
@@ -170,20 +171,28 @@ void PluginHost::toggleBypass(ID pluginId)
 
 void PluginHost::giadaToJuceTempBuf(const mcl::AudioBuffer& outBuf)
 {
-       for (int i = 0; i < outBuf.countFrames(); i++)
-               for (int j = 0; j < outBuf.countChannels(); j++)
-                       m_audioBuffer.setSample(j, i, outBuf[i][j]);
-}
+       assert(outBuf.countChannels() == m_audioBuffer.getNumChannels());
+
+       using namespace juce;
+       using Format = AudioData::Format<AudioData::Float32, AudioData::BigEndian>;
 
-/* juceToGiadaOutBuf
-Converts buffer from Juce to Giada. A note for the future: if we overwrite (=) 
-(as we do now) it's SEND, if we add (+) it's INSERT. */
+       AudioData::deinterleaveSamples(
+           AudioData::InterleavedSource<Format>{outBuf[0], outBuf.countChannels()},
+           AudioData::NonInterleavedDest<Format>{m_audioBuffer.getArrayOfWritePointers(), m_audioBuffer.getNumChannels()},
+           outBuf.countFrames());
+}
 
 void PluginHost::juceToGiadaOutBuf(mcl::AudioBuffer& outBuf) const
 {
-       for (int i = 0; i < outBuf.countFrames(); i++)
-               for (int j = 0; j < outBuf.countChannels(); j++)
-                       outBuf[i][j] = m_audioBuffer.getSample(j, i);
+       assert(outBuf.countChannels() == m_audioBuffer.getNumChannels());
+
+       using namespace juce;
+       using Format = AudioData::Format<AudioData::Float32, AudioData::BigEndian>;
+
+       AudioData::interleaveSamples(
+           AudioData::NonInterleavedSource<Format>{m_audioBuffer.getArrayOfReadPointers(), m_audioBuffer.getNumChannels()},
+           AudioData::InterleavedDest<Format>{outBuf[0], outBuf.countChannels()},
+           outBuf.countFrames());
 }
 
 /* -------------------------------------------------------------------------- */
index e247e841fc1f0604a289a076bb543a6c180c8ccf..9e198170e2dfdd85695524ada3f1e042e8f3f868 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -32,6 +32,7 @@
 #include "core/types.h"
 #include "deps/juce-config.h"
 #include <functional>
+#include <memory>
 
 namespace mcl
 {
index 7e5cbb7adf3559449b490ffbf5c932df491f1d7f..e58c406ef376b189bd856b99ea05be56475288d6 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -35,6 +35,7 @@
 #include "utils/log.h"
 #include "utils/string.h"
 #include <cassert>
+#include <memory>
 
 namespace giada::m
 {
@@ -56,7 +57,7 @@ void PluginManager::reset(SortMethod sortMethod)
 int PluginManager::scanDirs(const std::string& dirs, const std::function<void(float)>& cb)
 {
        u::log::print("[pluginManager::scanDir] requested directories: '%s'\n", dirs);
-       u::log::print("[pluginManager::scanDir] current plug-in types: %d\n", m_knownPluginList.getNumTypes());
+       u::log::print("[pluginManager::scanDir] currently known plug-ins: %d\n", m_knownPluginList.getNumTypes());
 
        m_knownPluginList.clear(); // clear up previous plugins
 
@@ -187,20 +188,14 @@ const Patch::Plugin PluginManager::serializePlugin(const Plugin& p) const
 /* -------------------------------------------------------------------------- */
 
 std::unique_ptr<Plugin> PluginManager::deserializePlugin(const Patch::Plugin& p,
-    Patch::Version version, int sampleRate, int bufferSize, const Sequencer& sequencer)
+    int sampleRate, int bufferSize, const Sequencer& sequencer)
 {
        std::unique_ptr<Plugin> plugin = makePlugin(p.path, sampleRate, bufferSize, sequencer, p.id);
        if (!plugin->valid)
                return plugin; // Return invalid version
 
-       /* Fill plug-in parameters. */
        plugin->setBypass(p.bypass);
-
-       if (version < Patch::Version{0, 17, 0}) // TODO - to be removed in 0.18.0
-               for (unsigned j = 0; j < p.params.size(); j++)
-                       plugin->setParameter(j, p.params.at(j));
-       else
-               plugin->setState(PluginState(p.state));
+       plugin->setState(PluginState(p.state));
 
        /* Fill plug-in MidiIn parameters. Don't fill Plugin::midiInParam if 
        Patch::midiInParams are zero: it would wipe out the current default 0x0
index 8b16ae48a972e59da23c363c41a13822d2d8831b..6e6b58a4c540a4906b5f183adf7ea79d085a0906 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -33,6 +33,7 @@
 #include "core/patch.h"
 #include "deps/juce-config.h"
 #include "plugin.h"
+#include <memory>
 
 namespace giada::m::patch
 {
@@ -113,7 +114,7 @@ public:
        Transforms patch data into a Plugin object and vice versa. */
 
        const Patch::Plugin     serializePlugin(const Plugin& p) const;
-       std::unique_ptr<Plugin> deserializePlugin(const Patch::Plugin& p, Patch::Version version, int sampleRate, int bufferSize, const Sequencer&);
+       std::unique_ptr<Plugin> deserializePlugin(const Patch::Plugin&, int sampleRate, int bufferSize, const Sequencer&);
        std::vector<Plugin*>    hydratePlugins(std::vector<ID> pluginIds, model::Model& model);
 
        void sortPlugins(SortMethod sortMethod);
index 0cad68817ac5bbf4454796024ae12b81e7451081..14a54033246354d498d19484967bddfd3c0a3cf5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index ecb4c7c232eeb7779c81d69faecca972461215d7..7a5d4402c4fbb703bc8ff7cb4f2e1f2dc339a574 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index c9433697ca4f681ae1b884690d72b10d531b10b9..224700eaa90a49a03d15a58d8795f14e842aac57 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 1fae5269e8f9aa8d9544d7e8f7234dd3c9d618ba..c2f90702954d5a921a0a33f0cde5f5fb60622552 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 1a1b9177818a024009c9b12f45feda62575b09a1..511dd1a8be7c430b3cc3a2987f43153368b658f5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index d131ae73e208afc8148bd886a87c4a6e3beb1777..19165ccf21448f69664896f50bb55e5999b3e34f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index f98a49be067a26491ed0c60c32ebfa866ec97438..34e4c4c367944e774497da5838bd484d693a6a76 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 596e83cb7e9ba71fa3df87f03e5f80e42bd6508c..4d227260296d7b6316401af5ad1aa8bb659ce67f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 680a0d3f3a00710c1a898c08a39d266e6110b610..2f563b6827daba788a4fb5f80c6a9ed5f28329b5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 310d027cd9c3169316ab5b7820865fd7cce5737f..9e7032c945aa1c5dda9f10447802aa88c845c301 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index fa602097b207257fdd97bf46e3631dd204e39b76..f479a5184422d1b7a464a15678865aaa670c97b6 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -118,27 +118,47 @@ void Sequencer::reset(int sampleRate)
 
 /* -------------------------------------------------------------------------- */
 
-void Sequencer::react(const EventDispatcher::EventBuffer& events)
+void Sequencer::react(const EventDispatcher::EventBuffer& events, int sampleRate)
 {
        for (const EventDispatcher::Event& e : events)
        {
-               if (e.type == EventDispatcher::EventType::SEQUENCER_START)
+               switch (e.type)
                {
+               case EventDispatcher::EventType::SEQUENCER_START:
                        if (!m_jackTransport.start())
                                rawStart();
                        break;
-               }
-               if (e.type == EventDispatcher::EventType::SEQUENCER_STOP)
-               {
+
+               case EventDispatcher::EventType::SEQUENCER_STOP:
                        if (!m_jackTransport.stop())
                                rawStop();
                        break;
-               }
-               if (e.type == EventDispatcher::EventType::SEQUENCER_REWIND)
-               {
+
+               case EventDispatcher::EventType::SEQUENCER_REWIND:
                        if (!m_jackTransport.setPosition(0))
                                rawRewind();
                        break;
+
+#ifdef WITH_AUDIO_JACK
+               case EventDispatcher::EventType::SEQUENCER_START_JACK:
+                       rawStart();
+                       break;
+
+               case EventDispatcher::EventType::SEQUENCER_STOP_JACK:
+                       rawStop();
+                       break;
+
+               case EventDispatcher::EventType::SEQUENCER_REWIND_JACK:
+                       rawRewind();
+                       break;
+
+               case EventDispatcher::EventType::SEQUENCER_BPM_JACK:
+                       rawSetBpm(std::get<float>(e.data), sampleRate);
+                       break;
+#endif
+
+               default:
+                       break;
                }
        }
 }
index e68ca6438e0c572baf353bca0517bc5403296cc9..97f53d28c2344a600ad9377be8b6692a1c92af79 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -133,7 +133,7 @@ public:
        /* react
        Reacts to live events coming from the EventDispatcher (human events). */
 
-       void react(const EventDispatcher::EventBuffer&);
+       void react(const EventDispatcher::EventBuffer&, int sampleRate);
 
        /* advance
        Parses sequencer events that might occur in a block and advances the internal 
@@ -147,22 +147,6 @@ public:
 
        void render(mcl::AudioBuffer& outBuf);
 
-       /* raw[*]
-       Raw functions to start, stop and rewind the sequencer. These functions must 
-       be called only when the JACK signal is received. Other modules should send
-       a SEQUENCER_* event to the Event Dispatcher. */
-
-       void rawStart();
-       void rawStop();
-       void rawRewind();
-
-       /* rawSetBpm
-       Raw function to set the bpm, bypassing any JACK instruction. This function 
-       must be called only by the Synchronizer when the JACK signal is received. 
-       Other modules should use the non-raw version below. */
-
-       void rawSetBpm(float v, int sampleRate);
-
        void rewind();
        void toggleMetronome();
        void setMetronome(bool v);
@@ -191,6 +175,22 @@ private:
 
        void rewindQ(Frame delta);
 
+       /* raw[*]
+       Raw functions to start, stop and rewind the sequencer. These functions must 
+       be called only when the JACK signal is received. Other modules should send
+       a SEQUENCER_* event to the Event Dispatcher. */
+
+       void rawStart();
+       void rawStop();
+       void rawRewind();
+
+       /* rawSetBpm
+       Raw function to set the bpm, bypassing any JACK instruction. This function 
+       must be called only by the Synchronizer when the JACK signal is received. 
+       Other modules should use the public, non-raw version setBpm(...). */
+
+       void rawSetBpm(float v, int sampleRate);
+
        model::Model&  m_model;
        Synchronizer&  m_synchronizer;
        JackTransport& m_jackTransport;
index 10198581d6fcf19c744d50995a8548e5f444ad97..504806f82d7681f33a7fadebd9de4328f70f0150 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 20f3bee8137fa542dd13e02b8a5cd79d0b71db5d..2251847801f8e7a9d859b6f81cf656aa75160967 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 14df0aaa8b82bb3e879a9449a047dc8bc8c848ff..f19b6a46687581a8242bad13524c90fcd3c761b5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index f29054a131018fcdc307a8009c10ca369263919b..264f1d7fcdde3e76d3116a69492e5e3d4540039a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 52c5705547502b2bf624dfe02a241f3d58ecc332..2e94af97885d105de6cd192ff85afd2266593c39 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index d68e5a16e805de478b9d78c8a475906923cd39b1..7f5aa7eb3b284ccaec469a6629b2fdb66c658ec5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index c0db661a610a8501422455575a0591bc256b03e0..37bf4629805370e89b6ee6b6e1e9ed269006a7a1 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 6cfe4149620e072529e3afe69f96c99eadd70bf2..fbb16bb055e549154aa51a558e4897ac99589d59 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -34,6 +34,7 @@
 #include "wave.h"
 #include "waveFx.h"
 #include <cmath>
+#include <memory>
 #include <samplerate.h>
 #include <sndfile.h>
 
index d0142eac6e44027d0f7eeca52d8c8f3cc54cc8f5..a50f8ecde15ed2dd8968d671b71fafe744c50051 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 248a6043b66103011d2f5a2869f72fbf845bb40d..7d2441c0296de387fcbf3ac35925b0a345fb90e7 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 899c0605761caecde52443901ef2a8aeee8e7cd7..d624e2abddea1f6368513b4c616c109fa265d31a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index a6aa9c2e579e3d115d09321ba8c6fcf2f6752625..2e25bc26b3fcd1644f4d9e1fd94062381379eac6 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -199,7 +199,14 @@ int loadChannel(ID channelId, const std::string& fname)
 
 void addChannel(ID columnId, ChannelType type)
 {
-       g_engine.mixerHandler.addChannel(type, columnId, g_engine.kernelAudio.getBufferSize(), g_engine.channelManager);
+       m::Channel& ch = g_engine.mixerHandler.addChannel(type, columnId,
+           g_engine.kernelAudio.getBufferSize(), g_engine.channelManager);
+
+       auto onSendMidiCb = [channelId = ch.id]() { g_ui.mainWindow->keyboard->notifyMidiOut(channelId); };
+
+       ch.midiLighter.onSend = onSendMidiCb;
+       if (ch.midiSender)
+               ch.midiSender->onSend = onSendMidiCb;
 }
 
 /* -------------------------------------------------------------------------- */
@@ -313,4 +320,15 @@ void setName(ID channelId, const std::string& name)
 {
        g_engine.mixerHandler.renameChannel(channelId, name);
 }
+
+/* -------------------------------------------------------------------------- */
+
+void setCallbacks(m::Channel& ch)
+{
+       auto onSendMidiCb = [channelId = ch.id]() { g_ui.mainWindow->keyboard->notifyMidiOut(channelId); };
+
+       ch.midiLighter.onSend = onSendMidiCb;
+       if (ch.midiSender)
+               ch.midiSender->onSend = onSendMidiCb;
+}
 } // namespace giada::c::channel
index 67e175d56fcf0ed0f965bb7292286e2d90c31271..c98e01dd64f786224dbfccce87c42c295d3246a2 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -162,6 +162,12 @@ void setName(ID channelId, const std::string& name);
 void setHeight(ID channelId, Pixel p);
 
 void setSamplePlayerMode(ID channelId, SamplePlayerMode m);
+
+/* setCallbacks
+Install callbacks to a m::Channel object in order to communicate with the UI. 
+Call this whenever you add a new channel. */
+
+void setCallbacks(m::Channel&);
 } // namespace giada::c::channel
 
 #endif
index 088d0f7210c690cacf5cdcced313437525a838f1..8a962ead32cc8a95614f8a9816484bd3df7a2c64 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -118,14 +118,14 @@ AudioData getAudioData()
        if (g_engine.kernelAudio.hasAPI(RtAudio::LINUX_ALSA))
                audioData.apis[G_SYS_API_ALSA] = "ALSA";
        if (g_engine.kernelAudio.hasAPI(RtAudio::UNIX_JACK))
-               audioData.apis[G_SYS_API_JACK] = "Jack";
+               audioData.apis[G_SYS_API_JACK] = "JACK";
        if (g_engine.kernelAudio.hasAPI(RtAudio::LINUX_PULSE))
                audioData.apis[G_SYS_API_PULSE] = "PulseAudio";
 
 #elif defined(G_OS_FREEBSD)
 
        if (g_engine.kernelAudio.hasAPI(RtAudio::UNIX_JACK))
-               audioData.apis[G_SYS_API_JACK] = "Jack";
+               audioData.apis[G_SYS_API_JACK] = "JACK";
        if (g_engine.kernelAudio.hasAPI(RtAudio::LINUX_PULSE))
                audioData.apis[G_SYS_API_PULSE] = "PulseAudio";
 
index ae479e33cb179b562b54e2029c75baaafdef2c3c..55878c627c72bdf5630c200799342e5c6d5c1d01 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 30a10437e6d4d4110d1fff1e7b519be146a46b0e..2d8b4ca2e7500fe4873523da72d87cdd23864b79 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -68,11 +68,19 @@ void pushEvent_(m::EventDispatcher::Event e, Thread t)
 {
        bool res = true;
        if (t == Thread::MAIN)
+       {
                res = g_engine.eventDispatcher.UIevents.push(e);
+       }
        else if (t == Thread::MIDI)
+       {
                res = g_engine.eventDispatcher.MidiEvents.push(e);
+               u::gui::ScopedLock lock;
+               g_ui.mainWindow->keyboard->notifyMidiIn(e.channelId);
+       }
        else
+       {
                assert(false);
+       }
 
        if (!res)
                G_DEBUG("[events] Queue full!\n");
@@ -108,13 +116,12 @@ void setChannelVolume(ID channelId, float v, Thread t)
 
        pushEvent_({m::EventDispatcher::EventType::CHANNEL_VOLUME, 0, channelId, v}, t);
 
-       sampleEditor::onRefresh(t == Thread::MAIN, [v](v::gdSampleEditor& e) { e.volumeTool->update(v); });
+       sampleEditor::onRefresh(t, [v](v::gdSampleEditor& e) { e.volumeTool->update(v); });
 
        if (t != Thread::MAIN)
        {
-               Fl::lock();
-               g_ui.mainWindow->keyboard->getChannel(channelId)->vol->value(v);
-               Fl::unlock();
+               u::gui::ScopedLock lock;
+               g_ui.mainWindow->keyboard->setChannelVolume(channelId, v);
        }
 }
 
@@ -126,7 +133,7 @@ void setChannelPitch(ID channelId, float v, Thread t)
 
        pushEvent_({m::EventDispatcher::EventType::CHANNEL_PITCH, 0, channelId, v}, t);
 
-       sampleEditor::onRefresh(t == Thread::MAIN, [v](v::gdSampleEditor& e) { e.pitchTool->update(v); });
+       sampleEditor::onRefresh(t, [v](v::gdSampleEditor& e) { e.pitchTool->update(v); });
 }
 
 /* -------------------------------------------------------------------------- */
@@ -138,7 +145,7 @@ void sendChannelPan(ID channelId, float v)
        /* Pan event is currently triggered only by the main thread. */
        pushEvent_({m::EventDispatcher::EventType::CHANNEL_PAN, 0, channelId, v}, Thread::MAIN);
 
-       sampleEditor::onRefresh(/*gui=*/true, [v](v::gdSampleEditor& e) { e.panTool->update(v); });
+       sampleEditor::onRefresh(Thread::MAIN, [v](v::gdSampleEditor& e) { e.panTool->update(v); });
 }
 
 /* -------------------------------------------------------------------------- */
@@ -192,9 +199,8 @@ void setMasterInVolume(float v, Thread t)
 
        if (t != Thread::MAIN)
        {
-               Fl::lock();
+               u::gui::ScopedLock lock;
                g_ui.mainWindow->mainIO->setInVol(v);
-               Fl::unlock();
        }
 }
 
@@ -204,9 +210,8 @@ void setMasterOutVolume(float v, Thread t)
 
        if (t != Thread::MAIN)
        {
-               Fl::lock();
+               u::gui::ScopedLock lock;
                g_ui.mainWindow->mainIO->setOutVol(v);
-               Fl::unlock();
        }
 }
 
@@ -269,10 +274,15 @@ void toggleInputRecording()
 /* -------------------------------------------------------------------------- */
 
 #ifdef WITH_VST
-void setPluginParameter(ID pluginId, int paramIndex, float value, bool gui)
+void setPluginParameter(ID channelId, ID pluginId, int paramIndex, float value, Thread t)
 {
+       if (t == Thread::MIDI)
+       {
+               u::gui::ScopedLock lock;
+               g_ui.mainWindow->keyboard->notifyMidiIn(channelId);
+       }
        g_engine.pluginHost.setPluginParameter(pluginId, paramIndex, value);
-       c::plugin::updateWindow(pluginId, gui);
+       c::plugin::updateWindow(pluginId, t);
 }
 #endif
 } // namespace giada::c::events
index 6816afa8a5df071cd64264c59008e5120a1ad9d1..f1ca0d2196996113a3e6c13605f48a57a4e3f51c 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -75,7 +75,7 @@ void toggleInputRecording();
 /* Plug-ins. */
 
 #ifdef WITH_VST
-void setPluginParameter(ID pluginId, int paramIndex, float value, bool gui);
+void setPluginParameter(ID channelId, ID pluginId, int paramIndex, float value, Thread);
 #endif
 } // namespace giada::c::events
 
index 4555a6d1617de18481643e5b6ed5e8fadd645ff3..eb3184d76ee33219694c064a971c9852f7d3423f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index f8624723bfa3a5c19278325ed292614e4d9cb395..74eca916c487bfe6d244526375f9486c8bc20333 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 711aa24582743f982c925a5376112e4aef2a639e..f3b9fc19fdce9d60c1f8299fac556bc2cbb31051 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -47,6 +47,7 @@
 #include "gui/dialogs/midiIO/midiInputMaster.h"
 #include "gui/dialogs/midiIO/midiOutputMidiCh.h"
 #include "gui/dialogs/midiIO/midiOutputSampleCh.h"
+#include "gui/dialogs/missingAssets.h"
 #include "gui/dialogs/pluginChooser.h"
 #include "gui/dialogs/pluginList.h"
 #include "gui/dialogs/sampleEditor.h"
@@ -161,8 +162,7 @@ void openMidiChannelMidiOutputWindow(ID channelId)
 void openSampleActionEditor(ID channelId)
 {
        g_ui.openSubWindow(*g_ui.mainWindow.get(),
-           new v::gdSampleActionEditor(channelId, g_engine.conf.data, g_engine.sequencer.getFramesInBeat()),
-           WID_ACTION_EDITOR);
+           new v::gdSampleActionEditor(channelId, g_engine.conf.data), WID_ACTION_EDITOR);
 }
 
 /* -------------------------------------------------------------------------- */
@@ -170,8 +170,7 @@ void openSampleActionEditor(ID channelId)
 void openMidiActionEditor(ID channelId)
 {
        g_ui.openSubWindow(*g_ui.mainWindow.get(),
-           new v::gdMidiActionEditor(channelId, g_engine.conf.data, g_engine.sequencer.getFramesInBeat()),
-           WID_ACTION_EDITOR);
+           new v::gdMidiActionEditor(channelId, g_engine.conf.data), WID_ACTION_EDITOR);
 }
 
 /* -------------------------------------------------------------------------- */
@@ -192,6 +191,14 @@ void openRenameChannelWindow(const c::channel::Data& data)
 
 /* -------------------------------------------------------------------------- */
 
+void openMissingAssetsWindow(const m::LoadState& state)
+{
+       g_ui.openSubWindow(*g_ui.mainWindow.get(), new v::gdMissingAssets(state),
+           WID_MISSING_ASSETS);
+}
+
+/* -------------------------------------------------------------------------- */
+
 #ifdef WITH_VST
 
 void openBrowserForPlugins(v::gdWindow& parent)
index a286f94123e6cb4ef5a4e826ac3ad0e251ede117..8526350af37057307ec2df0363987910125183b4 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include "core/types.h"
 #include <string>
 
+namespace giada::m
+{
+struct LoadState;
+}
+
 namespace giada::v
 {
 class gdWindow;
@@ -59,6 +64,7 @@ void openSampleActionEditor(ID channelId);
 void openMidiActionEditor(ID channelId);
 void openSampleEditor(ID channelId);
 void openRenameChannelWindow(const c::channel::Data&);
+void openMissingAssetsWindow(const m::LoadState&);
 #ifdef WITH_VST
 void openBrowserForPlugins(v::gdWindow& parent);
 void openChannelPluginListWindow(ID channelId);
index 3b6874775da9700fd3dd1ee5363edb28159a74dd..fd981bc9b56e774bbee9445e2f5cf0d6e6240e2f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 8757c5011ae4344f9a5ccb5afa33160a922e9f8f..b5bf1b8ade7a32be7a73226792201ab48982056b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index a7010e270e59a338eb10e8f334d02a2d0c82d1a7..86d579887dbf1300a0c7aa1c9f65663fca91f044 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -44,6 +44,7 @@
 #include "utils/gui.h"
 #include <FL/Fl.H>
 #include <cassert>
+#include <memory>
 
 extern giada::v::Ui     g_ui;
 extern giada::m::Engine g_engine;
@@ -136,7 +137,7 @@ std::vector<m::PluginManager::PluginInfo> getPluginsInfo()
 
 /* -------------------------------------------------------------------------- */
 
-void updateWindow(ID pluginId, bool gui)
+void updateWindow(ID pluginId, Thread t)
 {
        m::Plugin* p = g_engine.model.findShared<m::Plugin>(pluginId);
 
@@ -155,11 +156,9 @@ void updateWindow(ID pluginId, bool gui)
        if (child == nullptr)
                return;
 
-       if (!gui)
-               Fl::lock();
-       child->updateParameters(!gui);
-       if (!gui)
-               Fl::unlock();
+       if (t != Thread::MAIN)
+               u::gui::ScopedLock lock;
+       child->updateParameters(t != Thread::MAIN);
 }
 
 /* -------------------------------------------------------------------------- */
@@ -210,7 +209,7 @@ void freePlugin(const m::Plugin& plugin, ID channelId)
 void setProgram(ID pluginId, int programIndex)
 {
        g_engine.pluginHost.setPluginProgram(pluginId, programIndex);
-       updateWindow(pluginId, /*gui=*/true);
+       updateWindow(pluginId, Thread::MAIN);
 }
 
 /* -------------------------------------------------------------------------- */
index dca83f4c8e42f732f682f259fd88629853aa03da..aaebab781b581e99857ee31dd8763a8e35ea3783 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -115,7 +115,7 @@ std::vector<m::PluginManager::PluginInfo> getPluginsInfo();
 Updates the editor-less plug-in window. This is useless if the plug-in has an
 editor. */
 
-void updateWindow(ID pluginId, bool gui);
+void updateWindow(ID pluginId, Thread);
 
 void addPlugin(int pluginListIndex, ID channelId);
 void swapPlugins(const m::Plugin& p1, const m::Plugin& p2, ID channelId);
index 1c2d22a4c043925f89390c58a0a0ca6e13be8540..a25f38218db5a3ad9b48a44c55f016e423dc6e5c 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 6d784328ce8b1e1462a8b700b021e4ddb1232426..efd247e5cf79a91279b032cd00b7bc67fe69c024 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 7fec1745d48eec823c4310efecb41bdd53abdb93..942fb9ecd35d92f9063ee1b16ab9a56bb96fd0c5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -54,6 +54,7 @@
 #include "utils/log.h"
 #include <FL/Fl.H>
 #include <cassert>
+#include <memory>
 
 extern giada::v::Ui     g_ui;
 extern giada::m::Engine g_engine;
@@ -163,16 +164,14 @@ Data getData(ID channelId)
 
 /* -------------------------------------------------------------------------- */
 
-void onRefresh(bool gui, std::function<void(v::gdSampleEditor&)> f)
+void onRefresh(Thread t, std::function<void(v::gdSampleEditor&)> f)
 {
        v::gdSampleEditor* se = static_cast<v::gdSampleEditor*>(g_ui.getSubwindow(*g_ui.mainWindow.get(), WID_SAMPLE_EDITOR));
        if (se == nullptr)
                return;
-       if (!gui)
-               Fl::lock();
+       if (t != Thread::MAIN)
+               u::gui::ScopedLock lock;
        f(*se);
-       if (!gui)
-               Fl::unlock();
 }
 
 v::gdSampleEditor* getSampleEditorWindow()
@@ -357,7 +356,7 @@ void cleanupPreview()
 
 void toNewChannel(ID channelId, Frame a, Frame b)
 {
-       ID columnId = g_ui.mainWindow->keyboard->getChannel(channelId)->getColumnId();
+       ID columnId = g_ui.mainWindow->keyboard->getChannelColumnId(channelId);
        g_engine.mixerHandler.addAndLoadChannel(columnId, g_engine.waveManager.createFromWave(getWave_(channelId), a, b),
            g_engine.kernelAudio.getBufferSize(), g_engine.channelManager);
 }
index fe93099c28c6d27d9d928f16747f8658aa48d517..780c63ba60642e03c23d64b9f55358c799ffc429 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -77,7 +77,7 @@ private:
 
 /* onRefresh --- TODO - wrong name */
 
-void onRefresh(bool gui, std::function<void(v::gdSampleEditor&)> f);
+void onRefresh(Thread, std::function<void(v::gdSampleEditor&)> f);
 
 /* getData
 Returns a Data object filled with data from a channel. */
index ecb2aec4f6973c9c476fecbc25b6a45d02450981..1f18190db7cdd8dde6a58208e27b81b22a648050 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -39,6 +39,8 @@
 #include "core/sequencer.h"
 #include "core/wave.h"
 #include "core/waveManager.h"
+#include "glue/layout.h"
+#include "glue/main.h"
 #include "gui/dialogs/browser/browserLoad.h"
 #include "gui/dialogs/browser/browserSave.h"
 #include "gui/dialogs/mainWindow.h"
@@ -47,7 +49,6 @@
 #include "gui/elems/mainWindow/keyboard/column.h"
 #include "gui/elems/mainWindow/keyboard/keyboard.h"
 #include "gui/ui.h"
-#include "main.h"
 #include "src/core/actions/actionRecorder.h"
 #include "storage.h"
 #include "utils/fs.h"
@@ -73,13 +74,15 @@ void loadProject(void* data)
                p.setProgress(v);
        };
 
-       if (int res = g_engine.load(projectPath, patchPath, progressCb); res != G_PATCH_OK)
+       m::LoadState state = g_engine.load(projectPath, patchPath, progressCb);
+
+       if (state.patch != G_PATCH_OK)
        {
-               if (res == G_PATCH_UNREADABLE)
+               if (state.patch == G_PATCH_UNREADABLE)
                        v::gdAlert("This patch is unreadable.");
-               else if (res == G_PATCH_INVALID)
+               else if (state.patch == G_PATCH_INVALID)
                        v::gdAlert("This patch is not valid.");
-               else if (res == G_PATCH_UNSUPPORTED)
+               else if (state.patch == G_PATCH_UNSUPPORTED)
                        v::gdAlert("This patch format is no longer supported.");
                return;
        }
@@ -88,12 +91,8 @@ void loadProject(void* data)
 
        g_ui.load(g_engine.patch.data);
 
-#ifdef WITH_VST
-
-       if (g_engine.pluginManager.hasMissingPlugins())
-               v::gdAlert("Some plug-ins were not loaded successfully.\nCheck the Plug-in Browser to know more.");
-
-#endif
+       if (!state.isGood())
+               layout::openMissingAssetsWindow(state);
 
        browser->do_callback();
 }
index 661130045347cf3c95d60c129f9841f09765db31..b6df6ddf9605393bc04a1703ec02f7994d42fc35 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 18cd81f5405e809513740302c4b53365816f2234..ac3ded7e6c8ea8b79eba0ea320a5aff0aab61c8f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -54,7 +54,6 @@ gdAbout::gdAbout()
 , vstLogo(8, 265, 324, 50)
 #endif
 {
-       end();
        set_modal();
 
        std::string version = G_VERSION_STR;
@@ -73,6 +72,10 @@ gdAbout::gdAbout()
                                   "www.giadamusic.com")
                            .c_str());
 
+       add(logo);
+       add(text);
+       add(close);
+
 #ifdef WITH_VST
 
        vstLogo.image(new Fl_Pixmap(vstLogo_xpm));
@@ -82,6 +85,9 @@ gdAbout::gdAbout()
            "VST is a trademark of Steinberg\nMedia Technologies GmbH");
        vstText.position(vstText.x(), vstLogo.y() + vstLogo.h());
 
+       add(vstLogo);
+       add(vstText);
+
 #endif
 
        close.callback(cb_close, (void*)this);
index a2cd3ba93af39bf1d192f70fb3c3bc3f60a9b6ea..7083d6d455ef5c7886f9772df25651fc2614f371 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 75f4e23280e42085fa9f719d89e2499f139459ef..18c9051177a4c027be337213388258460c66bea7 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 
 namespace giada::v
 {
-gdBaseActionEditor::gdBaseActionEditor(ID channelId, m::Conf::Data& conf, Frame framesInBeat)
+gdBaseActionEditor::gdBaseActionEditor(ID channelId, m::Conf::Data& conf)
 : gdWindow(conf.actionEditorX, conf.actionEditorY, conf.actionEditorW, conf.actionEditorH)
 , channelId(channelId)
-, gridTool(0, 0, conf, framesInBeat)
+, gridTool(0, 0, conf)
 , zoomInBtn(0, 0, G_GUI_UNIT, G_GUI_UNIT, "", zoomInOff_xpm, zoomInOn_xpm)
 , zoomOutBtn(0, 0, G_GUI_UNIT, G_GUI_UNIT, "", zoomOutOff_xpm, zoomOutOn_xpm)
 , m_barTop(0, 0, Direction::HORIZONTAL)
@@ -116,9 +116,9 @@ Pixel gdBaseActionEditor::frameToPixel(Frame f) const
        return f / m_ratio;
 }
 
-Frame gdBaseActionEditor::pixelToFrame(Pixel p, bool snap) const
+Frame gdBaseActionEditor::pixelToFrame(Pixel p, Frame framesInBeat, bool snap) const
 {
-       return snap ? gridTool.getSnapFrame(p * m_ratio) : p * m_ratio;
+       return snap ? gridTool.getSnapFrame(p * m_ratio, framesInBeat) : p * m_ratio;
 }
 
 /* -------------------------------------------------------------------------- */
index 67a325af0b27766d7a6923b5bbfcd77a69642aa8..3ff2f3817af9e192455f1611b75f77d209d34dba 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -52,7 +52,7 @@ public:
        void draw() override;
 
        Pixel frameToPixel(Frame f) const;
-       Frame pixelToFrame(Pixel p, bool snap = true) const;
+       Frame pixelToFrame(Pixel p, Frame framesInBeat, bool snap = true) const;
 
        ID channelId;
 
@@ -68,7 +68,7 @@ protected:
        static constexpr float MAX_RATIO  = 40000.0f;
        static constexpr float RATIO_STEP = 1.5f;
 
-       gdBaseActionEditor(ID channelId, m::Conf::Data&, Frame framesInBeat);
+       gdBaseActionEditor(ID channelId, m::Conf::Data&);
 
        /* getMouseOverContent
        Returns mouse x-position relative to the viewport content. */
index 911dfdfc3c66956ec24c3f3cc309c3057092aef7..a270a103bcc8870a8eb9e15c09688078d6c8d12d 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -32,8 +32,8 @@
 
 namespace giada::v
 {
-gdMidiActionEditor::gdMidiActionEditor(ID channelId, m::Conf::Data& conf, Frame framesInBeat)
-: gdBaseActionEditor(channelId, conf, framesInBeat)
+gdMidiActionEditor::gdMidiActionEditor(ID channelId, m::Conf::Data& conf)
+: gdBaseActionEditor(channelId, conf)
 , m_barPadding(0, 0, w() - 150, G_GUI_UNIT)
 , m_pianoRoll(0, 0, this)
 , m_velocityEditor(0, 0, this)
index 75749cf762cbfb91c5a1182700dbc224c9650274..4722d65acf0955e3bbdef006de8fc0f636ea75e7 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -37,7 +37,7 @@ namespace giada::v
 class gdMidiActionEditor : public gdBaseActionEditor
 {
 public:
-       gdMidiActionEditor(ID channelId, m::Conf::Data&, Frame framesInBeat);
+       gdMidiActionEditor(ID channelId, m::Conf::Data&);
        ~gdMidiActionEditor();
 
        void rebuild() override;
index 939b90af46471f4b2f4ac3cbc43cb6fea2b711a1..0f013d69ccbff4061a50f5077dd7881f117e2fb2 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -36,8 +36,8 @@
 
 namespace giada::v
 {
-gdSampleActionEditor::gdSampleActionEditor(ID channelId, m::Conf::Data& conf, Frame framesInBeat)
-: gdBaseActionEditor(channelId, conf, framesInBeat)
+gdSampleActionEditor::gdSampleActionEditor(ID channelId, m::Conf::Data& conf)
+: gdBaseActionEditor(channelId, conf)
 , m_barPadding(0, 0, w() - 232, G_GUI_UNIT)
 , m_sampleActionEditor(0, 0, this)
 , m_envelopeEditor(0, 0, "Volume", this)
index 202133112e1aa5121537571bc6bc60b280df03c2..a1f42dfaec67d0537b418acf693fef33e8c3d2b3 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -38,7 +38,7 @@ namespace giada::v
 class gdSampleActionEditor : public gdBaseActionEditor
 {
 public:
-       gdSampleActionEditor(ID channelId, m::Conf::Data&, Frame framesInBeat);
+       gdSampleActionEditor(ID channelId, m::Conf::Data&);
        ~gdSampleActionEditor();
 
        void rebuild() override;
index 7951b7d301e3bd458c37b57b66f7f9e0328843ca..c777498a53fc8f7d587f274b7c984ddd7c1c1a07 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -44,6 +44,7 @@ gdBeatsInput::gdBeatsInput(int beats, int bars)
 {
        set_modal();
 
+       begin();
        m_beats = new geInput(8, 8, 43, G_GUI_UNIT);
        m_bars  = new geInput(m_beats->x() + m_beats->w() + 4, 8, 43, G_GUI_UNIT);
        m_ok    = new geButton(m_bars->x() + m_bars->w() + 4, 8, 70, G_GUI_UNIT, "Ok");
index 19ed954ab136d06420f5c1db6df9a8b487cd9597..5a6872482615ba648291a0fdba91abac8bafdad4 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include "window.h"
 
 class geInput;
-class geButton;
 class geCheck;
 
 namespace giada::v
 {
+class geButton;
 class gdBeatsInput : public gdWindow
 {
 public:
index 0364ae4a4ef2655a63595c5db215da22bc1ff992..b84c6552c00f953fbbf038be7e6f865d2a623b73 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -45,6 +45,7 @@ gdBpmInput::gdBpmInput(const char* label)
 {
        set_modal();
 
+       begin();
        input_a = new geInput(8, 8, 30, G_GUI_UNIT);
        input_b = new geInput(42, 8, 20, G_GUI_UNIT);
        ok      = new geButton(66, 8, 70, G_GUI_UNIT, "Ok");
index 5dde87dac89a3eeedde0284cfb60747ee0ae8e67..8658e9ad8b70f8025297b2ee322085ba3d5c23c5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include "window.h"
 
 class geInput;
-class geButton;
 
 namespace giada::v
 {
+class geButton;
 class gdBpmInput : public gdWindow
 {
 public:
index 7366d18cf4720e5b92b4f28c2d6d3f42aa1fb6f5..1ed00285da2e668f9834c8c9d4f9afb47ae69b85 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -33,7 +33,7 @@
 #include "gui/elems/basics/check.h"
 #include "gui/elems/basics/input.h"
 #include "gui/elems/basics/progress.h"
-#include "gui/elems/browser.h"
+#include "gui/elems/fileBrowser.h"
 #include "utils/fs.h"
 #include "utils/gui.h"
 
@@ -49,6 +49,8 @@ gdBrowserBase::gdBrowserBase(const std::string& title, const std::string& path,
 {
        set_non_modal();
 
+       begin();
+       
        groupTop    = new Fl_Group(8, 8, w() - 16, 48);
        hiddenFiles = new geCheck(groupTop->x(), groupTop->y(), 400, 20, "Show hidden files");
        where       = new geInput(groupTop->x(), hiddenFiles->y() + hiddenFiles->h() + 8, 20, 20);
@@ -64,7 +66,7 @@ gdBrowserBase::gdBrowserBase(const std::string& title, const std::string& path,
 
        updir->callback(cb_up, (void*)this);
 
-       browser = new geBrowser(8, groupTop->y() + groupTop->h() + 8, w() - 16, h() - 101);
+       browser = new geFileBrowser(8, groupTop->y() + groupTop->h() + 8, w() - 16, h() - 101);
        browser->loadDir(path);
        if (path == m_conf.browserLastPath)
                browser->preselect(m_conf.browserPosition, m_conf.browserLastValue);
index f9d9c10e0063fecf2968d380d72a2c0c56435ad3..af92f9c8f79a504ad7edd54923f436c00a0aedbb 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -35,7 +35,6 @@
 
 class Fl_Group;
 class geCheck;
-class geButton;
 class geInput;
 
 namespace giada::m
@@ -45,7 +44,8 @@ class Channel;
 
 namespace giada::v
 {
-class geBrowser;
+class geButton;
+class geFileBrowser;
 class gdBrowserBase : public gdWindow
 {
 public:
@@ -79,13 +79,13 @@ protected:
        m::Conf::Data& m_conf;
        ID             m_channelId;
 
-       Fl_Group*  groupTop;
-       geCheck*   hiddenFiles;
-       geBrowser* browser;
-       geButton*  ok;
-       geButton*  cancel;
-       geInput*   where;
-       geButton*  updir;
+       Fl_Group*      groupTop;
+       geCheck*       hiddenFiles;
+       geFileBrowser* browser;
+       geButton*      ok;
+       geButton*      cancel;
+       geInput*       where;
+       geButton*      updir;
 };
 } // namespace giada::v
 
index 46ee90351df3d3b0d38e4975bf50261327926793..69ea65ac78017b02e40bb009dced10ada2a30102 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -27,7 +27,7 @@
 #include "browserDir.h"
 #include "gui/elems/basics/button.h"
 #include "gui/elems/basics/input.h"
-#include "gui/elems/browser.h"
+#include "gui/elems/fileBrowser.h"
 #include "utils/fs.h"
 
 namespace giada::v
index daf93fd2ac069d455a529728b485a6be661bff07..218d002d88127c3a1f96cb5460c295cf0ef0938e 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 4b1d7e8135ef04ebffef6132aa8347b28deef8a2..5b4d90fecc0e88c3b049b23983c1dc96bf01615d 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -27,7 +27,7 @@
 #include "browserLoad.h"
 #include "gui/elems/basics/button.h"
 #include "gui/elems/basics/input.h"
-#include "gui/elems/browser.h"
+#include "gui/elems/fileBrowser.h"
 #include "utils/fs.h"
 
 namespace giada::v
index c01965b65892de4d3209bdacf640d2f658f898a6..828276de20bc598aa45da0ef2dc1034448e422bb 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index eb9e358d3743ed1c8e75becbfb76748f2f80a830..56f18c0b2fe12e8cc1d434d62cf71f1a86ae3211 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -27,7 +27,7 @@
 #include "browserSave.h"
 #include "gui/elems/basics/button.h"
 #include "gui/elems/basics/input.h"
-#include "gui/elems/browser.h"
+#include "gui/elems/fileBrowser.h"
 #include "utils/fs.h"
 
 namespace giada::v
index c8d7c86e70e15847fadde8613cab5e8390fe82e2..8f07133507c46fda53dc0cd5638aea2d20d0f16b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index f5f2d07313ad0357a5db5d371d37d111a65ffe0b..ed9ac9c1c35dbd62bc7e4f85922d799a5ede0bc3 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -43,6 +43,7 @@ gdChannelNameInput::gdChannelNameInput(const c::channel::Data& d)
 {
        set_modal();
 
+       begin();
        m_name   = new geInput(G_GUI_OUTER_MARGIN, G_GUI_OUTER_MARGIN, w() - (G_GUI_OUTER_MARGIN * 2), G_GUI_UNIT);
        m_ok     = new geButton(w() - 70 - G_GUI_OUTER_MARGIN, m_name->y() + m_name->h() + G_GUI_OUTER_MARGIN, 70, G_GUI_UNIT, "Ok");
        m_cancel = new geButton(m_ok->x() - 70 - G_GUI_OUTER_MARGIN, m_ok->y(), 70, G_GUI_UNIT, "Cancel");
index 6325c9e72603be2c8a0c8634f4fde0a502d4b536..c9286ae6844dedc64d6fec5f547604bfc0c4731a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include "window.h"
 
 class geInput;
-class geButton;
 
 namespace giada::c::channel
 {
 struct Data;
 }
+
 namespace giada::v
 {
+class geButton;
 class gdChannelNameInput : public gdWindow
 {
 public:
        gdChannelNameInput(const c::channel::Data& d);
 
-  private:
+private:
        static void cb_update(Fl_Widget* /*w*/, void* p);
        static void cb_cancel(Fl_Widget* /*w*/, void* p);
        void        cb_update();
index fee616fecc00daa041ed7cabe70d8c5be9dfe0d9..3ee0661fb5b7f34a7c0dea5083c5bec3b93a76c4 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -42,6 +42,8 @@ namespace giada::v
 gdConfig::gdConfig(int w, int h, m::Conf::Data& conf)
 : gdWindow(u::gui::centerWindowX(w), u::gui::centerWindowY(h), w, h, "Configuration")
 {
+       begin();
+
        Fl_Tabs* tabs = new Fl_Tabs(8, 8, w - 16, h - 44);
        tabs->box(G_CUSTOM_BORDER_BOX);
        tabs->labelcolor(G_COLOR_LIGHT_2);
index de259114b7468afa381724d2e8db216eaf43246f..23dabf8275f002327b7d197f70ab768fc74d6cd4 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include "core/conf.h"
 #include "window.h"
 
-class geButton;
 class geCheck;
 class geInput;
 class geBox;
 
 namespace giada::v
 {
+class geButton;
 class geChoice;
 class geTabAudio;
 class geTabBehaviors;
index 1ee505b8ad0cfc0600342ea939a224937a6960e7..bfdc43345b85f156d3a7895524b3e8e5d942d03d 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index bd66e8f9f795acb376fc0933e95565d01bd784f5..789e170c7ac14346f8d403ed54e4c6f19ef9166b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -31,7 +31,6 @@
 #include <FL/Fl.H>
 
 class geBox;
-class geButton;
 
 namespace giada::c::channel
 {
@@ -40,6 +39,7 @@ struct Data;
 
 namespace giada::v
 {
+class geButton;
 class gdKeyGrabber : public gdWindow
 {
 public:
index 50f566ca1349a2bf06f8da1643637ed3f80fad22..da46a8619a27e3bcbd87d142c85124457817746a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -29,6 +29,7 @@
 #include "core/const.h"
 #include "core/init.h"
 #include "gui/elems/basics/boxtypes.h"
+#include "gui/elems/basics/flex.h"
 #include "gui/elems/mainWindow/keyboard/keyboard.h"
 #include "gui/elems/mainWindow/mainIO.h"
 #include "gui/elems/mainWindow/mainMenu.h"
@@ -69,7 +70,6 @@ gdMainWindow::gdMainWindow(int W, int H, const char* title, int argc, char** arg
 : gdWindow(W, H, title)
 , m_conf(c)
 {
-
        Fl::visible_focus(0);
 
        Fl::background(25, 25, 25); // TODO use G_COLOR_GREY_1
@@ -89,12 +89,8 @@ gdMainWindow::gdMainWindow(int W, int H, const char* title, int argc, char** arg
 
        size_range(G_MIN_GUI_WIDTH, G_MIN_GUI_HEIGHT);
 
-       mainMenu = new v::geMainMenu(8, 0);
-#if defined(WITH_VST)
-       mainIO = new v::geMainIO(412, 8);
-#else
-       mainIO = new v::geMainIO(460, 8);
-#endif
+       mainMenu      = new v::geMainMenu(0, 0);
+       mainIO        = new v::geMainIO(0, 0, 0, 0);
        mainTransport = new v::geMainTransport(8, 39);
        mainTimer     = new v::geMainTimer(571, 44);
        sequencer     = new v::geSequencer(100, 78, 609, 30);
@@ -102,10 +98,12 @@ gdMainWindow::gdMainWindow(int W, int H, const char* title, int argc, char** arg
 
        /* zone 1 - menus, and I/O tools */
 
-       Fl_Group* zone1 = new Fl_Group(8, 0, W - 16, 28);
-       zone1->add(mainMenu);
-       zone1->resizable(new Fl_Box(300, 8, 80, 20));
-       zone1->add(mainIO);
+       geFlex* zone1 = new geFlex(getContentBounds().reduced(G_GUI_OUTER_MARGIN).withH(G_GUI_UNIT),
+           Direction::HORIZONTAL, G_GUI_INNER_MARGIN);
+       zone1->add(mainMenu, 300);
+       zone1->add(new Fl_Box(0, 0, 0, 0));
+       zone1->add(mainIO, 430);
+       zone1->end();
 
        /* zone 2 - mainTransport and timing tools */
 
index 5c9e2fba6a8386d05045c9a814a4e91d99bc2cde..f0ae97d2cb6181fc1758ce11f869839a2b429a06 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -55,7 +55,7 @@ public:
 
        void clearKeyboard();
 
-       ScopedProgress getScopedProgress(const char* msg);
+       [[nodiscard]] ScopedProgress getScopedProgress(const char* msg);
 
        geKeyboard*      keyboard;
        geSequencer*     sequencer;
index f2e4a6d67505038692ef755c29794dc3c57feafd..c8189c06e72dfb3ef7a1b930e49c1cdc4b488680 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 85463548aec2597d0297633b8fce8bd44ffe4e00..6aa6cb39d286d8453fe690bdb355e48febc57d00 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include "gui/dialogs/window.h"
 #include "gui/elems/midiIO/midiLearner.h"
 
-class geButton;
 class geCheck;
 
 namespace giada::v
 {
+class geButton;
 class geChoice;
 class gdMidiInputBase : public gdWindow
 {
index 84621f9b30e581965516b44f05b698bac5ed2050..214a9570d6c62a5b07a40f9f7918bd460e92d6ff 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -52,7 +52,7 @@ geChannelLearnerPack::geChannelLearnerPack(int x, int y, const c::io::Channel_In
        setCallbacks(
            [channelId = channel.channelId](int param) { c::io::channel_startMidiLearn(param, channelId); },
            [channelId = channel.channelId](int param) { c::io::channel_clearMidiLearn(param, channelId); });
-       addMidiLearner("keyPress", G_MIDI_IN_KEYPRESS);
+       addMidiLearner("key press", G_MIDI_IN_KEYPRESS);
        addMidiLearner("key release", G_MIDI_IN_KEYREL);
        addMidiLearner("key kill", G_MIDI_IN_KILL);
        addMidiLearner("arm", G_MIDI_IN_ARM);
index 9266febb2988f0fd16ee76ac7e4a0f0d27e1b6dc..a9e4e3fdd859e20e49c9bd846605faaf39bf7e43 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index e2bf9b0f278d2777f6a6f5c8cd9c042bb26c18bc..8360e1ff9a1ba54732a57f7302b858673eb13ac7 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index a4013b0988eb3b822acb0da06b33108300b94553..512f8ef5a8b1c16e8d5d17ef99d700993d52bcb8 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index fd75e243b95b274e364f6dcabb56ce729722a80f..7635ab9f77eb7bb1b4f9ee00ccd7b947fe744f00 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index df9de01e192c5178d2a76c31d1e1d3b95a712472..28b9e8fd8ac2be3aa34f844248aa04b005206a7f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -33,7 +33,6 @@
 #include "gui/elems/midiIO/midiLearner.h"
 #include "gui/elems/midiIO/midiLearnerPack.h"
 
-class geButton;
 class geCheck;
 
 /* There's no such thing as a gdMidiOutputMaster vs gdMidiOutputChannel. MIDI
@@ -47,6 +46,7 @@ namespace giada
 {
 namespace v
 {
+class geButton;
 class geLightningLearnerPack : public geMidiLearnerPack
 {
 public:
@@ -63,7 +63,7 @@ public:
        gdMidiOutputBase(int w, int h, ID channelId);
        ~gdMidiOutputBase();
 
-  protected:
+protected:
        /* cb_close
        close current window. */
 
index 801ea4e79eb29a5cdae8dbd589e2da7bfc1847e0..997cbbeed1a96375e5356b01acc0234b117c9622 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 61bc1702e15c22622c4ecdef3d2a00c51eca69ec..53f8a95a765efc1c1756ba9312e21a46227bc50f 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 43ad49b939fcd9477435b8cc64aa3664cdefdc84..0c0fde308a09db9873b7e81d8098dd8c37287f62 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 68a433a7c9cf09ceea5507916f734604e1757b0d..668a178042c6185de7b47127febcb3cd554fb34e 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
diff --git a/src/gui/dialogs/missingAssets.cpp b/src/gui/dialogs/missingAssets.cpp
new file mode 100644 (file)
index 0000000..03b897f
--- /dev/null
@@ -0,0 +1,91 @@
+/* -----------------------------------------------------------------------------
+ *
+ * Giada - Your Hardcore Loopmachine
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
+ *
+ * This file is part of Giada - Your Hardcore Loopmachine.
+ *
+ * Giada - Your Hardcore Loopmachine is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Giada - Your Hardcore Loopmachine is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Giada - Your Hardcore Loopmachine. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * -------------------------------------------------------------------------- */
+
+#include "gui/dialogs/missingAssets.h"
+#include "core/engine.h"
+#include "gui/elems/basics/box.h"
+#include "gui/elems/basics/browser.h"
+#include "gui/elems/basics/button.h"
+#include "gui/elems/basics/flex.h"
+#include "utils/gui.h"
+#include <FL/Fl_Group.H>
+
+namespace giada::v
+{
+gdMissingAssets::gdMissingAssets(const m::LoadState& state)
+: gdWindow(u::gui::getCenterWinBounds(400, 300), "Warning")
+{
+       geFlex* container = new geFlex(getContentBounds().reduced({G_GUI_OUTER_MARGIN}), Direction::VERTICAL, G_GUI_OUTER_MARGIN);
+       {
+               geFlex* body = new geFlex(Direction::VERTICAL, G_GUI_INNER_MARGIN);
+               {
+                       geBox* textIntro = new geBox("This project contains missing assets.", FL_ALIGN_LEFT);
+                       textIntro->color(G_COLOR_BLUE);
+
+                       body->add(textIntro, G_GUI_UNIT);
+
+                       if (state.missingWaves.size() > 0)
+                       {
+                               geBrowser* waves = new geBrowser();
+                               for (const std::string& s : state.missingWaves)
+                                       waves->add(s.c_str());
+                               body->add(new geBox("Audio files not found in the project folder:", FL_ALIGN_LEFT), G_GUI_UNIT);
+                               body->add(waves);
+                       }
+
+                       if (state.missingPlugins.size() > 0)
+                       {
+                               geBrowser* plugins = new geBrowser();
+                               for (const std::string& s : state.missingPlugins)
+                                       plugins->add(s.c_str());
+                               body->add(new geBox("Audio plug-ins not found globally:", FL_ALIGN_LEFT), G_GUI_UNIT);
+                               body->add(plugins);
+                       }
+                       body->end();
+               }
+
+               geFlex* footer = new geFlex(Direction::HORIZONTAL);
+               {
+                       geButton* close = new geButton("Close");
+                       close->onClick  = [this]() { do_callback(); };
+                       footer->add(new geBox()); // Spacer
+                       footer->add(close, 80);
+                       footer->end();
+               }
+
+               container->add(body);
+               container->add(footer, G_GUI_UNIT);
+               container->end();
+       }
+
+       add(container);
+       resizable(container);
+
+       set_modal();
+       u::gui::setFavicon(this);
+       show();
+}
+} // namespace giada::v
\ No newline at end of file
diff --git a/src/gui/dialogs/missingAssets.h b/src/gui/dialogs/missingAssets.h
new file mode 100644 (file)
index 0000000..bd1ca05
--- /dev/null
@@ -0,0 +1,46 @@
+/* -----------------------------------------------------------------------------
+ *
+ * Giada - Your Hardcore Loopmachine
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
+ *
+ * This file is part of Giada - Your Hardcore Loopmachine.
+ *
+ * Giada - Your Hardcore Loopmachine is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Giada - Your Hardcore Loopmachine is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Giada - Your Hardcore Loopmachine. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * -------------------------------------------------------------------------- */
+
+#ifndef GD_MISSING_ASSETS_H
+#define GD_MISSING_ASSETS_H
+
+#include "gui/dialogs/window.h"
+
+namespace giada::m
+{
+struct LoadState;
+}
+
+namespace giada::v
+{
+class gdMissingAssets : public gdWindow
+{
+public:
+       gdMissingAssets(const m::LoadState&);
+};
+} // namespace giada::v
+
+#endif
index c0d94b3cc3d8dc780ad5f351e41b1d699dd85c85..b170aa7f8c50c48d1f4d30aa7cf9d4fb69dbe916 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -42,6 +42,8 @@ gdPluginChooser::gdPluginChooser(int X, int Y, int W, int H, ID channelId, m::Co
 , m_conf(c)
 , m_channelId(channelId)
 {
+       begin();
+
        /* top area */
        Fl_Group* group_top = new Fl_Group(8, 8, w() - 16, 20);
        sortMethod          = new geChoice(group_top->x() + 45, group_top->y(), 100, 20, "Sort by");
@@ -65,6 +67,7 @@ gdPluginChooser::gdPluginChooser(int X, int Y, int W, int H, ID channelId, m::Co
        sortMethod->add("Name");
        sortMethod->add("Category");
        sortMethod->add("Manufacturer");
+       sortMethod->add("Format");
        sortMethod->callback(cb_sort, (void*)this);
        sortMethod->value(m_conf.pluginSortMethod);
 
index a5ab32325d0aa4d855f0e3f1b9c2d48bc8f7d5a5..e3d2f849d0e8f2718f4a47cbacf640b7c6416243 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include <FL/Fl.H>
 #include <FL/Fl_Scroll.H>
 
-class geButton;
-class geButton;
-
 namespace giada::v
 {
+class geButton;
 class geChoice;
 class gePluginBrowser;
 
index 12e73c4045ffbea6c0c712ff20df227139ac17d4..02fee22c963fd6b728c62ce449141c3190b4b405 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index a1f4c10b6eeb23a039f0d8cbda5a915d32b74de6..81d043c824ad1a1f62e5b177bf35ef07a96c31bd 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include "glue/plugin.h"
 #include "window.h"
 
-class geButton;
-
 namespace giada::v
 {
+class geButton;
 class geLiquidScroll;
 class gePluginElement;
 class gdPluginList : public gdWindow
index a7f5f0717452cc5bf434f0ea262694a9d36184b7..f4e712ad1a839e60a36cb04d992710463af03462 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -42,6 +42,8 @@ gdPluginWindow::gdPluginWindow(const c::plugin::Plugin& plugin)
 {
        set_non_modal();
 
+       begin();
+
        m_list = new geLiquidScroll(G_GUI_OUTER_MARGIN, G_GUI_OUTER_MARGIN,
            w() - (G_GUI_OUTER_MARGIN * 2), h() - (G_GUI_OUTER_MARGIN * 2),
            Direction::VERTICAL);
index 7613e4d05d99e57ece51c0fab6d59209451ce845..0b825484ef5bcd5f9e1102dbcef34397b451a840 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 3b21d6a16d24ad3f1632ed373a64e70e81316059..f06126d7e201106a4f10884de3c9673599e7eda4 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index daf5127bdabd1634b4bb56b473c71ee1883f2b40..6877c169aecd20d9c4eff6308d28deff7800f633 100644 (file)
@@ -7,7 +7,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -36,6 +36,7 @@
 #include "window.h"
 #include <FL/Fl.H>
 #include <FL/Fl_Window.H>
+#include <memory>
 
 namespace giada::c::plugin
 {
index ac983f373d60f089aa82347f2cec6ae0f128ff72..a42cb3df730c9532a8699756416a30b2ceb14f58 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index bae1850015d312e0268ffffec8ef5d72b2aaf729..d9b6759a839018f7c0c47c02a567d202a3d36183 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 1fcb0fc56a8da5629c824ba97300c69e31be01ff..9a80c58d1ef94e7c728336f945864437badb56c2 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 23f0c014be84a9cf906cd5647df6c406491820b3..81c9074eb7e18ed990c73c8ab63c596b7a06f31b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #ifndef GD_EDITOR_H
 #define GD_EDITOR_H
 
-#include "core/types.h"
 #include "core/conf.h"
+#include "core/types.h"
 #include "glue/sampleEditor.h"
 #include "window.h"
 
-class geButton;
 class geCheck;
 class geBox;
-class geButton;
 class geStatusButton;
 
 namespace giada::m
@@ -45,6 +43,7 @@ class Wave;
 
 namespace giada::v
 {
+class geButton;
 class geChoice;
 class gePack;
 class geGroup;
index 96230b7991461615c01a8a3237d2f2507906e7b5..48964fe28f7bd170c65dae23ef93156ade6a7f32 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include <FL/Fl.H>
 #include <FL/Fl_Window.H>
 
-namespace giada
+namespace giada::v
 {
-namespace v
+namespace
 {
-void gdAlert(const char* c)
+bool confirmRet_ = false;
+}
+
+/* -------------------------------------------------------------------------- */
+/* -------------------------------------------------------------------------- */
+/* -------------------------------------------------------------------------- */
+
+void gdAlert(const char* msg)
 {
-       gdWindow* modal = new gdWindow(
-           (Fl::w() / 2) - 150,
-           (Fl::h() / 2) - 47,
-           300, 90, "Alert");
-       modal->set_modal();
-       modal->begin();
-       geBox*    box = new geBox(10, 10, 280, 40, c);
+       gdWindow win(u::gui::getCenterWinBounds(300, 90), "Alert");
+       win.set_modal();
+       win.begin();
+       geBox*    box = new geBox(10, 10, 280, 40, msg);
        geButton* b   = new geButton(210, 60, 80, 20, "Close");
-       modal->end();
+       win.end();
        box->labelsize(G_GUI_FONT_SIZE_BASE);
-       b->callback(cb_window_closer, (void*)modal);
+
        b->shortcut(FL_Enter);
-       u::gui::setFavicon(modal);
-       modal->show();
+       b->onClick = [&win]() { win.hide(); };
+
+       u::gui::setFavicon(&win);
+       win.show();
+
+       while (win.shown())
+               Fl::wait();
 }
 
+/* -------------------------------------------------------------------------- */
+
 int gdConfirmWin(const char* title, const char* msg)
 {
-       gdWindow* win = new gdWindow(
-           (Fl::w() / 2) - 150,
-           (Fl::h() / 2) - 47,
-           300, 90, title);
-       win->set_modal();
-       win->begin();
+       gdWindow win(u::gui::getCenterWinBounds(300, 90), title);
+       win.set_modal();
+       win.begin();
        new geBox(10, 10, 280, 40, msg);
        geButton* ok = new geButton(212, 62, 80, 20, "Ok");
        geButton* ko = new geButton(124, 62, 80, 20, "Cancel");
-       win->end();
+       win.end();
+
        ok->shortcut(FL_Enter);
-       u::gui::setFavicon(win);
-       win->show();
+       ok->onClick = [&win]() { confirmRet_ = true; win.hide(); };
+
+       ko->onClick = [&win]() { confirmRet_ = false; win.hide(); };
+
+       u::gui::setFavicon(&win);
+       win.show();
 
-       /* no callbacks here. readqueue() check the event stack. */
+       while (win.shown())
+               Fl::wait();
 
-       int r = 0;
-       while (true)
-       {
-               Fl_Widget* o = Fl::readqueue();
-               if (!o)
-                       Fl::wait();
-               else if (o == ok)
-               {
-                       r = 1;
-                       break;
-               }
-               else if (o == ko)
-               {
-                       r = 0;
-                       break;
-               }
-       }
-       //delete win;
-       win->hide();
-       return r;
+       return confirmRet_;
 }
-} // namespace v
-} // namespace giada
\ No newline at end of file
+} // namespace giada::v
\ No newline at end of file
index 1cbf284dfb3f12c62e74c555ef2fafacac0014d0..22b4a42a1b869d34f538446be54328f9a52daaa8 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #ifndef GD_WARNINGS_H
 #define GD_WARNINGS_H
 
-namespace giada
-{
-namespace v
+namespace giada::v
 {
 void gdAlert(const char* c);
 int  gdConfirmWin(const char* title, const char* msg);
 } // namespace v
-} // namespace giada
 
 #endif
index adec425371fe25d97c00edfcb0b342941c7531c9..58754ada619cebcf9f022c4e2c2c7760a39b0f79 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 
 namespace giada::v
 {
-void cb_window_closer(Fl_Widget* /*v*/, void* p)
-{
-       delete (Fl_Window*)p;
-}
-
-/* -------------------------------------------------------------------------- */
-
 gdWindow::gdWindow(int x, int y, int w, int h, const char* title, int id)
 : Fl_Double_Window(x, y, w, h, title)
 , id(id)
 , parent(nullptr)
 {
+       end();
 }
 
 /* -------------------------------------------------------------------------- */
@@ -49,6 +43,14 @@ gdWindow::gdWindow(int w, int h, const char* title, int id)
 : Fl_Double_Window(w, h, title)
 , id(id)
 , parent(nullptr)
+{
+       end();
+}
+
+/* -------------------------------------------------------------------------- */
+
+gdWindow::gdWindow(geompp::Rect<int> r, const char* title, int id)
+: gdWindow(r.x, r.y, r.w, r.h, title, id)
 {
 }
 
@@ -137,6 +139,13 @@ void gdWindow::debug() const
 
 /* -------------------------------------------------------------------------- */
 
+geompp::Rect<int> gdWindow::getContentBounds() const
+{
+       return {0, 0, w(), h()};
+}
+
+/* -------------------------------------------------------------------------- */
+
 gdWindow* gdWindow::getParent()
 {
        return parent;
index c2d46489000cddf8dae938a1d7dc77d2af9c2ebf..aac3f197da5142eb8414d83503c28e29cc6f2b28 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #ifndef GD_WINDOW_H
 #define GD_WINDOW_H
 
+#include "deps/geompp/src/rect.hpp"
 #include <FL/Fl_Double_Window.H>
 #include <vector>
 
 namespace giada::v
 {
-/* cb_window_closer
-Callback for closing windows. Deletes the widget (delete). */
-
-void cb_window_closer(Fl_Widget* /*w*/, void* p);
-
 class gdWindow : public Fl_Double_Window
 {
 public:
        gdWindow(int x, int y, int w, int h, const char* title = 0, int id = 0);
        gdWindow(int w, int h, const char* title = 0, int id = 0);
+       gdWindow(geompp::Rect<int>, const char* title = 0, int id = 0);
        ~gdWindow();
 
        static void cb_closeChild(Fl_Widget* /*w*/, void* p);
@@ -62,6 +59,8 @@ public:
        int  getId() const;
        void debug() const;
 
+       geompp::Rect<int> getContentBounds() const;
+
        void      addSubWindow(gdWindow* w);
        void      delSubWindow(gdWindow* w);
        void      delSubWindow(int id);
index d7e594ed4bd507a24ef16d7bf457c250457d156c..75b48c2836addce2bf11ca5dda8047ad7653810d 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 3521dc14aff75601e4e68116c6850110a9e00a63..e31d121b59756497dbf2dd1cd8d13c4a27b477fe 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index b1b9cd6110dbef7bfb4232f636d4ec84c1d2bd79..3bc616bdd09fb0f5f4f0c1364fadb3fac65557ce 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 4ee79558571d71d570c0921e4231bd4955fbe53b..6eb3b61eb9622b082d38ab07c71edd64a246a53f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 04cc65afcf671c5b4d8f95da7aba70baca83d03a..989f8f09ee2fe242c9e2e856782867675daf3072 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 0fb7bb7d12ef47e297f97f77e8a44c561b839eda..35c3738535fa578753abdb47fee092436123869a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index c8ffdbafd451a6b2d133826d15d6f1369f8f07e5..2ae40ac24eccabb373f444aab620c351e397f6f6 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -77,7 +77,7 @@ void geBaseActionEditor::baseDraw(bool clear) const
        if (m_base->gridTool.getValue() > 1)
        {
                fl_color(G_COLOR_GREY_3);
-               drawVerticals(m_base->gridTool.getCellSize());
+               drawVerticals(m_base->gridTool.getCellSize(m_data->framesInBeat));
        }
 
        fl_color(G_COLOR_GREY_4);
index f973375799f725a469db7e7e90f72bc155e29d7c..dd47439174e38fab7e41e5d7ed8d59c95569b4cd 100644 (file)
@@ -5,7 +5,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 9fa0d28c785eb1a80291c2b7e61a291941cd82e5..e6ad8f9235d01f9ec863447189f7d8df0ba19622 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -149,7 +149,7 @@ int geEnvelopeEditor::yToValue(Pixel pixel, Pixel offset) const
 
 void geEnvelopeEditor::onAddAction()
 {
-       Frame f = m_base->pixelToFrame(Fl::event_x() - x());
+       Frame f = m_base->pixelToFrame(Fl::event_x() - x(), m_data->framesInBeat);
        int   v = yToValue(Fl::event_y() - y());
 
        c::actionEditor::recordEnvelopeAction(m_data->channelId, f, v);
@@ -199,9 +199,10 @@ void geEnvelopeEditor::onMoveAction()
 
 void geEnvelopeEditor::onRefreshAction()
 {
-       Frame f = m_base->pixelToFrame((m_action->x() - x()) + geEnvelopePoint::SIDE / 2);
-       float v = yToValue(m_action->y() - y(), geEnvelopePoint::SIDE);
-       c::actionEditor::updateEnvelopeAction(m_data->channelId, m_action->a1, f, v);
+       const Frame f  = (m_action->x() - x()) + geEnvelopePoint::SIDE / 2;
+       const Frame fq = m_base->pixelToFrame(f, m_data->framesInBeat);
+       const float v  = yToValue(m_action->y() - y(), geEnvelopePoint::SIDE);
+       c::actionEditor::updateEnvelopeAction(m_data->channelId, m_action->a1, fq, v);
 
        m_base->rebuild();
 }
index 49675fa8104b0963f14c1f1d2740aae0ebcc384f..494492d1466942246018f4c9fd8fabba9d33cb50 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index e362b55a73250caed40422f11d40e0d15983f0de..d39998d4cdd868c9036167ff47a3b6e243a87661 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index a83b309d0f19ad44355d9ac4c23f50044f0943a4..ffc51b0619cd7b254e8fef9ff61f7aa531971764 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 68f5492d0891df2f5aec6b4b7a207c4468beebe4..ff30eb51a66e6b4882b0460d605093ae8c52dfb8 100644 (file)
@@ -4,7 +4,7 @@
 *
 * ------------------------------------------------------------------------------
 *
-* Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+* Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
 *
 * This file is part of Giada - Your Hardcore Loopmachine.
 *
 
 namespace giada::v
 {
-geGridTool::geGridTool(Pixel x, Pixel y, m::Conf::Data& c, Frame framesInBeat)
+geGridTool::geGridTool(Pixel x, Pixel y, m::Conf::Data& c)
 : Fl_Group(x, y, 80, 20)
 , m_conf(c)
-, m_framesInBeat(framesInBeat)
 {
        gridType = new geChoice(x, y, 40, 20);
        gridType->add("1");
@@ -115,17 +114,17 @@ int geGridTool::getValue() const
 
 /* -------------------------------------------------------------------------- */
 
-Frame geGridTool::getSnapFrame(Frame v) const
+Frame geGridTool::getSnapFrame(Frame v, Frame framesInBeat) const
 {
        if (!isOn())
                return v;
-       return u::math::quantize(v, getCellSize());
+       return u::math::quantize(v, getCellSize(framesInBeat));
 }
 
 /* -------------------------------------------------------------------------- */
 
-Frame geGridTool::getCellSize() const
+Frame geGridTool::getCellSize(Frame framesInBeat) const
 {
-       return m_framesInBeat / getValue();
+       return framesInBeat / getValue();
 }
 } // namespace giada::v
\ No newline at end of file
index a8cf2d33835b8db2a3d332ad948117fa7a2cd4ff..5481045afc612cf827b4c26594e11d8d677f0458 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -39,22 +39,21 @@ class geChoice;
 class geGridTool : public Fl_Group
 {
 public:
-       geGridTool(Pixel x, Pixel y, m::Conf::Data&, Frame framesInBeat);
+       geGridTool(Pixel x, Pixel y, m::Conf::Data&);
        ~geGridTool();
 
        int  getValue() const;
        bool isOn() const;
 
-       Frame getSnapFrame(Frame f) const;
+       Frame getSnapFrame(Frame f, Frame framesInBeat) const;
 
        /* getCellSize
        Returns the size in frames of a single cell of the grid. */
 
-       Frame getCellSize() const;
+       Frame getCellSize(Frame framesInBeat) const;
 
 private:
        m::Conf::Data& m_conf;
-       Frame          m_framesInBeat;
 
        geChoice* gridType;
        geCheck*  active;
index 2b46bca9bf7de540f923b3a42000e77dcab921a8..83233e08aa9c395a6b514047b45c5175b0fb925a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index ab448be7f1f9bec0470ab89b5fc7565626559c4b..293aba539f04e948d1fe384cb047161b9df76512 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index ba89dd7b189fb513a7a96ce9c42652c8d602d6f0..de357a18c5ab10ea5bd97a720a22dc15abfa6245 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -217,7 +217,7 @@ int gePianoRoll::handle(int e)
 
 void gePianoRoll::onAddAction()
 {
-       Frame frame = m_base->pixelToFrame(Fl::event_x() - x());
+       Frame frame = m_base->pixelToFrame(Fl::event_x() - x(), m_data->framesInBeat);
        int   note  = yToNote(Fl::event_y() - y());
        c::actionEditor::recordMidiAction(m_data->channelId, note, G_MAX_VELOCITY,
            frame);
@@ -298,12 +298,12 @@ void gePianoRoll::onRefreshAction()
 
        if (!m_action->isOnEdges())
        {
-               f1 = m_base->pixelToFrame(p1);
-               f2 = m_base->pixelToFrame(p2, /*snap=*/false) - (m_base->pixelToFrame(p1, /*snap=*/false) - f1);
+               f1 = m_base->pixelToFrame(p1, m_data->framesInBeat);
+               f2 = m_base->pixelToFrame(p2, m_data->framesInBeat, /*snap=*/false) - (m_base->pixelToFrame(p1, m_data->framesInBeat, /*snap=*/false) - f1);
        }
        else if (m_action->onLeftEdge)
        {
-               f1 = m_base->pixelToFrame(p1);
+               f1 = m_base->pixelToFrame(p1, m_data->framesInBeat);
                f2 = m_action->a2.frame;
                if (f1 == f2) // If snapping makes an action fall onto the other
                        f1 -= G_DEFAULT_ACTION_SIZE;
@@ -311,7 +311,7 @@ void gePianoRoll::onRefreshAction()
        else if (m_action->onRightEdge)
        {
                f1 = m_action->a1.frame;
-               f2 = m_base->pixelToFrame(p2);
+               f2 = m_base->pixelToFrame(p2, m_data->framesInBeat);
                if (f1 == f2) // If snapping makes an action fall onto the other
                        f2 += G_DEFAULT_ACTION_SIZE;
        }
index db44cbfc58619164773f6427731d166a70941662..4cb3f5354f80d2d490be58088afd629f9640769f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 211ad7ac217f754955a4b243beb0d5a9b6ee0c39..0c1b2b4bacbbfde19622276a61772a97b48d4b67 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index b6066526999242979c15cbc6babb6a1d5f4ae2ec..13a2736b402734227c8bdc395eb849cb03ab488f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 89fddb4bfa0c3b8a272a6c9b76c57226d4f2b96f..16c6eab8e2cda8ab2c72afd4019f3f306145f99c 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -62,7 +62,6 @@ void geSampleActionEditor::rebuild(c::actionEditor::Data& d)
 
        for (const m::Action& a1 : m_data->actions)
        {
-
                if (a1.event.getStatus() == m::MidiEvent::ENVELOPE || isNoteOffSinglePress(a1))
                        continue;
 
@@ -119,7 +118,7 @@ void geSampleActionEditor::draw()
 
 void geSampleActionEditor::onAddAction()
 {
-       Frame f = m_base->pixelToFrame(Fl::event_x() - x());
+       Frame f = m_base->pixelToFrame(Fl::event_x() - x(), m_data->framesInBeat);
        c::actionEditor::recordSampleAction(m_data->channelId, static_cast<gdSampleActionEditor*>(m_base)->getActionType(), f);
 }
 
@@ -181,18 +180,18 @@ void geSampleActionEditor::onRefreshAction()
 
        if (!m_action->isOnEdges())
        {
-               f1 = m_base->pixelToFrame(p1);
-               f2 = m_base->pixelToFrame(p2, /*snap=*/false) - (m_base->pixelToFrame(p1, /*snap=*/false) - f1);
+               f1 = m_base->pixelToFrame(p1, m_data->framesInBeat);
+               f2 = m_base->pixelToFrame(p2, m_data->framesInBeat, /*snap=*/false) - (m_base->pixelToFrame(p1, m_data->framesInBeat, /*snap=*/false) - f1);
        }
        else if (m_action->onLeftEdge)
        {
-               f1 = m_base->pixelToFrame(p1);
+               f1 = m_base->pixelToFrame(p1, m_data->framesInBeat);
                f2 = m_action->a2.frame;
        }
        else if (m_action->onRightEdge)
        {
                f1 = m_action->a1.frame;
-               f2 = m_base->pixelToFrame(p2);
+               f2 = m_base->pixelToFrame(p2, m_data->framesInBeat);
        }
 
        ca::updateSampleAction(m_data->channelId, m_action->a1, type, f1, f2);
index fd8a8306ca353bbe35d38d11f29819b3f664f04d..23270aad7cf50acfa61a223a6424cb5aecb0e4e0 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index bcece2a3d42d6ccbfbd924efba3f0444b5db49b6..acd3a225a70015faf4f7f5a68d4c10fc27729eb3 100644 (file)
@@ -4,7 +4,7 @@
 *
 * ------------------------------------------------------------------------------
 *
-* Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+* Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
 *
 * This file is part of Giada - Your Hardcore Loopmachine.
 *
index 6bfd29cc0029ae1cbf84948af8aa492f650e2d5c..04f5e094181b974fd59df3eb1587cc1b1c25cd85 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index dd6ddc1fb82d9cf57a25cd42d4a5c61574ec2c1e..60e9033157dc29210af196c758898c3b9e0db7d7 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index cb15f90e928287764496431ac048e4f41c1c71e7..0ceb3524a2d84d940bec506b809cb6feabbd7968 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index c14cf957319275eaf03486829a7d1ea5503b488d..2e92b010386362f222f5ed3ba7514e7891ab045c 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -34,14 +34,22 @@ geBox::geBox(int x, int y, int w, int h, const char* l, Fl_Align al)
 {
        copy_label(l);
        box(FL_NO_BOX);
+       color(G_COLOR_GREY_1);
        align(al | FL_ALIGN_INSIDE);
 }
 
 /* -------------------------------------------------------------------------- */
 
+geBox::geBox(const char* l, Fl_Align al)
+: geBox(0, 0, 0, 0, l, al)
+{
+}
+
+/* -------------------------------------------------------------------------- */
+
 void geBox::draw()
 {
-       fl_rectf(x(), y(), w(), h(), G_COLOR_GREY_1); // Clear background
+       fl_rectf(x(), y(), w(), h(), color()); // Clear background
 
        if (box() != FL_NO_BOX)
                fl_rect(x(), y(), w(), h(), G_COLOR_GREY_4); // Border
index 2cc1ca92bd5ed823169baf69e914d8ddbbbed404..c2ec4ed595d8157ebc8a7ded5bd8617241f6c3fe 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -33,6 +33,7 @@ class geBox : public Fl_Box
 {
 public:
        geBox(int x, int y, int w, int h, const char* l = nullptr, Fl_Align al = FL_ALIGN_CENTER);
+       geBox(const char* l = nullptr, Fl_Align al = FL_ALIGN_CENTER);
 
        void draw() override;
 };
index 47e003af86c153b5b3c12ad0cfbd06495f9831e0..5ff93d6d1d7fdb9d7a103414a9ac06a6a12ad4f8 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index f763f66c4641ddc1975f61d974050128a5c8f5cd..2fca0ca10c35e2deea83fb2b9ef78bfb6bb789db 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
diff --git a/src/gui/elems/basics/browser.cpp b/src/gui/elems/basics/browser.cpp
new file mode 100644 (file)
index 0000000..5a91908
--- /dev/null
@@ -0,0 +1,62 @@
+/* -----------------------------------------------------------------------------
+ *
+ * Giada - Your Hardcore Loopmachine
+ *
+ * geScroll
+ * Custom scroll with nice scrollbars and something else.
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
+ *
+ * This file is part of Giada - Your Hardcore Loopmachine.
+ *
+ * Giada - Your Hardcore Loopmachine is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Giada - Your Hardcore Loopmachine is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Giada - Your Hardcore Loopmachine. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * -------------------------------------------------------------------------- */
+
+#include "gui/elems/basics/browser.h"
+#include "core/const.h"
+#include "gui/elems/basics/boxtypes.h"
+
+namespace giada::v
+{
+geBrowser::geBrowser(int x, int y, int w, int h)
+: Fl_Browser(x, y, w, h)
+{
+       box(G_CUSTOM_BORDER_BOX);
+       textsize(G_GUI_FONT_SIZE_BASE);
+       textcolor(G_COLOR_LIGHT_2);
+       selection_color(G_COLOR_GREY_4);
+       color(G_COLOR_GREY_2);
+
+       scrollbar.color(G_COLOR_GREY_2);
+       scrollbar.selection_color(G_COLOR_GREY_4);
+       scrollbar.labelcolor(G_COLOR_LIGHT_1);
+       scrollbar.slider(G_CUSTOM_BORDER_BOX);
+
+       hscrollbar.color(G_COLOR_GREY_2);
+       hscrollbar.selection_color(G_COLOR_GREY_4);
+       hscrollbar.labelcolor(G_COLOR_LIGHT_1);
+       hscrollbar.slider(G_CUSTOM_BORDER_BOX);
+}
+
+/* -------------------------------------------------------------------------- */
+
+geBrowser::geBrowser()
+: geBrowser(0, 0, 0, 0)
+{
+}
+} // namespace giada::v
\ No newline at end of file
diff --git a/src/gui/elems/basics/browser.h b/src/gui/elems/basics/browser.h
new file mode 100644 (file)
index 0000000..08bcde9
--- /dev/null
@@ -0,0 +1,42 @@
+/* -----------------------------------------------------------------------------
+ *
+ * Giada - Your Hardcore Loopmachine
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
+ *
+ * This file is part of Giada - Your Hardcore Loopmachine.
+ *
+ * Giada - Your Hardcore Loopmachine is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Giada - Your Hardcore Loopmachine is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Giada - Your Hardcore Loopmachine. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * -------------------------------------------------------------------------- */
+
+#ifndef GE_BROWSER_H
+#define GE_BROWSER_H
+
+#include <FL/Fl_Browser.H>
+
+namespace giada::v
+{
+class geBrowser : public Fl_Browser
+{
+public:
+       geBrowser(int x, int y, int w, int h);
+       geBrowser();
+};
+} // namespace giada::v
+
+#endif
index a37591531ac329e0bf8128eb0776ddf4330c4595..f635ad949bde5f50c05be02365ea345db9e51760 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include "utils/gui.h"
 #include <FL/fl_draw.H>
 
+namespace giada::v
+{
 geButton::geButton(int x, int y, int w, int h, const char* l,
     const char** imgOff, const char** imgOn, const char** imgDisabled)
 : Fl_Button(x, y, w, h, l)
+, onClick(nullptr)
 , imgOff(imgOff)
 , imgOn(imgOn)
 , imgDisabled(imgDisabled)
@@ -39,11 +42,28 @@ geButton::geButton(int x, int y, int w, int h, const char* l,
 , bgColor1(G_COLOR_GREY_4)
 , bdColor(G_COLOR_GREY_4)
 , txtColor(G_COLOR_LIGHT_2)
+{
+       callback(cb_click);
+}
+
+/* -------------------------------------------------------------------------- */
+
+geButton::geButton(const char* l, const char** imgOff, const char** imgOn, const char** imgDisabled)
+: geButton(0, 0, 0, 0, l, imgOff, imgOn, imgDisabled)
 {
 }
 
 /* -------------------------------------------------------------------------- */
 
+void geButton::cb_click(Fl_Widget* w, void*)
+{
+       geButton* b = static_cast<geButton*>(w);
+       if (b->onClick != nullptr)
+               b->onClick();
+}
+
+/* -------------------------------------------------------------------------- */
+
 void geButton::draw()
 {
        //Fl_Button::draw();
@@ -77,4 +97,5 @@ void geButton::draw(const char** img, Fl_Color bgColor, Fl_Color textColor)
                fl_font(FL_HELVETICA, G_GUI_FONT_SIZE_BASE);
                fl_draw(giada::u::gui::truncate(label(), w() - 16).c_str(), x() + 2, y(), w() - 2, h(), FL_ALIGN_CENTER);
        }
-}
\ No newline at end of file
+}
+} // namespace giada::v
\ No newline at end of file
index ab5dfe6bb06a493c0acfed69129e53d7cfc69418..5bb7ec724daccb14a4122e00de4541ed8685bb68 100644 (file)
@@ -7,7 +7,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #define GE_BUTTON_H
 
 #include <FL/Fl_Button.H>
+#include <functional>
 
+namespace giada::v
+{
 class geButton : public Fl_Button
 {
 public:
@@ -39,9 +42,16 @@ public:
            const char** imgOff = nullptr, const char** imgOn = nullptr,
            const char** imgDisabled = nullptr);
 
+       geButton(const char* l = nullptr, const char** imgOff = nullptr,
+           const char** imgOn = nullptr, const char** imgDisabled = nullptr);
+
        void draw() override;
 
-  protected:
+       std::function<void()> onClick;
+
+protected:
+       static void cb_click(Fl_Widget*, void*);
+
        void draw(const char** img, Fl_Color bgColor, Fl_Color textColor);
 
        const char** imgOff;
@@ -53,5 +63,6 @@ public:
        Fl_Color bdColor;  // border
        Fl_Color txtColor; // text
 };
+} // namespace giada::v
 
 #endif
index 4e7c6bc6fcfc121ee501633282e5848aaae4e93e..b13b5d90dd432448f6a26ee3a5832741a11bcaa6 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 0a4a54c4c353ff12ffd49aa2383d95ffce05ac2c..3178a496eef23ab1b72e3fd0232a1c559f341665 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index acb639ba84929f5faea2633c6044e2e4a3b20e3f..f0065baa255138194a6ca9406755f641f0e0dafa 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index be7903cc6cc9dd03f87d4c1a1b77078f12a1301f..4485e8376b1d3f1310deb33e78a0a8e288fb4558 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 476a4580ec4411471753e9db91b4053f7a60c718..7f11152e057fca00b5cb1ae1155e6f00d9575756 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
  *
  * -------------------------------------------------------------------------- */
 
-#include "dial.h"
-#include "../../../core/const.h"
+#include "gui/elems/basics/dial.h"
+#include "core/const.h"
 #include <FL/fl_draw.H>
 
+namespace giada::v
+{
 geDial::geDial(int x, int y, int w, int h, const char* l)
 : Fl_Dial(x, y, w, h, l)
+, onChange(nullptr)
 {
        labelsize(G_GUI_FONT_SIZE_BASE);
        labelcolor(G_COLOR_LIGHT_2);
@@ -38,6 +41,16 @@ geDial::geDial(int x, int y, int w, int h, const char* l)
        angles(0, 360);
        color(G_COLOR_GREY_2);           // background
        selection_color(G_COLOR_GREY_4); // selection
+       callback(cb_change);
+}
+
+/* -------------------------------------------------------------------------- */
+
+void geDial::cb_change(Fl_Widget* w, void*)
+{
+       geDial* d = static_cast<geDial*>(w);
+       if (d->onChange != nullptr)
+               d->onChange(d->value());
 }
 
 /* -------------------------------------------------------------------------- */
@@ -53,3 +66,4 @@ void geDial::draw()
        fl_arc(x(), y(), w(), h(), 0, 360);
        fl_pie(x(), y(), w(), h(), 270 - angle, 270 - angle1());
 }
+} // namespace giada::v
\ No newline at end of file
index d3a31270354db7c92ec3732ca97533d981b473bf..f33d8db24bae18b8125edd9f5a396cc1b0a7f3ff 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #define GE_DIAL_H
 
 #include <FL/Fl_Dial.H>
+#include <functional>
 
+namespace giada::v
+{
 class geDial : public Fl_Dial
 {
 public:
        geDial(int x, int y, int w, int h, const char* l = 0);
 
-       void draw();
+       void draw() override;
+
+       std::function<void(float)> onChange;
+
+private:
+       static void cb_change(Fl_Widget*, void*);
 };
+} // namespace giada::v
 
 #endif
diff --git a/src/gui/elems/basics/flex.cpp b/src/gui/elems/basics/flex.cpp
new file mode 100644 (file)
index 0000000..4bf1421
--- /dev/null
@@ -0,0 +1,136 @@
+#include "flex.h"
+#include <numeric>
+
+namespace giada::v
+{
+geFlex::Elem::Elem(Fl_Widget& w, geFlex& parent, Direction d, int size, geompp::Border<int> pad)
+: size(size)
+, m_w(w)
+, m_parent(parent)
+, m_dir(d)
+, m_pad(pad)
+{
+}
+
+/* -------------------------------------------------------------------------- */
+
+int geFlex::Elem::getSize() const
+{
+       if (isFixed())
+               return size;
+       return m_dir == Direction::VERTICAL ? m_w.h() : m_w.w();
+}
+
+/* -------------------------------------------------------------------------- */
+
+bool geFlex::Elem::isFixed() const
+{
+       return size != -1;
+}
+
+/* -------------------------------------------------------------------------- */
+
+void geFlex::Elem::resize(int pos, int newSize)
+{
+       geompp::Rect<int> bounds;
+
+       if (m_dir == Direction::VERTICAL)
+               bounds = geompp::Rect<int>(m_parent.x(), pos, m_parent.w(), newSize).reduced(m_pad);
+       else
+               bounds = geompp::Rect<int>(pos, m_parent.y(), newSize, m_parent.h()).reduced(m_pad);
+
+       m_w.resize(bounds.x, bounds.y, bounds.w, bounds.h);
+}
+
+/* -------------------------------------------------------------------------- */
+/* -------------------------------------------------------------------------- */
+/* -------------------------------------------------------------------------- */
+
+geFlex::geFlex(int x, int y, int w, int h, Direction d, int gutter)
+: Fl_Group(x, y, w, h, 0)
+, m_direction(d)
+, m_gutter(gutter)
+, m_numFixed(0)
+{
+       Fl_Group::end();
+}
+
+/* -------------------------------------------------------------------------- */
+
+geFlex::geFlex(geompp::Rect<int> r, Direction d, int gutter)
+: geFlex(r.x, r.y, r.w, r.h, d, gutter)
+{
+}
+
+/* -------------------------------------------------------------------------- */
+
+geFlex::geFlex(Direction d, int gutter)
+: geFlex(0, 0, 0, 0, d, gutter)
+{
+}
+
+/* -------------------------------------------------------------------------- */
+
+void geFlex::add(Fl_Widget& w, int size, geompp::Border<int> pad)
+{
+       Fl_Group::add(w);
+       m_elems.push_back({w, *this, m_direction, size, pad});
+       if (size != -1)
+               m_numFixed++;
+}
+
+void geFlex::add(Fl_Widget* w, int size, geompp::Border<int> pad)
+{
+       geFlex::add(*w, size, pad);
+}
+
+/* -------------------------------------------------------------------------- */
+
+void geFlex::resize(int X, int Y, int W, int H)
+{
+       Fl_Group::resize(X, Y, W, H);
+
+       const size_t numAllElems    = m_elems.size();
+       const size_t numLiquidElems = numAllElems - m_numFixed;
+
+       const int pos  = m_direction == Direction::VERTICAL ? y() : x();
+       const int size = m_direction == Direction::VERTICAL ? h() : w();
+
+       /* No fancy computations if there are no liquid elements. Just lay children
+       according to their fixed size. */
+
+       if (numLiquidElems == 0)
+       {
+               layWidgets(pos);
+               return;
+       }
+
+       const int fixedElemsSize = std::accumulate(m_elems.begin(), m_elems.end(), 0, [](int acc, const Elem& e) {
+               return e.isFixed() ? acc + e.getSize() : acc;
+       });
+       const int availableSize  = size - (m_gutter * (numAllElems - 1)); // Total size - gutters
+       const int liquidElemSize = (availableSize - fixedElemsSize) / numLiquidElems;
+
+       layWidgets(pos, liquidElemSize);
+}
+
+/* -------------------------------------------------------------------------- */
+
+void geFlex::layWidgets(int startPos, int sizeIfLiquid)
+{
+       int nextElemPos = startPos;
+       for (Elem& e : m_elems)
+       {
+               e.resize(nextElemPos, e.isFixed() ? e.size : sizeIfLiquid);
+               nextElemPos += e.getSize() + m_gutter;
+       }
+}
+
+/* -------------------------------------------------------------------------- */
+
+void geFlex::end()
+{
+       Fl_Group::end();
+       resize(x(), y(), w(), h());
+}
+} // namespace giada::v
\ No newline at end of file
diff --git a/src/gui/elems/basics/flex.h b/src/gui/elems/basics/flex.h
new file mode 100644 (file)
index 0000000..574409e
--- /dev/null
@@ -0,0 +1,93 @@
+/* -----------------------------------------------------------------------------
+ *
+ * Giada - Your Hardcore Loopmachine
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
+ *
+ * This file is part of Giada - Your Hardcore Loopmachine.
+ *
+ * Giada - Your Hardcore Loopmachine is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Giada - Your Hardcore Loopmachine is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Giada - Your Hardcore Loopmachine. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * -------------------------------------------------------------------------- */
+
+#ifndef GE_FLEX_H
+#define GE_FLEX_H
+
+#include "deps/geompp/src/border.hpp"
+#include "deps/geompp/src/rect.hpp"
+#include "gui/types.h"
+#include <FL/Fl_Group.H>
+#include <vector>
+
+namespace giada::v
+{
+/* geFlex
+Like a FlexBox item, it's a group that contains widgets that can be stretched 
+to fill the area. Inspired by https://github.com/osen/FL_Flex. */
+
+class geFlex : public Fl_Group
+{
+public:
+       geFlex(int x, int y, int w, int h, Direction d, int gutter = 0);
+       geFlex(geompp::Rect<int>, Direction d, int gutter = 0);
+       geFlex(Direction d, int gutter = 0);
+
+       /* add
+       Adds an existing widget to the Flex layout. If 'size' == -1, the widget
+       will be stretched to take up the available space. WARNING: like Fl_Group,
+       geFlex owns widgets! */
+
+       void add(Fl_Widget&, int size = -1, geompp::Border<int> pad = {});
+       void add(Fl_Widget*, int size = -1, geompp::Border<int> pad = {});
+
+       /* end
+       Finalize the Flex item. Call this when you're done add()ing widgets. */
+
+       void end();
+
+private:
+       class Elem
+       {
+       public:
+               Elem(Fl_Widget&, geFlex& parent, Direction, int size, geompp::Border<int> pad);
+
+               int  getSize() const;
+               bool isFixed() const;
+
+               void resize(int pos, int size);
+
+               int size;
+
+       private:
+               Fl_Widget&          m_w;
+               geFlex&             m_parent;
+               Direction           m_dir;
+               geompp::Border<int> m_pad;
+       };
+
+       void resize(int x, int y, int w, int h) override;
+
+       void layWidgets(int startPos, int sizeIfLiquid = 0);
+
+       Direction         m_direction;
+       int               m_gutter;
+       std::vector<Elem> m_elems;
+       int               m_numFixed;
+};
+} // namespace giada::v
+
+#endif
\ No newline at end of file
index 8145715b92811b39dc85790d1f3fb708eee9fa95..08fd58eeabdd120105825c1c0ace312304321109 100644 (file)
@@ -7,7 +7,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 55d884ce6b8cf007f52debbfafe296c78b552e76..49a32023d01375d35c7ff8b892223c27f63661eb 100644 (file)
@@ -7,7 +7,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index adfa4e2e88d4b0bf3c09943b37ba328695039e04..0fc1eaeab0d0dd19872b8ee588388a9166594601 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 199d4fd24eb3e3e84db04454c8a7cffad716daa8..59307ff0e1914da0fbedebf4146d79d995af3bfd 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index a639aeb1d4f5f879d4c4778c789b40cfce7efcb8..64f0903a38b2a00712d41c65ebc0e28afce9bc00 100644 (file)
@@ -9,7 +9,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 04b5983c31b15cf2db5a82a51ce8a6746b2af762..d90a28c2b3b21923bf818cdfdeb4a070be1be297 100644 (file)
@@ -9,7 +9,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 0b6982d37302ff44a23be6989db92d83fd50fd89..c4d544624e619ea2528fdbbdb6aa0da084465b11 100644 (file)
@@ -7,7 +7,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 723f99c718b30a049e3a9a4b33bdfd3c8550ad75..10c853a9711a44513e98507076a27b8c9ebe21eb 100644 (file)
@@ -7,7 +7,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 9e171890486c9e5d3dc127f007f187c9d5ef4c05..d1066f4f11b296d1f184b71fad156ea3540a4125 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 1ec31863c44789152ab0c599760f99aca8b2ba80..7ddea0d3968980ba45ebe5678b4c649d79ac6389 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index aa8bc4bf51a2d1c458784aea200123e0c0bbdb6e..f4dacc6abadea3ba37d963447d322e090350fd45 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 27ef9de8a4f4c159924b45b63a7f0642d44dd4fe..31057fb527e95463c1d04b2ce48c598b35c73b78 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index c6faf354d4c1837b273faf61cd3931b1d015a7c9..8f4837c71f4627659908d7301dfe5804f295235a 100644 (file)
@@ -7,7 +7,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 6562ec46ea2e5a0b928ac8cca1bd858da944db40..d13a8e827739947a06391883b781d57ef3b0815e 100644 (file)
@@ -7,7 +7,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 9917e2f901e4459622f0c657d5689da3915ecf24..22a3171d64bba171bd250b0357cb3c28c469f308 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index f855532bfaacc135cb0d009b11bfb979dc5f8402..95d946e756a88123bf9a7250255d414b5eebfb05 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index b41cae6e225bf444a637a1ff6f6f6e5ca39cee21..e01845207c1e70b1882c87c608ae3cbb96fb3b87 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 7e1d41eb5e7c2af4d7450efcd91c21302217cab1..5f47744d7e035c98b8f76231d14d99deb3bab95a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 658ed7c08256531b4c846f8a4d7630473fd2faf0..a29608234b4ac71cc50fb5b4442244c601fadbb3 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index f40746682501ab67ad7fbfaafd3ea183b8813fed..237db1805e30bb3ab4f3ecd74ca09fd0c7a0032f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 7f554fe1559bf74bafe6360d1ed422b3f2edb176..ee6733eceec566d7ecbd992f8bdb752d1ae2d91b 100644 (file)
@@ -7,7 +7,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 3805aac8235573143cb7fedbdcd147f3d126cb81..1c9a917cdcbb2079c9d95ae72913322661a5a4a1 100644 (file)
@@ -7,7 +7,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
diff --git a/src/gui/elems/browser.cpp b/src/gui/elems/browser.cpp
deleted file mode 100644 (file)
index 30a878b..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/* -----------------------------------------------------------------------------
- *
- * Giada - Your Hardcore Loopmachine
- *
- * -----------------------------------------------------------------------------
- *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
- *
- * This file is part of Giada - Your Hardcore Loopmachine.
- *
- * Giada - Your Hardcore Loopmachine is free software: you can
- * redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * Giada - Your Hardcore Loopmachine is distributed in the hope that it
- * will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Giada - Your Hardcore Loopmachine. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * -------------------------------------------------------------------------- */
-
-#include "browser.h"
-#include "basics/boxtypes.h"
-#include "core/const.h"
-#include "gui/dialogs/browser/browserBase.h"
-#include "utils/fs.h"
-#include "utils/string.h"
-
-namespace giada
-{
-namespace v
-{
-geBrowser::geBrowser(int x, int y, int w, int h)
-: Fl_File_Browser(x, y, w, h)
-, m_showHiddenFiles(false)
-{
-       box(G_CUSTOM_BORDER_BOX);
-       textsize(G_GUI_FONT_SIZE_BASE);
-       textcolor(G_COLOR_LIGHT_2);
-       selection_color(G_COLOR_GREY_4);
-       color(G_COLOR_GREY_2);
-       type(FL_SELECT_BROWSER);
-
-       this->scrollbar.color(G_COLOR_GREY_2);
-       this->scrollbar.selection_color(G_COLOR_GREY_4);
-       this->scrollbar.labelcolor(G_COLOR_LIGHT_1);
-       this->scrollbar.slider(G_CUSTOM_BORDER_BOX);
-
-       this->hscrollbar.color(G_COLOR_GREY_2);
-       this->hscrollbar.selection_color(G_COLOR_GREY_4);
-       this->hscrollbar.labelcolor(G_COLOR_LIGHT_1);
-       this->hscrollbar.slider(G_CUSTOM_BORDER_BOX);
-
-       take_focus(); // let it have focus on startup
-}
-
-/* -------------------------------------------------------------------------- */
-
-void geBrowser::toggleHiddenFiles()
-{
-       m_showHiddenFiles = !m_showHiddenFiles;
-       loadDir(m_currentDir);
-}
-
-/* -------------------------------------------------------------------------- */
-
-void geBrowser::loadDir(const std::string& dir)
-{
-       m_currentDir = dir;
-       load(m_currentDir.c_str());
-
-       /* Clean up unwanted elements. Hide "../" first, it just screws up things.
-       Also remove hidden files, if requested. */
-
-       for (int i = size(); i >= 0; i--)
-       {
-               if (text(i) == nullptr)
-                       continue;
-               if (strcmp(text(i), "../") == 0 || (!m_showHiddenFiles && strncmp(text(i), ".", 1) == 0))
-                       remove(i);
-       }
-}
-
-/* -------------------------------------------------------------------------- */
-
-int geBrowser::handle(int e)
-{
-       int ret = Fl_File_Browser::handle(e);
-       switch (e)
-       {
-       case FL_FOCUS:
-       case FL_UNFOCUS:
-               ret = 1; // enables receiving Keyboard events
-               break;
-       case FL_KEYDOWN: // keyboard
-               if (Fl::event_key(FL_Down))
-                       select(value() + 1);
-               else if (Fl::event_key(FL_Up))
-                       select(value() - 1);
-               else if (Fl::event_key(FL_Enter))
-                       static_cast<v::gdBrowserBase*>(parent())->fireCallback();
-               ret = 1;
-               break;
-       case FL_PUSH:                   // mouse
-               if (Fl::event_clicks() > 0) // double click
-                       static_cast<v::gdBrowserBase*>(parent())->fireCallback();
-               ret = 1;
-               break;
-       case FL_RELEASE: // mouse
-               /* nasty trick to keep the selection on mouse release */
-               if (value() > 1)
-               {
-                       select(value() - 1);
-                       select(value() + 1);
-               }
-               else
-               {
-                       select(value() + 1);
-                       select(value() - 1);
-               }
-               ret = 1;
-               break;
-       }
-       return ret;
-}
-
-/* -------------------------------------------------------------------------- */
-
-std::string geBrowser::getCurrentDir()
-{
-       return normalize(u::fs::getRealPath(m_currentDir));
-}
-
-/* -------------------------------------------------------------------------- */
-
-std::string geBrowser::getSelectedItem(bool fullPath)
-{
-       if (!fullPath) // no full path requested? return the selected text
-               return normalize(text(value()));
-       else if (value() == 0) // no rows selected? return current directory
-               return normalize(m_currentDir);
-       else
-       {
-#ifdef G_OS_WINDOWS
-               std::string sep = m_currentDir != "" ? G_SLASH_STR : "";
-#else
-               std::string sep = G_SLASH_STR;
-#endif
-               return normalize(u::fs::getRealPath(m_currentDir + sep + normalize(text(value()))));
-       }
-}
-
-/* -------------------------------------------------------------------------- */
-
-void geBrowser::preselect(int pos, int line)
-{
-       position(pos);
-       select(line);
-}
-
-/* -------------------------------------------------------------------------- */
-
-std::string geBrowser::normalize(const std::string& s)
-{
-       std::string out = s;
-
-       /* If std::string ends with G_SLASH, remove it. Don't do it if is the root dir, 
-       that is '/' on Unix or '[x]:\' on Windows. */
-
-       //if (out.back() == G_SLASH && out.length() > 1)
-       if (out.back() == G_SLASH && !u::fs::isRootDir(s))
-               out = out.substr(0, out.size() - 1);
-       return out;
-}
-} // namespace v
-} // namespace giada
\ No newline at end of file
diff --git a/src/gui/elems/browser.h b/src/gui/elems/browser.h
deleted file mode 100644 (file)
index 7fcfe8f..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -----------------------------------------------------------------------------
- *
- * Giada - Your Hardcore Loopmachine
- *
- * ge_browser
- *
- * -----------------------------------------------------------------------------
- *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
- *
- * This file is part of Giada - Your Hardcore Loopmachine.
- *
- * Giada - Your Hardcore Loopmachine is free software: you can
- * redistribute it and/or modify it under the terms of the GNU General
- * Public License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * Giada - Your Hardcore Loopmachine is distributed in the hope that it
- * will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Giada - Your Hardcore Loopmachine. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * -------------------------------------------------------------------------- */
-
-#ifndef GE_BROWSER_H
-#define GE_BROWSER_H
-
-#include <FL/Fl_File_Browser.H>
-#include <string>
-
-namespace giada
-{
-namespace v
-{
-class geBrowser : public Fl_File_Browser
-{
-public:
-       geBrowser(int x, int y, int w, int h);
-
-       void toggleHiddenFiles();
-
-       /* init
-       Initializes browser and show 'dir' as initial directory. */
-
-       void loadDir(const std::string& dir);
-
-       /* getSelectedItem
-       Returns the full path or just the displayed name of the i-th selected item.
-       Always with the trailing slash! */
-
-       std::string getSelectedItem(bool fullPath = true);
-
-       std::string getCurrentDir();
-
-       void preselect(int position, int line);
-
-       int handle(int e);
-
-  private:
-       /* normalize
-       Makes sure the std::string never ends with a trailing slash. */
-
-       std::string normalize(const std::string& s);
-
-       std::string m_currentDir;
-       bool        m_showHiddenFiles;
-};
-} // namespace v
-} // namespace giada
-
-#endif
index 8539215580688c7c074dca79dc4855efba992ed9..7894597ab26a849ada586fa10a24630e9207037b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 91cf9040bce3c67081ea9c14e11fc6b9c67a057a..b2f77bcdbd0956503488dce2407d4ba274129595 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include <FL/Fl_Group.H>
 
 class geCheck;
-class geButton;
 class geInput;
 
 namespace giada::v
 {
+class geButton;
 class geTabAudio : public Fl_Group
 {
 public:
index 4178b577eaf62ffec0b2ef12d24fc938158f8e22..c15c2f7bc992c58bc5effbf1fa7c5181f993610f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index a481c4665a8c9a0367af4788d7387a75e56e7aa2..f000fb38c2f9468909189ea65f3863e78767a4ab 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index df36959115d6f19ee63e1ec12ddae166f4a838e2..3ca5f11984f4c216978e14dd4b79c53ba4a2bb97 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index b2374a3d1723ee1e5015b078c2acaef0b8624fa7..0fce166b8eb149bdfef45fa8042fad0bc41a40ec 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index bcd66ad2921550bec05f892c9f3b0b1436d13e09..81f8badc98cb821d271442cc19b83044106820c3 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index f854eee742863c8ba737af0b1536b718f54eb8ba..727e4b59103253fa455bd26581c4e756c767d90b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 49eb2ae4984e3a72db6319a6b7c4415cc5c5d4c7..3c4a3f11bbc7b3a656912efd0bf1f13cafa803c5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index aeac23a02555a25f8e342449863bd7381f2b26e8..91ad1113f328d0210d8c6464358d9815787c0bbf 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
diff --git a/src/gui/elems/fileBrowser.cpp b/src/gui/elems/fileBrowser.cpp
new file mode 100644 (file)
index 0000000..db021e2
--- /dev/null
@@ -0,0 +1,181 @@
+/* -----------------------------------------------------------------------------
+ *
+ * Giada - Your Hardcore Loopmachine
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
+ *
+ * This file is part of Giada - Your Hardcore Loopmachine.
+ *
+ * Giada - Your Hardcore Loopmachine is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Giada - Your Hardcore Loopmachine is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Giada - Your Hardcore Loopmachine. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * -------------------------------------------------------------------------- */
+
+#include "fileBrowser.h"
+#include "basics/boxtypes.h"
+#include "core/const.h"
+#include "gui/dialogs/browser/browserBase.h"
+#include "utils/fs.h"
+#include "utils/string.h"
+
+namespace giada
+{
+namespace v
+{
+geFileBrowser::geFileBrowser(int x, int y, int w, int h)
+: Fl_File_Browser(x, y, w, h)
+, m_showHiddenFiles(false)
+{
+       box(G_CUSTOM_BORDER_BOX);
+       textsize(G_GUI_FONT_SIZE_BASE);
+       textcolor(G_COLOR_LIGHT_2);
+       selection_color(G_COLOR_GREY_4);
+       color(G_COLOR_GREY_2);
+       type(FL_SELECT_BROWSER);
+
+       this->scrollbar.color(G_COLOR_GREY_2);
+       this->scrollbar.selection_color(G_COLOR_GREY_4);
+       this->scrollbar.labelcolor(G_COLOR_LIGHT_1);
+       this->scrollbar.slider(G_CUSTOM_BORDER_BOX);
+
+       this->hscrollbar.color(G_COLOR_GREY_2);
+       this->hscrollbar.selection_color(G_COLOR_GREY_4);
+       this->hscrollbar.labelcolor(G_COLOR_LIGHT_1);
+       this->hscrollbar.slider(G_CUSTOM_BORDER_BOX);
+
+       take_focus(); // let it have focus on startup
+}
+
+/* -------------------------------------------------------------------------- */
+
+void geFileBrowser::toggleHiddenFiles()
+{
+       m_showHiddenFiles = !m_showHiddenFiles;
+       loadDir(m_currentDir);
+}
+
+/* -------------------------------------------------------------------------- */
+
+void geFileBrowser::loadDir(const std::string& dir)
+{
+       m_currentDir = dir;
+       load(m_currentDir.c_str());
+
+       /* Clean up unwanted elements. Hide "../" first, it just screws up things.
+       Also remove hidden files, if requested. */
+
+       for (int i = size(); i >= 0; i--)
+       {
+               if (text(i) == nullptr)
+                       continue;
+               if (strcmp(text(i), "../") == 0 || (!m_showHiddenFiles && strncmp(text(i), ".", 1) == 0))
+                       remove(i);
+       }
+}
+
+/* -------------------------------------------------------------------------- */
+
+int geFileBrowser::handle(int e)
+{
+       int ret = Fl_File_Browser::handle(e);
+       switch (e)
+       {
+       case FL_FOCUS:
+       case FL_UNFOCUS:
+               ret = 1; // enables receiving Keyboard events
+               break;
+       case FL_KEYDOWN: // keyboard
+               if (Fl::event_key(FL_Down))
+                       select(value() + 1);
+               else if (Fl::event_key(FL_Up))
+                       select(value() - 1);
+               else if (Fl::event_key(FL_Enter))
+                       static_cast<v::gdBrowserBase*>(parent())->fireCallback();
+               ret = 1;
+               break;
+       case FL_PUSH:                   // mouse
+               if (Fl::event_clicks() > 0) // double click
+                       static_cast<v::gdBrowserBase*>(parent())->fireCallback();
+               ret = 1;
+               break;
+       case FL_RELEASE: // mouse
+               /* nasty trick to keep the selection on mouse release */
+               if (value() > 1)
+               {
+                       select(value() - 1);
+                       select(value() + 1);
+               }
+               else
+               {
+                       select(value() + 1);
+                       select(value() - 1);
+               }
+               ret = 1;
+               break;
+       }
+       return ret;
+}
+
+/* -------------------------------------------------------------------------- */
+
+std::string geFileBrowser::getCurrentDir()
+{
+       return normalize(u::fs::getRealPath(m_currentDir));
+}
+
+/* -------------------------------------------------------------------------- */
+
+std::string geFileBrowser::getSelectedItem(bool fullPath)
+{
+       if (!fullPath) // no full path requested? return the selected text
+               return normalize(text(value()));
+       else if (value() == 0) // no rows selected? return current directory
+               return normalize(m_currentDir);
+       else
+       {
+#ifdef G_OS_WINDOWS
+               std::string sep = m_currentDir != "" ? G_SLASH_STR : "";
+#else
+               std::string sep = G_SLASH_STR;
+#endif
+               return normalize(u::fs::getRealPath(m_currentDir + sep + normalize(text(value()))));
+       }
+}
+
+/* -------------------------------------------------------------------------- */
+
+void geFileBrowser::preselect(int pos, int line)
+{
+       position(pos);
+       select(line);
+}
+
+/* -------------------------------------------------------------------------- */
+
+std::string geFileBrowser::normalize(const std::string& s)
+{
+       std::string out = s;
+
+       /* If std::string ends with G_SLASH, remove it. Don't do it if is the root dir, 
+       that is '/' on Unix or '[x]:\' on Windows. */
+
+       //if (out.back() == G_SLASH && out.length() > 1)
+       if (out.back() == G_SLASH && !u::fs::isRootDir(s))
+               out = out.substr(0, out.size() - 1);
+       return out;
+}
+} // namespace v
+} // namespace giada
\ No newline at end of file
diff --git a/src/gui/elems/fileBrowser.h b/src/gui/elems/fileBrowser.h
new file mode 100644 (file)
index 0000000..624a86a
--- /dev/null
@@ -0,0 +1,75 @@
+/* -----------------------------------------------------------------------------
+ *
+ * Giada - Your Hardcore Loopmachine
+ *
+ * ge_browser
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
+ *
+ * This file is part of Giada - Your Hardcore Loopmachine.
+ *
+ * Giada - Your Hardcore Loopmachine is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Giada - Your Hardcore Loopmachine is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Giada - Your Hardcore Loopmachine. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * -------------------------------------------------------------------------- */
+
+#ifndef GE_FILE_BROWSER_H
+#define GE_FILE_BROWSER_H
+
+#include <FL/Fl_File_Browser.H>
+#include <string>
+
+namespace giada
+{
+namespace v
+{
+class geFileBrowser : public Fl_File_Browser
+{
+public:
+       geFileBrowser(int x, int y, int w, int h);
+
+       void toggleHiddenFiles();
+
+       /* init
+       Initializes browser and show 'dir' as initial directory. */
+
+       void loadDir(const std::string& dir);
+
+       /* getSelectedItem
+       Returns the full path or just the displayed name of the i-th selected item.
+       Always with the trailing slash! */
+
+       std::string getSelectedItem(bool fullPath = true);
+
+       std::string getCurrentDir();
+
+       void preselect(int position, int line);
+
+       int handle(int e);
+
+  private:
+       /* normalize
+       Makes sure the std::string never ends with a trailing slash. */
+
+       std::string normalize(const std::string& s);
+
+       std::string m_currentDir;
+       bool        m_showHiddenFiles;
+};
+} // namespace v
+} // namespace giada
+
+#endif
index 48eb0947980065aaf8acfc0677a8aab938e5720e..0b62a1d2f974871fe596307e516892f4992dec6c 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -35,6 +35,7 @@
 #include "gui/elems/mainWindow/keyboard/channelButton.h"
 #include "gui/elems/mainWindow/keyboard/channelStatus.h"
 #include "gui/elems/mainWindow/keyboard/column.h"
+#include "gui/elems/mainWindow/keyboard/midiActivity.h"
 #include "gui/ui.h"
 #include <FL/Fl.H>
 #include <FL/fl_draw.H>
@@ -96,6 +97,7 @@ void geChannel::refresh()
                blink();
 
        playButton->setStatus(playStatus == ChannelStatus::PLAY || playStatus == ChannelStatus::ENDING);
+       midiActivity->redraw();
        mute->setStatus(m_channel.getMute());
        solo->setStatus(m_channel.getSolo());
 }
@@ -139,7 +141,7 @@ void geChannel::cb_openFxWindow()
 
 /* -------------------------------------------------------------------------- */
 
-int geChannel::getColumnId()
+int geChannel::getColumnId() const
 {
        return static_cast<geColumn*>(parent())->id;
 }
@@ -158,18 +160,17 @@ void geChannel::blink()
 
 void geChannel::packWidgets()
 {
-       /* Count visible widgets and resize mainButton according to how many widgets
-       are visible. */
+       /* Compute how much space is visible for the main button, then resize it
+       according to that amount. */
 
-       int visibles = 0;
+       int visible = w();
        for (int i = 0; i < children(); i++)
        {
-               child(i)->size(MIN_ELEM_W, child(i)->h()); // also normalize widths
-               if (child(i)->visible())
-                       visibles++;
+               if (child(i)->visible() && child(i) != mainButton)
+                       visible -= child(i)->w() + G_GUI_INNER_MARGIN;
        }
-       mainButton->size(w() - ((visibles - 1) * (MIN_ELEM_W + G_GUI_INNER_MARGIN)), // -1: exclude itself
-           mainButton->h());
+
+       mainButton->size(visible, mainButton->h());
 
        /* Reposition everything else */
 
index e3d53024c6dfb976942fb41d82b414b5da77672f..c457b468cb22ced5b6f21b16ed23a44cc48d3631 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include "glue/channel.h"
 #include <FL/Fl_Group.H>
 
-class geButton;
-class geDial;
-
 namespace giada::v
 {
+class geDial;
+class geButton;
 class geChannelStatus;
 class geStatusButton;
 class geChannelButton;
+class geMidiActivity;
 class geChannel : public Fl_Group
 {
 public:
@@ -54,7 +54,7 @@ public:
        /* getColumnId
        Returns the ID of the column this channel resides in. */
 
-       ID getColumnId();
+       ID getColumnId() const;
 
        /* handleKey
        Performs some UI-related operations when the bound key is pressed. Returns
@@ -71,6 +71,7 @@ public:
        geButton*        arm;
        geChannelStatus* status;
        geChannelButton* mainButton;
+       geMidiActivity*  midiActivity;
        geStatusButton*  mute;
        geStatusButton*  solo;
        geDial*          vol;
@@ -93,8 +94,6 @@ protected:
        static const int BREAK_ARM          = 168;
 #endif
 
-       static const int MIN_ELEM_W = 20;
-
        static void cb_arm(Fl_Widget* /*w*/, void* p);
        static void cb_mute(Fl_Widget* /*w*/, void* p);
        static void cb_solo(Fl_Widget* /*w*/, void* p);
index e868d636bd0db72ef146b833d5ae49bffb7e3f95..cb965d77db4d916495ff2d04f7617f331ff22f96 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index bfc8c389c72c06fa0e749144e678cec2d8cb9b3d..400ed3c883001cda396a152b2c99216cda47ab86 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 66e837a4f17a6e0b4babf0a4c81c9dc72e249644..a701ee1e6a6ba0c8b884cb1d20cad8c53c1d496c 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index c31d923119d538fe5ee9891963d0d4e822f7ae4f..003d98f4b3b273619495a538d9a26a563270e544 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index cac95155c0de2895888f593376254ee7264abb23..53cb7db32f0dfce74e26cc68768cb6e8684dd1f5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 4db44b29847954b78e644143a4e8822f6ec64349..595557bf7ccb94369ce59493af64dadde3b00ddb 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 72982b583438e4e70cbe581aeed69a744342be07..237ac6178ca1b0ec717f2ff969a381530167d6e0 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 2ab96d5bf8994f3fc7d926fd323f0465faaf3f59..808650ca6ce7f38822d80e5c8c37714c9f3f3bc6 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include <functional>
 #include <vector>
 
-class geButton;
-
 namespace giada::v
 {
+class geButton;
 class geResizerBar;
 class geKeyboard;
 class geChannel;
index 7b304ec13a402abf11ce79bd56f4f44559489f7b..4c72ca3f9c634ce2f8f2375783f10b79f29ced33 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
  *
  * -------------------------------------------------------------------------- */
 
-#include "keyboard.h"
-#include "channelButton.h"
-#include "column.h"
+#include "gui/elems/mainWindow/keyboard/keyboard.h"
 #include "glue/channel.h"
 #include "glue/io.h"
 #include "gui/dialogs/warnings.h"
 #include "gui/dispatcher.h"
 #include "gui/elems/basics/boxtypes.h"
+#include "gui/elems/basics/dial.h"
 #include "gui/elems/basics/resizerBar.h"
+#include "gui/elems/mainWindow/keyboard/channelButton.h"
+#include "gui/elems/mainWindow/keyboard/column.h"
+#include "gui/elems/mainWindow/keyboard/midiActivity.h"
+#include "gui/elems/mainWindow/keyboard/sampleChannel.h"
 #include "gui/ui.h"
-#include "sampleChannel.h"
 #include "utils/fs.h"
 #include "utils/log.h"
 #include "utils/string.h"
@@ -57,6 +59,13 @@ geKeyboard::geKeyboard(int X, int Y, int W, int H)
 
 /* -------------------------------------------------------------------------- */
 
+ID geKeyboard::getChannelColumnId(ID channelId) const
+{
+       return getChannel(channelId)->getColumnId();
+}
+
+/* -------------------------------------------------------------------------- */
+
 void geKeyboard::init()
 {
        m_columnId = m::IdManager();
@@ -113,6 +122,25 @@ void geKeyboard::deleteAllColumns()
 
 /* -------------------------------------------------------------------------- */
 
+void geKeyboard::setChannelVolume(ID channelId, float v)
+{
+       getChannel(channelId)->vol->value(v);
+}
+
+/* -------------------------------------------------------------------------- */
+
+void geKeyboard::notifyMidiIn(ID channelId)
+{
+       getChannel(channelId)->midiActivity->in->lit();
+}
+
+void geKeyboard::notifyMidiOut(ID channelId)
+{
+       getChannel(channelId)->midiActivity->out->lit();
+}
+
+/* -------------------------------------------------------------------------- */
+
 void geKeyboard::cb_addColumn(Fl_Widget* /*w*/, void* p)
 {
        ((geKeyboard*)p)->cb_addColumn();
@@ -264,7 +292,7 @@ geColumn* geKeyboard::getColumnAtCursor(Pixel px)
 
 /* -------------------------------------------------------------------------- */
 
-geChannel* geKeyboard::getChannel(ID channelId)
+const geChannel* geKeyboard::getChannel(ID channelId) const
 {
        for (geColumn* column : m_columns)
        {
@@ -276,6 +304,11 @@ geChannel* geKeyboard::getChannel(ID channelId)
        return nullptr;
 }
 
+geChannel* geKeyboard::getChannel(ID channelId)
+{
+       return const_cast<geChannel*>(const_cast<const geKeyboard*>(this)->getChannel(channelId));
+}
+
 /* -------------------------------------------------------------------------- */
 
 std::vector<std::string> geKeyboard::getDroppedFilePaths() const
index 70d131e2ecb6af8c0bd3569b1aaac86253477cc0..c5593f8d4097da5e3098fc1daa3f716756a8abc9 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include <functional>
 #include <vector>
 
-class geButton;
-
 namespace giada::v
 {
+class geButton;
 class geResizerBar;
 class geColumn;
 class geChannel;
@@ -54,6 +53,11 @@ public:
        int  handle(int e) override;
        void draw() override;
 
+       /* getChannelColumnId
+       Given a channel ID, returns the ID of the column it belongs to. */
+
+       ID getChannelColumnId(ID channelId) const;
+
        /* rebuild
        Rebuilds this widget from scratch. Used when the model has changed. */
 
@@ -74,10 +78,9 @@ public:
 
        void deleteAllColumns();
 
-       /* getChannel
-       Given a channel ID returns the UI channel it belongs to. */
-
-       geChannel* getChannel(ID channelId);
+       void setChannelVolume(ID channelId, float v);
+       void notifyMidiIn(ID channelId);
+       void notifyMidiOut(ID channelId);
 
        /* init
        Builds the default setup of empty columns. */
@@ -116,6 +119,12 @@ private:
 
        geColumn* getColumnAtCursor(Pixel x);
 
+       /* getChannel
+       Given a channel ID returns the UI channel it belongs to. */
+
+       geChannel*       getChannel(ID channelId);
+       const geChannel* getChannel(ID channelId) const;
+
        /* storeLayout
        Stores the current column layout into the layout vector. */
 
diff --git a/src/gui/elems/mainWindow/keyboard/midiActivity.cpp b/src/gui/elems/mainWindow/keyboard/midiActivity.cpp
new file mode 100644 (file)
index 0000000..4ced13c
--- /dev/null
@@ -0,0 +1,91 @@
+/* -----------------------------------------------------------------------------
+ *
+ * Giada - Your Hardcore Loopmachine
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
+ *
+ * This file is part of Giada - Your Hardcore Loopmachine.
+ *
+ * Giada - Your Hardcore Loopmachine is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Giada - Your Hardcore Loopmachine is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Giada - Your Hardcore Loopmachine. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * -------------------------------------------------------------------------- */
+
+#include "gui/elems/mainWindow/keyboard/midiActivity.h"
+#include "core/const.h"
+#include "gui/elems/basics/flex.h"
+#include <FL/fl_draw.H>
+
+namespace giada::v
+{
+geMidiActivity::geLed::geLed()
+: Fl_Button(0, 0, 0, 0)
+, m_decay(0) // decay > 0: led is on
+{
+}
+
+/* -------------------------------------------------------------------------- */
+
+void geMidiActivity::geLed::draw()
+{
+       int bgColor = G_COLOR_GREY_2;
+       int bdColor = G_COLOR_GREY_4;
+
+       if (m_decay > 0) // If led is on
+       {
+               m_decay = (m_decay + 1) % (G_GUI_FPS / 4);
+
+               bgColor = G_COLOR_LIGHT_2;
+               bdColor = G_COLOR_LIGHT_2;
+       }
+
+       fl_rectf(x(), y(), w(), h(), bgColor); // background
+       fl_rect(x(), y(), w(), h(), bdColor);  // border
+}
+
+/* -------------------------------------------------------------------------- */
+
+void geMidiActivity::geLed::lit()
+{
+       m_decay = 1;
+}
+
+/* -------------------------------------------------------------------------- */
+/* -------------------------------------------------------------------------- */
+/* -------------------------------------------------------------------------- */
+
+geMidiActivity::geMidiActivity(int x, int y, int w, int h)
+: Fl_Group(x, y, w, h)
+{
+       end();
+
+       geFlex* container = new geFlex(x, y, w, h, Direction::VERTICAL, G_GUI_INNER_MARGIN);
+       {
+               out = new geLed();
+               in  = new geLed();
+
+               container->add(out);
+               container->add(in);
+               container->end();
+       }
+
+       add(container);
+       resizable(container);
+
+       copy_tooltip("MIDI I/O activity\n\nNotifies MIDI messages sent (top) or "
+                    "received (bottom) by this channel.");
+}
+} // namespace giada::v
\ No newline at end of file
diff --git a/src/gui/elems/mainWindow/keyboard/midiActivity.h b/src/gui/elems/mainWindow/keyboard/midiActivity.h
new file mode 100644 (file)
index 0000000..f402a2e
--- /dev/null
@@ -0,0 +1,57 @@
+/* -----------------------------------------------------------------------------
+ *
+ * Giada - Your Hardcore Loopmachine
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
+ *
+ * This file is part of Giada - Your Hardcore Loopmachine.
+ *
+ * Giada - Your Hardcore Loopmachine is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Giada - Your Hardcore Loopmachine is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Giada - Your Hardcore Loopmachine. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * -------------------------------------------------------------------------- */
+
+#ifndef GE_MIDI_ACTIVITY_H
+#define GE_MIDI_ACTIVITY_H
+
+#include <FL/Fl_Button.H>
+#include <FL/Fl_Group.H>
+
+namespace giada::v
+{
+class geMidiActivity : public Fl_Group
+{
+public:
+       class geLed : public Fl_Button
+       {
+       public:
+               geLed();
+
+               void draw() override;
+               void lit();
+
+       private:
+               int m_decay;
+       };
+
+       geMidiActivity(int x, int y, int w, int h);
+
+       geLed* out;
+       geLed* in;
+};
+} // namespace giada::v
+
+#endif
index 2a9368f1e690b430b470e130f6f69f17700f46c9..0859e0f210d02b8832da9b8d464bf43be1d0521e 100644 (file)
@@ -38,6 +38,7 @@
 #include "gui/elems/basics/dial.h"
 #include "gui/elems/basics/statusButton.h"
 #include "gui/elems/mainWindow/keyboard/column.h"
+#include "gui/elems/mainWindow/keyboard/midiActivity.h"
 #include "gui/elems/mainWindow/keyboard/midiChannelButton.h"
 #include "utils/gui.h"
 #include "utils/string.h"
@@ -108,22 +109,17 @@ geMidiChannel::geMidiChannel(int X, int Y, int W, int H, c::channel::Data d)
 : geChannel(X, Y, W, H, d)
 , m_data(d)
 {
-#if defined(WITH_VST)
-       constexpr int delta = 6 * (G_GUI_UNIT + G_GUI_INNER_MARGIN);
-#else
-       constexpr int delta = 5 * (G_GUI_UNIT + G_GUI_INNER_MARGIN);
-#endif
-
-       playButton = new geStatusButton(x(), y(), G_GUI_UNIT, G_GUI_UNIT, channelStop_xpm, channelPlay_xpm);
-       arm        = new geButton(playButton->x() + playButton->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, "", armOff_xpm, armOn_xpm);
-       mainButton = new geMidiChannelButton(arm->x() + arm->w() + G_GUI_INNER_MARGIN, y(), w() - delta, H, m_channel);
-       mute       = new geStatusButton(mainButton->x() + mainButton->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, muteOff_xpm, muteOn_xpm);
-       solo       = new geStatusButton(mute->x() + mute->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, soloOff_xpm, soloOn_xpm);
+       playButton   = new geStatusButton(x(), y(), G_GUI_UNIT, G_GUI_UNIT, channelStop_xpm, channelPlay_xpm);
+       arm          = new geButton(playButton->x() + playButton->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, "", armOff_xpm, armOn_xpm);
+       mainButton   = new geMidiChannelButton(arm->x() + arm->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, H, m_channel);
+       midiActivity = new geMidiActivity(mainButton->x() + mainButton->w() + G_GUI_INNER_MARGIN, y(), 10, h());
+       mute         = new geStatusButton(midiActivity->x() + midiActivity->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, muteOff_xpm, muteOn_xpm);
+       solo         = new geStatusButton(mute->x() + mute->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, soloOff_xpm, soloOn_xpm);
 #if defined(WITH_VST)
        fx  = new geStatusButton(solo->x() + solo->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, fxOff_xpm, fxOn_xpm);
        vol = new geDial(fx->x() + fx->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT);
 #else
-       vol                 = new geDial(solo->x() + solo->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT);
+       vol = new geDial(solo->x() + solo->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT);
 #endif
 
        end();
index 33326d293641102b560fe5b6f4cf78b8d7677cae..9fc4db3e614577f9355f853a255838eef0ddaa57 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 789751c67e7d79811bddaacd986ae38693ff5801..4c5cca90b314be5cfebacdf5b6c6b72069667c5b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index ba145c2e80989148eb742c5abfddf4ef9da54335..3337b5a30db3f2491f51aeddfa204fee4327ba7f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index db9fcd1ad476c5e2dc61ee9a0b75c8a985664dd9..d868e61af169ec07285af0fcbb64672ed87c91ef 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -41,6 +41,7 @@
 #include "gui/elems/mainWindow/keyboard/channelStatus.h"
 #include "gui/elems/mainWindow/keyboard/column.h"
 #include "gui/elems/mainWindow/keyboard/keyboard.h"
+#include "gui/elems/mainWindow/keyboard/midiActivity.h"
 #include "gui/elems/mainWindow/keyboard/sampleChannelButton.h"
 #include "utils/gui.h"
 
@@ -173,25 +174,20 @@ void menuCallback(Fl_Widget* w, void* v)
 geSampleChannel::geSampleChannel(int X, int Y, int W, int H, c::channel::Data d)
 : geChannel(X, Y, W, H, d)
 {
-#if defined(WITH_VST)
-       constexpr int delta = 9 * (G_GUI_UNIT + G_GUI_INNER_MARGIN);
-#else
-       constexpr int delta = 8 * (G_GUI_UNIT + G_GUI_INNER_MARGIN);
-#endif
-
-       playButton  = new geStatusButton(x(), y(), G_GUI_UNIT, G_GUI_UNIT, channelStop_xpm, channelPlay_xpm);
-       arm         = new geButton(playButton->x() + playButton->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, "", armOff_xpm, armOn_xpm, armDisabled_xpm);
-       status      = new geChannelStatus(arm->x() + arm->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, H, m_channel);
-       mainButton  = new geSampleChannelButton(status->x() + status->w() + G_GUI_INNER_MARGIN, y(), w() - delta, H, m_channel);
-       readActions = new geStatusButton(mainButton->x() + mainButton->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, readActionOff_xpm, readActionOn_xpm, readActionDisabled_xpm);
-       modeBox     = new geChannelMode(readActions->x() + readActions->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, m_channel);
-       mute        = new geStatusButton(modeBox->x() + modeBox->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, muteOff_xpm, muteOn_xpm);
-       solo        = new geStatusButton(mute->x() + mute->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, soloOff_xpm, soloOn_xpm);
+       playButton   = new geStatusButton(x(), y(), G_GUI_UNIT, G_GUI_UNIT, channelStop_xpm, channelPlay_xpm);
+       arm          = new geButton(playButton->x() + playButton->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, "", armOff_xpm, armOn_xpm, armDisabled_xpm);
+       status       = new geChannelStatus(arm->x() + arm->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, h(), m_channel);
+       mainButton   = new geSampleChannelButton(status->x() + status->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, H, m_channel);
+       midiActivity = new geMidiActivity(mainButton->x() + mainButton->w() + G_GUI_INNER_MARGIN, y(), 10, h());
+       readActions  = new geStatusButton(midiActivity->x() + midiActivity->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, readActionOff_xpm, readActionOn_xpm, readActionDisabled_xpm);
+       modeBox      = new geChannelMode(readActions->x() + readActions->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, m_channel);
+       mute         = new geStatusButton(modeBox->x() + modeBox->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, muteOff_xpm, muteOn_xpm);
+       solo         = new geStatusButton(mute->x() + mute->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, soloOff_xpm, soloOn_xpm);
 #if defined(WITH_VST)
        fx  = new geStatusButton(solo->x() + solo->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT, fxOff_xpm, fxOn_xpm);
        vol = new geDial(fx->x() + fx->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT);
 #else
-       vol                 = new geDial(solo->x() + solo->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT);
+       vol = new geDial(solo->x() + solo->w() + G_GUI_INNER_MARGIN, y(), G_GUI_UNIT, G_GUI_UNIT);
 #endif
 
        end();
@@ -357,7 +353,6 @@ void geSampleChannel::draw()
 {
        const int ny = y() + (h() / 2) - (G_GUI_UNIT / 2);
 
-       status->resize(status->x(), ny, G_GUI_UNIT, G_GUI_UNIT);
        modeBox->resize(modeBox->x(), ny, G_GUI_UNIT, G_GUI_UNIT);
        readActions->resize(readActions->x(), ny, G_GUI_UNIT, G_GUI_UNIT);
 
index 32cfc992358dff33a7eee11d502cf15bbe6c7d16..f1f6d360b60486ff6742e1c61b92bfc8c9ec448a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 73f5fea20b18e93d26ef86f12b5bc761da1d14cc..e319ac3c166b9a77da2bdca37a2d34d9010a58ad 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 7f77d0a61347e6a52ca2bb0912cb6a97901fc0ff..b09737a627207f6b85fc2787337674205ceb4bcc 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index cc4a4087477f5794458947a50cefe24d11914190..8b3fca89b6139b79de418b98963b8fe8a89fa4dd 100644 (file)
@@ -4,7 +4,7 @@
 *
 * ------------------------------------------------------------------------------
 *
-* Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+* Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
 *
 * This file is part of Giada - Your Hardcore Loopmachine.
 *
 #include "glue/events.h"
 #include "glue/layout.h"
 #include "glue/main.h"
+#include "gui/elems/basics/button.h"
 #include "gui/elems/basics/dial.h"
 #include "gui/elems/basics/statusButton.h"
 #include "gui/elems/soundMeter.h"
 #include "utils/gui.h"
+#ifdef WITH_VST
+#include "gui/elems/basics/statusButton.h"
+#endif
 
 namespace giada::v
 {
-geMainIO::geMainIO(int x, int y)
-: gePack(x, y, Direction::HORIZONTAL)
-, outMeter(0, 0, 140, G_GUI_UNIT)
-, inMeter(0, 0, 140, G_GUI_UNIT)
-, outVol(0, 0, G_GUI_UNIT, G_GUI_UNIT)
-, inVol(0, 0, G_GUI_UNIT, G_GUI_UNIT)
-, inToOut(0, 0, 12, G_GUI_UNIT, "")
-#ifdef WITH_VST
-, masterFxOut(0, 0, G_GUI_UNIT, G_GUI_UNIT, fxOff_xpm, fxOn_xpm)
-, masterFxIn(0, 0, G_GUI_UNIT, G_GUI_UNIT, fxOff_xpm, fxOn_xpm)
-#endif
+geMainIO::geMainIO(int x, int y, int w, int h)
+: geFlex(x, y, w, h, Direction::HORIZONTAL, G_GUI_INNER_MARGIN)
 {
+       m_outMeter = new geSoundMeter(0, 0, 0, 0);
+       m_inMeter  = new geSoundMeter(0, 0, 0, 0);
+       m_outVol   = new geDial(0, 0, 0, 0);
+       m_inVol    = new geDial(0, 0, 0, 0);
+       m_inToOut  = new geButton();
 #ifdef WITH_VST
-       add(&masterFxIn);
+       m_masterFxOut = new geStatusButton(0, 0, 0, 0, fxOff_xpm, fxOn_xpm);
+       m_masterFxIn  = new geStatusButton(0, 0, 0, 0, fxOff_xpm, fxOn_xpm);
 #endif
-       add(&inVol);
-       add(&inMeter);
-       add(&inToOut);
-       add(&outMeter);
-       add(&outVol);
-#ifdef WITH_VST
-       add(&masterFxOut);
-#endif
-
-       resizable(nullptr); // don't resize any widget
 
-       outMeter.copy_tooltip("Main output meter");
-       inMeter.copy_tooltip("Main input meter");
-       outVol.copy_tooltip("Main output volume");
-       inVol.copy_tooltip("Main input volume");
-       inToOut.copy_tooltip("Stream linker\n\nConnects input to output to enable \"hear what you're playing\" mode.");
 #ifdef WITH_VST
-       masterFxOut.copy_tooltip("Main output plug-ins");
-       masterFxIn.copy_tooltip("Main input plug-ins");
+       add(m_masterFxIn, G_GUI_UNIT);
 #endif
-
-       outVol.callback(cb_outVol, (void*)this);
-       inVol.callback(cb_inVol, (void*)this);
-
-       inToOut.callback(cb_inToOut, (void*)this);
-       inToOut.type(FL_TOGGLE_BUTTON);
-
+       add(m_inVol, G_GUI_UNIT);
+       add(m_inMeter);
+       add(m_inToOut, 12);
+       add(m_outMeter);
+       add(m_outVol, G_GUI_UNIT);
 #ifdef WITH_VST
-       masterFxOut.callback(cb_masterFxOut, (void*)this);
-       masterFxIn.callback(cb_masterFxIn, (void*)this);
+       add(m_masterFxOut, G_GUI_UNIT);
 #endif
-}
+       end();
 
-/* -------------------------------------------------------------------------- */
-
-void geMainIO::cb_outVol(Fl_Widget* /*w*/, void* p) { ((geMainIO*)p)->cb_outVol(); }
-void geMainIO::cb_inVol(Fl_Widget* /*w*/, void* p) { ((geMainIO*)p)->cb_inVol(); }
-void geMainIO::cb_inToOut(Fl_Widget* /*w*/, void* p) { ((geMainIO*)p)->cb_inToOut(); }
+       m_outMeter->copy_tooltip("Main output meter");
+       m_inMeter->copy_tooltip("Main input meter");
+       m_outVol->copy_tooltip("Main output volume");
+       m_inVol->copy_tooltip("Main input volume");
+       m_inToOut->copy_tooltip("Stream linker\n\nConnects input to output to enable \"hear what you're playing\" mode.");
 #ifdef WITH_VST
-void geMainIO::cb_masterFxOut(Fl_Widget* /*w*/, void* p)
-{
-       ((geMainIO*)p)->cb_masterFxOut();
-}
-void geMainIO::cb_masterFxIn(Fl_Widget* /*w*/, void* p) { ((geMainIO*)p)->cb_masterFxIn(); }
+       m_masterFxOut->copy_tooltip("Main output plug-ins");
+       m_masterFxIn->copy_tooltip("Main input plug-ins");
 #endif
 
-/* -------------------------------------------------------------------------- */
+       m_outVol->onChange = [](float v) {
+               c::events::setMasterOutVolume(v, Thread::MAIN);
+       };
 
-void geMainIO::cb_outVol()
-{
-       c::events::setMasterOutVolume(outVol.value(), Thread::MAIN);
-}
+       m_inVol->onChange = [](float v) {
+               c::events::setMasterInVolume(v, Thread::MAIN);
+       };
 
-void geMainIO::cb_inVol()
-{
-       c::events::setMasterInVolume(inVol.value(), Thread::MAIN);
-}
-
-void geMainIO::cb_inToOut()
-{
-       c::main::setInToOut(inToOut.value());
-}
-
-/* -------------------------------------------------------------------------- */
+       m_inToOut->type(FL_TOGGLE_BUTTON);
+       m_inToOut->onClick = [v = m_inToOut->value()]() {
+               c::main::setInToOut(v);
+       };
 
 #ifdef WITH_VST
-
-void geMainIO::cb_masterFxOut()
-{
-       c::layout::openMasterOutPluginListWindow();
-}
-
-void geMainIO::cb_masterFxIn()
-{
-       c::layout::openMasterInPluginListWindow();
-}
-
+       m_masterFxOut->onClick = [] { c::layout::openMasterOutPluginListWindow(); };
+       m_masterFxIn->onClick  = [] { c::layout::openMasterInPluginListWindow(); };
 #endif
+}
 
 /* -------------------------------------------------------------------------- */
 
-void geMainIO::setOutVol(float v)
-{
-       outVol.value(v);
-}
-
-void geMainIO::setInVol(float v)
-{
-       inVol.value(v);
-}
+void geMainIO::setOutVol(float v) { m_outVol->value(v); }
+void geMainIO::setInVol(float v) { m_inVol->value(v); }
 
 /* -------------------------------------------------------------------------- */
 
@@ -150,12 +108,12 @@ void geMainIO::setInVol(float v)
 
 void geMainIO::setMasterFxOutFull(bool v)
 {
-       masterFxOut.setStatus(v);
+       m_masterFxOut->setStatus(v);
 }
 
 void geMainIO::setMasterFxInFull(bool v)
 {
-       masterFxIn.setStatus(v);
+       m_masterFxIn->setStatus(v);
 }
 
 #endif
@@ -164,12 +122,12 @@ void geMainIO::setMasterFxInFull(bool v)
 
 void geMainIO::refresh()
 {
-       outMeter.peak  = m_io.getMasterOutPeak();
-       outMeter.ready = m_io.isKernelReady();
-       inMeter.peak   = m_io.getMasterInPeak();
-       inMeter.ready  = m_io.isKernelReady();
-       outMeter.redraw();
-       inMeter.redraw();
+       m_outMeter->peak  = m_io.getMasterOutPeak();
+       m_outMeter->ready = m_io.isKernelReady();
+       m_inMeter->peak   = m_io.getMasterInPeak();
+       m_inMeter->ready  = m_io.isKernelReady();
+       m_outMeter->redraw();
+       m_inMeter->redraw();
 }
 
 /* -------------------------------------------------------------------------- */
@@ -178,12 +136,12 @@ void geMainIO::rebuild()
 {
        m_io = c::main::getIO();
 
-       outVol.value(m_io.masterOutVol);
-       inVol.value(m_io.masterInVol);
+       m_outVol->value(m_io.masterOutVol);
+       m_inVol->value(m_io.masterInVol);
 #ifdef WITH_VST
-       masterFxOut.setStatus(m_io.masterOutHasPlugins);
-       masterFxIn.setStatus(m_io.masterInHasPlugins);
-       inToOut.value(m_io.inToOut);
+       m_masterFxOut->setStatus(m_io.masterOutHasPlugins);
+       m_masterFxIn->setStatus(m_io.masterInHasPlugins);
+       m_inToOut->value(m_io.inToOut);
 #endif
 }
 } // namespace giada::v
\ No newline at end of file
index 3abc4fb86ece8fd8a1759951fb58eab59d718c27..9b83ccc9337aceaa9490977cd5c18b83887c9173 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #ifndef GE_MAIN_IO_H
 #define GE_MAIN_IO_H
 
-#include "gui/elems/basics/button.h"
-#include "gui/elems/basics/dial.h"
-#include "gui/elems/basics/pack.h"
-#include "gui/elems/soundMeter.h"
-#ifdef WITH_VST
-#include "gui/elems/basics/statusButton.h"
-#endif
 #include "glue/main.h"
+#include "gui/elems/basics/flex.h"
 
 namespace giada::v
 {
-class geMainIO : public gePack
+class geDial;
+class geSoundMeter;
+class geButton;
+class geStatusButton;
+class geMainIO : public geFlex
 {
 public:
-       geMainIO(int x, int y);
+       geMainIO(int x, int y, int w, int h);
 
        void refresh();
        void rebuild();
@@ -54,29 +52,16 @@ public:
 #endif
 
 private:
-       static void cb_outVol(Fl_Widget* /*w*/, void* p);
-       static void cb_inVol(Fl_Widget* /*w*/, void* p);
-       static void cb_inToOut(Fl_Widget* /*w*/, void* p);
-       void        cb_outVol();
-       void        cb_inVol();
-       void        cb_inToOut();
-#ifdef WITH_VST
-       static void cb_masterFxOut(Fl_Widget* /*w*/, void* p);
-       static void cb_masterFxIn(Fl_Widget* /*w*/, void* p);
-       void        cb_masterFxOut();
-       void        cb_masterFxIn();
-#endif
-
        c::main::IO m_io;
 
-       geSoundMeter outMeter;
-       geSoundMeter inMeter;
-       geDial       outVol;
-       geDial       inVol;
-       geButton     inToOut;
+       geSoundMeter* m_outMeter;
+       geSoundMeter* m_inMeter;
+       geDial*       m_outVol;
+       geDial*       m_inVol;
+       geButton*     m_inToOut;
 #ifdef WITH_VST
-       geStatusButton masterFxOut;
-       geStatusButton masterFxIn;
+       geStatusButton* m_masterFxOut;
+       geStatusButton* m_masterFxIn;
 #endif
 };
 } // namespace giada::v
index 3d57bd0349224bc1758dd1a5fcab9ed10daae99a..082331326ab923f87550e9b6917ae1c20d9e66f0 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 namespace giada::v
 {
 geMainMenu::geMainMenu(int x, int y)
-: gePack(x, y, Direction::HORIZONTAL)
+: gePack(x, y, Direction::HORIZONTAL, G_GUI_INNER_MARGIN)
 {
-       file   = new geButton(0, 0, 70, 21, "file");
-       edit   = new geButton(0, 0, 70, 21, "edit");
-       config = new geButton(0, 0, 70, 21, "config");
-       about  = new geButton(0, 0, 70, 21, "about");
+       geButton* file   = new geButton(0, 0, 70, G_GUI_UNIT, "File");
+       geButton* edit   = new geButton(0, 0, 70, G_GUI_UNIT, "Edit");
+       geButton* config = new geButton(0, 0, 70, G_GUI_UNIT, "Config");
+       geButton* about  = new geButton(0, 0, 70, G_GUI_UNIT, "About");
        add(file);
        add(edit);
        add(config);
        add(about);
 
-       resizable(nullptr); // don't resize any widget
+       resizable(nullptr);
 
-       file->callback(cb_file, (void*)this);
-       edit->callback(cb_edit, (void*)this);
-
-       about->callback([](Fl_Widget* /*w*/, void* /*v*/) {
-               c::layout::openAboutWindow();
-       });
-       config->callback([](Fl_Widget* /*w*/, void* /*v*/) {
-               c::layout::openConfigWindow();
-       });
+       file->onClick   = [this]() { cb_file(); };
+       edit->onClick   = [this]() { cb_edit(); };
+       about->onClick  = []() { c::layout::openAboutWindow(); };
+       config->onClick = []() { c::layout::openConfigWindow(); };
 }
 
 /* -------------------------------------------------------------------------- */
 
-void geMainMenu::cb_file(Fl_Widget* /*w*/, void* p) { ((geMainMenu*)p)->cb_file(); }
-void geMainMenu::cb_edit(Fl_Widget* /*w*/, void* p) { ((geMainMenu*)p)->cb_edit(); }
-
-/* -------------------------------------------------------------------------- */
-
 void geMainMenu::cb_file()
 {
-       using namespace giada::m;
-
-       /* An Fl_Menu_Button is made of many Fl_Menu_Item */
-
        Fl_Menu_Item menu[] = {
            u::gui::makeMenuItem("Open project..."),
            u::gui::makeMenuItem("Save project..."),
index 3f14b29fd11c19e2b453fab28a42f18da285b254..4ca3823eb195f4aa36f21444526f9ef1795214ef 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -29,8 +29,6 @@
 
 #include "gui/elems/basics/pack.h"
 
-class geButton;
-
 namespace giada::v
 {
 class geMainMenu : public gePack
@@ -39,15 +37,8 @@ public:
        geMainMenu(int x, int y);
 
 private:
-       static void cb_file(Fl_Widget* /*w*/, void* p);
-       static void cb_edit(Fl_Widget* /*w*/, void* p);
-       void        cb_file();
-       void        cb_edit();
-
-       geButton* file;
-       geButton* edit;
-       geButton* config;
-       geButton* about;
+       void cb_file();
+       void cb_edit();
 };
 } // namespace giada::v
 
index 59552babe9e049c88c08132780c6bf712076edde..32932858699abe44172f1a2e8f16d977f6b1bb16 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -39,82 +39,40 @@ namespace giada::v
 {
 geMainTimer::geMainTimer(int x, int y)
 : gePack(x, y, Direction::HORIZONTAL)
-, m_bpm(0, 0, 60, G_GUI_UNIT)
-, m_meter(0, 0, 60, G_GUI_UNIT)
-, m_quantizer(0, 0, 60, G_GUI_UNIT, "", false)
-, m_multiplier(0, 0, G_GUI_UNIT, G_GUI_UNIT, "", multiplyOff_xpm, multiplyOn_xpm)
-, m_divider(0, 0, G_GUI_UNIT, G_GUI_UNIT, "", divideOff_xpm, divideOn_xpm)
 {
-       add(&m_quantizer);
-       add(&m_bpm);
-       add(&m_meter);
-       add(&m_multiplier);
-       add(&m_divider);
+       m_bpm        = new geButton(0, 0, 60, G_GUI_UNIT);
+       m_meter      = new geButton(0, 0, 60, G_GUI_UNIT);
+       m_quantizer  = new geChoice(0, 0, 60, G_GUI_UNIT, "", false);
+       m_multiplier = new geButton(0, 0, G_GUI_UNIT, G_GUI_UNIT, "", multiplyOff_xpm, multiplyOn_xpm);
+       m_divider    = new geButton(0, 0, G_GUI_UNIT, G_GUI_UNIT, "", divideOff_xpm, divideOn_xpm);
+       add(m_quantizer);
+       add(m_bpm);
+       add(m_meter);
+       add(m_multiplier);
+       add(m_divider);
 
        resizable(nullptr); // don't resize any widget
 
-       m_bpm.copy_tooltip("Beats per minute (BPM)");
-       m_meter.copy_tooltip("Beats and bars");
-       m_quantizer.copy_tooltip("Live quantizer");
-       m_multiplier.copy_tooltip("Beat multiplier");
-       m_divider.copy_tooltip("Beat divider");
-
-       m_bpm.callback(cb_bpm, (void*)this);
-       m_meter.callback(cb_meter, (void*)this);
-       m_multiplier.callback(cb_multiplier, (void*)this);
-       m_divider.callback(cb_divider, (void*)this);
-
-       m_quantizer.add("off", 0, cb_quantizer, (void*)this);
-       m_quantizer.add("1\\/1", 0, cb_quantizer, (void*)this);
-       m_quantizer.add("1\\/2", 0, cb_quantizer, (void*)this);
-       m_quantizer.add("1\\/3", 0, cb_quantizer, (void*)this);
-       m_quantizer.add("1\\/4", 0, cb_quantizer, (void*)this);
-       m_quantizer.add("1\\/6", 0, cb_quantizer, (void*)this);
-       m_quantizer.add("1\\/8", 0, cb_quantizer, (void*)this);
-       m_quantizer.value(0); //  "off" by default
-}
-
-/* -------------------------------------------------------------------------- */
-
-void geMainTimer::cb_bpm(Fl_Widget* /*w*/, void* p) { ((geMainTimer*)p)->cb_bpm(); }
-void geMainTimer::cb_meter(Fl_Widget* /*w*/, void* p) { ((geMainTimer*)p)->cb_meter(); }
-void geMainTimer::cb_quantizer(Fl_Widget* /*w*/, void* p) { ((geMainTimer*)p)->cb_quantizer(); }
-void geMainTimer::cb_multiplier(Fl_Widget* /*w*/, void* p) { ((geMainTimer*)p)->cb_multiplier(); }
-void geMainTimer::cb_divider(Fl_Widget* /*w*/, void* p) { ((geMainTimer*)p)->cb_divider(); }
-
-/* -------------------------------------------------------------------------- */
-
-void geMainTimer::cb_bpm()
-{
-       c::layout::openBpmWindow(m_bpm.label());
-}
-
-/* -------------------------------------------------------------------------- */
-
-void geMainTimer::cb_meter()
-{
-       c::layout::openBeatsWindow(m_timer.beats, m_timer.bars);
-}
-
-/* -------------------------------------------------------------------------- */
-
-void geMainTimer::cb_quantizer()
-{
-       c::main::quantize(m_quantizer.value());
-}
-
-/* -------------------------------------------------------------------------- */
-
-void geMainTimer::cb_multiplier()
-{
-       c::events::multiplyBeats();
-}
-
-/* -------------------------------------------------------------------------- */
-
-void geMainTimer::cb_divider()
-{
-       c::events::divideBeats();
+       m_bpm->copy_tooltip("Beats per minute (BPM)");
+       m_meter->copy_tooltip("Beats and bars");
+       m_quantizer->copy_tooltip("Live quantizer");
+       m_multiplier->copy_tooltip("Beat multiplier");
+       m_divider->copy_tooltip("Beat divider");
+
+       m_bpm->onClick        = [&bpm = m_bpm]() { c::layout::openBpmWindow(bpm->label()); };
+       m_meter->onClick      = [&timer = m_timer]() { c::layout::openBeatsWindow(timer.beats, timer.bars); };
+       m_multiplier->onClick = []() { c::events::multiplyBeats(); };
+       m_divider->onClick    = []() { c::events::divideBeats(); };
+
+       m_quantizer->addItem("off");
+       m_quantizer->addItem("1\\/1");
+       m_quantizer->addItem("1\\/2");
+       m_quantizer->addItem("1\\/3");
+       m_quantizer->addItem("1\\/4");
+       m_quantizer->addItem("1\\/6");
+       m_quantizer->addItem("1\\/8");
+       m_quantizer->showItem(1); //  "off" by default
+       m_quantizer->onChange = [](ID value) { c::main::quantize(value); };
 }
 
 /* -------------------------------------------------------------------------- */
@@ -125,17 +83,17 @@ void geMainTimer::refresh()
 
        if (m_timer.isRecordingInput)
        {
-               m_bpm.deactivate();
-               m_meter.deactivate();
-               m_multiplier.deactivate();
-               m_divider.deactivate();
+               m_bpm->deactivate();
+               m_meter->deactivate();
+               m_multiplier->deactivate();
+               m_divider->deactivate();
        }
        else
        {
-               m_bpm.activate();
-               m_meter.activate();
-               m_multiplier.activate();
-               m_divider.activate();
+               m_bpm->activate();
+               m_meter->activate();
+               m_multiplier->activate();
+               m_divider->activate();
        }
 }
 
@@ -154,12 +112,12 @@ void geMainTimer::rebuild()
 
 void geMainTimer::setBpm(const char* v)
 {
-       m_bpm.copy_label(v);
+       m_bpm->copy_label(v);
 }
 
 void geMainTimer::setBpm(float v)
 {
-       m_bpm.copy_label(u::string::fToString(v, 1).c_str()); // Only 1 decimal place (e.g. 120.0)
+       m_bpm->copy_label(u::string::fToString(v, 1).c_str()); // Only 1 decimal place (e.g. 120.0)
 }
 
 /* -------------------------------------------------------------------------- */
@@ -168,17 +126,17 @@ void geMainTimer::setLock(bool v)
 {
        if (v)
        {
-               m_bpm.deactivate();
-               m_meter.deactivate();
-               m_multiplier.deactivate();
-               m_divider.deactivate();
+               m_bpm->deactivate();
+               m_meter->deactivate();
+               m_multiplier->deactivate();
+               m_divider->deactivate();
        }
        else
        {
-               m_bpm.activate();
-               m_meter.activate();
-               m_multiplier.activate();
-               m_divider.activate();
+               m_bpm->activate();
+               m_meter->activate();
+               m_multiplier->activate();
+               m_divider->activate();
        }
 }
 
@@ -186,7 +144,7 @@ void geMainTimer::setLock(bool v)
 
 void geMainTimer::setQuantizer(int q)
 {
-       m_quantizer.value(q);
+       m_quantizer->value(q);
 }
 
 /* -------------------------------------------------------------------------- */
@@ -194,6 +152,6 @@ void geMainTimer::setQuantizer(int q)
 void geMainTimer::setMeter(int beats, int bars)
 {
        std::string s = std::to_string(beats) + "/" + std::to_string(bars);
-       m_meter.copy_label(s.c_str());
+       m_meter->copy_label(s.c_str());
 }
 } // namespace giada::v
index f92feb3c1c8e4f8c691decdd42d021bee2364e82..c1ee8d5750f11a1fec4cfa71aa6b1e00ecca7a90 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #define GE_MAIN_TIMER_H
 
 #include "glue/main.h"
-#include "gui/elems/basics/button.h"
-#include "gui/elems/basics/choice.h"
 #include "gui/elems/basics/pack.h"
 
-class geButton;
-
 namespace giada::v
 {
+class geButton;
 class geChoice;
 class geMainTimer : public gePack
 {
@@ -55,25 +52,14 @@ public:
 
        void setLock(bool v);
 
-  private:
-       static void cb_bpm(Fl_Widget* /*w*/, void* p);
-       static void cb_meter(Fl_Widget* /*w*/, void* p);
-       static void cb_quantizer(Fl_Widget* /*w*/, void* p);
-       static void cb_multiplier(Fl_Widget* /*w*/, void* p);
-       static void cb_divider(Fl_Widget* /*w*/, void* p);
-       void        cb_bpm();
-       void        cb_meter();
-       void        cb_quantizer();
-       void        cb_multiplier();
-       void        cb_divider();
-
+private:
        c::main::Timer m_timer;
 
-       geButton m_bpm;
-       geButton m_meter;
-       geChoice m_quantizer;
-       geButton m_multiplier;
-       geButton m_divider;
+       geButton* m_bpm;
+       geButton* m_meter;
+       geChoice* m_quantizer;
+       geButton* m_multiplier;
+       geButton* m_divider;
 };
 } // namespace giada::v
 
index fef9729b96807e7398ca60bc238509e9d8fcbaad..c0d680a9ce251ae761bdf19d5935a831e65201e8 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 730f4506df42f5e0a6cb2605440ee92a2706a96a..f9e97a46e2b104022d0b848b04d54d88a91eed89 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 3c251006ff883134e4131a8eb896d85294bcc883..f0e38a5ddc0c343d3c3325afcd43c0de21272d07 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -53,7 +53,7 @@ void geSequencer::refresh()
 void geSequencer::draw()
 {
        m_background = geompp::Rect(x(), y(), w(), h());
-       m_cell       = geompp::Rect(x(), y(), w() / G_MAX_BEATS, h()).reduced(0, REC_BARS_H);
+       m_cell       = geompp::Rect(x(), y(), w() / G_MAX_BEATS, h()).reduced({0, REC_BARS_H});
 
        /* Cleanup */
        drawRectf(m_background, FL_BACKGROUND_COLOR);
@@ -69,7 +69,7 @@ void geSequencer::draw()
 
 void geSequencer::drawBody() const
 {
-       const geompp::Rect body = m_background.reduced(0, REC_BARS_H);
+       const geompp::Rect body = m_background.reduced({0, REC_BARS_H});
        const geompp::Line line = m_cell.getHeightAsLine();
 
        /* Background and borders. */
index a91d4bb116a87302feec72ea9eb349fe09761202..1d6dab2d8a67ad4af90b1d6813277da7dc84cd63 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 6093aa51e9637ece4be1e1f83e410edbe47647d8..988da8497c5eaf5fa2b76cf9be0119ac0c5f443e 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 4e919c1fb617dfb6292bb35e7446ab3660f437a9..7e97b66a3f247466537a4694d98fce1699be1bda 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 #include <string>
 
 class geBox;
-class geButton;
 
 namespace giada
 {
 namespace v
 {
+class geButton;
 class geMidiLearner : public gePack
 {
 public:
@@ -57,7 +57,7 @@ public:
        std::function<void()>         onStopLearn;
        std::function<void(uint32_t)> onClearLearn;
 
-  protected:
+protected:
        /* m_param
        Parameter index to be learnt. */
 
@@ -67,7 +67,7 @@ public:
        geButton m_valueBtn;
        geButton m_button;
 
-  private:
+private:
        static void cb_button(Fl_Widget* /*w*/, void* p);
        static void cb_value(Fl_Widget* /*w*/, void* p);
 
index a62a60f328c1753a302897f76840afe2626401d0..65558a8414d5327b8115c617e8aa53dad082c0cd 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 078598025ad96222ccf89f02818606af46c3b6b8..1622150304d4c74c2cfdfba50958eef9f1b1ad7a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 06bb2c0429f38a7a3cb76be0a8ceacaedf25e905..2a4d3dd4bda937aeb915e4cbd12bd47b89b1180c 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index e03972858668af515258b6ae7836afa89f4638e3..0b37df0ce82546c47b5714128dd9df0cc342f807 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index dd05266decfd6c9d917db7e45894430a07db03b0..a521fa8a23c4c59aad356fdafb88267b709eb8a0 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index b43cbe97d06ad99bc0d7e91cbdca6386c30a7bd6..cf667d6e60e343db8b8854f4cc3b732d5c527124 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 684e273bc614d97036e75cab3dcd5cd2080c8945..4d2c97a0ad8c9cd38babd667b9692fd425b1f42e 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -72,8 +72,8 @@ void gePluginParameter::cb_setValue(Fl_Widget* /*w*/, void* p) { ((gePluginParam
 
 void gePluginParameter::cb_setValue()
 {
-       c::events::setPluginParameter(m_param.pluginId, m_param.index,
-           m_slider->value(), /*gui=*/true);
+       c::events::setPluginParameter(0, m_param.pluginId, m_param.index,
+           m_slider->value(), Thread::MAIN);
 }
 
 /* -------------------------------------------------------------------------- */
index 4e5fe7db9f5c0de64f6f0f9d6ef2a9d52530d8e5..92e1d3356e9a737ff16ce9b3e323588433104437 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 90f628ab5bfdde463add3467569b215f54ba5aac..bcfe7a8f726233025900109a6995d088d2e430cb 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 93f1edf62204e9a4597f9aadaa9076074d32cea6..b0ad40bf7a71a4058fc6a7dd10c788e76a998000 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 
 #include <FL/Fl_Pack.H>
 
-class geDial;
 class geInput;
-class geButton;
 class geBox;
 
 namespace giada
 {
 namespace v
 {
+class geDial;
+class geButton;
 class geBoostTool : public Fl_Pack
 {
 public:
@@ -45,7 +45,7 @@ public:
 
        void rebuild();
 
-  private:
+private:
        static void cb_setBoost(Fl_Widget* /*w*/, void* p);
        static void cb_setBoostNum(Fl_Widget* /*w*/, void* p);
        static void cb_normalize(Fl_Widget* /*w*/, void* p);
index 3baf277f034eef3225177767eccb6b05b6a4df49..bcf685bfb50fcb8edcd0ce71537efa47d7667d88 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 2c23ff3f595ff0712242b279a9529bc10665247f..5d97aa0e5f6fa11ec4df1d8272a04a094b52dd13 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index bfeb6d26fd7096f827b0a82263168ea3e2302a44..69cad2b8eb89edfb593484328f1e91051089fb18 100644 (file)
@@ -5,7 +5,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index e410fd81e9f4f2366c4e637bb59ecc3ca0172ca0..f206627c455ed5e7ee8030877b26bb926045331c 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 20e8a6b1df37bb3f88d06dcd33fe6f5241df5e3e..8f8e85dfc4d492641aea059c1a09928b3081ca4f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 71500bf0c17d25e924a62076264fe7b860da354e..ed37e5e9c20c22e7c9c4729b86fc3b2451f75e97 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 956568296700e9f32d7ba0daa6c80cbbc3f25e50..f5c56c33e9ae97f85136daf45de644975c0649b3 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 7fd1b7ac77f5c7bbe320216dad669b784f10d6cd..09ec99e2a5cb27142968d0fc7300efd365f60a9c 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 4d27e8c822807b40cf54841925d5544faf9edbd2..5fd7d254787863815820875eff9d6c6b878f9d22 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 20e179fbf04e9a7f871681b5eacb2838190a09c2..2b753404547c7a6696b78a6209547f8156329102 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 607eb5189feaa004dc06643c68fe6c56f23eacd5..e271d3c0c3a3a335fa4ca51a7c954290dede74ab 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index f17a8a79a3b2d87d4265dd475c528d6ed2ca8427..76481da54007b7731f5b8faebc5eda75836b8240 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 98b0e2ae907c462d14ffe027521aaf058ece222f..761434ef7d4619f175a066632b8104ab9aa6716c 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 392f809c9590bdb7d78a183c7fdeeec54275329d..0d683389214f355887448d64dd3fa7ef396c2b8e 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index a1cc9050d809a40de4b07c7fb4d5fdd3ad98b124..816ce9f7c728850ad9c2c177161c9d9026196c9e 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 29498351c024e8be6597b6c7041bebd44085494b..0925e3f1601dbba9cb215d557f70d17dd9ef4e51 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 4662088878a859328b84fdf9fba3a57dfcb25047..97dee847420069de6b30ce6025f2d34458a6c372 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index fda0bc17d4ebf0220a350583e4829f30ed6a18e3..acdc0510410baddd4aee45115d357fab125a1138 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -57,7 +57,7 @@ Ui::Ui(m::Recorder& recorder)
 
 bool Ui::shouldBlink() const
 {
-       return m_blinker > 6; // TODO magic numbers
+       return m_blinker > BLINK_RATE / 2;
 }
 
 /* -------------------------------------------------------------------------- */
@@ -139,7 +139,7 @@ void Ui::refresh()
 
        /* Compute timer for blinker. */
 
-       m_blinker = (m_blinker + 1) % 12; // TODO magic numbers
+       m_blinker = (m_blinker + 1) % BLINK_RATE;
 
        /* Refresh Sample Editor and Action Editor for dynamic playhead. */
 
@@ -226,7 +226,7 @@ void Ui::setMainWindowTitle(const std::string& s)
 
 void Ui::startJuceDispatchLoop()
 {
-       Fl::add_timeout(G_GUI_PLUGIN_RATE, juceDispatchLoop);
+       Fl::add_timeout(G_GUI_REFRESH_RATE, juceDispatchLoop);
 }
 
 void Ui::stopJuceDispatchLoop()
@@ -253,7 +253,7 @@ void Ui::juceDispatchLoop(void*)
        juce::MessageManager* mm = juce::MessageManager::getInstanceWithoutCreating();
        assert(mm != nullptr);
        mm->runDispatchLoopUntil(1);
-       Fl::add_timeout(G_GUI_PLUGIN_RATE, juceDispatchLoop);
+       Fl::add_timeout(G_GUI_REFRESH_RATE, juceDispatchLoop);
 }
 
 #endif
index 724347e5d20ae526b3f580b555d3d8d73f31b1b6..ca25a1eb2307c16474c3f46512614b48c3048e0f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -124,6 +124,8 @@ public:
        Dispatcher                    dispatcher;
 
 private:
+       static constexpr int BLINK_RATE = G_GUI_FPS / 2;
+
 #ifdef WITH_VST
        static void juceDispatchLoop(void*);
 #endif
index dbb95b868eb101a0f1d97a47d422b12490bb1163..cbb2f5ab939006c4fd9989d4e966bee59f5ce348 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -48,9 +48,8 @@ void Updater::init(m::model::Model& model)
                /* This callback is fired by the updater thread, so it requires
                synchronization with the main one. */
 
-               Fl::lock();
+               u::gui::ScopedLock lock;
                type == m::model::SwapType::HARD ? m_ui.rebuild() : m_ui.refresh();
-               Fl::unlock();
        };
 
        Fl::add_timeout(G_GUI_REFRESH_RATE, update, this);
index e53de90d8618f2bd77ed03143c32d72d0d9dc06e..5b592d8ded6f950606fed060b2270d29ec31acb9 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 8584d81a115c4898cc023aa47b245d47d655f6f8..ff7829c3f6b8868fc4efe85aebbb08a497d94af2 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 155eb6bd843a02c0b9360af2b9c6c90c607a4db7..42a5ac71c72e5af8c005774ef54b8f62ed0e45d1 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index beb22ab9242d4fce4d52ddd5a3de766a41175591..ecec2791bdbadf3ba8a3e2682e3708d7f008b50e 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 9161ad48b397f550650934faff0477dfedb16281..b1f608e614981551c91acbc162eb20ab49d05dbc 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 7446db04ce9223ef85593472c0f130dd27dab528..406279e31d2fe8c0201704ad7bc8634b32180366 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
 
 namespace giada::u::gui
 {
+ScopedLock::ScopedLock()
+{
+       Fl::lock();
+}
+
+/* -------------------------------------------------------------------------- */
+
+ScopedLock::~ScopedLock()
+{
+       Fl::unlock();
+}
+
+/* -------------------------------------------------------------------------- */
+/* -------------------------------------------------------------------------- */
+/* -------------------------------------------------------------------------- */
+
 void setFavicon(v::gdWindow* w)
 {
 #if defined(__linux__) || defined(__FreeBSD__)
@@ -84,6 +100,13 @@ geompp::Rect<int> getStringRect(const std::string& s)
 
 /* -------------------------------------------------------------------------- */
 
+geompp::Rect<int> getCenterWinBounds(int w, int h)
+{
+       return {centerWindowX(w), centerWindowY(h), w, h};
+}
+
+/* -------------------------------------------------------------------------- */
+
 std::string removeFltkChars(const std::string& s)
 {
        std::string out = u::string::replace(s, "/", "-");
index 537e7235ce572cdd90998f18627935f717672527..86d4dc4b3250173fd4092d7270287208615cde55 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -39,6 +39,17 @@ class gdWindow;
 
 namespace giada::u::gui
 {
+/* ScopedLock
+ScopedLock for locking the main FLTK thread when the UI must be updated from a
+secondary thread. */
+
+class ScopedLock
+{
+public:
+       ScopedLock();
+       ~ScopedLock();
+};
+
 void setFavicon(v::gdWindow* w);
 
 /* removeFltkChars
@@ -51,6 +62,11 @@ Returns the bounding box in pixels of a string 's'. */
 
 geompp::Rect<int> getStringRect(const std::string& s);
 
+/* getCenterWinBounds
+Returns the bounding box to be used for a centered window. */
+
+geompp::Rect<int> getCenterWinBounds(int w, int h);
+
 /* truncate
 Adds ellipsis to a string 's' if it longer than 'width' pixels. */
 
index 1c90f51b4341002a76477186fae920eb8d21218b..42a1d0f132e3d9fcdb1ee0aabef09b52d6c5d17b 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 0b9cfc7302fc6a4fb70c71bced9a2cf06e80747f..2413724a13fdb237021ad9e68d6e244400501da4 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index ef7e1841b39ae49fc6fc3034f0d5cddb4de05b07..9f38a2f9d3eb8c2a22cad6bb3aa2518dcb68282a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index a7c1b9641b8e7aa1e9267b8bd8ec952951d6b985..7c31338702b34522e465badadfde5f659ecb818a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 4c7abb58f66170ae0b4f8c333b370695658a0ea4..e5d5ac42f53a19d2605ee2811ab65b6fcffbafa5 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
@@ -31,6 +31,7 @@
 #include <climits>
 #include <cstdarg>
 #include <iomanip>
+#include <memory>
 
 namespace giada
 {
index 7105c5c4b99157df4a448fc165cb88ded68eb476..a4d5a8de4a35bfb1a3dc96e16ad16b9ecd73dce0 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index bd9ebf46e6b86647f89eb48ccb8ba0bbfdbebc18..b95c4671167c95a8dfd49ba27373ab44a0833cd7 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 2562514e6c04a3da9fab5733955637fb6898b86c..f79c34595753abac3969b4caddb5b184869012f5 100644 (file)
@@ -6,7 +6,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 025a844c4f880fb2a7e764aaedd59fc914ac6b05..e3353e7601cdf025559ee540aec98197d5b4ab11 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 449b763ae12c50c22252ca9c769d73bb764e1953..a4c04700f0612aca85205a3600c76f5ea8b17db0 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index 6b8b0a825c5d8753e7832f4e266e151291b62ffd..7f96f850ce825aa5f08f30587dc4136145db0061 100644 (file)
@@ -4,7 +4,7 @@
  *
  * -----------------------------------------------------------------------------
  *
- * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual
+ * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories
  *
  * This file is part of Giada - Your Hardcore Loopmachine.
  *
index d951a8a3a62fe66eeb1f25e4858051c2b1ea4a44..fc729be633916da87ace8a552a1d2a4cb47430ef 100644 (file)
@@ -26,6 +26,8 @@ TEST_CASE("MidiMapper")
            {0, "0x000009", 0, 0x000009},   // playingInaudible
        };
 
+       midiLighter.onSend = []() {};
+
        midiLighter.playing = {0x000010, 0};
        midiLighter.mute    = {0x000011, 0};
        midiLighter.solo    = {0x000012, 0};