atrooney-online-2/include/aosfxplayer.h
oldmud0 13942345c6 Run clang-format on entire project
Indentation fixed to 2 spaces per tab. Braces set to Stroustrup style.
Lines reflow at 80 characters. One-line method bodies are on the same
line as the signature. Space always after `//`. No indentation
on preprocessor macros. Includes are sorted lexicographically.

If you don't want to see this commit on blames, use the hidden
whitespace option on GitHub, or use `-w` in git-blame.
2020-04-17 21:57:16 -05:00

43 lines
789 B
C++

#ifndef AOSFXPLAYER_H
#define AOSFXPLAYER_H
#if defined(BASSAUDIO)
#include "bass.h"
#elif defined(QTAUDIO)
#include <QSoundEffect>
#endif
#include "aoapplication.h"
#include <QDebug>
#include <QTimer>
#include <QWidget>
#include <string.h>
class AOSfxPlayer : public QObject {
Q_OBJECT
public:
AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
void play(QString p_sfx, QString p_char = "", QString shout = "");
void stop();
void set_volume(qreal p_volume);
void setLooping(bool is_looping);
private:
QWidget *m_parent;
AOApplication *ao_app;
qreal m_volume = 0;
bool looping_sfx = false;
void set_volume_internal(qreal p_volume);
#if defined(BASSAUDIO)
HSTREAM m_stream;
#elif defined(QTAUDIO)
QSoundEffect m_sfx;
#endif
};
#endif // AOSFXPLAYER_H