Can someone please point me to a skeleton of how to create notes in an empty measure programmatically?
In my case I have the staff object (or pointer), and a parallel staff which has notes in it. I want to derive notes/chords in one staff based on notes from another staff.
Basically I'm looking for the model such as:
seg = addSegment(staff,tick);
track = getVoice(staff,0); // get the track number of voice 1 of the staff
chord = createChord(seg,track,tick,duration);
There are lots of ways of creating notes because the specifics depend on what information you are starting with. Like sometimes you have a pitch but don't know what note name it is or staff line to display it on; other times; other times you have a note name but don't know how to map it to a pitch or staff line; other times you have a staff line but don't know what note name or pitch it is; plus you may or may not already know the exact duration or may need to infer it from the toolbar or you may need to figure out how to break the note into multiple tied notes, etc. Also keep in mind, there is no such thing as an empty measure normally - they should have a full measure already. So part of the process of adding notes is normally deleting whatever was already there to make room for the note(s) you are adding, but the process for doing that may different for voice 1 versus other voices, also may differ depending on whether you can predict in advance how big a space you will need in total or whether you need to create the space one note at a time.
So there are lots of different fuinctions involved, and no one-size-fits-all solution.
But for one example of a very simple use case, see:
This is the handler for the "Fill with slashes" command, which fills a measure with quarter notes (marked as "slash" style, but they are created as normal notes first). See in particular the use of makeGapVoice() to create space one note at a time, and setNoteRest() to insert the note. I'm using noteValForPosition() to construct the parameters for the note because I start out knowing the line I want but not pitch or note name. That's probably not the case for you, though, so the process will be different.
On Tue, May 19, 2015 at 1:22 PM, Jim Newton <[hidden email]> wrote:
Can someone please point me to a skeleton of how to create notes in an empty
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
Mscore-developer mailing list
|Free forum by Nabble||Edit this page|