fixed waveform shape and scale issue to maintain the state for all new regions on the track
git-svn-id: svn://localhost/ardour2/trunk@1222 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -56,7 +56,9 @@ AudioStreamView::AudioStreamView (AudioTimeAxisView& tv)
|
||||
: StreamView (tv)
|
||||
{
|
||||
crossfades_visible = true;
|
||||
|
||||
_waveform_scale = LinearWaveform;
|
||||
_waveform_shape = Traditional;
|
||||
|
||||
if (tv.is_audio_track())
|
||||
stream_base_color = color_map[cAudioTrackBase];
|
||||
else
|
||||
@@ -144,6 +146,14 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wai
|
||||
/* great. we already have a AudioRegionView for this Region. use it again. */
|
||||
|
||||
(*i)->set_valid (true);
|
||||
|
||||
// this might not be necessary
|
||||
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
|
||||
if (arv) {
|
||||
arv->set_waveform_scale (_waveform_scale);
|
||||
arv->set_waveform_shape (_waveform_shape);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -162,6 +172,27 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wai
|
||||
region_view->init (region_color, wait_for_waves);
|
||||
region_view->set_amplitude_above_axis(_amplitude_above_axis);
|
||||
region_views.push_front (region_view);
|
||||
|
||||
/* if this was the first one, then lets query the waveform scale and shape.
|
||||
otherwise, we set it to the current value */
|
||||
|
||||
if (region_views.size() == 1) {
|
||||
if (region_view->waveform_logscaled()) {
|
||||
_waveform_scale = LogWaveform;
|
||||
} else {
|
||||
_waveform_scale = LinearWaveform;
|
||||
}
|
||||
|
||||
if (region_view->waveform_rectified()) {
|
||||
_waveform_shape = Rectified;
|
||||
} else {
|
||||
_waveform_shape = Traditional;
|
||||
}
|
||||
}
|
||||
else {
|
||||
region_view->set_waveform_scale(_waveform_scale);
|
||||
region_view->set_waveform_shape(_waveform_shape);
|
||||
}
|
||||
|
||||
/* follow global waveform setting */
|
||||
|
||||
@@ -382,48 +413,20 @@ AudioStreamView::set_waveform_shape (WaveformShape shape)
|
||||
if (arv)
|
||||
arv->set_waveform_shape (shape);
|
||||
}
|
||||
_waveform_shape = shape;
|
||||
}
|
||||
|
||||
WaveformShape
|
||||
AudioStreamView::get_waveform_shape () const
|
||||
{
|
||||
// assumes that the first represents all for our purposes
|
||||
|
||||
if (region_views.size() > 0) {
|
||||
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(region_views.front());
|
||||
if (arv) {
|
||||
if (arv->waveform_rectified())
|
||||
return Rectified;
|
||||
}
|
||||
}
|
||||
return Traditional;
|
||||
}
|
||||
|
||||
void
|
||||
AudioStreamView::set_waveform_scale (WaveformScale scale)
|
||||
{
|
||||
for (RegionViewList::iterator i = region_views.begin(); i != region_views.end(); ++i) {
|
||||
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
|
||||
if (arv)
|
||||
if (arv)
|
||||
arv->set_waveform_scale (scale);
|
||||
}
|
||||
_waveform_scale = scale;
|
||||
}
|
||||
|
||||
WaveformScale
|
||||
AudioStreamView::get_waveform_scale () const
|
||||
{
|
||||
// assumes that the first represents all for our purposes
|
||||
|
||||
if (region_views.size() > 0) {
|
||||
AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(region_views.front());
|
||||
if (arv) {
|
||||
if (arv->waveform_logscaled())
|
||||
return LogWaveform;
|
||||
}
|
||||
}
|
||||
return LinearWaveform;
|
||||
}
|
||||
|
||||
void
|
||||
AudioStreamView::setup_rec_box ()
|
||||
{
|
||||
|
||||
@@ -59,9 +59,9 @@ class AudioStreamView : public StreamView
|
||||
~AudioStreamView ();
|
||||
|
||||
void set_waveform_shape (WaveformShape);
|
||||
WaveformShape get_waveform_shape () const;
|
||||
WaveformShape get_waveform_shape () const { return _waveform_shape; }
|
||||
void set_waveform_scale (WaveformScale);
|
||||
WaveformScale get_waveform_scale () const;
|
||||
WaveformScale get_waveform_scale () const { return _waveform_scale; }
|
||||
|
||||
int set_height (gdouble h);
|
||||
int set_samples_per_unit (gdouble spp);
|
||||
@@ -108,7 +108,9 @@ class AudioStreamView : public StreamView
|
||||
list<sigc::connection> peak_ready_connections;
|
||||
nframes_t last_rec_peak_frame;
|
||||
map<boost::shared_ptr<ARDOUR::Source>, bool> rec_peak_ready_map;
|
||||
|
||||
|
||||
WaveformShape _waveform_shape;
|
||||
WaveformScale _waveform_scale;
|
||||
};
|
||||
|
||||
#endif /* __ardour_audio_streamview_h__ */
|
||||
|
||||
Reference in New Issue
Block a user