atrooney-online-2/include/aosfxplayer.h
Crystalwarrior ad578eb0bd
Suppress application volume when alt-tabbed (#730)
* Suppress application volume when alt-tabbed
Add a "suppress_audio" slider setting, 50% by default, which decides how much audio remains when the client is not in focus
Add a "muted" setting for blip, music, and sfx players
Add update_audio_volume func

* change "suppress" to "how much audio is suppressed" instead of "how much audio remains"

* Fix last commit just flipping the behavior and being ultra wacky

* Fix evidence present sound ignoring audio suppression settings

Co-authored-by: stonedDiscord <Tukz@gmx.de>
Co-authored-by: Salanto <62221668+Salanto@users.noreply.github.com>
2022-07-23 18:18:45 +03:00

41 lines
839 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 = "");
void stop(int channel = -1);
void set_volume(qreal p_volume);
void set_looping(bool toggle, int channel = -1);
void set_muted(bool toggle);
int m_channel = 0;
int get_volume() { return m_volume * 100; };
private:
QWidget *m_parent;
AOApplication *ao_app;
qreal m_volume = 0;
bool m_looping = true;
bool m_muted = false;
void set_volume_internal(qreal p_volume);
const int m_channelmax = 5;
HSTREAM m_stream_list[5];
};
#endif // AOSFXPLAYER_H