]> Shamusworld >> Repos - wozmaker/blob - src/analysisthread.cpp
Initial commit.
[wozmaker] / src / analysisthread.cpp
1 //
2 // analysisthread.cpp: Disk image analysis thread
3 //
4 // Part of the WOZ Maker project
5 // by James Hammons
6 // (C) 2018 Underground Software
7 //
8 // Since this can take a bit of time, we shunt all the heavy lifting to a
9 // separate worker thread so that it doesn't block the GUI thread.
10 //
11
12 #include "analysisthread.h"
13
14 #include <stdlib.h>
15 #include <QtWidgets>
16 #include <cmath>
17 #include "dsp.h"
18 #include "fileio.h"
19 #include "global.h"
20
21
22 AnalysisThread::AnalysisThread(QObject * parent): QThread(parent)
23 {
24 }
25
26
27 AnalysisThread::~AnalysisThread()
28 {
29 #if 0
30         mutex.lock();
31         abort = true;
32         condition.wakeOne();
33         mutex.unlock();
34
35         wait();
36 #endif
37 }
38
39
40 void AnalysisThread::StartAnalysis(void)
41 {
42         start(LowPriority);
43 }
44
45
46 void AnalysisThread::run()
47 {
48         // Sanity clause
49         if (Global::a2r == NULL)
50                 return;
51
52 //temp, until we get the AA filled ones sorted
53 //      for(uint32_t i=0; i<141; i++)
54         for(uint32_t i=0; i<139; i++)
55         {
56                 SynthesizeTrack(i);
57 //              usleep(10000);
58                 int a = random();
59                 Global::trackStatus[i] = a & 0x03;
60                 emit(ShowTracks());
61         }
62 }
63