diff options
Diffstat (limited to 'include/aomusicplayer.h')
| -rw-r--r-- | include/aomusicplayer.h | 82 |
1 files changed, 26 insertions, 56 deletions
diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index 5181630c..82751b68 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -1,8 +1,10 @@ #ifndef AOMUSICPLAYER_H #define AOMUSICPLAYER_H +#include "file_functions.h" #if defined(BASSAUDIO) #include "bass.h" +#include "bassopus.h" #elif defined(QTAUDIO) #include <QMediaPlayer> #endif @@ -10,76 +12,44 @@ #include "aoapplication.h" #include <QDebug> -#include <QObject> -#include <QTimer> #include <QWidget> #include <string.h> -#if defined(BASSAUDIO) -class AOMusicPlayer : public QObject { - Q_OBJECT +class AOMusicPlayer { public: AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); virtual ~AOMusicPlayer(); + void set_volume(int p_value, int channel = -1); + void set_looping(bool toggle, int channel = 0); - void play(QString p_song); - void set_volume(int p_value); - - void kill_loop(); - QString get_path(); - bool enable_looping = true; - -private: - QWidget *m_parent; - AOApplication *ao_app; - - int m_volume = 0; - QString f_path; - - HSTREAM m_stream; -}; -#elif defined(QTAUDIO) -class AOMusicPlayer : public QObject { -public: - AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); - ~AOMusicPlayer(); - - void play(QString p_song); - void set_volume(int p_value); - - void kill_loop(); - QString get_path(); - bool enable_looping = true; - -private: - QWidget *m_parent; - AOApplication *ao_app; - - QMediaPlayer m_player; - - int m_volume = 0; - QString f_path; -}; -#else -class AOMusicPlayer : public QObject { -public: - AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); - ~AOMusicPlayer(); + const int m_channelmax = 4; - void play(QString p_song); - void set_volume(int p_value); + // These have to be public for the stupid sync thing + int loop_start[4] = {0, 0, 0, 0}; + int loop_end[4] = {0, 0, 0, 0}; - void kill_loop(); - QString get_path(); - bool enable_looping = true; +public slots: + void play(QString p_song, int channel = 0, bool loop = false, + int effect_flags = 0); + void stop(int channel = 0); private: QWidget *m_parent; AOApplication *ao_app; - int m_volume = 0; - QString f_path; + bool m_looping = false; + int m_volume[4] = {0, 0, 0, 0}; + + // Channel 0 = music + // Channel 1 = ambience + // Channel 2 = extra + // Channel 3 = extra + #if defined(BASSAUDIO) + HSTREAM m_stream_list[4]; + HSYNC loop_sync[4]; + #elif defined(QTAUDIO) + QMediaPlayer m_stream_list[4]; + #endif }; -#endif #endif // AOMUSICPLAYER_H |
