annotate runner/BinaryFeatureWriter.h @ 71:9600f5b8076f tip

latest version before copying fextractor
author gyorgyf
date Sun, 22 Sep 2013 21:55:40 +0200
parents 0ef80ae6493c
children
rev   line source
gyorgyf@60 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
gyorgyf@60 2
gyorgyf@60 3 /*
gyorgyf@60 4 Sonic Annotator
gyorgyf@60 5 A utility for batch feature extraction from audio files.
gyorgyf@60 6 Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London.
gyorgyf@60 7 Copyright 2007-2008 QMUL.
gyorgyf@60 8
gyorgyf@60 9 This program is free software; you can redistribute it and/or
gyorgyf@60 10 modify it under the terms of the GNU General Public License as
gyorgyf@60 11 published by the Free Software Foundation; either version 2 of the
gyorgyf@60 12 License, or (at your option) any later version. See the file
gyorgyf@60 13 COPYING included with this distribution for more information.
gyorgyf@60 14 */
gyorgyf@60 15
gyorgyf@60 16 #ifndef _BINARY_FEATURE_WRITER_H_
gyorgyf@60 17 #define _BINARY_FEATURE_WRITER_H_
gyorgyf@60 18
gyorgyf@60 19 #include <string>
gyorgyf@60 20 #include <map>
gyorgyf@60 21 #include <fstream>
gyorgyf@60 22
gyorgyf@60 23 using std::string;
gyorgyf@60 24 using std::map;
gyorgyf@60 25
gyorgyf@60 26 #include "transform/FeatureWriter.h"
gyorgyf@60 27
gyorgyf@60 28 class BinaryFeatureWriter : public FeatureWriter
gyorgyf@60 29 {
gyorgyf@60 30 public:
gyorgyf@60 31 BinaryFeatureWriter();
gyorgyf@60 32 virtual ~BinaryFeatureWriter();
gyorgyf@60 33
gyorgyf@60 34 virtual ParameterList getSupportedParameters() const;
gyorgyf@60 35 virtual void setParameters(map<string, string> &params);
gyorgyf@60 36
gyorgyf@60 37 virtual void setOutputFile(const string &);
gyorgyf@60 38
gyorgyf@60 39 virtual void write(QString trackid,
gyorgyf@60 40 const Transform &transform,
gyorgyf@60 41 const Vamp::Plugin::OutputDescriptor &output,
gyorgyf@60 42 const Vamp::Plugin::FeatureList &features,
gyorgyf@60 43 std::string summaryType = "");
gyorgyf@60 44
gyorgyf@60 45 virtual void finish();
gyorgyf@60 46
gyorgyf@60 47 virtual QString getWriterTag() const { return "binary"; }
gyorgyf@60 48
gyorgyf@60 49 private:
gyorgyf@60 50 // Parameters
gyorgyf@60 51 string outputFile;
gyorgyf@60 52
gyorgyf@60 53 // Parameter names (class vars)
gyorgyf@60 54 static string outputFileParam;
gyorgyf@60 55
gyorgyf@60 56 struct OutputStream;
gyorgyf@60 57 /*
gyorgyf@60 58 struct BinaryFeatureWriter::TrackStream
gyorgyf@60 59 {
gyorgyf@60 60 QString trackid;
gyorgyf@60 61 ofstream* ofs;
gyorgyf@60 62 };
gyorgyf@60 63 */
gyorgyf@60 64 typedef std::map<QString, float> ParameterMap;
gyorgyf@60 65
gyorgyf@60 66 OutputStream *binary;
gyorgyf@60 67
gyorgyf@60 68 bool openBinaryFile();
gyorgyf@69 69 long feature_count; // number of features per output
gyorgyf@69 70 long data_size_pos; // temporary storage for file positioning
gyorgyf@69 71 long output_binCount; // element count of each feature
gyorgyf@69 72 long element_count; // total number of elements (e.g. float numbers) written per output
gyorgyf@60 73 };
gyorgyf@60 74
gyorgyf@60 75 #endif