-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsoundselectiondialog.h
81 lines (60 loc) · 1.68 KB
/
soundselectiondialog.h
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
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef BACKGROUNDMUSICDIALOG_H
#define BACKGROUNDMUSICDIALOG_H
#include <QDialog>
#include <QFileDialog>
#include <QString>
#include <QAudioDecoder>
#include <QGraphicsScene>
#include <QMediaPlayer>
#include "soundeffect.h"
#include "waveform.h"
namespace Ui {
class SoundSelectionDialog;
}
class SoundSelectionDialog : public QDialog
{
Q_OBJECT
public:
enum class Mode {
BACKGROUND_MUSIC,
SOUND_EFFECT
};
explicit SoundSelectionDialog(Mode mode, QWidget *parent = 0);
~SoundSelectionDialog();
void setMovieDuration (double duration);
void loadFile (const QString &filename);
SoundEffect getSelectedSound () const;
void setSound (const SoundEffect &sfx);
protected:
virtual void showEvent(QShowEvent * event);
void stressTest ();
private slots:
void on_chooseMusicFileButton_clicked();
void fileDialogAccepted();
void fileDialogRejected();
void on_playPauseButton_clicked();
void readBuffer ();
void readFinished ();
void playerPositionChanged (qint64 newPosition);
void playerStateChanged (QMediaPlayer::State state);
void setPlayhead (qint64 newPosition);
void dialogClosed(int);
void on_removeMusicButton_clicked();
void on_rewindButton_clicked();
void on_volumeSlider_valueChanged(int value);
void on_resetSelectionButton_clicked();
void stressTestLoad ();
private:
Ui::SoundSelectionDialog *ui;
QFileDialog *_fileDialog;
Mode _mode;
QString _filename;
QAudioDecoder *_decoder;
QMediaPlayer *_player;
Waveform *_waveform;
SoundEffect _sfx;
double _movieDuration;
bool _musicSet;
bool _loading;
};
#endif // BACKGROUNDMUSICDIALOG_H