Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Measure.rightBarline not being correctly set when appending bar.Repeat #1703

Open
ggsimao opened this issue Apr 17, 2024 · 1 comment
Open

Comments

@ggsimao
Copy link

ggsimao commented Apr 17, 2024

music21 version

9.1.0

Problem summary
When appending an object like bar.Repeat(direction="end") to a measure object, the barline attributes of that measure object aren't being correctly set.

Steps to reproduce

>>> m1 = stream.Measure()
>>> m2 = stream.Measure()
>>> repeat_b = bar.Repeat(direction="start")
>>> repeat_e = bar.Repeat(direction="end")
>>> m1.append(repeat_b)
>>> m1.leftBarline
<music21.bar.Repeat direction=start>
>>> m1.rightBarline
>>> m2.append(repeat_e)
>>> m2.rightBarline
>>> m2.leftBarline
<music21.bar.Repeat direction=end>
>>> r1 = note.Rest("whole")
>>> r2 = note.Rest("whole")
>>> m1 = stream.Measure()
>>> m2 = stream.Measure()
>>> m1.append(repeat_b)
>>> m1.append(r1)
>>> m2.append(r2)
>>> m2.append(repeat_e)
>>> m1.leftBarline
<music21.bar.Repeat direction=start>
>>> m1.rightBarline
>>> m2.rightBarline
>>> m2.leftBarline
>>> 

Expected vs. actual behavior
When appending a bar.Repeat object with direction=="end" to a measure, the rightBarline attribute should receive it as its value. Instead, it sets leftBarline sometimes and not rightBarline.

OS is Linux Mint 21.2. I'd fix it myself, but I can't find where the attributes are being set when appending the bar.Repeat object. If anyone can help in that regard, that would be much appreciated.

Edit: Apparently this is because Measure._getRightBarline() only checks for elements of _endElements, and I'm assuming append() doesn't modify this attribute. Not sure if this is the intended behavior.

@TimFelixBeyer
Copy link
Contributor

As a workaround you can try using storeAtEnd instead of append. I agree that append should probably be smarter about this though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants