13
0

merge new symmetric curve from mixbus, fix errors in fade out slow curve, tweak display of xfades so that the non-upper-fade is slightly less dominant (alpha)

git-svn-id: svn://localhost/ardour2/branches/3.0@12384 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-05-22 21:23:22 +00:00
parent 930f9a34c1
commit f9030dd220
2 changed files with 39 additions and 30 deletions

View File

@ -1568,7 +1568,8 @@ AudioRegionView::redraw_start_xfade_to (boost::shared_ptr<AudioRegion> ar, frame
if (!start_xfade_out) { if (!start_xfade_out) {
start_xfade_out = new ArdourCanvas::Line (*group); start_xfade_out = new ArdourCanvas::Line (*group);
start_xfade_out->property_width_pixels() = 1; start_xfade_out->property_width_pixels() = 1;
start_xfade_out->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GainLine.get(); uint32_t col = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 125);
start_xfade_out->property_fill_color_rgba() = col;
} }
if (!start_xfade_rect) { if (!start_xfade_rect) {
@ -1673,7 +1674,8 @@ AudioRegionView::redraw_end_xfade_to (boost::shared_ptr<AudioRegion> ar, framecn
if (!end_xfade_out) { if (!end_xfade_out) {
end_xfade_out = new ArdourCanvas::Line (*group); end_xfade_out = new ArdourCanvas::Line (*group);
end_xfade_out->property_width_pixels() = 1; end_xfade_out->property_width_pixels() = 1;
end_xfade_out->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_GainLine.get(); uint32_t col UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_GainLine.get(), 125);
end_xfade_out->property_fill_color_rgba() = col;
} }
if (!end_xfade_rect) { if (!end_xfade_rect) {

View File

@ -106,6 +106,7 @@ generate_inverse_coefficient_curve (boost::shared_ptr<Evoral::ControlList> dst,
static void static void
generate_db_fade (boost::shared_ptr<Evoral::ControlList> dst, double len, int num_steps, float dB_drop) generate_db_fade (boost::shared_ptr<Evoral::ControlList> dst, double len, int num_steps, float dB_drop)
{ {
dst->clear ();
dst->fast_simple_add (0, 1); dst->fast_simple_add (0, 1);
//generate a fade-out curve by successively applying a gain drop //generate a fade-out curve by successively applying a gain drop
@ -1019,6 +1020,8 @@ AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
generate_db_fade (c1, len, 10, -1); // start off with a slow fade generate_db_fade (c1, len, 10, -1); // start off with a slow fade
generate_db_fade (c2, len, 10, -80); // end with a fast fade generate_db_fade (c2, len, 10, -80); // end with a fast fade
merge_curves (_fade_in, c1, c2); merge_curves (_fade_in, c1, c2);
reverse_curve (c3, _fade_in);
_fade_in->copy_events (*c3);
generate_inverse_power_curve (_inverse_fade_in, _fade_in); generate_inverse_power_curve (_inverse_fade_in, _fade_in);
break; break;
@ -1032,20 +1035,22 @@ AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
break; break;
case FadeSymmetric: case FadeSymmetric:
// starts kind of like a constant power but has a slower fadeout //start with a nearly linear cuve
// however it is NOT constant power and there will be a level drop in the middle of the crossfade _fade_in->fast_simple_add (0, 1);
c1->fast_simple_add (0.0, 1.0); _fade_in->fast_simple_add (0.5*len, 0.6);
for ( int i = 1; i < 9; i++ ) { //now generate a fade-out curve by successively applying a gain drop
float dist = (float)i/10.0; const float breakpoint = 0.7; //linear for first 70%
c1->fast_simple_add ((len * dist), cos(dist*M_PI/10.0)); const int num_steps = 9;
for (int i = 2; i < num_steps; i++) {
float coeff = (1.0-breakpoint);
for (int j = 0; j < i; j++) {
coeff *= 0.5; //6dB drop per step
} }
c1->fast_simple_add (len, VERY_SMALL_SIGNAL); _fade_in->fast_simple_add (len* (breakpoint+((1.0-breakpoint)*(double)i/(double)num_steps)), coeff);
}
//curve 2 is a slow fade at end _fade_in->fast_simple_add (len, VERY_SMALL_SIGNAL);
generate_db_fade (c2, len, 10, -30 ); reverse_curve (c3, _fade_in);
_fade_in->copy_events (*c3);
merge_curves (c3, c1, c2);
reverse_curve (_fade_in, c3);
reverse_curve (_inverse_fade_in, _fade_in ); reverse_curve (_inverse_fade_in, _fade_in );
break; break;
} }
@ -1108,19 +1113,21 @@ AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
break; break;
case FadeSymmetric: case FadeSymmetric:
//starts kind of like a constant power but has a slower fadeout //start with a nearly linear cuve
//however it is NOT constant power and there will be a level drop in the middle of the crossfade _fade_out->fast_simple_add (0, 1);
c1->fast_simple_add (0.0, 1.0); _fade_out->fast_simple_add (0.5*len, 0.6);
for ( int i = 1; i < 9; i++ ) {
float dist = (float)i/10.0; //now generate a fade-out curve by successively applying a gain drop
c1->fast_simple_add ((len * dist), cos(dist*M_PI/10.0)); //cheesy way of making a flat line const float breakpoint = 0.7; //linear for first 70%
const int num_steps = 9;
for (int i = 2; i < num_steps; i++) {
float coeff = (1.0-breakpoint);
for (int j = 0; j < i; j++) {
coeff *= 0.5; //6dB drop per step
} }
c1->fast_simple_add (len, VERY_SMALL_SIGNAL); _fade_out->fast_simple_add (len* (breakpoint+((1.0-breakpoint)*(double)i/(double)num_steps)), coeff);
}
//curve 2 is a slow fade at end _fade_out->fast_simple_add (len, VERY_SMALL_SIGNAL);
generate_db_fade (c2, len, 10, -30);
merge_curves (_fade_out, c1, c2);
reverse_curve (_inverse_fade_out, _fade_out); reverse_curve (_inverse_fade_out, _fade_out);
break; break;
} }