diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2020-08-12 21:03:34 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2020-08-12 21:03:34 +0000 |
| commit | 7ef8d11baeaf1847ba7f1df5d858f8cffea9300d (patch) | |
| tree | a741fb49db8834efd4b46d760b89082547eb2a9d /src/plugins/Effect | |
| parent | 6f301f5880f7efce76ed46e7b502830642b87370 (diff) | |
| download | qmmp-7ef8d11baeaf1847ba7f1df5d858f8cffea9300d.tar.gz qmmp-7ef8d11baeaf1847ba7f1df5d858f8cffea9300d.tar.bz2 qmmp-7ef8d11baeaf1847ba7f1df5d858f8cffea9300d.zip | |
coding style fixes
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9470 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Effect')
| -rw-r--r-- | src/plugins/Effect/bs2b/bs2bplugin.cpp | 5 | ||||
| -rw-r--r-- | src/plugins/Effect/bs2b/bs2bplugin.h | 2 | ||||
| -rw-r--r-- | src/plugins/Effect/ladspa/ladspabutton.h | 4 | ||||
| -rw-r--r-- | src/plugins/Effect/ladspa/ladspahost.cpp | 29 | ||||
| -rw-r--r-- | src/plugins/Effect/ladspa/ladspahost.h | 8 |
5 files changed, 20 insertions, 28 deletions
diff --git a/src/plugins/Effect/bs2b/bs2bplugin.cpp b/src/plugins/Effect/bs2b/bs2bplugin.cpp index 5460e4c9a..74a89b246 100644 --- a/src/plugins/Effect/bs2b/bs2bplugin.cpp +++ b/src/plugins/Effect/bs2b/bs2bplugin.cpp @@ -26,13 +26,12 @@ Bs2bPlugin *Bs2bPlugin::m_instance = nullptr; -Bs2bPlugin::Bs2bPlugin() : Effect() +Bs2bPlugin::Bs2bPlugin() : Effect(), + m_bs2b_handler(bs2b_open()) { m_instance = this; - m_bs2b_handler = bs2b_open(); QSettings settings(Qmmp::configFile(), QSettings::IniFormat); bs2b_set_level(m_bs2b_handler, settings.value("bs2b/level", BS2B_DEFAULT_CLEVEL).toUInt()); - m_chan = 0; } Bs2bPlugin::~Bs2bPlugin() diff --git a/src/plugins/Effect/bs2b/bs2bplugin.h b/src/plugins/Effect/bs2b/bs2bplugin.h index c75256fee..6cff0be39 100644 --- a/src/plugins/Effect/bs2b/bs2bplugin.h +++ b/src/plugins/Effect/bs2b/bs2bplugin.h @@ -42,7 +42,7 @@ public: private: t_bs2bdp m_bs2b_handler; - int m_chan; + int m_chan = 0; QMutex m_mutex; static Bs2bPlugin *m_instance; }; diff --git a/src/plugins/Effect/ladspa/ladspabutton.h b/src/plugins/Effect/ladspa/ladspabutton.h index e29813b20..851cb3493 100644 --- a/src/plugins/Effect/ladspa/ladspabutton.h +++ b/src/plugins/Effect/ladspa/ladspabutton.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2010 by Ilya Kotov * + * Copyright (C) 2010-2020 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -33,7 +33,7 @@ class LADSPAButton : public QCheckBox { Q_OBJECT public: - LADSPAButton(LADSPA_Data *value, QWidget *parent = nullptr); + explicit LADSPAButton(LADSPA_Data *value, QWidget *parent = nullptr); private slots: void enable(bool yes); diff --git a/src/plugins/Effect/ladspa/ladspahost.cpp b/src/plugins/Effect/ladspa/ladspahost.cpp index 0a15b1875..15fe49815 100644 --- a/src/plugins/Effect/ladspa/ladspahost.cpp +++ b/src/plugins/Effect/ladspa/ladspahost.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * Copyright (C) 2002-2003 Nick Lamb <njl195@zepler.org.uk> * * Copyright (C) 2005 Giacomo Lozito <city_hunter@users.sf.net> * - * Copyright (C) 2009-2020 by Ilya Kotov <forkotov02@ya.ru> * + * Copyright (C) 2009-2020 by Ilya Kotov <forkotov02@ya.ru> * * * * 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 * @@ -27,6 +27,7 @@ #include <math.h> #include <stdlib.h> #include <dlfcn.h> +#include <algorithm> #include <qmmp/qmmp.h> #include <qmmp/audioparameters.h> #include "ladspahost.h" @@ -45,26 +46,18 @@ LADSPAHost::LADSPAHost(QObject *parent) : QObject(parent) loadModules(); QSettings settings(Qmmp::configFile(), QSettings::IniFormat); - int p = settings.value("LADSPA/plugins_number", 0).toInt(); - for(int i = 0; i < p; ++i) + int pluginNumber = settings.value("LADSPA/plugin_number", 0).toInt(); + for(int i = 0; i < pluginNumber; ++i) { QString section = QString("LADSPA_%1/").arg(i); settings.beginGroup(section); int id = settings.value("id").toInt(); - - LADSPAPlugin *plugin = nullptr; - for(LADSPAPlugin *p : plugins()) - { - if(p->unique_id == id) - { - plugin = p; - break; - } - } - if(!plugin) + auto it = std::find_if(m_plugins.cbegin(), m_plugins.cend(), [id](LADSPAPlugin *p){ return p->unique_id = id; }); + if(it == m_plugins.cend()) continue; + LADSPAPlugin *plugin = *it; LADSPAEffect *effect = createEffect(plugin); for(LADSPAControl *c : qAsConst(effect->controls)) c->value = settings.value(QString("port%1").arg(c->port), c->value).toFloat(); @@ -78,11 +71,11 @@ LADSPAHost::~LADSPAHost() { m_instance = nullptr; QSettings settings(Qmmp::configFile(), QSettings::IniFormat); - for(int i = 0; i < settings.value("LADSPA/plugins_number", 0).toInt(); ++i) + for(int i = 0; i < settings.value("LADSPA/plugin_number", 0).toInt(); ++i) { settings.remove(QString("LADSPA_%1/").arg(i)); } - settings.setValue("LADSPA/plugins_number", m_effects.count()); + settings.setValue("LADSPA/plugin_number", m_effects.count()); for(int i = 0; i < m_effects.count(); ++i) { QString section = QString("LADSPA_%1/").arg(i); @@ -388,12 +381,12 @@ void LADSPAHost::deactivateEffect(LADSPAEffect *e) e->handles.clear(); } -QList <LADSPAPlugin *> LADSPAHost::plugins() +const QList<LADSPAPlugin *> &LADSPAHost::plugins() const { return m_plugins; } -QList <LADSPAEffect *> LADSPAHost::effects() +const QList <LADSPAEffect *> &LADSPAHost::effects() const { return m_effects; } diff --git a/src/plugins/Effect/ladspa/ladspahost.h b/src/plugins/Effect/ladspa/ladspahost.h index 131f874bd..02f260b91 100644 --- a/src/plugins/Effect/ladspa/ladspahost.h +++ b/src/plugins/Effect/ladspa/ladspahost.h @@ -1,7 +1,7 @@ /*************************************************************************** * Copyright (C) 2002,2003 Nick Lamb <njl195@zepler.org.uk> * * Copyright (C) 2005 Giacomo Lozito <city_hunter@users.sf.net> * - * Copyright (C) 2009-2020 by Ilya Kotov <forkotov02@ya.ru> * + * Copyright (C) 2009-2020 by Ilya Kotov <forkotov02@ya.ru> * * * * 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 * @@ -77,14 +77,14 @@ class LADSPAHost : public QObject { Q_OBJECT public: - LADSPAHost(QObject *parent); + explicit LADSPAHost(QObject *parent); virtual ~LADSPAHost(); int applyEffect(float *data, size_t samples); void configure(quint32 freq, int chan); - QList <LADSPAPlugin *> plugins(); - QList <LADSPAEffect *> effects(); + const QList<LADSPAPlugin *> &plugins() const; + const QList<LADSPAEffect *> &effects() const; void load(LADSPAPlugin *plugin); void unload(LADSPAEffect *effect); |
