annotate widgets/PluginParameterBox.h @ 1614:c6f5c822b10d

Fix potential divide-by-zero (depending on a race elsewhere)
author Chris Cannam
date Tue, 30 Jun 2020 10:56:56 +0100
parents 7eb595837eaa
children
rev   line source
Chris@60 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@60 2
Chris@60 3 /*
Chris@60 4 Sonic Visualiser
Chris@60 5 An audio file viewer and annotation editor.
Chris@60 6 Centre for Digital Music, Queen Mary, University of London.
Chris@182 7 This file copyright 2006 Chris Cannam and QMUL.
Chris@60 8
Chris@60 9 This program is free software; you can redistribute it and/or
Chris@60 10 modify it under the terms of the GNU General Public License as
Chris@60 11 published by the Free Software Foundation; either version 2 of the
Chris@60 12 License, or (at your option) any later version. See the file
Chris@60 13 COPYING included with this distribution for more information.
Chris@60 14 */
Chris@60 15
Chris@1407 16 #ifndef SV_PLUGIN_PARAMETER_BOX_H
Chris@1407 17 #define SV_PLUGIN_PARAMETER_BOX_H
Chris@60 18
Chris@442 19 #include <vamp-hostsdk/PluginBase.h>
Chris@60 20
Chris@60 21 #include <QFrame>
Chris@60 22 #include <map>
Chris@1597 23 #include <memory>
Chris@60 24
Chris@60 25 class AudioDial;
Chris@60 26 class QDoubleSpinBox;
Chris@63 27 class QCheckBox;
Chris@60 28 class QGridLayout;
Chris@74 29 class QComboBox;
Chris@60 30
Chris@60 31 class PluginParameterBox : public QFrame
Chris@60 32 {
Chris@60 33 Q_OBJECT
Chris@60 34
Chris@60 35 public:
Chris@1581 36 PluginParameterBox(std::shared_ptr<Vamp::PluginBase>,
Chris@1581 37 QWidget *parent = 0);
Chris@60 38 ~PluginParameterBox();
Chris@60 39
Chris@1581 40 std::shared_ptr<Vamp::PluginBase> getPlugin() { return m_plugin; }
Chris@60 41
Chris@64 42 signals:
Chris@64 43 void pluginConfigurationChanged(QString);
Chris@64 44
Chris@60 45 protected slots:
Chris@60 46 void dialChanged(int);
Chris@60 47 void spinBoxChanged(double);
Chris@63 48 void checkBoxChanged(int);
Chris@63 49 void programComboChanged(const QString &);
Chris@60 50
Chris@60 51 protected:
Chris@60 52 void populate();
Chris@293 53 void updateProgramCombo();
Chris@60 54
Chris@60 55 QGridLayout *m_layout;
Chris@1581 56 std::shared_ptr<Vamp::PluginBase> m_plugin;
Chris@60 57
Chris@60 58 struct ParamRec {
Chris@60 59 AudioDial *dial;
Chris@60 60 QDoubleSpinBox *spin;
Chris@63 61 QCheckBox *check;
Chris@74 62 QComboBox *combo;
Chris@71 63 Vamp::PluginBase::ParameterDescriptor param;
Chris@60 64 };
Chris@60 65
Chris@293 66 QComboBox *m_programCombo;
Chris@293 67
Chris@60 68 std::map<QString, ParamRec> m_params;
Chris@207 69 std::map<QString, QString> m_nameMap;
Chris@293 70 Vamp::PluginBase::ProgramList m_programs;
Chris@60 71 };
Chris@60 72
Chris@60 73 #endif
Chris@60 74