From 71da60b5d6f77629b73fd232f97bed2ecaefb4c3 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Tue, 12 Mar 2019 20:14:54 +0100 Subject: sfx tested and works --- include/aosfxplayer.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'include') diff --git a/include/aosfxplayer.h b/include/aosfxplayer.h index 30cbe9d..5b82534 100644 --- a/include/aosfxplayer.h +++ b/include/aosfxplayer.h @@ -1,13 +1,19 @@ #ifndef AOSFXPLAYER_H #define AOSFXPLAYER_H +#if defined(BASSAUDIO) #include "bass.h" +#elif defined(QTAUDIO) +#include +#endif + #include "aoapplication.h" #include #include #include +#if defined(BASSAUDIO) class AOSfxPlayer { public: @@ -24,5 +30,39 @@ private: int m_volume = 0; HSTREAM m_stream; }; +#elif defined(QTAUDIO) +class AOSfxPlayer +{ +public: + AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app); + + void play(QString p_sfx, QString p_char = "", QString shout = ""); + void stop(); + void set_volume(int p_volume); + +private: + QSoundEffect m_sfx; + QWidget *m_parent; + AOApplication *ao_app; + + int m_volume = 0; +}; +#else +class AOSfxPlayer +{ +public: + AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app); + + void play(QString p_sfx, QString p_char = "", QString shout = ""); + void stop(); + void set_volume(int p_volume); + +private: + QWidget *m_parent; + AOApplication *ao_app; + + int m_volume = 0; +}; +#endif #endif // AOSFXPLAYER_H -- cgit