annotate data/model/test/MockWaveModel.h @ 1247:8f076d02569a piper

Make SVDEBUG always write to a log file -- formerly this was disabled in NDEBUG builds. I think there's little use to that, it just means that we keep adding more cerr debug output because we aren't getting the log we need. And SVDEBUG logging is not usually used in tight loops, I don't think the performance overhead is too serious. Also update the About box.
author Chris Cannam
date Thu, 03 Nov 2016 14:57:00 +0000
parents 4d9816ba0ebe
children 54af1e21705c
rev   line source
Chris@1086 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@1086 2
Chris@1086 3 /*
Chris@1086 4 Sonic Visualiser
Chris@1086 5 An audio file viewer and annotation editor.
Chris@1086 6 Centre for Digital Music, Queen Mary, University of London.
Chris@1086 7 This file copyright 2006 Chris Cannam.
Chris@1086 8
Chris@1086 9 This program is free software; you can redistribute it and/or
Chris@1086 10 modify it under the terms of the GNU General Public License as
Chris@1086 11 published by the Free Software Foundation; either version 2 of the
Chris@1086 12 License, or (at your option) any later version. See the file
Chris@1086 13 COPYING included with this distribution for more information.
Chris@1086 14 */
Chris@1086 15
Chris@1086 16 #ifndef MOCK_WAVE_MODEL_H
Chris@1086 17 #define MOCK_WAVE_MODEL_H
Chris@1086 18
Chris@1086 19 #include "../DenseTimeValueModel.h"
Chris@1086 20
Chris@1086 21 #include <vector>
Chris@1086 22
Chris@1086 23 enum Sort {
Chris@1086 24 DC,
Chris@1086 25 Sine,
Chris@1086 26 Cosine,
Chris@1086 27 Nyquist,
Chris@1086 28 Dirac
Chris@1086 29 };
Chris@1086 30
Chris@1086 31 class MockWaveModel : public DenseTimeValueModel
Chris@1086 32 {
Chris@1086 33 Q_OBJECT
Chris@1086 34
Chris@1086 35 public:
Chris@1088 36 /** One Sort per channel! Length is in samples, and is in addition
Chris@1088 37 * to "pad" number of zero samples at the start and end */
Chris@1088 38 MockWaveModel(std::vector<Sort> sorts, int length, int pad);
Chris@1086 39
Chris@1086 40 virtual float getValueMinimum() const { return -1.f; }
Chris@1086 41 virtual float getValueMaximum() const { return 1.f; }
Chris@1086 42 virtual int getChannelCount() const { return int(m_data.size()); }
Chris@1086 43
Chris@1096 44 virtual std::vector<float> getData(int channel, sv_frame_t start, sv_frame_t count) const;
Chris@1096 45 virtual std::vector<std::vector<float>> getMultiChannelData(int fromchannel, int tochannel, sv_frame_t start, sv_frame_t count) const;
Chris@1086 46
Chris@1086 47 virtual bool canPlay() const { return true; }
Chris@1086 48 virtual QString getDefaultPlayClipId() const { return ""; }
Chris@1086 49
Chris@1086 50 virtual sv_frame_t getStartFrame() const { return 0; }
Chris@1086 51 virtual sv_frame_t getEndFrame() const { return m_data[0].size(); }
Chris@1086 52 virtual sv_samplerate_t getSampleRate() const { return 44100; }
Chris@1086 53 virtual bool isOK() const { return true; }
Chris@1086 54
Chris@1086 55 QString getTypeName() const { return tr("Mock Wave"); }
Chris@1086 56
Chris@1086 57 private:
Chris@1086 58 std::vector<std::vector<float> > m_data;
Chris@1088 59 std::vector<float> generate(Sort sort, int length, int pad) const;
Chris@1086 60 };
Chris@1086 61
Chris@1086 62 #endif