Mercurial > hg > svcore
comparison data/model/AggregateWaveModel.cpp @ 1686:e73baeead27f single-point
Model deletion issues - the AlignmentModel doesn't actually need to know about the input aggregate model; the document should own it instead
author | Chris Cannam |
---|---|
date | Thu, 04 Apr 2019 11:15:43 +0100 |
parents | f97d64b8674f |
children | d08b560102a1 |
comparison
equal
deleted
inserted
replaced
1685:0e9840a381b5 | 1686:e73baeead27f |
---|---|
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 AggregateWaveModel::~AggregateWaveModel() | 47 AggregateWaveModel::~AggregateWaveModel() |
48 { | 48 { |
49 SVDEBUG << "AggregateWaveModel::~AggregateWaveModel" << endl; | |
49 } | 50 } |
50 | 51 |
51 void | 52 void |
52 AggregateWaveModel::componentModelAboutToBeDeleted() | 53 AggregateWaveModel::componentModelAboutToBeDeleted() |
53 { | 54 { |
59 } | 60 } |
60 | 61 |
61 bool | 62 bool |
62 AggregateWaveModel::isOK() const | 63 AggregateWaveModel::isOK() const |
63 { | 64 { |
64 if (m_invalidated) { | 65 if (m_invalidated || m_components.empty()) { |
65 return false; | 66 return false; |
66 } | 67 } |
67 for (ChannelSpecList::const_iterator i = m_components.begin(); | 68 for (ChannelSpecList::const_iterator i = m_components.begin(); |
68 i != m_components.end(); ++i) { | 69 i != m_components.end(); ++i) { |
69 if (!i->model->isOK()) { | 70 if (!i->model->isOK()) { |
118 } | 119 } |
119 | 120 |
120 sv_samplerate_t | 121 sv_samplerate_t |
121 AggregateWaveModel::getSampleRate() const | 122 AggregateWaveModel::getSampleRate() const |
122 { | 123 { |
123 if (m_components.empty()) return 0; | 124 if (m_invalidated || m_components.empty()) return 0; |
124 return m_components.begin()->model->getSampleRate(); | 125 return m_components.begin()->model->getSampleRate(); |
125 } | 126 } |
126 | 127 |
127 floatvec_t | 128 floatvec_t |
128 AggregateWaveModel::getData(int channel, sv_frame_t start, sv_frame_t count) const | 129 AggregateWaveModel::getData(int channel, sv_frame_t start, sv_frame_t count) const |
129 { | 130 { |
131 if (m_invalidated || m_components.empty()) return {}; | |
132 | |
130 int ch0 = channel, ch1 = channel; | 133 int ch0 = channel, ch1 = channel; |
131 if (channel == -1) { | 134 if (channel == -1) { |
132 ch0 = 0; | 135 ch0 = 0; |
133 ch1 = getChannelCount()-1; | 136 ch1 = getChannelCount()-1; |
134 } | 137 } |