Example
====== Playback - Set FX Multiplier ======
^ by: | Sebastian Beutel |
^ published: | April 2020 |
^ description: | Set a playback's Fx Multiplier |
^ remarks: | see also [[macros:example:setplaybackfadeintime|]] |
{{tag> playback fx multiplier }}
==== functions ====
* [[:macros:function:Handles.ClearSelection]]
* [[:macros:function:ActionScript.SetProperty.double]]
* [[:macros:function:Playbacks.Editor.EnsurePlaybackCueSelected]]
* [[:macros:function:math.cast.todouble|]]
==== affected properties ====
* [[:macros:property:Playbacks.Editor.SelectedPlayback]]
* [[:macros:property:Handles.SourceHandle]]
* [[:macros:property:Playbacks.Editor.Times.CueSpeedMultiplier]]
==== control structures ====
* [[macros:control_structures|step condition]]
===== Code =====
Handles.ClearSelection()
ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", null)
Handles.SetSourceHandle("PlaybackWindow", 0)
ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", Handles.SourceHandle)
Playbacks.Editor.EnsurePlaybackCueSelected()
ActionScript.SetProperty.Double("Playbacks.Editor.Times.CueSpeedMultiplier", Math.Cast.ToDouble(0.25))
Handles.SetSourceHandle("PlaybackWindow", 1)
ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", Handles.SourceHandle)
Playbacks.Editor.EnsurePlaybackCueSelected()
ActionScript.SetProperty.Double("Playbacks.Editor.Times.CueSpeedMultiplier", Math.Cast.ToDouble(0.25))
Handles.ClearSelection()
ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", null)
===== Explanation =====
This explains the functional steps within the sequence. For all the other XML details please refer to [[:macros:formats_and_syntax#xml_format|Formats and syntax]]
* The first and last two lines ''Handles.ClearSelection()'' and ''ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", null)'' make handle and playback selection empty so that no other handle/playback is affected by accident.
* ''Handles.SetSourceHandle("PlaybackWindow", 0)'' selects a playback as source handle
* '''': only if this is a cue playback handle (and not maybe a macro or group handle which would break the macro)...
* ... ''ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", Handles.SourceHandle)'' derive the playback from the given handle (the playback holds the time, not the handle)
* ''Playbacks.Editor.EnsurePlaybackCueSelected()'' is required for single-cue playbacks to make sure the cue itself is selected/in the editor
* ''ActionScript.SetProperty.Double("Playbacks.Editor.Times.CueSpeedMultiplier", Math.Cast.ToDouble(0.25))'' finally sets the multiplier to the desired value which needs to be a double, hence the value is cast with ''Math.Cast.ToDouble(0.25)''.
===== How to use it =====
* [[:macros:deploying|make this macro available]]
* while it's well possible to create some macros to set some playbacks to a given multiplier, it does make more sense to integrate this into a bigger context like [[macros:example:createworkspaces|]] in order to setup a known show environment.
~~DISCUSSION~~