mirror of
				https://github.com/vsariola/sointu.git
				synced 2025-10-31 07:54:26 -04:00 
			
		
		
		
	fix(tracker): when reassigning unit IDs, update send targets. fixes instrument loading
This commit is contained in:
		
						parent
						
							cd700ed954
						
					
				
				
					commit
					9efddd673d
				
			| @ -1267,9 +1267,13 @@ func (m *Model) freeUnitIDs(units []sointu.Unit) { | ||||
| } | ||||
|  | ||||
| func (m *Model) assignUnitIDs(units []sointu.Unit) { | ||||
| 	rewrites := map[int]int{} | ||||
| 	for i := range units { | ||||
| 		if units[i].ID == 0 || m.usedIDs[units[i].ID] { | ||||
| 		if id := units[i].ID; id == 0 || m.usedIDs[id] { | ||||
| 			m.maxID++ | ||||
| 			if id > 0 { | ||||
| 				rewrites[id] = m.maxID | ||||
| 			} | ||||
| 			units[i].ID = m.maxID | ||||
| 		} | ||||
| 		m.usedIDs[units[i].ID] = true | ||||
| @ -1277,6 +1281,13 @@ func (m *Model) assignUnitIDs(units []sointu.Unit) { | ||||
| 			m.maxID = units[i].ID | ||||
| 		} | ||||
| 	} | ||||
| 	for i, u := range units { | ||||
| 		if target, ok := u.Parameters["target"]; u.Type == "send" && ok { | ||||
| 			if newId, ok := rewrites[target]; ok { | ||||
| 				units[i].Parameters["target"] = newId | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (m *Model) computePatternUseCounts() { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user