/// <summary> /// Cue level volume control. /// </summary> public void UndoableEditVolumeControl(ushort volumeBase, ushort randomRange) { if (SequenceRef == null) { return; } List <IUndoRedo> undos = CreateSequenceCommands(); ACB_CommandGroup commands = SequenceCommand; ACB_Command command = commands.Commands.FirstOrDefault(x => x.CommandType == CommandType.VolumeRandomization1 || x.CommandType == CommandType.VolumeRandomization2); if (command == null) { //No volume command exists, so create one command = new ACB_Command(CommandType.VolumeRandomization2); commands.Commands.Add(command); undos.Add(new UndoableListAdd <ACB_Command>(commands.Commands, command)); } if (command.CommandType == CommandType.VolumeRandomization1) { //Convert into VolumeRandomization2 command.CommandType = CommandType.VolumeRandomization2; command.Param2 = command.Param1; command.Param1 = 0; } undos.Add(new UndoableProperty <ACB_Command>("Param1", command, command.Param1, volumeBase)); undos.Add(new UndoableProperty <ACB_Command>("Param2", command, command.Param2, randomRange)); command.Param1 = volumeBase; command.Param2 = randomRange; UndoManager.Instance.AddUndo(new CompositeUndo(undos, "Volume Control")); }
private void InitValues(ACB_CommandGroup commandGroup, ACB_Command volumeCommand) { if (commandGroup != null && volumeCommand != null) { if (volumeCommand.CommandType == CommandType.VolumeRandomization1) { RandomRange = volumeCommand.Param1; BaseVolume = 0; } else { BaseVolume = volumeCommand.Param1; RandomRange = volumeCommand.Param2; } } else { //Default values BaseVolume = 100; RandomRange = 0; } //Some acbs have a sum slightly greater than 100 for some reason, but this set up wont like that so it needs to be fixed. if (baseVolume + randomRange > 100) { randomRange = (ushort)(100 - baseVolume); } _originalBaseVolume = baseVolume; _originalRandomRange = randomRange; }
public void UndoableEditVolumeBus(Guid stringGuid, ushort volume) { //Currently not used as a better method was discovered for volume control. May delete later. if (SequenceRef == null) { return; } List <IUndoRedo> undos = CreateSequenceCommands(); ACB_CommandGroup commands = SequenceCommand; ACB_Command command = commands.Commands.FirstOrDefault(x => x.CommandType == CommandType.VolumeBus); if (command == null) { //No volume command exists, so create one command = new ACB_Command(CommandType.VolumeBus); commands.Commands.Add(command); undos.Add(new UndoableListAdd <ACB_Command>(commands.Commands, command)); } undos.Add(new UndoableProperty <AcbTableReference>("TableGuid", command.ReferenceIndex, command.ReferenceIndex.TableGuid, stringGuid)); undos.Add(new UndoableProperty <ACB_Command>("Param2", command, command.Param2, volume)); command.Param2 = volume; command.ReferenceIndex.TableGuid = stringGuid; UndoManager.Instance.AddUndo(new CompositeUndo(undos, "Edit Volume")); }
public CopiedAction(ACB_Track action, ACB_CommandGroup command) { Track = action.Copy(); Commands = command.Copy(); //Generate new guids Track.InstanceGuid = Guid.NewGuid(); Commands.InstanceGuid = Guid.NewGuid(); Track.CommandIndex = new AcbTableReference(); Track.CommandIndex.TableGuid = Commands.InstanceGuid; }
/// <summary> /// Creates a command for the sequence if required (Sequence-type cues only). /// </summary> private List <IUndoRedo> CreateSequenceCommands() { List <IUndoRedo> undos = new List <IUndoRedo>(); ACB_CommandGroup commands = SequenceCommand; if (commands == null) { commands = new ACB_CommandGroup(); SequenceRef.CommandIndex.TableGuid = commands.InstanceGuid; undos.Add(new UndoableProperty <AcbTableReference>("TableGuid", SequenceRef.CommandIndex, Guid.Empty, SequenceRef.CommandIndex.TableGuid)); undos.AddRange(WrapperRoot.AcbFile.CommandTables.AddCommand(commands, CommandTableType.SequenceCommand)); } return(undos); }
/// <summary> /// Creates commands for this track if there are none already present. Note: this is the commands on the ACB_Track object itself, not any child objects. /// </summary> public List <IUndoRedo> CreateTrackCommands() { //Presently unused... List <IUndoRedo> undos = new List <IUndoRedo>(); ACB_CommandGroup commands = TrackCommand; if (TrackCommand == null) { commands = new ACB_CommandGroup(); TrackRef.CommandIndex.TableGuid = commands.InstanceGuid; undos.Add(new UndoableProperty <AcbTableReference>("TableGuid", TrackRef.CommandIndex, Guid.Empty, TrackRef.CommandIndex.TableGuid)); undos.AddRange(WrapperRoot.AcbFile.CommandTables.AddCommand(commands, CommandTableType.TrackCommand)); } return(undos); }
public void UndoableEditCueLimit(ushort cueLimit) { if (SequenceRef == null) { return; } //Might be worth seperating out all this duplicated code soon... List <IUndoRedo> undos = CreateSequenceCommands(); ACB_CommandGroup commands = SequenceCommand; ACB_Command command = commands.Commands.FirstOrDefault(x => x.CommandType == CommandType.CueLimit); if (command == null) { command = new ACB_Command(CommandType.CueLimit); commands.Commands.Add(command); undos.Add(new UndoableListAdd <ACB_Command>(commands.Commands, command)); } undos.Add(new UndoableProperty <ACB_Command>("Param1", command, command.Param1, cueLimit)); command.Param1 = cueLimit; UndoManager.Instance.AddUndo(new CompositeUndo(undos, "Cue Limit")); }