forked from AttorneyOnline/AO2-Client
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaosfxplayer.cpp
More file actions
29 lines (23 loc) · 744 Bytes
/
aosfxplayer.cpp
File metadata and controls
29 lines (23 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "aosfxplayer.h"
#include <string.h>
#include <QDebug>
AOSfxPlayer::AOSfxPlayer(QObject *p_parent, AOApplication *p_ao_app)
: AOAbstractPlayer(p_parent, p_ao_app)
{}
void AOSfxPlayer::play(QString p_name)
{
QString f_file = ao_app->get_sounds_path() + p_name.toLower();
try {
AOBassHandle *handle = new AOBassHandle(f_file, true, this);
connect(this, &AOSfxPlayer::new_volume, handle, &AOBassHandle::set_volume);
connect(this, &AOSfxPlayer::stopping, handle, &AOBassHandle::stop);
handle->set_volume(get_volume());
handle->play();
} catch(const std::exception &e_exception) {
qDebug() << e_exception.what();
}
}
void AOSfxPlayer::stop()
{
emit stopping();
}