annotate data/model/AggregateWaveModel.h @ 575:8688430850d6

* either I'm going mad or the compiler is... valgrind and sizeof both seem to think that reading or writing m_size is reading beyond the end of the object, unless I add m_spare padding... why?
author Chris Cannam
date Mon, 16 Mar 2009 16:32:02 +0000
parents 166c22eff678
children 59e7fe1b1003
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@297 16 #ifndef _AGGREGATE_WAVE_MODEL_H_
Chris@297 17 #define _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@297 31 ModelChannelSpec(RangeSummarisableTimeValueModel *m, int c) :
Chris@297 32 model(m), channel(c) { }
Chris@297 33 RangeSummarisableTimeValueModel *model;
Chris@297 34 int channel;
Chris@297 35 };
Chris@297 36
Chris@297 37 typedef std::vector<ModelChannelSpec> ChannelSpecList;
Chris@297 38
Chris@297 39 AggregateWaveModel(ChannelSpecList channelSpecs);
Chris@297 40 ~AggregateWaveModel();
Chris@297 41
Chris@297 42 bool isOK() const;
Chris@297 43 bool isReady(int *) const;
Chris@297 44
Chris@345 45 QString getTypeName() const { return tr("Aggregate Wave"); }
Chris@345 46
Chris@297 47 size_t getComponentCount() const;
Chris@297 48 ModelChannelSpec getComponent(size_t c) const;
Chris@297 49
Chris@297 50 const ZoomConstraint *getZoomConstraint() const { return &m_zoomConstraint; }
Chris@297 51
Chris@297 52 size_t getFrameCount() const;
Chris@297 53 size_t getChannelCount() const;
Chris@297 54 size_t getSampleRate() const;
Chris@297 55
Chris@297 56 virtual Model *clone() const;
Chris@297 57
Chris@297 58 float getValueMinimum() const { return -1.0f; }
Chris@297 59 float getValueMaximum() const { return 1.0f; }
Chris@297 60
Chris@297 61 virtual size_t getStartFrame() const { return 0; }
Chris@297 62 virtual size_t getEndFrame() const { return getFrameCount(); }
Chris@297 63
Chris@300 64 virtual size_t getData(int channel, size_t start, size_t count,
Chris@300 65 float *buffer) const;
Chris@297 66
Chris@300 67 virtual size_t getData(int channel, size_t start, size_t count,
Chris@300 68 double *buffer) const;
Chris@297 69
Chris@363 70 virtual size_t getData(size_t fromchannel, size_t tochannel,
Chris@363 71 size_t start, size_t count,
Chris@363 72 float **buffer) const;
Chris@363 73
Chris@377 74 virtual size_t getSummaryBlockSize(size_t desired) const;
Chris@377 75
Chris@300 76 virtual void getSummaries(size_t channel, size_t start, size_t count,
Chris@300 77 RangeBlock &ranges,
Chris@300 78 size_t &blockSize) const;
Chris@297 79
Chris@300 80 virtual Range getSummary(size_t channel, size_t start, size_t count) const;
Chris@297 81
Chris@297 82 virtual void toXml(QTextStream &out,
Chris@297 83 QString indent = "",
Chris@297 84 QString extraAttributes = "") const;
Chris@297 85
Chris@297 86 signals:
Chris@297 87 void modelChanged();
Chris@297 88 void modelChanged(size_t, size_t);
Chris@297 89 void completionChanged();
Chris@297 90
Chris@297 91 protected slots:
Chris@297 92 void componentModelChanged();
Chris@297 93 void componentModelChanged(size_t, size_t);
Chris@297 94 void componentModelCompletionChanged();
Chris@297 95
Chris@297 96 protected:
Chris@297 97 ChannelSpecList m_components;
Chris@297 98 static PowerOfSqrtTwoZoomConstraint m_zoomConstraint;
Chris@297 99 };
Chris@297 100
Chris@297 101 #endif
Chris@297 102