123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- /*
- This file is part of QTau
- Copyright (C) 2013-2018 Tobias "Tomoko" Platen <tplaten@posteo.de>
- Copyright (C) 2013 digited <https://github.com/digited>
- Copyright (C) 2010-2013 HAL@ShurabaP <https://github.com/haruneko>
- QTau is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- SPDX-License-Identifier: GPL-3.0+
- */
- #ifndef LESYNTH_H
- #define LESYNTH_H
- #include "PluginInterfaces.h"
- #include <QJsonArray>
- #include <QList>
- #include <QMap>
- //for epr synth
- #include <sekai/hzosc.h>
- #include <sekai/epr.h>
- #include "sekai/common.h"
- #define RES_COUNT 5
- #include "jack/ringbuffer.h"
- #include "sndfile.h"
- #include <QThread>
- #include <QMap>
- #include <QString>
- #include <QStringList>
- struct formant
- {
- int f1;
- int f2;
- };
- struct noteEvent
- {
- float startPos;
- float endPos;
- formant fo;
- float f0;
- };
- class EpRSynth : public QObject, public ISynth
- {
- Q_OBJECT
- Q_PLUGIN_METADATA(IID c_isynth_comname FILE "epr_synth.json")
- Q_INTERFACES(ISynth)
- public:
- EpRSynth() {}
- //plugin loading
- QString name() override;
- QString description() override;
- QString version() override;
- void setup(IController *ctrl) override;
- //synth base
- bool setCacheDir(QString cacheDir) override;
- bool synthesize(IScore* score) override;
- bool synthIsRealtime() override;
- int readData(float *data, int size) override;
- //lyricizer
- QString getTranscription(QString txt) override;
- bool doPhonemeTransformation(QStringList& lyrics) override;
- //voice manager
- bool setVoice(QString voiceName) override;
- QStringList listVoices() override;
- private:
- void genOneFrame();
- private:
- QMap<QString,formant> _formantMap;
- QList<noteEvent> _notes;
- int _pos;
- int _currentNote;
- bool _stop;
- IController* _ctrl;
- int _jack_samplerate;
- IFFTOsc _osc;
- EprResonance _res[RES_COUNT+2];
- bool _resEnabled[RES_COUNT+2];
- EprSourceParams _src;
- signals:
- void endOfThread();
- void logError(QString error);
- void logSuccess(QString success);
- void logDebug(QString debug);
- public slots:
- void on_logError(QString error);
- void on_logSuccess(QString success);
- void on_logDebug(QString debug);
- void on_endOfThread();
- };
- #define SETSEEK 1
- #endif // LESYNTH_H
|