Mercurial > hg > svgui
changeset 30:ea6fe8cfcdd5
* Add the Note layer for pianoroll-type display of note-type data
* Complete the MIDI file importer (well, nearly -- it would be nice to
be able to import the non-note data as other sorts of models, and that's
not done yet).
* Minor refactoring in RealTime etc
author | Chris Cannam |
---|---|
date | Fri, 10 Feb 2006 17:51:36 +0000 |
parents | 9f55af9676b4 |
children | fc802f7b112e |
files | layer/LayerFactory.cpp layer/LayerFactory.h layer/NoteLayer.cpp layer/NoteLayer.h layer/SpectrogramLayer.h layer/TimeInstantLayer.h layer/TimeRulerLayer.cpp layer/TimeValueLayer.h layer/WaveformLayer.h |
diffstat | 9 files changed, 757 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/LayerFactory.cpp Wed Feb 08 17:59:16 2006 +0000 +++ b/layer/LayerFactory.cpp Fri Feb 10 17:51:36 2006 +0000 @@ -14,12 +14,14 @@ #include "TimeRulerLayer.h" #include "TimeInstantLayer.h" #include "TimeValueLayer.h" +#include "NoteLayer.h" #include "Colour3DPlotLayer.h" #include "model/RangeSummarisableTimeValueModel.h" #include "model/DenseTimeValueModel.h" #include "model/SparseOneDimensionalModel.h" #include "model/SparseTimeValueModel.h" +#include "model/NoteModel.h" #include "model/DenseThreeDimensionalModel.h" LayerFactory * @@ -44,6 +46,7 @@ case TimeRuler: return Layer::tr("Ruler"); case TimeInstants: return Layer::tr("Time Instants"); case TimeValues: return Layer::tr("Time Values"); + case Notes: return Layer::tr("Notes"); case Colour3DPlot: return Layer::tr("Colour 3D Plot"); case MelodicRangeSpectrogram: @@ -84,6 +87,10 @@ types.insert(TimeValues); } + if (dynamic_cast<NoteModel *>(model)) { + types.insert(Notes); + } + // We don't count TimeRuler here as it doesn't actually display // the data, although it can be backed by any model @@ -96,6 +103,7 @@ LayerTypeSet types; types.insert(TimeInstants); types.insert(TimeValues); + types.insert(Notes); //!!! and in principle Colour3DPlot -- now that's a challenge return types; } @@ -108,6 +116,7 @@ if (dynamic_cast<const TimeRulerLayer *>(layer)) return TimeRuler; if (dynamic_cast<const TimeInstantLayer *>(layer)) return TimeInstants; if (dynamic_cast<const TimeValueLayer *>(layer)) return TimeValues; + if (dynamic_cast<const NoteLayer *>(layer)) return Notes; if (dynamic_cast<const Colour3DPlotLayer *>(layer)) return Colour3DPlot; return UnknownLayer; } @@ -121,6 +130,7 @@ case TimeRuler: return "timeruler"; case TimeInstants: return "instants"; case TimeValues: return "values"; + case Notes: return "notes"; case Colour3DPlot: return "colour3d"; default: return "unknown"; } @@ -135,6 +145,7 @@ case TimeRuler: return "timeruler"; case TimeInstants: return "timeinstants"; case TimeValues: return "timevalues"; + case Notes: return "notes"; case Colour3DPlot: return "colour3dplot"; default: return "unknown"; } @@ -148,6 +159,7 @@ if (name == "timeruler") return TimeRuler; if (name == "timeinstants") return TimeInstants; if (name == "timevalues") return TimeValues; + if (name == "notes") return Notes; if (name == "colour3dplot") return Colour3DPlot; return UnknownLayer; } @@ -170,6 +182,9 @@ if (trySetModel<TimeValueLayer, SparseTimeValueModel>(layer, model)) return; + if (trySetModel<NoteLayer, NoteModel>(layer, model)) + return; + if (trySetModel<Colour3DPlotLayer, DenseThreeDimensionalModel>(layer, model)) return; @@ -185,6 +200,9 @@ } else if (layerType == TimeValues) { return new SparseTimeValueModel(baseModel->getSampleRate(), 1, 0.0, 0.0, true); + } else if (layerType == Notes) { + return new NoteModel(baseModel->getSampleRate(), 1, + 0.0, 0.0, true); } else { return 0; } @@ -220,6 +238,10 @@ layer = new TimeValueLayer(view); break; + case Notes: + layer = new NoteLayer(view); + break; + case Colour3DPlot: layer = new Colour3DPlotLayer(view); break;
--- a/layer/LayerFactory.h Wed Feb 08 17:59:16 2006 +0000 +++ b/layer/LayerFactory.h Fri Feb 10 17:51:36 2006 +0000 @@ -28,6 +28,7 @@ TimeRuler, TimeInstants, TimeValues, + Notes, Colour3DPlot, // Layers with different initial parameters
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layer/NoteLayer.cpp Fri Feb 10 17:51:36 2006 +0000 @@ -0,0 +1,629 @@ +/* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ + +/* + A waveform viewer and audio annotation editor. + Chris Cannam, Queen Mary University of London, 2005-2006 + + This is experimental software. Not for distribution. +*/ + +#include "NoteLayer.h" + +#include "base/Model.h" +#include "base/RealTime.h" +#include "base/Profiler.h" +#include "base/Pitch.h" +#include "base/View.h" + +#include "model/NoteModel.h" + +#include <QPainter> +#include <QPainterPath> +#include <QMouseEvent> + +#include <iostream> +#include <cmath> + +NoteLayer::NoteLayer(View *w) : + Layer(w), + m_model(0), + m_editing(false), + m_originalPoint(0, 0.0, 0, tr("New Point")), + m_editingPoint(0, 0.0, 0, tr("New Point")), + m_editingCommand(0), + m_colour(Qt::black), + m_verticalScale(MinMaxRangeScale) +{ + m_view->addLayer(this); +} + +void +NoteLayer::setModel(NoteModel *model) +{ + if (m_model == model) return; + m_model = model; + + connect(m_model, SIGNAL(modelChanged()), this, SIGNAL(modelChanged())); + connect(m_model, SIGNAL(modelChanged(size_t, size_t)), + this, SIGNAL(modelChanged(size_t, size_t))); + + connect(m_model, SIGNAL(completionChanged()), + this, SIGNAL(modelCompletionChanged())); + + std::cerr << "NoteLayer::setModel(" << model << ")" << std::endl; + + emit modelReplaced(); +} + +Layer::PropertyList +NoteLayer::getProperties() const +{ + PropertyList list; + list.push_back(tr("Colour")); + list.push_back(tr("Vertical Scale")); + return list; +} + +Layer::PropertyType +NoteLayer::getPropertyType(const PropertyName &) const +{ + return ValueProperty; +} + +int +NoteLayer::getPropertyRangeAndValue(const PropertyName &name, + int *min, int *max) const +{ + //!!! factor this colour handling stuff out into a colour manager class + + int deft = 0; + + if (name == tr("Colour")) { + + if (min) *min = 0; + if (max) *max = 5; + + if (m_colour == Qt::black) deft = 0; + else if (m_colour == Qt::darkRed) deft = 1; + else if (m_colour == Qt::darkBlue) deft = 2; + else if (m_colour == Qt::darkGreen) deft = 3; + else if (m_colour == QColor(200, 50, 255)) deft = 4; + else if (m_colour == QColor(255, 150, 50)) deft = 5; + + } else if (name == tr("Vertical Scale")) { + + if (min) *min = 0; + if (max) *max = 2; + + deft = int(m_verticalScale); + + } else { + + deft = Layer::getPropertyRangeAndValue(name, min, max); + } + + return deft; +} + +QString +NoteLayer::getPropertyValueLabel(const PropertyName &name, + int value) const +{ + if (name == tr("Colour")) { + switch (value) { + default: + case 0: return tr("Black"); + case 1: return tr("Red"); + case 2: return tr("Blue"); + case 3: return tr("Green"); + case 4: return tr("Purple"); + case 5: return tr("Orange"); + } + } else if (name == tr("Vertical Scale")) { + switch (value) { + default: + case 0: return tr("Note Range In Use"); + case 1: return tr("MIDI Note Range"); + case 2: return tr("Frequency"); + } + } + return tr("<unknown>"); +} + +void +NoteLayer::setProperty(const PropertyName &name, int value) +{ + if (name == tr("Colour")) { + switch (value) { + default: + case 0: setBaseColour(Qt::black); break; + case 1: setBaseColour(Qt::darkRed); break; + case 2: setBaseColour(Qt::darkBlue); break; + case 3: setBaseColour(Qt::darkGreen); break; + case 4: setBaseColour(QColor(200, 50, 255)); break; + case 5: setBaseColour(QColor(255, 150, 50)); break; + } + } else if (name == tr("Vertical Scale")) { + setVerticalScale(VerticalScale(value)); + } +} + +void +NoteLayer::setBaseColour(QColor colour) +{ + if (m_colour == colour) return; + m_colour = colour; + emit layerParametersChanged(); +} + +void +NoteLayer::setVerticalScale(VerticalScale scale) +{ + if (m_verticalScale == scale) return; + m_verticalScale = scale; + emit layerParametersChanged(); +} + +bool +NoteLayer::isLayerScrollable() const +{ + QPoint discard; + return !m_view->shouldIlluminateLocalFeatures(this, discard); +} + +NoteModel::PointList +NoteLayer::getLocalPoints(int x) const +{ + if (!m_model) return NoteModel::PointList(); + + long frame = getFrameForX(x); + + NoteModel::PointList onPoints = + m_model->getPoints(frame); + + if (!onPoints.empty()) { + return onPoints; + } + + NoteModel::PointList prevPoints = + m_model->getPreviousPoints(frame); + NoteModel::PointList nextPoints = + m_model->getNextPoints(frame); + + NoteModel::PointList usePoints = prevPoints; + + if (prevPoints.empty()) { + usePoints = nextPoints; + } else if (prevPoints.begin()->frame < m_view->getStartFrame() && + !(nextPoints.begin()->frame > m_view->getEndFrame())) { + usePoints = nextPoints; + } else if (nextPoints.begin()->frame - frame < + frame - prevPoints.begin()->frame) { + usePoints = nextPoints; + } + + if (!usePoints.empty()) { + int fuzz = 2; + int px = getXForFrame(usePoints.begin()->frame); + if ((px > x && px - x > fuzz) || + (px < x && x - px > fuzz + 1)) { + usePoints.clear(); + } + } + + return usePoints; +} + +QString +NoteLayer::getFeatureDescription(QPoint &pos) const +{ + int x = pos.x(); + + if (!m_model || !m_model->getSampleRate()) return ""; + + NoteModel::PointList points = getLocalPoints(x); + + if (points.empty()) { + if (!m_model->isReady()) { + return tr("In progress"); + } else { + return tr("No local points"); + } + } + + Note note(0); + NoteModel::PointList::iterator i; + + for (i = points.begin(); i != points.end(); ++i) { + + int y = getYForValue(i->value); + int h = 3; + + if (m_model->getValueQuantization() != 0.0) { + h = y - getYForValue(i->value + m_model->getValueQuantization()); + if (h < 3) h = 3; + } + + if (pos.y() >= y - h && pos.y() <= y) { + note = *i; + break; + } + } + + if (i == points.end()) return tr("No local points"); + + RealTime rt = RealTime::frame2RealTime(note.frame, + m_model->getSampleRate()); + RealTime rd = RealTime::frame2RealTime(note.duration, + m_model->getSampleRate()); + + QString text; + + if (note.label == "") { + text = QString(tr("Time:\t%1\nPitch:\t%2\nDuration:\t%3\nNo label")) + .arg(rt.toText(true).c_str()) + .arg(note.value) + .arg(rd.toText(true).c_str()); + } else { + text = QString(tr("Time:\t%1\nPitch:\t%2\nDuration:\t%3\nLabel:\t%4")) + .arg(rt.toText(true).c_str()) + .arg(note.value) + .arg(rd.toText(true).c_str()) + .arg(note.label); + } + + pos = QPoint(getXForFrame(note.frame), + getYForValue(note.value)); + return text; +} + +bool +NoteLayer::snapToFeatureFrame(int &frame, + size_t &resolution, + SnapType snap) const +{ + if (!m_model) { + return Layer::snapToFeatureFrame(frame, resolution, snap); + } + + resolution = m_model->getResolution(); + NoteModel::PointList points; + + if (snap == SnapNeighbouring) { + + points = getLocalPoints(getXForFrame(frame)); + if (points.empty()) return false; + frame = points.begin()->frame; + return true; + } + + points = m_model->getPoints(frame, frame); + int snapped = frame; + bool found = false; + + for (NoteModel::PointList::const_iterator i = points.begin(); + i != points.end(); ++i) { + + if (snap == SnapRight) { + + if (i->frame > frame) { + snapped = i->frame; + found = true; + break; + } + + } else if (snap == SnapLeft) { + + if (i->frame <= frame) { + snapped = i->frame; + found = true; // don't break, as the next may be better + } else { + break; + } + + } else { // nearest + + NoteModel::PointList::const_iterator j = i; + ++j; + + if (j == points.end()) { + + snapped = i->frame; + found = true; + break; + + } else if (j->frame >= frame) { + + if (j->frame - frame < frame - i->frame) { + snapped = j->frame; + } else { + snapped = i->frame; + } + found = true; + break; + } + } + } + + frame = snapped; + return found; +} + +int +NoteLayer::getYForValue(float value) const +{ + float min, max, h = m_view->height(); + + switch (m_verticalScale) { + + case MIDIRangeScale: + min = 0.0; + max = 127.0; + break; + + case MinMaxRangeScale: + min = m_model->getValueMinimum(); + max = m_model->getValueMaximum(); + break; + + case FrequencyScale: + std::cerr << "FrequencyScale: value in = " << value << std::endl; + min = m_model->getValueMinimum(); + min = Pitch::getFrequencyForPitch(lrintf(min), min - lrintf(min)); + max = m_model->getValueMaximum(); + max = Pitch::getFrequencyForPitch(lrintf(max), max - lrintf(max)); + value = Pitch::getFrequencyForPitch(lrintf(value), value - lrintf(value)); + std::cerr << "FrequencyScale: min = " << min << ", max = " << max << ", value = " << value << std::endl; + break; + } + + if (max < min) max = min; + max = max + 1.0; + + return int(h - ((value - min) * h) / (max - min)) - 1; +} + +float +NoteLayer::getValueForY(int y) const +{ + float min = m_model->getValueMinimum(); + float max = m_model->getValueMaximum(); + if (max == min) max = min + 1.0; + + int h = m_view->height(); + + return min + (float(h - y) * float(max - min)) / h; +} + +void +NoteLayer::paint(QPainter &paint, QRect rect) const +{ + if (!m_model || !m_model->isOK()) return; + + int sampleRate = m_model->getSampleRate(); + if (!sampleRate) return; + +// Profiler profiler("NoteLayer::paint", true); + + int x0 = rect.left(), x1 = rect.right(); + long frame0 = getFrameForX(x0); + long frame1 = getFrameForX(x1); + + NoteModel::PointList points(m_model->getPoints(frame0, frame1)); + if (points.empty()) return; + + paint.setPen(m_colour); + + QColor brushColour(m_colour); + brushColour.setAlpha(80); + +// std::cerr << "NoteLayer::paint: resolution is " +// << m_model->getResolution() << " frames" << std::endl; + + float min = m_model->getValueMinimum(); + float max = m_model->getValueMaximum(); + if (max == min) max = min + 1.0; + + int origin = int(nearbyint(m_view->height() - + (-min * m_view->height()) / (max - min))); + + QPoint localPos; + long illuminateFrame = -1; + + if (m_view->shouldIlluminateLocalFeatures(this, localPos)) { + NoteModel::PointList localPoints = + getLocalPoints(localPos.x()); + if (!localPoints.empty()) illuminateFrame = localPoints.begin()->frame; + } + + paint.save(); + paint.setRenderHint(QPainter::Antialiasing, false); + + for (NoteModel::PointList::const_iterator i = points.begin(); + i != points.end(); ++i) { + + const NoteModel::Point &p(*i); + + int x = getXForFrame(p.frame); + int y = getYForValue(p.value); + int w = getXForFrame(p.frame + p.duration) - x; + int h = 3; + + if (m_model->getValueQuantization() != 0.0) { + h = y - getYForValue(p.value + m_model->getValueQuantization()); + if (h < 3) h = 3; + } + + if (w < 1) w = 1; + paint.setPen(m_colour); + paint.setBrush(brushColour); + + if (illuminateFrame == p.frame) { + if (localPos.y() >= y - h && localPos.y() < y) { + paint.setPen(Qt::black);//!!! + paint.setBrush(Qt::black);//!!! + } + } + + paint.drawRect(x, y - h, w, h); + +/// if (p.label != "") { +/// paint.drawText(x + 5, y - paint.fontMetrics().height() + paint.fontMetrics().ascent(), p.label); +/// } + } + + paint.restore(); +} + +void +NoteLayer::drawStart(QMouseEvent *e) +{ + std::cerr << "NoteLayer::drawStart(" << e->x() << "," << e->y() << ")" << std::endl; + + if (!m_model) return; + + long frame = getFrameForX(e->x()); + if (frame < 0) frame = 0; + frame = frame / m_model->getResolution() * m_model->getResolution(); + + float value = getValueForY(e->y()); + + m_editingPoint = NoteModel::Point(frame, value, 0, tr("New Point")); + m_originalPoint = m_editingPoint; + + if (m_editingCommand) m_editingCommand->finish(); + m_editingCommand = new NoteModel::EditCommand(m_model, + tr("Draw Point")); + m_editingCommand->addPoint(m_editingPoint); + + m_editing = true; +} + +void +NoteLayer::drawDrag(QMouseEvent *e) +{ + std::cerr << "NoteLayer::drawDrag(" << e->x() << "," << e->y() << ")" << std::endl; + + if (!m_model || !m_editing) return; + + long frame = getFrameForX(e->x()); + if (frame < 0) frame = 0; + frame = frame / m_model->getResolution() * m_model->getResolution(); + + float value = getValueForY(e->y()); + + m_editingCommand->deletePoint(m_editingPoint); + m_editingPoint.frame = frame; + m_editingPoint.value = value; + m_editingCommand->addPoint(m_editingPoint); +} + +void +NoteLayer::drawEnd(QMouseEvent *e) +{ + std::cerr << "NoteLayer::drawEnd(" << e->x() << "," << e->y() << ")" << std::endl; + if (!m_model || !m_editing) return; + m_editingCommand->finish(); + m_editingCommand = 0; + m_editing = false; +} + +void +NoteLayer::editStart(QMouseEvent *e) +{ + std::cerr << "NoteLayer::editStart(" << e->x() << "," << e->y() << ")" << std::endl; + + if (!m_model) return; + + NoteModel::PointList points = getLocalPoints(e->x()); + if (points.empty()) return; + + m_editingPoint = *points.begin(); + m_originalPoint = m_editingPoint; + + if (m_editingCommand) { + m_editingCommand->finish(); + m_editingCommand = 0; + } + + m_editing = true; +} + +void +NoteLayer::editDrag(QMouseEvent *e) +{ + std::cerr << "NoteLayer::editDrag(" << e->x() << "," << e->y() << ")" << std::endl; + + if (!m_model || !m_editing) return; + + long frame = getFrameForX(e->x()); + if (frame < 0) frame = 0; + frame = frame / m_model->getResolution() * m_model->getResolution(); + + float value = getValueForY(e->y()); + + if (!m_editingCommand) { + m_editingCommand = new NoteModel::EditCommand(m_model, + tr("Drag Point")); + } + + m_editingCommand->deletePoint(m_editingPoint); + m_editingPoint.frame = frame; + m_editingPoint.value = value; + m_editingCommand->addPoint(m_editingPoint); +} + +void +NoteLayer::editEnd(QMouseEvent *e) +{ + std::cerr << "NoteLayer::editEnd(" << e->x() << "," << e->y() << ")" << std::endl; + if (!m_model || !m_editing) return; + + if (m_editingCommand) { + + QString newName = m_editingCommand->getName(); + + if (m_editingPoint.frame != m_originalPoint.frame) { + if (m_editingPoint.value != m_originalPoint.value) { + newName = tr("Edit Point"); + } else { + newName = tr("Relocate Point"); + } + } else { + newName = tr("Change Point Value"); + } + + m_editingCommand->setName(newName); + m_editingCommand->finish(); + } + + m_editingCommand = 0; + m_editing = false; +} + +QString +NoteLayer::toXmlString(QString indent, QString extraAttributes) const +{ + return Layer::toXmlString(indent, extraAttributes + + QString(" colour=\"%1\" verticalScale=\"%2\"") + .arg(encodeColour(m_colour)).arg(m_verticalScale)); +} + +void +NoteLayer::setProperties(const QXmlAttributes &attributes) +{ + QString colourSpec = attributes.value("colour"); + if (colourSpec != "") { + QColor colour(colourSpec); + if (colour.isValid()) { + setBaseColour(QColor(colourSpec)); + } + } + + bool ok; + VerticalScale scale = (VerticalScale) + attributes.value("verticalScale").toInt(&ok); + if (ok) setVerticalScale(scale); +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layer/NoteLayer.h Fri Feb 10 17:51:36 2006 +0000 @@ -0,0 +1,95 @@ +/* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ + +/* + A waveform viewer and audio annotation editor. + Chris Cannam, Queen Mary University of London, 2005-2006 + + This is experimental software. Not for distribution. +*/ + +#ifndef _NOTE_LAYER_H_ +#define _NOTE_LAYER_H_ + +#include "base/Layer.h" +#include "model/NoteModel.h" + +#include <QObject> +#include <QColor> + +class View; +class QPainter; + +class NoteLayer : public Layer +{ + Q_OBJECT + +public: + NoteLayer(View *w); + + virtual void paint(QPainter &paint, QRect rect) const; + + virtual QString getFeatureDescription(QPoint &) const; + + virtual bool snapToFeatureFrame(int &frame, + size_t &resolution, + SnapType snap) const; + + virtual void drawStart(QMouseEvent *); + virtual void drawDrag(QMouseEvent *); + virtual void drawEnd(QMouseEvent *); + + virtual void editStart(QMouseEvent *); + virtual void editDrag(QMouseEvent *); + virtual void editEnd(QMouseEvent *); + + virtual const Model *getModel() const { return m_model; } + void setModel(NoteModel *model); + + virtual PropertyList getProperties() const; + virtual PropertyType getPropertyType(const PropertyName &) const; + virtual int getPropertyRangeAndValue(const PropertyName &, + int *min, int *max) const; + virtual QString getPropertyValueLabel(const PropertyName &, + int value) const; + virtual void setProperty(const PropertyName &, int value); + + void setBaseColour(QColor); + QColor getBaseColour() const { return m_colour; } + + enum VerticalScale { + MinMaxRangeScale, + MIDIRangeScale, + FrequencyScale + }; + + void setVerticalScale(VerticalScale scale); + VerticalScale getVerticalScale() const { return m_verticalScale; } + + virtual bool isLayerScrollable() const; + + virtual bool isLayerEditable() const { return true; } + + virtual int getCompletion() const { return m_model->getCompletion(); } + + virtual QString toXmlString(QString indent = "", + QString extraAttributes = "") const; + + void setProperties(const QXmlAttributes &attributes); + +protected: + int getYForValue(float value) const; + float getValueForY(int y) const; + + NoteModel::PointList getLocalPoints(int) const; + + NoteModel *m_model; + bool m_editing; + NoteModel::Point m_originalPoint; + NoteModel::Point m_editingPoint; + NoteModel::EditCommand *m_editingCommand; + QColor m_colour; + VerticalScale m_verticalScale; +}; + +#endif +
--- a/layer/SpectrogramLayer.h Wed Feb 08 17:59:16 2006 +0000 +++ b/layer/SpectrogramLayer.h Fri Feb 10 17:51:36 2006 +0000 @@ -7,8 +7,8 @@ This is experimental software. Not for distribution. */ -#ifndef _SPECTROGRAM_VIEW_H_ -#define _SPECTROGRAM_VIEW_H_ +#ifndef _SPECTROGRAM_LAYER_H_ +#define _SPECTROGRAM_LAYER_H_ #include "base/Layer.h" #include "base/Window.h"
--- a/layer/TimeInstantLayer.h Wed Feb 08 17:59:16 2006 +0000 +++ b/layer/TimeInstantLayer.h Fri Feb 10 17:51:36 2006 +0000 @@ -7,8 +7,8 @@ This is experimental software. Not for distribution. */ -#ifndef _TIME_INSTANT_VIEW_H_ -#define _TIME_INSTANT_VIEW_H_ +#ifndef _TIME_INSTANT_LAYER_H_ +#define _TIME_INSTANT_LAYER_H_ #include "base/Layer.h" #include "model/SparseOneDimensionalModel.h"
--- a/layer/TimeRulerLayer.cpp Wed Feb 08 17:59:16 2006 +0000 +++ b/layer/TimeRulerLayer.cpp Fri Feb 10 17:51:36 2006 +0000 @@ -185,7 +185,7 @@ long ms = rt.sec * 1000 + rt.msec(); ms = (ms / incms) * incms - incms; - RealTime incRt = RealTime(incms / 1000, (incms % 1000) * 1000000); + RealTime incRt = RealTime::fromMilliseconds(incms); long incFrame = RealTime::realTime2Frame(incRt, sampleRate); int incX = incFrame / zoomLevel; int ticks = 10; @@ -207,7 +207,7 @@ while (1) { - rt = RealTime(ms / 1000, (ms % 1000) * 1000000); + rt = RealTime::fromMilliseconds(ms); ms += incms; long frame = RealTime::realTime2Frame(rt, sampleRate);
--- a/layer/TimeValueLayer.h Wed Feb 08 17:59:16 2006 +0000 +++ b/layer/TimeValueLayer.h Fri Feb 10 17:51:36 2006 +0000 @@ -7,8 +7,8 @@ This is experimental software. Not for distribution. */ -#ifndef _TIME_VALUE_VIEW_H_ -#define _TIME_VALUE_VIEW_H_ +#ifndef _TIME_VALUE_LAYER_H_ +#define _TIME_VALUE_LAYER_H_ #include "base/Layer.h" #include "model/SparseTimeValueModel.h"
--- a/layer/WaveformLayer.h Wed Feb 08 17:59:16 2006 +0000 +++ b/layer/WaveformLayer.h Fri Feb 10 17:51:36 2006 +0000 @@ -7,8 +7,8 @@ This is experimental software. Not for distribution. */ -#ifndef _WAVEFORM_VIEW_H_ -#define _WAVEFORM_VIEW_H_ +#ifndef _WAVEFORM_LAYER_H_ +#define _WAVEFORM_LAYER_H_ #include <QRect> #include <QColor>