Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Safe HaskellNone

Cmd.Integrate.Merge

Contents

Description

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

merge

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 #

Constructors

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.

Instances

Eq Edit # 

Methods

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

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

Show Edit # 

Methods

showsPrec :: Int -> Edit -> ShowS #

show :: Edit -> String #

showList :: [Edit] -> ShowS #

Pretty.Pretty Edit # 

diff

diff_events Source #

Arguments

:: 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.

make_index :: [Event.Event] -> Block.EventIndex Source #

Create an index from integrated tracks. Since they are integrated, they should all have stacks, so events without stacks are discarded.

apply Source #

Arguments

:: Set Event.IndexKey

events that were deleted

-> [Edit] 
-> [Event.Event]

results of current integrate

-> Events.Events