Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
First attempt. Remove lists work, but adding has no effect.
  • Loading branch information
JohannesLorenz committed Mar 16, 2018
commit 021e60423be7f30c35a66cfd4b82f9f885522f52
130 changes: 97 additions & 33 deletions src/core/DataFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,47 @@ void DataFile::upgrade_1_2_0_rc2_42()
}


/**
* Helper function to call a functor for all effect ports' DomElements,
* providing the functor with lists to add and remove DomElements. Helpful for
* patching port values from savefiles.
*/
template<class Ftor>
void iterate_ladspa_ports(QDomElement& effect, Ftor& ftor)
{
// Head back up the DOM to upgrade ports
QDomNodeList ladspacontrols = effect.elementsByTagName( "ladspacontrols" );
for( int m = 0; !ladspacontrols.item( m ).isNull(); ++m )
{
QList<QDomElement> addList, removeList;
QDomElement ladspacontrol = ladspacontrols.item( m ).toElement();
for( QDomElement port = ladspacontrol.firstChild().toElement();
!port.isNull(); port = port.nextSibling().toElement() )
{
QStringList parts = port.tagName().split("port");
// Not a "port"
if ( parts.size() < 2 )
{
continue;
}
int num = parts[1].toInt();

ftor(port, num, addList, removeList);
}
// Add ports marked for adding
for ( QDomElement e : addList )
{
puts("ADD");
ladspacontrol.appendChild( e );
}
// Remove ports marked for removal
for ( QDomElement e : removeList )
{
ladspacontrol.removeChild( e );
}
}
}

void DataFile::upgrade_1_3_0()
{
QDomNodeList list = elementsByTagName( "instrument" );
Expand Down Expand Up @@ -1009,6 +1050,7 @@ void DataFile::upgrade_1_3_0()
QDomNodeList attributes = key.elementsByTagName( "attribute" );
for( int k = 0; !attributes.item( k ).isNull(); ++k )
{
// Effect name changes
QDomElement attribute = attributes.item( k ).toElement();
if( attribute.attribute( "name" ) == "file" &&
( attribute.attribute( "value" ) == "calf" ||
Expand Down Expand Up @@ -1041,55 +1083,77 @@ void DataFile::upgrade_1_3_0()
{
attribute.setAttribute( "value", "MultibandLimiter" );
}


// Handle port changes
if( attribute.attribute( "name" ) == "plugin" &&
( attribute.attribute( "value" ) == "MultibandLimiter" ||
attribute.attribute( "value" ) == "MultibandCompressor" ||
attribute.attribute( "value" ) == "MultibandGate" ) )
{
auto fn = [&](QDomElement& port, int num, QList<QDomElement>&, QList<QDomElement>& removeList)
{
// Mark ports for removal
if ( num >= 18 && num <= 23 )
{
removeList << port;
}
// Bump higher ports up 6 positions
else if ( num >= 24 )
{
// port01...port010, etc
QString name( "port0" );
name.append( QString::number( num -6 ) );
port.setTagName( name );
}
};
iterate_ladspa_ports(effect, fn);
}

// Head back up the DOM to upgrade ports
QDomNodeList ladspacontrols = effect.elementsByTagName( "ladspacontrols" );
for( int m = 0; !ladspacontrols.item( m ).isNull(); ++m )
if( attribute.attribute( "name" ) == "plugin" &&
( attribute.attribute( "value" ) == "Pulsator" ) )
{
auto fn = [&](QDomElement& port, int num, QList<QDomElement>& addList, QList<QDomElement>& removeList)
{
QList<QDomElement> removeList;
QDomElement ladspacontrol = ladspacontrols.item( m ).toElement();
for( QDomElement port = ladspacontrol.firstChild().toElement();
!port.isNull(); port = port.nextSibling().toElement() )
switch(num)
{
QStringList parts = port.tagName().split("port");
// Not a "port"
if ( parts.size() < 2 )
{
continue;
}
int num = parts[1].toInt();
// Leave as-is
if ( num <= 17 )
{
continue;
}
// Mark ports for removal
if ( num >= 18 && num <= 23 )
case 16:
{
// old freq is now at port 25
QDomElement portCopy = createElement("port25");
portCopy.setAttribute("data", port.attribute("data"));
addList << portCopy;
// remove old freq port
removeList << port;
// set the "timing" port to choose port23+2=port25 (timing in Hz)
QDomElement timing = createElement("port22");
timing.setAttribute("data", 2);
addList << timing;
break;
}
// Bump higher ports up 6 positions
else if ( num >= 24 )
// port 18 (modulation) => 17
case 17:
port.setTagName("port16");
break;
case 18:
{
// port01...port010, etc
QString name( "port0" );
name.append( QString::number( num -6 ) );
port.setTagName( name );
// leave port 18 (offsetr), but add port 17 (offsetl)
QDomElement offsetl = createElement("port17");
offsetl.setAttribute("data", .0f);
addList << offsetl;
// additional: bash port 21 to 1
QDomElement pulsewidth = createElement("port21");
pulsewidth.setAttribute("data", 1.f);
addList << pulsewidth;
break;
}
}
// Remove ports marked for removal
for ( QDomElement e : removeList )
{
ladspacontrol.removeChild( e );
}
}


};
iterate_ladspa_ports(effect, fn);
}

}
}
}
Expand Down