-
Notifications
You must be signed in to change notification settings - Fork 0
/
abxtester.h
66 lines (59 loc) · 1.59 KB
/
abxtester.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
#ifndef ABXTESTER_H
#define ABXTESTER_H
#include <qlist.h>
#include <qobject.h>
#include <qmediaplayer.h>
#include <qrandom.h>
class ABXTester : public QObject
{
Q_OBJECT
public:
explicit ABXTester(QString filePath1, QString filePath2, int trials, qint64 segmentStart,
qint64 segmentStop, QObject *parent = nullptr);
~ABXTester();
int getCurrentTrial();
int getTrials();
qint64 getPlaybackPosition();
private:
QString filePath1;
QString filePath2;
int currentTrial = 0;
int trials;
qint64 segmentStart;
qint64 segmentStop;
bool testIsStarted = false;
bool testIsFinished = false;
bool testIsRunning = false;
QList<bool> results;
QMediaPlayer *APlayer;
QMediaPlayer *BPlayer;
// XPlayer and currentPlayer are supposed to point at APlayer or BPlayer
QMediaPlayer *XPlayer;
QMediaPlayer *currentPlayer;
QMediaPlayer *previousPlayer;
qint64 currentPlaybackPosition;
void stopCurrentPlayer();
void startCurrentPlayer();
public slots:
void startTest();
void startNextTrial();
void finishCurrentTrial();
void chooseA();
void chooseB();
void listenToA();
void listenToB();
void listenToX();
void changePlaybackPosition(qint64 position);
signals:
void AChosen();
void BChosen();
void currentTrialFinished();
void nextTrialStarted();
void AIsListenedTo();
void BIsListenedTo();
void XIsListenedTo();
void playbackPositionChanged(qint64 position);
void testStarted();
void testFinished(QList<bool> results);
};
#endif // ABXTESTER_H