Custom Macro in .xml file

This is a place for people to chare the custom macros they have written.

Moderator: Moderators

User avatar
Quidam
Posts: 102
Joined: 21 Nov 2012, 15:03
Location: Belgium

Custom Macro in .xml file

Postby Quidam » 15 Mar 2015, 04:12

Hello,

I was looking for a way to set a specific BPM speed to the a chase in one keypress.
I'm aware I can record a macro to do that but, unless there's a valid succession of keypresses I didn't find, the resulting macro will be related to the handle on which the chase is recorded and, thus, moving the chase will render my shortcut useless.
So I had a look at the macro xml file and, using the existing Xfade macros as a starting point, I wrote this :


Code: Select all

  <macro name="Chase BPM 0" id="Avolites.Macros.BPM0">
    <description>Set the speed of the connected chase to 0 BPM.</description>
    <sequence>
      <step>Chases.IncrementWheelParameter(0, -14.4)</step>
    </sequence>
  </macro>

Code: Select all

  <macro name="Chase BPM 60" id="Avolites.Macros.BPM60">
    <description>Set the speed of the connected chase to 60 BPM.</description>
    <sequence>
      <step>Chases.IncrementWheelParameter(0, -14.4)</step>
      <step pause="0.01">Chases.IncrementWheelParameter(0, 0.24)</step>
    </sequence>
  </macro>


Using the same logic, I made a few other macro (BPM 120, 240, BPM add/remove 10, add/remove 25...), paying attention to maintain the xml structure and give them distinctive macro name / id, without fancy characters.
I modified the xml file and tested it in my Titan sim. The new macros are available in the show library and everything seems to work as expected.

But I'm no specialist, so before using that custom file in my desks and sharing it with other users, I'd rather be sure :
Can you please confirm that I made no mistake and that, while I'll use this at my own risks, I guess, this should be fine ?

I also have a few other questions :

- In the brackets (0, -14.4), the '0' refers to to wheel that will be modified by the value '-14.4'. '0' stands for the first wheel, '1' would be the third. Were there be a parameter assigned to the second/middle wheel, should we use '2' ? Just curious...

- Regarding BPM macros, a 'double speed' and 'half the speed' would be very handy. One cannot use the above method to achieve this, however, as the +- value can't be replaced by an operation (i.e. ' *2 ').
Is there another way of achieving this ?

- Of course, custom macros are far more easier and safer to build using the record macro function in the software. However, at the moment we cannot use this for everything, as some specific actions aren't recorded - wheel and fader movement, for example. Factory provided macros show that there are some workarounds but, while the 'macro name and id/description/sequence/step/step...' structure is quite simple to grasp, we obviously miss more information about the xml elements we could use. Is there any chance this could be at least partially documented at some point ? Maybe in the 'Titan Tips and Tricks' section of this forum ?

Thanks,

Charles
User avatar
Gregory
Posts: 1300
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Custom Macro in .xml file

Postby Gregory » 15 Mar 2015, 10:31

I'm impressed, from a quick look over the macros look to be good. Note that the macros will not have the same effect if the display is set to seconds instead of BPM.

Regarding your questions:
  • The first parameter is the wheel index but based on the Pearl Expert so it is the first and second wheels. The command is specific to Chases so won't have any effect if other parameters are shown on the wheels.
  • The value supplied is based on those received from the hardware. Internally the value gets multiplied up before being added to the current value. It might be possible if we do a bit of maths first but I'll have to think about it.
  • I will pass on the point about providing more information about the scripts. The problem is at the moment they have no documentation apart from the source code which is connected to them. Also, although a lot of desk functions can be accessed through these scripts, they are often quite specific to what they were needed for in the software and therefore take odd parameters.

I feel it is a good idea to keep updating the macro library with new things, in fact about a month ago I added a few more that I hope that some people may find useful (you'll get them if you install the latest personality library). I'd be interested to know if there are other macros that people are after but bare in mind that it is not always possible with this script.
PeterM
Posts: 19
Joined: 27 May 2011, 18:50
Location: Belgium
Contact:

Re: Custom Macro in .xml file

Postby PeterM » 07 Dec 2015, 19:51

Can someone tell me where to place the midi.xml file on TigerTouch ?
On PcSuite (Titan Mobile / Simulator / Titan One) it is located in C:\Program Files (x86)\Avolites\Titan\Macros
User avatar
niclights
The eManual
Posts: 4442
Joined: 24 Sep 2004, 01:06
Location: UK

Re: Custom Macro in .xml file

Postby niclights » 07 Dec 2015, 20:43

The Macros folder on TT is D:\TitanData\MacroLibrary. This is hidden by default.
PeterM
Posts: 19
Joined: 27 May 2011, 18:50
Location: Belgium
Contact:

Re: Custom Macro in .xml file

Postby PeterM » 07 Dec 2015, 20:47

found it in another post on the forum : 'save it to d:\TitanData\Macros\MidiMacros.xml'
User avatar
Gregory
Posts: 1300
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Custom Macro in .xml file

Postby Gregory » 13 Feb 2016, 00:43

If you are interested this is what I came up for doubling and halving chase BPM:

Code: Select all

  <macro name="Chase Speed Double" id="Avolites.Macros.ChaseSpeedDouble">
    <description>Double the speed of the currently connected chase.</description>
    <sequence>
      <step>ActionScript.SetProperty("Handles.SourceHandle", Playbacks.Editor.SelectedPlayback)</step>
      <step>ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", Chases.ConnectedHandle)</step>
      <step>Math.Min("Playbacks.Editor.Times.ChaseSpeed", Playbacks.Editor.Times.ChaseSpeed * 2, 3600.0)</step>
      <step condition="Math.IsEqual(Playbacks.Editor.Times.ChaseSpeed, 0.0)">ActionScript.SetProperty.Float("Playbacks.Editor.Times.ChaseSpeed", 1.0)</step>
      <step>ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", Handles.SourceHandle)</step>
    </sequence>
  </macro>
 
  <macro name="Chase Speed Half" id="Avolites.Macros.ChaseSpeedHalf">
    <description>Halves the speed of the currently connected chase.</description>
    <sequence>
      <step>ActionScript.SetProperty("Handles.SourceHandle", Playbacks.Editor.SelectedPlayback)</step>
      <step>ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", Chases.ConnectedHandle)</step>
      <step>ActionScript.SetProperty.Float("Playbacks.Editor.Times.ChaseSpeed", Playbacks.Editor.Times.ChaseSpeed / 2)</step>
      <step condition="Math.IsLessThan(Playbacks.Editor.Times.ChaseSpeed, 1.0)">ActionScript.SetProperty.Float("Playbacks.Editor.Times.ChaseSpeed", 0.0)</step>
      <step>ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", Handles.SourceHandle)</step>
    </sequence>
  </macro>

The problem with this code is that it requires the chase to be set as the selected playback in the editor (used for the Edit Times menu). This means that the Playback View which could be showing a cue list switches to show the chase instead, to get around this I have stored the previous selected playback and restore that afterwards but this does cause the display to flicker.
icke_siegen
Posts: 1087
Joined: 02 Jul 2010, 10:29
Location: Siegen, Germany
Contact:

Re: Custom Macro in .xml file

Postby icke_siegen » 19 Mar 2016, 19:44

I might be totally wrong, but I think there is an error in this macro:

Gregory wrote:

Code: Select all

  <macro name="Chase Speed Double" id="Avolites.Macros.ChaseSpeedDouble">
    <description>Double the speed of the currently connected chase.</description>
    <sequence>
      <step>ActionScript.SetProperty("Handles.SourceHandle", Playbacks.Editor.SelectedPlayback)</step>
      <step>ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", Chases.ConnectedHandle)</step>
      <step>Math.Min("Playbacks.Editor.Times.ChaseSpeed", Playbacks.Editor.Times.ChaseSpeed * 2, 3600.0)</step>
      <step condition="Math.IsEqual(Playbacks.Editor.Times.ChaseSpeed, 0.0)">ActionScript.SetProperty.Float("Playbacks.Editor.Times.ChaseSpeed", 1.0)</step>
      <step>ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", Handles.SourceHandle)</step>
    </sequence>
  </macro>



To my mind the error is in step #3:

<step>Math.Min("Playbacks.Editor.Times.ChaseSpeed", Playbacks.Editor.Times.ChaseSpeed * 2, 3600.0)</step>

Instead it should read

Code: Select all

  <macro name="Chase Speed Double" id="Avolites.Macros.ChaseSpeedDouble">
    <description>Double the speed of the currently connected chase.</description>
    <sequence>
      <step>ActionScript.SetProperty("Handles.SourceHandle", Playbacks.Editor.SelectedPlayback)</step>
      <step>ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", Chases.ConnectedHandle)</step>
      <step>ActionScript.SetProperty.Float("Playbacks.Editor.Times.ChaseSpeed", Math.Min(Playbacks.Editor.Times.ChaseSpeed * 2, 3600.0))</step>
      <step condition="Math.IsEqual(Playbacks.Editor.Times.ChaseSpeed, 0.0)">ActionScript.SetProperty.Float("Playbacks.Editor.Times.ChaseSpeed", 1.0)</step>
      <step>ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", Handles.SourceHandle)</step>
    </sequence>
  </macro>


Or am I wrong?
User avatar
Gregory
Posts: 1300
Joined: 14 Dec 2007, 15:25
Location: London, United Kingdom
Contact:

Re: Custom Macro in .xml file

Postby Gregory » 19 Mar 2016, 20:11

I see where you are coming from and if we where writing these functions now that is probably the way it would be written. However it is only relatively recently that our ActionScript supported function chaining so before that it was not possible to return a value directly from one function as a parameter for another. Since the Min function is older it takes three parameters, the first being a string with the name of the property where the result should be stored. ActionScript along with the rest of Titan has evolved a lot over the years.
icke_siegen
Posts: 1087
Joined: 02 Jul 2010, 10:29
Location: Siegen, Germany
Contact:

Re: Custom Macro in .xml file

Postby icke_siegen » 20 Mar 2016, 10:31

Hi Gregory,

thanks a lot for this extensive answer!

Sebastian

Who is online

Users browsing this forum: No registered users and 15 guests