20 #include <QTextStream> 26 m_components(channelSpecs)
28 for (ChannelSpecList::const_iterator i = channelSpecs.begin();
29 i != channelSpecs.end(); ++i) {
30 if (i->model->getSampleRate() !=
31 channelSpecs.begin()->model->getSampleRate()) {
32 SVDEBUG <<
"AggregateWaveModel::AggregateWaveModel: WARNING: Component models do not all have the same sample rate" << endl;
45 for (ChannelSpecList::const_iterator i =
m_components.begin();
47 if (!i->model->isOK())
return false;
55 if (completion) *completion = 100;
57 for (ChannelSpecList::const_iterator i =
m_components.begin();
59 int completionHere = 100;
60 if (!i->model->isReady(&completionHere))
ready =
false;
61 if (completion && completionHere < *completion) {
62 *completion = completionHere;
73 for (ChannelSpecList::const_iterator i =
m_components.begin();
75 int thisCount = i->model->getEndFrame() - i->model->getStartFrame();
76 if (thisCount > count) count = thisCount;
105 int ch0 = channel, ch1 = channel;
113 float *readbuf = buffer;
115 readbuf =
new float[count];
116 for (
int i = 0; i < count; ++i) {
123 for (
int c = ch0; c <= ch1; ++c) {
128 if (szHere < sz) sz = szHere;
130 for (
int i = 0; i < count; ++i) {
131 buffer[i] += readbuf[i];
136 if (mixing)
delete[] readbuf;
142 double *buffer)
const 144 int ch0 = channel, ch1 = channel;
152 double *readbuf = buffer;
154 readbuf =
new double[count];
155 for (
int i = 0; i < count; ++i) {
162 for (
int c = ch0; c <= ch1; ++c) {
167 if (szHere < sz) sz = szHere;
169 for (
int i = 0; i < count; ++i) {
170 buffer[i] += readbuf[i];
175 if (mixing)
delete[] readbuf;
181 int start,
int count,
182 float **buffer)
const 186 for (
int c = fromchannel; c <= tochannel; ++c) {
187 int here =
getData(c, start, count, buffer[c - fromchannel]);
188 if (here < min) min = here;
virtual Model * clone() const
Return a copy of this model.
void componentModelChangedWithin(int, int)
int getSampleRate() const
Return the frame rate in frames per second.
static PowerOfSqrtTwoZoomConstraint m_zoomConstraint
std::vector< Range > RangeBlock
void ready()
Emitted when internal processing is complete (i.e.
AggregateWaveModel(ChannelSpecList channelSpecs)
bool isOK() const
Return true if the model was constructed successfully.
int getChannelCount() const
Return the number of distinct channels for this model.
ModelChannelSpec getComponent(int c) const
ChannelSpecList m_components
virtual Range getSummary(int channel, int start, int count) const
Return the range from the given start frame, corresponding to the given number of underlying sample f...
virtual void getSummaries(int channel, int start, int count, RangeBlock &ranges, int &blockSize) const
Return ranges from the given start frame, corresponding to the given number of underlying sample fram...
void componentModelChanged()
Model is the base class for all data models that represent any sort of data on a time scale based on ...
void componentModelCompletionChanged()
std::vector< ModelChannelSpec > ChannelSpecList
int getFrameCount() const
int getComponentCount() const
virtual int getSummaryBlockSize(int desired) const
bool isReady(int *) const
Return true if the model has finished loading or calculating all its data, for a model that is capabl...
void modelChangedWithin(int, int)
virtual void toXml(QTextStream &out, QString indent="", QString extraAttributes="") const
Stream this exportable object out to XML on a text stream.
virtual int getData(int channel, int start, int count, float *buffer) const
Get the specified set of samples from the given channel of the model in single-precision floating-poi...