comparison runner/MIDIFeatureWriter.cpp @ 140:9b94545a7fdc midi

More of MIDIFeatureWriter
author Chris Cannam
date Mon, 13 Oct 2014 12:00:22 +0100
parents 65a488d8c1bb
children d7a91e07ca57
comparison
equal deleted inserted replaced
139:a4bee1a374b4 140:9b94545a7fdc
58 const Transform &transform, 58 const Transform &transform,
59 const Plugin::OutputDescriptor& output, 59 const Plugin::OutputDescriptor& output,
60 const Plugin::FeatureList& features, 60 const Plugin::FeatureList& features,
61 std::string summaryType) 61 std::string summaryType)
62 { 62 {
63 QString filename = getOutputFilename(trackId, transform.getIdentifier()); 63 QString transformId = transform.getIdentifier();
64
65 QString filename = getOutputFilename(trackId, transformId);
64 if (filename == "") { 66 if (filename == "") {
65 throw FailedToOpenOutputStream(trackId, transform.getIdentifier()); 67 throw FailedToOpenOutputStream(trackId, transformId);
66 } 68 }
67 69
68 //!!! implement! 70 if (m_rates.find(filename) == m_rates.end()) {
71 // If the output is FixedSampleRate, we draw the sample rate
72 // from the output descriptor; otherwise from the transform
73 float sampleRate;
74 if (output.sampleType == Plugin::OutputDescriptor::FixedSampleRate) {
75 sampleRate = output.sampleRate;
76 } else {
77 sampleRate = transform.getSampleRate();
78 }
79 m_rates[filename] = sampleRate;
80 }
81
82 if (m_fileTransforms[filename].find(transformId) ==
83 m_fileTransforms[filename].end()) {
84
85 // This transform is new to the file, give it a channel number
86
87 int channel = m_nextChannels[filename];
88 m_nextChannels[filename] = channel + 1;
89
90 m_fileTransforms[filename].insert(transformId);
91 m_channels[transformId] = channel;
92 }
93
94 NoteList notes = m_notes[filename];
95
96
97
98 m_notes[filename] = notes;
69 } 99 }
70 100
71 void 101 void
72 MIDIFeatureWriter::finish() 102 MIDIFeatureWriter::finish()
73 { 103 {