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

Fix LMMS plugin issues #6670

Merged
merged 30 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
fbe01f7
Fix Organic automated harmonic parameter loading
messmerd Mar 14, 2023
413c668
Fix Kicker automated end distortion parameter loading
messmerd Mar 14, 2023
70a9b37
Fix AudioFileProcessor automated interpolation parameter loading
messmerd Mar 14, 2023
3e148c9
Fix Vibed automated volume parameter loading
messmerd Mar 14, 2023
8698b32
Improve coding style/formatting
messmerd Mar 14, 2023
0341160
Fix #6671
messmerd Mar 14, 2023
3eed6dd
Fix Vibed memory leaks
messmerd Mar 14, 2023
b9ffb79
Refactor Vibed instrument
messmerd Mar 15, 2023
62dc38e
Fix build
messmerd Mar 15, 2023
87c341b
Try to fix build again
messmerd Mar 15, 2023
5be484a
Revert previous commit
messmerd Mar 15, 2023
8095e4b
Replace more raw pointers with smart pointers
messmerd Mar 15, 2023
2741fef
Remove unused files
messmerd Mar 15, 2023
cb76ae0
Minor changes
messmerd Mar 15, 2023
0b1a464
Update plugins/Vibed/Vibed.cpp
messmerd Mar 15, 2023
074b4f5
Implement suggestions from review
messmerd Mar 15, 2023
9ecf875
Minor changes
messmerd Mar 18, 2023
de08ab0
Only check plugin data pointer
messmerd Mar 18, 2023
3a64d2c
Refactor NineButtonSelector
messmerd Mar 19, 2023
eff5788
Fix memory leaks during heavy tempo automation
messmerd Mar 21, 2023
681554b
Merge branch 'master' into b6669-fix
messmerd Apr 19, 2023
56b34cf
Fix build
messmerd Apr 19, 2023
690925d
Use s_stringCount
messmerd Apr 22, 2023
e42aa05
Replace some vectors with arrays
messmerd Apr 22, 2023
4dc6bd8
Use array instead of switch
messmerd Jun 24, 2023
68c29f1
Allow compiler to generate move assignment operator
messmerd Jun 24, 2023
6d71c68
Fix loading of old automated detune values
messmerd Jun 24, 2023
49c168c
Fix member variable names
messmerd Jun 24, 2023
85630b2
Merge branch 'LMMS:master' into b6669-fix
messmerd Jul 2, 2023
7cba5a5
Address review comments
messmerd Aug 21, 2023
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
73 changes: 34 additions & 39 deletions plugins/AudioFileProcessor/AudioFileProcessor.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* AudioFileProcessor.cpp - instrument for using audio-files
* AudioFileProcessor.cpp - instrument for using audio files
*
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
Expand Down Expand Up @@ -47,7 +47,6 @@
#include "embed.h"
#include "plugin_export.h"


namespace lmms
{

Expand Down Expand Up @@ -205,74 +204,70 @@ void AudioFileProcessor::deleteNotePluginData( NotePlayHandle * _n )



void AudioFileProcessor::saveSettings( QDomDocument & _doc,
QDomElement & _this )
void AudioFileProcessor::saveSettings(QDomDocument& doc, QDomElement& elem)
{
_this.setAttribute( "src", m_sampleBuffer.audioFile() );
if( m_sampleBuffer.audioFile() == "" )
elem.setAttribute("src", m_sampleBuffer.audioFile());
if (m_sampleBuffer.audioFile() == "")
{
QString s;
_this.setAttribute( "sampledata",
m_sampleBuffer.toBase64( s ) );
elem.setAttribute("sampledata", m_sampleBuffer.toBase64(s));
}
m_reverseModel.saveSettings( _doc, _this, "reversed" );
m_loopModel.saveSettings( _doc, _this, "looped" );
m_ampModel.saveSettings( _doc, _this, "amp" );
m_startPointModel.saveSettings( _doc, _this, "sframe" );
m_endPointModel.saveSettings( _doc, _this, "eframe" );
m_loopPointModel.saveSettings( _doc, _this, "lframe" );
m_stutterModel.saveSettings( _doc, _this, "stutter" );
m_interpolationModel.saveSettings( _doc, _this, "interp" );

m_reverseModel.saveSettings(doc, elem, "reversed");
m_loopModel.saveSettings(doc, elem, "looped");
m_ampModel.saveSettings(doc, elem, "amp");
m_startPointModel.saveSettings(doc, elem, "sframe");
m_endPointModel.saveSettings(doc, elem, "eframe");
m_loopPointModel.saveSettings(doc, elem, "lframe");
m_stutterModel.saveSettings(doc, elem, "stutter");
m_interpolationModel.saveSettings(doc, elem, "interp");
}




void AudioFileProcessor::loadSettings( const QDomElement & _this )
void AudioFileProcessor::loadSettings(const QDomElement& elem)
{
if( _this.attribute( "src" ) != "" )
if (elem.attribute("src") != "")
{
setAudioFile( _this.attribute( "src" ), false );
setAudioFile(elem.attribute("src"), false);

QString absolutePath = PathUtil::toAbsolute( m_sampleBuffer.audioFile() );
if ( !QFileInfo( absolutePath ).exists() )
QString absolutePath = PathUtil::toAbsolute(m_sampleBuffer.audioFile());
if (!QFileInfo(absolutePath).exists())
{
QString message = tr( "Sample not found: %1" ).arg( m_sampleBuffer.audioFile() );

Engine::getSong()->collectError( message );
QString message = tr("Sample not found: %1").arg(m_sampleBuffer.audioFile());
Engine::getSong()->collectError(message);
}
}
else if( _this.attribute( "sampledata" ) != "" )
else if (elem.attribute("sampledata") != "")
{
m_sampleBuffer.loadFromBase64( _this.attribute( "srcdata" ) );
m_sampleBuffer.loadFromBase64(elem.attribute("srcdata"));
}

m_loopModel.loadSettings( _this, "looped" );
m_ampModel.loadSettings( _this, "amp" );
m_endPointModel.loadSettings( _this, "eframe" );
m_startPointModel.loadSettings( _this, "sframe" );
m_loopModel.loadSettings(elem, "looped");
m_ampModel.loadSettings(elem, "amp");
m_endPointModel.loadSettings(elem, "eframe");
m_startPointModel.loadSettings(elem, "sframe");

// compat code for not having a separate loopback point
if (_this.hasAttribute("lframe") || !(_this.firstChildElement("lframe").isNull()))
if (elem.hasAttribute("lframe") || !elem.firstChildElement("lframe").isNull())
{
m_loopPointModel.loadSettings( _this, "lframe" );
m_loopPointModel.loadSettings(elem, "lframe");
}
else
{
m_loopPointModel.loadSettings( _this, "sframe" );
m_loopPointModel.loadSettings(elem, "sframe");
}

m_reverseModel.loadSettings( _this, "reversed" );
m_reverseModel.loadSettings(elem, "reversed");

m_stutterModel.loadSettings( _this, "stutter" );
if( _this.hasAttribute( "interp" ) )
m_stutterModel.loadSettings(elem, "stutter");
if (elem.hasAttribute("interp") || !elem.firstChildElement("interp").isNull())
{
m_interpolationModel.loadSettings( _this, "interp" );
m_interpolationModel.loadSettings(elem, "interp");
}
else
{
m_interpolationModel.setValue( 1 ); //linear by default
m_interpolationModel.setValue(1.0f); // linear by default
}

pointChanged();
Expand Down
12 changes: 5 additions & 7 deletions plugins/AudioFileProcessor/AudioFileProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
*
*/


#ifndef AUDIO_FILE_PROCESSOR_H
#define AUDIO_FILE_PROCESSOR_H
#ifndef LMMS_AUDIO_FILE_PROCESSOR_H
#define LMMS_AUDIO_FILE_PROCESSOR_H

#include <QPixmap>

Expand Down Expand Up @@ -61,9 +60,8 @@ class AudioFileProcessor : public Instrument
sampleFrame * _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;

void saveSettings( QDomDocument & _doc,
QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
void saveSettings(QDomDocument& doc, QDomElement& elem) override;
void loadSettings(const QDomElement& elem) override;

void loadFile( const QString & _file ) override;

Expand Down Expand Up @@ -303,4 +301,4 @@ public slots:

} // namespace lmms

#endif
#endif // LMMS_AUDIO_FILE_PROCESSOR_H
80 changes: 39 additions & 41 deletions plugins/Kicker/Kicker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
*
*/


#include "Kicker.h"

#include <QDomElement>

#include "Kicker.h"
#include "AudioEngine.h"
#include "Engine.h"
#include "InstrumentTrack.h"
Expand Down Expand Up @@ -85,65 +84,64 @@ KickerInstrument::KickerInstrument( InstrumentTrack * _instrument_track ) :



void KickerInstrument::saveSettings( QDomDocument & _doc,
QDomElement & _this )
void KickerInstrument::saveSettings(QDomDocument& doc, QDomElement& elem)
{
m_startFreqModel.saveSettings( _doc, _this, "startfreq" );
m_endFreqModel.saveSettings( _doc, _this, "endfreq" );
m_decayModel.saveSettings( _doc, _this, "decay" );
m_distModel.saveSettings( _doc, _this, "dist" );
m_distEndModel.saveSettings( _doc, _this, "distend" );
m_gainModel.saveSettings( _doc, _this, "gain" );
m_envModel.saveSettings( _doc, _this, "env" );
m_noiseModel.saveSettings( _doc, _this, "noise" );
m_clickModel.saveSettings( _doc, _this, "click" );
m_slopeModel.saveSettings( _doc, _this, "slope" );
m_startNoteModel.saveSettings( _doc, _this, "startnote" );
m_endNoteModel.saveSettings( _doc, _this, "endnote" );
m_versionModel.saveSettings( _doc, _this, "version" );
m_startFreqModel.saveSettings(doc, elem, "startfreq");
m_endFreqModel.saveSettings(doc, elem, "endfreq");
m_decayModel.saveSettings(doc, elem, "decay");
m_distModel.saveSettings(doc, elem, "dist");
m_distEndModel.saveSettings(doc, elem, "distend");
m_gainModel.saveSettings(doc, elem, "gain");
m_envModel.saveSettings(doc, elem, "env");
m_noiseModel.saveSettings(doc, elem, "noise");
m_clickModel.saveSettings(doc, elem, "click");
m_slopeModel.saveSettings(doc, elem, "slope");
m_startNoteModel.saveSettings(doc, elem, "startnote");
m_endNoteModel.saveSettings(doc, elem, "endnote");
m_versionModel.saveSettings(doc, elem, "version");
}




void KickerInstrument::loadSettings( const QDomElement & _this )
void KickerInstrument::loadSettings(const QDomElement& elem)
{
m_versionModel.loadSettings( _this, "version" );
m_versionModel.loadSettings(elem, "version");

m_startFreqModel.loadSettings( _this, "startfreq" );
m_endFreqModel.loadSettings( _this, "endfreq" );
m_decayModel.loadSettings( _this, "decay" );
m_distModel.loadSettings( _this, "dist" );
if( _this.hasAttribute( "distend" ) )
m_startFreqModel.loadSettings(elem, "startfreq");
m_endFreqModel.loadSettings(elem, "endfreq");
m_decayModel.loadSettings(elem, "decay");
m_distModel.loadSettings(elem, "dist");
if (elem.hasAttribute("distend") || !elem.firstChildElement("distend").isNull())
{
m_distEndModel.loadSettings( _this, "distend" );
m_distEndModel.loadSettings(elem, "distend");
}
else
{
m_distEndModel.setValue( m_distModel.value() );
m_distEndModel.setValue(m_distModel.value());
}
m_gainModel.loadSettings( _this, "gain" );
m_envModel.loadSettings( _this, "env" );
m_noiseModel.loadSettings( _this, "noise" );
m_clickModel.loadSettings( _this, "click" );
m_slopeModel.loadSettings( _this, "slope" );
m_startNoteModel.loadSettings( _this, "startnote" );
if( m_versionModel.value() < 1 )
m_gainModel.loadSettings(elem, "gain");
m_envModel.loadSettings(elem, "env");
m_noiseModel.loadSettings(elem, "noise");
m_clickModel.loadSettings(elem, "click");
m_slopeModel.loadSettings(elem, "slope");
m_startNoteModel.loadSettings(elem, "startnote");
if (m_versionModel.value() < 1)
{
m_startNoteModel.setValue( false );
}
m_endNoteModel.loadSettings( _this, "endnote" );
m_endNoteModel.loadSettings(elem, "endnote");

// Try to maintain backwards compatibility
if( !_this.hasAttribute( "version" ) )
if (!elem.hasAttribute("version"))
{
m_startNoteModel.setValue( false );
m_decayModel.setValue( m_decayModel.value() * 1.33f );
m_envModel.setValue( 1.0f );
m_slopeModel.setValue( 1.0f );
m_clickModel.setValue( 0.0f );
m_startNoteModel.setValue(false);
m_decayModel.setValue(m_decayModel.value() * 1.33f);
m_envModel.setValue(1.0f);
m_slopeModel.setValue(1.0f);
m_clickModel.setValue(0.0f);
}
m_versionModel.setValue( KICKER_PRESET_VERSION );
m_versionModel.setValue(KICKER_PRESET_VERSION);
}


Expand Down
11 changes: 5 additions & 6 deletions plugins/Kicker/Kicker.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@
*
*/


#ifndef KICKER_H
#define KICKER_H
#ifndef LMMS_KICKER_H
#define LMMS_KICKER_H

#include "AutomatableModel.h"
#include "Instrument.h"
Expand Down Expand Up @@ -60,8 +59,8 @@ class KickerInstrument : public Instrument
sampleFrame * _working_buffer ) override;
void deleteNotePluginData( NotePlayHandle * _n ) override;

void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
void loadSettings( const QDomElement & _this ) override;
void saveSettings(QDomDocument& doc, QDomElement& elem) override;
void loadSettings(const QDomElement& elem) override;

QString nodeName() const override;

Expand Down Expand Up @@ -135,4 +134,4 @@ class KickerInstrumentView : public InstrumentViewFixedSize

} // namespace lmms

#endif
#endif // LMMS_KICKER_H
Loading