comparison data/model/ReadOnlyWaveFileModel.cpp @ 1599:ce185d4dd408 bqaudiostream

Merge from default branch
author Chris Cannam
date Wed, 23 Jan 2019 14:43:43 +0000
parents 70e172e6cc59
children 77543124651b
comparison
equal deleted inserted replaced
1598:d2555df635ec 1599:ce185d4dd408
40 ReadOnlyWaveFileModel::m_zoomConstraint; 40 ReadOnlyWaveFileModel::m_zoomConstraint;
41 41
42 ReadOnlyWaveFileModel::ReadOnlyWaveFileModel(FileSource source, sv_samplerate_t targetRate) : 42 ReadOnlyWaveFileModel::ReadOnlyWaveFileModel(FileSource source, sv_samplerate_t targetRate) :
43 m_source(source), 43 m_source(source),
44 m_path(source.getLocation()), 44 m_path(source.getLocation()),
45 m_reader(0), 45 m_reader(nullptr),
46 m_myReader(true), 46 m_myReader(true),
47 m_startFrame(0), 47 m_startFrame(0),
48 m_fillThread(0), 48 m_fillThread(nullptr),
49 m_updateTimer(0), 49 m_updateTimer(nullptr),
50 m_lastFillExtent(0), 50 m_lastFillExtent(0),
51 m_prevCompletion(0), 51 m_prevCompletion(0),
52 m_exiting(false), 52 m_exiting(false),
53 m_lastDirectReadStart(0), 53 m_lastDirectReadStart(0),
54 m_lastDirectReadCount(0) 54 m_lastDirectReadCount(0)
88 } 88 }
89 89
90 ReadOnlyWaveFileModel::ReadOnlyWaveFileModel(FileSource source, AudioFileReader *reader) : 90 ReadOnlyWaveFileModel::ReadOnlyWaveFileModel(FileSource source, AudioFileReader *reader) :
91 m_source(source), 91 m_source(source),
92 m_path(source.getLocation()), 92 m_path(source.getLocation()),
93 m_reader(0), 93 m_reader(nullptr),
94 m_myReader(false), 94 m_myReader(false),
95 m_startFrame(0), 95 m_startFrame(0),
96 m_fillThread(0), 96 m_fillThread(nullptr),
97 m_updateTimer(0), 97 m_updateTimer(nullptr),
98 m_lastFillExtent(0), 98 m_lastFillExtent(0),
99 m_prevCompletion(0), 99 m_prevCompletion(0),
100 m_exiting(false) 100 m_exiting(false)
101 { 101 {
102 SVDEBUG << "ReadOnlyWaveFileModel::ReadOnlyWaveFileModel: path " 102 SVDEBUG << "ReadOnlyWaveFileModel::ReadOnlyWaveFileModel: path "
111 ReadOnlyWaveFileModel::~ReadOnlyWaveFileModel() 111 ReadOnlyWaveFileModel::~ReadOnlyWaveFileModel()
112 { 112 {
113 m_exiting = true; 113 m_exiting = true;
114 if (m_fillThread) m_fillThread->wait(); 114 if (m_fillThread) m_fillThread->wait();
115 if (m_myReader) delete m_reader; 115 if (m_myReader) delete m_reader;
116 m_reader = 0; 116 m_reader = nullptr;
117 117
118 SVDEBUG << "ReadOnlyWaveFileModel: Destructor exiting; we had caches of " 118 SVDEBUG << "ReadOnlyWaveFileModel: Destructor exiting; we had caches of "
119 << (m_cache[0].size() * sizeof(Range)) << " and " 119 << (m_cache[0].size() * sizeof(Range)) << " and "
120 << (m_cache[1].size() * sizeof(Range)) << " bytes" << endl; 120 << (m_cache[1].size() * sizeof(Range)) << " bytes" << endl;
121 } 121 }
595 void 595 void
596 ReadOnlyWaveFileModel::cacheFilled() 596 ReadOnlyWaveFileModel::cacheFilled()
597 { 597 {
598 m_mutex.lock(); 598 m_mutex.lock();
599 delete m_fillThread; 599 delete m_fillThread;
600 m_fillThread = 0; 600 m_fillThread = nullptr;
601 delete m_updateTimer; 601 delete m_updateTimer;
602 m_updateTimer = 0; 602 m_updateTimer = nullptr;
603 auto prevFillExtent = m_lastFillExtent; 603 auto prevFillExtent = m_lastFillExtent;
604 m_lastFillExtent = getEndFrame(); 604 m_lastFillExtent = getEndFrame();
605 m_mutex.unlock(); 605 m_mutex.unlock();
606 #ifdef DEBUG_WAVE_FILE_MODEL 606 #ifdef DEBUG_WAVE_FILE_MODEL
607 SVDEBUG << "ReadOnlyWaveFileModel(" << objectName() << ")::cacheFilled, about to emit things" << endl; 607 SVDEBUG << "ReadOnlyWaveFileModel(" << objectName() << ")::cacheFilled, about to emit things" << endl;