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 0023 #ifndef MINUET_ISOUNDCONTROLLER_H 0024 #define MINUET_ISOUNDCONTROLLER_H 0025 0026 #include "iplugin.h" 0027 0028 #include <interfaces/minuetinterfacesexport.h> 0029 0030 #include <QJsonArray> 0031 0032 namespace Minuet 0033 { 0034 class MINUETINTERFACES_EXPORT ISoundController : public IPlugin 0035 { 0036 Q_OBJECT 0037 0038 // Read-write properties with simple mutators 0039 Q_PROPERTY(QString playMode MEMBER m_playMode NOTIFY playModeChanged) 0040 0041 // Read-write properties with custom mutators 0042 Q_PROPERTY(qint8 pitch MEMBER m_pitch WRITE setPitch NOTIFY pitchChanged) 0043 Q_PROPERTY(quint8 volume MEMBER m_volume WRITE setVolume NOTIFY volumeChanged) 0044 Q_PROPERTY(quint8 tempo MEMBER m_tempo WRITE setTempo NOTIFY tempoChanged) 0045 0046 // Read-only properties 0047 Q_PROPERTY(State state READ state NOTIFY stateChanged) 0048 Q_PROPERTY(QString playbackLabel READ playbackLabel NOTIFY playbackLabelChanged) 0049 0050 public: 0051 virtual ~ISoundController() override = default; 0052 0053 enum State { StoppedState = 0, PlayingState, PausedState }; 0054 Q_ENUM(State) 0055 Minuet::ISoundController::State state() const; 0056 0057 QString playbackLabel() const; 0058 0059 public Q_SLOTS: 0060 virtual void setPitch(qint8 pitch) = 0; 0061 virtual void setVolume(quint8 volume) = 0; 0062 virtual void setTempo(quint8 tempo) = 0; 0063 0064 virtual void prepareFromExerciseOptions(QJsonArray selectedExerciseOptions) = 0; 0065 virtual void prepareFromMidiFile(const QString &fileName) = 0; 0066 0067 virtual void play() = 0; 0068 virtual void pause() = 0; 0069 virtual void stop() = 0; 0070 virtual void reset() = 0; 0071 0072 Q_SIGNALS: 0073 void playModeChanged(QString newPlayMode); 0074 void pitchChanged(qint8 newPitch); 0075 void volumeChanged(quint8 newVolume); 0076 void tempoChanged(quint8 newTempo); 0077 void stateChanged(Minuet::ISoundController::State newState); 0078 void playbackLabelChanged(QString newPlaybackLabel); 0079 0080 protected: 0081 explicit ISoundController(QObject *parent = nullptr); 0082 0083 void setPlaybackLabel(const QString &playbackLabel); 0084 void setState(State state); 0085 0086 qint8 m_pitch; 0087 quint8 m_volume; 0088 quint8 m_tempo; 0089 QString m_playbackLabel; 0090 State m_state; 0091 QString m_playMode; 0092 }; 0093 0094 } 0095 0096 Q_DECLARE_INTERFACE(Minuet::ISoundController, "org.kde.minuet.ISoundController") 0097 0098 #endif