MuseScore  3.4
Music composition and notation
effect.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseSynth
3 // Music Software Synthesizer
4 //
5 // Copyright (C) 2013 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __EFFECT_H__
14 #define __EFFECT_H__
15 
16 #include <vector>
18 
19 namespace Ms {
20 
21 class EffectGui;
22 
23 //---------------------------------------------------------
24 // ParDescr
25 // parameter description
26 //---------------------------------------------------------
27 
28 struct ParDescr {
29  int id; // index in parameter list
30  const char* name;
31  bool log;
32  float min;
33  float max;
34  float init;
35  };
36 
37 //---------------------------------------------------------
38 // Effect
39 //---------------------------------------------------------
40 
41 class Effect : public QObject {
42  Q_OBJECT
43 
44  protected:
45  EffectGui* _gui { nullptr };
46 
47  public slots:
48  virtual void setValue(const QString& name, double value);
49  virtual void setValue(int idx, double value);
50  virtual void setNValue(int idx, double value) = 0;
51 
52  public:
53  Effect() : QObject() { }
54  virtual ~Effect() {}
55  virtual void process(int frames, float*, float*) = 0;
56  virtual const char* name() const = 0;
57  virtual void init(float /*sampleRate*/) {}
58  virtual const std::vector<ParDescr>& parDescr() const = 0;
59 
60  Q_INVOKABLE qreal value(const QString& name) const;
61  virtual double value(int idx) const;
62  virtual double nvalue(int /*idx*/) const { return .0; }
63 
64  virtual const ParDescr* parameter(int idx) const;
65  virtual const ParDescr* parameter(const QString&) const;
66 
67  virtual SynthesizerGroup state() const { return SynthesizerGroup(); }
68  virtual void setState(const SynthesizerGroup&) {}
69 
70  virtual EffectGui* gui() { return _gui; }
71  };
72 }
73 #endif
74 
Definition: effect.h:41
Definition: effectgui.h:24
int id
Definition: effect.h:29
bool log
Definition: effect.h:31
Definition: effect.h:28
float min
Definition: effect.h:32
Effect()
Definition: effect.h:53
virtual void init(float)
Definition: effect.h:57
virtual EffectGui * gui()
Definition: effect.h:70
Definition: aeolus.cpp:26
virtual ~Effect()
Definition: effect.h:54
Definition: synthesizerstate.h:40
const char * name
Definition: effect.h:30
float init
Definition: effect.h:34
virtual SynthesizerGroup state() const
Definition: effect.h:67
virtual void setState(const SynthesizerGroup &)
Definition: effect.h:68
virtual double nvalue(int) const
Definition: effect.h:62
float max
Definition: effect.h:33