Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Calf plugins to 0.90 #3987

Merged
merged 26 commits into from
Apr 16, 2018
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8dce0e4
Move calf to submodule
tresf Nov 5, 2017
8d428bc
Add CMakeLists.txt, use old Calf version
tresf Nov 5, 2017
aa542c5
Revert submodule to 0.0.60.0
tresf Nov 5, 2017
2631d22
Revert Calf to 0.0.18.2
tresf Nov 5, 2017
c540efc
Point calf submodule at fork
tresf Nov 6, 2017
ebd1fbd
Make it work
tresf Nov 6, 2017
c817ad3
Bump to Calf 0.90
tresf Nov 6, 2017
cd80f8e
Cleanup comments
tresf Nov 17, 2017
67adaf3
Namespace calf_plugins to veal_plugins
tresf Nov 19, 2017
a02730a
Nudge to latest commits
tresf Nov 19, 2017
0a0fd0a
Fix windows, bump to latest commits
tresf Nov 21, 2017
2e9f98d
Bump to latest changes at tresf/veal
tresf Dec 2, 2017
14d00cd
Tmp
JohannesLorenz Jan 2, 2018
ac14fa8
Fixes from the PR todo list
JohannesLorenz Jan 4, 2018
00b188e
DataFile upgrades
tresf Feb 5, 2018
ab72fe2
Add S&Q upgrades
tresf Feb 8, 2018
fb01511
Fix looping logic
tresf Feb 10, 2018
ca4690b
Switch back to lmms fork
tresf Feb 11, 2018
c29d2a8
Try again to bump submodule
tresf Feb 11, 2018
a1606ac
Move exprtk to non-volatile branch
tresf Jan 5, 2018
85860ec
Enable C++11 to fix Windows builds
tresf Feb 11, 2018
021e604
First attempt. Remove lists work, but adding has no effect.
JohannesLorenz Mar 16, 2018
62e1d8f
Fix all CALF effects' port numbers, ranges and defaults
JohannesLorenz Apr 2, 2018
2574408
Fix all CALF effects' port numbers, ranges and defaults
JohannesLorenz Apr 2, 2018
e313d62
Update CALF module. Code reading rework.
JohannesLorenz Apr 2, 2018
b156a82
Don't revert exprtk
tresf Apr 13, 2018
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
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
[submodule "plugins/OpulenZ/adplug"]
path = plugins/OpulenZ/adplug
url = https://github.com/adplug/adplug.git
[submodule "plugins/LadspaEffect/calf/veal"]
path = plugins/LadspaEffect/calf/veal
url = https://github.com/lmms/veal
[submodule "plugins/Xpressive/exprtk"]
path = plugins/Xpressive/exprtk
url = https://github.com/ArashPartow/exprtk
Expand All @@ -25,3 +22,6 @@
[submodule "src/3rdparty/weakjack/weakjack"]
path = src/3rdparty/weakjack/weakjack
url = https://github.com/x42/weakjack.git
[submodule "plugins/LadspaEffect/calf/veal"]
path = plugins/LadspaEffect/calf/veal
url = https://github.com/tresf/veal
1 change: 1 addition & 0 deletions include/LadspaBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ typedef enum BufferRates
typedef enum BufferData
{
TOGGLED,
ENUM,
INTEGER,
FLOATING,
TIME,
Expand Down
6 changes: 6 additions & 0 deletions include/LadspaManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ class EXPORT LadspaManager
be described as [-0.1, 3.1]. */
bool isInteger( const ladspa_key_t & _plugin, uint32_t _port );

/* Indicates that a user interface would probably wish to provide a
stepped control taking only integer values. This is equal to isInteger,
but the number of values is usually small and may be better depicted
with a combo box. */
bool isEnum( const ladspa_key_t & _plugin, uint32_t _port );

/* Returns the name of the port. */
QString getPortName( const ladspa_key_t & _plugin, uint32_t _port );

Expand Down
6 changes: 3 additions & 3 deletions plugins/LadspaEffect/LadspaControlDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ void LadspaControlDialog::updateEffectView( LadspaControls * _ctl )
{
if( (*it)->port()->proc == proc )
{
buffer_data_t this_port = (*it)->port()->data_type;
if( last_port != NONE &&
(*it)->port()->data_type == TOGGLED &&
!( (*it)->port()->data_type == TOGGLED &&
last_port == TOGGLED ) )
( this_port == TOGGLED || this_port == ENUM ) &&
( last_port != TOGGLED && last_port != ENUM ) )
{
++row;
col = 0;
Expand Down
6 changes: 5 additions & 1 deletion plugins/LadspaEffect/LadspaEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,11 @@ void LadspaEffect::pluginInstantiation()
}

p->scale = 1.0f;
if( manager->isPortToggled( m_key, port ) )
if( manager->isEnum( m_key, port ) )
{
p->data_type = ENUM;
}
else if( manager->isPortToggled( m_key, port ) )
{
p->data_type = TOGGLED;
}
Expand Down
7 changes: 5 additions & 2 deletions plugins/LadspaEffect/calf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ FILE(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/veal/src/*.cpp")
LIST(SORT SOURCES)

# Skip files matching pattern
SET(FILE_PATTERNS "ctl;gui;gtk;session;connector;jack;rdf;draw;fluid;preset;lv2;benchmark;win")
SET(FILE_PATTERNS "ctl;gui;gtk;session;connector;jack;rdf;draw;fluid;preset;lv2;benchmark;win;plugin.cpp")
FOREACH(_item ${SOURCES})
FOREACH(_pattern ${FILE_PATTERNS})
IF(${_item} MATCHES ${_pattern})
Expand All @@ -29,6 +29,10 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include"

INSTALL(TARGETS veal LIBRARY DESTINATION "${PLUGIN_DIR}/ladspa")
SET_TARGET_PROPERTIES(veal PROPERTIES PREFIX "")

# Disable OSC messaging, it's not mingw compatible
TARGET_COMPILE_DEFINITIONS(veal PRIVATE DISABLE_OSC=1)

SET(INLINE_FLAGS "")
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET(INLINE_FLAGS "-finline-functions-called-once -finline-limit=80")
Expand All @@ -42,4 +46,3 @@ ENDIF()
IF(NOT LMMS_BUILD_APPLE AND NOT LMMS_BUILD_OPENBSD)
SET_TARGET_PROPERTIES(veal PROPERTIES LINK_FLAGS "${LINK_FLAGS} -shared -Wl,-no-undefined")
ENDIF()

4 changes: 4 additions & 0 deletions plugins/LadspaEffect/calf/config.h.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#define VERSION "${VERSION}"
#define PACKAGE_NAME "veal"
#define USE_LADSPA 1
#define PKGLIBDIR ""

// Namespace change to avoid conflict with LV2
#define calf_plugins veal_plugins
2 changes: 1 addition & 1 deletion plugins/LadspaEffect/calf/veal
Submodule veal updated from 816b4d to 7cf84e
25 changes: 25 additions & 0 deletions src/core/DataFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,31 @@ void DataFile::upgrade_1_3_0()
{
attribute.setAttribute( "value", "veal" );
}
else if( attribute.attribute( "name" ) == "plugin" &&
attribute.attribute( "value" ) == "Sidechaincompressor" )
{
attribute.setAttribute( "value", "SidechainCompressor" );
}
else if( attribute.attribute( "name" ) == "plugin" &&
attribute.attribute( "value" ) == "Sidechaingate" )
{
attribute.setAttribute( "value", "SidechainGate" );
}
else if( attribute.attribute( "name" ) == "plugin" &&
attribute.attribute( "value" ) == "Multibandcompressor" )
{
attribute.setAttribute( "value", "MultibandCompressor" );
}
else if( attribute.attribute( "name" ) == "plugin" &&
attribute.attribute( "value" ) == "Multibandgate" )
{
attribute.setAttribute( "value", "MultibandGate" );
}
else if( attribute.attribute( "name" ) == "plugin" &&
attribute.attribute( "value" ) == "Multibandlimiter" )
{
attribute.setAttribute( "value", "MultibandLimiter" );
}
}
}
}
Expand Down
88 changes: 63 additions & 25 deletions src/core/LadspaControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ LadspaControl::LadspaControl( Model * _parent, port_desc_t * _port,
switch( m_port->data_type )
{
case TOGGLED:
m_toggledModel.setInitValue(
static_cast<bool>( m_port->def ) );
connect( &m_toggledModel, SIGNAL( dataChanged() ),
this, SLOT( ledChanged() ) );
if( m_port->def == 1.0f )
Expand All @@ -59,6 +61,7 @@ LadspaControl::LadspaControl( Model * _parent, port_desc_t * _port,
break;

case INTEGER:
case ENUM:
m_knobModel.setRange( static_cast<int>( m_port->max ),
static_cast<int>( m_port->min ),
1 + static_cast<int>( m_port->max -
Expand Down Expand Up @@ -117,6 +120,7 @@ LADSPA_Data LadspaControl::value()
case TOGGLED:
return static_cast<LADSPA_Data>( m_toggledModel.value() );
case INTEGER:
case ENUM:
case FLOATING:
return static_cast<LADSPA_Data>( m_knobModel.value() );
case TIME:
Expand All @@ -136,6 +140,7 @@ ValueBuffer * LadspaControl::valueBuffer()
{
case TOGGLED:
case INTEGER:
case ENUM:
return NULL;
case FLOATING:
return m_knobModel.valueBuffer();
Expand All @@ -159,6 +164,7 @@ void LadspaControl::setValue( LADSPA_Data _value )
m_toggledModel.setValue( static_cast<bool>( _value ) );
break;
case INTEGER:
case ENUM:
m_knobModel.setValue( static_cast<int>( _value ) );
break;
case FLOATING:
Expand Down Expand Up @@ -193,6 +199,7 @@ void LadspaControl::saveSettings( QDomDocument& doc,
m_toggledModel.saveSettings( doc, e, "data" );
break;
case INTEGER:
case ENUM:
case FLOATING:
m_knobModel.saveSettings( doc, e, "data" );
break;
Expand All @@ -216,35 +223,64 @@ void LadspaControl::loadSettings( const QDomElement& parent, const QString& name
QString linkModelName = "link";
QDomElement e = parent.namedItem( name ).toElement();

// COMPAT < 1.0.0: detect old data format where there's either no dedicated sub
// element or there's a direct sub element with automation link information
if( e.isNull() || e.hasAttribute( "id" ) )
if(e.isNull())
{
dataModelName = name;
linkModelName = name + "link";
e = parent;
// the port exists in the current effect, but not in the
// savefile => it's a new port, so load the default value
if( m_link )
m_linkEnabledModel.setValue(m_linkEnabledModel.initValue());
switch( m_port->data_type )
{
case TOGGLED:
m_toggledModel.setValue(m_toggledModel.initValue());
break;
case INTEGER:
case ENUM:
case FLOATING:
m_knobModel.setValue(m_knobModel.initValue());
break;
case TIME:
m_tempoSyncKnobModel.setValue(m_tempoSyncKnobModel.initValue());
break;
default:
printf("LadspaControl::loadSettings BAD BAD BAD\n");
break;
}
}

if( m_link )
else
{
m_linkEnabledModel.loadSettings( e, linkModelName );
}

switch( m_port->data_type )
{
case TOGGLED:
m_toggledModel.loadSettings( e, dataModelName );
break;
case INTEGER:
case FLOATING:
m_knobModel.loadSettings( e, dataModelName );
break;
case TIME:
m_tempoSyncKnobModel.loadSettings( e, dataModelName );
break;
default:
printf("LadspaControl::loadSettings BAD BAD BAD\n");
break;
// COMPAT < 1.0.0: detect old data format where there's either no dedicated sub
// element or there's a direct sub element with automation link information
if( e.isNull() || e.hasAttribute( "id" ) )
{
dataModelName = name;
linkModelName = name + "link";
e = parent;
}

if( m_link )
{
m_linkEnabledModel.loadSettings( e, linkModelName );
}

switch( m_port->data_type )
{
case TOGGLED:
m_toggledModel.loadSettings( e, dataModelName );
break;
case INTEGER:
case ENUM:
case FLOATING:
m_knobModel.loadSettings( e, dataModelName );
break;
case TIME:
m_tempoSyncKnobModel.loadSettings( e, dataModelName );
break;
default:
printf("LadspaControl::loadSettings BAD BAD BAD\n");
break;
}
}
}

Expand All @@ -259,6 +295,7 @@ void LadspaControl::linkControls( LadspaControl * _control )
BoolModel::linkModels( &m_toggledModel, _control->toggledModel() );
break;
case INTEGER:
case ENUM:
case FLOATING:
FloatModel::linkModels( &m_knobModel, _control->knobModel() );
break;
Expand Down Expand Up @@ -309,6 +346,7 @@ void LadspaControl::unlinkControls( LadspaControl * _control )
BoolModel::unlinkModels( &m_toggledModel, _control->toggledModel() );
break;
case INTEGER:
case ENUM:
case FLOATING:
FloatModel::unlinkModels( &m_knobModel, _control->knobModel() );
break;
Expand Down
25 changes: 25 additions & 0 deletions src/core/LadspaManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,31 @@ bool LadspaManager::isInteger( const ladspa_key_t & _plugin,



bool LadspaManager::isEnum( const ladspa_key_t & _plugin, uint32_t _port )
{
if( m_ladspaManagerMap.contains( _plugin )
&& _port < getPortCount( _plugin ) )
{
LADSPA_Descriptor_Function descriptorFunction =
m_ladspaManagerMap[_plugin]->descriptorFunction;
const LADSPA_Descriptor * descriptor =
descriptorFunction(
m_ladspaManagerMap[_plugin]->index );
LADSPA_PortRangeHintDescriptor hintDescriptor =
descriptor->PortRangeHints[_port].HintDescriptor;
// This is an LMMS extension to ladspa
return( LADSPA_IS_HINT_INTEGER( hintDescriptor ) &&
LADSPA_IS_HINT_TOGGLED( hintDescriptor ) );
}
else
{
return( false );
}
}




QString LadspaManager::getPortName( const ladspa_key_t & _plugin,
uint32_t _port )
{
Expand Down
1 change: 1 addition & 0 deletions src/gui/widgets/LadspaControlView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ LadspaControlView::LadspaControlView( QWidget * _parent,
}

case INTEGER:
case ENUM:
case FLOATING:
knb = new Knob( knobBright_26, this, m_ctl->port()->name );
break;
Expand Down