comparison vamp-sdk/hostext/PluginSummarisingAdapter.cpp @ 176:adfb6348881c

* add getSummaryForAllOutputs
author cannam
date Tue, 05 Aug 2008 15:36:40 +0000
parents 4811fb599a97
children 2258794251be
comparison
equal deleted inserted replaced
175:4811fb599a97 176:adfb6348881c
52 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); 52 FeatureSet process(const float *const *inputBuffers, RealTime timestamp);
53 FeatureSet getRemainingFeatures(); 53 FeatureSet getRemainingFeatures();
54 54
55 void setSummarySegmentBoundaries(const SegmentBoundaries &); 55 void setSummarySegmentBoundaries(const SegmentBoundaries &);
56 56
57 FeatureList getSummary(int output, SummaryType type); 57 FeatureList getSummaryForOutput(int output, SummaryType type);
58 FeatureSet getSummaryForAllOutputs(SummaryType type);
58 59
59 protected: 60 protected:
60 Plugin *m_plugin; 61 Plugin *m_plugin;
61 62
62 SegmentBoundaries m_boundaries; 63 SegmentBoundaries m_boundaries;
117 { 118 {
118 return m_impl->getRemainingFeatures(); 119 return m_impl->getRemainingFeatures();
119 } 120 }
120 121
121 Plugin::FeatureList 122 Plugin::FeatureList
122 PluginSummarisingAdapter::getSummary(int output, SummaryType type) 123 PluginSummarisingAdapter::getSummaryForOutput(int output, SummaryType type)
123 { 124 {
124 return m_impl->getSummary(output, type); 125 return m_impl->getSummaryForOutput(output, type);
126 }
127
128 Plugin::FeatureSet
129 PluginSummarisingAdapter::getSummaryForAllOutputs(SummaryType type)
130 {
131 return m_impl->getSummaryForAllOutputs(type);
125 } 132 }
126 133
127 PluginSummarisingAdapter::Impl::Impl(Plugin *plugin, float inputSampleRate) : 134 PluginSummarisingAdapter::Impl::Impl(Plugin *plugin, float inputSampleRate) :
128 m_plugin(plugin) 135 m_plugin(plugin)
129 { 136 {
150 reduce(); 157 reduce();
151 return fs; 158 return fs;
152 } 159 }
153 160
154 Plugin::FeatureList 161 Plugin::FeatureList
155 PluginSummarisingAdapter::Impl::getSummary(int output, SummaryType type) 162 PluginSummarisingAdapter::Impl::getSummaryForOutput(int output, SummaryType type)
156 { 163 {
157 //!!! need to ensure that this is only called after processing is 164 //!!! need to ensure that this is only called after processing is
158 //!!! complete (at the moment processing is "completed" in the 165 //!!! complete (at the moment processing is "completed" in the
159 //!!! call to getRemainingFeatures, but we don't want to require 166 //!!! call to getRemainingFeatures, but we don't want to require
160 //!!! the host to call getRemainingFeatures at all unless it 167 //!!! the host to call getRemainingFeatures at all unless it
223 fl.push_back(f); 230 fl.push_back(f);
224 } 231 }
225 return fl; 232 return fl;
226 } 233 }
227 234
235 Plugin::FeatureSet
236 PluginSummarisingAdapter::Impl::getSummaryForAllOutputs(SummaryType type)
237 {
238 FeatureSet fs;
239 for (OutputSummarySegmentMap::const_iterator i = m_summaries.begin();
240 i != m_summaries.end(); ++i) {
241 fs[i->first] = getSummaryForOutput(i->first, type);
242 }
243 return fs;
244 }
245
228 void 246 void
229 PluginSummarisingAdapter::Impl::accumulate(const FeatureSet &fs, 247 PluginSummarisingAdapter::Impl::accumulate(const FeatureSet &fs,
230 RealTime timestamp) 248 RealTime timestamp)
231 { 249 {
232 for (FeatureSet::const_iterator i = fs.begin(); i != fs.end(); ++i) { 250 for (FeatureSet::const_iterator i = fs.begin(); i != fs.end(); ++i) {