comparison vamp-hostsdk/PluginSummarisingAdapter.h @ 233:521734d2b498 distinct-libraries

* Flatten directory tree a bit, update doxygen
author cannam
date Fri, 07 Nov 2008 15:28:33 +0000
parents
children 3cf5bd155e5b
comparison
equal deleted inserted replaced
232:71ea10a3cbe7 233:521734d2b498
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Vamp
5
6 An API for audio analysis and feature extraction plugins.
7
8 Centre for Digital Music, Queen Mary, University of London.
9 Copyright 2006-2008 Chris Cannam and QMUL.
10
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:
18
19 The above copyright notice and this permission notice shall be
20 included in all copies or substantial portions of the Software.
21
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.
29
30 Except as contained in this notice, the names of the Centre for
31 Digital Music; Queen Mary, University of London; and Chris Cannam
32 shall not be used in advertising or otherwise to promote the sale,
33 use or other dealings in this Software without prior written
34 authorization.
35 */
36
37 #ifndef _VAMP_PLUGIN_SUMMARISING_ADAPTER_H_
38 #define _VAMP_PLUGIN_SUMMARISING_ADAPTER_H_
39
40 #include "PluginWrapper.h"
41
42 #include <set>
43
44 namespace Vamp {
45
46 namespace HostExt {
47
48 /**
49 * \class PluginSummarisingAdapter PluginSummarisingAdapter.h <vamp-hostsdk/PluginSummarisingAdapter.h>
50 *
51 * \note This class was introduced in version 2.0 of the Vamp plugin SDK.
52 */
53
54 class PluginSummarisingAdapter : public PluginWrapper
55 {
56 public:
57 PluginSummarisingAdapter(Plugin *plugin); // I take ownership of plugin
58 virtual ~PluginSummarisingAdapter();
59
60 bool initialise(size_t channels, size_t stepSize, size_t blockSize);
61
62 FeatureSet process(const float *const *inputBuffers, RealTime timestamp);
63 FeatureSet getRemainingFeatures();
64
65 typedef std::set<RealTime> SegmentBoundaries;
66 void setSummarySegmentBoundaries(const SegmentBoundaries &);
67
68 enum SummaryType {
69 Minimum = 0,
70 Maximum = 1,
71 Mean = 2,
72 Median = 3,
73 Mode = 4,
74 Sum = 5,
75 Variance = 6,
76 StandardDeviation = 7,
77 Count = 8,
78
79 UnknownSummaryType = 999
80 };
81
82 /**
83 * AveragingMethod indicates how the adapter should handle
84 * average-based summaries of features whose results are not
85 * equally spaced in time.
86 *
87 * If SampleAverage is specified, summary types based on averages
88 * will be calculated by treating each result individually without
89 * regard to its time: for example, the mean will be the sum of
90 * all values divided by the number of values.
91 *
92 * If ContinuousTimeAverage is specified, each feature will be
93 * considered to have a duration, either as specified in the
94 * feature's duration field, or until the following feature: thus,
95 * for example, the mean will be the sum of the products of values
96 * and durations, divided by the total duration.
97 *
98 * Although SampleAverage is useful for many types of feature,
99 * ContinuousTimeAverage is essential for some situations, for
100 * example finding the result that spans the largest proportion of
101 * the input given a feature that emits a new result only when the
102 * value changes (the modal value integrated over time).
103 */
104 enum AveragingMethod {
105 SampleAverage = 0,
106 ContinuousTimeAverage = 1,
107 };
108
109 FeatureList getSummaryForOutput(int output,
110 SummaryType type,
111 AveragingMethod method = SampleAverage);
112
113 FeatureSet getSummaryForAllOutputs(SummaryType type,
114 AveragingMethod method = SampleAverage);
115
116 protected:
117 class Impl;
118 Impl *m_impl;
119 };
120
121 }
122
123 }
124
125 #endif