Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone




Merge integrated tracks into existing, possibly hand-edited tracks, using the index of the previous integration to figure out which edits were made.

This proceeds in two steps: first the tracks are matched up. This takes advantage of the two-level (note, controls) hierarchy emitted by Cmd.Integrate.Convert, since each control track is uniquely identified by its title, it's safe to just match them up by title.

However, there's no key to match up the note tracks themselves, so it's done purely based on the order of the tracks. So if the integrate source emits more simultaneous notes and Convert puts them on appended tracks all will be well, but if it prepends a new track then the later tracks won't line up with the index. This will result in bogus diffs, or just events not being found at all and being considered hand-added.

TODO I'll have to see from experience if this is a problem, and if so, how it can be fixed.

Once tracks are matched, the events are diffed based on the Event.IndexKey.




merge_tracks :: Ui.M m => BlockId -> Convert.Tracks -> [Block.NoteDestination] -> m [Block.NoteDestination] Source #

Given a set of source Convert.Tracks and a set of previously integrated destination tracks, merge them together and give new destination tracks. A single integrating source track can create multiple Convert.Tracks, and an integrating track can have >=1 destinations, so this is called once per (source, destination) pair.

score_merge_tracks :: Ui.M m => BlockId -> TrackId -> Block.ScoreDestinations -> m Block.ScoreDestinations Source #

Update the given ScoreDestinations from the source block and track.

data Edit Source #


Add !Event.Event

This event was added, and will be copied to the output.

Edit !Event.IndexKey ![Modify]

This matched an existing event, which has possibly been modified, so I have to merge the new event while applying any modifications.

Eq Edit # 
Instance details

Defined in Cmd.Integrate.Merge


(==) :: Edit -> Edit -> Bool #

(/=) :: Edit -> Edit -> Bool #

Show Edit # 
Instance details

Defined in Cmd.Integrate.Merge


showsPrec :: Int -> Edit -> ShowS #

show :: Edit -> String #

showList :: [Edit] -> ShowS #

Pretty.Pretty Edit # 
Instance details

Defined in Cmd.Integrate.Merge

data Modify Source #

Eq Modify # 
Instance details

Defined in Cmd.Integrate.Merge


(==) :: Modify -> Modify -> Bool #

(/=) :: Modify -> Modify -> Bool #

Show Modify # 
Instance details

Defined in Cmd.Integrate.Merge

Pretty.Pretty Modify # 
Instance details

Defined in Cmd.Integrate.Merge


diff_events Source #


:: Block.EventIndex

results of last integrate

-> [Event.Event]

current events, which is last integrate plus user edits

-> (Set Event.IndexKey, [Edit])

set of deleted events, and edited events

Find out how to merge new integrated output with user edits by diffing it against the old integrated output.