#ifndef SOUNDPLAYER_H #define SOUNDPLAYER_H #include #include #include ///////////////////////////////////////////////////////////////// //// DOESN'T WORK! Has to be reworked in master-merge 1.2 //// https://trello.com/c/KFUhEbYh/62-reimplement-sound-system class QWSoundPlayer final : public QObject { Q_OBJECT Q_DISABLE_COPY_MOVE(QWSoundPlayer) private: int i_volume; bool b_muted; //////////////////////// //////// //// Background sounds in loop. QMediaPlayer *player_loop; QMediaPlaylist *playlist_loop; //////// //// Sounds which should play once per call. QMediaPlayer *player_single; //////// //// Music is music. QMediaPlayer *player_music; QMediaPlaylist *playlist_music; public: explicit QWSoundPlayer(QObject *parent = nullptr); int addMusic(const QString &path); inline bool isMuted() const noexcept; inline int volume() const noexcept; void playSound(QMediaContent *sound); void playMusic(const int index); void stopMusic(); //////////////////////// public slots: void setMuteness(bool mute) noexcept; void adjustVolume(int vol) noexcept; void onEndLevel() noexcept; signals: void transferSetMuteness(bool); void transferAdjustVolume(int); void playLoop(); void playSingle(); void playMusic(); }; #endif // SOUNDPLAYER_H