Quantcast

Measure::endBarLineType() deleted, now it's in Segment?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Measure::endBarLineType() deleted, now it's in Segment?

sideways
2.0.3 measure.h line 265:
https://github.com/musescore/MuseScore/blob/2.0.3/libmscore/measure.h#L265

In the new master I cannot query a Measure for its end barline type.  I
see that I can do it by segment, but does that mean that I must now
iterate over all the segments in the Measure simply to get the end
barline type?  Or can I look in the first or last segment? I guess I'm
about to find out... but I did want to raise the issue somewhere so
there can be a recommended way to update 3rd party code (like mine).

Thanks,

Sideways

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Measure::endBarLineType() deleted, now it's in Segment?

sideways
Measure::first() == the begin barline segment
Measure::last() == the end barline segment

Here is sample code of mine before and after:

Measure* mp;

BEFORE
:
if (mp->endBarLineType() == BarLineType::DOUBLE) {

AFTER
: 
if (mp->last()->isEndBarLineType()
           && static_cast<BarLine*>(mp->last()->element(0))->barLineType() == BarLineType::DOUBLE) {

Yea, it's a bit more complex, but it seems to work.
  • The element(0) is to get the segment's first track (4 tracks/voices per staff).
  • I do the check for isEndBarLineType() just to be safe.  If I can count on the last segment of every measure being the end barline element in track zero, then that check is not necessary.
Other than that, I think the sample code tells it better than anything I can add here.

Let me know if there's a better way to do it.

Thanks,

Sideways


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Measure::endBarLineType() deleted, now it's in Segment?

wschweer9
Two possible problems: mp->last() may not be the end barline segment and element(0) may not contain a barline.
For convenience i (re)added a Measure->endBarLineType() method which does the lookup.

Am 16.04.2016 um 21:48 schrieb Sideways Skullfinger:
Measure::first() == the begin barline segment
Measure::last() == the end barline segment

Here is sample code of mine before and after:

Measure* mp;

BEFORE
:
if (mp->endBarLineType() == BarLineType::DOUBLE) {

AFTER
: 
if (mp->last()->isEndBarLineType()
           && static_cast<BarLine*>(mp->last()->element(0))->barLineType() == BarLineType::DOUBLE) {

Yea, it's a bit more complex, but it seems to work.
  • The element(0) is to get the segment's first track (4 tracks/voices per staff).
  • I do the check for isEndBarLineType() just to be safe.  If I can count on the last segment of every measure being the end barline element in track zero, then that check is not necessary.
Other than that, I think the sample code tells it better than anything I can add here.

Let me know if there's a better way to do it.

Thanks,

Sideways


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Measure::endBarLineType() deleted, now it's in Segment?

sideways
Thanks!  That's why I posted this and raised those exact issues.

--
Sideways


On 4/18/2016 1:54 AM, Werner Schweer wrote:
Two possible problems: mp->last() may not be the end barline segment and element(0) may not contain a barline.
For convenience i (re)added a Measure->endBarLineType() method which does the lookup.

Am 16.04.2016 um 21:48 schrieb Sideways Skullfinger:
Measure::first() == the begin barline segment
Measure::last() == the end barline segment

Here is sample code of mine before and after:

Measure* mp;

BEFORE
:
if (mp->endBarLineType() == BarLineType::DOUBLE) {

AFTER
: 
if (mp->last()->isEndBarLineType()
           && static_cast<BarLine*>(mp->last()->element(0))->barLineType() == BarLineType::DOUBLE) {

Yea, it's a bit more complex, but it seems to work.
  • The element(0) is to get the segment's first track (4 tracks/voices per staff).
  • I do the check for isEndBarLineType() just to be safe.  If I can count on the last segment of every measure being the end barline element in track zero, then that check is not necessary.
Other than that, I think the sample code tells it better than anything I can add here.

Let me know if there's a better way to do it.

Thanks,

Sideways



------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z


_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Mscore-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mscore-developer
Loading...