13 #ifndef __ZERBERUS_H__ 14 #define __ZERBERUS_H__ 33 static const int MAX_VOICES = 512;
34 static const int MAX_CHANNELS = 256;
35 static const int MAX_TRIGGER = 512;
43 std::vector< std::unique_ptr<Voice> >
voices;
47 voices.resize(MAX_VOICES);
51 for (
int i = 0; i < MAX_VOICES; ++i) {
52 voices.push_back(std::unique_ptr<Voice>(
new Voice(z)));
53 buffer.push(voices.back().get());
62 Q_ASSERT(!buffer.empty());
63 Voice* v = buffer.front();
68 bool empty()
const {
return buffer.empty(); }
80 double _masterTuning = 440.0;
86 int allocatedVoices = 0;
89 int _loadProgress = 0;
90 bool _loadWasCanceled =
false;
94 void programChange(
int channel,
int program);
95 void trigger(
Channel*,
int key,
int velo,
Trigger,
int cc,
int ccVal,
double durSinceNoteOn);
96 void processNoteOff(
Channel*,
int pitch);
97 void processNoteOn(
Channel* cp,
int key,
int velo);
103 virtual void process(
unsigned frames,
float*,
float*,
float*);
106 bool loadInstrument(
const QString&);
119 double ct2hz(
double c)
const {
return pow(2.0, (c-6900.0) / 1200.0) * masterTuning(); }
121 virtual const char* name()
const;
126 virtual void allSoundsOff(
int channel);
127 virtual void allNotesOff(
int channel);
129 virtual bool addSoundFont(
const QString&);
130 virtual bool removeSoundFont(
const QString&);
131 virtual bool loadSoundFonts(
const QStringList&);
132 virtual bool removeSoundFonts(
const QStringList& fileNames);
133 QStringList soundFonts()
const;
134 std::vector<Ms::SoundFontInfo> soundFontsInfo()
const override;
136 virtual const QList<Ms::MidiPatch*>&
getPatchInfo()
const override {
return patches; }
138 void updatePatchList();
141 static QFileInfoList sfzFiles();
Definition: instrument.h:30
QMutex mutex
Definition: zerberus.h:92
VoiceFifo freeVoices
Definition: zerberus.h:87
std::vector< std::unique_ptr< Voice > > voices
Definition: zerberus.h:43
virtual double masterTuning() const
Definition: zerberus.h:117
Voice * getActiveVoices()
Definition: zerberus.h:109
virtual void setMasterTuning(double val)
Definition: zerberus.h:116
Definition: synthesizer.h:41
void push(Voice *v)
Definition: zerberus.h:57
static bool initialized
Definition: zerberus.h:76
virtual const QList< Ms::MidiPatch * > & getPatchInfo() const override
Definition: zerberus.h:136
Definition: zerberus.h:75
bool loadWasCanceled()
Definition: zerberus.h:113
void setLoadProgress(int val)
Definition: zerberus.h:112
Definition: synthesizergui.h:24
int loadProgress()
Definition: zerberus.h:111
std::atomic< bool > busy
Definition: zerberus.h:81
Channel * channel(int n)
Definition: zerberus.h:110
Trigger
Definition: zone.h:23
double ct2hz(double c) const
Definition: zerberus.h:119
Definition: zerberus.h:41
void setLoadWasCanceled(bool status)
Definition: zerberus.h:114
bool empty() const
Definition: zerberus.h:68
QList< Ms::MidiPatch * > patches
Definition: zerberus.h:78
Definition: synthesizerstate.h:40
std::queue< Voice * > buffer
Definition: zerberus.h:42
Voice * pop()
Definition: zerberus.h:61
void init(Zerberus *z)
Definition: zerberus.h:50
std::list< ZInstrument * > instruments
Definition: zerberus.h:83
VoiceFifo()
Definition: zerberus.h:46
static std::list< ZInstrument * > globalInstruments
Definition: zerberus.h:77