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

55 lines
1.2 KiB
C++

#ifndef AOMUSICPLAYER_H
#define AOMUSICPLAYER_H
#include "file_functions.h"
#include "bass.h"
#include "bassmidi.h"
#include "bassopus.h"
#include "aoapplication.h"
#include <QDebug>
#include <QWidget>
#include <string.h>
#include <QFuture>
#include <QFutureWatcher>
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);
void set_muted(bool toggle);
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};
QFutureWatcher<QString> music_watcher;
public slots:
QString 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;
bool m_muted = 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