[JW Lua] FCNoteentry methods...

Simon Leclerc simon at prodsl.ca
Wed Jun 22 03:20:25 CEST 2022


Thank you so much Robert for this very insightful answer. I’ll look into it having all that in mind.

Simon Leclerc
Composer, conductor, arranger

> Le 21 juin 2022 à 20:35, Robert Patterson <robert at robertgpatterson.com> a écrit :
> 
> 
> I'm fairly certain that these are calculated values provided by Finale so you don't have to constantly recalc them for yourself. (Same with the clef value on FCNoteEntry.) I don't really know why they are writable. That was done long before I got to the code base. Any new values you write will be retained for the life of the FCNoteEntry instance, but they will not be saved.
> 
> To copy TGTools Easy Tremolos you need to modify the Duration property and add an invisible tuplet. So, for example, to turn 2 consecutive quarters into a half-note tremolo with three beams, you would change the Duration of each note from QUARTER_NOTE to NOTE_32ND. Then you would add a new invisible tuplet to the first one that is 2 32nds in the time of 2 quarters. After the FCNoteEntry is saved, the next time you retrieve it the MeasurePos and ActualDuration properties will have been updated.
> 
> I don't at this moment recall how much Jari's documentation says about TGFs. The PDK Framework mostly hides them from Lua scripters, but it's a pretty important concept for working with note entries. Entries always come out of a TGF, which is an array of entries for a single layer in a single measure. To save an entry, you have to save the entire TGF. This can lead to possibly unexpected behavior, for example:
> 
> for e in eachentrysaved(region) do
>    e.Duration = e.Duration / 2
>    break
> end
> 
> This would appear to halve the first entry in a region, but in fact the entry won't be saved because you broke out of the loop. To save the entry, the loop *must complete*. (You can see for yourself how eachentrysaved works, because I've posted all the built-in iterator functions to the lua-source repository. Or you can fish it out of the jwlua binary for yourself, like I did originally.)
> 
> 
>> On Tue, Jun 21, 2022 at 6:53 PM Simon Leclerc <simon at prodsl.ca> wrote:
>> Hi to all,
>> 
>> Am I right to understand that the 2 FCNoteentry methods “SetMeasurePos” and “SetActualDuration” have no effect?
>> 
>> I’m working on a plugin that deals with tremolos between whole notes and it does not seem possible to modify those 2 parameters.
>> 
>> I analyzed the result of the TGTool plugin “Easy tremolos” and I can see that the 2 parameters have been changed and saved.
>> 
>> Is there another class that needs to be addressed to make it work?
>> 
>> 
>> 
>> 
>> 
>> ¯\_(ツ)_/¯
>> 
>> Simon Leclerc
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> JWLua mailing list
>> JWLua at jwmusic.nu
>> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20220621/2ab79b64/attachment-0001.html>


More information about the JWLua mailing list