3 #ifndef SPECTMORPH_SAMPLE_VIEW_HH
4 #define SPECTMORPH_SAMPLE_VIEW_HH
7 #include "smwavdata.hh"
8 #include "smblockutils.hh"
12 namespace SpectMorph {
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;
46 bool m_show_tuning =
false;
49 void mousePressEvent (QMouseEvent *event);
50 void move_marker (
int x);
51 void mouseMoveEvent (QMouseEvent *event);
52 void mouseReleaseEvent (QMouseEvent *event);
57 void set_zoom (
double hzoom,
double vzoom);
58 void paintEvent (QPaintEvent *event);
60 void set_edit_marker_type (EditMarkerType marker_type);
61 EditMarkerType edit_marker_type();
63 void set_show_tuning (
bool show_tuning);
65 template<
class Pa
inter>
static void
66 draw_signal (std::vector<float>& signal, Painter& painter,
const QRect& rect,
int height,
double vz,
double hz)
70 double last_value = 0;
72 for (
int x = rect.x(); x < rect.x() + rect.width(); x++)
75 int i1 = (x + 1) / hz + 1;
79 if (i0 <
int (signal.size()) && i0 >= 0 && i1 < int (signal.size() + 1) && i1 > 0)
81 painter.drawLine (last_x, (height / 2) + last_value * vz, x, (height / 2) + signal[i0] * vz);
83 float min_value, max_value;
84 Block::range (i1 - i0, &signal[i0], min_value, max_value);
86 painter.drawLine (x, (height / 2) + min_value * vz, x, (height / 2) + max_value * vz);
89 last_value = signal[i1 - 1];
97 void mouse_time_changed (
int pos);
Audio sample containing many blocks.
Definition: smaudio.hh:80
Definition: smsampleview.hh:26
Definition: smsampleview.hh:15
Definition: smwavdata.hh:17