Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
9c80041
Add CLAP 1.1.3 submodule
messmerd Dec 31, 2023
7b630bd
Add submodule again; Add CLAP to CMake
messmerd Dec 31, 2023
b443722
Remove CLAP submodule from old location
messmerd Dec 31, 2023
c51390c
Locate and init CLAP plugins
messmerd Dec 19, 2022
5e2866e
Add CLAP logo
messmerd Jan 22, 2023
ae61e5c
Update CLAP to version 1.1.6
messmerd Jan 22, 2023
1e17502
Add clap-helpers submodule
messmerd Jan 24, 2023
4992b2a
Refactor ClapManager
messmerd Jan 29, 2023
1617b05
Move ClapFile/ClapPlugin into their own source files
messmerd Jan 29, 2023
b088038
Add PluginIssueHash
messmerd Dec 31, 2023
230c953
Add missing ClapFile.h/cpp; Start implementing ClapPorts
messmerd Jan 29, 2023
2469d9f
Add ClapSubPluginFeatures
messmerd Jan 29, 2023
3de14c1
Add ClapEffect (currently non-functional)
messmerd Jan 29, 2023
ed63855
Improve effect description widget text
messmerd Jan 29, 2023
ee87f4e
Refactor to support plugin instances
messmerd Jan 30, 2023
987c9ff
More refactoring
messmerd Jan 31, 2023
10f48a6
Refactor + fix ownership issues
messmerd Feb 2, 2023
c20c075
Progress
messmerd Feb 13, 2023
1763e5a
Fix audio buffers and plugin state
messmerd Feb 13, 2023
0dd0905
Copy audio buffers; Implement CLAP_EXT_LOG
messmerd Feb 17, 2023
c3821d9
Fix crash when initializing some CLAP plugins
messmerd Feb 17, 2023
ec27096
Allocate audio buffers - some CLAP effects work now
messmerd Feb 17, 2023
4bede10
Fix crash, implement thread check extension, and more
messmerd Feb 24, 2023
35c7dcf
Fix edge case
messmerd Feb 24, 2023
c891ab2
Begin implementing params
messmerd Feb 26, 2023
01e2dd8
Minor changes
messmerd Mar 12, 2023
c1827fa
Progress on params
messmerd Mar 12, 2023
cdfea27
Parameter automation mostly works now
messmerd Mar 12, 2023
961e4f8
Use CheckControl; Minor improvements
messmerd Mar 13, 2023
b5b6ae3
Modify CustomTextKnob to provide "dynamic" text option
messmerd Dec 31, 2023
72e8034
Implement ClapControlBase::reload()
messmerd Apr 30, 2023
2fb00cc
Fix failed assert
messmerd May 1, 2023
cc397ab
Fix build
messmerd Dec 31, 2023
1c2326b
Update CLAP to version 1.1.8
messmerd Aug 28, 2023
7f171e3
Update clap-helpers
messmerd Aug 28, 2023
346595d
Fix crash when loading LSP plugin ports
messmerd Aug 28, 2023
b1923ff
Safer param creation
messmerd Sep 24, 2023
b3cb37e
Style fixes + better memory/thread safety
messmerd Sep 24, 2023
983838d
Fix build
messmerd Sep 25, 2023
a9cc62e
Stop using RTLD_DEEPBIND to allow ASan to work; Modify method names
messmerd Sep 25, 2023
eaf8f77
Fail gracefully when plugin parameter is invalid
messmerd Sep 25, 2023
dc32273
Implement transport event; Better state transitions
messmerd Dec 31, 2023
ca41492
Fix CLAP file deinit; Fix some memory issues; Minor changes
messmerd Sep 28, 2023
fe6166d
Use ArrayVector
messmerd Sep 30, 2023
8c4f78f
Param init improvements; Minor changes
messmerd Sep 30, 2023
084acd6
Add empty latency extension impl to prevent DISTRHO plugin crashes
messmerd Oct 1, 2023
2abc80d
Start implementing CLAP instruments
messmerd Oct 2, 2023
a0dd5fc
Ensure CLAP plugins start on main thread
messmerd Oct 2, 2023
7b38b5e
Fix null pointer dereference when input port doesn't exist
messmerd Oct 2, 2023
c37346a
Use ringbuffer for midi events
messmerd Oct 4, 2023
b782016
Support steady time
messmerd Oct 4, 2023
5e64b1e
Implement transport beats info; Set transport flags correctly
messmerd Oct 5, 2023
03773ba
Add ClapTransport class
messmerd Oct 6, 2023
77975ac
Refactor some window embedding code in preparation for CLAP GUI
messmerd Dec 31, 2023
4a48daf
Fix regression from previous commit
messmerd Oct 8, 2023
6919eef
Begin GUI implementation; Don't set constant_mask
messmerd Oct 10, 2023
63a356a
Implement MIDI key pressure event
messmerd Oct 10, 2023
0e3bbb8
Allow LMMS_CLAP_PATH env var to override all default CLAP search paths
messmerd Oct 11, 2023
1fdbaab
Attempt to fix restart method; Reimplement constant_mask
messmerd Oct 11, 2023
3e96224
Fix restart() and deactivate()
messmerd Oct 12, 2023
1f95248
Improve param value text; Improve extension init
messmerd Oct 22, 2023
70e817d
Implement note ports extension; Refactor log extension
messmerd Nov 2, 2023
8b2b2c2
Fix filesystem includes; Fix value_to_text() buffer size
messmerd Nov 3, 2023
9439574
Fix build
messmerd Nov 3, 2023
e5f2ceb
Fix some build issues
messmerd Nov 5, 2023
5ecfb76
Improve findSearchPaths()
messmerd Dec 4, 2023
bbdc9ae
Better way of ensuring plugins load on main thread
messmerd Dec 4, 2023
2b9e996
Fix some issues
messmerd Dec 4, 2023
599fe47
Fix scripted-checks
messmerd Dec 4, 2023
d872221
Update CLAP to version 1.1.10
messmerd Dec 4, 2023
27b4ea2
Fix instruments that have audio input
messmerd Dec 17, 2023
bbf328c
Use mingw.thread.h
messmerd Dec 17, 2023
5661141
Implement timer support extension
messmerd Dec 21, 2023
076511e
Improve timer support
messmerd Dec 21, 2023
1b18171
Implement thread pool extension
messmerd Dec 22, 2023
71c3095
Enable thread pool extension
messmerd Dec 22, 2023
3b0dea0
Begin refactoring CLAP extensions
messmerd Dec 24, 2023
08ac8cc
Continue refactoring CLAP extensions
messmerd Dec 24, 2023
7d9b581
Implement state extension (WIP)
messmerd Dec 27, 2023
bf7f600
Refactor thread check and params extensions (WIP)
messmerd Dec 29, 2023
f5dbc3b
Refactor gui extension
messmerd Dec 29, 2023
2c7e10f
Fix mistake in thread check extension
messmerd Dec 31, 2023
88386ec
Workaround for std::experimental::filesystem
messmerd Dec 31, 2023
6e83350
Refactor log extension
messmerd Jan 1, 2024
ba29c87
Fix build; Remove thread pool extension (needs more work)
messmerd Jan 2, 2024
337e5ca
Try to fix filesystem issues
messmerd Jan 2, 2024
80c5643
Try to fix builds
messmerd Jan 2, 2024
90a5b15
Clean up includes
messmerd Jan 3, 2024
189e142
More refactoring
messmerd Jan 3, 2024
5972559
Fix MSVC build
messmerd Jan 16, 2024
f654a1d
Cleanup; Use CLAP state when cloning tracks (WIP)
messmerd Jan 22, 2024
a5c4097
Fix state extension implementation and plugin cloning
messmerd Jan 23, 2024
e50d007
Update CLAP to version 1.2.0
messmerd Jan 26, 2024
f04a5bb
Add support for CLAP compatibility IDs; revert parameter value change
messmerd Jan 27, 2024
5af3d4d
Add hashCombine function
messmerd Feb 9, 2024
ad7bd3e
Begin work on presets (WIP)
messmerd Feb 11, 2024
60374db
More work on presets
messmerd Feb 12, 2024
73e3fde
Fix small timer support bug
messmerd Feb 12, 2024
dfe8ac4
Fix some issues in ClapPresetLoader::load()
messmerd Feb 13, 2024
63ef03d
More work on CLAP presets (WIP)
messmerd Feb 20, 2024
21d9168
Remember to deinit preset database
messmerd Feb 20, 2024
698d1c9
CLAP presets (WIP)
messmerd Mar 3, 2024
e502ad3
More progress on presets (WIP)
messmerd Mar 4, 2024
3c54c31
Try to fix build
messmerd Mar 7, 2024
bf85afe
Implement state context extension
messmerd Mar 7, 2024
763d69a
Presets and parameters (WIP)
messmerd Mar 9, 2024
575dd78
Presets bug fixes and refactoring (WIP)
messmerd Mar 16, 2024
148f5fc
Fix external presets
messmerd Mar 17, 2024
7e6dd39
Fix PresetSelector
messmerd Mar 17, 2024
c1662aa
Add preset load/save buttons; cleanup
messmerd Mar 18, 2024
feee422
Allow extension initialization within plugin.init() call
messmerd Mar 21, 2024
5b6bb75
Merge branch 'LMMS:master' into clap-host-dev
messmerd Mar 21, 2024
6063cdf
Fix ClapState::save() bug
messmerd Mar 23, 2024
1aac7a9
Add CLAP filter to EffectSelectDialog
messmerd Mar 24, 2024
f29e8ca
Minor changes
messmerd Mar 24, 2024
cb09644
New way of handling mono plugins (WIP)
messmerd Mar 26, 2024
92ebcf7
Remove LinkedModelGroup usage
messmerd Mar 27, 2024
3e5b433
Improve PluginPortConfig
messmerd Mar 28, 2024
d17a1d8
Add PluginPortConfigSelector
messmerd Mar 28, 2024
090bf82
Replace QComboBox with ComboBox
messmerd Mar 28, 2024
2b8e8d8
Fix Windows builds
messmerd Mar 28, 2024
f896536
Delay full extension init until after plugin.init()
messmerd Mar 29, 2024
b660556
Fix automation load/save regression
messmerd Apr 6, 2024
52b1214
Merge branch 'master' of https://github.com/messmerd/lmms into clap-h…
messmerd Apr 7, 2024
da893e2
Fix build
messmerd Apr 7, 2024
2b23635
Fix CLAP loading on macOS
messmerd Apr 18, 2024
1808474
Merge branch 'master' into clap-host-dev
messmerd May 28, 2024
4201279
Use std::filesystem; fix UTF-8 issues
messmerd May 29, 2024
0a3cb05
Fix build
messmerd May 29, 2024
b7ed5a0
Merge branch 'master' into clap-host-dev
messmerd Nov 7, 2024
0dec314
Fix build
messmerd Nov 7, 2024
1b3b091
Fix more build errors
messmerd Nov 7, 2024
5470871
Merge branch 'master' into clap-host-dev
messmerd Jul 6, 2025
0ca27e2
Fix C++20 upgrade issues
messmerd Jul 6, 2025
5f3f699
Fix MSVC build
messmerd Jul 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add ClapTransport class
  • Loading branch information
messmerd committed Jan 27, 2024
commit 03773bacc2f2c07e6588ad6b8c697238fac99313
4 changes: 2 additions & 2 deletions include/ClapInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ class ClapInstance final : public LinkedModelGroup
auto deactivate() -> bool;

auto processBegin(std::uint32_t frames) -> bool;
void processNoteOff(int sampleOffset, int channel, int key, int velocity);
void processNoteOn(int sampleOffset, int channel, int key, int velocity);
void processNoteOff(f_cnt_t sampleOffset, std::int8_t channel, std::int16_t key, std::uint8_t velocity);
void processNoteOn(f_cnt_t sampleOffset, std::int8_t channel, std::int16_t key, std::uint8_t velocity);
auto process(std::uint32_t frames) -> bool;
auto processEnd(std::uint32_t frames) -> bool;

Expand Down
16 changes: 0 additions & 16 deletions include/ClapManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,6 @@ class ClapManager
//! Creates a plugin instance given plugin info; Plugin instance is owned by ClapManager
//auto createInstance(const ClapPluginInfo* info) -> std::weak_ptr<ClapPluginInstance>;

/**
* Transport update methods
* TODO: Add pre-roll and beat position
*/
static void updateTransport();
static void setPlaying(bool isPlaying);
static void setRecording(bool isRecording);
static void setLooping(bool isLooping);
static void setBeatPosition();
static void setTimePosition(int elapsedMilliseconds);
static void setTempo(bpm_t tempo);
static void setTimeSignature(int num, int denom);

static auto transport() -> const clap_event_transport* { return &s_transport; }

static auto clapGuiApi() -> const char*;

static auto debugging() -> bool { return s_debug; }
Expand All @@ -115,7 +100,6 @@ class ClapManager
std::unordered_map<std::string, std::weak_ptr<const ClapPluginInfo>> m_uriToPluginInfo; //!< Non-owning map of plugin URIs (IDs) to ClapPluginInfo
//std::vector<std::weak_ptr<ClapInstance>> m_instances; //!< Vector of all CLAP plugin instances (for guaranteeing correct clean-up order)

static clap_event_transport s_transport;
static bool s_debug; //!< If LMMS_CLAP_DEBUG is set, debug output will be printed
};

Expand Down
62 changes: 62 additions & 0 deletions include/ClapTransport.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* ClapTransport.h - CLAP transport events
*
* Copyright (c) 2023 Dalton Messmer <messmer.dalton/at/gmail.com>
*
* This file is part of LMMS - https://lmms.io
*
* This program 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 2 of the License, or (at your option) any later version.
*
* This program 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 this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/

#ifndef LMMS_CLAP_TRANSPORT_H
#define LMMS_CLAP_TRANSPORT_H

#include "lmmsconfig.h"

#ifdef LMMS_HAVE_CLAP

#include "lmms_basics.h"

#include <clap/events.h>

namespace lmms
{

//! Static class for managing CLAP transport events
class ClapTransport
{
public:
static void update();
static void setPlaying(bool isPlaying);
static void setRecording(bool isRecording);
static void setLooping(bool isLooping);
static void setBeatPosition();
static void setTimePosition(int elapsedMilliseconds);
static void setTempo(bpm_t tempo);
static void setTimeSignature(int num, int denom);

static auto get() -> const clap_event_transport* { return &s_transport; }

private:
static clap_event_transport s_transport;
};

} // namespace lmms

#endif // LMMS_HAVE_CLAP

#endif // LMMS_CLAP_TRANSPORT_H
1 change: 1 addition & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ set(LMMS_SRCS
core/clap/ClapManager.cpp
core/clap/ClapParam.cpp
core/clap/ClapSubPluginFeatures.cpp
core/clap/ClapTransport.cpp

core/lv2/Lv2Basics.cpp
core/lv2/Lv2ControlBase.cpp
Expand Down
26 changes: 13 additions & 13 deletions src/core/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include "AutomationTrack.h"
#include "AutomationEditor.h"
#include "ClapTransport.h"
#include "ConfigManager.h"
#include "ControllerRackView.h"
#include "ControllerConnection.h"
Expand All @@ -56,7 +57,6 @@
#include "SongEditor.h"
#include "TimeLineWidget.h"
#include "PeakController.h"
#include "ClapManager.h"


namespace lmms
Expand Down Expand Up @@ -166,7 +166,7 @@ void Song::setTempo()
m_vstSyncController.setTempo( tempo );

#ifdef LMMS_HAVE_CLAP
ClapManager::setTempo(tempo);
ClapTransport::setTempo(tempo);
#endif

emit tempoChanged( tempo );
Expand All @@ -186,7 +186,7 @@ void Song::setTimeSignature()
getTimeSigModel().getNumerator(), getTimeSigModel().getDenominator() );

#ifdef LMMS_HAVE_CLAP
ClapManager::setTimeSignature(getTimeSigModel().getNumerator(), getTimeSigModel().getDenominator());
ClapTransport::setTimeSignature(getTimeSigModel().getNumerator(), getTimeSigModel().getDenominator());
#endif
}

Expand Down Expand Up @@ -272,7 +272,7 @@ void Song::processNextBuffer()
#ifdef LMMS_HAVE_CLAP
// If looping is enabled, or we're playing a pattern track or a MIDI clip
// TODO: Looping might not be handled correctly
ClapManager::setLooping(loopEnabled
ClapTransport::setLooping(loopEnabled
|| (m_playMode == PlayMode::Pattern)
|| (m_playMode == PlayMode::MidiClip && m_loopMidiClip)
);
Expand Down Expand Up @@ -350,8 +350,8 @@ void Song::processNextBuffer()
m_vstSyncController.update();

#ifdef LMMS_HAVE_CLAP
ClapManager::setBeatPosition();
ClapManager::setTimePosition(getMilliseconds());
ClapTransport::setBeatPosition();
ClapTransport::setTimePosition(getMilliseconds());
#endif
}

Expand Down Expand Up @@ -513,7 +513,7 @@ void Song::playSong()
m_vstSyncController.setPlaybackState( true );

#ifdef LMMS_HAVE_CLAP
ClapManager::setPlaying(true);
ClapTransport::setPlaying(true);
#endif

savePlayStartPosition();
Expand Down Expand Up @@ -556,7 +556,7 @@ void Song::playPattern()
m_vstSyncController.setPlaybackState( true );

#ifdef LMMS_HAVE_CLAP
ClapManager::setPlaying(true);
ClapTransport::setPlaying(true);
#endif

savePlayStartPosition();
Expand Down Expand Up @@ -654,7 +654,7 @@ void Song::togglePause()
m_vstSyncController.setPlaybackState( m_playing );

#ifdef LMMS_HAVE_CLAP
ClapManager::setPlaying(m_playing);
ClapTransport::setPlaying(m_playing);
#endif

emit playbackStateChanged();
Expand Down Expand Up @@ -714,9 +714,9 @@ void Song::stop()
/ (double) Engine::framesPerTick() );

#ifdef LMMS_HAVE_CLAP
ClapManager::setPlaying(m_exporting);
ClapManager::setBeatPosition();
ClapManager::setTimePosition(getMilliseconds());
ClapTransport::setPlaying(m_exporting);
ClapTransport::setBeatPosition();
ClapTransport::setTimePosition(getMilliseconds());
#endif

// remove all note-play-handles that are active
Expand Down Expand Up @@ -802,7 +802,7 @@ void Song::stopExport()
m_vstSyncController.setPlaybackState( m_playing );

#ifdef LMMS_HAVE_CLAP
ClapManager::setPlaying(m_playing);
ClapTransport::setPlaying(m_playing);
#endif
}

Expand Down
10 changes: 7 additions & 3 deletions src/core/clap/ClapInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#ifdef LMMS_HAVE_CLAP

#include "ClapManager.h"
#include "ClapTransport.h"
#include "Engine.h"
#include "AudioEngine.h"
#include "MidiEvent.h"
Expand Down Expand Up @@ -124,7 +125,7 @@ ClapInstance::ClapInstance(const ClapPluginInfo* pluginInfo, Model* parent)
m_pluginState = PluginState::None;
setHost();

m_process.transport = ClapManager::transport();
m_process.transport = ClapTransport::get();

start();
}
Expand All @@ -151,6 +152,9 @@ void ClapInstance::copyModelsFromCore()

if (!hasNoteInput()) { return; } // TODO: Check for MIDI event / note event support instead?

// TODO: Midi events and parameter events may not be ordered according to increasing sample offset
// The event.header.time values need to be sorted in increasing order.

while (m_midiInputReader.read_space() > 0)
{
const auto [event, _, offset] = m_midiInputReader.read(1)[0];
Expand Down Expand Up @@ -672,7 +676,7 @@ auto ClapInstance::processBegin(std::uint32_t frames) -> bool
return false;
}

void ClapInstance::processNoteOff(int sampleOffset, int channel, int key, int velocity)
void ClapInstance::processNoteOff(f_cnt_t sampleOffset, std::int8_t channel, std::int16_t key, std::uint8_t velocity)
{
assert(isAudioThread());

Expand All @@ -691,7 +695,7 @@ void ClapInstance::processNoteOff(int sampleOffset, int channel, int key, int ve
m_evIn.push(&ev.header);
}

void ClapInstance::processNoteOn(int sampleOffset, int channel, int key, int velocity)
void ClapInstance::processNoteOn(f_cnt_t sampleOffset, std::int8_t channel, std::int16_t key, std::uint8_t velocity)
{
assert(isAudioThread());

Expand Down
Loading