Strange Results for Accidental Style

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Strange Results for Accidental Style

Martin Marris

Getting strange results with the Note.AccidentalStyle variable, using this code:

 

score = Sibelius.ActiveScore;

staff = score.NthStaff(1);

for each b in staff

     {

     for each nr in b

           {

           for each n in nr

                {

                trace ("Visible " & n.IsAccidentalVisible);

                trace ("Style " & n.AccidentalStyle);

                trace ("Cautionary " & (n.AccidentalStyle = "CautionaryAcc"));

                trace ("");

                }

           }

     }

 

It is being tested on a score in C major, that contains only a series of quarternotes, all of them pitched as F. There are no accidentals.

 

When I run the code, the trace code correctly shows “false” for “is accidental visible.”

 

For “style” it returns “0” (zero) i.e. a “normal” accidental style.

 

So far, so good.

 

But the third trace line returns “true” for each note, i.e., “cautionary accidental” is true.

 

How can it be both “0” (normal accidental) and also “cautionary”? The numerical code for “cautionary” is “3” so why are we getting zeroes?

 

(I am running this in Sibelius 7.)

 

Martin

 


_______________________________________________
Plugin-dev mailing list
[hidden email]
http://avid-listsrv1.avid.com/mailman/listinfo/plugin-dev
Reply | Threaded
Open this post in threaded view
|

Re: Strange Results for Accidental Style

Bob Zawalich

trace ("Cautionary " & (n.AccidentalStyle = "CautionaryAcc"));

 

is wrong. The Reference defines:

 

Accidental styles

As used by Note.AccidentalStyle.

NormalAcc "0"

HiddenAcc "1"

CautionaryAcc "2"

BracketedAcc "3"

 

 

So if you use the global variables, like CautionaryAcc, do not put them in quotes.

 

(n.AccidentalStyle = CautionaryAcc)  or

(n.AccidentalStyle = “2”)

 

Should work, and note that CautionaryAcc is “2”, not “3”

 

Now I would expect that you would get False from your code, not true, since no legit value of n.AccidentalStyle should  equal “CautionaryAcc”.

 

But it is at least true that the =global variable names do not use quotes.

 

Bob

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Martin Marris
Sent: Wednesday, August 05, 2015 5:35 AM
To: 'A mailing list for Sibelius plug-in developers'
Subject: [Plugin-dev] Strange Results for Accidental Style

 

Getting strange results with the Note.AccidentalStyle variable, using this code:

 

score = Sibelius.ActiveScore;

staff = score.NthStaff(1);

for each b in staff

     {

     for each nr in b

           {

           for each n in nr

                {

                trace ("Visible " & n.IsAccidentalVisible);

                trace ("Style " & n.AccidentalStyle);

                trace ("Cautionary " & (n.AccidentalStyle = "CautionaryAcc"));

                trace ("");

                }

           }

     }

 

It is being tested on a score in C major, that contains only a series of quarternotes, all of them pitched as F. There are no accidentals.

 

When I run the code, the trace code correctly shows “false” for “is accidental visible.”

 

For “style” it returns “0” (zero) i.e. a “normal” accidental style.

 

So far, so good.

 

But the third trace line returns “true” for each note, i.e., “cautionary accidental” is true.

 

How can it be both “0” (normal accidental) and also “cautionary”? The numerical code for “cautionary” is “3” so why are we getting zeroes?

 

(I am running this in Sibelius 7.)

 

Martin

 


_______________________________________________
Plugin-dev mailing list
[hidden email]
http://avid-listsrv1.avid.com/mailman/listinfo/plugin-dev
Reply | Threaded
Open this post in threaded view
|

Re: Strange Results for Accidental Style

Martin Marris

Thanks Bob. I’m a bit embarrassed by the mistakes I made!

 

Am now making progress with a longer plugin that uses these variable….

 

Martin

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Bob Zawalich
Sent: Wednesday, August 05, 2015 11:34
To: 'A mailing list for Sibelius plug-in developers'
Subject: Re: [Plugin-dev] Strange Results for Accidental Style

 

trace ("Cautionary " & (n.AccidentalStyle = "CautionaryAcc"));

 

is wrong. The Reference defines:

 

Accidental styles

As used by Note.AccidentalStyle.

NormalAcc "0"

HiddenAcc "1"

CautionaryAcc "2"

BracketedAcc "3"

 

 

So if you use the global variables, like CautionaryAcc, do not put them in quotes.

 

(n.AccidentalStyle = CautionaryAcc)  or

(n.AccidentalStyle = “2”)

 

Should work, and note that CautionaryAcc is “2”, not “3”

 

Now I would expect that you would get False from your code, not true, since no legit value of n.AccidentalStyle should  equal “CautionaryAcc”.

 

But it is at least true that the =global variable names do not use quotes.

 

Bob

 

From: [hidden email] [[hidden email]] On Behalf Of Martin Marris
Sent: Wednesday, August 05, 2015 5:35 AM
To: 'A mailing list for Sibelius plug-in developers'
Subject: [Plugin-dev] Strange Results for Accidental Style

 

Getting strange results with the Note.AccidentalStyle variable, using this code:

 

score = Sibelius.ActiveScore;

staff = score.NthStaff(1);

for each b in staff

     {

     for each nr in b

           {

           for each n in nr

                {

                trace ("Visible " & n.IsAccidentalVisible);

                trace ("Style " & n.AccidentalStyle);

                trace ("Cautionary " & (n.AccidentalStyle = "CautionaryAcc"));

                trace ("");

                }

           }

     }

 

It is being tested on a score in C major, that contains only a series of quarternotes, all of them pitched as F. There are no accidentals.

 

When I run the code, the trace code correctly shows “false” for “is accidental visible.”

 

For “style” it returns “0” (zero) i.e. a “normal” accidental style.

 

So far, so good.

 

But the third trace line returns “true” for each note, i.e., “cautionary accidental” is true.

 

How can it be both “0” (normal accidental) and also “cautionary”? The numerical code for “cautionary” is “3” so why are we getting zeroes?

 

(I am running this in Sibelius 7.)

 

Martin

 


_______________________________________________
Plugin-dev mailing list
[hidden email]
http://avid-listsrv1.avid.com/mailman/listinfo/plugin-dev