Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

Cmd.Integrate.Merge

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

data MergeTitles Source #

Constructors

KeepTitles

leave the titles of merged tracks alone

ReplaceTitles

replace titles with the merge source

Instances

Instances details
Show MergeTitles Source # 
Instance details

Defined in Cmd.Integrate.Merge

Eq MergeTitles Source # 
Instance details

Defined in Cmd.Integrate.Merge

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.

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

Instances details
Show Edit Source # 
Instance details

Defined in Cmd.Integrate.Merge

Methods

showsPrec :: Int -> Edit -> ShowS #

show :: Edit -> String #

showList :: [Edit] -> ShowS #

Eq Edit Source # 
Instance details

Defined in Cmd.Integrate.Merge

Methods

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

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

Pretty.Pretty Edit Source # 
Instance details

Defined in Cmd.Integrate.Merge

data Modify Source #

Instances

Instances details
Show Modify Source # 
Instance details

Defined in Cmd.Integrate.Merge

Eq Modify Source # 
Instance details

Defined in Cmd.Integrate.Merge

Methods

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

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

Pretty.Pretty Modify Source # 
Instance details

Defined in Cmd.Integrate.Merge

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.