mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
switch from frames_per_pixel to samples_per_pixel in the one canvas object that uses this
This commit is contained in:
parent
8877199ae0
commit
e5a3747686
2 changed files with 14 additions and 14 deletions
|
|
@ -54,7 +54,7 @@ public:
|
||||||
XMLNode* get_state () const;
|
XMLNode* get_state () const;
|
||||||
void set_state (XMLNode const *);
|
void set_state (XMLNode const *);
|
||||||
|
|
||||||
void set_frames_per_pixel (double);
|
void set_samples_per_pixel (double);
|
||||||
void set_height (Distance);
|
void set_height (Distance);
|
||||||
void set_channel (int);
|
void set_channel (int);
|
||||||
void set_region_start (ARDOUR::frameoffset_t);
|
void set_region_start (ARDOUR::frameoffset_t);
|
||||||
|
|
@ -135,7 +135,7 @@ private:
|
||||||
|
|
||||||
boost::shared_ptr<ARDOUR::AudioRegion> _region;
|
boost::shared_ptr<ARDOUR::AudioRegion> _region;
|
||||||
int _channel;
|
int _channel;
|
||||||
double _frames_per_pixel;
|
double _samples_per_pixel;
|
||||||
Coord _height;
|
Coord _height;
|
||||||
Color _wave_color;
|
Color _wave_color;
|
||||||
/** The `start' value to use for the region; we can't use the region's
|
/** The `start' value to use for the region; we can't use the region's
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ WaveView::WaveView (Group* parent, boost::shared_ptr<ARDOUR::AudioRegion> region
|
||||||
, Fill (parent)
|
, Fill (parent)
|
||||||
, _region (region)
|
, _region (region)
|
||||||
, _channel (0)
|
, _channel (0)
|
||||||
, _frames_per_pixel (0)
|
, _samples_per_pixel (0)
|
||||||
, _height (64)
|
, _height (64)
|
||||||
, _wave_color (0xffffffff)
|
, _wave_color (0xffffffff)
|
||||||
, _region_start (0)
|
, _region_start (0)
|
||||||
|
|
@ -52,11 +52,11 @@ WaveView::WaveView (Group* parent, boost::shared_ptr<ARDOUR::AudioRegion> region
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WaveView::set_frames_per_pixel (double frames_per_pixel)
|
WaveView::set_samples_per_pixel (double samples_per_pixel)
|
||||||
{
|
{
|
||||||
begin_change ();
|
begin_change ();
|
||||||
|
|
||||||
_frames_per_pixel = frames_per_pixel;
|
_samples_per_pixel = samples_per_pixel;
|
||||||
|
|
||||||
_bounding_box_dirty = true;
|
_bounding_box_dirty = true;
|
||||||
end_change ();
|
end_change ();
|
||||||
|
|
@ -67,7 +67,7 @@ WaveView::set_frames_per_pixel (double frames_per_pixel)
|
||||||
void
|
void
|
||||||
WaveView::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
WaveView::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
|
||||||
{
|
{
|
||||||
assert (_frames_per_pixel != 0);
|
assert (_samples_per_pixel != 0);
|
||||||
|
|
||||||
if (!_region) {
|
if (!_region) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -77,8 +77,8 @@ WaveView::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) cons
|
||||||
area is relative to the position of the region.
|
area is relative to the position of the region.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int const start = rint (area.x0 + _region_start / _frames_per_pixel);
|
int const start = rint (area.x0 + _region_start / _samples_per_pixel);
|
||||||
int const end = rint (area.x1 + _region_start / _frames_per_pixel);
|
int const end = rint (area.x1 + _region_start / _samples_per_pixel);
|
||||||
|
|
||||||
int p = start;
|
int p = start;
|
||||||
list<CacheEntry*>::iterator cache = _cache.begin ();
|
list<CacheEntry*>::iterator cache = _cache.begin ();
|
||||||
|
|
@ -134,8 +134,8 @@ WaveView::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) cons
|
||||||
|
|
||||||
int const this_end = min (end, render->end ());
|
int const this_end = min (end, render->end ());
|
||||||
|
|
||||||
Coord const left = p - _region_start / _frames_per_pixel;
|
Coord const left = p - _region_start / _samples_per_pixel;
|
||||||
Coord const right = this_end - _region_start / _frames_per_pixel;
|
Coord const right = this_end - _region_start / _samples_per_pixel;
|
||||||
|
|
||||||
context->save ();
|
context->save ();
|
||||||
|
|
||||||
|
|
@ -157,7 +157,7 @@ void
|
||||||
WaveView::compute_bounding_box () const
|
WaveView::compute_bounding_box () const
|
||||||
{
|
{
|
||||||
if (_region) {
|
if (_region) {
|
||||||
_bounding_box = Rect (0, 0, _region->length() / _frames_per_pixel, _height);
|
_bounding_box = Rect (0, 0, _region->length() / _samples_per_pixel, _height);
|
||||||
} else {
|
} else {
|
||||||
_bounding_box = boost::optional<Rect> ();
|
_bounding_box = boost::optional<Rect> ();
|
||||||
}
|
}
|
||||||
|
|
@ -253,10 +253,10 @@ WaveView::CacheEntry::CacheEntry (
|
||||||
_wave_view->_region->read_peaks (
|
_wave_view->_region->read_peaks (
|
||||||
_peaks.get(),
|
_peaks.get(),
|
||||||
_n_peaks,
|
_n_peaks,
|
||||||
_start * _wave_view->_frames_per_pixel,
|
_start * _wave_view->_samples_per_pixel,
|
||||||
(_end - _start) * _wave_view->_frames_per_pixel,
|
(_end - _start) * _wave_view->_samples_per_pixel,
|
||||||
_wave_view->_channel,
|
_wave_view->_channel,
|
||||||
_wave_view->_frames_per_pixel
|
_wave_view->_samples_per_pixel
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue