atrooney-online-2/include/aomusicplayer.h
scatterflower 9eb0f53db1
Reset BASS when switching devices; drop Qt Multimedia support (#262)
* Allow changing audio device on the fly while in a server
* Use default audio device if device in config doesn't exist
* Automatically change audio device to default when current one is invalid
* Destroy Qt Multimedia support

It was decided that there was not enough attention being given to Qt
Multimedia support to justify its continued maintenance simply as a
libre alternative to BASS. While substantial changes to audio were being
made in 2.8, the Qt Multimedia support code fell behind in disrepair.
It's clear that there is no vested interest in implementing audio
features twice for the sake of licensing.

When it's time to switch to another audio library, it will be done
unilaterally.

* CI: Use BASS for Linux build

Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
2020-08-19 16:40:37 -05:00

48 lines
1015 B
C++

#ifndef AOMUSICPLAYER_H
#define AOMUSICPLAYER_H
#include "file_functions.h"
#include "bass.h"
#include "bassopus.h"
#include "aoapplication.h"
#include <QDebug>
#include <QWidget>
#include <string.h>
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);
const int m_channelmax = 4;
// 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};
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;
bool m_looping = false;
int m_volume[4] = {0, 0, 0, 0};
// Channel 0 = music
// Channel 1 = ambience
// Channel 2 = extra
// Channel 3 = extra
HSTREAM m_stream_list[4];
HSYNC loop_sync[4];
};
#endif // AOMUSICPLAYER_H