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