annotate transform/FeatureWriter.h @ 537:3cc4b7cd2aa5

* Merge from one-fftdataserver-per-fftmodel branch. This bit of reworking (which is not described very accurately by the title of the branch) turns the MatrixFile object into something that either reads or writes, but not both, and separates the FFT file cache reader and writer implementations separately. This allows the FFT data server to have a single thread owning writers and one reader per "customer" thread, and for all locking to be vastly simplified and concentrated in the data server alone (because none of the classes it makes use of is used in more than one thread at a time). The result is faster and more trustworthy code.
author Chris Cannam
date Tue, 27 Jan 2009 13:25:10 +0000
parents 1aefb666ecfc
children 4541581067f3
rev   line source
Chris@498 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@498 2
Chris@498 3 /*
Chris@498 4 Sonic Visualiser
Chris@498 5 An audio file viewer and annotation editor.
Chris@498 6
Chris@498 7 Sonic Annotator
Chris@498 8 A utility for batch feature extraction from audio files.
Chris@498 9
Chris@498 10 Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London.
Chris@498 11 Copyright 2007-2008 QMUL.
Chris@498 12
Chris@498 13 This program is free software; you can redistribute it and/or
Chris@498 14 modify it under the terms of the GNU General Public License as
Chris@498 15 published by the Free Software Foundation; either version 2 of the
Chris@498 16 License, or (at your option) any later version. See the file
Chris@498 17 COPYING included with this distribution for more information.
Chris@498 18 */
Chris@498 19
Chris@498 20 #ifndef _FEATURE_WRITER_H_
Chris@498 21 #define _FEATURE_WRITER_H_
Chris@498 22
Chris@498 23 #include <string>
Chris@498 24 #include <map>
Chris@498 25 #include <vector>
Chris@498 26
Chris@498 27 #include <QString>
Chris@498 28
Chris@498 29 #include "Transform.h"
Chris@498 30
Chris@498 31 #include <vamp-hostsdk/Plugin.h>
Chris@498 32
Chris@498 33 using std::string;
Chris@498 34 using std::map;
Chris@498 35 using std::vector;
Chris@498 36
Chris@498 37 class FeatureWriter
Chris@498 38 {
Chris@498 39 public:
Chris@498 40 virtual ~FeatureWriter() { }
Chris@498 41
Chris@498 42 struct Parameter { // parameter of the writer, not the plugin
Chris@498 43 string name;
Chris@498 44 string description;
Chris@498 45 bool hasArg;
Chris@498 46 };
Chris@498 47 typedef vector<Parameter> ParameterList;
Chris@498 48 virtual ParameterList getSupportedParameters() const {
Chris@498 49 return ParameterList();
Chris@498 50 }
Chris@498 51
Chris@498 52 virtual void setParameters(map<string, string> &params) {
Chris@498 53 return;
Chris@498 54 }
Chris@498 55
Chris@504 56 struct TrackMetadata {
Chris@504 57 QString title;
Chris@504 58 QString maker;
Chris@504 59 };
Chris@504 60 virtual void setTrackMetadata(QString trackid, TrackMetadata metadata) { }
Chris@504 61
Chris@498 62 // may throw FailedToOpenFile or other exceptions
Chris@498 63
Chris@498 64 virtual void write(QString trackid,
Chris@498 65 const Transform &transform,
Chris@498 66 const Vamp::Plugin::OutputDescriptor &output,
Chris@498 67 const Vamp::Plugin::FeatureList &features,
Chris@498 68 std::string summaryType = "") = 0;
Chris@498 69
Chris@515 70 virtual void flush() { } // whatever the last stream was
Chris@515 71
Chris@498 72 virtual void finish() = 0;
Chris@498 73 };
Chris@498 74
Chris@498 75 #endif