diff --git a/src/core/actions/actionRecorder.cpp b/src/core/actions/actionRecorder.cpp index 8aa6159e9..89a226d05 100644 --- a/src/core/actions/actionRecorder.cpp +++ b/src/core/actions/actionRecorder.cpp @@ -84,10 +84,11 @@ void ActionRecorder::updateBpm(float ratio, int quantizerStep) if (ratio == 1.0f) return; - m_model.get().actions.updateKeyFrames([=](Frame old) { - /* The division here cannot be precise. A new frame can be 44099 and the - quantizer set to 44100. That would mean two recs completely useless. So we - compute a reject value ('delta'): if it's lower than 6 frames the new frame + m_model.get().actions.updateKeyFrames([=](Frame old) + { + /* The division here cannot be precise. A new frame can be 44099 and the + quantizer set to 44100. That would mean two recs completely useless. So we + compute a reject value ('delta'): if it's lower than 6 frames the new frame is collapsed with a quantized frame. FIXME - maybe 6 frames are too low. */ Frame frame = static_cast(old * ratio); if (frame != 0) @@ -111,7 +112,8 @@ void ActionRecorder::updateSamplerate(int systemRate, int patchRate) float ratio = systemRate / (float)patchRate; - m_model.get().actions.updateKeyFrames([=](Frame old) { return floorf(old * ratio); }); + m_model.get().actions.updateKeyFrames([=](Frame old) + { return floorf(old * ratio); }); m_model.swap(model::SwapType::NONE); } @@ -123,7 +125,8 @@ bool ActionRecorder::cloneActions(ID channelId, ID newChannelId) std::vector actions; std::unordered_map map; // Action ID mapper, old -> new - m_model.get().actions.forEachAction([&](const Action& a) { + m_model.get().actions.forEachAction([&](const Action& a) + { if (a.channelId != channelId) return; @@ -374,7 +377,7 @@ std::unordered_set ActionRecorder::consolidate() void ActionRecorder::clearAllActions() { m_model.get().tracks.forEachChannel([](Channel& ch) - { ch.hasActions = false; return true; }); + { ch.hasActions = false; return true; }); m_model.get().actions.clearAll(); m_model.swap(model::SwapType::HARD); } @@ -413,9 +416,9 @@ bool ActionRecorder::isSinglePressMode(ID channelId) const void ActionRecorder::consolidate(const Action& a1, std::size_t i) { - /* This algorithm must start searching from the element next to 'a1': since - live actions are recorded in linear sequence, the potential partner of 'a1' - always lies beyond a1 itself. Without this trick (i.e. if it loops from + /* This algorithm must start searching from the element next to 'a1': since + live actions are recorded in linear sequence, the potential partner of 'a1' + always lies beyond a1 itself. Without this trick (i.e. if it loops from vector.begin() each time) the algorithm would end up matching wrong partners. */ for (auto it = m_liveActions.begin() + i; it != m_liveActions.end(); ++it) diff --git a/src/core/actions/actionRecorder.h b/src/core/actions/actionRecorder.h index 83f7cce36..e42ca42ac 100644 --- a/src/core/actions/actionRecorder.h +++ b/src/core/actions/actionRecorder.h @@ -52,25 +52,25 @@ class ActionRecorder void reset(); /* updateBpm - Changes actions position by calculating the new bpm value. */ + Changes actions position by calculating the new bpm value. */ void updateBpm(float ratio, int quantizerStep); /* updateSamplerate - Changes actions position by taking in account the new samplerate. If - f_system == f_patch nothing will change, otherwise the conversion is - mandatory. */ + Changes actions position by taking in account the new samplerate. If + f_system == f_patch nothing will change, otherwise the conversion is + mandatory. */ void updateSamplerate(int systemRate, int patchRate); /* cloneActions - Clones actions in channel 'channelId', giving them a new channel ID. Returns - whether any action has been cloned. */ + Clones actions in channel 'channelId', giving them a new channel ID. Returns + whether any action has been cloned. */ bool cloneActions(ID channelId, ID newChannelId); /* liveRec - Records a user-generated action. NOTE_ON or NOTE_OFF only for now. */ + Records a user-generated action. NOTE_ON or NOTE_OFF only for now. */ void liveRec(ID channelId, MidiEvent e, Frame global); @@ -100,13 +100,13 @@ class ActionRecorder void updateVelocity(const Action&, float value); /* consolidate - Records all live actions. Returns a set of channels IDs that have been - recorded. */ + Records all live actions. Returns a set of channels IDs that have been + recorded. */ std::unordered_set consolidate(); /* clearAllActions - Deletes all recorded actions. */ + Deletes all recorded actions. */ void clearAllActions(); @@ -126,7 +126,7 @@ class ActionRecorder private: /* areComposite - Composite: NOTE_ON + NOTE_OFF on the same note. */ + Composite: NOTE_ON + NOTE_OFF on the same note. */ bool areComposite(const Action& a1, const Action& a2) const; @@ -145,8 +145,8 @@ class ActionRecorder void recordNonFirstEnvelopeAction(ID channelId, Frame frame, int value); #endif /* consolidate - Given an action 'a1' tries to find the matching NOTE_OFF and updates the - action accordingly. */ + Given an action 'a1' tries to find the matching NOTE_OFF and updates the + action accordingly. */ void consolidate(const Action& a1, std::size_t i); diff --git a/src/core/api/storageApi.h b/src/core/api/storageApi.h index b6a3926bd..61e1deecf 100644 --- a/src/core/api/storageApi.h +++ b/src/core/api/storageApi.h @@ -57,7 +57,7 @@ class StorageApi std::function progress) const; /* loadProject - Loads a new project. Returns a model::LoadState object containing the + Loads a new project. Returns a model::LoadState object containing the operation state. */ model::LoadState loadProject(const std::string& projectPath, std::function progress); diff --git a/src/core/channels/channel.h b/src/core/channels/channel.h index 2314c4136..46b39346c 100644 --- a/src/core/channels/channel.h +++ b/src/core/channels/channel.h @@ -65,7 +65,7 @@ class Channel final bool canSendMidi() const; /* isAudible - True if this channel is currently audible: not muted or not included in a + True if this channel is currently audible: not muted or not included in a solo session. */ bool isAudible(bool mixerHasSolos) const; diff --git a/src/core/channels/channelFactory.h b/src/core/channels/channelFactory.h index bc84b9ab2..c2aadf85c 100644 --- a/src/core/channels/channelFactory.h +++ b/src/core/channels/channelFactory.h @@ -47,7 +47,7 @@ struct Data }; /* getNextId - Returns the next channel ID that will be assigned to a new channel. */ + Returns the next channel ID that will be assigned to a new channel. */ ID getNextId(); @@ -57,7 +57,7 @@ ID getNextId(); void reset(); /* create (1) - Creates a new channel. If channelId == 0 generates a new ID, reuse the one + Creates a new channel. If channelId == 0 generates a new ID, reuse the one passed in otherwise. */ Data create(ID channelId, ChannelType type, int bufferSize, Resampler::Quality, bool overdubProtection); diff --git a/src/core/channels/channelManager.cpp b/src/core/channels/channelManager.cpp index 537dec87b..a9b1e3aa0 100644 --- a/src/core/channels/channelManager.cpp +++ b/src/core/channels/channelManager.cpp @@ -187,7 +187,7 @@ void ChannelManager::loadSampleChannel(ID channelId, Wave& wave) loadSampleChannel(channel, &newWave); m_model.swap(model::SwapType::HARD); - /* Remove the old Wave, if any. It is safe to do it now: the audio thread is + /* Remove the old Wave, if any. It is safe to do it now: the audio thread is already processing the new Document. */ if (oldWave != nullptr) @@ -563,16 +563,19 @@ void ChannelManager::setupChannelCallbacks(const Channel& ch, ChannelShared& sha { assert(onChannelPlayStatusChanged != nullptr); - shared.playStatus.onChange = [this, id = ch.id](ChannelStatus status) { + shared.playStatus.onChange = [this, id = ch.id](ChannelStatus status) + { onChannelPlayStatusChanged(id, status); }; if (ch.type == ChannelType ::SAMPLE) { - shared.quantizer->schedule(Q_ACTION_PLAY + ch.id, [&shared](Frame delta) { + shared.quantizer->schedule(Q_ACTION_PLAY + ch.id, [&shared](Frame delta) + { rendering::playSampleChannel(shared, delta); }); - shared.quantizer->schedule(Q_ACTION_REWIND + ch.id, [&shared](Frame delta) { + shared.quantizer->schedule(Q_ACTION_REWIND + ch.id, [&shared](Frame delta) + { const ChannelStatus status = shared.playStatus.load(); if (status == ChannelStatus::OFF) rendering::playSampleChannel(shared, delta); diff --git a/src/core/channels/channelManager.h b/src/core/channels/channelManager.h index f0666b0f4..8904e7f9f 100644 --- a/src/core/channels/channelManager.h +++ b/src/core/channels/channelManager.h @@ -68,17 +68,17 @@ class ChannelManager final Channel& getChannel(ID); /* hasInputRecordableChannels - Tells whether Mixer has one or more input-recordable channels. */ + Tells whether Mixer has one or more input-recordable channels. */ bool hasInputRecordableChannels() const; /* hasActions - True if at least one Channel has actions recorded in it. */ + True if at least one Channel has actions recorded in it. */ bool hasActions() const; /* hasAudioData - True if at least one Sample Channel has some audio recorded in it. */ + True if at least one Sample Channel has some audio recorded in it. */ bool hasAudioData() const; @@ -97,7 +97,7 @@ class ChannelManager final /* reset Brings channels configuration back to the initial state: two I/O master - channels, one preview channel. */ + channels, one preview channel. */ void reset(Frame framesInBuffer); @@ -121,22 +121,22 @@ class ChannelManager final void setTrackWidth(std::size_t trackIndex, int width); /* addChannel - Adds a new channel to the stack. */ + Adds a new channel to the stack. */ Channel& addChannel(ChannelType, std::size_t trackIndex, int bufferSize); /* loadSampleChannel (1) - Creates a new Wave from a file path and loads it inside a Sample Channel. */ + Creates a new Wave from a file path and loads it inside a Sample Channel. */ int loadSampleChannel(ID channelId, const std::string&, int sampleRate, Resampler::Quality); /* loadSampleChannel (2) - Loads an existing Wave inside a Sample Channel. */ + Loads an existing Wave inside a Sample Channel. */ void loadSampleChannel(ID channelId, Wave&); /* freeChannel - Unloads existing Wave from a Sample Channel. */ + Unloads existing Wave from a Sample Channel. */ void freeSampleChannel(ID channelId); void freeAllSampleChannels(); @@ -151,8 +151,8 @@ class ChannelManager final Channel& cloneChannel(ID channelId, int bufferSize, const std::vector&); /* finalizeInputRec - Fills armed Sample channel with audio data coming from an input recording - session. */ + Fills armed Sample channel with audio data coming from an input recording + session. */ void finalizeInputRec(const mcl::AudioBuffer&, Frame recordedFrames, Frame currentFrame); @@ -173,7 +173,7 @@ class ChannelManager final /* consolidateChannels Enable reading actions for Channels that have just been filled with actions - after an action recording session. This will start reading actions right + after an action recording session. This will start reading actions right away, without checking whether conf::treatRecsAsLoops is enabled or not. Same thing for MIDI channels. */ @@ -200,7 +200,7 @@ class ChannelManager final void loadSampleChannel(Channel&, Wave*, Frame begin = -1, Frame end = -1, Frame shift = -1) const; /* setupChannelCallbacks - Prepares the channel with the necessary callbacks. Call this whenever a + Prepares the channel with the necessary callbacks. Call this whenever a new channel is created. */ void setupChannelCallbacks(const Channel&, ChannelShared&) const; @@ -209,7 +209,7 @@ class ChannelManager final std::vector getOverdubbableChannels(); /* setupChannelPostRecording - Fnialize the Sample channel after an audio recording session. */ + Fnialize the Sample channel after an audio recording session. */ void setupChannelPostRecording(Channel&, Frame currentFrame); diff --git a/src/core/channels/channelShared.h b/src/core/channels/channelShared.h index e43deee56..f30aedc49 100644 --- a/src/core/channels/channelShared.h +++ b/src/core/channels/channelShared.h @@ -48,7 +48,7 @@ struct ChannelShared final bool isReadingActions() const; - /* setBufferSize + /* setBufferSize Sets a new size for the internal audio buffer. */ void setBufferSize(int); @@ -68,14 +68,14 @@ struct ChannelShared final std::optional quantizer; /* Optional render queue for sample-based channels. Used by callers on thread - different than the real-time one to instruct the real-time one how to render + different than the real-time one to instruct the real-time one how to render audio. */ std::optional renderQueue = {}; /* Optional resampler for sample-based channels. Unfortunately a Resampler object (based on libsamplerate) doesn't like to get copied while rendering - audio, so can't live inside a Channel object (which is copied on model + audio, so can't live inside a Channel object (which is copied on model changes by the Swapper mechanism). Let's put it in the shared state here. */ std::optional resampler = {}; diff --git a/src/core/channels/midiChannel.h b/src/core/channels/midiChannel.h index 92a62da8c..74405ee71 100644 --- a/src/core/channels/midiChannel.h +++ b/src/core/channels/midiChannel.h @@ -38,12 +38,12 @@ class MidiChannel final MidiChannel(const Patch::Channel&); /* outputEnabled - Tells whether MIDI output is enabled or not. */ + Tells whether MIDI output is enabled or not. */ bool outputEnabled; /* outputFilter - Which MIDI channel data should be sent to. */ + Which MIDI channel data should be sent to. */ int outputFilter; }; diff --git a/src/core/channels/midiInput.h b/src/core/channels/midiInput.h index c8e57b58d..576f75301 100644 --- a/src/core/channels/midiInput.h +++ b/src/core/channels/midiInput.h @@ -39,18 +39,18 @@ class MidiInput final MidiInput(const Patch::Channel&); /* isAllowed - Tells whether the MIDI channel 'c' is enabled to receive MIDI data. */ + Tells whether the MIDI channel 'c' is enabled to receive MIDI data. */ bool isAllowed(int c) const; /* enabled - Tells whether MIDI learning is enabled for the current channel. */ + Tells whether MIDI learning is enabled for the current channel. */ bool enabled; /* filter - Which MIDI channel should be filtered out when receiving MIDI messages. - If -1 means 'all'. */ + Which MIDI channel should be filtered out when receiving MIDI messages. + If -1 means 'all'. */ int filter; diff --git a/src/core/channels/midiLightning.h b/src/core/channels/midiLightning.h index 6c92d41f7..ed444af3e 100644 --- a/src/core/channels/midiLightning.h +++ b/src/core/channels/midiLightning.h @@ -39,7 +39,7 @@ class MidiLightning final MidiLightning(const Patch::Channel&); /* enabled - Tells whether MIDI lighting is enabled or not. */ + Tells whether MIDI lighting is enabled or not. */ bool enabled; diff --git a/src/core/channels/sampleChannel.h b/src/core/channels/sampleChannel.h index 3f0684066..7f195a710 100644 --- a/src/core/channels/sampleChannel.h +++ b/src/core/channels/sampleChannel.h @@ -49,7 +49,7 @@ class SampleChannel final Wave* getWave() const; /* loadWave - Loads Wave and sets it up (name, markers, ...). Resets begin/end points + Loads Wave and sets it up (name, markers, ...). Resets begin/end points and shift if not specified. */ void loadWave(Wave*, Frame begin = -1, Frame end = -1, Frame shift = -1); diff --git a/src/core/confFactory.h b/src/core/confFactory.h index e9bf2a96f..ca42ee027 100644 --- a/src/core/confFactory.h +++ b/src/core/confFactory.h @@ -31,12 +31,12 @@ namespace giada::m::confFactory { -/* serialize +/* serialize Writes Conf to disk. */ bool serialize(const Conf&); -/* deserialize +/* deserialize Reads data from disk into a new Conf object. */ Conf deserialize(); diff --git a/src/core/const.h b/src/core/const.h index ef1ba8f2b..5f51428c8 100644 --- a/src/core/const.h +++ b/src/core/const.h @@ -65,12 +65,12 @@ constexpr auto G_CONF_FILENAME = "giada.conf"; /* -- Engine ---------------------------------------------------------------- */ /* G_EVENT_DISPATCHER_RATE_MS The amount of sleep between each Event Dispatcher cycle. It should be lower -than the audio thread sleep time. Note: this value will obviously increase the +than the audio thread sleep time. Note: this value will obviously increase the live input latency, keep it small! */ constexpr int G_EVENT_DISPATCHER_RATE_MS = 5; /* G_KERNEL_MIDI_OUTPUT_RATE_MS -The rate at which KernelMidi spits out MIDI events. Note: this value will +The rate at which KernelMidi spits out MIDI events. Note: this value will obviously increase the MIDI output latency, keep it small!*/ constexpr int G_KERNEL_MIDI_OUTPUT_RATE_MS = 3; diff --git a/src/core/deepPtr.h b/src/core/deepPtr.h index 02ea97bf8..ed3a5221a 100644 --- a/src/core/deepPtr.h +++ b/src/core/deepPtr.h @@ -42,7 +42,7 @@ class DeepPtr swap(first.m_ptr, second.m_ptr); } - /* Constructor (empty). You can construct it with an explicit nullptr parameter, if + /* Constructor (empty). You can construct it with an explicit nullptr parameter, if needed, like so: DeepPtr ptr(nullptr). Or simply DeepPtr ptr; */ DeepPtr(std::nullptr_t value = nullptr) : m_ptr(value) diff --git a/src/core/engine.cpp b/src/core/engine.cpp index ad2c300c8..57b3bdf82 100644 --- a/src/core/engine.cpp +++ b/src/core/engine.cpp @@ -67,15 +67,18 @@ Engine::Engine() , m_storageApi(*this, m_model, m_pluginManager, m_midiSynchronizer, m_mixer, m_channelManager, m_kernelAudio, m_sequencer, m_actionRecorder) , m_configApi(m_model, m_kernelAudio, m_kernelMidi, m_midiMapper, m_midiSynchronizer) { - m_kernelAudio.onAudioCallback = [this](mcl::AudioBuffer& out, const mcl::AudioBuffer& in) { + m_kernelAudio.onAudioCallback = [this](mcl::AudioBuffer& out, const mcl::AudioBuffer& in) + { registerThread(Thread::AUDIO, /*realtime=*/true); m_renderer.render(out, in, m_model); return 0; }; - m_kernelAudio.onStreamAboutToOpen = [this]() { + m_kernelAudio.onStreamAboutToOpen = [this]() + { m_mixer.disable(); }; - m_kernelAudio.onStreamOpened = [this]() { + m_kernelAudio.onStreamOpened = [this]() + { #ifdef WITH_AUDIO_JACK if (m_kernelAudio.getAPI() == RtAudio::Api::UNIX_JACK) m_jackTransport.setHandle(m_kernelAudio.getJackHandle()); @@ -89,7 +92,8 @@ Engine::Engine() m_mixer.enable(); }; - m_kernelMidi.onMidiReceived = [this](const MidiEvent& e) { + m_kernelMidi.onMidiReceived = [this](const MidiEvent& e) + { assert(onMidiReceived != nullptr); registerThread(Thread::MIDI, /*realtime=*/false); @@ -97,25 +101,31 @@ Engine::Engine() m_midiSynchronizer.receive(e, m_sequencer.getBeats()); onMidiReceived(); }; - m_kernelMidi.onMidiSent = [this]() { + m_kernelMidi.onMidiSent = [this]() + { assert(onMidiSent != nullptr); onMidiSent(); }; - m_midiDispatcher.onEventReceived = [this]() { + m_midiDispatcher.onEventReceived = [this]() + { m_recorder.startActionRecOnCallback(); }; - m_midiSynchronizer.onChangePosition = [this](int beat) { + m_midiSynchronizer.onChangePosition = [this](int beat) + { m_mainApi.goToBeat(beat); }; - m_midiSynchronizer.onChangeBpm = [this](float bpm) { + m_midiSynchronizer.onChangeBpm = [this](float bpm) + { m_mainApi.setBpm(bpm); }; - m_midiSynchronizer.onStart = [this]() { + m_midiSynchronizer.onStart = [this]() + { m_mainApi.startSequencer(); }; - m_midiSynchronizer.onStop = [this]() { + m_midiSynchronizer.onStop = [this]() + { m_mainApi.stopSequencer(); }; @@ -126,48 +136,62 @@ Engine::Engine() on the m_model that the realtime thread cannot perform directly. */ #ifdef WITH_AUDIO_JACK - m_jackSynchronizer.onJackRewind = [this]() { - m_eventDispatcher.pumpEvent([this]() { + m_jackSynchronizer.onJackRewind = [this]() + { + m_eventDispatcher.pumpEvent([this]() + { registerThread(Thread::EVENTS, /*realtime=*/false); m_sequencer.jack_rewind(); }); }; - m_jackSynchronizer.onJackChangeBpm = [this](float bpm) { - m_eventDispatcher.pumpEvent([this, bpm]() { + m_jackSynchronizer.onJackChangeBpm = [this](float bpm) + { + m_eventDispatcher.pumpEvent([this, bpm]() + { registerThread(Thread::EVENTS, /*realtime=*/false); m_sequencer.jack_setBpm(bpm, m_kernelAudio.getSampleRate()); }); }; - m_jackSynchronizer.onJackStart = [this]() { - m_eventDispatcher.pumpEvent([this]() { + m_jackSynchronizer.onJackStart = [this]() + { + m_eventDispatcher.pumpEvent([this]() + { registerThread(Thread::EVENTS, /*realtime=*/false); m_sequencer.jack_start(); }); }; - m_jackSynchronizer.onJackStop = [this]() { - m_eventDispatcher.pumpEvent([this]() { + m_jackSynchronizer.onJackStop = [this]() + { + m_eventDispatcher.pumpEvent([this]() + { registerThread(Thread::EVENTS, /*realtime=*/false); m_sequencer.jack_stop(); }); }; #endif - m_mixer.onSignalTresholdReached = [this]() { - m_eventDispatcher.pumpEvent([this]() { + m_mixer.onSignalTresholdReached = [this]() + { + m_eventDispatcher.pumpEvent([this]() + { registerThread(Thread::EVENTS, /*realtime=*/false); m_recorder.startInputRecOnCallback(); }); }; - m_mixer.onEndOfRecording = [this]() { + m_mixer.onEndOfRecording = [this]() + { if (m_mixer.isRecordingInput()) - m_eventDispatcher.pumpEvent([this]() { + m_eventDispatcher.pumpEvent([this]() + { registerThread(Thread::EVENTS, /*realtime=*/false); m_recorder.stopInputRec(m_kernelAudio.getSampleRate()); }); }; - m_channelManager.onChannelPlayStatusChanged = [this](ID channelId, ChannelStatus status) { - m_eventDispatcher.pumpEvent([this, channelId, status]() { + m_channelManager.onChannelPlayStatusChanged = [this](ID channelId, ChannelStatus status) + { + m_eventDispatcher.pumpEvent([this, channelId, status]() + { registerThread(Thread::EVENTS, /*realtime=*/false); const Channel& ch = m_model.get().tracks.getChannel(channelId); if (ch.midiLightning.enabled) @@ -175,21 +199,25 @@ Engine::Engine() }); }; - m_channelManager.onChannelsAltered = [this]() { + m_channelManager.onChannelsAltered = [this]() + { if (!m_recorder.canEnableFreeInputRec()) m_mixer.setInputRecMode(InputRecMode::RIGID); }; - m_channelManager.onChannelRecorded = [this](Frame recordedFrames) { + m_channelManager.onChannelRecorded = [this](Frame recordedFrames) + { return waveFactory::createEmpty(recordedFrames, G_MAX_IO_CHANS, m_kernelAudio.getSampleRate(), "TAKE"); }; - m_sequencer.onAboutStart = [this](SeqStatus status) { + m_sequencer.onAboutStart = [this](SeqStatus status) + { /* TODO move this logic to Recorder */ if (status == SeqStatus::WAITING) m_recorder.stopActionRec(); m_model.get().mixer.recTriggerMode = RecTriggerMode::NORMAL; }; - m_sequencer.onAboutStop = [this]() { + m_sequencer.onAboutStop = [this]() + { /* If recordings (both input and action) are active deactivate them, but store the takes. RecManager takes care of it. */ /* TODO move this logic to Recorder */ @@ -198,16 +226,19 @@ Engine::Engine() else if (m_mixer.isRecordingInput()) m_recorder.stopInputRec(m_kernelAudio.getSampleRate()); }; - m_sequencer.onBpmChange = [this](float oldVal, float newVal, int quantizerStep) { + m_sequencer.onBpmChange = [this](float oldVal, float newVal, int quantizerStep) + { m_actionRecorder.updateBpm(oldVal / newVal, quantizerStep); }; - m_model.onSwap = [this](model::SwapType t) { + m_model.onSwap = [this](model::SwapType t) + { assert(onModelSwap != nullptr); onModelSwap(t); }; - rendering::registerOnSendMidiCb([this](ID channelId) { + rendering::registerOnSendMidiCb([this](ID channelId) + { onMidiSentFromChannel(channelId); }); } diff --git a/src/core/eventDispatcher.cpp b/src/core/eventDispatcher.cpp index 1d0dd7d39..e1381877b 100644 --- a/src/core/eventDispatcher.cpp +++ b/src/core/eventDispatcher.cpp @@ -40,7 +40,8 @@ EventDispatcher::EventDispatcher() void EventDispatcher::start() { - m_worker.start([this]() { process(); }); + m_worker.start([this]() + { process(); }); } /* -------------------------------------------------------------------------- */ diff --git a/src/core/idManager.h b/src/core/idManager.h index 75e7b1774..962628407 100644 --- a/src/core/idManager.h +++ b/src/core/idManager.h @@ -42,8 +42,8 @@ class IdManager void set(ID id); /* generate - Generates a new unique id. If 'id' parameter is passed in is valid, it just - returns it with no unique id generation. Useful when loading things from the + Generates a new unique id. If 'id' parameter is passed in is valid, it just + returns it with no unique id generation. Useful when loading things from the model that already have their own id. */ ID generate(ID id = 0); diff --git a/src/core/init.cpp b/src/core/init.cpp index 2719ad408..16bc0f74a 100644 --- a/src/core/init.cpp +++ b/src/core/init.cpp @@ -108,29 +108,38 @@ int tests(int argc, char** argv) void startup() { - g_ui->dispatcher.onEventOccured = []() { + g_ui->dispatcher.onEventOccured = []() + { g_engine->getMainApi().startActionRecOnCallback(); }; - g_engine->onMidiReceived = []() { - g_ui->pumpEvent([] { g_ui->mainWindow->mainInput->setMidiInActivity(); }); + g_engine->onMidiReceived = []() + { + g_ui->pumpEvent([] + { g_ui->mainWindow->mainInput->setMidiInActivity(); }); }; - g_engine->onMidiSent = []() { - g_ui->pumpEvent([] { g_ui->mainWindow->mainOutput->setMidiOutActivity(); }); + g_engine->onMidiSent = []() + { + g_ui->pumpEvent([] + { g_ui->mainWindow->mainOutput->setMidiOutActivity(); }); }; - g_engine->onMidiSentFromChannel = [](ID channelId) { - g_ui->pumpEvent([channelId]() { g_ui->mainWindow->keyboard->notifyMidiOut(channelId); }); + g_engine->onMidiSentFromChannel = [](ID channelId) + { + g_ui->pumpEvent([channelId]() + { g_ui->mainWindow->keyboard->notifyMidiOut(channelId); }); }; - g_engine->onModelSwap = [](model::SwapType type) { + g_engine->onModelSwap = [](model::SwapType type) + { /* Rebuild or refresh the UI accoring to the swap type. Note: the onSwap - callback might be performed by a non-main thread, which must talk to the + callback might be performed by a non-main thread, which must talk to the UI (main thread) through the UI queue by pumping an event in it. */ if (type == model::SwapType::NONE) return; - g_ui->pumpEvent([type]() { type == model::SwapType::HARD ? g_ui->rebuild() : g_ui->refresh(); }); + g_ui->pumpEvent([type]() + { type == model::SwapType::HARD ? g_ui->rebuild() : g_ui->refresh(); }); }; Conf conf = confFactory::deserialize(); diff --git a/src/core/init.h b/src/core/init.h index 0fe7cf9d4..d28d71c90 100644 --- a/src/core/init.h +++ b/src/core/init.h @@ -30,7 +30,7 @@ namespace giada::m::init { /* tests -Performs tests, if requested. Returns -1 if no tests are available or the +Performs tests, if requested. Returns -1 if no tests are available or the `--run-tests` has not been passed in. */ int tests(int argc, char** argv); diff --git a/src/core/jackSynchronizer.h b/src/core/jackSynchronizer.h index 6800ddb97..7f2bfe2e9 100644 --- a/src/core/jackSynchronizer.h +++ b/src/core/jackSynchronizer.h @@ -46,12 +46,12 @@ class JackSynchronizer final JackSynchronizer(); /* recvJackSync - Receives a new JACK state. Called by Kernel Audio on each audio block. */ + Receives a new JACK state. Called by Kernel Audio on each audio block. */ void recvJackSync(const JackTransport::State&) const; /* onJack[...] - Callbacks called when something happens in the JACK state. */ + Callbacks called when something happens in the JACK state. */ std::function onJackRewind; std::function onJackChangeBpm; diff --git a/src/core/kernelAudio.cpp b/src/core/kernelAudio.cpp index d0460cc17..d328e9664 100644 --- a/src/core/kernelAudio.cpp +++ b/src/core/kernelAudio.cpp @@ -304,11 +304,12 @@ RtAudio::Api KernelAudio::setAPI_(RtAudio::Api api) m_rtAudio = std::make_unique(api); - m_rtAudio->setErrorCallback([](RtAudioErrorType type, const std::string& msg) { + m_rtAudio->setErrorCallback([](RtAudioErrorType type, const std::string& msg) + { u::log::print("[KA] RtAudio error {}: {}\n", static_cast(type), msg); }); - /* If api == UNSPECIFIED, rtAudio will pick one according to some internal + /* If api == UNSPECIFIED, rtAudio will pick one according to some internal logic. */ return api == RtAudio::Api::UNSPECIFIED ? m_rtAudio->getCurrentApi() : api; @@ -338,7 +339,7 @@ KernelAudio::OpenStreamResult KernelAudio::openStream_( const RtAudio::Api api = m_model.get().kernelAudio.api; - /* Abort here if devices found are zero, both devices are disabled or + /* Abort here if devices found are zero, both devices are disabled or current API is dummy. */ if (m_rtAudio->getDeviceCount() == 0 || (in.id == 0 && out.id == 0) || api == RtAudio::Api::RTAUDIO_DUMMY) diff --git a/src/core/kernelAudio.h b/src/core/kernelAudio.h index 390fddb62..260ec2ddf 100644 --- a/src/core/kernelAudio.h +++ b/src/core/kernelAudio.h @@ -85,7 +85,7 @@ class KernelAudio final static void logCompiledAPIs(); /* init - Initializes the audio engine given the current model::KernelAudio data. Closes + Initializes the audio engine given the current model::KernelAudio data. Closes any existing and running streams and return false on failure. */ bool init(); @@ -159,7 +159,7 @@ class KernelAudio final }; /* setAPI_ - Sets the API. Returns the chosen API, which might be a different one in + Sets the API. Returns the chosen API, which might be a different one in case API in input is UNSPECIFIED (RtAudio would pick one according to some internal logic). */ diff --git a/src/core/kernelMidi.cpp b/src/core/kernelMidi.cpp index 37564847d..259ab14c5 100644 --- a/src/core/kernelMidi.cpp +++ b/src/core/kernelMidi.cpp @@ -123,7 +123,8 @@ void KernelMidi::start() { if (m_midiOut == nullptr) return; - m_worker.start([this]() { + m_worker.start([this]() + { RtMidiMessage msg; while (m_midiQueue.try_dequeue(msg)) m_midiOut->sendMessage(&msg); diff --git a/src/core/kernelMidi.h b/src/core/kernelMidi.h index 6acd4a78c..41dece6bd 100644 --- a/src/core/kernelMidi.h +++ b/src/core/kernelMidi.h @@ -74,7 +74,7 @@ class KernelMidi final Result openInPort(int port); /* getOutPorts, getOutPorts - Returns a vector of port names. */ + Returns a vector of port names. */ std::vector getOutPorts() const; std::vector getInPorts() const; @@ -86,13 +86,13 @@ class KernelMidi final int getCurrentInPort() const; /* canSend, canReceive - Return true if KernelMidi is capable of sending/receiving MIDI messages, + Return true if KernelMidi is capable of sending/receiving MIDI messages, given the current configuration. */ bool canSend() const; bool canReceive() const; - /* canSyncMaster, canSyncSlave + /* canSyncMaster, canSyncSlave Return true if KernelMidi has MIDI sync enabled, master or slave, given the current configuration. */ @@ -100,7 +100,7 @@ class KernelMidi final bool canSyncSlave() const; /* send - Sends a MIDI message to the outside world. Returns false if MIDI out is not + Sends a MIDI message to the outside world. Returns false if MIDI out is not enabled or the internal queue is full. */ bool send(const MidiEvent&) const; diff --git a/src/core/midiDispatcher.cpp b/src/core/midiDispatcher.cpp index 40791eaa9..8871d7932 100644 --- a/src/core/midiDispatcher.cpp +++ b/src/core/midiDispatcher.cpp @@ -53,17 +53,20 @@ MidiDispatcher::MidiDispatcher(model::Model& m) void MidiDispatcher::startChannelLearn(int param, ID channelId, std::function f) { - m_learnCb = [this, param, channelId, f](MidiEvent e) { learnChannel(e, param, channelId, f); }; + m_learnCb = [this, param, channelId, f](MidiEvent e) + { learnChannel(e, param, channelId, f); }; } void MidiDispatcher::startMasterLearn(int param, std::function f) { - m_learnCb = [this, param, f](MidiEvent e) { learnMaster(e, param, f); }; + m_learnCb = [this, param, f](MidiEvent e) + { learnMaster(e, param, f); }; } void MidiDispatcher::startPluginLearn(std::size_t paramIndex, ID pluginId, std::function f) { - m_learnCb = [this, paramIndex, pluginId, f](MidiEvent e) { learnPlugin(e, paramIndex, pluginId, f); }; + m_learnCb = [this, paramIndex, pluginId, f](MidiEvent e) + { learnPlugin(e, paramIndex, pluginId, f); }; } void MidiDispatcher::stopLearn() @@ -92,7 +95,7 @@ void MidiDispatcher::clearPluginLearn(std::size_t paramIndex, ID pluginId, std:: void MidiDispatcher::dispatch(const MidiEvent& e) { - /* Fix the velocity zero issue for those devices that sends NOTE OFF events + /* Fix the velocity zero issue for those devices that sends NOTE OFF events as NOTE ON + velocity zero. Let's make it a real NOTE OFF event. */ MidiEvent eFixed = e; @@ -122,7 +125,7 @@ void MidiDispatcher::process(const MidiEvent& e) assert(onEventReceived != nullptr); assert(e.getType() != MidiEvent::Type::INVALID); - /* Here we are interested only in CHANNEL events, that is note on/note off + /* Here we are interested only in CHANNEL events, that is note on/note off from a MIDI keyboard, knob/wheel/slider movements from a MIDI controller, and so on. SYSTEM events (MIDI Clock, ...) are ignored. */ @@ -159,8 +162,8 @@ void MidiDispatcher::processPlugins(ID channelId, const std::vector& pl const float velocityF = midiEvent.getVelocityFloat(); /* Plugins' parameters layout reflects the structure of the matrix - Channel::midiInPlugins. It is safe to assume then that Plugin 'p' and - parameter indexes match both the structure of Channel::midiInPlugins and the + Channel::midiInPlugins. It is safe to assume then that Plugin 'p' and + parameter indexes match both the structure of Channel::midiInPlugins and the vector of plugins. */ for (Plugin* p : plugins) @@ -183,7 +186,7 @@ void MidiDispatcher::processChannels(const MidiEvent& midiEvent) const uint32_t pure = midiEvent.getRawNoVelocity(); m_model.get().tracks.forEachChannel([this, &midiEvent, &pure](const Channel& c) - { + { /* Do nothing on this channel if MIDI in is disabled or filtered out for the current MIDI channel. */ diff --git a/src/core/midiDispatcher.h b/src/core/midiDispatcher.h index 44aad1fff..210ab898b 100644 --- a/src/core/midiDispatcher.h +++ b/src/core/midiDispatcher.h @@ -51,7 +51,7 @@ class MidiDispatcher void clearPluginLearn(std::size_t paramIndex, ID pluginId, std::function f); /* dispatch - Main callback invoked by kernelMidi whenever a new MIDI data comes in. */ + Main callback invoked by kernelMidi whenever a new MIDI data comes in. */ void dispatch(const MidiEvent&); @@ -62,13 +62,13 @@ class MidiDispatcher private: /* learn - Learns event 'e'. Called by the Event Dispatcher. */ + Learns event 'e'. Called by the Event Dispatcher. */ void learn(const MidiEvent&); /* process - Sends event 'e' to channels (masters and keyboard). Called by the Event - Dispatcher. */ + Sends event 'e' to channels (masters and keyboard). Called by the Event + Dispatcher. */ void process(const MidiEvent&); @@ -85,8 +85,8 @@ class MidiDispatcher void learnPlugin(MidiEvent, std::size_t paramIndex, ID pluginId, std::function doneCb); /* cb_midiLearn - Callback prepared by the gdMidiGrabber window and called by midiDispatcher. - It contains things to do once the midi message has been stored. */ + Callback prepared by the gdMidiGrabber window and called by midiDispatcher. + It contains things to do once the midi message has been stored. */ std::function m_learnCb; diff --git a/src/core/midiEvent.cpp b/src/core/midiEvent.cpp index 6901cd190..08376e6eb 100644 --- a/src/core/midiEvent.cpp +++ b/src/core/midiEvent.cpp @@ -177,7 +177,7 @@ int MidiEvent::getSppPosition() const { assert(getType() == MidiEvent::Type::SYSTEM && getByte1() == SYSTEM_SPP); - /* Song position: the two 7-bit data bytes (least significant byte first) + /* Song position: the two 7-bit data bytes (least significant byte first) forming a 14-bit value which specifies the number of "MIDI beats". */ return getByte2() | (getByte3() << 7); diff --git a/src/core/midiEvent.h b/src/core/midiEvent.h index 3483bc4ff..70370d0ae 100644 --- a/src/core/midiEvent.h +++ b/src/core/midiEvent.h @@ -74,7 +74,7 @@ class MidiEvent static MidiEvent makeFrom2Bytes(uint8_t byte1, uint8_t byte2, double timestamp = 0.0); static MidiEvent makeFrom1Byte(uint8_t byte1, double timestamp = 0.0); - /* MidiEvent + /* MidiEvent Creates and empty and invalid MIDI event. */ MidiEvent(); @@ -94,7 +94,7 @@ class MidiEvent double getTimestamp() const; /* getSppPosition - Returns the number of MIDI beats from the song-position-pointer data + Returns the number of MIDI beats from the song-position-pointer data (byte1 + byte2). */ int getSppPosition() const; @@ -111,14 +111,14 @@ class MidiEvent void setVelocity(int v); /* setVelocityFloat - Stores the velocity value in a high-resolution float variable, instead of + Stores the velocity value in a high-resolution float variable, instead of using the limited 7-bit MIDI one that comes with a CHANNEL type. */ void setVelocityFloat(float); /* fixVelocityZero() - According to the MIDI standard, there is a special case if the velocity is - set to zero. The NOTE ON message then has the same meaning as a NOTE OFF + According to the MIDI standard, there is a special case if the velocity is + set to zero. The NOTE ON message then has the same meaning as a NOTE OFF message, switching the note off. Let's fix it. Sometime however you do want a NOTE ON with velocity zero: setting velocity to 0 in MIDI action editor to mute a specific event. */ diff --git a/src/core/midiMapper.cpp b/src/core/midiMapper.cpp index 59e72454a..a0b459f2f 100644 --- a/src/core/midiMapper.cpp +++ b/src/core/midiMapper.cpp @@ -153,12 +153,12 @@ void MidiMapper::sendMidiLightning(uint32_t learnt, const MidiMap:: u::log::print("[MidiMapper::sendMidiLightning] learnt={:#x}, chan={}, msg={:#x}, offset={}\n", learnt, m.channel, m.value, m.offset); - /* Isolate 'channel' from learnt message and offset it as requested by 'nn' in + /* Isolate 'channel' from learnt message and offset it as requested by 'nn' in the midiMap configuration file. */ uint32_t out = ((learnt & 0x00FF0000) >> 16) << m.offset; - /* Merge the previously prepared channel into final message, and finally send + /* Merge the previously prepared channel into final message, and finally send it. */ out |= m.value | (m.channel << 24); diff --git a/src/core/midiMapper.h b/src/core/midiMapper.h index 86ad3588a..aa5651f09 100644 --- a/src/core/midiMapper.h +++ b/src/core/midiMapper.h @@ -90,7 +90,7 @@ class MidiMapper final : public Mapper int read(const std::string& file); /* sendInitMessages - Sends initialization messages from the currently loaded midimap to the + Sends initialization messages from the currently loaded midimap to the connected MIDI devices. */ void sendInitMessages() const; diff --git a/src/core/midiSynchronizer.cpp b/src/core/midiSynchronizer.cpp index 0d2f5512a..974597da2 100644 --- a/src/core/midiSynchronizer.cpp +++ b/src/core/midiSynchronizer.cpp @@ -56,13 +56,13 @@ void MidiSynchronizer::receive(const MidiEvent& e, int numBeatsInLoop) assert(onStart != nullptr); assert(onStop != nullptr); - /* MidiSynchronizer, if working in SLAVE mode, can receive SYSTEM_* MIDI + /* MidiSynchronizer, if working in SLAVE mode, can receive SYSTEM_* MIDI types. More specifically: - * SYSTEM_CLOCK - when another MIDI device sends CLOCK data to perform - synchronization; - * SYSTEM_START - when another MIDI device is about to start; - * SYSTEM_STOP - when another MIDI device is about to stop; - * SYSTEM_SPP - when another MIDI device has changed song position. */ + * SYSTEM_CLOCK - when another MIDI device sends CLOCK data to perform + synchronization; + * SYSTEM_START - when another MIDI device is about to start; + * SYSTEM_STOP - when another MIDI device is about to stop; + * SYSTEM_SPP - when another MIDI device has changed song position. */ if (!m_kernelMidi.canSyncSlave() || e.getType() != MidiEvent::Type::SYSTEM) return; @@ -100,7 +100,8 @@ void MidiSynchronizer::startSendClock(float bpm) setClockBpm(bpm); const MidiEvent clockEvent = MidiEvent::makeFrom1Byte(MidiEvent::SYSTEM_CLOCK); - m_worker.start([this, clockEvent]() { + m_worker.start([this, clockEvent]() + { if (!m_kernelMidi.send(clockEvent)) G_DEBUG("Can't send MIDI out message!", ); }); @@ -149,9 +150,9 @@ void MidiSynchronizer::computeClock(double timestamp) { assert(onChangeBpm != nullptr); - /* A MIDI clock event (SYSTEM_CLOCK) is sent 24 times per quarter note, that - is 24 times per beat. This is tempo-relative, since the tempo defines the - length of a quarter note (aka frames in beat) and so the duration of each + /* A MIDI clock event (SYSTEM_CLOCK) is sent 24 times per quarter note, that + is 24 times per beat. This is tempo-relative, since the tempo defines the + length of a quarter note (aka frames in beat) and so the duration of each pulse. Faster tempo -> faster SYSTEM_CLOCK events stream. Here we are interpreting that rate and converting into a BPM value. */ @@ -182,8 +183,8 @@ void MidiSynchronizer::computeClock(double timestamp) m_lastDelta = (rawDelta * SMOOTHNESS) + (m_lastDelta * (1.0 - SMOOTHNESS)); /* Do the same as delta for the BPM value. The raw bpm formula is a simplified - version of - rawBpm = ((1.0 / m_lastDelta) / MIDI_CLOCK_PPQ) * 60.0; + version of + rawBpm = ((1.0 / m_lastDelta) / MIDI_CLOCK_PPQ) * 60.0; where MIDI_CLOCK_PPQ == 24.0 */ const double rawBpm = 2.5 / m_lastDelta; @@ -205,7 +206,7 @@ void MidiSynchronizer::computePosition(int sppPosition, int numBeatsInLoop) { assert(onChangePosition != nullptr); - /* Each MIDI Beat spans 6 MIDI Clocks. In other words, each MIDI Beat is a + /* Each MIDI Beat spans 6 MIDI Clocks. In other words, each MIDI Beat is a 16th note (since there are 24 MIDI Clocks in a quarter note). So 1 MIDI beat = a 16th note = 6 clock pulses. A quarter (aka a beat) is diff --git a/src/core/midiSynchronizer.h b/src/core/midiSynchronizer.h index 3109ba844..d2eafd4ec 100644 --- a/src/core/midiSynchronizer.h +++ b/src/core/midiSynchronizer.h @@ -69,7 +69,7 @@ class MidiSynchronizer final void computeClock(double timestamp); - /* computePosition + /* computePosition Given a SPP (Song Position Pointer), it jumps to the right beat. */ void computePosition(int sppPosition, int numBeatsInLoop); diff --git a/src/core/mixer.cpp b/src/core/mixer.cpp index 1e73e342e..3378b9bec 100644 --- a/src/core/mixer.cpp +++ b/src/core/mixer.cpp @@ -289,7 +289,7 @@ int Mixer::lineInRec(const mcl::AudioBuffer& inBuf, mcl::AudioBuffer& recBuf, Fr void Mixer::processLineIn(const model::Mixer& mixer, const mcl::AudioBuffer& inBuf, float inVol, float recTriggerLevel, bool isSeqActive) const { - /* Prepare the working buffer for input stream, which will be processed + /* Prepare the working buffer for input stream, which will be processed later on by the Master Input Channel with plug-ins. */ assert(inBuf.countChannels() <= mixer.getInBuffer().countChannels()); diff --git a/src/core/mixer.h b/src/core/mixer.h index 8efaced2e..1af86954f 100644 --- a/src/core/mixer.h +++ b/src/core/mixer.h @@ -128,7 +128,7 @@ class Mixer void stopActionRec(); /* updateSoloCount - Updates the number of solo-ed channels in mixer. */ + Updates the number of solo-ed channels in mixer. */ void updateSoloCount(bool hasSolos); @@ -148,7 +148,7 @@ class Mixer void setInputRecMode(InputRecMode); /* onSignalTresholdReached - Callback fired when audio has reached a certain threshold (record-on-signal + Callback fired when audio has reached a certain threshold (record-on-signal mode). */ std::function onSignalTresholdReached; @@ -160,7 +160,7 @@ class Mixer private: /* thresholdReached - Returns true if left or right channel's peak has reached a certain + Returns true if left or right channel's peak has reached a certain threshold. */ bool thresholdReached(Peak p, float threshold) const; @@ -172,8 +172,8 @@ class Mixer Peak makePeak(const mcl::AudioBuffer& b) const; /* lineInRec - Records from line in. 'maxFrames' determines how many frames to record - before the internal tracker loops over. The value changes whether you are + Records from line in. 'maxFrames' determines how many frames to record + before the internal tracker loops over. The value changes whether you are recording in RIGID or FREE mode. Returns the number of recorded frames. */ int lineInRec(const mcl::AudioBuffer& inBuf, mcl::AudioBuffer& recBuf, @@ -194,7 +194,7 @@ class Mixer model::Model& m_model; /* m_signalCbFired, m_endOfRecCbFired - Boolean guards to determine whether the callbacks have been fired or not, + Boolean guards to determine whether the callbacks have been fired or not, to avoid retriggering. Mutable: strictly for internal use only. */ mutable bool m_signalCbFired; diff --git a/src/core/model/actions.cpp b/src/core/model/actions.cpp index 4cc896583..0ef721b83 100644 --- a/src/core/model/actions.cpp +++ b/src/core/model/actions.cpp @@ -50,14 +50,16 @@ void Actions::clearAll() void Actions::clearChannel(ID channelId) { - removeIf([=](const Action& a) { return a.channelId == channelId; }); + removeIf([=](const Action& a) + { return a.channelId == channelId; }); } /* -------------------------------------------------------------------------- */ void Actions::clearActions(ID channelId, int type) { - removeIf([=](const Action& a) { + removeIf([=](const Action& a) + { return a.channelId == channelId && a.event.getStatus() == type; }); } @@ -66,12 +68,14 @@ void Actions::clearActions(ID channelId, int type) void Actions::deleteAction(ID id) { - removeIf([=](const Action& a) { return a.id == id; }); + removeIf([=](const Action& a) + { return a.id == id; }); } void Actions::deleteAction(ID currId, ID nextId) { - removeIf([=](const Action& a) { return a.id == currId || a.id == nextId; }); + removeIf([=](const Action& a) + { return a.id == currId || a.id == nextId; }); } /* -------------------------------------------------------------------------- */ @@ -175,7 +179,7 @@ Action Actions::rec(ID channelId, Frame frame, MidiEvent event) Action a = actionFactory::makeAction(0, channelId, frame, event); - /* If key frame doesn't exist yet, the [] operator in std::map is smart + /* If key frame doesn't exist yet, the [] operator in std::map is smart enough to insert a new item first. No plug-in data for now. */ m_actions[frame].push_back(a); @@ -222,7 +226,8 @@ const std::vector* Actions::getActionsOnFrame(Frame frame) const Action Actions::getClosestAction(ID channelId, Frame f, int type) const { Action out = {}; - forEachAction([&](const Action& a) { + forEachAction([&](const Action& a) + { if (a.event.getStatus() != type || a.channelId != channelId) return; if (!out.isValid() || (a.frame <= f && a.frame > out.frame)) @@ -236,7 +241,8 @@ Action Actions::getClosestAction(ID channelId, Frame f, int type) const std::vector Actions::getActionsOnChannel(ID channelId) const { std::vector out; - forEachAction([&](const Action& a) { + forEachAction([&](const Action& a) + { if (a.channelId == channelId) out.push_back(a); }); diff --git a/src/core/model/actions.h b/src/core/model/actions.h index 7537088be..4025bb395 100644 --- a/src/core/model/actions.h +++ b/src/core/model/actions.h @@ -43,34 +43,34 @@ class Actions using Map = std::map>; /* forEachAction - Applies a read-only callback on each action recorded. NEVER do anything - inside the callback that might alter the ActionMap. */ + Applies a read-only callback on each action recorded. NEVER do anything + inside the callback that might alter the ActionMap. */ void forEachAction(std::function f) const; /* getActionsOnChannel - Returns a vector of actions belonging to channel 'ch'. */ + Returns a vector of actions belonging to channel 'ch'. */ std::vector getActionsOnChannel(ID channelId) const; /* getClosestAction - Given a frame 'f' returns the closest action. */ + Given a frame 'f' returns the closest action. */ Action getClosestAction(ID channelId, Frame f, int type) const; /* getActionsOnFrame - Returns a pointer to a vector of actions recorded on frame 'f', or nullptr - if the frame has no actions. */ + Returns a pointer to a vector of actions recorded on frame 'f', or nullptr + if the frame has no actions. */ const std::vector* getActionsOnFrame(Frame f) const; /* hasActions - Checks if the channel has at least one action recorded. */ + Checks if the channel has at least one action recorded. */ bool hasActions(ID channelId, int type = 0) const; /* getAll - Returns a reference to the internal map. */ + Returns a reference to the internal map. */ const Map& getAll() const; @@ -89,61 +89,61 @@ class Actions void set(model::Actions::Map&&); /* clearAll - Deletes all recorded actions. */ + Deletes all recorded actions. */ void clearAll(); /* clearChannel - Clears all actions from a channel. */ + Clears all actions from a channel. */ void clearChannel(ID channelId); /* clearActions - Clears the actions by type from a channel. */ + Clears the actions by type from a channel. */ void clearActions(ID channelId, int type); /* deleteAction (1) - Deletes a specific action. */ + Deletes a specific action. */ void deleteAction(ID id); /* deleteAction (2) - Deletes a specific pair of actions. Useful for composite stuff (i.e. MIDI). */ + Deletes a specific pair of actions. Useful for composite stuff (i.e. MIDI). */ void deleteAction(ID currId, ID nextId); /* updateKeyFrames - Update all the key frames in the internal map of actions, according to a - lambda function 'f'. */ + Update all the key frames in the internal map of actions, according to a + lambda function 'f'. */ void updateKeyFrames(std::function f); /* updateEvent - Changes the event in action 'a'. */ + Changes the event in action 'a'. */ void updateEvent(ID id, MidiEvent e); /* updateSiblings - Changes previous and next actions in action with id 'id'. Mostly used for - chained actions such as envelopes. */ + Changes previous and next actions in action with id 'id'. Mostly used for + chained actions such as envelopes. */ void updateSiblings(ID id, ID prevId, ID nextId); /* rec (1) - Records an action and returns it. Used by the Action Editor. */ + Records an action and returns it. Used by the Action Editor. */ Action rec(ID channelId, Frame frame, MidiEvent e); /* rec (2) - Transfer a vector of actions into the current ActionMap. This is called by - recordHandler when a live session is over and consolidation is required. */ + Transfer a vector of actions into the current ActionMap. This is called by + recordHandler when a live session is over and consolidation is required. */ void rec(std::vector& actions); /* rec (3) - Records two actions on channel 'channel'. Useful when recording composite - actions in the Action Editor. */ + Records two actions on channel 'channel'. Useful when recording composite + actions in the Action Editor. */ void rec(ID channelId, Frame f1, Frame f2, MidiEvent e1, MidiEvent e2); @@ -155,7 +155,7 @@ class Actions const Action* findAction(const Map& src, ID id) const; /* optimize - Removes frames without actions. */ + Removes frames without actions. */ void optimize(Map& map); diff --git a/src/core/model/channels.cpp b/src/core/model/channels.cpp index b966302f0..1d1047e1f 100644 --- a/src/core/model/channels.cpp +++ b/src/core/model/channels.cpp @@ -43,7 +43,7 @@ Channel* Channels::find(ID id) const Channel* Channels::find(ID id) const { auto it = std::find_if(m_channels.begin(), m_channels.end(), [id](const Channel& c) - { return c.id == id; }); + { return c.id == id; }); return it != m_channels.end() ? &*it : nullptr; } @@ -57,7 +57,7 @@ Channel& Channels::get(ID id) const Channel& Channels::get(ID id) const { auto it = std::find_if(m_channels.begin(), m_channels.end(), [id](const Channel& c) - { return c.id == id; }); + { return c.id == id; }); assert(it != m_channels.end()); return *it; } @@ -144,7 +144,7 @@ std::vector Channels::getIf(std::function f) void Channels::remove(ID id) { u::vector::removeIf(m_channels, [id](const Channel& c) - { return c.id == id; }); + { return c.id == id; }); } /* -------------------------------------------------------------------------- */ diff --git a/src/core/model/document.cpp b/src/core/model/document.cpp index da796fa60..26a386716 100644 --- a/src/core/model/document.cpp +++ b/src/core/model/document.cpp @@ -67,7 +67,7 @@ void Document::load(const Patch& patch, Shared& shared, float sampleRateRatio) /* -------------------------------------------------------------------------- */ /* load (2) - Loads data from a Conf object. */ + Loads data from a Conf object. */ void Document::load(const Conf& conf) { diff --git a/src/core/model/document.h b/src/core/model/document.h index 33a57d715..915d62bcc 100644 --- a/src/core/model/document.h +++ b/src/core/model/document.h @@ -72,7 +72,7 @@ struct Document #endif /* locked - If locked, Mixer won't process channels. This is used to allow editing the + If locked, Mixer won't process channels. This is used to allow editing the shared data (e.g. Plugins, Waves) by the rendering engine without data races. */ bool locked = false; diff --git a/src/core/model/model.cpp b/src/core/model/model.cpp index 037962e86..9c3497fbc 100644 --- a/src/core/model/model.cpp +++ b/src/core/model/model.cpp @@ -118,8 +118,8 @@ void Model::store(Patch& patch, const std::string& projectPath) { get().store(patch); - /* Lock the shared data before storing it. Real-time thread can't read from - it until this method goes out of scope. Even if it's mostly a read-only operation, + /* Lock the shared data before storing it. Real-time thread can't read from + it until this method goes out of scope. Even if it's mostly a read-only operation, some Wave objects need to be updated at some point. */ const SharedLock lock = lockShared(SwapType::NONE); diff --git a/src/core/model/model.h b/src/core/model/model.h index 6763bd2b9..e140f2122 100644 --- a/src/core/model/model.h +++ b/src/core/model/model.h @@ -85,7 +85,7 @@ class Model void load(const Conf&); - /* load (2) + /* load (2) Loads data from a Patch object. */ LoadState load(const Patch&, PluginManager&, int sampleRate, int bufferSize, Resampler::Quality); @@ -103,7 +103,7 @@ class Model bool registerThread(Thread, bool realtime) const; /* get_RT - Returns a DocumentLock object for REALTIME processing. Access Document by + Returns a DocumentLock object for REALTIME processing. Access Document by calling DocumentLock::get() method (returns ready-only Document). */ DocumentLock get_RT() const; @@ -133,7 +133,7 @@ class Model Wave* findWave(ID); /* add[*] - Adds some shared data (by moving it). Returns a reference to the last added + Adds some shared data (by moving it). Returns a reference to the last added shared item. */ Wave& addWave(std::unique_ptr); @@ -151,7 +151,7 @@ class Model #endif /* onSwap - Callbacks fired when the Document has been swapped. Useful for listening to + Callbacks fired when the Document has been swapped. Useful for listening to model changes. */ std::function onSwap; diff --git a/src/core/model/sequencer.h b/src/core/model/sequencer.h index be93c9cdc..c6c07bc18 100644 --- a/src/core/model/sequencer.h +++ b/src/core/model/sequencer.h @@ -41,13 +41,13 @@ class Sequencer public: /* isRunning - When sequencer is actually moving forward, i.e. SeqStatus == RUNNING. */ + When sequencer is actually moving forward, i.e. SeqStatus == RUNNING. */ bool isRunning() const; /* isActive - Sequencer is enabled, but might be in wait mode, i.e. SeqStatus == RUNNING or - SeqStatus == WAITING. */ + Sequencer is enabled, but might be in wait mode, i.e. SeqStatus == RUNNING or + SeqStatus == WAITING. */ bool isActive() const; @@ -65,8 +65,8 @@ class Sequencer float a_getCurrentSecond(int sampleRate) const; /* getMaxFramesInLoop - Returns how many frames the current loop length might contain at the slowest - speed possible (G_MIN_BPM). */ + Returns how many frames the current loop length might contain at the slowest + speed possible (G_MIN_BPM). */ int getMaxFramesInLoop(int sampleRate) const; diff --git a/src/core/model/shared.cpp b/src/core/model/shared.cpp index bcdf1947b..814d42e05 100644 --- a/src/core/model/shared.cpp +++ b/src/core/model/shared.cpp @@ -42,7 +42,8 @@ namespace template auto getIter_(const std::vector>& source, ID id) { - return u::vector::findIf(source, [id](const std::unique_ptr& p) { return p->id == id; }); + return u::vector::findIf(source, [id](const std::unique_ptr& p) + { return p->id == id; }); } /* -------------------------------------------------------------------------- */ @@ -68,7 +69,8 @@ typename T::element_type& add_(std::vector& dest, T obj) template void remove_(D& dest, T& ref) { - u::vector::removeIf(dest, [&ref](const auto& other) { return other.get() == &ref; }); + u::vector::removeIf(dest, [&ref](const auto& other) + { return other.get() == &ref; }); } } // namespace @@ -130,7 +132,7 @@ void Shared::store(Patch& patch, const std::string& projectPath) for (auto& w : getAllWaves()) { - /* Update all existing file paths in Waves, so that they point to the + /* Update all existing file paths in Waves, so that they point to the project folder they belong to. */ w->setPath(waveFactory::makeUniqueWavePath(projectPath, *w, getAllWaves())); diff --git a/src/core/model/shared.h b/src/core/model/shared.h index 1db731216..20dbf4121 100644 --- a/src/core/model/shared.h +++ b/src/core/model/shared.h @@ -51,7 +51,7 @@ class Shared void init(); - /* load + /* load Loads shared data from a Patch object. */ LoadState load(const Patch&, PluginManager&, const Sequencer&, int sampleRate, int bufferSize, Resampler::Quality); @@ -79,7 +79,7 @@ class Shared ChannelShared* findChannel(ID); /* add[*] - Adds some shared data (by moving it). Returns a reference to the last added + Adds some shared data (by moving it). Returns a reference to the last added shared item. */ Wave& addWave(std::unique_ptr); diff --git a/src/core/model/sharedLock.cpp b/src/core/model/sharedLock.cpp index fb92a56c1..3ea364937 100644 --- a/src/core/model/sharedLock.cpp +++ b/src/core/model/sharedLock.cpp @@ -24,8 +24,8 @@ * * -------------------------------------------------------------------------- */ -#include "core/model/model.h" #include "core/model/sharedLock.h" +#include "core/model/model.h" namespace giada::m::model { diff --git a/src/core/model/types.h b/src/core/model/types.h index f76f5a914..e85bd1fbb 100644 --- a/src/core/model/types.h +++ b/src/core/model/types.h @@ -40,11 +40,11 @@ using AtomicSwapper = mcl::AtomicSwapper; using DocumentLock = AtomicSwapper::RtLock; /* SwapType -Type of Document change. - Hard: the structure has changed (e.g. add a new channel); - Soft: a property has changed (e.g. change volume); - None: something has changed but we don't care. -Used by model listeners to determine the type of change that occurred in the +Type of Document change. + Hard: the structure has changed (e.g. add a new channel); + Soft: a property has changed (e.g. change volume); + None: something has changed but we don't care. +Used by model listeners to determine the type of change that occurred in the Document. */ enum class SwapType diff --git a/src/core/patchFactory.cpp b/src/core/patchFactory.cpp index 43d74b078..96b5324a9 100644 --- a/src/core/patchFactory.cpp +++ b/src/core/patchFactory.cpp @@ -363,7 +363,7 @@ void modernize_(Patch& patch) const bool isInternalChannel = c.type == ChannelType::PREVIEW || c.type == ChannelType::MASTER; /* 0.16.3 - Make sure that ChannelType is correct: ID 1, 2 are MASTER channels, ID 3 + Make sure that ChannelType is correct: ID 1, 2 are MASTER channels, ID 3 is PREVIEW channel. */ if (c.id == Mixer::MASTER_OUT_CHANNEL_ID || c.id == Mixer::MASTER_IN_CHANNEL_ID) c.type = ChannelType::MASTER; diff --git a/src/core/patchFactory.h b/src/core/patchFactory.h index f782ef453..1b776caa5 100644 --- a/src/core/patchFactory.h +++ b/src/core/patchFactory.h @@ -31,12 +31,12 @@ namespace giada::m::patchFactory { -/* serialize +/* serialize Writes Patch to disk. The 'filePath' parameter refers to the .gptc file. */ bool serialize(const Patch&, const std::string& filePath); -/* deserialize +/* deserialize Reads data from disk into a new Patch object. The 'filePath' parameter refers to the .gptc file. */ diff --git a/src/core/plugins/plugin.cpp b/src/core/plugins/plugin.cpp index 3fb0f82ea..de2940d98 100644 --- a/src/core/plugins/plugin.cpp +++ b/src/core/plugins/plugin.cpp @@ -56,7 +56,7 @@ Plugin::Plugin(ID id, std::unique_ptr plugin, , m_bypass(false) , m_hasEditor(m_plugin->hasEditor()) { - /* (1) Initialize midiInParams vector, where midiInParams.size == number of + /* (1) Initialize midiInParams vector, where midiInParams.size == number of plugin parameters. All values are initially empty (0x0): they will be filled during MIDI learning process. */ @@ -216,7 +216,7 @@ void Plugin::setBypass(bool b) { m_bypass.store(b); } const Plugin::Buffer& Plugin::process(const Plugin::Buffer& out, juce::MidiBuffer m) { - /* Copy the incoming buffer data into the temporary one. This way FXes will + /* Copy the incoming buffer data into the temporary one. This way FXes will process existing audio data on the private buffer. This is needed later on when merging it back into the incoming buffer. */ diff --git a/src/core/plugins/plugin.h b/src/core/plugins/plugin.h index 2e69e771d..24467f485 100644 --- a/src/core/plugins/plugin.h +++ b/src/core/plugins/plugin.h @@ -54,10 +54,10 @@ class Plugin : private juce::ComponentListener Plugin(ID id, std::unique_ptr, std::unique_ptr, double samplerate, int buffersize); - Plugin(const Plugin& o) = delete; - Plugin(Plugin&& o) = delete; + Plugin(const Plugin& o) = delete; + Plugin(Plugin&& o) = delete; Plugin& operator=(const Plugin&) = delete; - Plugin& operator=(Plugin&&) = delete; + Plugin& operator=(Plugin&&) = delete; ~Plugin(); @@ -89,9 +89,9 @@ class Plugin : private juce::ComponentListener int countMainOutChannels() const; /* process - Process the plug-in with audio and MIDI data. The audio buffer is a - reference, while the MIDI buffer must be passed by copy: each plug-in must - receive its own copy of the event set, so that any attempt to change/clear + Process the plug-in with audio and MIDI data. The audio buffer is a + reference, while the MIDI buffer must be passed by copy: each plug-in must + receive its own copy of the event set, so that any attempt to change/clear the MIDI buffer will only modify the local copy. Returns a reference of the local buffer filled with processed data. */ diff --git a/src/core/plugins/pluginFactory.cpp b/src/core/plugins/pluginFactory.cpp index 640fa97db..8f5196e44 100644 --- a/src/core/plugins/pluginFactory.cpp +++ b/src/core/plugins/pluginFactory.cpp @@ -58,8 +58,8 @@ std::unique_ptr create(ID id, const std::string& pid, std::unique_ptr deserializePlugin(const Patch::Plugin& pplugin, std::uni plugin->setBypass(pplugin.bypass); plugin->setState(PluginState(pplugin.state)); - /* Fill plug-in MidiIn parameters. Don't fill Plugin::midiInParam if + /* Fill plug-in MidiIn parameters. Don't fill Plugin::midiInParam if Patch::midiInParams are zero: it would wipe out the current default 0x0 values. */ diff --git a/src/core/plugins/pluginHost.cpp b/src/core/plugins/pluginHost.cpp index 91ac7cbf0..4625d5f5e 100644 --- a/src/core/plugins/pluginHost.cpp +++ b/src/core/plugins/pluginHost.cpp @@ -223,7 +223,7 @@ void PluginHost::processPlugin(Plugin* p, const juce::MidiBuffer& events) for (int i = 0, j = 0; i < m_audioBuffer.getNumChannels(); i++) { - /* If instrument (i.e. a plug-in that accepts MIDI and produces audio + /* If instrument (i.e. a plug-in that accepts MIDI and produces audio out of it), SUM the local working buffer to the main one. This allows multiple plug-in instruments to play simultaneously on a given set of MIDI events. If it's a normal FX instead (!isInstrument), the local diff --git a/src/core/plugins/pluginHost.h b/src/core/plugins/pluginHost.h index d9d98c19e..23830bb20 100644 --- a/src/core/plugins/pluginHost.h +++ b/src/core/plugins/pluginHost.h @@ -75,7 +75,7 @@ class PluginHost final void reset(int bufferSize); /* setBufferSize - Sets a new buffer size value for the internal audio buffer. Must be called + Sets a new buffer size value for the internal audio buffer. Must be called only when mixer is disabled. */ void setBufferSize(int); @@ -92,7 +92,7 @@ class PluginHost final void processStack(mcl::AudioBuffer& outBuf, const std::vector& plugins, const juce::MidiBuffer* events = nullptr); - /* swapPlugin + /* swapPlugin Swaps plug-in 1 with plug-in 2 in the plug-in vector. */ void swapPlugin(const m::Plugin& p1, const m::Plugin& p2, std::vector& plugins); diff --git a/src/core/plugins/pluginManager.h b/src/core/plugins/pluginManager.h index fb6b1f2c1..8c9446386 100644 --- a/src/core/plugins/pluginManager.h +++ b/src/core/plugins/pluginManager.h @@ -102,9 +102,9 @@ class PluginManager final void reset(); /* scanDirs - Parses plugin directories (semicolon-separated) and store list in + Parses plugin directories (semicolon-separated) and store list in knownPluginList. The callback is called on each plugin found. Used to update - the main window from the GUI thread. Return false from the progress callback + the main window from the GUI thread. Return false from the progress callback to stop the scanning process. */ int scanDirs(const std::string& paths, std::function progressCb); diff --git a/src/core/quantizer.h b/src/core/quantizer.h index d7a4c20ca..fca7855ee 100644 --- a/src/core/quantizer.h +++ b/src/core/quantizer.h @@ -40,19 +40,19 @@ class Quantizer { public: /* schedule - Schedules a function in slot 'id' to be called at the right time. The + Schedules a function in slot 'id' to be called at the right time. The function has a 'delta' parameter for the buffer offset. */ void schedule(int id, std::function); /* trigger - Triggers the function in slot 'id'. Might start right away, or at the end + Triggers the function in slot 'id'. Might start right away, or at the end of the quantization step. */ void trigger(int id); /* advance - Computes the internal state. Wants a range of frames [currentFrame, + Computes the internal state. Wants a range of frames [currentFrame, currentFrame + bufferSize) and a quantization step. Call this function on each block. */ diff --git a/src/core/recorder.cpp b/src/core/recorder.cpp index df3819e5d..9d4c134df 100644 --- a/src/core/recorder.cpp +++ b/src/core/recorder.cpp @@ -77,7 +77,7 @@ void Recorder::stopActionRec() if (m_mixer.getRecTriggerMode() == RecTriggerMode::SIGNAL && m_sequencer.getStatus() == SeqStatus::RUNNING) m_mixer.setRecTriggerMode(RecTriggerMode::NORMAL); - /* If you stop the Action Recorder in SIGNAL mode before any actual + /* If you stop the Action Recorder in SIGNAL mode before any actual recording: just clean up everything and return. */ if (m_sequencer.getStatus() == SeqStatus::WAITING) @@ -86,8 +86,8 @@ void Recorder::stopActionRec() return; } - /* Enable reading actions for Channels that have just been filled with - actions. This will start reading right away, without checking whether + /* Enable reading actions for Channels that have just been filled with + actions. This will start reading right away, without checking whether conf::treatRecsAsLoops is enabled or not. Same thing for MIDI channels. */ m_channelManager.consolidateChannels(m_actionRecorder.consolidate()); @@ -145,7 +145,7 @@ void Recorder::stopInputRec(int sampleRate) if (recTriggerMode == RecTriggerMode::SIGNAL && m_sequencer.getStatus() == SeqStatus::RUNNING) m_mixer.setRecTriggerMode(RecTriggerMode::NORMAL); - /* When recording in RIGID mode, the amount of recorded frames is always + /* When recording in RIGID mode, the amount of recorded frames is always equal to the current loop length. */ if (recMode == InputRecMode::RIGID) @@ -153,7 +153,7 @@ void Recorder::stopInputRec(int sampleRate) G_DEBUG("Stop input rec, recordedFrames={}", recordedFrames); - /* If you stop the Input Recorder in SIGNAL mode before any actual + /* If you stop the Input Recorder in SIGNAL mode before any actual recording: just clean up everything and return. */ if (m_sequencer.getStatus() == SeqStatus::WAITING) diff --git a/src/core/recorder.h b/src/core/recorder.h index d64fbd6a8..cf60e882e 100644 --- a/src/core/recorder.h +++ b/src/core/recorder.h @@ -41,14 +41,14 @@ class Recorder final Recorder(Sequencer&, ChannelManager&, Mixer&, ActionRecorder&); /* canEnableRecOnSignal - True if rec-on-signal can be enabled: can't set it while sequencer is - running, in order to prevent mistakes while live recording. */ + True if rec-on-signal can be enabled: can't set it while sequencer is + running, in order to prevent mistakes while live recording. */ bool canEnableRecOnSignal() const; /* canEnableFreeInputRec - True if free loop-length can be enabled: Can't set it if there's already a - filled Sample Channel in the current project. */ + True if free loop-length can be enabled: Can't set it if there's already a + filled Sample Channel in the current project. */ bool canEnableFreeInputRec() const; diff --git a/src/core/rendering/midiOutput.cpp b/src/core/rendering/midiOutput.cpp index 3217abf1e..110f54de5 100644 --- a/src/core/rendering/midiOutput.cpp +++ b/src/core/rendering/midiOutput.cpp @@ -94,8 +94,8 @@ void sendMidiAllNotesOff(const Channel& ch, KernelMidi& kernelMidi) void sendMidiEventToPlugins(ChannelShared::MidiQueue& midiQueue, const MidiEvent& e) { - /* Now all messages are turned into Channel-0 messages. Giada doesn't care - about holding MIDI channel information. Moreover, having all internal + /* Now all messages are turned into Channel-0 messages. Giada doesn't care + about holding MIDI channel information. Moreover, having all internal messages on channel 0 is way easier. Then send it to plug-ins. */ MidiEvent flat(e); diff --git a/src/core/rendering/midiReactions.h b/src/core/rendering/midiReactions.h index 0b038426e..99f1a8a55 100644 --- a/src/core/rendering/midiReactions.h +++ b/src/core/rendering/midiReactions.h @@ -48,7 +48,7 @@ void playMidiChannel(WeakAtomic&); void stopMidiChannel(WeakAtomic&); void rewindMidiChannel(WeakAtomic&); -/* recordMidiAction +/* recordMidiAction Records a new Action for a MIDI channel. */ void recordMidiAction(ID channelId, const MidiEvent&, Frame currentFrameQuantized, ActionRecorder&); diff --git a/src/core/rendering/pluginRendering.h b/src/core/rendering/pluginRendering.h index ccbce4d00..785d7e30b 100644 --- a/src/core/rendering/pluginRendering.h +++ b/src/core/rendering/pluginRendering.h @@ -36,7 +36,7 @@ class PluginHost; namespace giada::m::rendering { -/* renderAudioAndMidiPlugins +/* renderAudioAndMidiPlugins Renders plug-ins using the shared juce::MidiBuffer for MIDI event rendering. It renders normal audio plug-ins too. */ diff --git a/src/core/rendering/reactor.cpp b/src/core/rendering/reactor.cpp index 3d595ff1c..ee8dff5e0 100644 --- a/src/core/rendering/reactor.cpp +++ b/src/core/rendering/reactor.cpp @@ -96,7 +96,7 @@ void Reactor::keyRelease(ID channelId, bool canRecordActions, Frame currentFrame if (canRecordActions && mode == SamplePlayerMode::SINGLE_PRESS) { - /* Record a stop event only if channel is SINGLE_PRESS. For any other + /* Record a stop event only if channel is SINGLE_PRESS. For any other mode the key release event is meaningless. */ recordSampleKeyRelease(channelId, currentFrameQuantized, m_actionRecorder); @@ -139,7 +139,7 @@ void Reactor::keyKill(ID channelId, bool canRecordActions, Frame currentFrameQua if (ch.hasWave() && canRecordActions && mode == SamplePlayerMode::SINGLE_PRESS) { - /* Record a stop event only if channel is SINGLE_PRESS. For any other + /* Record a stop event only if channel is SINGLE_PRESS. For any other mode the key release event is meaningless. */ recordSampleKeyKill(channelId, currentFrameQuantized, m_actionRecorder); @@ -191,7 +191,7 @@ void Reactor::toggleReadActions(ID channelId, bool seqIsRunning) void Reactor::killReadActions(ID channelId) { - /* Killing Read Actions, i.e. shift + click on 'R' button is meaningful + /* Killing Read Actions, i.e. shift + click on 'R' button is meaningful only when the treatRecsAsLoops flag is true. */ if (!m_model.get().behaviors.treatRecsAsLoops) diff --git a/src/core/rendering/sampleReactions.cpp b/src/core/rendering/sampleReactions.cpp index 61dfc8706..a0053b13f 100644 --- a/src/core/rendering/sampleReactions.cpp +++ b/src/core/rendering/sampleReactions.cpp @@ -60,7 +60,7 @@ void startReadActions_(ChannelShared& shared, bool treatRecsAsLoops) void stopReadActions_(ChannelShared& shared, ChannelStatus curRecStatus, bool treatRecsAsLoops, bool seqIsRunning) { - /* First of all, if the sequencer is not running or treatRecsAsLoops is off, + /* First of all, if the sequencer is not running or treatRecsAsLoops is off, just stop and disable everything. Otherwise make sure a channel with actions behave like a dynamic one. */ @@ -83,7 +83,7 @@ ChannelStatus pressWhileOff_(ID channelId, ChannelShared& shared, float velocity bool canQuantize, bool velocityAsVol) { /* Reset internal volume to default (1.0) if no velocity as volume. This is - important in case the channel has actions and some of them have velocity + important in case the channel has actions and some of them have velocity less than 1.0: without reset you would play the channel with that velocity value. */ @@ -133,7 +133,7 @@ void recordSampleKeyPress(ID channelId, ChannelShared& shared, Frame currentFram { record_(channelId, MidiEvent::CHANNEL_NOTE_ON, currentFrameQuantized, actionRecorder); - /* Skip reading actions when recording on ChannelMode::SINGLE_PRESS to + /* Skip reading actions when recording on ChannelMode::SINGLE_PRESS to prevent existing actions to interfere with the keypress/keyrel combo. */ if (mode == SamplePlayerMode::SINGLE_PRESS) @@ -262,8 +262,8 @@ void releaseSampleChannel(ChannelShared& shared, SamplePlayerMode mode) if (mode != SamplePlayerMode::SINGLE_PRESS) return; - /* Kill it if it's SINGLE_PRESS is playing. Otherwise there might be a - quantization step in progress that would play the channel later on: + /* Kill it if it's SINGLE_PRESS is playing. Otherwise there might be a + quantization step in progress that would play the channel later on: disable it. */ if (shared.playStatus.load() == ChannelStatus::PLAY) diff --git a/src/core/rendering/sampleRendering.cpp b/src/core/rendering/sampleRendering.cpp index 261b921e0..728c7bdb0 100644 --- a/src/core/rendering/sampleRendering.cpp +++ b/src/core/rendering/sampleRendering.cpp @@ -70,9 +70,9 @@ ReadResult readCopy_(const Wave& wave, mcl::AudioBuffer& dest, Frame start, /* -------------------------------------------------------------------------- */ /* onSampleEnd -Things to do when the last frame has been reached. 'natural' == true if the -rendering has ended because the end of the sample has ben reached. -'natural' == false if the rendering has been manually interrupted (by a +Things to do when the last frame has been reached. 'natural' == true if the +rendering has ended because the end of the sample has ben reached. +'natural' == false if the rendering has been manually interrupted (by a RenderInfo::Mode::STOP type). Returns whether the sample should loop or not. */ bool onSampleEnd_(const Channel& ch, bool seqIsRunning, bool natural) @@ -87,7 +87,7 @@ bool onSampleEnd_(const Channel& ch, bool seqIsRunning, bool natural) { case ChannelStatus::PLAY: /* Stop LOOP_* when the sequencer is off, or SINGLE_* except for - SINGLE_ENDLESS, which runs forever unless it's in ENDING mode. + SINGLE_ENDLESS, which runs forever unless it's in ENDING mode. Other loop once modes are put in wait mode. */ if (isSingleNoLoop || (isLoop && !seqIsRunning) || !natural) shared.playStatus.store(ChannelStatus::OFF); @@ -133,7 +133,7 @@ Frame render_(const Channel& ch, mcl::AudioBuffer& buf, Frame tracker, Frame off tracker += res.used; offset += res.generated; - /* Break here if the buffer has been filled completely: there's nothing + /* Break here if the buffer has been filled completely: there's nothing else do to. */ if (offset >= buf.countFrames()) diff --git a/src/core/rendering/sampleRendering.h b/src/core/rendering/sampleRendering.h index bb7910a31..04cd10913 100644 --- a/src/core/rendering/sampleRendering.h +++ b/src/core/rendering/sampleRendering.h @@ -46,12 +46,12 @@ class PluginHost; namespace giada::m::rendering { /* RenderInfo - Determines how the render() function should behave. - Mode::NORMAL - normal rendering, starting at offset 'offset'; - Mode::REWIND - two-step rendering, used when the sample must rewind at some - point ('offset') in the audio buffer; - Mode::STOP - abort rendering. The audio buffer is silenced starting at - 'offset'. Also triggers onLastFrame(). */ + Determines how the render() function should behave. + Mode::NORMAL - normal rendering, starting at offset 'offset'; + Mode::REWIND - two-step rendering, used when the sample must rewind at some + point ('offset') in the audio buffer; + Mode::STOP - abort rendering. The audio buffer is silenced starting at + 'offset'. Also triggers onLastFrame(). */ struct RenderInfo { @@ -67,9 +67,9 @@ struct RenderInfo }; /* ReadResult -A ReadResult object is returned by the readWave() function below, containing the -number of frames used and generated from a buffer filling operation. The two -values are different only when pitch is != 1.0, where a chunk of audio in input +A ReadResult object is returned by the readWave() function below, containing the +number of frames used and generated from a buffer filling operation. The two +values are different only when pitch is != 1.0, where a chunk of audio in input (used) might result in a longer or shorter portion of audio in output (generated). */ struct ReadResult @@ -79,7 +79,7 @@ struct ReadResult void renderSampleChannel(const Channel&, bool seqIsRunning); -/* renderSampleChannelInput +/* renderSampleChannelInput Copies input buffer to channel buffer: this enables the input monitoring. */ void renderSampleChannelInput(const Channel&, const mcl::AudioBuffer&); diff --git a/src/core/resampler.cpp b/src/core/resampler.cpp index 9f0d49101..e9fbf632d 100644 --- a/src/core/resampler.cpp +++ b/src/core/resampler.cpp @@ -90,7 +90,7 @@ long Resampler::callback(float** audio) { assert(audio != nullptr); - /* Move pointer properly, taking into account read data and number of + /* Move pointer properly, taking into account read data and number of channels in input data. */ *audio = m_input + (m_inputPos * m_channels); diff --git a/src/core/resampler.h b/src/core/resampler.h index f35cfff80..9b423d6c4 100644 --- a/src/core/resampler.h +++ b/src/core/resampler.h @@ -45,7 +45,7 @@ class Resampler final }; /* Result - A Result object is returned by the process() function below, containing the + A Result object is returned by the process() function below, containing the number of frames used from input and generated to output. */ struct Result @@ -57,7 +57,7 @@ class Resampler final Resampler(Quality quality, int channels); Resampler(const Resampler& o); Resampler(Resampler&&) = delete; - Resampler& operator =(const Resampler&); + Resampler& operator=(const Resampler&); Resampler& operator=(Resampler&&) = delete; ~Resampler(); diff --git a/src/core/ringBuffer.h b/src/core/ringBuffer.h index be2dcf6a0..fba853c71 100644 --- a/src/core/ringBuffer.h +++ b/src/core/ringBuffer.h @@ -33,7 +33,7 @@ namespace giada { /* RingBuffer -A non-thread-safe, fixed-size ring buffer implementation. It grows from 0 to S, +A non-thread-safe, fixed-size ring buffer implementation. It grows from 0 to S, then items are overwritten starting from position 0. */ template diff --git a/src/core/sequencer.cpp b/src/core/sequencer.cpp index c8e1b2713..ab18e76a8 100644 --- a/src/core/sequencer.cpp +++ b/src/core/sequencer.cpp @@ -55,7 +55,8 @@ Sequencer::Sequencer(model::Model& m, MidiSynchronizer& s, JackTransport& j) , m_jackTransport(j) , m_quantizerStep(1) { - m_quantizer.schedule(Q_ACTION_REWIND, [this](Frame delta) { rawRewind(delta); }); + m_quantizer.schedule(Q_ACTION_REWIND, [this](Frame delta) + { rawRewind(delta); }); } /* -------------------------------------------------------------------------- */ diff --git a/src/core/sequencer.h b/src/core/sequencer.h index 5d385827c..bb904aa88 100644 --- a/src/core/sequencer.h +++ b/src/core/sequencer.h @@ -77,18 +77,18 @@ class Sequencer final Sequencer(model::Model&, MidiSynchronizer&, JackTransport&); /* canQuantize - Tells whether the quantizer value is > 0 and the sequencer is running. */ + Tells whether the quantizer value is > 0 and the sequencer is running. */ bool canQuantize() const; /* isRunning - When sequencer is actually moving forward, i.e. SeqStatus == RUNNING. */ + When sequencer is actually moving forward, i.e. SeqStatus == RUNNING. */ bool isRunning() const; /* isActive - Sequencer is enabled, but might be in wait mode, i.e. SeqStatus == RUNNING or - SeqStatus == WAITING. */ + Sequencer is enabled, but might be in wait mode, i.e. SeqStatus == RUNNING or + SeqStatus == WAITING. */ bool isActive() const; @@ -114,13 +114,13 @@ class Sequencer final int getMaxFramesInLoop(int sampleRate) const; /* calcBpmFromRec - Given the amount of recorded frames, returns the speed of the current - performance. Used while input recording in FREE mode. */ + Given the amount of recorded frames, returns the speed of the current + performance. Used while input recording in FREE mode. */ float calcBpmFromRec(Frame recordedFrames, int sampleRate) const; /* quantize - Quantizes the frame 'f'. */ + Quantizes the frame 'f'. */ Frame quantize(Frame f) const; @@ -130,13 +130,13 @@ class Sequencer final void reset(int sampleRate); /* setSampleRate - Sets a new sample rate value for the internal beat computation. Must be + Sets a new sample rate value for the internal beat computation. Must be called only when mixer is disabled.*/ void setSampleRate(int); /* advance - Parses sequencer events that might occur in a block and advances the internal + Parses sequencer events that might occur in a block and advances the internal quantizer. Returns a reference to the internal EventBuffer filled with events (if any). Call this on each new audio block. */ @@ -168,7 +168,7 @@ class Sequencer final #endif /* recomputeFrames - Updates bpm, frames, beats and so on. */ + Updates bpm, frames, beats and so on. */ void recomputeFrames(int sampleRate); @@ -178,7 +178,7 @@ class Sequencer final private: /* raw[*] - Raw functions to start, stop and rewind the sequencer or change other + Raw functions to start, stop and rewind the sequencer or change other properties. These functions must be called only internally. Other modules should send a SEQUENCER_* event to the Event Dispatcher. */ @@ -193,7 +193,7 @@ class Sequencer final JackTransport& m_jackTransport; /* m_eventBuffer - Buffer of events found in each block sent to channels for event parsing. + Buffer of events found in each block sent to channels for event parsing. This is filled during react(). */ mutable EventBuffer m_eventBuffer; @@ -202,7 +202,7 @@ class Sequencer final Quantizer m_quantizer; /* m_quantizerStep - Tells how many frames to wait to perform a quantized action. */ + Tells how many frames to wait to perform a quantized action. */ int m_quantizerStep; }; diff --git a/src/core/wave.h b/src/core/wave.h index d4a6867bf..446131ed3 100644 --- a/src/core/wave.h +++ b/src/core/wave.h @@ -58,7 +58,7 @@ class Wave const mcl::AudioBuffer& getBuffer() const; /* setPath - Sets new path 'p'. If 'id' != -1 inserts a numeric id next to the file + Sets new path 'p'. If 'id' != -1 inserts a numeric id next to the file extension, e.g. : /path/to/sample-[id].wav */ void setPath(const std::string& p, int id = -1); diff --git a/src/core/waveFactory.h b/src/core/waveFactory.h index 2570ff37c..1e3fc43eb 100644 --- a/src/core/waveFactory.h +++ b/src/core/waveFactory.h @@ -49,38 +49,38 @@ struct Result void reset(); /* create - Creates a new Wave object with data read from file 'path'. Pass id = 0 to - auto-generate it. The function converts the Wave sample rate if it doesn't - match the desired one as specified in 'samplerate'. */ + Creates a new Wave object with data read from file 'path'. Pass id = 0 to + auto-generate it. The function converts the Wave sample rate if it doesn't + match the desired one as specified in 'samplerate'. */ Result createFromFile(const std::string& path, ID id, int samplerate, Resampler::Quality); /* createEmpty - Creates a new silent Wave object. */ + Creates a new silent Wave object. */ std::unique_ptr createEmpty(int frames, int channels, int samplerate, const std::string& name); /* createFromWave - Creates a new Wave from an existing one. If specified, copying the data in - range a - b. Range is [0, sr.buffer.countFrames()] otherwise. */ + Creates a new Wave from an existing one. If specified, copying the data in + range a - b. Range is [0, sr.buffer.countFrames()] otherwise. */ std::unique_ptr createFromWave(const Wave& src, int a = -1, int b = -1); /* (de)serializeWave - Creates a new Wave given the patch raw data and vice versa. */ + Creates a new Wave given the patch raw data and vice versa. */ std::unique_ptr deserializeWave(const Patch::Wave& w, int samplerate, Resampler::Quality); const Patch::Wave serializeWave(const Wave& w); /* resample - Change sample rate of 'w' to the desider value. The 'quality' parameter sets - the algorithm to use for the conversion. */ + Change sample rate of 'w' to the desider value. The 'quality' parameter sets + the algorithm to use for the conversion. */ int resample(Wave&, Resampler::Quality, int samplerate); /* save - Writes Wave data to file 'path'. Only 'wav' format is supported for now. */ + Writes Wave data to file 'path'. Only 'wav' format is supported for now. */ int save(const Wave& w, const std::string& path); diff --git a/src/core/waveFx.cpp b/src/core/waveFx.cpp index aa59338e1..9623b73fd 100644 --- a/src/core/waveFx.cpp +++ b/src/core/waveFx.cpp @@ -127,7 +127,7 @@ void cut(Wave& w, int a, int b) b = w.getBuffer().countFrames(); /* Create a new temp wave and copy there the original one, skipping the a-b - range. */ + range. */ int newSize = w.getBuffer().countFrames() - (b - a); @@ -220,7 +220,7 @@ void fade(Wave& w, int a, int b, Fade type) void smooth(Wave& w, int a, int b) { - /* Do nothing if fade edges (both of SMOOTH_SIZE samples) are > than selected + /* Do nothing if fade edges (both of SMOOTH_SIZE samples) are > than selected portion of wave. SMOOTH_SIZE*2 to count both edges. */ if (SMOOTH_SIZE * 2 > (b - a)) diff --git a/src/core/worker.cpp b/src/core/worker.cpp index 2158ac200..39449947f 100644 --- a/src/core/worker.cpp +++ b/src/core/worker.cpp @@ -48,7 +48,8 @@ void Worker::start(std::function f) const { stop(); m_running.store(true); - m_thread = std::thread([this, f]() { + m_thread = std::thread([this, f]() + { while (m_running.load() == true) { f(); diff --git a/src/glue/channel.cpp b/src/glue/channel.cpp index dbf8ab807..acb6a2885 100644 --- a/src/glue/channel.cpp +++ b/src/glue/channel.cpp @@ -350,7 +350,7 @@ float setChannelVolume(ID channelId, float v, Thread t, bool repaintMainUi) if (t != Thread::MAIN || repaintMainUi) g_ui->pumpEvent([channelId, v]() - { g_ui->mainWindow->keyboard->setChannelVolume(channelId, v); }); + { g_ui->mainWindow->keyboard->setChannelVolume(channelId, v); }); return v; } @@ -361,7 +361,7 @@ float setChannelPitch(ID channelId, float v, Thread t) { g_engine->getChannelsApi().setPitch(channelId, v); g_ui->pumpEvent([v]() - { + { if (auto* w = sampleEditor::getWindow(); w != nullptr) w->pitchTool->update(v); }); notifyChannelForMidiIn(t, channelId); @@ -425,7 +425,7 @@ void notifyChannelForMidiIn(Thread t, ID channelId) { if (t == Thread::MIDI) g_ui->pumpEvent([channelId]() - { g_ui->mainWindow->keyboard->notifyMidiIn(channelId); }); + { g_ui->mainWindow->keyboard->notifyMidiIn(channelId); }); } } // namespace giada::c::channel diff --git a/src/glue/config.h b/src/glue/config.h index c8237b358..b416c8167 100644 --- a/src/glue/config.h +++ b/src/glue/config.h @@ -35,7 +35,7 @@ #include /* giada::c::config -Functions to interact with the Configuration panel. Only the main thread can use +Functions to interact with the Configuration panel. Only the main thread can use these! */ namespace giada::c::config diff --git a/src/glue/io.cpp b/src/glue/io.cpp index 3303857ae..f81231179 100644 --- a/src/glue/io.cpp +++ b/src/glue/io.cpp @@ -227,17 +227,23 @@ bool channel_setKey(ID channelId, int k) void channel_startMidiLearn(int param, ID channelId) { - g_engine->getIOApi().channel_startMidiLearn(param, channelId, []() { g_ui->pumpEvent([]() { rebuildMidiWindows_(); }); }); + g_engine->getIOApi().channel_startMidiLearn(param, channelId, []() + { g_ui->pumpEvent([]() + { rebuildMidiWindows_(); }); }); } void master_startMidiLearn(int param) { - g_engine->getIOApi().master_startMidiLearn(param, []() { g_ui->pumpEvent([]() { rebuildMidiWindows_(); }); }); + g_engine->getIOApi().master_startMidiLearn(param, []() + { g_ui->pumpEvent([]() + { rebuildMidiWindows_(); }); }); } void plugin_startMidiLearn(int paramIndex, ID pluginId) { - g_engine->getIOApi().plugin_startMidiLearn(paramIndex, pluginId, []() { g_ui->pumpEvent([]() { rebuildMidiWindows_(); }); }); + g_engine->getIOApi().plugin_startMidiLearn(paramIndex, pluginId, []() + { g_ui->pumpEvent([]() + { rebuildMidiWindows_(); }); }); } /* -------------------------------------------------------------------------- */ @@ -245,24 +251,31 @@ void plugin_startMidiLearn(int paramIndex, ID pluginId) void stopMidiLearn() { g_engine->getIOApi().stopMidiLearn(); - g_ui->pumpEvent([]() { rebuildMidiWindows_(); }); + g_ui->pumpEvent([]() + { rebuildMidiWindows_(); }); } /* -------------------------------------------------------------------------- */ void channel_clearMidiLearn(int param, ID channelId) { - g_engine->getIOApi().channel_clearMidiLearn(param, channelId, []() { g_ui->pumpEvent([]() { rebuildMidiWindows_(); }); }); + g_engine->getIOApi().channel_clearMidiLearn(param, channelId, []() + { g_ui->pumpEvent([]() + { rebuildMidiWindows_(); }); }); } void master_clearMidiLearn(int param) { - g_engine->getIOApi().master_clearMidiLearn(param, []() { g_ui->pumpEvent([]() { rebuildMidiWindows_(); }); }); + g_engine->getIOApi().master_clearMidiLearn(param, []() + { g_ui->pumpEvent([]() + { rebuildMidiWindows_(); }); }); } void plugin_clearMidiLearn(int param, ID pluginId) { - g_engine->getIOApi().plugin_clearMidiLearn(param, pluginId, []() { g_ui->pumpEvent([]() { rebuildMidiWindows_(); }); }); + g_engine->getIOApi().plugin_clearMidiLearn(param, pluginId, []() + { g_ui->pumpEvent([]() + { rebuildMidiWindows_(); }); }); } /* -------------------------------------------------------------------------- */ diff --git a/src/glue/main.cpp b/src/glue/main.cpp index 8e94b3081..ba266608c 100644 --- a/src/glue/main.cpp +++ b/src/glue/main.cpp @@ -243,7 +243,8 @@ void setMasterInVolume(float v, Thread t) g_engine->getMainApi().setMasterInVolume(v); if (t != Thread::MAIN) - g_ui->pumpEvent([v]() { g_ui->mainWindow->mainInput->setInVol(v); }); + g_ui->pumpEvent([v]() + { g_ui->mainWindow->mainInput->setInVol(v); }); } void setMasterOutVolume(float v, Thread t) @@ -251,7 +252,8 @@ void setMasterOutVolume(float v, Thread t) g_engine->getMainApi().setMasterOutVolume(v); if (t != Thread::MAIN) - g_ui->pumpEvent([v]() { g_ui->mainWindow->mainOutput->setOutVol(v); }); + g_ui->pumpEvent([v]() + { g_ui->mainWindow->mainOutput->setOutVol(v); }); } /* -------------------------------------------------------------------------- */ diff --git a/src/glue/plugin.cpp b/src/glue/plugin.cpp index cae3cf771..293c43114 100644 --- a/src/glue/plugin.cpp +++ b/src/glue/plugin.cpp @@ -195,7 +195,8 @@ void setParameter(ID channelId, ID pluginId, int paramIndex, float value, Thread g_engine->getPluginsApi().setParameter(pluginId, paramIndex, value); channel::notifyChannelForMidiIn(t, channelId); - g_ui->pumpEvent([pluginId, t]() { c::plugin::updateWindow(pluginId, t); }); + g_ui->pumpEvent([pluginId, t]() + { c::plugin::updateWindow(pluginId, t); }); } /* -------------------------------------------------------------------------- */ diff --git a/src/glue/storage.cpp b/src/glue/storage.cpp index 31122faf7..64f51ad20 100644 --- a/src/glue/storage.cpp +++ b/src/glue/storage.cpp @@ -100,8 +100,8 @@ void loadProject(void* data) const std::string projectPath = browser->getSelectedItem(); - /* Close all sub-windows first (browser included), in case there are VST - editors visible. VST editors must be closed before deleting their plug-in + /* Close all sub-windows first (browser included), in case there are VST + editors visible. VST editors must be closed before deleting their plug-in processors. */ g_ui->closeAllSubwindows(); @@ -113,7 +113,8 @@ void loadProject(void* data) g_ui->stopUpdater(); auto uiProgress = g_ui->mainWindow->getScopedProgress(g_ui->getI18Text(v::LangMap::MESSAGE_STORAGE_LOADINGPROJECT)); - auto engineProgress = [&uiProgress](float v) { uiProgress.setProgress(v); }; + auto engineProgress = [&uiProgress](float v) + { uiProgress.setProgress(v); }; m::model::LoadState state = g_engine->getStorageApi().loadProject(projectPath, engineProgress); @@ -150,7 +151,8 @@ void saveProject(void* data) return; auto uiProgress = g_ui->mainWindow->getScopedProgress(g_ui->getI18Text(v::LangMap::MESSAGE_STORAGE_SAVINGPROJECT)); - auto engineProgress = [&uiProgress](float v) { uiProgress.setProgress(v); }; + auto engineProgress = [&uiProgress](float v) + { uiProgress.setProgress(v); }; g_ui->model.projectName = projectName; diff --git a/src/gui/dialogs/about.cpp b/src/gui/dialogs/about.cpp index b62f1181f..9f7a2483c 100644 --- a/src/gui/dialogs/about.cpp +++ b/src/gui/dialogs/about.cpp @@ -87,7 +87,8 @@ gdAbout::gdAbout() geFlex* footer = new geFlex(Direction::HORIZONTAL); { geTextButton* close = new geTextButton(g_ui->getI18Text(LangMap::COMMON_CLOSE)); - close->onClick = [this]() { do_callback(); }; + close->onClick = [this]() + { do_callback(); }; footer->addWidget(new geBox()); // Spacer footer->addWidget(close, 80); footer->end(); diff --git a/src/gui/dialogs/actionEditor/baseActionEditor.cpp b/src/gui/dialogs/actionEditor/baseActionEditor.cpp index e28d1d9f9..73cb84b0c 100644 --- a/src/gui/dialogs/actionEditor/baseActionEditor.cpp +++ b/src/gui/dialogs/actionEditor/baseActionEditor.cpp @@ -59,10 +59,12 @@ gdBaseActionEditor::gdBaseActionEditor(ID channelId, const Model& model) , m_legends(new geFlexResizable(Direction::VERTICAL, geResizerBar::Mode::RESIZE)) , m_ratio(model.actionEditorZoom) { - m_zoomInBtn->onClick = [this]() { zoomIn(); }; + m_zoomInBtn->onClick = [this]() + { zoomIn(); }; m_zoomInBtn->copy_tooltip(g_ui->getI18Text(LangMap::COMMON_ZOOMIN)); - m_zoomOutBtn->onClick = [this]() { zoomOut(); }; + m_zoomOutBtn->onClick = [this]() + { zoomOut(); }; m_zoomOutBtn->copy_tooltip(g_ui->getI18Text(LangMap::COMMON_ZOOMOUT)); } @@ -107,7 +109,8 @@ Frame gdBaseActionEditor::pixelToFrame(Pixel p, Frame framesInBeat, bool snap) c void gdBaseActionEditor::zoomIn() { // Explicit type std::max to fix MINMAX macro hell on Windows - zoomAbout([&r = m_ratio]() { return std::max(r / RATIO_STEP, MIN_RATIO); }); + zoomAbout([&r = m_ratio]() + { return std::max(r / RATIO_STEP, MIN_RATIO); }); } /* -------------------------------------------------------------------------- */ @@ -115,7 +118,8 @@ void gdBaseActionEditor::zoomIn() void gdBaseActionEditor::zoomOut() { // Explicit type std::max to fix MINMAX macro hell on Windows - zoomAbout([&r = m_ratio]() { return std::min(r * RATIO_STEP, MAX_RATIO); }); + zoomAbout([&r = m_ratio]() + { return std::min(r * RATIO_STEP, MAX_RATIO); }); } /* -------------------------------------------------------------------------- */ @@ -167,7 +171,7 @@ void gdBaseActionEditor::zoomAbout(std::function f) m_ratio = f(); - /* Make sure the new content width doesn't underflow the window space (i.e. + /* Make sure the new content width doesn't underflow the window space (i.e. the minimum width allowed). */ if (frameToPixel(m_data.framesInSeq) < minWidth) diff --git a/src/gui/dialogs/actionEditor/baseActionEditor.h b/src/gui/dialogs/actionEditor/baseActionEditor.h index 7ca99fcc6..8fa3a60ac 100644 --- a/src/gui/dialogs/actionEditor/baseActionEditor.h +++ b/src/gui/dialogs/actionEditor/baseActionEditor.h @@ -99,7 +99,7 @@ class gdBaseActionEditor : public gdWindow void refresh() override; /* zoomAbout - Zooms and centers the viewport around the mouse cursor. Wants a function to + Zooms and centers the viewport around the mouse cursor. Wants a function to apply to the current ratio. */ void zoomAbout(std::function f); diff --git a/src/gui/dialogs/actionEditor/midiActionEditor.cpp b/src/gui/dialogs/actionEditor/midiActionEditor.cpp index 7b344aefd..0cf1deaae 100644 --- a/src/gui/dialogs/actionEditor/midiActionEditor.cpp +++ b/src/gui/dialogs/actionEditor/midiActionEditor.cpp @@ -88,16 +88,19 @@ gdMidiActionEditor::gdMidiActionEditor(ID channelId, const Model& model) m_splitScroll->addWidgets(*m_pianoRoll, *m_velocityEditor, model.actionEditorSplitH); - m_splitScroll->onDragBar = [this]() { + m_splitScroll->onDragBar = [this]() + { m_legends->resizeWidget(0, m_splitScroll->getTopContentH()); }; - m_splitScroll->onScrollV = [this](int y) { + m_splitScroll->onScrollV = [this](int y) + { static_cast(m_legends->getWidget(0)).scroll_to(0, y); }; m_legends->resizeWidget(0, m_splitScroll->getTopContentH()); - m_legends->onDragBar = [this](const Fl_Widget& widget) { + m_legends->onDragBar = [this](const Fl_Widget& widget) + { m_splitScroll->resizeWidget(0, widget.h()); }; diff --git a/src/gui/dialogs/actionEditor/sampleActionEditor.cpp b/src/gui/dialogs/actionEditor/sampleActionEditor.cpp index 13297319d..c5f9a3cf9 100644 --- a/src/gui/dialogs/actionEditor/sampleActionEditor.cpp +++ b/src/gui/dialogs/actionEditor/sampleActionEditor.cpp @@ -98,13 +98,15 @@ gdSampleActionEditor::gdSampleActionEditor(ID channelId, const Model& model) m_velocityEditor = new geVelocityEditor(0, 0, this); m_splitScroll->addWidgets(*m_sampleActionEditor, *m_velocityEditor, model.actionEditorSplitH); - m_splitScroll->onDragBar = [this]() { + m_splitScroll->onDragBar = [this]() + { m_legends->resizeWidget(0, m_splitScroll->getTopContentH()); }; m_legends->resizeWidget(0, m_splitScroll->getTopContentH()); - m_legends->onDragBar = [this](const Fl_Widget& widget) { + m_legends->onDragBar = [this](const Fl_Widget& widget) + { m_splitScroll->resizeWidget(0, widget.h()); }; diff --git a/src/gui/dialogs/beatsInput.cpp b/src/gui/dialogs/beatsInput.cpp index 45b436372..90ca2a4a2 100644 --- a/src/gui/dialogs/beatsInput.cpp +++ b/src/gui/dialogs/beatsInput.cpp @@ -65,7 +65,8 @@ gdBeatsInput::gdBeatsInput(int beats, int bars) m_bars->setType(FL_INT_INPUT); m_ok->shortcut(FL_Enter); - m_ok->onClick = [this]() { + m_ok->onClick = [this]() + { if (m_beats->getValue() == "" || m_bars->getValue() == "") return; c::main::setBeats(std::stoi(m_beats->getValue()), std::stoi(m_bars->getValue())); diff --git a/src/gui/dialogs/bpmInput.cpp b/src/gui/dialogs/bpmInput.cpp index bab92dfdc..815fd2eb4 100644 --- a/src/gui/dialogs/bpmInput.cpp +++ b/src/gui/dialogs/bpmInput.cpp @@ -61,7 +61,8 @@ gdBpmInput::gdBpmInput(float value) m_value->setValue(fmt::format("{:.1f}", value)); m_ok->shortcut(FL_Enter); - m_ok->onClick = [this]() { + m_ok->onClick = [this]() + { std::string value = m_value->getValue(); if (value == "") return; diff --git a/src/gui/dialogs/browser/browserBase.cpp b/src/gui/dialogs/browser/browserBase.cpp index 5bf7e3f6d..98d78e694 100644 --- a/src/gui/dialogs/browser/browserBase.cpp +++ b/src/gui/dialogs/browser/browserBase.cpp @@ -99,17 +99,20 @@ gdBrowserBase::gdBrowserBase(const std::string& title, const std::string& path, where->setCursorColor(G_COLOR_BLACK); where->setValue(path.c_str()); - updir->onClick = [this]() { + updir->onClick = [this]() + { browser->loadDir(u::fs::getUpDir(browser->getCurrentDir())); where->setValue(browser->getCurrentDir().c_str()); }; - browser->onSelectedElement = [this]() { fireCallback(); }; + browser->onSelectedElement = [this]() + { fireCallback(); }; browser->loadDir(path); if (path == model.browserLastPath) browser->preselect(model.browserPosition, model.browserLastValue); - cancel->onClick = [this]() { do_callback(); }; + cancel->onClick = [this]() + { do_callback(); }; set_non_modal(); size_range(320, 200); diff --git a/src/gui/dialogs/browser/browserDir.cpp b/src/gui/dialogs/browser/browserDir.cpp index 0b1773534..84385c242 100644 --- a/src/gui/dialogs/browser/browserDir.cpp +++ b/src/gui/dialogs/browser/browserDir.cpp @@ -46,7 +46,8 @@ gdBrowserDir::gdBrowserDir(const std::string& title, const std::string& path, ok->label(g_ui->getI18Text(LangMap::COMMON_SELECT)); ok->shortcut(FL_ENTER); - ok->onClick = [this]() { fireCallback(); }; + ok->onClick = [this]() + { fireCallback(); }; } /* -------------------------------------------------------------------------- */ diff --git a/src/gui/dialogs/browser/browserLoad.cpp b/src/gui/dialogs/browser/browserLoad.cpp index 60f5fc48e..d5d228fd9 100644 --- a/src/gui/dialogs/browser/browserLoad.cpp +++ b/src/gui/dialogs/browser/browserLoad.cpp @@ -46,7 +46,8 @@ gdBrowserLoad::gdBrowserLoad(const std::string& title, const std::string& path, ok->label(g_ui->getI18Text(LangMap::COMMON_LOAD)); ok->shortcut(FL_ENTER); - ok->onClick = [this]() { fireCallback(); }; + ok->onClick = [this]() + { fireCallback(); }; } /* -------------------------------------------------------------------------- */ diff --git a/src/gui/dialogs/browser/browserSave.cpp b/src/gui/dialogs/browser/browserSave.cpp index 48921f5cf..69ac40c8d 100644 --- a/src/gui/dialogs/browser/browserSave.cpp +++ b/src/gui/dialogs/browser/browserSave.cpp @@ -46,7 +46,8 @@ gdBrowserSave::gdBrowserSave(const std::string& title, const std::string& path, ok->label(g_ui->getI18Text(LangMap::COMMON_SAVE)); ok->shortcut(FL_ENTER); - ok->onClick = [this]() { fireCallback(); }; + ok->onClick = [this]() + { fireCallback(); }; } /* -------------------------------------------------------------------------- */ diff --git a/src/gui/dialogs/channelNameInput.cpp b/src/gui/dialogs/channelNameInput.cpp index 2a7ab214b..10aa75fd1 100644 --- a/src/gui/dialogs/channelNameInput.cpp +++ b/src/gui/dialogs/channelNameInput.cpp @@ -66,12 +66,14 @@ gdChannelNameInput::gdChannelNameInput(const c::channel::Data& d) m_name->setValue(m_data.name); m_ok->shortcut(FL_Enter); - m_ok->onClick = [this]() { + m_ok->onClick = [this]() + { c::channel::setName(m_data.id, m_name->getValue()); do_callback(); }; - m_cancel->onClick = [this]() { + m_cancel->onClick = [this]() + { do_callback(); }; diff --git a/src/gui/dialogs/channelRouting.cpp b/src/gui/dialogs/channelRouting.cpp index dd6e61b6a..ac2daec9e 100644 --- a/src/gui/dialogs/channelRouting.cpp +++ b/src/gui/dialogs/channelRouting.cpp @@ -69,7 +69,8 @@ gdChannelRouting::gdChannelRouting(const c::channel::Data& d) add(container); - m_close->onClick = [this]() { do_callback(); }; + m_close->onClick = [this]() + { do_callback(); }; set_modal(); show(); diff --git a/src/gui/dialogs/config.cpp b/src/gui/dialogs/config.cpp index 77882e492..74b08ee7e 100644 --- a/src/gui/dialogs/config.cpp +++ b/src/gui/dialogs/config.cpp @@ -71,7 +71,8 @@ gdConfig::gdConfig(int w, int h, const Model& model) geFlex* footer = new geFlex(Direction::HORIZONTAL, G_GUI_OUTER_MARGIN); { geTextButton* closeBtn = new geTextButton(g_ui->getI18Text(LangMap::COMMON_CLOSE)); - closeBtn->onClick = [this]() { do_callback(); }; + closeBtn->onClick = [this]() + { do_callback(); }; footer->addWidget(new geBox()); // Spacer footer->addWidget(closeBtn, 80); diff --git a/src/gui/dialogs/keyGrabber.cpp b/src/gui/dialogs/keyGrabber.cpp index 1492b77ee..d269815b8 100644 --- a/src/gui/dialogs/keyGrabber.cpp +++ b/src/gui/dialogs/keyGrabber.cpp @@ -68,7 +68,8 @@ gdKeyGrabber::gdKeyGrabber(int key) add(container); - m_clear->onClick = [this]() { + m_clear->onClick = [this]() + { assert(onSetKey != nullptr); m_key = 0; @@ -76,7 +77,8 @@ gdKeyGrabber::gdKeyGrabber(int key) rebuild(); }; - m_cancel->onClick = [this]() { + m_cancel->onClick = [this]() + { do_callback(); }; diff --git a/src/gui/dialogs/mainWindow.cpp b/src/gui/dialogs/mainWindow.cpp index 00d4f2989..1ba7e2e7c 100644 --- a/src/gui/dialogs/mainWindow.cpp +++ b/src/gui/dialogs/mainWindow.cpp @@ -158,7 +158,8 @@ gdMainWindow::gdMainWindow(geompp::Rect r, const char* title) add(container); resizable(container); - callback([](Fl_Widget* /*w*/, void* /*v*/) { + callback([](Fl_Widget* /*w*/, void* /*v*/) + { if (Fl::event() == FL_SHORTCUT && Fl::event_key() == FL_Escape) return; // ignore Escape c::main::quitGiada(); diff --git a/src/gui/dialogs/midiIO/midiInputChannel.cpp b/src/gui/dialogs/midiIO/midiInputChannel.cpp index 20edc2102..5a890679c 100644 --- a/src/gui/dialogs/midiIO/midiInputChannel.cpp +++ b/src/gui/dialogs/midiIO/midiInputChannel.cpp @@ -51,8 +51,10 @@ geChannelLearnerPack::geChannelLearnerPack(int x, int y, const c::io::Channel_In : geMidiLearnerPack(x, y, g_ui->getI18Text(LangMap::MIDIINPUT_CHANNEL_LEARN_CHANNEL)) { setCallbacks( - [channelId = channel.channelId](int param) { c::io::channel_startMidiLearn(param, channelId); }, - [channelId = channel.channelId](int param) { c::io::channel_clearMidiLearn(param, channelId); }); + [channelId = channel.channelId](int param) + { c::io::channel_startMidiLearn(param, channelId); }, + [channelId = channel.channelId](int param) + { c::io::channel_clearMidiLearn(param, channelId); }); addMidiLearner(g_ui->getI18Text(LangMap::MIDIINPUT_CHANNEL_LEARN_KEYPRESS), G_MIDI_IN_KEYPRESS); addMidiLearner(g_ui->getI18Text(LangMap::MIDIINPUT_CHANNEL_LEARN_KEYREL), G_MIDI_IN_KEYREL); addMidiLearner(g_ui->getI18Text(LangMap::MIDIINPUT_CHANNEL_LEARN_KEYKILL), G_MIDI_IN_KILL); @@ -88,8 +90,10 @@ gePluginLearnerPack::gePluginLearnerPack(int x, int y, const c::io::PluginData& : geMidiLearnerPack(x, y, plugin.name) { setCallbacks( - [pluginId = plugin.id](int param) { c::io::plugin_startMidiLearn(param, pluginId); }, - [pluginId = plugin.id](int param) { c::io::plugin_clearMidiLearn(param, pluginId); }); + [pluginId = plugin.id](int param) + { c::io::plugin_startMidiLearn(param, pluginId); }, + [pluginId = plugin.id](int param) + { c::io::plugin_clearMidiLearn(param, pluginId); }); for (const c::io::PluginParamData& param : plugin.params) addMidiLearner(param.name, param.index); @@ -152,9 +156,11 @@ gdMidiInputChannel::gdMidiInputChannel(ID channelId, const Model& model) add(container); resizable(container); - m_ok->onClick = [this]() { do_callback(); }; + m_ok->onClick = [this]() + { do_callback(); }; - m_enable->onChange = [this](bool value) { + m_enable->onChange = [this](bool value) + { c::io::channel_enableMidiLearn(m_data.channelId, value); }; @@ -175,11 +181,13 @@ gdMidiInputChannel::gdMidiInputChannel(ID channelId, const Model& model) m_channel->addItem("Channel 14"); m_channel->addItem("Channel 15"); m_channel->addItem("Channel 16"); - m_channel->onChange = [this](ID id) { + m_channel->onChange = [this](ID id) + { c::io::channel_setMidiInputFilter(m_data.channelId, id == 0 ? -1 : id - 1); }; - m_veloAsVol->onChange = [this](bool value) { + m_veloAsVol->onChange = [this](bool value) + { c::io::channel_enableVelocityAsVol(m_data.channelId, value); }; diff --git a/src/gui/dialogs/midiIO/midiInputMaster.cpp b/src/gui/dialogs/midiIO/midiInputMaster.cpp index 6da31f513..e8bf45b88 100644 --- a/src/gui/dialogs/midiIO/midiInputMaster.cpp +++ b/src/gui/dialogs/midiIO/midiInputMaster.cpp @@ -43,8 +43,10 @@ geMasterLearnerPack::geMasterLearnerPack(int x, int y) : geMidiLearnerPack(x, y) { setCallbacks( - [](int param) { c::io::master_startMidiLearn(param); }, - [](int param) { c::io::master_clearMidiLearn(param); }); + [](int param) + { c::io::master_startMidiLearn(param); }, + [](int param) + { c::io::master_clearMidiLearn(param); }); addMidiLearner(g_ui->getI18Text(LangMap::MIDIINPUT_MASTER_LEARN_REWIND), G_MIDI_IN_REWIND); addMidiLearner(g_ui->getI18Text(LangMap::MIDIINPUT_MASTER_LEARN_PLAYSTOP), G_MIDI_IN_START_STOP); addMidiLearner(g_ui->getI18Text(LangMap::MIDIINPUT_MASTER_LEARN_ACTIONREC), G_MIDI_IN_ACTION_REC); @@ -116,9 +118,11 @@ gdMidiInputMaster::gdMidiInputMaster(const Model& model) add(container); resizable(container); - m_ok->onClick = [this]() { do_callback(); }; + m_ok->onClick = [this]() + { do_callback(); }; - m_enable->onChange = [](bool value) { c::io::master_enableMidiLearn(value); }; + m_enable->onChange = [](bool value) + { c::io::master_enableMidiLearn(value); }; m_channel->addItem("Channel (any)"); m_channel->addItem("Channel 1"); @@ -137,7 +141,8 @@ gdMidiInputMaster::gdMidiInputMaster(const Model& model) m_channel->addItem("Channel 14"); m_channel->addItem("Channel 15"); m_channel->addItem("Channel 16"); - m_channel->onChange = [](ID id) { + m_channel->onChange = [](ID id) + { c::io::master_setMidiFilter(id == 0 ? -1 : id - 1); }; diff --git a/src/gui/dialogs/midiIO/midiOutputBase.cpp b/src/gui/dialogs/midiIO/midiOutputBase.cpp index 95b0709ea..60c22a684 100644 --- a/src/gui/dialogs/midiIO/midiOutputBase.cpp +++ b/src/gui/dialogs/midiIO/midiOutputBase.cpp @@ -39,8 +39,10 @@ geLightningLearnerPack::geLightningLearnerPack(int x, int y, ID channelId) : geMidiLearnerPack(x, y) { setCallbacks( - [channelId](int param) { c::io::channel_startMidiLearn(param, channelId); }, - [channelId](int param) { c::io::channel_clearMidiLearn(param, channelId); }); + [channelId](int param) + { c::io::channel_startMidiLearn(param, channelId); }, + [channelId](int param) + { c::io::channel_clearMidiLearn(param, channelId); }); addMidiLearner(g_ui->getI18Text(LangMap::MIDIOUTPUT_CHANNEL_LEARN_PLAYING), G_MIDI_OUT_L_PLAYING); addMidiLearner(g_ui->getI18Text(LangMap::MIDIOUTPUT_CHANNEL_LEARN_MUTE), G_MIDI_OUT_L_MUTE); addMidiLearner(g_ui->getI18Text(LangMap::MIDIOUTPUT_CHANNEL_LEARN_SOLO), G_MIDI_OUT_L_SOLO); diff --git a/src/gui/dialogs/midiIO/midiOutputMidiCh.cpp b/src/gui/dialogs/midiIO/midiOutputMidiCh.cpp index 889d1f5bc..8909e1ca4 100644 --- a/src/gui/dialogs/midiIO/midiOutputMidiCh.cpp +++ b/src/gui/dialogs/midiIO/midiOutputMidiCh.cpp @@ -99,19 +99,23 @@ gdMidiOutputMidiCh::gdMidiOutputMidiCh(ID channelId) m_chanListOut->addItem("Channel 15"); m_chanListOut->addItem("Channel 16"); m_chanListOut->showItem(0); - m_chanListOut->onChange = [this](ID id) { + m_chanListOut->onChange = [this](ID id) + { c::io::channel_setMidiOutputFilter(m_channelId, id); }; - m_enableOut->onChange = [this](bool value) { + m_enableOut->onChange = [this](bool value) + { c::io::channel_enableMidiOutput(m_channelId, value); }; - m_enableLightning->onChange = [this](bool value) { + m_enableLightning->onChange = [this](bool value) + { c::io::channel_enableMidiLightning(m_channelId, value); }; - m_close->onClick = [this]() { do_callback(); }; + m_close->onClick = [this]() + { do_callback(); }; set_modal(); rebuild(); diff --git a/src/gui/dialogs/midiIO/midiOutputSampleCh.cpp b/src/gui/dialogs/midiIO/midiOutputSampleCh.cpp index b8ca51604..64aad53c3 100644 --- a/src/gui/dialogs/midiIO/midiOutputSampleCh.cpp +++ b/src/gui/dialogs/midiIO/midiOutputSampleCh.cpp @@ -70,9 +70,11 @@ gdMidiOutputSampleCh::gdMidiOutputSampleCh(ID channelId) add(container); resizable(nullptr); - m_close->onClick = [this]() { do_callback(); }; + m_close->onClick = [this]() + { do_callback(); }; - m_enableLightning->onChange = [this](bool value) { + m_enableLightning->onChange = [this](bool value) + { c::io::channel_enableMidiLightning(m_channelId, value); }; diff --git a/src/gui/dialogs/missingAssets.cpp b/src/gui/dialogs/missingAssets.cpp index afc87b1d1..29ace5ae4 100644 --- a/src/gui/dialogs/missingAssets.cpp +++ b/src/gui/dialogs/missingAssets.cpp @@ -73,7 +73,8 @@ gdMissingAssets::gdMissingAssets(const m::model::LoadState& state) geFlex* footer = new geFlex(Direction::HORIZONTAL); { geTextButton* close = new geTextButton(g_ui->getI18Text(LangMap::COMMON_CLOSE)); - close->onClick = [this]() { do_callback(); }; + close->onClick = [this]() + { do_callback(); }; footer->addWidget(new geBox()); // Spacer footer->addWidget(close, 80); footer->end(); diff --git a/src/gui/dialogs/pluginChooser.cpp b/src/gui/dialogs/pluginChooser.cpp index c39617878..1489a3ce2 100644 --- a/src/gui/dialogs/pluginChooser.cpp +++ b/src/gui/dialogs/pluginChooser.cpp @@ -80,7 +80,8 @@ gdPluginChooser::gdPluginChooser(ID channelId, const Model& model) sortMethod->addItem(g_ui->getI18Text(LangMap::PLUGINCHOOSER_SORTBY_MANUFACTURER)); sortMethod->addItem(g_ui->getI18Text(LangMap::PLUGINCHOOSER_SORTBY_FORMAT)); sortMethod->showItem(static_cast(model.pluginChooserSortMode.method)); - sortMethod->onChange = [this](ID) { + sortMethod->onChange = [this](ID) + { c::plugin::sortPlugins(getSortMode()); browser->refresh(); }; @@ -88,12 +89,14 @@ gdPluginChooser::gdPluginChooser(ID channelId, const Model& model) sortDir->addItem("A-Z"); sortDir->addItem("Z-A"); sortDir->showItem(static_cast(model.pluginChooserSortMode.dir)); - sortDir->onChange = [this](ID) { + sortDir->onChange = [this](ID) + { c::plugin::sortPlugins(getSortMode()); browser->refresh(); }; - addBtn->onClick = [this]() { + addBtn->onClick = [this]() + { int pluginIndex = browser->value() - 3; // subtract header lines if (pluginIndex < 0) return; @@ -102,7 +105,8 @@ gdPluginChooser::gdPluginChooser(ID channelId, const Model& model) }; addBtn->shortcut(FL_Enter); - cancelBtn->onClick = [this]() { + cancelBtn->onClick = [this]() + { do_callback(); }; diff --git a/src/gui/dialogs/pluginList.cpp b/src/gui/dialogs/pluginList.cpp index 6fa461cc4..83f88fdc4 100644 --- a/src/gui/dialogs/pluginList.cpp +++ b/src/gui/dialogs/pluginList.cpp @@ -88,7 +88,8 @@ void gdPluginList::rebuild() addPlugin = new geTextButton(0, 0, 0, G_GUI_UNIT, g_ui->getI18Text(LangMap::PLUGINLIST_ADDPLUGIN)); - addPlugin->onClick = [this]() { + addPlugin->onClick = [this]() + { c::layout::openPluginChooser(m_plugins.channelId); }; diff --git a/src/gui/dialogs/pluginWindowGUI.cpp b/src/gui/dialogs/pluginWindowGUI.cpp index 461be8bfd..b2f692689 100644 --- a/src/gui/dialogs/pluginWindowGUI.cpp +++ b/src/gui/dialogs/pluginWindowGUI.cpp @@ -83,7 +83,7 @@ void gdPluginWindowGUI::adjustSize() #ifdef G_OS_WINDOWS /* Dragging around a resized window (this windows will get resized with the - setBounds() call below) triggers some weird auto-resize mechanism if the + setBounds() call below) triggers some weird auto-resize mechanism if the system UI scale is set to a value greater than 100% (see https://github.com/monocasual/giada/issues/621). Setting this window resizable with size_range() seems to fix the issue. */ @@ -108,7 +108,8 @@ void gdPluginWindowGUI::createEditor() m_editor->setScaleFactor(m_plugin.uiScaling); - m_plugin.setResizeCallback([this](int w, int h) { + m_plugin.setResizeCallback([this](int w, int h) + { setBounds(getBounds().withSize(w, h)); }); } diff --git a/src/gui/dialogs/progress.cpp b/src/gui/dialogs/progress.cpp index eefe2f0ec..33a278f99 100644 --- a/src/gui/dialogs/progress.cpp +++ b/src/gui/dialogs/progress.cpp @@ -68,7 +68,8 @@ gdProgress::gdProgress() add(container); - m_cancelBtn->onClick = [this]() { + m_cancelBtn->onClick = [this]() + { if (onCancel) onCancel(); }; diff --git a/src/gui/dialogs/sampleEditor.cpp b/src/gui/dialogs/sampleEditor.cpp index 656fbec39..c34ae7409 100644 --- a/src/gui/dialogs/sampleEditor.cpp +++ b/src/gui/dialogs/sampleEditor.cpp @@ -132,7 +132,8 @@ gdSampleEditor::gdSampleEditor(ID channelId, const Model& model) add(container); resizable(container); - reload->onClick = [this]() { + reload->onClick = [this]() + { c::sampleEditor::reload(m_data.channelId); redraw(); }; @@ -148,37 +149,44 @@ gdSampleEditor::gdSampleEditor(ID channelId, const Model& model) grid->addItem("64", 64); grid->copy_tooltip(g_ui->getI18Text(LangMap::COMMON_GRIDRES)); grid->showItem(model.sampleEditorGridVal); - grid->onChange = [this](ID) { + grid->onChange = [this](ID) + { /* TODO - redraw grid if != (off) */ waveTools->waveform->setGridLevel(grid->getSelectedId()); }; snap->value(model.sampleEditorGridOn); snap->copy_tooltip(g_ui->getI18Text(LangMap::COMMON_SNAPTOGRID)); - snap->onChange = [this](bool val) { + snap->onChange = [this](bool val) + { waveTools->waveform->setSnap(val); }; zoomOut->copy_tooltip(g_ui->getI18Text(LangMap::COMMON_ZOOMOUT)); - zoomOut->onClick = [this]() { + zoomOut->onClick = [this]() + { waveTools->waveform->setZoom(geWaveform::Zoom::OUT); waveTools->redraw(); }; zoomIn->copy_tooltip(g_ui->getI18Text(LangMap::COMMON_ZOOMIN)); - zoomIn->onClick = [this]() { + zoomIn->onClick = [this]() + { waveTools->waveform->setZoom(geWaveform::Zoom::IN); waveTools->redraw(); }; play->setToggleable(true); - play->onClick = []() { c::sampleEditor::togglePreview(); }; + play->onClick = []() + { c::sampleEditor::togglePreview(); }; - rewind->onClick = [this]() { + rewind->onClick = [this]() + { c::sampleEditor::setPreviewTracker(m_data.begin); }; - loop->onChange = [](bool shouldLoop) { c::sampleEditor::setLoop(shouldLoop); }; + loop->onChange = [](bool shouldLoop) + { c::sampleEditor::setLoop(shouldLoop); }; info->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_TOP); diff --git a/src/gui/dialogs/warnings.cpp b/src/gui/dialogs/warnings.cpp index 52c33afa9..d39c6ee52 100644 --- a/src/gui/dialogs/warnings.cpp +++ b/src/gui/dialogs/warnings.cpp @@ -58,7 +58,8 @@ void gdAlert(const char* msg, bool resizable) box->labelsize(G_GUI_FONT_SIZE_BASE); b->shortcut(FL_Enter); - b->onClick = [&win]() { win.hide(); }; + b->onClick = [&win]() + { win.hide(); }; if (resizable) win.resizable(box); @@ -82,9 +83,11 @@ int gdConfirmWin(const char* title, const char* msg) win.end(); ok->shortcut(FL_Enter); - ok->onClick = [&win]() { confirmRet_ = true; win.hide(); }; + ok->onClick = [&win]() + { confirmRet_ = true; win.hide(); }; - ko->onClick = [&win]() { confirmRet_ = false; win.hide(); }; + ko->onClick = [&win]() + { confirmRet_ = false; win.hide(); }; win.show(); diff --git a/src/gui/dialogs/window.h b/src/gui/dialogs/window.h index 0c5bbc6e3..8e31d022b 100644 --- a/src/gui/dialogs/window.h +++ b/src/gui/dialogs/window.h @@ -46,11 +46,11 @@ class gdWindow : public Fl_Double_Window /* rebuild, refresh Rebuild() is called by the View Updater when something structural changes - (e.g. a new channel added). Refresh() is called periodically by the View + (e.g. a new channel added). Refresh() is called periodically by the View Updater during the refresh loop. */ - virtual void rebuild(){}; - virtual void refresh(){}; + virtual void rebuild() {}; + virtual void refresh() {}; /* hasChild True if the window with id 'id' exists in the stack. */ diff --git a/src/gui/dispatcher.cpp b/src/gui/dispatcher.cpp index 4c3a747fb..07313f425 100644 --- a/src/gui/dispatcher.cpp +++ b/src/gui/dispatcher.cpp @@ -68,12 +68,13 @@ void Dispatcher::perform(ID channelId, int event) const /* -------------------------------------------------------------------------- */ -/* Walk channels array, trying to match button's bound key with the event. If +/* Walk channels array, trying to match button's bound key with the event. If found, trigger the key-press/key-release function. */ void Dispatcher::dispatchChannels(int event) const { - m_mainWindow->keyboard->forEachChannel([this, event](geChannel& c) { + m_mainWindow->keyboard->forEachChannel([this, event](geChannel& c) + { if (c.handleKey(event)) perform(c.getData().id, event); }); @@ -86,7 +87,7 @@ void Dispatcher::dispatchKey(int event) assert(onEventOccured != nullptr); assert(m_model != nullptr); - /* These events come from the keyboard, not from a direct interaction on the + /* These events come from the keyboard, not from a direct interaction on the UI with the mouse/touch. */ if (event == FL_KEYDOWN) diff --git a/src/gui/dispatcher.h b/src/gui/dispatcher.h index e0f52f51b..3bd950adc 100644 --- a/src/gui/dispatcher.h +++ b/src/gui/dispatcher.h @@ -40,23 +40,23 @@ class Dispatcher final public: Dispatcher(); - /* init + /* init Initializes internal reference to gdMainWindow. */ void init(gdMainWindow&, const Model&); /* dispatchKey - Processes a key pressed on the physical keyboard. */ + Processes a key pressed on the physical keyboard. */ void dispatchKey(int event); /* dispatchTouch - Processes a mouse click/touch event. */ + Processes a mouse click/touch event. */ void dispatchTouch(const geChannel& gch, bool status); /* onEventOccured - Callback fired when a key has been pressed or a mouse button clicked. */ + Callback fired when a key has been pressed or a mouse button clicked. */ std::function onEventOccured; @@ -64,8 +64,8 @@ class Dispatcher final void perform(ID channelId, int event) const; /* dispatchChannels - Walks channels array, trying to match button's bound key with the event. If - found, trigger the key-press/key-release function. */ + Walks channels array, trying to match button's bound key with the event. If + found, trigger the key-press/key-release function. */ void dispatchChannels(int event) const; diff --git a/src/gui/elems/actionEditor/baseActionEditor.cpp b/src/gui/elems/actionEditor/baseActionEditor.cpp index 316bb0485..0bf1f4162 100644 --- a/src/gui/elems/actionEditor/baseActionEditor.cpp +++ b/src/gui/elems/actionEditor/baseActionEditor.cpp @@ -97,7 +97,7 @@ void geBaseActionEditor::baseDraw(bool clear) const void geBaseActionEditor::drawVerticals(int steps) const { - /* Start drawing from steps, not from 0. The zero-th element is always + /* Start drawing from steps, not from 0. The zero-th element is always graphically useless. */ for (Frame i = steps; i < m_data->framesInLoop; i += steps) { diff --git a/src/gui/elems/actionEditor/gridTool.cpp b/src/gui/elems/actionEditor/gridTool.cpp index 308a6442b..fcd209426 100644 --- a/src/gui/elems/actionEditor/gridTool.cpp +++ b/src/gui/elems/actionEditor/gridTool.cpp @@ -1,28 +1,28 @@ /* ----------------------------------------------------------------------------- -* -* Giada - Your Hardcore Loopmachine -* -* ------------------------------------------------------------------------------ -* -* Copyright (C) 2010-2024 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 -* . -* -* --------------------------------------------------------------------------- */ + * + * Giada - Your Hardcore Loopmachine + * + * ------------------------------------------------------------------------------ + * + * Copyright (C) 2010-2024 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 + * . + * + * --------------------------------------------------------------------------- */ #include "gui/elems/actionEditor/gridTool.h" #include "gui/elems/basics/check.h" @@ -48,7 +48,8 @@ geGridTool::geGridTool(Pixel x, Pixel y, const Model& model) gridType->addItem("16"); gridType->addItem("32"); gridType->showItem(0); - gridType->onChange = [this](ID) { + gridType->onChange = [this](ID) + { window()->redraw(); }; diff --git a/src/gui/elems/actionEditor/pianoRoll.cpp b/src/gui/elems/actionEditor/pianoRoll.cpp index 12ba93c32..40b3faf52 100644 --- a/src/gui/elems/actionEditor/pianoRoll.cpp +++ b/src/gui/elems/actionEditor/pianoRoll.cpp @@ -118,7 +118,7 @@ void gePianoRoll::onDeleteAction() void gePianoRoll::onMoveAction() { - /* Y computation: - (CELL_H/2) is wrong: we should need the y pick value as + /* Y computation: - (CELL_H/2) is wrong: we should need the y pick value as done with x. Let's change this when vertical piano zoom will be available. */ Pixel ex = Fl::event_x() - m_action->pick; diff --git a/src/gui/elems/actionEditor/pianoRollLegend.cpp b/src/gui/elems/actionEditor/pianoRollLegend.cpp index b0d383bc8..b6d605784 100644 --- a/src/gui/elems/actionEditor/pianoRollLegend.cpp +++ b/src/gui/elems/actionEditor/pianoRollLegend.cpp @@ -51,7 +51,7 @@ void gePianoRollLegend::geContent::drawOffscreen() m_offscreen = fl_create_offscreen(gePianoRoll::CELL_W, h()); fl_begin_offscreen(m_offscreen); - /* Warning: only w() and h() come from this widget, x and y coordinates are + /* Warning: only w() and h() come from this widget, x and y coordinates are absolute, since we are writing in a memory chunk. */ fl_rectf(0, 0, gePianoRoll::CELL_W, h(), G_COLOR_GREY_1_5); diff --git a/src/gui/elems/actionEditor/sampleActionEditor.cpp b/src/gui/elems/actionEditor/sampleActionEditor.cpp index 7e54fc508..72f27f12f 100644 --- a/src/gui/elems/actionEditor/sampleActionEditor.cpp +++ b/src/gui/elems/actionEditor/sampleActionEditor.cpp @@ -81,7 +81,7 @@ void geSampleActionEditor::rebuild(c::actionEditor::Data& d) resizable(gsa); } - /* If channel is LOOP_ANY, deactivate it: a loop mode channel cannot hold + /* If channel is LOOP_ANY, deactivate it: a loop mode channel cannot hold keypress/keyrelease actions. */ isAnyLoopMode ? deactivate() : activate(); @@ -93,13 +93,13 @@ void geSampleActionEditor::rebuild(c::actionEditor::Data& d) void geSampleActionEditor::draw() { - /* Force height to match its parent's height. This widget belongs to a + /* Force height to match its parent's height. This widget belongs to a geScroll container (see geSplitScroll class in baseActionEditor.h) but there's nothing to scroll here actually. */ size(w(), parent()->h()); - /* Draw basic boundaries (+ beat bars) and hide the unused area. Then draw + /* Draw basic boundaries (+ beat bars) and hide the unused area. Then draw children (the actions). */ baseDraw(); diff --git a/src/gui/elems/actionEditor/splitScroll.cpp b/src/gui/elems/actionEditor/splitScroll.cpp index 73cae8f5a..9e9f82a47 100644 --- a/src/gui/elems/actionEditor/splitScroll.cpp +++ b/src/gui/elems/actionEditor/splitScroll.cpp @@ -1,28 +1,28 @@ /* ----------------------------------------------------------------------------- -* -* Giada - Your Hardcore Loopmachine -* -* ------------------------------------------------------------------------------ -* -* Copyright (C) 2010-2024 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 -* . -* -* --------------------------------------------------------------------------- */ + * + * Giada - Your Hardcore Loopmachine + * + * ------------------------------------------------------------------------------ + * + * Copyright (C) 2010-2024 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 + * . + * + * --------------------------------------------------------------------------- */ #include "splitScroll.h" #include "gui/drawing.h" @@ -53,22 +53,26 @@ geSplitScroll::geSplitScroll(Pixel x, Pixel y, Pixel w, Pixel h) end(); m_scrollbar->type(FL_HORIZONTAL); - m_scrollbar->onScroll = [this](float v) { + m_scrollbar->onScroll = [this](float v) + { m_a.scroll_to(v, m_a.yposition()); m_b.scroll_to(v, m_b.yposition()); }; - m_body->onDragBar = [this](const Fl_Widget&) { + m_body->onDragBar = [this](const Fl_Widget&) + { if (onDragBar) onDragBar(); }; - m_a.onScrollV = [this](Pixel y) { + m_a.onScrollV = [this](Pixel y) + { if (onScrollV) onScrollV(y); }; - m_b.onScrollH = [&a = m_a](Pixel x) { + m_b.onScrollH = [&a = m_a](Pixel x) + { a.scroll_to(x, a.yposition()); }; } diff --git a/src/gui/elems/actionEditor/velocityEditor.h b/src/gui/elems/actionEditor/velocityEditor.h index 504935c4f..77d3f231c 100644 --- a/src/gui/elems/actionEditor/velocityEditor.h +++ b/src/gui/elems/actionEditor/velocityEditor.h @@ -43,9 +43,9 @@ class geVelocityEditor : public geBaseActionEditor private: void onMoveAction() override; void onRefreshAction() override; - void onAddAction() override{}; - void onDeleteAction() override{}; - void onResizeAction() override{}; + void onAddAction() override {}; + void onDeleteAction() override {}; + void onResizeAction() override {}; Pixel valueToY(float v) const; float yToValue(Pixel y) const; diff --git a/src/gui/elems/basics/button.h b/src/gui/elems/basics/button.h index aee7807e6..d535a88c9 100644 --- a/src/gui/elems/basics/button.h +++ b/src/gui/elems/basics/button.h @@ -54,7 +54,7 @@ class geButton : public Fl_Button void setToggleable(bool); /* setValue - Sets the button into a particular graphical state. The state will change + Sets the button into a particular graphical state. The state will change when the button is pressed or released. No callback fired. */ void setValue(bool); diff --git a/src/gui/elems/basics/choice.cpp b/src/gui/elems/basics/choice.cpp index e2ade70f7..88c1608a3 100644 --- a/src/gui/elems/basics/choice.cpp +++ b/src/gui/elems/basics/choice.cpp @@ -173,7 +173,8 @@ std::size_t geChoice::countItems() const bool geChoice::hasItem(ID oid) const { - return u::vector::has(m_ids, [oid](const ID& id) { return oid == id; }); + return u::vector::has(m_ids, [oid](const ID& id) + { return oid == id; }); } /* -------------------------------------------------------------------------- */ diff --git a/src/gui/elems/basics/choice.h b/src/gui/elems/basics/choice.h index ecb9e703f..3a87335eb 100644 --- a/src/gui/elems/basics/choice.h +++ b/src/gui/elems/basics/choice.h @@ -40,7 +40,7 @@ namespace giada::v class geChoice : public geFlex { public: - /* geChoice + /* geChoice Constructors. If label is != nullptr but labelWidth is not specified, the label width is automatically computed and adjusted accordingly. */ diff --git a/src/gui/elems/basics/flex.h b/src/gui/elems/basics/flex.h index f10ac5e97..80256c92a 100644 --- a/src/gui/elems/basics/flex.h +++ b/src/gui/elems/basics/flex.h @@ -36,7 +36,7 @@ namespace giada::v { /* geFlex -Like a FlexBox item, it's a group that contains widgets that can be stretched +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_Flex diff --git a/src/gui/elems/basics/flexResizable.cpp b/src/gui/elems/basics/flexResizable.cpp index f68e3a3fa..632c268a8 100644 --- a/src/gui/elems/basics/flexResizable.cpp +++ b/src/gui/elems/basics/flexResizable.cpp @@ -52,7 +52,7 @@ void geFlexResizable::resize(int newX, int newY, int newW, int newH) { geFlex::resize(newX, newY, newW, newH); - /* In Mode::RESIZE, we must make sure the last widget, which is flex by + /* In Mode::RESIZE, we must make sure the last widget, which is flex by default, doesn't get shrinked lower than G_GUI_UNIT when this flex container is resized. If it happens, the trick is to make the last widget fixed, while everything else flex. */ @@ -73,8 +73,8 @@ void geFlexResizable::resize(int newX, int newY, int newW, int newH) void geFlexResizable::addWidget(Fl_Widget& widget, int size) { - /* In RESIZE mode the bar is added before the widget, but only if there - is at least one child. */ + /* In RESIZE mode the bar is added before the widget, but only if there + is at least one child. */ if (m_mode == geResizerBar::Mode::RESIZE && children() > 0) addResizerBar(); @@ -181,13 +181,14 @@ void geFlexResizable::makeLastWidgetFixed() void geFlexResizable::addResizerBar() { /* TODO - geResizerBar is glitchy when added in a flex layout: if width or - height is 0 it just doesn't show up. */ + height is 0 it just doesn't show up. */ geResizerBar* bar = new geResizerBar(0, 0, G_GUI_INNER_MARGIN, G_GUI_INNER_MARGIN, G_GUI_UNIT, getDirection(), m_mode); geFlex::addWidget(bar, G_GUI_INNER_MARGIN); m_bars.push_back(bar); - bar->onDrag = [this](const Fl_Widget& wg) { + bar->onDrag = [this](const Fl_Widget& wg) + { if (onDragBar != nullptr) onDragBar(wg); @@ -199,7 +200,8 @@ void geFlexResizable::addResizerBar() /* The widget connected to the drag bar becomes fixed, when resized. */ - bar->onRelease = [this](const Fl_Widget& wg) { + bar->onRelease = [this](const Fl_Widget& wg) + { geFlex::fixed(const_cast(wg), getWidgetMainSize(wg)); }; } diff --git a/src/gui/elems/basics/group.cpp b/src/gui/elems/basics/group.cpp index 54f640017..ea65b56b6 100644 --- a/src/gui/elems/basics/group.cpp +++ b/src/gui/elems/basics/group.cpp @@ -67,7 +67,7 @@ void geGroup::add(Fl_Widget* widget) } /* Don't call size(newW, newH) as it changes widgets position. Adjust width - and height manually instead. */ + and height manually instead. */ w(newW); h(newH); diff --git a/src/gui/elems/basics/group.h b/src/gui/elems/basics/group.h index 57a6f81ad..39bc8ee80 100644 --- a/src/gui/elems/basics/group.h +++ b/src/gui/elems/basics/group.h @@ -47,16 +47,16 @@ class geGroup : public Fl_Group geGroup(int x, int y); /* countChildren - Returns the number of widgets contained in this group. */ + Returns the number of widgets contained in this group. */ std::size_t countChildren() const; /* add - Adds a Fl_Widget 'w' to this group. Coordinates are relative to the group, - so origin starts at (0, 0). As with any other FLTK group, the widget becomes - owned by this group: If you add static or automatic (local) variables, then + Adds a Fl_Widget 'w' to this group. Coordinates are relative to the group, + so origin starts at (0, 0). As with any other FLTK group, the widget becomes + owned by this group: If you add static or automatic (local) variables, then it is your responsibility to remove (or delete) all such static or automatic - child widgets before destroying the group - otherwise the child widgets' + child widgets before destroying the group - otherwise the child widgets' destructors would be called twice! */ void add(Fl_Widget* w); @@ -65,9 +65,9 @@ class geGroup : public Fl_Group Fl_Widget* getLastChild(); private: - /* m_widgets - The internal Fl_Scroll::array_ is unreliable when inspected with the child() - method. Let's keep track of widgets that belong to this group manually. */ + /* m_widgets + The internal Fl_Scroll::array_ is unreliable when inspected with the child() + method. Let's keep track of widgets that belong to this group manually. */ std::vector m_widgets; }; diff --git a/src/gui/elems/basics/liquidScroll.h b/src/gui/elems/basics/liquidScroll.h index 9d82b7714..4705dab9c 100644 --- a/src/gui/elems/basics/liquidScroll.h +++ b/src/gui/elems/basics/liquidScroll.h @@ -55,7 +55,7 @@ class geLiquidScroll : public geScroll void resize(int x, int y, int w, int h) override; /* addWidget - Adds a new widget to the bottom, with proper spacing. */ + Adds a new widget to the bottom, with proper spacing. */ void addWidget(Fl_Widget*); diff --git a/src/gui/elems/basics/pack.h b/src/gui/elems/basics/pack.h index 9df225856..7816e60e3 100644 --- a/src/gui/elems/basics/pack.h +++ b/src/gui/elems/basics/pack.h @@ -45,11 +45,11 @@ class gePack : public geGroup gePack(int x, int y, Direction d, int gutter = G_GUI_INNER_MARGIN); /* add - Adds a Fl_Widget 'w' to this pack. Coordinates are relative to the group, - so origin starts at (0, 0). As with any other FLTK group, the widget becomes - owned by this group: If you add static or automatic (local) variables, then + Adds a Fl_Widget 'w' to this pack. Coordinates are relative to the group, + so origin starts at (0, 0). As with any other FLTK group, the widget becomes + owned by this group: If you add static or automatic (local) variables, then it is your responsibility to remove (or delete) all such static or automatic - child widgets before destroying the group - otherwise the child widgets' + child widgets before destroying the group - otherwise the child widgets' destructors would be called twice! */ void add(Fl_Widget* w); diff --git a/src/gui/elems/basics/resizerBar.cpp b/src/gui/elems/basics/resizerBar.cpp index 0ff613ae5..6133c1191 100644 --- a/src/gui/elems/basics/resizerBar.cpp +++ b/src/gui/elems/basics/resizerBar.cpp @@ -62,7 +62,8 @@ void geResizerBar::handleDrag(int diff) void geResizerBar::move(int diff) { Fl_Widget& wfirst = getFirstWidget(); - std::vector wothers = findWidgets([this](const Fl_Widget& wd) { return isAfter(wd); }); + std::vector wothers = findWidgets([this](const Fl_Widget& wd) + { return isAfter(wd); }); if (m_direction == Direction::VERTICAL) { @@ -89,7 +90,8 @@ void geResizerBar::move(int diff) void geResizerBar::resize(int diff) { Fl_Widget& wa = getFirstWidget(); - Fl_Widget& wb = *findWidgets([this](const Fl_Widget& wd) { return isAfter(wd); }, /*howmany=*/1)[0]; + Fl_Widget& wb = *findWidgets([this](const Fl_Widget& wd) + { return isAfter(wd); }, /*howmany=*/1)[0]; if (m_direction == Direction::VERTICAL) { @@ -131,7 +133,8 @@ bool geResizerBar::isAfter(const Fl_Widget& wd) const Fl_Widget& geResizerBar::getFirstWidget() { - return *findWidgets([this](const Fl_Widget& wd) { return isBefore(wd); }, /*howmany=*/1)[0]; + return *findWidgets([this](const Fl_Widget& wd) + { return isBefore(wd); }, /*howmany=*/1)[0]; } /* -------------------------------------------------------------------------- */ @@ -151,7 +154,7 @@ std::vector geResizerBar::findWidgets(std::functiony() + w->h() == this->y() if Direction::VERTICAL. + - Parent is an Fl_Group; + - The widget before us has an edge touching our edge; + ie. w->y() + w->h() == this->y() if Direction::VERTICAL. When this widget is dragged: - - The widget before us (with a common edge) will be resized; - - if Mode == MOVE - All children after us will be moved. - - else if Mode == RESIZE - The child after us is resized. */ + - The widget before us (with a common edge) will be resized; + - if Mode == MOVE + All children after us will be moved. + - else if Mode == RESIZE + The child after us is resized. */ namespace giada::v { @@ -101,7 +101,7 @@ class geResizerBar : public Fl_Box void move(int diff); - /* resize + /* resize Resize the first and the second widget, leaving all others untouched. */ void resize(int diff); diff --git a/src/gui/elems/basics/scrollPack.h b/src/gui/elems/basics/scrollPack.h index 3fc897e00..829cb41e6 100644 --- a/src/gui/elems/basics/scrollPack.h +++ b/src/gui/elems/basics/scrollPack.h @@ -45,7 +45,7 @@ class geScrollPack : public geScroll Direction d = Direction::HORIZONTAL, int gutter = G_GUI_INNER_MARGIN); /* countChildren - Returns the number of widgets contained in this group. */ + Returns the number of widgets contained in this group. */ std::size_t countChildren() const; @@ -55,9 +55,9 @@ class geScrollPack : public geScroll Fl_Widget* getLastChild(); private: - /* m_widgets - The internal Fl_Scroll::array_ is unreliable when inspected with the child() - method. Let's keep track of widgets that belong to this group manually. */ + /* m_widgets + The internal Fl_Scroll::array_ is unreliable when inspected with the child() + method. Let's keep track of widgets that belong to this group manually. */ std::vector m_widgets; diff --git a/src/gui/elems/basics/scrollbar.cpp b/src/gui/elems/basics/scrollbar.cpp index dc17db10d..c54c6557a 100644 --- a/src/gui/elems/basics/scrollbar.cpp +++ b/src/gui/elems/basics/scrollbar.cpp @@ -42,7 +42,8 @@ geScrollbar::geScrollbar() labelcolor(G_COLOR_LIGHT_1); slider(G_CUSTOM_BORDER_BOX); - callback([](Fl_Widget* w) { + callback([](Fl_Widget* w) + { const geScrollbar* self = static_cast(w); if (self->onScroll) self->onScroll(self->value()); diff --git a/src/gui/elems/config/tabAudio.cpp b/src/gui/elems/config/tabAudio.cpp index 491860f96..a5fd47e94 100644 --- a/src/gui/elems/config/tabAudio.cpp +++ b/src/gui/elems/config/tabAudio.cpp @@ -214,7 +214,8 @@ geTabAudio::geTabAudio(geompp::Rect bounds) add(body); resizable(body); - m_api->onChange = [this](ID id) { + m_api->onChange = [this](ID id) + { m_data.api = static_cast(id); deactivateAll(); c::config::changeAudioAPI(static_cast(id)); @@ -222,35 +223,42 @@ geTabAudio::geTabAudio(geompp::Rect bounds) activateAll(); }; - m_sampleRate->onChange = [this](ID id) { m_data.sampleRate = id; }; + m_sampleRate->onChange = [this](ID id) + { m_data.sampleRate = id; }; - m_sounddevOut->onChange = [this](ID id) { + m_sounddevOut->onChange = [this](ID id) + { m_data.setOutputDevice(id); refreshDevOutProperties(); }; - m_sounddevIn->onChange = [this](ID id) { + m_sounddevIn->onChange = [this](ID id) + { m_data.setInputDevice(id); refreshDevInProperties(); }; m_enableIn->copy_tooltip(g_ui->getI18Text(LangMap::CONFIG_AUDIO_ENABLEINPUT)); - m_enableIn->onChange = [this](bool b) { + m_enableIn->onChange = [this](bool b) + { m_data.toggleInputDevice(b); refreshDevInProperties(); }; - m_channelsOut->onChange = [this](ID) { + m_channelsOut->onChange = [this](ID) + { m_data.outputDevice.channelsCount = m_channelsOut->getChannelsCount(); m_data.outputDevice.channelsStart = m_channelsOut->getChannelsStart(); }; - m_channelsIn->onChange = [this](ID) { + m_channelsIn->onChange = [this](ID) + { m_data.inputDevice.channelsCount = m_channelsIn->getChannelsCount(); m_data.inputDevice.channelsStart = m_channelsIn->getChannelsStart(); }; - m_limitOutput->onChange = [this](bool v) { m_data.limitOutput = v; }; + m_limitOutput->onChange = [this](bool v) + { m_data.limitOutput = v; }; m_bufferSize->addItem("8", 8); m_bufferSize->addItem("16", 16); @@ -262,7 +270,8 @@ geTabAudio::geTabAudio(geompp::Rect bounds) m_bufferSize->addItem("1024", 1024); m_bufferSize->addItem("2048", 2048); m_bufferSize->addItem("4096", 4096); - m_bufferSize->onChange = [this](ID id) { m_data.bufferSize = id; }; + m_bufferSize->onChange = [this](ID id) + { m_data.bufferSize = id; }; m_rsmpQuality->addItem(g_ui->getI18Text(LangMap::CONFIG_AUDIO_RESAMPLING_SINCBEST), 0); m_rsmpQuality->addItem(g_ui->getI18Text(LangMap::CONFIG_AUDIO_RESAMPLING_SINCMEDIUM), 1); @@ -270,11 +279,14 @@ geTabAudio::geTabAudio(geompp::Rect bounds) m_rsmpQuality->addItem(g_ui->getI18Text(LangMap::CONFIG_AUDIO_RESAMPLING_ZEROORDER), 3); m_rsmpQuality->addItem(g_ui->getI18Text(LangMap::CONFIG_AUDIO_RESAMPLING_LINEAR), 4); - m_rsmpQuality->onChange = [this](ID id) { m_data.resampleQuality = id; }; + m_rsmpQuality->onChange = [this](ID id) + { m_data.resampleQuality = id; }; - m_recTriggerLevel->onChange = [this](const std::string& s) { m_data.recTriggerLevel = std::stof(s); }; + m_recTriggerLevel->onChange = [this](const std::string& s) + { m_data.recTriggerLevel = std::stof(s); }; - m_applyBtn->onClick = [this]() { c::config::apply(m_data); }; + m_applyBtn->onClick = [this]() + { c::config::apply(m_data); }; rebuild(c::config::getAudioData()); } diff --git a/src/gui/elems/config/tabBehaviors.cpp b/src/gui/elems/config/tabBehaviors.cpp index 8ad86727d..f43da9367 100644 --- a/src/gui/elems/config/tabBehaviors.cpp +++ b/src/gui/elems/config/tabBehaviors.cpp @@ -60,25 +60,29 @@ geTabBehaviors::geTabBehaviors(geompp::Rect bounds) resizable(body); m_chansStopOnSeqHalt->value(m_data.chansStopOnSeqHalt); - m_chansStopOnSeqHalt->onChange = [this](bool v) { + m_chansStopOnSeqHalt->onChange = [this](bool v) + { m_data.chansStopOnSeqHalt = v; c::config::save(m_data); }; m_treatRecsAsLoops->value(m_data.treatRecsAsLoops); - m_treatRecsAsLoops->onChange = [this](bool v) { + m_treatRecsAsLoops->onChange = [this](bool v) + { m_data.treatRecsAsLoops = v; c::config::save(m_data); }; m_inputMonitorDefaultOn->value(m_data.inputMonitorDefaultOn); - m_inputMonitorDefaultOn->onChange = [this](bool v) { + m_inputMonitorDefaultOn->onChange = [this](bool v) + { m_data.inputMonitorDefaultOn = v; c::config::save(m_data); }; m_overdubProtectionDefaultOn->value(m_data.overdubProtectionDefaultOn); - m_overdubProtectionDefaultOn->onChange = [this](bool v) { + m_overdubProtectionDefaultOn->onChange = [this](bool v) + { m_data.overdubProtectionDefaultOn = v; c::config::save(m_data); }; diff --git a/src/gui/elems/config/tabBindings.cpp b/src/gui/elems/config/tabBindings.cpp index 71df62abb..9119385ff 100644 --- a/src/gui/elems/config/tabBindings.cpp +++ b/src/gui/elems/config/tabBindings.cpp @@ -58,10 +58,15 @@ geTabBindings::geTabBindings(geompp::Rect bounds, const Model& model) add(body); resizable(body); - play->onKeyBound = [](int key) { g_ui->model.keyBindPlay = key; }; - rewind->onKeyBound = [](int key) { g_ui->model.keyBindRewind = key; }; - recordActions->onKeyBound = [](int key) { g_ui->model.keyBindRecordActions = key; }; - recordInput->onKeyBound = [](int key) { g_ui->model.keyBindRecordInput = key; }; - exit->onKeyBound = [](int key) { g_ui->model.keyBindExit = key; }; + play->onKeyBound = [](int key) + { g_ui->model.keyBindPlay = key; }; + rewind->onKeyBound = [](int key) + { g_ui->model.keyBindRewind = key; }; + recordActions->onKeyBound = [](int key) + { g_ui->model.keyBindRecordActions = key; }; + recordInput->onKeyBound = [](int key) + { g_ui->model.keyBindRecordInput = key; }; + exit->onKeyBound = [](int key) + { g_ui->model.keyBindExit = key; }; } } // namespace giada::v \ No newline at end of file diff --git a/src/gui/elems/config/tabMidi.cpp b/src/gui/elems/config/tabMidi.cpp index ddc3e940f..c43dc4af7 100644 --- a/src/gui/elems/config/tabMidi.cpp +++ b/src/gui/elems/config/tabMidi.cpp @@ -54,7 +54,7 @@ geTabMidi::geTabMidi(geompp::Rect bounds) geFlex* line1 = new geFlex(Direction::HORIZONTAL, G_GUI_OUTER_MARGIN); { m_portOut = new geStringMenu(g_ui->getI18Text(LangMap::CONFIG_MIDI_OUTPUTPORT), - g_ui->getI18Text(LangMap::CONFIG_MIDI_NOPORTSFOUND), LABEL_WIDTH); + g_ui->getI18Text(LangMap::CONFIG_MIDI_NOPORTSFOUND), LABEL_WIDTH); m_enableOut = new geCheck(0, 0, 0, 0); line1->addWidget(m_portOut); @@ -65,7 +65,7 @@ geTabMidi::geTabMidi(geompp::Rect bounds) geFlex* line2 = new geFlex(Direction::HORIZONTAL, G_GUI_OUTER_MARGIN); { m_portIn = new geStringMenu(g_ui->getI18Text(LangMap::CONFIG_MIDI_INPUTPORT), - g_ui->getI18Text(LangMap::CONFIG_MIDI_NOPORTSFOUND), LABEL_WIDTH); + g_ui->getI18Text(LangMap::CONFIG_MIDI_NOPORTSFOUND), LABEL_WIDTH); m_enableIn = new geCheck(0, 0, 0, 0); line2->addWidget(m_portIn); @@ -107,17 +107,21 @@ geTabMidi::geTabMidi(geompp::Rect bounds) add(body); resizable(body); - m_system->onChange = [this](ID id) { + m_system->onChange = [this](ID id) + { c::config::changeMidiAPI(static_cast(id)); rebuild(c::config::getMidiData()); }; - m_portOut->onChange = [this](ID id) { m_data.outPort = id; }; + m_portOut->onChange = [this](ID id) + { m_data.outPort = id; }; - m_portIn->onChange = [this](ID id) { m_data.inPort = id; }; + m_portIn->onChange = [this](ID id) + { m_data.inPort = id; }; m_enableOut->copy_tooltip(g_ui->getI18Text(LangMap::CONFIG_MIDI_LABEL_ENABLEOUT)); - m_enableOut->onChange = [this](bool b) { + m_enableOut->onChange = [this](bool b) + { if (m_data.outPorts.empty()) return; if (b) @@ -133,7 +137,8 @@ geTabMidi::geTabMidi(geompp::Rect bounds) }; m_enableIn->copy_tooltip(g_ui->getI18Text(LangMap::CONFIG_MIDI_LABEL_ENABLEIN)); - m_enableIn->onChange = [this](bool b) { + m_enableIn->onChange = [this](bool b) + { if (m_data.inPorts.empty()) return; if (b) @@ -148,17 +153,20 @@ geTabMidi::geTabMidi(geompp::Rect bounds) } }; - m_midiMap->onChange = [this](ID id) { + m_midiMap->onChange = [this](ID id) + { m_data.midiMap = id; c::config::setMidiMapPath(m_data.getMidiMapByIndex(id)); }; - m_sync->onChange = [this](ID id) { + m_sync->onChange = [this](ID id) + { m_data.syncMode = id; c::config::setMidiSyncMode(m_data.syncMode); }; - m_applyBtn->onClick = [this]() { c::config::apply(m_data); }; + m_applyBtn->onClick = [this]() + { c::config::apply(m_data); }; rebuild(c::config::getMidiData()); } diff --git a/src/gui/elems/config/tabMisc.cpp b/src/gui/elems/config/tabMisc.cpp index caa2bf8bc..5cdd819f2 100644 --- a/src/gui/elems/config/tabMisc.cpp +++ b/src/gui/elems/config/tabMisc.cpp @@ -51,7 +51,7 @@ geTabMisc::geTabMisc(geompp::Rect bounds) m_debugMsg = new geChoice(g_ui->getI18Text(LangMap::CONFIG_MISC_DEBUGMESSAGES), LABEL_WIDTH); m_tooltips = new geChoice(g_ui->getI18Text(LangMap::CONFIG_MISC_TOOLTIPS), LABEL_WIDTH); m_langMap = new geStringMenu(g_ui->getI18Text(LangMap::CONFIG_MISC_LANGUAGE), - g_ui->getI18Text(LangMap::CONFIG_MISC_NOLANGUAGESFOUND), LABEL_WIDTH); + g_ui->getI18Text(LangMap::CONFIG_MISC_NOLANGUAGESFOUND), LABEL_WIDTH); m_uiScaling = new geChoice(g_ui->getI18Text(LangMap::CONFIG_MISC_UISCALING), LABEL_WIDTH); body->addWidget(m_debugMsg, G_GUI_UNIT); @@ -69,7 +69,8 @@ geTabMisc::geTabMisc(geompp::Rect bounds) m_debugMsg->addItem(g_ui->getI18Text(LangMap::CONFIG_MISC_DEBUGMESSAGES_TOSTDOUT)); m_debugMsg->addItem(g_ui->getI18Text(LangMap::CONFIG_MISC_DEBUGMESSAGES_TOFILE)); m_debugMsg->showItem(m_data.logMode); - m_debugMsg->onChange = [this](ID id) { + m_debugMsg->onChange = [this](ID id) + { m_data.logMode = id; c::config::save(m_data); }; @@ -77,7 +78,8 @@ geTabMisc::geTabMisc(geompp::Rect bounds) m_tooltips->addItem(g_ui->getI18Text(LangMap::CONFIG_MISC_TOOLTIPS_DISABLED)); m_tooltips->addItem(g_ui->getI18Text(LangMap::CONFIG_MISC_TOOLTIPS_ENABLED)); m_tooltips->showItem(m_data.showTooltips); - m_tooltips->onChange = [this](ID id) { + m_tooltips->onChange = [this](ID id) + { m_data.showTooltips = id; c::config::save(m_data); }; @@ -88,7 +90,8 @@ geTabMisc::geTabMisc(geompp::Rect bounds) m_langMap->showItem(0); else m_langMap->showItem(m_data.langMap); - m_langMap->onChange = [this](ID /*id*/) { + m_langMap->onChange = [this](ID /*id*/) + { m_data.langMap = m_langMap->getSelectedLabel(); c::config::save(m_data); }; @@ -100,7 +103,8 @@ geTabMisc::geTabMisc(geompp::Rect bounds) m_uiScaling->addItem("250%", 250); m_uiScaling->addItem("300%", 300); m_uiScaling->showItem(static_cast(m_data.uiScaling * 100)); - m_uiScaling->onChange = [this](ID id) { + m_uiScaling->onChange = [this](ID id) + { m_data.uiScaling = id / 100.0f; c::config::save(m_data); }; diff --git a/src/gui/elems/config/tabPlugins.cpp b/src/gui/elems/config/tabPlugins.cpp index 3a3ff59eb..692ac5207 100644 --- a/src/gui/elems/config/tabPlugins.cpp +++ b/src/gui/elems/config/tabPlugins.cpp @@ -75,20 +75,25 @@ geTabPlugins::geTabPlugins(geompp::Rect bounds) add(body); resizable(body); - m_folderPath->onChange = [this](const std::string& v) { + m_folderPath->onChange = [this](const std::string& v) + { m_data.pluginPath = v; c::config::save(m_data); }; - m_browse->onClick = [this]() { + m_browse->onClick = [this]() + { c::layout::openBrowserForPlugins(*static_cast(top_window())); }; - m_scanButton->onClick = [this]() { - bool shouldScan = true; - auto onCancelCb = [&shouldScan]() { shouldScan = false; }; + m_scanButton->onClick = [this]() + { + bool shouldScan = true; + auto onCancelCb = [&shouldScan]() + { shouldScan = false; }; auto uiProgress = g_ui->mainWindow->getScopedProgress(g_ui->getI18Text(LangMap::CONFIG_PLUGINS_SCANNING), onCancelCb); - auto engineProgressCb = [&shouldScan, &uiProgress](float progress) { + auto engineProgressCb = [&shouldScan, &uiProgress](float progress) + { uiProgress.setProgress(progress); return shouldScan; }; diff --git a/src/gui/elems/keyBinder.cpp b/src/gui/elems/keyBinder.cpp index 84fda94e7..e7bacb4f5 100644 --- a/src/gui/elems/keyBinder.cpp +++ b/src/gui/elems/keyBinder.cpp @@ -57,9 +57,11 @@ geKeyBinder::geKeyBinder(const std::string& l, int key) m_labelBox->box(G_CUSTOM_BORDER_BOX); m_keyBox->box(G_CUSTOM_BORDER_BOX); - m_bindBtn->onClick = [key, this]() { + m_bindBtn->onClick = [key, this]() + { assert(onKeyBound != nullptr); - c::layout::openKeyGrabberWindow(key, [this](int newKey) { + c::layout::openKeyGrabberWindow(key, [this](int newKey) + { m_key = newKey; m_keyBox->copy_label(u::gui::keyToString(m_key).c_str()); onKeyBound(newKey); @@ -67,7 +69,8 @@ geKeyBinder::geKeyBinder(const std::string& l, int key) }); }; - m_clearBtn->onClick = [key, this]() { + m_clearBtn->onClick = [key, this]() + { m_key = 0; m_keyBox->copy_label(u::gui::keyToString(key).c_str()); }; diff --git a/src/gui/elems/mainWindow/keyboard/groupChannel.cpp b/src/gui/elems/mainWindow/keyboard/groupChannel.cpp index 3d8f59f62..b45565f3c 100644 --- a/src/gui/elems/mainWindow/keyboard/groupChannel.cpp +++ b/src/gui/elems/mainWindow/keyboard/groupChannel.cpp @@ -90,26 +90,31 @@ geGroupChannel::geGroupChannel(c::channel::Data d) vol->copy_tooltip(g_ui->getI18Text(LangMap::MAIN_CHANNEL_LABEL_VOLUME)); fx->forceValue(m_channel.plugins.size() > 0); - fx->onClick = [this]() { + fx->onClick = [this]() + { c::layout::openChannelPluginListWindow(m_channel.id); }; playButton->when(FL_WHEN_CHANGED); // On keypress && on keyrelease - playButton->onClick = [this]() { + playButton->onClick = [this]() + { g_ui->dispatcher.dispatchTouch(*this, playButton->getValue()); }; mute->setToggleable(true); - mute->onClick = [this]() { + mute->onClick = [this]() + { c::channel::toggleMuteChannel(m_channel.id, Thread::MAIN); }; solo->setToggleable(true); - solo->onClick = [this]() { + solo->onClick = [this]() + { c::channel::toggleSoloChannel(m_channel.id, Thread::MAIN); }; - mainButton->onClick = [this]() { openMenu(); }; + mainButton->onClick = [this]() + { openMenu(); }; vol->value(m_channel.volume); vol->callback(cb_changeVol, (void*)this); diff --git a/src/gui/elems/mainWindow/keyboard/midiChannel.cpp b/src/gui/elems/mainWindow/keyboard/midiChannel.cpp index 6e5402499..190a05845 100644 --- a/src/gui/elems/mainWindow/keyboard/midiChannel.cpp +++ b/src/gui/elems/mainWindow/keyboard/midiChannel.cpp @@ -99,31 +99,37 @@ geMidiChannel::geMidiChannel(int X, int Y, int W, int H, c::channel::Data d) vol->copy_tooltip(g_ui->getI18Text(LangMap::MAIN_CHANNEL_LABEL_VOLUME)); fx->setValue(m_channel.plugins.size() > 0); - fx->onClick = [this]() { + fx->onClick = [this]() + { c::layout::openChannelPluginListWindow(m_channel.id); }; playButton->when(FL_WHEN_CHANGED); // On keypress && on keyrelease - playButton->onClick = [this]() { + playButton->onClick = [this]() + { g_ui->dispatcher.dispatchTouch(*this, playButton->getValue()); }; arm->setToggleable(true); - arm->onClick = [this]() { + arm->onClick = [this]() + { c::channel::toggleArmChannel(m_channel.id, Thread::MAIN); }; mute->setToggleable(true); - mute->onClick = [this]() { + mute->onClick = [this]() + { c::channel::toggleMuteChannel(m_channel.id, Thread::MAIN); }; solo->setToggleable(true); - solo->onClick = [this]() { + solo->onClick = [this]() + { c::channel::toggleSoloChannel(m_channel.id, Thread::MAIN); }; - mainButton->onClick = [this]() { openMenu(); }; + mainButton->onClick = [this]() + { openMenu(); }; vol->value(m_channel.volume); vol->callback(cb_changeVol, (void*)this); @@ -150,7 +156,8 @@ void geMidiChannel::openMenu() if (!m_channel.hasActions) menu.setEnabled((ID)Menu::CLEAR_ACTIONS, false); - menu.onSelect = [&data = m_channel](ID id) { + menu.onSelect = [&data = m_channel](ID id) + { switch (static_cast(id)) { case Menu::EDIT_ACTIONS: @@ -160,7 +167,8 @@ void geMidiChannel::openMenu() c::channel::clearAllActions(data.id); break; case Menu::SETUP_KEYBOARD_INPUT: - c::layout::openKeyGrabberWindow(data.key, [channelId = data.id](int key) { + c::layout::openKeyGrabberWindow(data.key, [channelId = data.id](int key) + { return c::io::channel_setKey(channelId, key); }); break; diff --git a/src/gui/elems/mainWindow/keyboard/sampleChannel.cpp b/src/gui/elems/mainWindow/keyboard/sampleChannel.cpp index 18066d30c..e7646ab47 100644 --- a/src/gui/elems/mainWindow/keyboard/sampleChannel.cpp +++ b/src/gui/elems/mainWindow/keyboard/sampleChannel.cpp @@ -115,34 +115,41 @@ geSampleChannel::geSampleChannel(int X, int Y, int W, int H, c::channel::Data d) vol->copy_tooltip(g_ui->getI18Text(LangMap::MAIN_CHANNEL_LABEL_VOLUME)); fx->forceValue(m_channel.plugins.size() > 0); - fx->onClick = [this]() { + fx->onClick = [this]() + { c::layout::openChannelPluginListWindow(m_channel.id); }; playButton->when(FL_WHEN_CHANGED); // On keypress && on keyrelease - playButton->onClick = [this]() { + playButton->onClick = [this]() + { g_ui->dispatcher.dispatchTouch(*this, playButton->getValue()); }; arm->setToggleable(true); - arm->onClick = [this]() { + arm->onClick = [this]() + { c::channel::toggleArmChannel(m_channel.id, Thread::MAIN); }; mute->setToggleable(true); - mute->onClick = [this]() { + mute->onClick = [this]() + { c::channel::toggleMuteChannel(m_channel.id, Thread::MAIN); }; solo->setToggleable(true); - solo->onClick = [this]() { + solo->onClick = [this]() + { c::channel::toggleSoloChannel(m_channel.id, Thread::MAIN); }; - mainButton->onClick = [this]() { openMenu(); }; + mainButton->onClick = [this]() + { openMenu(); }; readActionsBtn->setToggleable(true); - readActionsBtn->onClick = [this]() { readActions(); }; + readActionsBtn->onClick = [this]() + { readActions(); }; vol->value(m_channel.volume); vol->callback(cb_changeVol, (void*)this); @@ -191,7 +198,8 @@ void geSampleChannel::openMenu() if (!m_channel.hasActions) menu.setEnabled((ID)Menu::CLEAR_ACTIONS, false); - menu.onSelect = [&channel = m_channel](ID id) { + menu.onSelect = [&channel = m_channel](ID id) + { switch (static_cast(id)) { case Menu::INPUT_MONITOR: @@ -211,7 +219,8 @@ void geSampleChannel::openMenu() break; case Menu::SETUP_KEYBOARD_INPUT: - c::layout::openKeyGrabberWindow(channel.key, [channelId = channel.id](int key) { + c::layout::openKeyGrabberWindow(channel.key, [channelId = channel.id](int key) + { return c::io::channel_setKey(channelId, key); }); break; diff --git a/src/gui/elems/mainWindow/keyboard/sampleChannelMode.cpp b/src/gui/elems/mainWindow/keyboard/sampleChannelMode.cpp index 1c9aae7d5..d54f7c217 100644 --- a/src/gui/elems/mainWindow/keyboard/sampleChannelMode.cpp +++ b/src/gui/elems/mainWindow/keyboard/sampleChannelMode.cpp @@ -42,7 +42,8 @@ geSampleChannelMode::geSampleChannelMode(int x, int y, int w, int h, c::channel: : geImageButton(x, y, w, h, nullptr, nullptr) , m_channel(d) { - onClick = [this]() { + onClick = [this]() + { openMenu(); }; @@ -115,7 +116,8 @@ void geSampleChannelMode::openMenu() menu.addItem((ID)SamplePlayerMode::SINGLE_RETRIG, "Oneshot - Retrig"); menu.addItem((ID)SamplePlayerMode::SINGLE_ENDLESS, "Oneshot - Endless"); - menu.onSelect = [this](ID id) { + menu.onSelect = [this](ID id) + { c::channel::setSamplePlayerMode(m_channel.id, static_cast(id)); }; diff --git a/src/gui/elems/mainWindow/mainInput.cpp b/src/gui/elems/mainWindow/mainInput.cpp index 23085fa91..447cf4960 100644 --- a/src/gui/elems/mainWindow/mainInput.cpp +++ b/src/gui/elems/mainWindow/mainInput.cpp @@ -1,28 +1,28 @@ /* ----------------------------------------------------------------------------- -* -* Giada - Your Hardcore Loopmachine -* -* ------------------------------------------------------------------------------ -* -* Copyright (C) 2010-2024 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 -* . -* -* --------------------------------------------------------------------------- */ + * + * Giada - Your Hardcore Loopmachine + * + * ------------------------------------------------------------------------------ + * + * Copyright (C) 2010-2024 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 + * . + * + * --------------------------------------------------------------------------- */ #include "gui/elems/mainWindow/mainInput.h" #include "core/const.h" @@ -64,16 +64,19 @@ geMainInput::geMainInput() m_masterFxIn->copy_tooltip(g_ui->getI18Text(LangMap::MAIN_IO_LABEL_FXIN)); m_midiIn->copy_tooltip(g_ui->getI18Text(LangMap::MAIN_IO_LABEL_MIDIINACTIVITY)); - m_inVol->onChange = [](float v) { + m_inVol->onChange = [](float v) + { c::main::setMasterInVolume(v, Thread::MAIN); }; m_inToOut->setToggleable(true); - m_inToOut->onClick = [&inToOut = m_inToOut]() { + m_inToOut->onClick = [&inToOut = m_inToOut]() + { c::main::setInToOut(inToOut->getValue()); }; - m_masterFxIn->onClick = [] { c::layout::openMasterInPluginListWindow(); }; + m_masterFxIn->onClick = [] + { c::layout::openMasterInPluginListWindow(); }; } /* -------------------------------------------------------------------------- */ diff --git a/src/gui/elems/mainWindow/mainMenu.cpp b/src/gui/elems/mainWindow/mainMenu.cpp index 1aa7b32fb..58585d83e 100644 --- a/src/gui/elems/mainWindow/mainMenu.cpp +++ b/src/gui/elems/mainWindow/mainMenu.cpp @@ -79,22 +79,32 @@ geMainMenu::geMainMenu() Fl_Menu_Item popup[] = { beginSubMenu_(LangMap::MAIN_MENU_FILE), - makeMenuItem_(LangMap::MAIN_MENU_FILE_OPENPROJECT, [](Fl_Widget*, void*) { c::layout::openBrowserForProjectLoad(); }), - makeMenuItem_(LangMap::MAIN_MENU_FILE_SAVEPROJECT, [](Fl_Widget*, void*) { c::layout::openBrowserForProjectSave(); }), - makeMenuItem_(LangMap::MAIN_MENU_FILE_CLOSEPROJECT, [](Fl_Widget*, void*) { c::main::closeProject(); }), + makeMenuItem_(LangMap::MAIN_MENU_FILE_OPENPROJECT, [](Fl_Widget*, void*) + { c::layout::openBrowserForProjectLoad(); }), + makeMenuItem_(LangMap::MAIN_MENU_FILE_SAVEPROJECT, [](Fl_Widget*, void*) + { c::layout::openBrowserForProjectSave(); }), + makeMenuItem_(LangMap::MAIN_MENU_FILE_CLOSEPROJECT, [](Fl_Widget*, void*) + { c::main::closeProject(); }), #ifdef G_DEBUG_MODE - makeMenuItem_(LangMap::MAIN_MENU_FILE_DEBUGSTATS, [](Fl_Widget*, void*) { c::main::printDebugInfo(); }), + makeMenuItem_(LangMap::MAIN_MENU_FILE_DEBUGSTATS, [](Fl_Widget*, void*) + { c::main::printDebugInfo(); }), #endif - makeMenuItem_(LangMap::MAIN_MENU_FILE_QUIT, [](Fl_Widget*, void*) { c::main::quitGiada(); }), + makeMenuItem_(LangMap::MAIN_MENU_FILE_QUIT, [](Fl_Widget*, void*) + { c::main::quitGiada(); }), endSubMenu_(), beginSubMenu_(LangMap::MAIN_MENU_EDIT), - makeMenuItem_(LangMap::MAIN_MENU_EDIT_FREEALLSAMPLES, [](Fl_Widget*, void*) { c::main::clearAllSamples(); }), - makeMenuItem_(LangMap::MAIN_MENU_EDIT_CLEARALLACTIONS, [](Fl_Widget*, void*) { c::main::clearAllActions(); }), - makeMenuItem_(LangMap::MAIN_MENU_EDIT_SETUPMIDIINPUT, [](Fl_Widget*, void*) { c::layout::openMasterMidiInputWindow(); }), + makeMenuItem_(LangMap::MAIN_MENU_EDIT_FREEALLSAMPLES, [](Fl_Widget*, void*) + { c::main::clearAllSamples(); }), + makeMenuItem_(LangMap::MAIN_MENU_EDIT_CLEARALLACTIONS, [](Fl_Widget*, void*) + { c::main::clearAllActions(); }), + makeMenuItem_(LangMap::MAIN_MENU_EDIT_SETUPMIDIINPUT, [](Fl_Widget*, void*) + { c::layout::openMasterMidiInputWindow(); }), endSubMenu_(), #ifndef G_OS_MAC // "Config" and "About" are treated differently on macOS menu - makeMenuItem_(LangMap::MAIN_MENU_CONFIG, [](Fl_Widget*, void*) { c::layout::openConfigWindow(); }), - makeMenuItem_(LangMap::MAIN_MENU_ABOUT, [](Fl_Widget*, void*) { c::layout::openAboutWindow(); }), + makeMenuItem_(LangMap::MAIN_MENU_CONFIG, [](Fl_Widget*, void*) + { c::layout::openConfigWindow(); }), + makeMenuItem_(LangMap::MAIN_MENU_ABOUT, [](Fl_Widget*, void*) + { c::layout::openAboutWindow(); }), #endif endSubMenu_()}; @@ -102,11 +112,13 @@ geMainMenu::geMainMenu() #ifdef G_OS_MAC static const Fl_Menu_Item macOSextra[] = { - makeMenuItem_(LangMap::MAIN_MENU_CONFIG, [](Fl_Widget*, void*) { c::layout::openConfigWindow(); }), + makeMenuItem_(LangMap::MAIN_MENU_CONFIG, [](Fl_Widget*, void*) + { c::layout::openConfigWindow(); }), endSubMenu_(), endSubMenu_()}; Fl_Mac_App_Menu::custom_application_menu_items(macOSextra); - Fl_Sys_Menu_Bar::about([](Fl_Widget*, void*) { c::layout::openAboutWindow(); }, nullptr); + Fl_Sys_Menu_Bar::about([](Fl_Widget*, void*) + { c::layout::openAboutWindow(); }, nullptr); #endif } } // namespace giada::v \ No newline at end of file diff --git a/src/gui/elems/mainWindow/mainOutput.cpp b/src/gui/elems/mainWindow/mainOutput.cpp index 9c7c72ee9..4bc14e507 100644 --- a/src/gui/elems/mainWindow/mainOutput.cpp +++ b/src/gui/elems/mainWindow/mainOutput.cpp @@ -1,28 +1,28 @@ /* ----------------------------------------------------------------------------- -* -* Giada - Your Hardcore Loopmachine -* -* ------------------------------------------------------------------------------ -* -* Copyright (C) 2010-2024 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 -* . -* -* --------------------------------------------------------------------------- */ + * + * Giada - Your Hardcore Loopmachine + * + * ------------------------------------------------------------------------------ + * + * Copyright (C) 2010-2024 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 + * . + * + * --------------------------------------------------------------------------- */ #include "gui/elems/mainWindow/mainOutput.h" #include "core/const.h" @@ -61,11 +61,13 @@ geMainOutput::geMainOutput() m_outMeter->copy_tooltip(g_ui->getI18Text(LangMap::MAIN_IO_LABEL_OUTMETER)); m_midiOut->copy_tooltip(g_ui->getI18Text(LangMap::MAIN_IO_LABEL_MIDIOUTACTIVITY)); - m_outVol->onChange = [](float v) { + m_outVol->onChange = [](float v) + { c::main::setMasterOutVolume(v, Thread::MAIN); }; - m_masterFxOut->onClick = [] { c::layout::openMasterOutPluginListWindow(); }; + m_masterFxOut->onClick = [] + { c::layout::openMasterOutPluginListWindow(); }; } /* -------------------------------------------------------------------------- */ diff --git a/src/gui/elems/mainWindow/mainTimer.cpp b/src/gui/elems/mainWindow/mainTimer.cpp index dc0425079..2b663b8d0 100644 --- a/src/gui/elems/mainWindow/mainTimer.cpp +++ b/src/gui/elems/mainWindow/mainTimer.cpp @@ -61,10 +61,14 @@ geMainTimer::geMainTimer() m_multiplier->copy_tooltip(g_ui->getI18Text(LangMap::MAIN_TIMER_LABEL_MULTIPLIER)); m_divider->copy_tooltip(g_ui->getI18Text(LangMap::MAIN_TIMER_LABEL_DIVIDER)); - m_bpm->onClick = [&timer = m_timer]() { c::layout::openBpmWindow(timer.bpm); }; - m_meter->onClick = [&timer = m_timer]() { c::layout::openBeatsWindow(timer.beats, timer.bars); }; - m_multiplier->onClick = []() { c::main::multiplyBeats(); }; - m_divider->onClick = []() { c::main::divideBeats(); }; + m_bpm->onClick = [&timer = m_timer]() + { c::layout::openBpmWindow(timer.bpm); }; + m_meter->onClick = [&timer = m_timer]() + { c::layout::openBeatsWindow(timer.beats, timer.bars); }; + m_multiplier->onClick = []() + { c::main::multiplyBeats(); }; + m_divider->onClick = []() + { c::main::divideBeats(); }; m_quantizer->addItem(g_ui->getI18Text(LangMap::COMMON_OFF)); m_quantizer->addItem("1\\/1"); @@ -74,7 +78,8 @@ geMainTimer::geMainTimer() 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); }; + m_quantizer->onChange = [](ID value) + { c::main::quantize(value); }; } /* -------------------------------------------------------------------------- */ diff --git a/src/gui/elems/mainWindow/mainTransport.cpp b/src/gui/elems/mainWindow/mainTransport.cpp index 17d59e67f..56633babe 100644 --- a/src/gui/elems/mainWindow/mainTransport.cpp +++ b/src/gui/elems/mainWindow/mainTransport.cpp @@ -66,37 +66,44 @@ geMainTransport::geMainTransport() m_inputRecMode->copy_tooltip(g_ui->getI18Text(LangMap::MAIN_TRANSPORT_LABEL_RECINPUTMODE)); m_metronome->copy_tooltip(g_ui->getI18Text(LangMap::MAIN_TRANSPORT_LABEL_METRONOME)); - m_rewind->onClick = []() { + m_rewind->onClick = []() + { c::main::rewindSequencer(); }; m_play->setToggleable(true); - m_play->onClick = []() { + m_play->onClick = []() + { c::main::toggleSequencer(); }; m_recAction->setToggleable(true); - m_recAction->onClick = []() { + m_recAction->onClick = []() + { c::main::toggleActionRecording(); }; m_recInput->setToggleable(true); - m_recInput->onClick = []() { + m_recInput->onClick = []() + { c::main::toggleInputRecording(); }; m_recTriggerMode->setToggleable(true); - m_recTriggerMode->onClick = []() { + m_recTriggerMode->onClick = []() + { c::main::toggleRecOnSignal(); }; m_inputRecMode->setToggleable(true); - m_inputRecMode->onClick = []() { + m_inputRecMode->onClick = []() + { c::main::toggleFreeInputRec(); }; m_metronome->setToggleable(true); - m_metronome->onClick = []() { + m_metronome->onClick = []() + { c::main::toggleMetronome(); }; } diff --git a/src/gui/elems/midiIO/midiLearner.cpp b/src/gui/elems/midiIO/midiLearner.cpp index 4e7ce7102..649e0a09b 100644 --- a/src/gui/elems/midiIO/midiLearner.cpp +++ b/src/gui/elems/midiIO/midiLearner.cpp @@ -60,7 +60,8 @@ geMidiLearner::geMidiLearner(int x, int y, int w, int h, std::string l, int para m_value->box(G_CUSTOM_BORDER_BOX); m_learnBtn->setToggleable(true); - m_learnBtn->onClick = [this]() { + m_learnBtn->onClick = [this]() + { assert(onStartLearn != nullptr); assert(onStopLearn != nullptr); @@ -70,7 +71,8 @@ geMidiLearner::geMidiLearner(int x, int y, int w, int h, std::string l, int para onStopLearn(); }; - m_clearBtn->onClick = [this]() { + m_clearBtn->onClick = [this]() + { onClearLearn(m_param); }; } diff --git a/src/gui/elems/midiIO/midiLearnerPack.cpp b/src/gui/elems/midiIO/midiLearnerPack.cpp index ace7b35c7..2c466f233 100644 --- a/src/gui/elems/midiIO/midiLearnerPack.cpp +++ b/src/gui/elems/midiIO/midiLearnerPack.cpp @@ -61,7 +61,8 @@ void geMidiLearnerPack::addMidiLearner(std::string label, int param, bool visibl l->onStartLearn = m_onStartLearn; l->onClearLearn = m_onClearLearn; - l->onStopLearn = []() { c::io::stopMidiLearn(); }; + l->onStopLearn = []() + { c::io::stopMidiLearn(); }; add(l); if (!visible) diff --git a/src/gui/elems/panTool.cpp b/src/gui/elems/panTool.cpp index 0cd447d7b..bfa240518 100644 --- a/src/gui/elems/panTool.cpp +++ b/src/gui/elems/panTool.cpp @@ -54,7 +54,8 @@ gePanTool::gePanTool(ID channelId, float pan, int labelWidth) end(); m_dial->range(0.0f, G_MAX_PAN); - m_dial->onChange = [this](float val) { + m_dial->onChange = [this](float val) + { c::channel::sendChannelPan(m_channelId, val); update(val); }; @@ -62,7 +63,8 @@ gePanTool::gePanTool(ID channelId, float pan, int labelWidth) m_input->setReadonly(true); m_input->setCursorColor(FL_WHITE); - m_reset->onClick = [this]() { + m_reset->onClick = [this]() + { c::channel::sendChannelPan(m_channelId, 0.5f); update(0.5f); }; diff --git a/src/gui/elems/plugin/pluginElement.cpp b/src/gui/elems/plugin/pluginElement.cpp index 43e0adb0f..5d4214d47 100644 --- a/src/gui/elems/plugin/pluginElement.cpp +++ b/src/gui/elems/plugin/pluginElement.cpp @@ -62,7 +62,8 @@ gePluginElement::gePluginElement(int x, int y, int w, int h, c::plugin::Plugin d addWidget(remove, G_GUI_UNIT); end(); - remove->onClick = [this]() { removePlugin(); }; + remove->onClick = [this]() + { removePlugin(); }; if (!m_plugin.valid) { @@ -75,9 +76,11 @@ gePluginElement::gePluginElement(int x, int y, int w, int h, c::plugin::Plugin d } button->copy_label(m_plugin.name.c_str()); - button->onClick = [this]() { openPluginWindow(); }; + button->onClick = [this]() + { openPluginWindow(); }; - program->onChange = [pluginId = m_plugin.id](ID id) { + program->onChange = [pluginId = m_plugin.id](ID id) + { c::plugin::setProgram(pluginId, id); }; @@ -95,12 +98,15 @@ gePluginElement::gePluginElement(int x, int y, int w, int h, c::plugin::Plugin d bypass->setToggleable(true); bypass->setValue(!m_plugin.isBypassed); - bypass->onClick = [this]() { + bypass->onClick = [this]() + { c::plugin::toggleBypass(m_plugin.id); }; - shiftUpBtn->onClick = [this]() { shiftUp(); }; - shiftDownBtn->onClick = [this]() { shiftDown(); }; + shiftUpBtn->onClick = [this]() + { shiftUp(); }; + shiftDownBtn->onClick = [this]() + { shiftDown(); }; } /* -------------------------------------------------------------------------- */ diff --git a/src/gui/elems/sampleEditor/pitchTool.cpp b/src/gui/elems/sampleEditor/pitchTool.cpp index 47f8cdac2..1c878f6bb 100644 --- a/src/gui/elems/sampleEditor/pitchTool.cpp +++ b/src/gui/elems/sampleEditor/pitchTool.cpp @@ -68,35 +68,42 @@ gePitchTool::gePitchTool(const c::sampleEditor::Data& d) m_dial->range(0.01f, 4.0f); m_dial->when(FL_WHEN_RELEASE); - m_dial->onChange = [this](float val) { + m_dial->onChange = [this](float val) + { c::channel::setChannelPitch(m_data->channelId, val, Thread::MAIN); }; m_input->setType(FL_FLOAT_INPUT); m_input->setWhen(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY); // on focus lost or enter key - m_input->onChange = [this](const std::string& val) { + m_input->onChange = [this](const std::string& val) + { c::channel::setChannelPitch(m_data->channelId, u::string::toFloat(val), Thread::MAIN); }; - m_pitchToBar->onClick = [this]() { + m_pitchToBar->onClick = [this]() + { c::channel::setChannelPitch(m_data->channelId, m_data->end / (float)m_data->getFramesInBar(), Thread::MAIN); }; - m_pitchToSong->onClick = [this]() { + m_pitchToSong->onClick = [this]() + { c::channel::setChannelPitch(m_data->channelId, m_data->end / (float)m_data->getFramesInLoop(), Thread::MAIN); }; - m_pitchHalf->onClick = [this]() { + m_pitchHalf->onClick = [this]() + { c::channel::setChannelPitch(m_data->channelId, m_dial->value() / 2, Thread::MAIN); }; - m_pitchDouble->onClick = [this]() { + m_pitchDouble->onClick = [this]() + { c::channel::setChannelPitch(m_data->channelId, m_dial->value() * 2, Thread::MAIN); }; - m_pitchReset->onClick = [this]() { + m_pitchReset->onClick = [this]() + { c::channel::setChannelPitch(m_data->channelId, G_DEFAULT_PITCH, Thread::MAIN); }; diff --git a/src/gui/elems/sampleEditor/rangeTool.cpp b/src/gui/elems/sampleEditor/rangeTool.cpp index 07823e807..b3922521a 100644 --- a/src/gui/elems/sampleEditor/rangeTool.cpp +++ b/src/gui/elems/sampleEditor/rangeTool.cpp @@ -55,17 +55,20 @@ geRangeTool::geRangeTool(const c::sampleEditor::Data& d) m_begin->setType(FL_INT_INPUT); m_begin->setWhen(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY); // on focus lost or enter key - m_begin->onChange = [this](const std::string& val) { + m_begin->onChange = [this](const std::string& val) + { c::sampleEditor::setBeginEnd(m_data->channelId, u::string::toInt(val), u::string::toInt(m_end->getValue())); }; m_end->setType(FL_INT_INPUT); m_end->setWhen(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY); // on focus lost or enter key - m_end->onChange = [this](const std::string& val) { + m_end->onChange = [this](const std::string& val) + { c::sampleEditor::setBeginEnd(m_data->channelId, u::string::toInt(m_begin->getValue()), u::string::toInt(val)); }; - m_reset->onClick = [this]() { + m_reset->onClick = [this]() + { c::sampleEditor::setBeginEnd(m_data->channelId, 0, m_data->waveSize - 1); }; diff --git a/src/gui/elems/sampleEditor/shiftTool.cpp b/src/gui/elems/sampleEditor/shiftTool.cpp index eb7936d81..45edd3814 100644 --- a/src/gui/elems/sampleEditor/shiftTool.cpp +++ b/src/gui/elems/sampleEditor/shiftTool.cpp @@ -52,11 +52,13 @@ geShiftTool::geShiftTool(const c::sampleEditor::Data& d) m_shift->setType(FL_INT_INPUT); m_shift->setWhen(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY); // on focus lost or enter key - m_shift->onChange = [this](const std::string& val) { + m_shift->onChange = [this](const std::string& val) + { c::sampleEditor::shift(m_data->channelId, u::string::toInt(val)); }; - m_reset->onClick = [this]() { + m_reset->onClick = [this]() + { c::sampleEditor::shift(m_data->channelId, 0); }; diff --git a/src/gui/elems/sampleEditor/waveTools.cpp b/src/gui/elems/sampleEditor/waveTools.cpp index 9109867ed..cdf25d8a8 100644 --- a/src/gui/elems/sampleEditor/waveTools.cpp +++ b/src/gui/elems/sampleEditor/waveTools.cpp @@ -179,7 +179,8 @@ void geWaveTools::openMenu() menu.onSelect = [channelId = m_data->channelId, a = waveform->getSelectionA(), - b = waveform->getSelectionB()](ID id) { + b = waveform->getSelectionB()](ID id) + { switch (static_cast(id)) { case Menu::CUT: diff --git a/src/gui/elems/sampleEditor/waveform.cpp b/src/gui/elems/sampleEditor/waveform.cpp index 6a6e1ebdf..e84a14d36 100644 --- a/src/gui/elems/sampleEditor/waveform.cpp +++ b/src/gui/elems/sampleEditor/waveform.cpp @@ -108,7 +108,7 @@ int geWaveform::alloc(int datasize, bool force) int gridFreq = m_grid.level != 0 ? wave.getBuffer().countFrames() / m_grid.level : 0; - /* Resampling the waveform, hardcore way. Many thanks to + /* Resampling the waveform, hardcore way. Many thanks to http://fourier.eng.hmc.edu/e161/lectures/resize/node3.html */ for (int i = 0; i < m_waveform.size; i++) @@ -286,7 +286,7 @@ void geWaveform::draw() fl_rectf(x(), y(), w(), h(), G_COLOR_GREY_2); // blank canvas - /* Draw things from 'from' (offset driven by the scrollbar) to 'to' (width of + /* Draw things from 'from' (offset driven by the scrollbar) to 'to' (width of parent window). We don't draw the entire waveform, only the visible part. */ int from = abs(x() - parent()->x()); @@ -356,8 +356,8 @@ int geWaveform::handle(int e) if (!m_chanStartLit && !m_chanEndLit) c::sampleEditor::setPreviewTracker(m_mouseX); - /* If selection has been done (m_dragged or resized), make sure that point A - is always lower than B. */ + /* If selection has been done (m_dragged or resized), make sure that point A + is always lower than B. */ if (m_dragged || m_resizedA || m_resizedB) fixSelection(); @@ -468,7 +468,7 @@ int geWaveform::handle(int e) else if (m_resizedA || m_resizedB) { - int pos = snap(m_mouseX); + int pos = snap(m_mouseX); m_resizedA ? m_selection.a = pos : m_selection.b = pos; redraw(); } @@ -597,13 +597,13 @@ void geWaveform::setZoom(Zoom z) /* Avoid overflow when zooming out with scrollbar like that: - |----------[scrollbar]| + |----------[scrollbar]| Offset vs smaller: - - |[wave------------| offset > 0 smaller = false - |[wave----] | offset < 0, smaller = true - |-------------] | offset < 0, smaller = false */ + + |[wave------------| offset > 0 smaller = false + |[wave----] | offset < 0, smaller = true + |-------------] | offset < 0, smaller = false */ int parentW = parent()->w(); int thisW = x() + w() - BORDER; // visible width, not full width diff --git a/src/gui/elems/sampleEditor/waveform.h b/src/gui/elems/sampleEditor/waveform.h index 6437322f6..661832185 100644 --- a/src/gui/elems/sampleEditor/waveform.h +++ b/src/gui/elems/sampleEditor/waveform.h @@ -159,7 +159,7 @@ class geWaveform : public Fl_Widget int frameToPixel(int f) const; // TODO - move these to utils::, will be needed in actionEditor /* fixSelection - Helper function which flattens the selection if it was made from right to left + Helper function which flattens the selection if it was made from right to left (inverse selection). It also computes the absolute points. Call this one whenever the selection gesture is done. */ @@ -187,7 +187,7 @@ class geWaveform : public Fl_Widget void selectAll(); /* alloc - Allocates memory for the picture. It's smart enough not to reallocate if + Allocates memory for the picture. It's smart enough not to reallocate if datasize hasn't changed, but it can be forced otherwise. */ int alloc(int datasize, bool force = false); diff --git a/src/gui/elems/volumeTool.cpp b/src/gui/elems/volumeTool.cpp index 61e8fcf9a..9890ab22b 100644 --- a/src/gui/elems/volumeTool.cpp +++ b/src/gui/elems/volumeTool.cpp @@ -52,20 +52,23 @@ geVolumeTool::geVolumeTool(ID channelId, float volume, int labelWidth) end(); m_dial->range(0.0f, 1.0f); - m_dial->onChange = [this](float val) { + m_dial->onChange = [this](float val) + { c::channel::setChannelVolume(m_channelId, val, Thread::MAIN, /*repaintMainUi=*/true); update(val, /*fromDial=*/true); }; m_input->setType(FL_FLOAT_INPUT); m_input->setWhen(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY); // on focus lost or enter key - m_input->onChange = [this](const std::string& val) { + m_input->onChange = [this](const std::string& val) + { const float valf = c::channel::setChannelVolume(m_channelId, u::math::dBtoLinear(u::string::toFloat(val)), Thread::MAIN, /*repaintMainUi=*/true); update(valf, /*fromDial=*/false); }; - m_reset->onClick = [this]() { + m_reset->onClick = [this]() + { c::channel::setChannelVolume(m_channelId, G_DEFAULT_VOL, Thread::MAIN, /*repaintMainUi=*/true); update(G_DEFAULT_VOL, /*fromDial=*/false); }; diff --git a/src/gui/langMapper.cpp b/src/gui/langMapper.cpp index aac691c15..409e749a6 100644 --- a/src/gui/langMapper.cpp +++ b/src/gui/langMapper.cpp @@ -105,15 +105,15 @@ LangMap::LangMap() m_data[MAIN_MENU_CONFIG] = "Settings"; m_data[MAIN_MENU_ABOUT] = "About"; - m_data[MAIN_IO_LABEL_OUTMETER] = "Main output meter"; - m_data[MAIN_IO_LABEL_INMETER] = "Main input meter"; - m_data[MAIN_IO_LABEL_OUTVOL] = "Main output volume"; - m_data[MAIN_IO_LABEL_INVOL] = "Main input volume"; - m_data[MAIN_IO_LABEL_INTOOUT] = "Stream linker\n\nConnects input to output to enable \"hear what you're playing\" mode."; - m_data[MAIN_IO_LABEL_FXOUT] = "Main output plug-ins"; - m_data[MAIN_IO_LABEL_FXIN] = "Main input plug-ins"; - m_data[MAIN_IO_LABEL_MIDIACTIVITY] = "Master MIDI I/O activity\n\nNotifies MIDI messages sent (top) or " - "received (bottom) globally."; + m_data[MAIN_IO_LABEL_OUTMETER] = "Main output meter"; + m_data[MAIN_IO_LABEL_INMETER] = "Main input meter"; + m_data[MAIN_IO_LABEL_OUTVOL] = "Main output volume"; + m_data[MAIN_IO_LABEL_INVOL] = "Main input volume"; + m_data[MAIN_IO_LABEL_INTOOUT] = "Stream linker\n\nConnects input to output to enable \"hear what you're playing\" mode."; + m_data[MAIN_IO_LABEL_FXOUT] = "Main output plug-ins"; + m_data[MAIN_IO_LABEL_FXIN] = "Main input plug-ins"; + m_data[MAIN_IO_LABEL_MIDIACTIVITY] = "Master MIDI I/O activity\n\nNotifies MIDI messages sent (top) or " + "received (bottom) globally."; m_data[MAIN_IO_LABEL_MIDIINACTIVITY] = "Master MIDI input activity\n\nNotifies MIDI messages received globally."; m_data[MAIN_IO_LABEL_MIDIOUTACTIVITY] = "Master MIDI output activity\n\nNotifies MIDI messages sent globally."; @@ -129,11 +129,11 @@ LangMap::LangMap() m_data[MAIN_TRANSPORT_LABEL_PLAY] = "Play/Stop"; m_data[MAIN_TRANSPORT_LABEL_RECTRIGGERMODE] = "Record-on-signal mode\n\nAction and audio recording will start only when a signal (key press or audio) " "is detected.\n\nAvailable if the sequencer is not running."; - m_data[MAIN_TRANSPORT_LABEL_RECACTIONS] = "Record actions"; - m_data[MAIN_TRANSPORT_LABEL_RECINPUT] = "Record audio\n\nAvailable if:\n - input device is enabled\n - there is at least one empty and armed Sample channel"; - m_data[MAIN_TRANSPORT_LABEL_RECINPUTMODE] = "Free loop-length mode\n\nThe sequencer will adjust to the length of your first audio recording.\n\n" - "Available if there are no other audio samples in the project."; - m_data[MAIN_TRANSPORT_LABEL_METRONOME] = "Metronome"; + m_data[MAIN_TRANSPORT_LABEL_RECACTIONS] = "Record actions"; + m_data[MAIN_TRANSPORT_LABEL_RECINPUT] = "Record audio\n\nAvailable if:\n - input device is enabled\n - there is at least one empty and armed Sample channel"; + m_data[MAIN_TRANSPORT_LABEL_RECINPUTMODE] = "Free loop-length mode\n\nThe sequencer will adjust to the length of your first audio recording.\n\n" + "Available if there are no other audio samples in the project."; + m_data[MAIN_TRANSPORT_LABEL_METRONOME] = "Metronome"; m_data[MAIN_TRACK_HELP] = "Drop audio files or right-click here"; @@ -143,13 +143,13 @@ LangMap::LangMap() m_data[MAIN_TRACK_BUTTON_REMOVE_TRACK] = "Remove track"; m_data[MAIN_TRACK_BUTTON_ADD_TRACK] = "Add track"; - m_data[MAIN_CHANNEL_NOSAMPLE] = "-- no sample --"; - m_data[MAIN_CHANNEL_SAMPLENOTFOUND] = "* file not found! *"; - m_data[MAIN_CHANNEL_LABEL_PLAY] = "Play/stop"; - m_data[MAIN_CHANNEL_LABEL_ARM] = "Arm for recording"; - m_data[MAIN_CHANNEL_LABEL_STATUS] = "Progress bar"; - m_data[MAIN_CHANNEL_LABEL_READACTIONS] = "Read actions\n\nToggles playback of pre-recorded " - "actions (key press, key release, ...)."; + m_data[MAIN_CHANNEL_NOSAMPLE] = "-- no sample --"; + m_data[MAIN_CHANNEL_SAMPLENOTFOUND] = "* file not found! *"; + m_data[MAIN_CHANNEL_LABEL_PLAY] = "Play/stop"; + m_data[MAIN_CHANNEL_LABEL_ARM] = "Arm for recording"; + m_data[MAIN_CHANNEL_LABEL_STATUS] = "Progress bar"; + m_data[MAIN_CHANNEL_LABEL_READACTIONS] = "Read actions\n\nToggles playback of pre-recorded " + "actions (key press, key release, ...)."; m_data[MAIN_CHANNEL_LABEL_MODEBOX] = "Mode"; m_data[MAIN_CHANNEL_LABEL_MUTE] = "Mute"; m_data[MAIN_CHANNEL_LABEL_SOLO] = "Solo"; @@ -273,13 +273,13 @@ LangMap::LangMap() m_data[MIDIOUTPUT_CHANNEL_LEARN_MUTE] = "Mute"; m_data[MIDIOUTPUT_CHANNEL_LEARN_SOLO] = "Solo"; - m_data[ABOUT_TITLE] = "About Giada"; - m_data[ABOUT_BODY] = "Version {} ({} build) {}\n\n" - "Developed by Monocasual Laboratories\n\n" - "Released under the terms of the GNU General\n" - "Public License (GPL v3)\n\n" - "News, infos, contacts and documentation:\n" - "www.giadamusic.com"; + m_data[ABOUT_TITLE] = "About Giada"; + m_data[ABOUT_BODY] = "Version {} ({} build) {}\n\n" + "Developed by Monocasual Laboratories\n\n" + "Released under the terms of the GNU General\n" + "Public License (GPL v3)\n\n" + "News, infos, contacts and documentation:\n" + "www.giadamusic.com"; m_data[ABOUT_BODY_VST] = "VST Plug-In Technology by Steinberg\n" "VST is a trademark of Steinberg\nMedia Technologies GmbH"; diff --git a/src/gui/langMapper.h b/src/gui/langMapper.h index 1dadd997a..04d1f1668 100644 --- a/src/gui/langMapper.h +++ b/src/gui/langMapper.h @@ -377,8 +377,8 @@ class LangMapper final : public Mapper private: /* maps - The current langmap selected and loaded. It might be the default one (En_US) - if no langmaps have been found. */ + The current langmap selected and loaded. It might be the default one (En_US) + if no langmaps have been found. */ LangMap m_map; }; diff --git a/src/gui/ui.cpp b/src/gui/ui.cpp index 5ed691af0..3070d1b93 100644 --- a/src/gui/ui.cpp +++ b/src/gui/ui.cpp @@ -67,7 +67,7 @@ bool Ui::shouldBlink() const float Ui::getScaling() const { - //return 1.0; + // return 1.0; return Fl::screen_scale(mainWindow->screen_num()); } diff --git a/src/gui/ui.h b/src/gui/ui.h index d7ee1b634..055deef2d 100644 --- a/src/gui/ui.h +++ b/src/gui/ui.h @@ -47,7 +47,7 @@ class Ui final Ui(); /* shouldBlink - Return whether is time to blink something or not. This is used to make + Return whether is time to blink something or not. This is used to make widgets blink. */ bool shouldBlink() const; @@ -90,7 +90,7 @@ class Ui final void rebuild(); - /* [rebuild|refresh]SubWindow + /* [rebuild|refresh]SubWindow Rebuilds or refreshes subwindow with ID 'wid' if it exists, i.e. if it's open. */ void rebuildSubWindow(ID wid); @@ -116,7 +116,7 @@ class Ui final void closeAllSubwindows(); - /* setMainWindowTitle + /* setMainWindowTitle Changes Main Window title. */ void setMainWindowTitle(const std::string&); @@ -139,9 +139,9 @@ class Ui final void stopJuceDispatchLoop(); /* rebuildStaticWidgets - Updates attributes of static widgets, i.e. those elements that don't get - automatically refreshed during the UI update loop. Useful when loading a new - patch. */ + Updates attributes of static widgets, i.e. those elements that don't get + automatically refreshed during the UI update loop. Useful when loading a new + patch. */ void rebuildStaticWidgets(); diff --git a/src/utils/cocoa.h b/src/utils/cocoa.h index 17a588147..0469bed87 100644 --- a/src/utils/cocoa.h +++ b/src/utils/cocoa.h @@ -35,9 +35,9 @@ pointer to NSView. The function does the hard conversion. */ void* cocoa_getViewFromWindow(void* p); /* A bug on on OS X seems to misalign plugins' UI. The function takes care of -fixing the positioning. +fixing the positioning. TODO temporarily disabled: it does not work. */ -//void cocoa_setWindowSize(void *p, int w, int h); +// void cocoa_setWindowSize(void *p, int w, int h); #endif diff --git a/src/utils/fs.h b/src/utils/fs.h index 0109d8497..ef7ba9643 100644 --- a/src/utils/fs.h +++ b/src/utils/fs.h @@ -60,7 +60,7 @@ Returns the path to the .conf file. */ std::string getConfigFilePath(); /* getRealPath -Expands all symbolic links and resolves references to /./, /../ and extra / +Expands all symbolic links and resolves references to /./, /../ and extra / characters in the input path and returns the canonicalized absolute pathname. */ std::string getRealPath(const std::string& s); diff --git a/src/utils/math.h b/src/utils/math.h index 84366f619..96ad14f04 100644 --- a/src/utils/math.h +++ b/src/utils/math.h @@ -40,7 +40,7 @@ int quantize(int x, int step); /* map (1) Maps 'x' in range [a, b] to a new range [w, z]. Source: - https://en.wikipedia.org/wiki/Linear_equation#Two-point_form*/ + https://en.wikipedia.org/wiki/Linear_equation#Two-point_form*/ template TO map(TI x, TI a, TI b, TO w, TO z)