3 #ifndef SPECTMORPH_SAMPLE_VIEW_HH 4 #define SPECTMORPH_SAMPLE_VIEW_HH 7 #include "smwavdata.hh" 8 #include "smblockutils.hh" 28 virtual size_t count() = 0;
29 virtual EditMarkerType type (
size_t marker) = 0;
30 virtual float position (
size_t marker) = 0;
31 virtual bool valid (
size_t marker) = 0;
32 virtual void set_position (
size_t marker,
float new_position) = 0;
33 virtual void clear (
size_t marker) = 0;
37 std::vector<float> signal;
44 EditMarkerType m_edit_marker_type;
45 bool button_1_pressed;
48 void mousePressEvent (QMouseEvent *event);
49 void move_marker (
int x);
50 void mouseMoveEvent (QMouseEvent *event);
51 void mouseReleaseEvent (QMouseEvent *event);
56 void set_zoom (
double hzoom,
double vzoom);
57 void paintEvent (QPaintEvent *event);
59 void set_edit_marker_type (EditMarkerType marker_type);
60 EditMarkerType edit_marker_type();
62 template<
class Pa
inter>
static void 63 draw_signal (std::vector<float>& signal, Painter& painter,
const QRect& rect,
int height,
double vz,
double hz)
67 double last_value = 0;
69 for (
int x = rect.x(); x < rect.x() + rect.width(); x++)
72 int i1 = (x + 1) / hz + 1;
76 if (i0 <
int (signal.size()) && i0 >= 0 && i1 <
int (signal.size() + 1) && i1 > 0)
78 painter.drawLine (last_x, (height / 2) + last_value * vz, x, (height / 2) + signal[i0] * vz);
80 float min_value, max_value;
81 Block::range (i1 - i0, &signal[i0], min_value, max_value);
83 painter.drawLine (x, (height / 2) + min_value * vz, x, (height / 2) + max_value * vz);
86 last_value = signal[i1 - 1];
94 void mouse_time_changed (
int pos);
Audio sample containing many blocks.
Definition: smaudio.hh:81
Definition: smsampleview.hh:26
Definition: smalignedarray.cc:7
Definition: smwavdata.hh:13
Definition: smsampleview.hh:14