annotate data/model/AggregateWaveModel.h @ 1782:2a810ed46977

Lib dir name is usually the same as the binary name, not the formal application name
author Chris Cannam
date Tue, 17 Sep 2019 09:28:27 +0100
parents dffc70996f54
children
rev   line source
Chris@297 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@297 2
Chris@297 3 /*
Chris@297 4 Sonic Visualiser
Chris@297 5 An audio file viewer and annotation editor.
Chris@297 6 Centre for Digital Music, Queen Mary, University of London.
Chris@297 7 This file copyright 2007 QMUL.
Chris@297 8
Chris@297 9 This program is free software; you can redistribute it and/or
Chris@297 10 modify it under the terms of the GNU General Public License as
Chris@297 11 published by the Free Software Foundation; either version 2 of the
Chris@297 12 License, or (at your option) any later version. See the file
Chris@297 13 COPYING included with this distribution for more information.
Chris@297 14 */
Chris@297 15
Chris@1581 16 #ifndef SV_AGGREGATE_WAVE_MODEL_H
Chris@1581 17 #define SV_AGGREGATE_WAVE_MODEL_H
Chris@297 18
Chris@297 19 #include "RangeSummarisableTimeValueModel.h"
Chris@297 20 #include "PowerOfSqrtTwoZoomConstraint.h"
Chris@297 21
Chris@297 22 #include <vector>
Chris@297 23
Chris@297 24 class AggregateWaveModel : public RangeSummarisableTimeValueModel
Chris@297 25 {
Chris@297 26 Q_OBJECT
Chris@297 27
Chris@297 28 public:
Chris@297 29 struct ModelChannelSpec
Chris@297 30 {
Chris@1732 31 ModelChannelSpec(ModelId m, int c) : model(m), channel(c) { }
Chris@1732 32 ModelId model;
Chris@297 33 int channel;
Chris@297 34 };
Chris@297 35
Chris@297 36 typedef std::vector<ModelChannelSpec> ChannelSpecList;
Chris@297 37
Chris@297 38 AggregateWaveModel(ChannelSpecList channelSpecs);
Chris@297 39 ~AggregateWaveModel();
Chris@297 40
Chris@1580 41 bool isOK() const override;
Chris@1580 42 bool isReady(int *) const override;
Chris@1671 43 int getCompletion() const override {
Chris@1671 44 int c = 0;
Chris@1671 45 (void)isReady(&c);
Chris@1671 46 return c;
Chris@1671 47 }
Chris@297 48
Chris@1580 49 QString getTypeName() const override { return tr("Aggregate Wave"); }
Chris@345 50
Chris@929 51 int getComponentCount() const;
Chris@929 52 ModelChannelSpec getComponent(int c) const;
Chris@297 53
Chris@1580 54 const ZoomConstraint *getZoomConstraint() const override { return &m_zoomConstraint; }
Chris@297 55
Chris@1038 56 sv_frame_t getFrameCount() const;
Chris@1580 57 int getChannelCount() const override;
Chris@1580 58 sv_samplerate_t getSampleRate() const override;
Chris@297 59
Chris@1580 60 float getValueMinimum() const override { return -1.0f; }
Chris@1580 61 float getValueMaximum() const override { return 1.0f; }
Chris@297 62
Chris@1580 63 sv_frame_t getStartFrame() const override { return 0; }
Chris@1725 64 sv_frame_t getTrueEndFrame() const override { return getFrameCount(); }
Chris@297 65
Chris@1580 66 floatvec_t getData(int channel, sv_frame_t start, sv_frame_t count) const override;
Chris@297 67
Chris@1580 68 std::vector<floatvec_t> getMultiChannelData(int fromchannel, int tochannel, sv_frame_t start, sv_frame_t count) const override;
Chris@363 69
Chris@1580 70 int getSummaryBlockSize(int desired) const override;
Chris@377 71
Chris@1580 72 void getSummaries(int channel, sv_frame_t start, sv_frame_t count,
Chris@300 73 RangeBlock &ranges,
Chris@1580 74 int &blockSize) const override;
Chris@297 75
Chris@1580 76 Range getSummary(int channel, sv_frame_t start, sv_frame_t count) const override;
Chris@297 77
Chris@1580 78 void toXml(QTextStream &out,
Chris@297 79 QString indent = "",
Chris@1580 80 QString extraAttributes = "") const override;
Chris@297 81
Chris@297 82 protected slots:
Chris@1770 83 void componentModelChanged(ModelId);
Chris@1770 84 void componentModelChangedWithin(ModelId, sv_frame_t, sv_frame_t);
Chris@1770 85 void componentModelCompletionChanged(ModelId);
Chris@297 86
Chris@297 87 protected:
Chris@297 88 ChannelSpecList m_components;
Chris@297 89 static PowerOfSqrtTwoZoomConstraint m_zoomConstraint;
Chris@297 90 };
Chris@297 91
Chris@297 92 #endif
Chris@297 93