@@ -229,7 +229,9 @@ local calc_layer_is_visible = function(staff, layer_number)
229
229
return staff .AltShowOtherNotes
230
230
end
231
231
232
- local hider_altnotation_types = {finale .ALTSTAFF_BLANKNOTATION , finale .ALTSTAFF_SLASHBEATS , finale .ALTSTAFF_ONEBARREPEAT , finale .ALTSTAFF_TWOBARREPEAT , finale .ALTSTAFF_BLANKNOTATIONRESTS }
232
+ local hider_altnotation_types = {
233
+ finale .ALTSTAFF_BLANKNOTATION , finale .ALTSTAFF_SLASHBEATS , finale .ALTSTAFF_ONEBARREPEAT , finale .ALTSTAFF_TWOBARREPEAT , finale .ALTSTAFF_BLANKNOTATIONRESTS ,
234
+ }
233
235
local altnotation_type = staff .AltNotationStyle
234
236
for _ , v in pairs (hider_altnotation_types ) do
235
237
if v == altnotation_type then
@@ -531,7 +533,9 @@ function tie.calc_placement(note, tie_mod, for_pageview, direction, tie_prefs)
531
533
end
532
534
end
533
535
local next_stemdir = direction == finale .TIEMODDIR_UNDER and - 1 or 1
534
- end_placement = calc_placement_for_endpoint (next_note , tie_mod , tie_prefs , direction , next_stemdir , true , next_note .NoteIndex , next_entry .Count , upstem2nd , next_note .Downstem2nd )
536
+ end_placement = calc_placement_for_endpoint (
537
+ next_note , tie_mod , tie_prefs , direction , next_stemdir , true , next_note .NoteIndex , next_entry .Count , upstem2nd ,
538
+ next_note .Downstem2nd )
535
539
end
536
540
end
537
541
end
@@ -711,6 +715,7 @@ Calculates the current contour index of a tie based on context and FCTiePrefs.
711
715
@ direction (number) one of the TIEMOD_DIRECTION values or nil (if you don't know it yet)
712
716
@ [tie_prefs] (FCTiePrefs) use these tie prefs if supplied
713
717
: (number) CONTOUR_INDEXES value for tie
718
+ : (number) calculated length of tie in EVPU
714
719
]]
715
720
function tie .calc_contour_index (note , tie_mod , for_pageview , direction , tie_prefs )
716
721
if not tie_prefs then
@@ -729,7 +734,7 @@ function tie.calc_contour_index(note, tie_mod, for_pageview, direction, tie_pref
729
734
elseif tie_length <= tie_contour_prefs :GetSpan (finale .TCONTOURIDX_SHORT ) then
730
735
return finale .TCONTOURIDX_SHORT
731
736
end
732
- return finale .TCONTOURIDX_MEDIUM
737
+ return finale .TCONTOURIDX_MEDIUM , tie_length
733
738
end
734
739
735
740
local calc_inset_and_height = function (tie_prefs , tie_contour_prefs , length , contour_index , get_fixed_func , get_relative_func , get_height_func )
@@ -739,18 +744,26 @@ local calc_inset_and_height = function(tie_prefs, tie_contour_prefs, length, con
739
744
local height = get_height_func (tie_contour_prefs , contour_index )
740
745
local inset = tie_prefs .FixedInsetStyle and get_fixed_func (tie_contour_prefs , contour_index ) or get_relative_func (tie_contour_prefs , contour_index )
741
746
if tie_prefs .UseInterpolation and contour_index == finale .TCONTOURIDX_MEDIUM then
742
- local interpolation_length , interepolation_percent
743
- if length <= tie_contour_prefs :GetSpan (finale .TCONTOURIDX_MEDIUM ) then
747
+ local interpolation_length , interpolation_percent , interpolation_height_diff , interpolation_inset_diff
748
+ if length < tie_contour_prefs :GetSpan (finale .TCONTOURIDX_MEDIUM ) then
744
749
interpolation_length = tie_contour_prefs :GetSpan (finale .TCONTOURIDX_MEDIUM ) - tie_contour_prefs :GetSpan (finale .TCONTOURIDX_SHORT )
745
- interpolation_percent = (tie_contour_prefs :GetSpan (finale .TCONTOURIDX_MEDIUM ) - length ) / interpolation_length
750
+ interpolation_percent = (interpolation_length - tie_contour_prefs :GetSpan (finale .TCONTOURIDX_MEDIUM ) + length ) / interpolation_length
751
+ interpolation_height_diff = get_height_func (tie_contour_prefs , finale .TCONTOURIDX_MEDIUM ) - get_height_func (tie_contour_prefs , finale .TCONTOURIDX_SHORT )
752
+ interpolation_inset_diff = get_relative_func (tie_contour_prefs , finale .TCONTOURIDX_MEDIUM ) - get_relative_func (tie_contour_prefs , finale .TCONTOURIDX_SHORT )
753
+ height = get_height_func (tie_contour_prefs , finale .TCONTOURIDX_SHORT )
754
+ if not tie_prefs .FixedInsetStyle then
755
+ inset = get_relative_func (tie_contour_prefs , finale .TCONTOURIDX_SHORT )
756
+ end
746
757
else
747
758
interpolation_length = tie_contour_prefs :GetSpan (finale .TCONTOURIDX_LONG ) - tie_contour_prefs :GetSpan (finale .TCONTOURIDX_MEDIUM )
748
- interpolation_percent = (tie_contour_prefs :GetSpan (finale .TCONTOURIDX_LONG ) - length ) / interpolation_length
749
- end
750
- height = height * interpolation_percent
751
- if not tie_prefs .FixedInsetStyle then
752
- inset = inset * interpolation_percent
759
+ interpolation_percent = (interpolation_length - tie_contour_prefs :GetSpan (finale .TCONTOURIDX_LONG ) + length ) / interpolation_length
760
+ interpolation_height_diff = get_height_func (tie_contour_prefs , finale .TCONTOURIDX_LONG ) - get_height_func (tie_contour_prefs , finale .TCONTOURIDX_MEDIUM )
761
+ interpolation_inset_diff = get_relative_func (tie_contour_prefs , finale .TCONTOURIDX_LONG ) - get_relative_func (tie_contour_prefs , finale .TCONTOURIDX_MEDIUM )
753
762
end
763
+ height = math.floor (0.5 + height + interpolation_height_diff * interpolation_percent )
764
+ if not tie_prefs .FixedInsetStyle then
765
+ inset = math.floor (0.5 + inset + interpolation_inset_diff * interpolation_percent )
766
+ end
754
767
end
755
768
return inset , height
756
769
end
@@ -759,15 +772,18 @@ end
759
772
% activate_contour
760
773
761
774
Activates the contour fields of the input tie_mod and initializes them with their
762
- default values. If the contour field are already activated, nothing is changed.
775
+ default values. If the contour fields are already activated, nothing is changed. Note
776
+ that for interpolated Medium span types, the interpolated values may not be identical
777
+ to those calculated by Finale, but they should be close enough to make no appreciable
778
+ visible difference.
763
779
764
780
@ note (FCNote) the note for which to return the tie direction.
765
781
@ tie_mod (FCTieMod) the tie mods for the note, if any.
766
782
@ for_pageview (bool) true if calculating for Page View, false for Scroll/Studio View
767
783
@ [tie_prefs] (FCTiePrefs) use these tie prefs if supplied
768
784
: (boolean) returns true if anything changed
769
785
]]
770
- function tie .activate_contour (note , tie_mod , for_pageview , tie_contour_index , tie_prefs )
786
+ function tie .activate_contour (note , tie_mod , for_pageview , tie_prefs )
771
787
if tie_mod :IsContourActive () then
772
788
return false
773
789
end
@@ -776,12 +792,14 @@ function tie.activate_contour(note, tie_mod, for_pageview, tie_contour_index, ti
776
792
tie_prefs :Load (0 )
777
793
end
778
794
local direction = tie .calc_direction (note , tie_mod , tie_prefs )
779
- local tie_contour_index = tie .calc_contour_index (note , tie_mod , for_pageview , direction , tie_prefs )
795
+ local tie_contour_index , length = tie .calc_contour_index (note , tie_mod , for_pageview , direction , tie_prefs )
780
796
local tie_contour_prefs = tie_prefs :CreateTieContourPrefs ()
781
- local left_height = tie_contour_prefs :GetLeftHeight (tie_contour_index )
782
- local left_inset = tie_prefs .FixedInsetStyle and tie_contour_prefs :GetLeftFixedInset (tie_contour_index ) or tie_contour_prefs :GetLeftRawRelativeInset (tie_contour_index )
783
- local right_height = tie_contour_prefs :GetRightHeight (tie_contour_index )
784
- local right_inset = tie_prefs .FixedInsetStyle and tie_contour_prefs :GetRightFixedInset (tie_contour_index ) or tie_contour_prefs :GetRightRawRelativeInset (tie_contour_index )
797
+ local left_inset , left_height = calc_inset_and_height (
798
+ tie_prefs , tie_contour_prefs , length , tie_contour_index , tie_contour_prefs .GetLeftFixedInset , tie_contour_prefs .GetLeftRawRelativeInset ,
799
+ tie_contour_prefs .GetLeftHeight )
800
+ local right_inset , right_height = calc_inset_and_height (
801
+ tie_prefs , tie_contour_prefs , length , tie_contour_index , tie_contour_prefs .GetRightFixedInset , tie_contour_prefs .GetRightRawRelativeInset ,
802
+ tie_contour_prefs .GetRightHeight )
785
803
tie_mod :ActivateContour (left_inset , left_height , right_inset , right_height , tie_prefs .FixedInsetStyle )
786
804
return true
787
805
end
0 commit comments