atrooney-online-2/include/aomusicplayer.h
iamgoofball 1139bf5cd0 Bass.dll functionality-based clientside music looping system by using channel loopable flags (no use of QTimer required)
Implement Goofball's AOV loopable music server message where any value that's not -1 when the length of the handle_message packet is longer than 3 will not loop the music (still confused about this but w/e)
2019-09-14 00:28:27 +03:00

69 lines
1.1 KiB
C++

#ifndef AOMUSICPLAYER_H
#define AOMUSICPLAYER_H
#if defined(BASSAUDIO)
#include "bass.h"
#elif defined(QTAUDIO)
#include <QMediaPlayer>
#endif
#include "aoapplication.h"
#include <QWidget>
#include <string.h>
#include <QDebug>
#if defined(BASSAUDIO)
class AOMusicPlayer
{
public:
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
virtual ~AOMusicPlayer();
void play(QString p_song);
void stop();
void set_volume(int p_value);
void set_looping(bool toggle);
private:
QWidget *m_parent;
AOApplication *ao_app;
bool m_looping = true;
int m_volume = 0;
HSTREAM m_stream;
};
#elif defined(QTAUDIO)
class AOMusicPlayer
{
public:
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
~AOMusicPlayer();
void play(QString p_song);
void set_volume(int p_value);
private:
QMediaPlayer m_player;
QWidget *m_parent;
AOApplication *ao_app;
int m_volume = 0;
};
#else
class AOMusicPlayer
{
public:
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
~AOMusicPlayer();
void play(QString p_song);
void set_volume(int p_value);
private:
QWidget *m_parent;
AOApplication *ao_app;
};
#endif
#endif // AOMUSICPLAYER_H