blob: 82fe149e19d73e4c04cc06746840a7cff8cabeaa (
plain)
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
|
#ifndef ANALYSERQUEUE_H
#define ANALYSERQUEUE_H
#include <QList>
#include <QThread>
#include <QQueue>
#include <QWaitCondition>
#include <QSemaphore>
#include "configobject.h"
#include "analyser.h"
#include "soundsource.h"
#include "trackinfoobject.h"
class TrackCollection;
class AnalyserQueue : public QThread {
Q_OBJECT
public:
AnalyserQueue(TrackCollection* pTrackCollection);
virtual ~AnalyserQueue();
void stop();
void queueAnalyseTrack(TrackPointer tio);
static AnalyserQueue* createDefaultAnalyserQueue(
ConfigObject<ConfigValue>* pConfig, TrackCollection* pTrackCollection);
static AnalyserQueue* createAnalysisFeatureAnalyserQueue(
ConfigObject<ConfigValue>* pConfig, TrackCollection* pTrackCollection);
public slots:
void slotAnalyseTrack(TrackPointer tio);
void slotUpdateProgress();
signals:
void trackProgress(int progress);
void trackDone(TrackPointer track);
void trackFinished(int size);
// Signals from AnalyserQueue Thread:
void queueEmpty();
void updateProgress();
protected:
void run();
private:
struct progress_info {
TrackPointer current_track;
int track_progress; // in 0.1 %
int queue_size;
QSemaphore sema;
};
void addAnalyser(Analyser* an);
QList<Analyser*> m_aq;
bool isLoadedTrackWaiting(TrackPointer analysingTrack);
TrackPointer dequeueNextBlocking();
bool doAnalysis(TrackPointer tio, const Mixxx::SoundSourcePointer& pSoundSource);
void emitUpdateProgress(TrackPointer tio, int progress);
void emptyCheck();
bool m_exit;
QAtomicInt m_aiCheckPriorities;
SAMPLE* m_pSamplesPCM;
CSAMPLE* m_pSamples;
// The processing queue and associated mutex
QQueue<TrackPointer> m_tioq;
QMutex m_qm;
QWaitCondition m_qwait;
struct progress_info m_progressInfo;
int m_queue_size;
};
#endif
|