04299ad6f
김태훈
테스트 프로그램 작성
|
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#ifndef SOUNDPLAYER_H
#define SOUNDPLAYER_H
#include <QObject>
#include <QSound>
#include <QSoundEffect>
#include <QThread>
#include <QMap>
#include <QProcess>
class SoundPlayWorker : public QObject
{
Q_OBJECT
bool repeat_;
public:
explicit SoundPlayWorker();
public slots:
void play(const QString &filename);
void playClick();
void setVolume(int volume);
void repeat(const QString &filename);
void stop();
private:
QMap<QString, QSound *> map;
QSound *current;
QSoundEffect *click;
QProcess *proc;
private slots:
void onFinished();
};
class SoundPlayer : public QObject
{
Q_OBJECT
explicit SoundPlayer();
void play(const QString &filename);
void emitClick();
void repeat(const QString &filename);
void stopPlay();
static SoundPlayer *instance;
public:
static void playClick();
static void playStart();
static void playStop();
static void playError1();
static void playError2();
static void repeatError1();
static void repeatError2();
static void stop();
signals:
void setVolume(int);
void operate(const QString &);
void click();
void operateRepeat(const QString &);
void operateStop();
};
#endif // SOUNDPLAYER_H
|