Mercurial > hg > svcore
changeset 1006:d954e03274e8
TransformId is not sufficient -- it could be ambiguous (same transform id, different parameters etc). Use the whole transform
author | Chris Cannam |
---|---|
date | Wed, 15 Oct 2014 17:02:48 +0100 |
parents | 6b2a8b34e9d3 |
children | ba404199345f d9e0e59a1581 |
files | transform/CSVFeatureWriter.cpp transform/CSVFeatureWriter.h |
diffstat | 2 files changed, 11 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/transform/CSVFeatureWriter.cpp Wed Oct 15 16:05:15 2014 +0100 +++ b/transform/CSVFeatureWriter.cpp Wed Oct 15 17:02:48 2014 +0100 @@ -134,11 +134,7 @@ if (n == 0) return; - TrackTransformPair tt(trackId, transformId); - - if (m_rates.find(transformId) == m_rates.end()) { - m_rates[transformId] = transform.getSampleRate(); - } + DataId tt(trackId, transform); if (m_pending.find(tt) != m_pending.end()) { writeFeature(tt, @@ -171,11 +167,11 @@ { for (PendingFeatures::const_iterator i = m_pending.begin(); i != m_pending.end(); ++i) { - TrackTransformPair tt = i->first; + DataId tt = i->first; Plugin::Feature f = i->second; - QTextStream *sptr = getOutputStream(tt.first, tt.second); + QTextStream *sptr = getOutputStream(tt.first, tt.second.getIdentifier()); if (!sptr) { - throw FailedToOpenOutputStream(tt.first, tt.second); + throw FailedToOpenOutputStream(tt.first, tt.second.getIdentifier()); } QTextStream &stream = *sptr; // final feature has its own time as end time (we can't @@ -189,14 +185,14 @@ } void -CSVFeatureWriter::writeFeature(TrackTransformPair tt, +CSVFeatureWriter::writeFeature(DataId tt, QTextStream &stream, const Plugin::Feature &f, const Plugin::Feature *optionalNextFeature, std::string summaryType) { QString trackId = tt.first; - TransformId transformId = tt.second; + Transform transform = tt.second; if (!m_omitFilename) { if (m_stdout || m_singleFileName != "") { @@ -222,7 +218,7 @@ if (m_sampleTiming) { - float rate = m_rates[transformId]; + float rate = transform.getSampleRate(); stream << Vamp::RealTime::realTime2Frame(f.timestamp, rate);
--- a/transform/CSVFeatureWriter.h Wed Oct 15 16:05:15 2014 +0100 +++ b/transform/CSVFeatureWriter.h Wed Oct 15 17:02:48 2014 +0100 @@ -63,15 +63,13 @@ bool m_omitFilename; QString m_prevPrintedTrackId; - typedef map<TrackTransformPair, Vamp::Plugin::Feature> PendingFeatures; - typedef map<TrackTransformPair, std::string> PendingSummaryTypes; + typedef pair<QString, Transform> DataId; // track id, transform + typedef map<DataId, Vamp::Plugin::Feature> PendingFeatures; + typedef map<DataId, std::string> PendingSummaryTypes; PendingFeatures m_pending; PendingSummaryTypes m_pendingSummaryTypes; - typedef map<TransformId, float> SampleRateMap; - SampleRateMap m_rates; - - void writeFeature(TrackTransformPair trackId, + void writeFeature(DataId, QTextStream &, const Vamp::Plugin::Feature &f, const Vamp::Plugin::Feature *optionalNextFeature,