forked from AttorneyOnline/AO2-Client
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaoshoutplayer.cpp
More file actions
45 lines (37 loc) · 1.31 KB
/
aoshoutplayer.cpp
File metadata and controls
45 lines (37 loc) · 1.31 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "aoshoutplayer.hpp"
#include "file_functions.h"
#include <QDebug>
AOShoutPlayer::AOShoutPlayer(QObject *p_parent, AOApplication *p_ao_app)
: AOAbstractPlayer(p_parent, p_ao_app)
{}
void AOShoutPlayer::play(QString p_name, QString p_char)
{
QString f_file;
QString char_path = ao_app->get_character_path(p_char) + p_name.toLower();
QString theme_path = ao_app->get_theme_path() + p_name.toLower();
QString default_theme_path = ao_app->get_default_theme_path() + p_name.toLower();
qDebug() << char_path;
qDebug() << theme_path;
qDebug() << default_theme_path;
if(file_exists(char_path))
f_file = char_path;
else if (file_exists(theme_path))
f_file = theme_path;
else if (file_exists(default_theme_path))
f_file = default_theme_path;
else
f_file = "";
try {
AOBassHandle *handle = new AOBassHandle(f_file, true, this);
connect(this, &AOShoutPlayer::new_volume, handle, &AOBassHandle::set_volume);
connect(this, &AOShoutPlayer::stopping, handle, &AOBassHandle::stop);
handle->set_volume(get_volume());
handle->play();
} catch(const std::exception &e_exception) {
qDebug() << e_exception.what();
}
}
void AOShoutPlayer::stop()
{
emit stopping();
}