atrooney-online-2/include/aosfxplayer.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

40 lines
768 B
C++

#ifndef AOSFXPLAYER_H
#define AOSFXPLAYER_H
#include "bass.h"
#include "bassopus.h"
#include "aoapplication.h"
#include <QDebug>
#include <QWidget>
#include <string.h>
class AOSfxPlayer {
public:
AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
void clear();
void loop_clear();
void play(QString p_sfx, QString p_char = "", QString shout = "",
int channel = -1);
void stop(int channel = -1);
void set_volume(qreal p_volume);
void set_looping(bool toggle, int channel = -1);
int m_channel = 0;
private:
QWidget *m_parent;
AOApplication *ao_app;
qreal m_volume = 0;
bool m_looping = true;
void set_volume_internal(qreal p_volume);
const int m_channelmax = 5;
HSTREAM m_stream_list[5];
};
#endif // AOSFXPLAYER_H