Safe Haskell | Safe-Inferred |
---|
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
.
Synopsis
- create_block :: Ui.M m => BlockId -> Convert.Tracks -> m (BlockId, [Block.NoteDestination])
- data MergeTitles
- merge_block :: Ui.M m => BlockId -> Convert.Tracks -> [Block.NoteDestination] -> m [Block.NoteDestination]
- score_merge_block :: Ui.M m => BlockId -> BlockId -> Block.ScoreDestinations -> m Block.ScoreDestinations
- merge_tracks :: Ui.M m => MergeTitles -> BlockId -> Convert.Tracks -> [Block.NoteDestination] -> m [Block.NoteDestination]
- score_merge_tracks :: Ui.M m => BlockId -> TrackId -> Block.ScoreDestinations -> m Block.ScoreDestinations
- data Edit
- = Add !Event.Event
- | Edit !Event.IndexKey ![Modify]
- data Modify
- is_modified :: Edit -> Bool
- diff_events :: Block.EventIndex -> [Event.Event] -> (Set Event.IndexKey, [Edit])
create
create_block :: Ui.M m => BlockId -> Convert.Tracks -> m (BlockId, [Block.NoteDestination]) Source #
merge
data MergeTitles Source #
KeepTitles | leave the titles of merged tracks alone |
ReplaceTitles | replace titles with the merge source |
Instances
Show MergeTitles Source # | |
Defined in Cmd.Integrate.Merge showsPrec :: Int -> MergeTitles -> ShowS # show :: MergeTitles -> String # showList :: [MergeTitles] -> ShowS # | |
Eq MergeTitles Source # | |
Defined in Cmd.Integrate.Merge (==) :: MergeTitles -> MergeTitles -> Bool # (/=) :: MergeTitles -> MergeTitles -> Bool # |
merge_block :: Ui.M m => BlockId -> Convert.Tracks -> [Block.NoteDestination] -> m [Block.NoteDestination] Source #
score_merge_block :: Ui.M m => BlockId -> BlockId -> Block.ScoreDestinations -> m Block.ScoreDestinations Source #
merge_tracks :: Ui.M m => MergeTitles -> 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.
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. |
is_modified :: Edit -> Bool Source #
diff
:: 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.