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; }
/// <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")); }
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 EditVolume(Window parent, Cue_Wrapper cue) { Owner = parent; DataContext = this; CueWrapper = cue; StringValues = cue.WrapperRoot.AcbFile.StringValues; var command = cue.SequenceCommand; ACB_Command volumeCommand = command?.Commands.FirstOrDefault(x => x.CommandType == CommandType.VolumeBus); if (command != null && volumeCommand != null) { StringValue = cue.WrapperRoot.AcbFile.GetTable(volumeCommand.ReferenceIndex.TableGuid, cue.WrapperRoot.AcbFile.StringValues, true); Volume = volumeCommand.Param2; } else { //Default values StringValue = (CueWrapper.WrapperRoot.AcbFile.StringValues.Count > 0) ? CueWrapper.WrapperRoot.AcbFile.StringValues[0] : null; Volume = 10000; } originalStringValue = StringValue; originalVolume = Volume; InitializeComponent(); }
public float GetBaseVolume() { ACB_Command volumeCommand = SequenceCommand?.Commands.FirstOrDefault(x => x.CommandType == CommandType.VolumeRandomization1 || x.CommandType == CommandType.VolumeRandomization2); if (volumeCommand == null) { return(1f); } return((volumeCommand.CommandType == CommandType.VolumeRandomization2) ? volumeCommand.Param1 / 100f : 0f); }
public float GetRandomVolume() { ACB_Command volumeCommand = TrackCommand?.Commands.FirstOrDefault(x => x.CommandType == CommandType.VolumeRandomization1 || x.CommandType == CommandType.VolumeRandomization2); if (volumeCommand == null) { return(0f); } return((volumeCommand.CommandType == CommandType.VolumeRandomization2) ? volumeCommand.Param2 / 100f : volumeCommand.Param1 / 100f); }
public VolumeControl(Window parent, Cue_Wrapper cue) { DataContext = this; CueWrapper = cue; var command = cue.SequenceCommand; ACB_Command volumeCommand = command?.Commands.FirstOrDefault(x => x.CommandType == CommandType.VolumeRandomization1 || x.CommandType == CommandType.VolumeRandomization2); InitValues(command, volumeCommand); InitializeComponent(); Title = "Volume (cue-level)"; Owner = parent; }
public VolumeControl(Window parent, Track_Wrapper track) { DataContext = this; TrackWrapper = track; var command = track.TrackCommand; ACB_Command volumeCommand = command?.Commands.FirstOrDefault(x => x.CommandType == CommandType.VolumeRandomization1 || x.CommandType == CommandType.VolumeRandomization2); InitValues(command, volumeCommand); InitializeComponent(); Title = "Volume (track-level)"; Owner = parent; }
private async void ActionCommandAdd() { var track = GetSelectedTrack(TrackType.ActionTrack); if (track != null) { var newCommand = new ACB_Command() { CommandType = CommandType.Null }; track.TrackCommand.Commands.Add(newCommand); UndoManager.Instance.AddUndo(new UndoableListAdd <ACB_Command>(track.TrackCommand.Commands, newCommand, "Add Action")); } }
public EditCueLimit(Window parent, Cue_Wrapper cue) { CueWrapper = cue; var command = cue.SequenceCommand; ACB_Command cueLimitCommand = command?.Commands.FirstOrDefault(x => x.CommandType == CommandType.CueLimit); if (cueLimitCommand != null) { CueLimit = cueLimitCommand.Param1; } originalCueLimit = CueLimit; InitializeComponent(); DataContext = this; Owner = parent; }
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")); }