File indexing completed on 2024-05-05 03:51:30

0001 /****************************************************************************
0002 **
0003 ** Copyright (C) 2016 by Sandro S. Andrade <sandroandrade@kde.org>
0004 **
0005 ** This program is free software; you can redistribute it and/or
0006 ** modify it under the terms of the GNU General Public License as
0007 ** published by the Free Software Foundation; either version 2 of
0008 ** the License or (at your option) version 3 or any later version
0009 ** accepted by the membership of KDE e.V. (or its successor approved
0010 ** by the membership of KDE e.V.), which shall act as a proxy
0011 ** defined in Section 14 of version 3 of the license.
0012 **
0013 ** This program is distributed in the hope that it will be useful,
0014 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
0015 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016 ** GNU General Public License for more details.
0017 **
0018 ** You should have received a copy of the GNU General Public License
0019 ** along with this program.  If not, see <http://www.gnu.org/licenses/>.
0020 **
0021 ****************************************************************************/
0022 #ifndef MINUET_CSOUNDSOUNDCONTROLLER_H
0023 #define MINUET_CSOUNDSOUNDCONTROLLER_H
0024 
0025 #include <interfaces/isoundcontroller.h>
0026 
0027 class CsEngine;
0028 
0029 class CsoundSoundController : public Minuet::ISoundController
0030 {
0031     Q_OBJECT
0032 
0033     Q_INTERFACES(Minuet::IPlugin)
0034     Q_INTERFACES(Minuet::ISoundController)
0035 
0036 public:
0037     explicit CsoundSoundController(QObject *parent = 0);
0038     virtual ~CsoundSoundController() override;
0039 
0040 public Q_SLOTS:
0041     virtual void setPitch(qint8 pitch);
0042     virtual void setVolume(quint8 volume);
0043     virtual void setTempo(quint8 tempo);
0044 
0045     virtual void prepareFromExerciseOptions(QJsonArray selectedExerciseOptions) override;
0046     virtual void prepareFromMidiFile(const QString &fileName) override;
0047 
0048     virtual void play() override;
0049     virtual void pause() override;
0050     virtual void stop() override;
0051     virtual void reset() override;
0052 
0053 private:
0054     void appendEvent(QList<unsigned int> midiNotes, QList<float> barStartInfo, QString playMode);
0055     void openExerciseFile();
0056     void openCsdFile();
0057 
0058 private:
0059     CsEngine *m_csoundEngine;
0060     QStringList m_begLine;
0061     QStringList m_endLine;
0062     QList<qint16> m_size;
0063 };
0064 
0065 #endif