diff options
author | IOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org> | 2022-02-24 15:29:57 +0100 |
---|---|---|
committer | IOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org> | 2022-02-24 15:29:57 +0100 |
commit | 51f1a5d9e7467ceb4075e8223c265469ad200954 (patch) | |
tree | 0de2337010776b5fc2e7c464b9096a593fb87518 | |
parent | 9cc1e2e8e9ce4e31539c6837f920e2d256d99026 (diff) |
New upstream version 0.20.1+ds1
342 files changed, 1823 insertions, 992 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a0ca06..4aeb5e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 @@ -11,6 +11,20 @@ -------------------------------------------------------------------------------- +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 @@ -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. diff --git a/src/core/actions/action.h b/src/core/actions/action.h index 5c3d2e6..ba960b8 100644 --- a/src/core/actions/action.h +++ b/src/core/actions/action.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/actions/actionRecorder.cpp b/src/core/actions/actionRecorder.cpp index 38f7b3f..9043034 100644 --- a/src/core/actions/actionRecorder.cpp +++ b/src/core/actions/actionRecorder.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/actions/actionRecorder.h b/src/core/actions/actionRecorder.h index c0ee704..ebbe27b 100644 --- a/src/core/actions/actionRecorder.h +++ b/src/core/actions/actionRecorder.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/actions/actions.cpp b/src/core/actions/actions.cpp index dc3bdb0..04d1dc9 100644 --- a/src/core/actions/actions.cpp +++ b/src/core/actions/actions.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/actions/actions.h b/src/core/actions/actions.h index 12c224b..d098eae 100644 --- a/src/core/actions/actions.h +++ b/src/core/actions/actions.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/audioReceiver.cpp b/src/core/channels/audioReceiver.cpp index c0957a7..bdaf232 100644 --- a/src/core/channels/audioReceiver.cpp +++ b/src/core/channels/audioReceiver.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/audioReceiver.h b/src/core/channels/audioReceiver.h index 99e4e9d..eec25bc 100644 --- a/src/core/channels/audioReceiver.h +++ b/src/core/channels/audioReceiver.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/channel.cpp b/src/core/channels/channel.cpp index 6c9cb87..7cf7081 100644 --- a/src/core/channels/channel.cpp +++ b/src/core/channels/channel.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 +} /* -------------------------------------------------------------------------- */ diff --git a/src/core/channels/channel.h b/src/core/channels/channel.h index aa91a9a..020ba9e 100644 --- a/src/core/channels/channel.h +++ b/src/core/channels/channel.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/channelManager.cpp b/src/core/channels/channelManager.cpp index 30c5578..51d42e8 100644 --- a/src/core/channels/channelManager.cpp +++ b/src/core/channels/channelManager.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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; } /* -------------------------------------------------------------------------- */ diff --git a/src/core/channels/channelManager.h b/src/core/channels/channelManager.h index 2e1e582..29b8290 100644 --- a/src/core/channels/channelManager.h +++ b/src/core/channels/channelManager.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/midiActionRecorder.cpp b/src/core/channels/midiActionRecorder.cpp index 61d2925..0b5286e 100644 --- a/src/core/channels/midiActionRecorder.cpp +++ b/src/core/channels/midiActionRecorder.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/midiActionRecorder.h b/src/core/channels/midiActionRecorder.h index 8abc229..62f9807 100644 --- a/src/core/channels/midiActionRecorder.h +++ b/src/core/channels/midiActionRecorder.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/midiController.cpp b/src/core/channels/midiController.cpp index ffc86a5..3ad920d 100644 --- a/src/core/channels/midiController.cpp +++ b/src/core/channels/midiController.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/midiController.h b/src/core/channels/midiController.h index 48b1a79..61c701e 100644 --- a/src/core/channels/midiController.h +++ b/src/core/channels/midiController.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/midiLearner.cpp b/src/core/channels/midiLearner.cpp index bb5492d..3c6d92f 100644 --- a/src/core/channels/midiLearner.cpp +++ b/src/core/channels/midiLearner.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/midiLearner.h b/src/core/channels/midiLearner.h index 286b3cc..4bd64a1 100644 --- a/src/core/channels/midiLearner.h +++ b/src/core/channels/midiLearner.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/midiLighter.cpp b/src/core/channels/midiLighter.cpp index 687c059..45056e8 100644 --- a/src/core/channels/midiLighter.cpp +++ b/src/core/channels/midiLighter.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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(); } /* -------------------------------------------------------------------------- */ diff --git a/src/core/channels/midiLighter.h b/src/core/channels/midiLighter.h index b34dbc0..a58b39f 100644 --- a/src/core/channels/midiLighter.h +++ b/src/core/channels/midiLighter.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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; }; diff --git a/src/core/channels/midiReceiver.cpp b/src/core/channels/midiReceiver.cpp index ada713a..599f2ca 100644 --- a/src/core/channels/midiReceiver.cpp +++ b/src/core/channels/midiReceiver.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/midiReceiver.h b/src/core/channels/midiReceiver.h index 050bc4f..4f8fdb5 100644 --- a/src/core/channels/midiReceiver.h +++ b/src/core/channels/midiReceiver.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/midiSender.cpp b/src/core/channels/midiSender.cpp index b50fc9a..6eee0ba 100644 --- a/src/core/channels/midiSender.cpp +++ b/src/core/channels/midiSender.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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(); } /* -------------------------------------------------------------------------- */ diff --git a/src/core/channels/midiSender.h b/src/core/channels/midiSender.h index a405aff..140f291 100644 --- a/src/core/channels/midiSender.h +++ b/src/core/channels/midiSender.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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; diff --git a/src/core/channels/sampleActionRecorder.cpp b/src/core/channels/sampleActionRecorder.cpp index cb0445c..d03c752 100644 --- a/src/core/channels/sampleActionRecorder.cpp +++ b/src/core/channels/sampleActionRecorder.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/sampleActionRecorder.h b/src/core/channels/sampleActionRecorder.h index 7f86b09..a780c02 100644 --- a/src/core/channels/sampleActionRecorder.h +++ b/src/core/channels/sampleActionRecorder.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/samplePlayer.cpp b/src/core/channels/samplePlayer.cpp index 108a8ef..bf87e55 100644 --- a/src/core/channels/samplePlayer.cpp +++ b/src/core/channels/samplePlayer.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/samplePlayer.h b/src/core/channels/samplePlayer.h index 2e18b17..f6256ab 100644 --- a/src/core/channels/samplePlayer.h +++ b/src/core/channels/samplePlayer.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/waveReader.cpp b/src/core/channels/waveReader.cpp index 0d7946b..bbc206d 100644 --- a/src/core/channels/waveReader.cpp +++ b/src/core/channels/waveReader.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/channels/waveReader.h b/src/core/channels/waveReader.h index 9af720d..d12dfff 100644 --- a/src/core/channels/waveReader.h +++ b/src/core/channels/waveReader.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/conf.cpp b/src/core/conf.cpp index 7240433..cf8437d 100644 --- a/src/core/conf.cpp +++ b/src/core/conf.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/conf.h b/src/core/conf.h index a34b544..20e032d 100644 --- a/src/core/conf.h +++ b/src/core/conf.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/const.h b/src/core/const.h index a2e7356..e77db0c 100644 --- a/src/core/const.h +++ b/src/core/const.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual + * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories * * This file is part of Giada - Your Hardcore Loopmachine. * @@ -59,10 +59,10 @@ /* -- 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; diff --git a/src/core/engine.cpp b/src/core/engine.cpp index 3139443..2b05d8f 100644 --- a/src/core/engine.cpp +++ b/src/core/engine.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,9 +29,19 @@ #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 diff --git a/src/core/engine.h b/src/core/engine.h index 5fa6ae5..c7d242e 100644 --- a/src/core/engine.h +++ b/src/core/engine.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual + * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories * * This file is part of Giada - Your Hardcore Loopmachine. * @@ -51,6 +51,15 @@ 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 diff --git a/src/core/eventDispatcher.h b/src/core/eventDispatcher.h index b980537..3462201 100644 --- a/src/core/eventDispatcher.h +++ b/src/core/eventDispatcher.h @@ -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, diff --git a/src/core/graphics.cpp b/src/core/graphics.cpp index eb41137..10eb1b0 100644 --- a/src/core/graphics.cpp +++ b/src/core/graphics.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/graphics.h b/src/core/graphics.h index 6fb2c05..7e18e5f 100644 --- a/src/core/graphics.h +++ b/src/core/graphics.h @@ -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/core/idManager.cpp b/src/core/idManager.cpp index 2e34592..87f62bb 100644 --- a/src/core/idManager.cpp +++ b/src/core/idManager.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/idManager.h b/src/core/idManager.h index 6fe9c6e..32bf1ae 100644 --- a/src/core/idManager.h +++ b/src/core/idManager.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/init.cpp b/src/core/init.cpp index bd4b98f..ccd97f0 100644 --- a/src/core/init.cpp +++ b/src/core/init.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/init.h b/src/core/init.h index c29e6ef..1c587e2 100644 --- a/src/core/init.h +++ b/src/core/init.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/jackTransport.cpp b/src/core/jackTransport.cpp index 45c1c7c..9ebcac6 100644 --- a/src/core/jackTransport.cpp +++ b/src/core/jackTransport.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/jackTransport.h b/src/core/jackTransport.h index 5e6f7f7..b733474 100644 --- a/src/core/jackTransport.h +++ b/src/core/jackTransport.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/kernelAudio.cpp b/src/core/kernelAudio.cpp index 4a52d88..8c10d8e 100644 --- a/src/core/kernelAudio.cpp +++ b/src/core/kernelAudio.cpp @@ -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/core/kernelAudio.h b/src/core/kernelAudio.h index 706d662..ce3c57b 100644 --- a/src/core/kernelAudio.h +++ b/src/core/kernelAudio.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/kernelMidi.cpp b/src/core/kernelMidi.cpp index fd24587..040b0e2 100644 --- a/src/core/kernelMidi.cpp +++ b/src/core/kernelMidi.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 { diff --git a/src/core/kernelMidi.h b/src/core/kernelMidi.h index 88f98ed..ac10e22 100644 --- a/src/core/kernelMidi.h +++ b/src/core/kernelMidi.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/metronome.cpp b/src/core/metronome.cpp index 1ed5cd7..7b5fbb0 100644 --- a/src/core/metronome.cpp +++ b/src/core/metronome.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/metronome.h b/src/core/metronome.h index 7c8c2a7..01bee57 100644 --- a/src/core/metronome.h +++ b/src/core/metronome.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/midiDispatcher.cpp b/src/core/midiDispatcher.cpp index 239e234..0d06521 100644 --- a/src/core/midiDispatcher.cpp +++ b/src/core/midiDispatcher.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/core/midiDispatcher.h b/src/core/midiDispatcher.h index b7d0a1d..2a52c0d 100644 --- a/src/core/midiDispatcher.h +++ b/src/core/midiDispatcher.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/core/midiEvent.cpp b/src/core/midiEvent.cpp index 22aef56..761106a 100644 --- a/src/core/midiEvent.cpp +++ b/src/core/midiEvent.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/midiEvent.h b/src/core/midiEvent.h index 48e967a..15ff0e7 100644 --- a/src/core/midiEvent.h +++ b/src/core/midiEvent.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/midiLearnParam.cpp b/src/core/midiLearnParam.cpp index 54dfcbf..83c820a 100644 --- a/src/core/midiLearnParam.cpp +++ b/src/core/midiLearnParam.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/midiLearnParam.h b/src/core/midiLearnParam.h index b6f0430..f2e7738 100644 --- a/src/core/midiLearnParam.h +++ b/src/core/midiLearnParam.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/midiMapper.cpp b/src/core/midiMapper.cpp index a11bd38..bee78b8 100644 --- a/src/core/midiMapper.cpp +++ b/src/core/midiMapper.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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; } diff --git a/src/core/midiMapper.h b/src/core/midiMapper.h index 694ffe5..f8f2c13 100644 --- a/src/core/midiMapper.h +++ b/src/core/midiMapper.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/mixer.cpp b/src/core/mixer.cpp index 7b8cd54..bd49e43 100644 --- a/src/core/mixer.cpp +++ b/src/core/mixer.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/core/mixer.h b/src/core/mixer.h index 6ed4635..d10c933 100644 --- a/src/core/mixer.h +++ b/src/core/mixer.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/mixerHandler.cpp b/src/core/mixerHandler.cpp index d636775..af88cf2 100644 --- a/src/core/mixerHandler.cpp +++ b/src/core/mixerHandler.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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. */ diff --git a/src/core/mixerHandler.h b/src/core/mixerHandler.h index b951356..65364c9 100644 --- a/src/core/mixerHandler.h +++ b/src/core/mixerHandler.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/model/mixer.cpp b/src/core/model/mixer.cpp index e667c3f..7ed5dd7 100644 --- a/src/core/model/mixer.cpp +++ b/src/core/model/mixer.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/model/mixer.h b/src/core/model/mixer.h index a1377b1..a5a7499 100644 --- a/src/core/model/mixer.h +++ b/src/core/model/mixer.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/model/model.cpp b/src/core/model/model.cpp index 75a30e0..ca27e4c 100644 --- a/src/core/model/model.cpp +++ b/src/core/model/model.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/core/model/model.h b/src/core/model/model.h index 12e0f3a..28b7c6b 100644 --- a/src/core/model/model.h +++ b/src/core/model/model.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 { diff --git a/src/core/model/recorder.cpp b/src/core/model/recorder.cpp index d7835b6..5d714fe 100644 --- a/src/core/model/recorder.cpp +++ b/src/core/model/recorder.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/model/recorder.h b/src/core/model/recorder.h index d4112ce..aca24e9 100644 --- a/src/core/model/recorder.h +++ b/src/core/model/recorder.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/model/sequencer.cpp b/src/core/model/sequencer.cpp index d2a5b2f..426f9d7 100644 --- a/src/core/model/sequencer.cpp +++ b/src/core/model/sequencer.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/model/sequencer.h b/src/core/model/sequencer.h index 5526f3b..5389e86 100644 --- a/src/core/model/sequencer.h +++ b/src/core/model/sequencer.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/model/storage.cpp b/src/core/model/storage.cpp index d2e5e73..c0cc3c8 100644 --- a/src/core/model/storage.cpp +++ b/src/core/model/storage.cpp @@ -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; } /* -------------------------------------------------------------------------- */ diff --git a/src/core/model/storage.h b/src/core/model/storage.h index e69d140..aa1ce01 100644 --- a/src/core/model/storage.h +++ b/src/core/model/storage.h @@ -27,15 +27,16 @@ #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 diff --git a/src/core/patch.cpp b/src/core/patch.cpp index 2db30e4..498b12f 100644 --- a/src/core/patch.cpp +++ b/src/core/patch.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/patch.h b/src/core/patch.h index a9e22f1..f359251 100644 --- a/src/core/patch.h +++ b/src/core/patch.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/plugins/plugin.cpp b/src/core/plugins/plugin.cpp index 31f75c4..23c07cd 100644 --- a/src/core/plugins/plugin.cpp +++ b/src/core/plugins/plugin.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 { diff --git a/src/core/plugins/plugin.h b/src/core/plugins/plugin.h index d65136b..6f1758d 100644 --- a/src/core/plugins/plugin.h +++ b/src/core/plugins/plugin.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/core/plugins/pluginHost.cpp b/src/core/plugins/pluginHost.cpp index 6533ad1..76c58e5 100644 --- a/src/core/plugins/pluginHost.cpp +++ b/src/core/plugins/pluginHost.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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()); } /* -------------------------------------------------------------------------- */ diff --git a/src/core/plugins/pluginHost.h b/src/core/plugins/pluginHost.h index e247e84..9e19817 100644 --- a/src/core/plugins/pluginHost.h +++ b/src/core/plugins/pluginHost.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 { diff --git a/src/core/plugins/pluginManager.cpp b/src/core/plugins/pluginManager.cpp index 7e5cbb7..e58c406 100644 --- a/src/core/plugins/pluginManager.cpp +++ b/src/core/plugins/pluginManager.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/core/plugins/pluginManager.h b/src/core/plugins/pluginManager.h index 8b16ae4..6e6b58a 100644 --- a/src/core/plugins/pluginManager.h +++ b/src/core/plugins/pluginManager.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); diff --git a/src/core/plugins/pluginState.cpp b/src/core/plugins/pluginState.cpp index 0cad688..14a5403 100644 --- a/src/core/plugins/pluginState.cpp +++ b/src/core/plugins/pluginState.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/plugins/pluginState.h b/src/core/plugins/pluginState.h index ecb4c7c..7a5d440 100644 --- a/src/core/plugins/pluginState.h +++ b/src/core/plugins/pluginState.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/quantizer.cpp b/src/core/quantizer.cpp index c943369..224700e 100644 --- a/src/core/quantizer.cpp +++ b/src/core/quantizer.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/quantizer.h b/src/core/quantizer.h index 1fae526..c2f9070 100644 --- a/src/core/quantizer.h +++ b/src/core/quantizer.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/range.h b/src/core/range.h index 1a1b917..511dd1a 100644 --- a/src/core/range.h +++ b/src/core/range.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/recorder.cpp b/src/core/recorder.cpp index d131ae7..19165cc 100644 --- a/src/core/recorder.cpp +++ b/src/core/recorder.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/recorder.h b/src/core/recorder.h index f98a49b..34e4c4c 100644 --- a/src/core/recorder.h +++ b/src/core/recorder.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/resampler.cpp b/src/core/resampler.cpp index 596e83c..4d22726 100644 --- a/src/core/resampler.cpp +++ b/src/core/resampler.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/resampler.h b/src/core/resampler.h index 680a0d3..2f563b6 100644 --- a/src/core/resampler.h +++ b/src/core/resampler.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/ringBuffer.h b/src/core/ringBuffer.h index 310d027..9e7032c 100644 --- a/src/core/ringBuffer.h +++ b/src/core/ringBuffer.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/sequencer.cpp b/src/core/sequencer.cpp index fa60209..f479a51 100644 --- a/src/core/sequencer.cpp +++ b/src/core/sequencer.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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; } } } diff --git a/src/core/sequencer.h b/src/core/sequencer.h index e68ca64..97f53d2 100644 --- a/src/core/sequencer.h +++ b/src/core/sequencer.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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; diff --git a/src/core/synchronizer.cpp b/src/core/synchronizer.cpp index 1019858..504806f 100644 --- a/src/core/synchronizer.cpp +++ b/src/core/synchronizer.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/synchronizer.h b/src/core/synchronizer.h index 20f3bee..2251847 100644 --- a/src/core/synchronizer.h +++ b/src/core/synchronizer.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/types.h b/src/core/types.h index 14df0aa..f19b6a4 100644 --- a/src/core/types.h +++ b/src/core/types.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/wave.cpp b/src/core/wave.cpp index f29054a..264f1d7 100644 --- a/src/core/wave.cpp +++ b/src/core/wave.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/wave.h b/src/core/wave.h index 52c5705..2e94af9 100644 --- a/src/core/wave.h +++ b/src/core/wave.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/waveFx.cpp b/src/core/waveFx.cpp index d68e5a1..7f5aa7e 100644 --- a/src/core/waveFx.cpp +++ b/src/core/waveFx.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/waveFx.h b/src/core/waveFx.h index c0db661..37bf462 100644 --- a/src/core/waveFx.h +++ b/src/core/waveFx.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/core/waveManager.cpp b/src/core/waveManager.cpp index 6cfe414..fbb16bb 100644 --- a/src/core/waveManager.cpp +++ b/src/core/waveManager.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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> diff --git a/src/core/waveManager.h b/src/core/waveManager.h index d0142ea..a50f8ec 100644 --- a/src/core/waveManager.h +++ b/src/core/waveManager.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/glue/actionEditor.cpp b/src/glue/actionEditor.cpp index 248a604..7d2441c 100644 --- a/src/glue/actionEditor.cpp +++ b/src/glue/actionEditor.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/glue/actionEditor.h b/src/glue/actionEditor.h index 899c060..d624e2a 100644 --- a/src/glue/actionEditor.h +++ b/src/glue/actionEditor.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/glue/channel.cpp b/src/glue/channel.cpp index a6aa9c2..2e25bc2 100644 --- a/src/glue/channel.cpp +++ b/src/glue/channel.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/glue/channel.h b/src/glue/channel.h index 67e175d..c98e01d 100644 --- a/src/glue/channel.h +++ b/src/glue/channel.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/glue/config.cpp b/src/glue/config.cpp index 088d0f7..8a962ea 100644 --- a/src/glue/config.cpp +++ b/src/glue/config.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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"; diff --git a/src/glue/config.h b/src/glue/config.h index ae479e3..55878c6 100644 --- a/src/glue/config.h +++ b/src/glue/config.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/glue/events.cpp b/src/glue/events.cpp index 30a1043..2d8b4ca 100644 --- a/src/glue/events.cpp +++ b/src/glue/events.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/glue/events.h b/src/glue/events.h index 6816afa..f1ca0d2 100644 --- a/src/glue/events.h +++ b/src/glue/events.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/glue/io.cpp b/src/glue/io.cpp index 4555a6d..eb3184d 100644 --- a/src/glue/io.cpp +++ b/src/glue/io.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/glue/io.h b/src/glue/io.h index f862472..74eca91 100644 --- a/src/glue/io.h +++ b/src/glue/io.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/glue/layout.cpp b/src/glue/layout.cpp index 711aa24..f3b9fc1 100644 --- a/src/glue/layout.cpp +++ b/src/glue/layout.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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) diff --git a/src/glue/layout.h b/src/glue/layout.h index a286f94..8526350 100644 --- a/src/glue/layout.h +++ b/src/glue/layout.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual + * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories * * This file is part of Giada - Your Hardcore Loopmachine. * @@ -30,6 +30,11 @@ #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); diff --git a/src/glue/main.cpp b/src/glue/main.cpp index 3b68747..fd981bc 100644 --- a/src/glue/main.cpp +++ b/src/glue/main.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/glue/main.h b/src/glue/main.h index 8757c50..b5bf1b8 100644 --- a/src/glue/main.h +++ b/src/glue/main.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/glue/plugin.cpp b/src/glue/plugin.cpp index a7010e2..86d5798 100644 --- a/src/glue/plugin.cpp +++ b/src/glue/plugin.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); } /* -------------------------------------------------------------------------- */ diff --git a/src/glue/plugin.h b/src/glue/plugin.h index dca83f4..aaebab7 100644 --- a/src/glue/plugin.h +++ b/src/glue/plugin.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); diff --git a/src/glue/recorder.cpp b/src/glue/recorder.cpp index 1c2d22a..a25f382 100644 --- a/src/glue/recorder.cpp +++ b/src/glue/recorder.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/glue/recorder.h b/src/glue/recorder.h index 6d78432..efd247e 100644 --- a/src/glue/recorder.h +++ b/src/glue/recorder.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/glue/sampleEditor.cpp b/src/glue/sampleEditor.cpp index 7fec174..942fb9e 100644 --- a/src/glue/sampleEditor.cpp +++ b/src/glue/sampleEditor.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); } diff --git a/src/glue/sampleEditor.h b/src/glue/sampleEditor.h index fe93099..780c63b 100644 --- a/src/glue/sampleEditor.h +++ b/src/glue/sampleEditor.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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. */ diff --git a/src/glue/storage.cpp b/src/glue/storage.cpp index ecb2aec..1f18190 100644 --- a/src/glue/storage.cpp +++ b/src/glue/storage.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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(); } diff --git a/src/glue/storage.h b/src/glue/storage.h index 6611300..b6df6dd 100644 --- a/src/glue/storage.h +++ b/src/glue/storage.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/about.cpp b/src/gui/dialogs/about.cpp index 18cd81f..ac3ded7 100644 --- a/src/gui/dialogs/about.cpp +++ b/src/gui/dialogs/about.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); diff --git a/src/gui/dialogs/about.h b/src/gui/dialogs/about.h index a2cd3ba..7083d6d 100644 --- a/src/gui/dialogs/about.h +++ b/src/gui/dialogs/about.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/baseActionEditor.cpp b/src/gui/dialogs/actionEditor/baseActionEditor.cpp index 75f4e23..18c9051 100644 --- a/src/gui/dialogs/actionEditor/baseActionEditor.cpp +++ b/src/gui/dialogs/actionEditor/baseActionEditor.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,10 +45,10 @@ 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; } /* -------------------------------------------------------------------------- */ diff --git a/src/gui/dialogs/actionEditor/baseActionEditor.h b/src/gui/dialogs/actionEditor/baseActionEditor.h index 67a325a..3ff2f38 100644 --- a/src/gui/dialogs/actionEditor/baseActionEditor.h +++ b/src/gui/dialogs/actionEditor/baseActionEditor.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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. */ diff --git a/src/gui/dialogs/actionEditor/midiActionEditor.cpp b/src/gui/dialogs/actionEditor/midiActionEditor.cpp index 911dfdf..a270a10 100644 --- a/src/gui/dialogs/actionEditor/midiActionEditor.cpp +++ b/src/gui/dialogs/actionEditor/midiActionEditor.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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) diff --git a/src/gui/dialogs/actionEditor/midiActionEditor.h b/src/gui/dialogs/actionEditor/midiActionEditor.h index 75749cf..4722d65 100644 --- a/src/gui/dialogs/actionEditor/midiActionEditor.h +++ b/src/gui/dialogs/actionEditor/midiActionEditor.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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; diff --git a/src/gui/dialogs/actionEditor/sampleActionEditor.cpp b/src/gui/dialogs/actionEditor/sampleActionEditor.cpp index 939b90a..0f013d6 100644 --- a/src/gui/dialogs/actionEditor/sampleActionEditor.cpp +++ b/src/gui/dialogs/actionEditor/sampleActionEditor.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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) diff --git a/src/gui/dialogs/actionEditor/sampleActionEditor.h b/src/gui/dialogs/actionEditor/sampleActionEditor.h index 2021331..a1f42df 100644 --- a/src/gui/dialogs/actionEditor/sampleActionEditor.h +++ b/src/gui/dialogs/actionEditor/sampleActionEditor.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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; diff --git a/src/gui/dialogs/beatsInput.cpp b/src/gui/dialogs/beatsInput.cpp index 7951b7d..c777498 100644 --- a/src/gui/dialogs/beatsInput.cpp +++ b/src/gui/dialogs/beatsInput.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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"); diff --git a/src/gui/dialogs/beatsInput.h b/src/gui/dialogs/beatsInput.h index 19ed954..5a68724 100644 --- a/src/gui/dialogs/beatsInput.h +++ b/src/gui/dialogs/beatsInput.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual + * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories * * This file is part of Giada - Your Hardcore Loopmachine. * @@ -30,11 +30,11 @@ #include "window.h" class geInput; -class geButton; class geCheck; namespace giada::v { +class geButton; class gdBeatsInput : public gdWindow { public: diff --git a/src/gui/dialogs/bpmInput.cpp b/src/gui/dialogs/bpmInput.cpp index 0364ae4..b84c655 100644 --- a/src/gui/dialogs/bpmInput.cpp +++ b/src/gui/dialogs/bpmInput.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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"); diff --git a/src/gui/dialogs/bpmInput.h b/src/gui/dialogs/bpmInput.h index 5dde87d..8658e9a 100644 --- a/src/gui/dialogs/bpmInput.h +++ b/src/gui/dialogs/bpmInput.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual + * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories * * This file is part of Giada - Your Hardcore Loopmachine. * @@ -30,10 +30,10 @@ #include "window.h" class geInput; -class geButton; namespace giada::v { +class geButton; class gdBpmInput : public gdWindow { public: diff --git a/src/gui/dialogs/browser/browserBase.cpp b/src/gui/dialogs/browser/browserBase.cpp index 7366d18..1ed0028 100644 --- a/src/gui/dialogs/browser/browserBase.cpp +++ b/src/gui/dialogs/browser/browserBase.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); diff --git a/src/gui/dialogs/browser/browserBase.h b/src/gui/dialogs/browser/browserBase.h index f9d9c10..af92f9c 100644 --- a/src/gui/dialogs/browser/browserBase.h +++ b/src/gui/dialogs/browser/browserBase.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/gui/dialogs/browser/browserDir.cpp b/src/gui/dialogs/browser/browserDir.cpp index 46ee903..69ea65a 100644 --- a/src/gui/dialogs/browser/browserDir.cpp +++ b/src/gui/dialogs/browser/browserDir.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/gui/dialogs/browser/browserDir.h b/src/gui/dialogs/browser/browserDir.h index daf93fd..218d002 100644 --- a/src/gui/dialogs/browser/browserDir.h +++ b/src/gui/dialogs/browser/browserDir.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/browser/browserLoad.cpp b/src/gui/dialogs/browser/browserLoad.cpp index 4b1d7e8..5b4d90f 100644 --- a/src/gui/dialogs/browser/browserLoad.cpp +++ b/src/gui/dialogs/browser/browserLoad.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/gui/dialogs/browser/browserLoad.h b/src/gui/dialogs/browser/browserLoad.h index c01965b..828276d 100644 --- a/src/gui/dialogs/browser/browserLoad.h +++ b/src/gui/dialogs/browser/browserLoad.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/browser/browserSave.cpp b/src/gui/dialogs/browser/browserSave.cpp index eb9e358..56f18c0 100644 --- a/src/gui/dialogs/browser/browserSave.cpp +++ b/src/gui/dialogs/browser/browserSave.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/gui/dialogs/browser/browserSave.h b/src/gui/dialogs/browser/browserSave.h index c8d7c86..8f07133 100644 --- a/src/gui/dialogs/browser/browserSave.h +++ b/src/gui/dialogs/browser/browserSave.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/channelNameInput.cpp b/src/gui/dialogs/channelNameInput.cpp index f5f2d07..ed9ac9c 100644 --- a/src/gui/dialogs/channelNameInput.cpp +++ b/src/gui/dialogs/channelNameInput.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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"); diff --git a/src/gui/dialogs/channelNameInput.h b/src/gui/dialogs/channelNameInput.h index 6325c9e..c9286ae 100644 --- a/src/gui/dialogs/channelNameInput.h +++ b/src/gui/dialogs/channelNameInput.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual + * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories * * This file is part of Giada - Your Hardcore Loopmachine. * @@ -30,20 +30,21 @@ #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(); diff --git a/src/gui/dialogs/config.cpp b/src/gui/dialogs/config.cpp index fee616f..3ee0661 100644 --- a/src/gui/dialogs/config.cpp +++ b/src/gui/dialogs/config.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); diff --git a/src/gui/dialogs/config.h b/src/gui/dialogs/config.h index de25911..23dabf8 100644 --- a/src/gui/dialogs/config.h +++ b/src/gui/dialogs/config.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual + * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories * * This file is part of Giada - Your Hardcore Loopmachine. * @@ -30,13 +30,13 @@ #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; diff --git a/src/gui/dialogs/keyGrabber.cpp b/src/gui/dialogs/keyGrabber.cpp index 1ee505b..bfdc433 100644 --- a/src/gui/dialogs/keyGrabber.cpp +++ b/src/gui/dialogs/keyGrabber.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/keyGrabber.h b/src/gui/dialogs/keyGrabber.h index bd66e8f..789e170 100644 --- a/src/gui/dialogs/keyGrabber.h +++ b/src/gui/dialogs/keyGrabber.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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: diff --git a/src/gui/dialogs/mainWindow.cpp b/src/gui/dialogs/mainWindow.cpp index 50f566c..da46a86 100644 --- a/src/gui/dialogs/mainWindow.cpp +++ b/src/gui/dialogs/mainWindow.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 */ diff --git a/src/gui/dialogs/mainWindow.h b/src/gui/dialogs/mainWindow.h index 5c9e2fb..f0ae97d 100644 --- a/src/gui/dialogs/mainWindow.h +++ b/src/gui/dialogs/mainWindow.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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; diff --git a/src/gui/dialogs/midiIO/midiInputBase.cpp b/src/gui/dialogs/midiIO/midiInputBase.cpp index f2e4a6d..c8189c0 100644 --- a/src/gui/dialogs/midiIO/midiInputBase.cpp +++ b/src/gui/dialogs/midiIO/midiInputBase.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/midiIO/midiInputBase.h b/src/gui/dialogs/midiIO/midiInputBase.h index 8546354..6aa6cb3 100644 --- a/src/gui/dialogs/midiIO/midiInputBase.h +++ b/src/gui/dialogs/midiIO/midiInputBase.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,11 +31,11 @@ #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 { diff --git a/src/gui/dialogs/midiIO/midiInputChannel.cpp b/src/gui/dialogs/midiIO/midiInputChannel.cpp index 84621f9..214a957 100644 --- a/src/gui/dialogs/midiIO/midiInputChannel.cpp +++ b/src/gui/dialogs/midiIO/midiInputChannel.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); diff --git a/src/gui/dialogs/midiIO/midiInputChannel.h b/src/gui/dialogs/midiIO/midiInputChannel.h index 9266feb..a9e4e3f 100644 --- a/src/gui/dialogs/midiIO/midiInputChannel.h +++ b/src/gui/dialogs/midiIO/midiInputChannel.h @@ -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/dialogs/midiIO/midiInputMaster.cpp b/src/gui/dialogs/midiIO/midiInputMaster.cpp index e2bf9b0..8360e1f 100644 --- a/src/gui/dialogs/midiIO/midiInputMaster.cpp +++ b/src/gui/dialogs/midiIO/midiInputMaster.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/midiIO/midiInputMaster.h b/src/gui/dialogs/midiIO/midiInputMaster.h index a4013b0..512f8ef 100644 --- a/src/gui/dialogs/midiIO/midiInputMaster.h +++ b/src/gui/dialogs/midiIO/midiInputMaster.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/midiIO/midiOutputBase.cpp b/src/gui/dialogs/midiIO/midiOutputBase.cpp index fd75e24..7635ab9 100644 --- a/src/gui/dialogs/midiIO/midiOutputBase.cpp +++ b/src/gui/dialogs/midiIO/midiOutputBase.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/midiIO/midiOutputBase.h b/src/gui/dialogs/midiIO/midiOutputBase.h index df9de01..28b9e8f 100644 --- a/src/gui/dialogs/midiIO/midiOutputBase.h +++ b/src/gui/dialogs/midiIO/midiOutputBase.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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. */ diff --git a/src/gui/dialogs/midiIO/midiOutputMidiCh.cpp b/src/gui/dialogs/midiIO/midiOutputMidiCh.cpp index 801ea4e..997cbbe 100644 --- a/src/gui/dialogs/midiIO/midiOutputMidiCh.cpp +++ b/src/gui/dialogs/midiIO/midiOutputMidiCh.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/midiIO/midiOutputMidiCh.h b/src/gui/dialogs/midiIO/midiOutputMidiCh.h index 61bc170..53f8a95 100644 --- a/src/gui/dialogs/midiIO/midiOutputMidiCh.h +++ b/src/gui/dialogs/midiIO/midiOutputMidiCh.h @@ -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/dialogs/midiIO/midiOutputSampleCh.cpp b/src/gui/dialogs/midiIO/midiOutputSampleCh.cpp index 43ad49b..0c0fde3 100644 --- a/src/gui/dialogs/midiIO/midiOutputSampleCh.cpp +++ b/src/gui/dialogs/midiIO/midiOutputSampleCh.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/midiIO/midiOutputSampleCh.h b/src/gui/dialogs/midiIO/midiOutputSampleCh.h index 68a433a..668a178 100644 --- a/src/gui/dialogs/midiIO/midiOutputSampleCh.h +++ b/src/gui/dialogs/midiIO/midiOutputSampleCh.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 index 0000000..03b897f --- /dev/null +++ b/src/gui/dialogs/missingAssets.cpp @@ -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 index 0000000..bd1ca05 --- /dev/null +++ b/src/gui/dialogs/missingAssets.h @@ -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 diff --git a/src/gui/dialogs/pluginChooser.cpp b/src/gui/dialogs/pluginChooser.cpp index c0d94b3..b170aa7 100644 --- a/src/gui/dialogs/pluginChooser.cpp +++ b/src/gui/dialogs/pluginChooser.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); diff --git a/src/gui/dialogs/pluginChooser.h b/src/gui/dialogs/pluginChooser.h index a5ab323..e3d2f84 100644 --- a/src/gui/dialogs/pluginChooser.h +++ b/src/gui/dialogs/pluginChooser.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,11 +35,9 @@ #include <FL/Fl.H> #include <FL/Fl_Scroll.H> -class geButton; -class geButton; - namespace giada::v { +class geButton; class geChoice; class gePluginBrowser; diff --git a/src/gui/dialogs/pluginList.cpp b/src/gui/dialogs/pluginList.cpp index 12e73c4..02fee22 100644 --- a/src/gui/dialogs/pluginList.cpp +++ b/src/gui/dialogs/pluginList.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/pluginList.h b/src/gui/dialogs/pluginList.h index a1f4c10..81d043c 100644 --- a/src/gui/dialogs/pluginList.h +++ b/src/gui/dialogs/pluginList.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,10 +33,9 @@ #include "glue/plugin.h" #include "window.h" -class geButton; - namespace giada::v { +class geButton; class geLiquidScroll; class gePluginElement; class gdPluginList : public gdWindow diff --git a/src/gui/dialogs/pluginWindow.cpp b/src/gui/dialogs/pluginWindow.cpp index a7f5f07..f4e712a 100644 --- a/src/gui/dialogs/pluginWindow.cpp +++ b/src/gui/dialogs/pluginWindow.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); diff --git a/src/gui/dialogs/pluginWindow.h b/src/gui/dialogs/pluginWindow.h index 7613e4d..0b82548 100644 --- a/src/gui/dialogs/pluginWindow.h +++ b/src/gui/dialogs/pluginWindow.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/pluginWindowGUI.cpp b/src/gui/dialogs/pluginWindowGUI.cpp index 3b21d6a..f06126d 100644 --- a/src/gui/dialogs/pluginWindowGUI.cpp +++ b/src/gui/dialogs/pluginWindowGUI.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/pluginWindowGUI.h b/src/gui/dialogs/pluginWindowGUI.h index daf5127..6877c16 100644 --- a/src/gui/dialogs/pluginWindowGUI.h +++ b/src/gui/dialogs/pluginWindowGUI.h @@ -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 { diff --git a/src/gui/dialogs/progress.cpp b/src/gui/dialogs/progress.cpp index ac983f3..a42cb3d 100644 --- a/src/gui/dialogs/progress.cpp +++ b/src/gui/dialogs/progress.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/progress.h b/src/gui/dialogs/progress.h index bae1850..d9b6759 100644 --- a/src/gui/dialogs/progress.h +++ b/src/gui/dialogs/progress.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor.cpp b/src/gui/dialogs/sampleEditor.cpp index 1fcb0fc..9a80c58 100644 --- a/src/gui/dialogs/sampleEditor.cpp +++ b/src/gui/dialogs/sampleEditor.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor.h b/src/gui/dialogs/sampleEditor.h index 23f0c01..81c9074 100644 --- a/src/gui/dialogs/sampleEditor.h +++ b/src/gui/dialogs/sampleEditor.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,15 +27,13 @@ #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; diff --git a/src/gui/dialogs/warnings.cpp b/src/gui/dialogs/warnings.cpp index 96230b7..48964fe 100644 --- a/src/gui/dialogs/warnings.cpp +++ b/src/gui/dialogs/warnings.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,66 +33,60 @@ #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 diff --git a/src/gui/dialogs/warnings.h b/src/gui/dialogs/warnings.h index 1cbf284..22b4a42 100644 --- a/src/gui/dialogs/warnings.h +++ b/src/gui/dialogs/warnings.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,13 +27,10 @@ #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 diff --git a/src/gui/dialogs/window.cpp b/src/gui/dialogs/window.cpp index adec425..58754ad 100644 --- a/src/gui/dialogs/window.cpp +++ b/src/gui/dialogs/window.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,18 +29,12 @@ 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(); } /* -------------------------------------------------------------------------- */ @@ -50,6 +44,14 @@ gdWindow::gdWindow(int w, int h, const char* title, int id) , 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; diff --git a/src/gui/dialogs/window.h b/src/gui/dialogs/window.h index c2d4648..aac3f19 100644 --- a/src/gui/dialogs/window.h +++ b/src/gui/dialogs/window.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,21 +27,18 @@ #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); diff --git a/src/gui/dispatcher.cpp b/src/gui/dispatcher.cpp index d7e594e..75b48c2 100644 --- a/src/gui/dispatcher.cpp +++ b/src/gui/dispatcher.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/dispatcher.h b/src/gui/dispatcher.h index 3521dc1..e31d121 100644 --- a/src/gui/dispatcher.h +++ b/src/gui/dispatcher.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/drawing.cpp b/src/gui/drawing.cpp index b1b9cd6..3bc616b 100644 --- a/src/gui/drawing.cpp +++ b/src/gui/drawing.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/drawing.h b/src/gui/drawing.h index 4ee7955..6eb3b61 100644 --- a/src/gui/drawing.h +++ b/src/gui/drawing.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/baseAction.cpp b/src/gui/elems/actionEditor/baseAction.cpp index 04cc65a..989f8f0 100644 --- a/src/gui/elems/actionEditor/baseAction.cpp +++ b/src/gui/elems/actionEditor/baseAction.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/baseAction.h b/src/gui/elems/actionEditor/baseAction.h index 0fb7bb7..35c3738 100644 --- a/src/gui/elems/actionEditor/baseAction.h +++ b/src/gui/elems/actionEditor/baseAction.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/baseActionEditor.cpp b/src/gui/elems/actionEditor/baseActionEditor.cpp index c8ffdba..2ae40ac 100644 --- a/src/gui/elems/actionEditor/baseActionEditor.cpp +++ b/src/gui/elems/actionEditor/baseActionEditor.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); diff --git a/src/gui/elems/actionEditor/baseActionEditor.h b/src/gui/elems/actionEditor/baseActionEditor.h index f973375..dd47439 100644 --- a/src/gui/elems/actionEditor/baseActionEditor.h +++ b/src/gui/elems/actionEditor/baseActionEditor.h @@ -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. * diff --git a/src/gui/elems/actionEditor/envelopeEditor.cpp b/src/gui/elems/actionEditor/envelopeEditor.cpp index 9fa0d28..e6ad8f9 100644 --- a/src/gui/elems/actionEditor/envelopeEditor.cpp +++ b/src/gui/elems/actionEditor/envelopeEditor.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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(); } diff --git a/src/gui/elems/actionEditor/envelopeEditor.h b/src/gui/elems/actionEditor/envelopeEditor.h index 49675fa..494492d 100644 --- a/src/gui/elems/actionEditor/envelopeEditor.h +++ b/src/gui/elems/actionEditor/envelopeEditor.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/envelopePoint.cpp b/src/gui/elems/actionEditor/envelopePoint.cpp index e362b55..d39998d 100644 --- a/src/gui/elems/actionEditor/envelopePoint.cpp +++ b/src/gui/elems/actionEditor/envelopePoint.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/envelopePoint.h b/src/gui/elems/actionEditor/envelopePoint.h index a83b309..ffc51b0 100644 --- a/src/gui/elems/actionEditor/envelopePoint.h +++ b/src/gui/elems/actionEditor/envelopePoint.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/gridTool.cpp b/src/gui/elems/actionEditor/gridTool.cpp index 68f5492..ff30eb5 100644 --- a/src/gui/elems/actionEditor/gridTool.cpp +++ b/src/gui/elems/actionEditor/gridTool.cpp @@ -4,7 +4,7 @@ * * ------------------------------------------------------------------------------ * -* Copyright (C) 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,10 +33,9 @@ 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 diff --git a/src/gui/elems/actionEditor/gridTool.h b/src/gui/elems/actionEditor/gridTool.h index a8cf2d3..5481045 100644 --- a/src/gui/elems/actionEditor/gridTool.h +++ b/src/gui/elems/actionEditor/gridTool.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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; diff --git a/src/gui/elems/actionEditor/pianoItem.cpp b/src/gui/elems/actionEditor/pianoItem.cpp index 2b46bca..83233e0 100644 --- a/src/gui/elems/actionEditor/pianoItem.cpp +++ b/src/gui/elems/actionEditor/pianoItem.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/pianoItem.h b/src/gui/elems/actionEditor/pianoItem.h index ab448be..293aba5 100644 --- a/src/gui/elems/actionEditor/pianoItem.h +++ b/src/gui/elems/actionEditor/pianoItem.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/pianoRoll.cpp b/src/gui/elems/actionEditor/pianoRoll.cpp index ba89dd7..de357a1 100644 --- a/src/gui/elems/actionEditor/pianoRoll.cpp +++ b/src/gui/elems/actionEditor/pianoRoll.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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; } diff --git a/src/gui/elems/actionEditor/pianoRoll.h b/src/gui/elems/actionEditor/pianoRoll.h index db44cbf..4cb3f53 100644 --- a/src/gui/elems/actionEditor/pianoRoll.h +++ b/src/gui/elems/actionEditor/pianoRoll.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/sampleAction.cpp b/src/gui/elems/actionEditor/sampleAction.cpp index 211ad7a..0c1b2b4 100644 --- a/src/gui/elems/actionEditor/sampleAction.cpp +++ b/src/gui/elems/actionEditor/sampleAction.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/sampleAction.h b/src/gui/elems/actionEditor/sampleAction.h index b606652..13a2736 100644 --- a/src/gui/elems/actionEditor/sampleAction.h +++ b/src/gui/elems/actionEditor/sampleAction.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/sampleActionEditor.cpp b/src/gui/elems/actionEditor/sampleActionEditor.cpp index 89fddb4..16c6eab 100644 --- a/src/gui/elems/actionEditor/sampleActionEditor.cpp +++ b/src/gui/elems/actionEditor/sampleActionEditor.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); diff --git a/src/gui/elems/actionEditor/sampleActionEditor.h b/src/gui/elems/actionEditor/sampleActionEditor.h index fd8a830..23270aa 100644 --- a/src/gui/elems/actionEditor/sampleActionEditor.h +++ b/src/gui/elems/actionEditor/sampleActionEditor.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/splitScroll.cpp b/src/gui/elems/actionEditor/splitScroll.cpp index bcece2a..acd3a22 100644 --- a/src/gui/elems/actionEditor/splitScroll.cpp +++ b/src/gui/elems/actionEditor/splitScroll.cpp @@ -4,7 +4,7 @@ * * ------------------------------------------------------------------------------ * -* Copyright (C) 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/actionEditor/splitScroll.h b/src/gui/elems/actionEditor/splitScroll.h index 6bfd29c..04f5e09 100644 --- a/src/gui/elems/actionEditor/splitScroll.h +++ b/src/gui/elems/actionEditor/splitScroll.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/velocityEditor.cpp b/src/gui/elems/actionEditor/velocityEditor.cpp index dd6ddc1..60e9033 100644 --- a/src/gui/elems/actionEditor/velocityEditor.cpp +++ b/src/gui/elems/actionEditor/velocityEditor.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/actionEditor/velocityEditor.h b/src/gui/elems/actionEditor/velocityEditor.h index cb15f90..0ceb352 100644 --- a/src/gui/elems/actionEditor/velocityEditor.h +++ b/src/gui/elems/actionEditor/velocityEditor.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/box.cpp b/src/gui/elems/basics/box.cpp index c14cf95..2e92b01 100644 --- a/src/gui/elems/basics/box.cpp +++ b/src/gui/elems/basics/box.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/gui/elems/basics/box.h b/src/gui/elems/basics/box.h index 2cc1ca9..c2ec4ed 100644 --- a/src/gui/elems/basics/box.h +++ b/src/gui/elems/basics/box.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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; }; diff --git a/src/gui/elems/basics/boxtypes.cpp b/src/gui/elems/basics/boxtypes.cpp index 47e003a..5ff93d6 100644 --- a/src/gui/elems/basics/boxtypes.cpp +++ b/src/gui/elems/basics/boxtypes.cpp @@ -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/boxtypes.h b/src/gui/elems/basics/boxtypes.h index f763f66..2fca0ca 100644 --- a/src/gui/elems/basics/boxtypes.h +++ b/src/gui/elems/basics/boxtypes.h @@ -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 index 0000000..5a91908 --- /dev/null +++ b/src/gui/elems/basics/browser.cpp @@ -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 index 0000000..08bcde9 --- /dev/null +++ b/src/gui/elems/basics/browser.h @@ -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 diff --git a/src/gui/elems/basics/button.cpp b/src/gui/elems/basics/button.cpp index a375915..f635ad9 100644 --- a/src/gui/elems/basics/button.cpp +++ b/src/gui/elems/basics/button.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,9 +29,12 @@ #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) @@ -40,6 +43,23 @@ geButton::geButton(int x, int y, int w, int h, const char* l, , 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(); } /* -------------------------------------------------------------------------- */ @@ -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 diff --git a/src/gui/elems/basics/button.h b/src/gui/elems/basics/button.h index ab5dfe6..5bb7ec7 100644 --- a/src/gui/elems/basics/button.h +++ b/src/gui/elems/basics/button.h @@ -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. * @@ -31,7 +31,10 @@ #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 diff --git a/src/gui/elems/basics/check.cpp b/src/gui/elems/basics/check.cpp index 4e7c6bc..b13b5d9 100644 --- a/src/gui/elems/basics/check.cpp +++ b/src/gui/elems/basics/check.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/check.h b/src/gui/elems/basics/check.h index 0a4a54c..3178a49 100644 --- a/src/gui/elems/basics/check.h +++ b/src/gui/elems/basics/check.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/choice.cpp b/src/gui/elems/basics/choice.cpp index acb639b..f0065ba 100644 --- a/src/gui/elems/basics/choice.cpp +++ b/src/gui/elems/basics/choice.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/choice.h b/src/gui/elems/basics/choice.h index be7903c..4485e83 100644 --- a/src/gui/elems/basics/choice.h +++ b/src/gui/elems/basics/choice.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/dial.cpp b/src/gui/elems/basics/dial.cpp index 476a458..7f11152 100644 --- a/src/gui/elems/basics/dial.cpp +++ b/src/gui/elems/basics/dial.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual + * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories * * This file is part of Giada - Your Hardcore Loopmachine. * @@ -24,12 +24,15 @@ * * -------------------------------------------------------------------------- */ -#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 diff --git a/src/gui/elems/basics/dial.h b/src/gui/elems/basics/dial.h index d3a3127..f33d8db 100644 --- a/src/gui/elems/basics/dial.h +++ b/src/gui/elems/basics/dial.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,13 +28,22 @@ #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 index 0000000..4bf1421 --- /dev/null +++ b/src/gui/elems/basics/flex.cpp @@ -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 index 0000000..574409e --- /dev/null +++ b/src/gui/elems/basics/flex.h @@ -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 diff --git a/src/gui/elems/basics/group.cpp b/src/gui/elems/basics/group.cpp index 8145715..08fd58e 100644 --- a/src/gui/elems/basics/group.cpp +++ b/src/gui/elems/basics/group.cpp @@ -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/basics/group.h b/src/gui/elems/basics/group.h index 55d884c..49a3202 100644 --- a/src/gui/elems/basics/group.h +++ b/src/gui/elems/basics/group.h @@ -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/basics/input.cpp b/src/gui/elems/basics/input.cpp index adfa4e2..0fc1eae 100644 --- a/src/gui/elems/basics/input.cpp +++ b/src/gui/elems/basics/input.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/input.h b/src/gui/elems/basics/input.h index 199d4fd..59307ff 100644 --- a/src/gui/elems/basics/input.h +++ b/src/gui/elems/basics/input.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/liquidScroll.cpp b/src/gui/elems/basics/liquidScroll.cpp index a639aeb..64f0903 100644 --- a/src/gui/elems/basics/liquidScroll.cpp +++ b/src/gui/elems/basics/liquidScroll.cpp @@ -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. * diff --git a/src/gui/elems/basics/liquidScroll.h b/src/gui/elems/basics/liquidScroll.h index 04b5983..d90a28c 100644 --- a/src/gui/elems/basics/liquidScroll.h +++ b/src/gui/elems/basics/liquidScroll.h @@ -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. * diff --git a/src/gui/elems/basics/pack.cpp b/src/gui/elems/basics/pack.cpp index 0b6982d..c4d5446 100644 --- a/src/gui/elems/basics/pack.cpp +++ b/src/gui/elems/basics/pack.cpp @@ -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/basics/pack.h b/src/gui/elems/basics/pack.h index 723f99c..10c853a 100644 --- a/src/gui/elems/basics/pack.h +++ b/src/gui/elems/basics/pack.h @@ -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/basics/progress.cpp b/src/gui/elems/basics/progress.cpp index 9e17189..d1066f4 100644 --- a/src/gui/elems/basics/progress.cpp +++ b/src/gui/elems/basics/progress.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/progress.h b/src/gui/elems/basics/progress.h index 1ec3186..7ddea0d 100644 --- a/src/gui/elems/basics/progress.h +++ b/src/gui/elems/basics/progress.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/resizerBar.cpp b/src/gui/elems/basics/resizerBar.cpp index aa8bc4b..f4dacc6 100644 --- a/src/gui/elems/basics/resizerBar.cpp +++ b/src/gui/elems/basics/resizerBar.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/resizerBar.h b/src/gui/elems/basics/resizerBar.h index 27ef9de..31057fb 100644 --- a/src/gui/elems/basics/resizerBar.h +++ b/src/gui/elems/basics/resizerBar.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/scroll.cpp b/src/gui/elems/basics/scroll.cpp index c6faf35..8f4837c 100644 --- a/src/gui/elems/basics/scroll.cpp +++ b/src/gui/elems/basics/scroll.cpp @@ -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/basics/scroll.h b/src/gui/elems/basics/scroll.h index 6562ec4..d13a8e8 100644 --- a/src/gui/elems/basics/scroll.h +++ b/src/gui/elems/basics/scroll.h @@ -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/basics/scrollPack.cpp b/src/gui/elems/basics/scrollPack.cpp index 9917e2f..22a3171 100644 --- a/src/gui/elems/basics/scrollPack.cpp +++ b/src/gui/elems/basics/scrollPack.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/scrollPack.h b/src/gui/elems/basics/scrollPack.h index f855532..95d946e 100644 --- a/src/gui/elems/basics/scrollPack.h +++ b/src/gui/elems/basics/scrollPack.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/slider.cpp b/src/gui/elems/basics/slider.cpp index b41cae6..e018452 100644 --- a/src/gui/elems/basics/slider.cpp +++ b/src/gui/elems/basics/slider.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/slider.h b/src/gui/elems/basics/slider.h index 7e1d41e..5f47744 100644 --- a/src/gui/elems/basics/slider.h +++ b/src/gui/elems/basics/slider.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/split.cpp b/src/gui/elems/basics/split.cpp index 658ed7c..a296082 100644 --- a/src/gui/elems/basics/split.cpp +++ b/src/gui/elems/basics/split.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/split.h b/src/gui/elems/basics/split.h index f407466..237db18 100644 --- a/src/gui/elems/basics/split.h +++ b/src/gui/elems/basics/split.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/statusButton.cpp b/src/gui/elems/basics/statusButton.cpp index 7f554fe..ee6733e 100644 --- a/src/gui/elems/basics/statusButton.cpp +++ b/src/gui/elems/basics/statusButton.cpp @@ -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/basics/statusButton.h b/src/gui/elems/basics/statusButton.h index 3805aac..1c9a917 100644 --- a/src/gui/elems/basics/statusButton.h +++ b/src/gui/elems/basics/statusButton.h @@ -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/config/tabAudio.cpp b/src/gui/elems/config/tabAudio.cpp index 8539215..7894597 100644 --- a/src/gui/elems/config/tabAudio.cpp +++ b/src/gui/elems/config/tabAudio.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/config/tabAudio.h b/src/gui/elems/config/tabAudio.h index 91cf904..b2f77bc 100644 --- a/src/gui/elems/config/tabAudio.h +++ b/src/gui/elems/config/tabAudio.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,11 +32,11 @@ #include <FL/Fl_Group.H> class geCheck; -class geButton; class geInput; namespace giada::v { +class geButton; class geTabAudio : public Fl_Group { public: diff --git a/src/gui/elems/config/tabBehaviors.cpp b/src/gui/elems/config/tabBehaviors.cpp index 4178b57..c15c2f7 100644 --- a/src/gui/elems/config/tabBehaviors.cpp +++ b/src/gui/elems/config/tabBehaviors.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/config/tabBehaviors.h b/src/gui/elems/config/tabBehaviors.h index a481c46..f000fb3 100644 --- a/src/gui/elems/config/tabBehaviors.h +++ b/src/gui/elems/config/tabBehaviors.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/config/tabMidi.cpp b/src/gui/elems/config/tabMidi.cpp index df36959..3ca5f11 100644 --- a/src/gui/elems/config/tabMidi.cpp +++ b/src/gui/elems/config/tabMidi.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/config/tabMidi.h b/src/gui/elems/config/tabMidi.h index b2374a3..0fce166 100644 --- a/src/gui/elems/config/tabMidi.h +++ b/src/gui/elems/config/tabMidi.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/config/tabMisc.cpp b/src/gui/elems/config/tabMisc.cpp index bcd66ad..81f8bad 100644 --- a/src/gui/elems/config/tabMisc.cpp +++ b/src/gui/elems/config/tabMisc.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/config/tabMisc.h b/src/gui/elems/config/tabMisc.h index f854eee..727e4b5 100644 --- a/src/gui/elems/config/tabMisc.h +++ b/src/gui/elems/config/tabMisc.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/config/tabPlugins.cpp b/src/gui/elems/config/tabPlugins.cpp index 49eb2ae..3c4a3f1 100644 --- a/src/gui/elems/config/tabPlugins.cpp +++ b/src/gui/elems/config/tabPlugins.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/config/tabPlugins.h b/src/gui/elems/config/tabPlugins.h index aeac23a..91ad111 100644 --- a/src/gui/elems/config/tabPlugins.h +++ b/src/gui/elems/config/tabPlugins.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/fileBrowser.cpp index 30a878b..db021e2 100644 --- a/src/gui/elems/browser.cpp +++ b/src/gui/elems/fileBrowser.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual + * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories * * This file is part of Giada - Your Hardcore Loopmachine. * @@ -24,7 +24,7 @@ * * -------------------------------------------------------------------------- */ -#include "browser.h" +#include "fileBrowser.h" #include "basics/boxtypes.h" #include "core/const.h" #include "gui/dialogs/browser/browserBase.h" @@ -35,7 +35,7 @@ namespace giada { namespace v { -geBrowser::geBrowser(int x, int y, int w, int h) +geFileBrowser::geFileBrowser(int x, int y, int w, int h) : Fl_File_Browser(x, y, w, h) , m_showHiddenFiles(false) { @@ -61,7 +61,7 @@ geBrowser::geBrowser(int x, int y, int w, int h) /* -------------------------------------------------------------------------- */ -void geBrowser::toggleHiddenFiles() +void geFileBrowser::toggleHiddenFiles() { m_showHiddenFiles = !m_showHiddenFiles; loadDir(m_currentDir); @@ -69,7 +69,7 @@ void geBrowser::toggleHiddenFiles() /* -------------------------------------------------------------------------- */ -void geBrowser::loadDir(const std::string& dir) +void geFileBrowser::loadDir(const std::string& dir) { m_currentDir = dir; load(m_currentDir.c_str()); @@ -88,7 +88,7 @@ void geBrowser::loadDir(const std::string& dir) /* -------------------------------------------------------------------------- */ -int geBrowser::handle(int e) +int geFileBrowser::handle(int e) { int ret = Fl_File_Browser::handle(e); switch (e) @@ -131,14 +131,14 @@ int geBrowser::handle(int e) /* -------------------------------------------------------------------------- */ -std::string geBrowser::getCurrentDir() +std::string geFileBrowser::getCurrentDir() { return normalize(u::fs::getRealPath(m_currentDir)); } /* -------------------------------------------------------------------------- */ -std::string geBrowser::getSelectedItem(bool fullPath) +std::string geFileBrowser::getSelectedItem(bool fullPath) { if (!fullPath) // no full path requested? return the selected text return normalize(text(value())); @@ -157,7 +157,7 @@ std::string geBrowser::getSelectedItem(bool fullPath) /* -------------------------------------------------------------------------- */ -void geBrowser::preselect(int pos, int line) +void geFileBrowser::preselect(int pos, int line) { position(pos); select(line); @@ -165,7 +165,7 @@ void geBrowser::preselect(int pos, int line) /* -------------------------------------------------------------------------- */ -std::string geBrowser::normalize(const std::string& s) +std::string geFileBrowser::normalize(const std::string& s) { std::string out = s; diff --git a/src/gui/elems/browser.h b/src/gui/elems/fileBrowser.h index 7fcfe8f..624a86a 100644 --- a/src/gui/elems/browser.h +++ b/src/gui/elems/fileBrowser.h @@ -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. * @@ -26,8 +26,8 @@ * * -------------------------------------------------------------------------- */ -#ifndef GE_BROWSER_H -#define GE_BROWSER_H +#ifndef GE_FILE_BROWSER_H +#define GE_FILE_BROWSER_H #include <FL/Fl_File_Browser.H> #include <string> @@ -36,10 +36,10 @@ namespace giada { namespace v { -class geBrowser : public Fl_File_Browser +class geFileBrowser : public Fl_File_Browser { public: - geBrowser(int x, int y, int w, int h); + geFileBrowser(int x, int y, int w, int h); void toggleHiddenFiles(); diff --git a/src/gui/elems/mainWindow/keyboard/channel.cpp b/src/gui/elems/mainWindow/keyboard/channel.cpp index 48eb094..0b62a1d 100644 --- a/src/gui/elems/mainWindow/keyboard/channel.cpp +++ b/src/gui/elems/mainWindow/keyboard/channel.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 */ diff --git a/src/gui/elems/mainWindow/keyboard/channel.h b/src/gui/elems/mainWindow/keyboard/channel.h index e3d5302..c457b46 100644 --- a/src/gui/elems/mainWindow/keyboard/channel.h +++ b/src/gui/elems/mainWindow/keyboard/channel.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,14 +31,14 @@ #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); diff --git a/src/gui/elems/mainWindow/keyboard/channelButton.cpp b/src/gui/elems/mainWindow/keyboard/channelButton.cpp index e868d63..cb965d7 100644 --- a/src/gui/elems/mainWindow/keyboard/channelButton.cpp +++ b/src/gui/elems/mainWindow/keyboard/channelButton.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/mainWindow/keyboard/channelButton.h b/src/gui/elems/mainWindow/keyboard/channelButton.h index bfc8c38..400ed3c 100644 --- a/src/gui/elems/mainWindow/keyboard/channelButton.h +++ b/src/gui/elems/mainWindow/keyboard/channelButton.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/mainWindow/keyboard/channelMode.cpp b/src/gui/elems/mainWindow/keyboard/channelMode.cpp index 66e837a..a701ee1 100644 --- a/src/gui/elems/mainWindow/keyboard/channelMode.cpp +++ b/src/gui/elems/mainWindow/keyboard/channelMode.cpp @@ -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/mainWindow/keyboard/channelMode.h b/src/gui/elems/mainWindow/keyboard/channelMode.h index c31d923..003d98f 100644 --- a/src/gui/elems/mainWindow/keyboard/channelMode.h +++ b/src/gui/elems/mainWindow/keyboard/channelMode.h @@ -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/mainWindow/keyboard/channelStatus.cpp b/src/gui/elems/mainWindow/keyboard/channelStatus.cpp index cac9515..53cb7db 100644 --- a/src/gui/elems/mainWindow/keyboard/channelStatus.cpp +++ b/src/gui/elems/mainWindow/keyboard/channelStatus.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/mainWindow/keyboard/channelStatus.h b/src/gui/elems/mainWindow/keyboard/channelStatus.h index 4db44b2..595557b 100644 --- a/src/gui/elems/mainWindow/keyboard/channelStatus.h +++ b/src/gui/elems/mainWindow/keyboard/channelStatus.h @@ -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/mainWindow/keyboard/column.cpp b/src/gui/elems/mainWindow/keyboard/column.cpp index 72982b5..237ac61 100644 --- a/src/gui/elems/mainWindow/keyboard/column.cpp +++ b/src/gui/elems/mainWindow/keyboard/column.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/mainWindow/keyboard/column.h b/src/gui/elems/mainWindow/keyboard/column.h index 2ab96d5..808650c 100644 --- a/src/gui/elems/mainWindow/keyboard/column.h +++ b/src/gui/elems/mainWindow/keyboard/column.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,10 +33,9 @@ #include <functional> #include <vector> -class geButton; - namespace giada::v { +class geButton; class geResizerBar; class geKeyboard; class geChannel; diff --git a/src/gui/elems/mainWindow/keyboard/keyboard.cpp b/src/gui/elems/mainWindow/keyboard/keyboard.cpp index 7b304ec..4c72ca3 100644 --- a/src/gui/elems/mainWindow/keyboard/keyboard.cpp +++ b/src/gui/elems/mainWindow/keyboard/keyboard.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 2010-2021 Giovanni A. Zuliani | Monocasual + * Copyright (C) 2010-2022 Giovanni A. Zuliani | Monocasual Laboratories * * This file is part of Giada - Your Hardcore Loopmachine. * @@ -24,17 +24,19 @@ * * -------------------------------------------------------------------------- */ -#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 diff --git a/src/gui/elems/mainWindow/keyboard/keyboard.h b/src/gui/elems/mainWindow/keyboard/keyboard.h index 70d131e..c5593f8 100644 --- a/src/gui/elems/mainWindow/keyboard/keyboard.h +++ b/src/gui/elems/mainWindow/keyboard/keyboard.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,10 +33,9 @@ #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 index 0000000..4ced13c --- /dev/null +++ b/src/gui/elems/mainWindow/keyboard/midiActivity.cpp @@ -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 index 0000000..f402a2e --- /dev/null +++ b/src/gui/elems/mainWindow/keyboard/midiActivity.h @@ -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 diff --git a/src/gui/elems/mainWindow/keyboard/midiChannel.cpp b/src/gui/elems/mainWindow/keyboard/midiChannel.cpp index 2a9368f..0859e0f 100644 --- a/src/gui/elems/mainWindow/keyboard/midiChannel.cpp +++ b/src/gui/elems/mainWindow/keyboard/midiChannel.cpp @@ -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(); diff --git a/src/gui/elems/mainWindow/keyboard/midiChannel.h b/src/gui/elems/mainWindow/keyboard/midiChannel.h index 33326d2..9fc4db3 100644 --- a/src/gui/elems/mainWindow/keyboard/midiChannel.h +++ b/src/gui/elems/mainWindow/keyboard/midiChannel.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/mainWindow/keyboard/midiChannelButton.cpp b/src/gui/elems/mainWindow/keyboard/midiChannelButton.cpp index 789751c..4c5cca9 100644 --- a/src/gui/elems/mainWindow/keyboard/midiChannelButton.cpp +++ b/src/gui/elems/mainWindow/keyboard/midiChannelButton.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/mainWindow/keyboard/midiChannelButton.h b/src/gui/elems/mainWindow/keyboard/midiChannelButton.h index ba145c2..3337b5a 100644 --- a/src/gui/elems/mainWindow/keyboard/midiChannelButton.h +++ b/src/gui/elems/mainWindow/keyboard/midiChannelButton.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/mainWindow/keyboard/sampleChannel.cpp b/src/gui/elems/mainWindow/keyboard/sampleChannel.cpp index db9fcd1..d868e61 100644 --- a/src/gui/elems/mainWindow/keyboard/sampleChannel.cpp +++ b/src/gui/elems/mainWindow/keyboard/sampleChannel.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); diff --git a/src/gui/elems/mainWindow/keyboard/sampleChannel.h b/src/gui/elems/mainWindow/keyboard/sampleChannel.h index 32cfc99..f1f6d36 100644 --- a/src/gui/elems/mainWindow/keyboard/sampleChannel.h +++ b/src/gui/elems/mainWindow/keyboard/sampleChannel.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/mainWindow/keyboard/sampleChannelButton.cpp b/src/gui/elems/mainWindow/keyboard/sampleChannelButton.cpp index 73f5fea..e319ac3 100644 --- a/src/gui/elems/mainWindow/keyboard/sampleChannelButton.cpp +++ b/src/gui/elems/mainWindow/keyboard/sampleChannelButton.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/mainWindow/keyboard/sampleChannelButton.h b/src/gui/elems/mainWindow/keyboard/sampleChannelButton.h index 7f77d0a..b09737a 100644 --- a/src/gui/elems/mainWindow/keyboard/sampleChannelButton.h +++ b/src/gui/elems/mainWindow/keyboard/sampleChannelButton.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/mainWindow/mainIO.cpp b/src/gui/elems/mainWindow/mainIO.cpp index cc4a408..8b3fca8 100644 --- a/src/gui/elems/mainWindow/mainIO.cpp +++ b/src/gui/elems/mainWindow/mainIO.cpp @@ -4,7 +4,7 @@ * * ------------------------------------------------------------------------------ * -* Copyright (C) 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,118 +31,76 @@ #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 diff --git a/src/gui/elems/mainWindow/mainIO.h b/src/gui/elems/mainWindow/mainIO.h index 3abc4fb..9b83ccc 100644 --- a/src/gui/elems/mainWindow/mainIO.h +++ b/src/gui/elems/mainWindow/mainIO.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,21 +27,19 @@ #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 diff --git a/src/gui/elems/mainWindow/mainMenu.cpp b/src/gui/elems/mainWindow/mainMenu.cpp index 3d57bd0..0823313 100644 --- a/src/gui/elems/mainWindow/mainMenu.cpp +++ b/src/gui/elems/mainWindow/mainMenu.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,43 +38,29 @@ 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..."), diff --git a/src/gui/elems/mainWindow/mainMenu.h b/src/gui/elems/mainWindow/mainMenu.h index 3f14b29..4ca3823 100644 --- a/src/gui/elems/mainWindow/mainMenu.h +++ b/src/gui/elems/mainWindow/mainMenu.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/gui/elems/mainWindow/mainTimer.cpp b/src/gui/elems/mainWindow/mainTimer.cpp index 59552ba..3293285 100644 --- a/src/gui/elems/mainWindow/mainTimer.cpp +++ b/src/gui/elems/mainWindow/mainTimer.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/gui/elems/mainWindow/mainTimer.h b/src/gui/elems/mainWindow/mainTimer.h index f92feb3..c1ee8d5 100644 --- a/src/gui/elems/mainWindow/mainTimer.h +++ b/src/gui/elems/mainWindow/mainTimer.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,14 +28,11 @@ #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 diff --git a/src/gui/elems/mainWindow/mainTransport.cpp b/src/gui/elems/mainWindow/mainTransport.cpp index fef9729..c0d680a 100644 --- a/src/gui/elems/mainWindow/mainTransport.cpp +++ b/src/gui/elems/mainWindow/mainTransport.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/mainWindow/mainTransport.h b/src/gui/elems/mainWindow/mainTransport.h index 730f450..f9e97a4 100644 --- a/src/gui/elems/mainWindow/mainTransport.h +++ b/src/gui/elems/mainWindow/mainTransport.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/mainWindow/sequencer.cpp b/src/gui/elems/mainWindow/sequencer.cpp index 3c25100..f0e38a5 100644 --- a/src/gui/elems/mainWindow/sequencer.cpp +++ b/src/gui/elems/mainWindow/sequencer.cpp @@ -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. */ diff --git a/src/gui/elems/mainWindow/sequencer.h b/src/gui/elems/mainWindow/sequencer.h index a91d4bb..1d6dab2 100644 --- a/src/gui/elems/mainWindow/sequencer.h +++ b/src/gui/elems/mainWindow/sequencer.h @@ -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/midiIO/midiLearner.cpp b/src/gui/elems/midiIO/midiLearner.cpp index 6093aa5..988da84 100644 --- a/src/gui/elems/midiIO/midiLearner.cpp +++ b/src/gui/elems/midiIO/midiLearner.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/midiIO/midiLearner.h b/src/gui/elems/midiIO/midiLearner.h index 4e919c1..7e97b66 100644 --- a/src/gui/elems/midiIO/midiLearner.h +++ b/src/gui/elems/midiIO/midiLearner.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,12 +34,12 @@ #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); diff --git a/src/gui/elems/midiIO/midiLearnerPack.cpp b/src/gui/elems/midiIO/midiLearnerPack.cpp index a62a60f..65558a8 100644 --- a/src/gui/elems/midiIO/midiLearnerPack.cpp +++ b/src/gui/elems/midiIO/midiLearnerPack.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/midiIO/midiLearnerPack.h b/src/gui/elems/midiIO/midiLearnerPack.h index 0785980..1622150 100644 --- a/src/gui/elems/midiIO/midiLearnerPack.h +++ b/src/gui/elems/midiIO/midiLearnerPack.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/plugin/pluginBrowser.cpp b/src/gui/elems/plugin/pluginBrowser.cpp index 06bb2c0..2a4d3dd 100644 --- a/src/gui/elems/plugin/pluginBrowser.cpp +++ b/src/gui/elems/plugin/pluginBrowser.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/plugin/pluginBrowser.h b/src/gui/elems/plugin/pluginBrowser.h index e039728..0b37df0 100644 --- a/src/gui/elems/plugin/pluginBrowser.h +++ b/src/gui/elems/plugin/pluginBrowser.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/plugin/pluginElement.cpp b/src/gui/elems/plugin/pluginElement.cpp index dd05266..a521fa8 100644 --- a/src/gui/elems/plugin/pluginElement.cpp +++ b/src/gui/elems/plugin/pluginElement.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/plugin/pluginElement.h b/src/gui/elems/plugin/pluginElement.h index b43cbe9..cf667d6 100644 --- a/src/gui/elems/plugin/pluginElement.h +++ b/src/gui/elems/plugin/pluginElement.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/plugin/pluginParameter.cpp b/src/gui/elems/plugin/pluginParameter.cpp index 684e273..4d2c97a 100644 --- a/src/gui/elems/plugin/pluginParameter.cpp +++ b/src/gui/elems/plugin/pluginParameter.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); } /* -------------------------------------------------------------------------- */ diff --git a/src/gui/elems/plugin/pluginParameter.h b/src/gui/elems/plugin/pluginParameter.h index 4e5fe7d..92e1d33 100644 --- a/src/gui/elems/plugin/pluginParameter.h +++ b/src/gui/elems/plugin/pluginParameter.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor/boostTool.cpp b/src/gui/elems/sampleEditor/boostTool.cpp index 90f628a..bcfe7a8 100644 --- a/src/gui/elems/sampleEditor/boostTool.cpp +++ b/src/gui/elems/sampleEditor/boostTool.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor/boostTool.h b/src/gui/elems/sampleEditor/boostTool.h index 93f1edf..b0ad40b 100644 --- a/src/gui/elems/sampleEditor/boostTool.h +++ b/src/gui/elems/sampleEditor/boostTool.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,15 +29,15 @@ #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); diff --git a/src/gui/elems/sampleEditor/panTool.cpp b/src/gui/elems/sampleEditor/panTool.cpp index 3baf277..bcf685b 100644 --- a/src/gui/elems/sampleEditor/panTool.cpp +++ b/src/gui/elems/sampleEditor/panTool.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor/panTool.h b/src/gui/elems/sampleEditor/panTool.h index 2c23ff3..5d97aa0 100644 --- a/src/gui/elems/sampleEditor/panTool.h +++ b/src/gui/elems/sampleEditor/panTool.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor/pitchTool.cpp b/src/gui/elems/sampleEditor/pitchTool.cpp index bfeb6d2..69cad2b 100644 --- a/src/gui/elems/sampleEditor/pitchTool.cpp +++ b/src/gui/elems/sampleEditor/pitchTool.cpp @@ -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. * diff --git a/src/gui/elems/sampleEditor/pitchTool.h b/src/gui/elems/sampleEditor/pitchTool.h index e410fd8..f206627 100644 --- a/src/gui/elems/sampleEditor/pitchTool.h +++ b/src/gui/elems/sampleEditor/pitchTool.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor/rangeTool.cpp b/src/gui/elems/sampleEditor/rangeTool.cpp index 20e8a6b..8f8e85d 100644 --- a/src/gui/elems/sampleEditor/rangeTool.cpp +++ b/src/gui/elems/sampleEditor/rangeTool.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor/rangeTool.h b/src/gui/elems/sampleEditor/rangeTool.h index 71500bf..ed37e5e 100644 --- a/src/gui/elems/sampleEditor/rangeTool.h +++ b/src/gui/elems/sampleEditor/rangeTool.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor/shiftTool.cpp b/src/gui/elems/sampleEditor/shiftTool.cpp index 9565682..f5c56c3 100644 --- a/src/gui/elems/sampleEditor/shiftTool.cpp +++ b/src/gui/elems/sampleEditor/shiftTool.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor/shiftTool.h b/src/gui/elems/sampleEditor/shiftTool.h index 7fd1b7a..09ec99e 100644 --- a/src/gui/elems/sampleEditor/shiftTool.h +++ b/src/gui/elems/sampleEditor/shiftTool.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor/volumeTool.cpp b/src/gui/elems/sampleEditor/volumeTool.cpp index 4d27e8c..5fd7d25 100644 --- a/src/gui/elems/sampleEditor/volumeTool.cpp +++ b/src/gui/elems/sampleEditor/volumeTool.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor/volumeTool.h b/src/gui/elems/sampleEditor/volumeTool.h index 20e179f..2b75340 100644 --- a/src/gui/elems/sampleEditor/volumeTool.h +++ b/src/gui/elems/sampleEditor/volumeTool.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor/waveTools.cpp b/src/gui/elems/sampleEditor/waveTools.cpp index 607eb51..e271d3c 100644 --- a/src/gui/elems/sampleEditor/waveTools.cpp +++ b/src/gui/elems/sampleEditor/waveTools.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor/waveTools.h b/src/gui/elems/sampleEditor/waveTools.h index f17a8a7..76481da 100644 --- a/src/gui/elems/sampleEditor/waveTools.h +++ b/src/gui/elems/sampleEditor/waveTools.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor/waveform.cpp b/src/gui/elems/sampleEditor/waveform.cpp index 98b0e2a..761434e 100644 --- a/src/gui/elems/sampleEditor/waveform.cpp +++ b/src/gui/elems/sampleEditor/waveform.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/sampleEditor/waveform.h b/src/gui/elems/sampleEditor/waveform.h index 392f809..0d68338 100644 --- a/src/gui/elems/sampleEditor/waveform.h +++ b/src/gui/elems/sampleEditor/waveform.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/soundMeter.cpp b/src/gui/elems/soundMeter.cpp index a1cc905..816ce9f 100644 --- a/src/gui/elems/soundMeter.cpp +++ b/src/gui/elems/soundMeter.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/soundMeter.h b/src/gui/elems/soundMeter.h index 2949835..0925e3f 100644 --- a/src/gui/elems/soundMeter.h +++ b/src/gui/elems/soundMeter.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/types.h b/src/gui/types.h index 4662088..97dee84 100644 --- a/src/gui/types.h +++ b/src/gui/types.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/ui.cpp b/src/gui/ui.cpp index fda0bc1..acdc051 100644 --- a/src/gui/ui.cpp +++ b/src/gui/ui.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/gui/ui.h b/src/gui/ui.h index 724347e..ca25a1e 100644 --- a/src/gui/ui.h +++ b/src/gui/ui.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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 diff --git a/src/gui/updater.cpp b/src/gui/updater.cpp index dbb95b8..cbb2f5a 100644 --- a/src/gui/updater.cpp +++ b/src/gui/updater.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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); diff --git a/src/gui/updater.h b/src/gui/updater.h index e53de90..5b592d8 100644 --- a/src/gui/updater.h +++ b/src/gui/updater.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/main.cpp b/src/main.cpp index 8584d81..ff7829c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/utils/cocoa.h b/src/utils/cocoa.h index 155eb6b..42a5ac7 100644 --- a/src/utils/cocoa.h +++ b/src/utils/cocoa.h @@ -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/utils/fs.cpp b/src/utils/fs.cpp index beb22ab..ecec279 100644 --- a/src/utils/fs.cpp +++ b/src/utils/fs.cpp @@ -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/utils/fs.h b/src/utils/fs.h index 9161ad4..b1f608e 100644 --- a/src/utils/fs.h +++ b/src/utils/fs.h @@ -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/utils/gui.cpp b/src/utils/gui.cpp index 7446db0..406279e 100644 --- a/src/utils/gui.cpp +++ b/src/utils/gui.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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,6 +55,22 @@ 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, "/", "-"); diff --git a/src/utils/gui.h b/src/utils/gui.h index 537e723..86d4dc4 100644 --- a/src/utils/gui.h +++ b/src/utils/gui.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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. */ diff --git a/src/utils/log.cpp b/src/utils/log.cpp index 1c90f51..42a1d0f 100644 --- a/src/utils/log.cpp +++ b/src/utils/log.cpp @@ -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/utils/log.h b/src/utils/log.h index 0b9cfc7..2413724 100644 --- a/src/utils/log.h +++ b/src/utils/log.h @@ -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/utils/math.cpp b/src/utils/math.cpp index ef7e184..9f38a2f 100644 --- a/src/utils/math.cpp +++ b/src/utils/math.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/utils/math.h b/src/utils/math.h index a7c1b96..7c31338 100644 --- a/src/utils/math.h +++ b/src/utils/math.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/utils/string.cpp b/src/utils/string.cpp index 4c7abb5..e5d5ac4 100644 --- a/src/utils/string.cpp +++ b/src/utils/string.cpp @@ -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 { diff --git a/src/utils/string.h b/src/utils/string.h index 7105c5c..a4d5a8d 100644 --- a/src/utils/string.h +++ b/src/utils/string.h @@ -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/utils/time.cpp b/src/utils/time.cpp index bd9ebf4..b95c467 100644 --- a/src/utils/time.cpp +++ b/src/utils/time.cpp @@ -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/utils/time.h b/src/utils/time.h index 2562514..f79c345 100644 --- a/src/utils/time.h +++ b/src/utils/time.h @@ -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/utils/vector.h b/src/utils/vector.h index 025a844..e3353e7 100644 --- a/src/utils/vector.h +++ b/src/utils/vector.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/utils/ver.cpp b/src/utils/ver.cpp index 449b763..a4c0470 100644 --- a/src/utils/ver.cpp +++ b/src/utils/ver.cpp @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/utils/ver.h b/src/utils/ver.h index 6b8b0a8..7f96f85 100644 --- a/src/utils/ver.h +++ b/src/utils/ver.h @@ -4,7 +4,7 @@ * * ----------------------------------------------------------------------------- * - * Copyright (C) 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/tests/midiLighter.cpp b/tests/midiLighter.cpp index d951a8a..fc729be 100644 --- a/tests/midiLighter.cpp +++ b/tests/midiLighter.cpp @@ -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}; |