1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
6 An API for audio analysis and feature extraction plugins.
8 Centre for Digital Music, Queen Mary, University of London.
9 Copyright 2006 Chris Cannam.
11 Permission is hereby granted, free of charge, to any person
12 obtaining a copy of this software and associated documentation
13 files (the "Software"), to deal in the Software without
14 restriction, including without limitation the rights to use, copy,
15 modify, merge, publish, distribute, sublicense, and/or sell copies
16 of the Software, and to permit persons to whom the Software is
17 furnished to do so, subject to the following conditions:
19 The above copyright notice and this permission notice shall be
20 included in all copies or substantial portions of the Software.
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40 VampEBUr128::VampEBUr128(float inputSampleRate)
41 : Plugin(inputSampleRate)
46 VampEBUr128::~VampEBUr128()
51 VampEBUr128::getIdentifier() const
57 VampEBUr128::getName() const
59 return "EBU R128 Loudness";
63 VampEBUr128::getDescription() const
65 return "Loudness measurements according to the EBU Recommendation 128";
69 VampEBUr128::getMaker() const
71 return "Harrison Consoles";
75 VampEBUr128::getPluginVersion() const
81 VampEBUr128::getCopyright() const
83 return "GPL version 2 or later";
87 VampEBUr128::initialise(size_t channels, size_t stepSize, size_t blockSize)
89 if (channels < getMinChannelCount() ||
90 channels > getMaxChannelCount()) return false;
92 m_stepSize = std::min(stepSize, blockSize);
93 m_channels = channels;
95 ebu.init (m_channels, m_inputSampleRate);
106 VampEBUr128::OutputList
107 VampEBUr128::getOutputDescriptors() const
112 zc.identifier = "loundless";
113 zc.name = "Integrated loudness";
114 zc.description = "Integrated loudness";
116 zc.hasFixedBinCount = true;
118 zc.hasKnownExtents = false;
119 zc.isQuantized = false;
120 zc.sampleType = OutputDescriptor::OneSamplePerStep;
123 zc.identifier = "range";
124 zc.name = "Integrated loudness Range";
125 zc.description = "Dynamic Range of the audio";
127 zc.hasFixedBinCount = true;
129 zc.hasKnownExtents = false;
130 zc.isQuantized = false;
131 zc.sampleType = OutputDescriptor::OneSamplePerStep;
137 VampEBUr128::FeatureSet
138 VampEBUr128::process(const float *const *inputBuffers,
139 Vamp::RealTime timestamp)
141 if (m_stepSize == 0) {
142 cerr << "ERROR: VampEBUr128::process: "
143 << "VampEBUr128 has not been initialised"
148 ebu.integr_start (); // noop if already started
149 ebu.process (m_stepSize, inputBuffers);
154 VampEBUr128::FeatureSet
155 VampEBUr128::getRemainingFeatures()
157 FeatureSet returnFeatures;
160 loudness.hasTimestamp = false;
161 loudness.values.push_back(ebu.integrated());
162 returnFeatures[0].push_back(loudness);
165 range.hasTimestamp = false;
166 range.values.push_back(ebu.range_max () - ebu.range_min ());
167 returnFeatures[1].push_back(range);
169 return returnFeatures;