NoteWorthy Composer Forum

Forums => Tips & Tricks => Object Plugins => Topic started by: Lloyd on 2015-10-29 06:55 pm

Title: WingedRepeats.fso (version 1.5)
Post by: Lloyd on 2015-10-29 06:55 pm
This plugin draws winged Repeat Bars in the staff, just the same than Mike's (https://forum.noteworthycomposer.com/?topic=9264 (https://forum.noteworthycomposer.com/?topic=9264))

To start the plugin just insert an instance of the User Object at the beginning of the staff and it will automatically draw "wing" decorations to any Master Repeat Bar.

OPTIONS:

To start using this Object just copy the following clip and paste as a new file in NWC2.75.
Code: (nwc) [Select · Download]
!NoteWorthyComposer(2.75)
|AddStaff|Name:"Staff-1"|Group:"Standard"
|StaffProperties|EndingBar:Section Close|Visible:Y|BoundaryTop:12|BoundaryBottom:12|Lines:5|Color:Default
|StaffProperties|Muted:N|Volume:127|StereoPan:64|Device:0|Channel:1
|StaffInstrument|Trans:0|DynVel:10,30,45,60,75,92,108,127
|User|WingedRepeats.fso|Pos:1|Class:StaffSig
|Clef|Type:Treble
|TimeSig|Signature:4/4
|Bar|Style:MasterRepeatOpen
|Note|Dur:Half|Pos:1
|Note|Dur:Half|Pos:3
|Bar|Style:MasterRepeatClose
|Spacer|Width:50
|Bar|Style:MasterRepeatOpen
|Note|Dur:Half|Pos:3
|Note|Dur:Half|Pos:1
|Bar|Style:MasterRepeatClose
|Note|Dur:Half|Pos:1
|Note|Dur:Half|Pos:1
|AddStaff|Name:"Staff-2"|Group:"Standard"
|StaffProperties|EndingBar:Section Close|Visible:Y|BoundaryTop:10|BoundaryBottom:10|Lines:5|WithNextStaff:Brace,ConnectBars|Color:Default
|StaffProperties|Muted:N|Volume:127|StereoPan:64|Device:0|Channel:2
|StaffInstrument|Trans:0|DynVel:10,30,45,60,75,92,108,127
|User|WingedRepeats.fso|Pos:1|Class:StaffSig|System:"System: Upper Staff"
|Clef|Type:Treble
|TimeSig|Signature:4/4
|Bar|Style:MasterRepeatOpen
|Note|Dur:4th|Pos:1
|Note|Dur:4th|Pos:2
|Note|Dur:4th|Pos:3
|Note|Dur:4th|Pos:4
|Bar|Style:MasterRepeatClose
|Spacer|Width:50
|Bar|Style:MasterRepeatOpen
|Note|Dur:4th|Pos:4
|Note|Dur:4th|Pos:3
|Note|Dur:4th|Pos:2
|Note|Dur:4th|Pos:1
|Bar|Style:MasterRepeatClose
|Note|Dur:4th|Pos:1
|Note|Dur:4th|Pos:1
|Note|Dur:4th|Pos:1
|Note|Dur:4th|Pos:1
|AddStaff|Name:"Staff-3"|Group:"Standard"
|StaffProperties|EndingBar:Section Close|Visible:Y|BoundaryTop:10|BoundaryBottom:10|Lines:5|Color:Default
|StaffProperties|Muted:N|Volume:127|StereoPan:64|Device:0|Channel:3
|StaffInstrument|Trans:0|DynVel:10,30,45,60,75,92,108,127
|User|WingedRepeats.fso|Pos:1|Class:StaffSig|System:"System: Lower Staff"
|Clef|Type:Bass
|TimeSig|Signature:4/4
|Bar|Style:MasterRepeatOpen
|Note|Dur:4th|Pos:-1|Opts:Stem=Down
|Note|Dur:4th|Pos:0
|Note|Dur:4th|Pos:1
|Note|Dur:4th|Pos:2
|Bar|Style:MasterRepeatClose
|Spacer|Width:50
|Bar|Style:MasterRepeatOpen
|Note|Dur:4th|Pos:2
|Note|Dur:4th|Pos:1
|Note|Dur:4th|Pos:0
|Note|Dur:4th|Pos:-1|Opts:Stem=Down
|Bar|Style:MasterRepeatClose
|Note|Dur:4th|Pos:-1
|Note|Dur:4th|Pos:-1
|Note|Dur:4th|Pos:-1
|Note|Dur:4th|Pos:-1
!NoteWorthyComposer-End

Title: Re: WingedRepeats.fso (version 1.0)
Post by: Lloyd on 2015-10-29 08:16 pm
Thanks Mike, your version looks very good to mee, I specially like smooth edges on your wings.

Looking at both codes I think we get the same solution for the same question, and of course with the same limitations (the need of a spacer between close-open bars and, as you said in yours, missing wings to a Master Repeat Close Ending Bar).

I don't see the need of pulling down your version. I think that if there's more options it will be better for users, don't you think?  ;)
Title: Re: WingedRepeats.fso (version 1.0)
Post by: Lawrie Pardy on 2015-10-29 11:42 pm
Lloyd, Mike - you guys are amazing - I love these objects :D :D :D

Thank you both so much!
Title: Re: WingedRepeats.fso (version 1.0)
Post by: Lawrie Pardy on 2015-10-30 03:51 am
Hi Lloyd,
I'm just doing some testing, and I've run into a small issue...

In copying your object from staff to staff in preparation for score preparation I've run into the error:
Quote
Execution limit exceeded.
The 'WingedRepeats.fso' object plugin has been suspended

It seems to happen when there are no repeats on a staff but it isn't predictable.  E.G. I had inserted it onto the right hand of a grand staff, then copied it to the left hand - no repeats existed in either location - and after the copy I got the suspension message.

Another time I inserted it onto a staff, the copied it to several others, none with any repeats yet, and the error occurred after the 4th or 5th paste.  A score refresh will clear the error if there are repeats for it to work on.
Title: Re: WingedRepeats.fso (version 1.0)
Post by: Lawrie Pardy on 2015-10-30 04:57 am
Hi Lloyd,
Just found another buglet:
CORRECTION
When an ending repeat is flagged to force a system break appears at the end of a staff, the wings appear in the editor, but not in print preview nor on the printed page for that repeat sign.

Placing a normal barline immediately after the repeat barline and moving the system break to it resolves the visual problem even if the barline is set to visibility never, but I don't think this workaround should be necessary.
Title: Re: WingedRepeats.fso (version 1.0)
Post by: Lloyd on 2015-10-30 07:09 am
Thanks for reporting bugs  ;)
Gonna work for solving them, so wait for a little time.
Title: Re: WingedRepeats.fso (version 1.2)
Post by: Lloyd on 2015-10-30 08:44 am
Object updated to version 1.2
It tries to correct some bug fixes (thanks Lawrie) and now supports staff ending bars when they are set to Master Repeat Close (thanks Mike).
It also hides wings on hidden repeat bars and tries to solve the problems when Repeat Close and Repeat Open bars are found together.

Please hardly test it to ensure there's no bugs on the new functions, thanks.


Lawrie, please let me know if the bugs you found are solved. If not, then paste an nwctxt clip with an example of the errors, thanks  :D
Title: Re: WingedRepeats.fso (version 1.2)
Post by: Lawrie Pardy on 2015-10-30 01:43 pm
Hi Lloyd,
just did a quick test and it looks OK.  Will know more the next time I need to use it "in anger" but for now it seems like a winner :)

Adjacent repeat bars seem to work fine.
Title: Re: WingedRepeats.fso (version 1.2)
Post by: Lloyd on 2015-10-30 01:56 pm
Thanks a lot  :D if someone find more bugs, please report.
Title: Re: WingedRepeats.fso (version 1.2)
Post by: melismata on 2015-11-12 06:42 pm
I am finding some problems with this otherwise excellent object.

After executing a "print preview" on a piece of music that has this object running, I get two error messages (see attached) - "Execution limit exceeded" followed by "The WingedRepeats.fso object plugin has been suspended".  The wings disappear from the score.  The only way to recover the winged version of the score is to exit nwc and restart the program and load the file afresh.

Is this a bug or am I doing something wrong ?

Title: Re: WingedRepeats.fso (version 1.2)
Post by: Lloyd on 2015-11-12 07:12 pm
Hi melismata,
Quote
Is this a bug or am I doing something wrong ?
Both must be posible... since I'm very bad with script programing it can be a bug, of course (I'm almost sure it will be...), but I cannot solve it unless you upload your score, or a NWC text clip with the staff with the error to this post. So please, upload it and I'll review it. If there's a bug in the plugin script I'll update as soon as I can  ;)
Title: Re: WingedRepeats.fso (version 1.2)
Post by: Mike Shawaluk on 2015-11-12 07:59 pm
In my experience, the most common way for "execution limit exceed" to happen is if a plug-in manages to go into an infinite loop.  If you show a sample score that is causing the error, hopefully we can see what is happening.

Mike
Title: Re: WingedRepeats.fso (version 1.2)
Post by: NoteWorthy Online on 2015-11-12 08:21 pm
A simple suggestion that might help safeguard your plug-in code. Change your repeat to guard against passing last bar, or exceeding your xLast calculation:

Code: (lua) [Select · Download]
repeat
if not NextBar:find('next', 'bar') then break end
...
until x >= xLast

Note that LastBar:find('last') is not guaranteed to be a bar line.
Title: Re: WingedRepeats.fso (version 1.2)
Post by: Lloyd on 2015-11-13 07:46 am
Thanks for the suggestion, this will solve infinite loop problems, but since the last version, I've been making changes to the code (I've been trying to add a non-staffsig function) so the bug that causes this error might be already fixed, that's because I think it would be better if melismata shows a sample score (as Mike said). Anyway I will add this line to the code, thanks ;D .

Quote
Note that LastBar:find('last') is not guaranteed to be a bar line.
I thought that find('last') would always find a barline (the "ending bar" in edit view or the bar with "system break" in print preview)
Was I wrong?
Title: Re: WingedRepeats.fso (version 1.2)
Post by: NoteWorthy Online on 2015-11-13 11:20 am

My recommendation: Do not assume that this will always be the case. It is a good practice to not make assumptions about what a plugin will find while indexing through notation positions.
Title: Re: WingedRepeats.fso (version 1.2)
Post by: Lloyd on 2015-11-13 07:12 pm
Thanks for your suggestion, I'll keep that in mind  :)
Title: Re: WingedRepeats.fso (version 1.5)
Post by: Lloyd on 2015-11-17 06:20 pm
Object updated.
The object now has a function for drawing wings "only once" by setting object's class to 'Standard'. The script has been reviewed for fixing bugs.

If there's some other (or new) bugs, please report.
Title: Re: WingedRepeats.fso (version 1.5)
Post by: melismata on 2015-11-17 09:18 pm
Thanks Lloyd.

This fixed my "disappearing" wings after preview.  Now I can "fly" whenever I want to ...  ;D 

Melismata