Cross-Reference List of all Variables in a MT Pro Project

  • Q&A Forum
  • Cross-Reference List of all Variables in a MT Pro Project
0
0

A user of MIDI Translator Pro created a small utility to create a cross reference of all used variables in a MIDI Translator Pro project. It outputs two lists: 1) by variable in which translators the variable is used, and 2) by translator, which variables are used in a given translator.

Such functionality is planned for a future version of MIDI Translator Pro, but for now this utility might be useful for you.

Usage:
1) open the project file in MIDI Translator Pro
2) Use File|Export Project As Text to save the file as a text file
3) run the attached .exe file (a command line window appears)
4) from an explorer window, drag the exported .txt file to the command line. Press the BACKSPACE key 4 times to remove the .txt file extension, then ENTER
5) the program creates a file with appended name “-Liste Variables.txt” which contains the cross-reference

Note: the program is French, but it should be easy to use it with the instructions above.

Example output:

C:\Novation_Launchpad_Pong.txt
--------------------------------------

ORDRE ALPHABETIQUE DES VARIABLES
--------------------------------
Variable - Translator
i0 000.000
i0 002.008
i0 002.009
i1 000.000
i1 002.008
i1 002.009
i2 000.000
i2 002.008
i2 002.009
i3 000.000
i3 002.008
(...)
Nombre variables :  90 
  
ORDRE DES TRANSLATORS
---------------------
Translator - Variable
000.000 i0
000.000 i1
000.000 i2
000.000 i3
000.000 kc
000.000 ks
000.000 kt
000.000 lx
000.000 ly
001.018 pp
002.000 kg
002.001 kx
002.001 ky
002.001 lx
002.001 ly
002.003 kg
002.006 kr
002.007 ks
(...)

Note that the program is not foolproof and provided to you without warranty of any kind. Bome Software has not created this program and merely makes it available as a courtesy.

Attachments:
Marked as spam
Posted by (Q&A Forum: 6, Answers: 308)
February 5, 2018 2:52 pm
76 views

Nice,

I might try this sometime if I get a large file from someone else that is not well documented. Usually I don’t need to do this for my project files as I document all of my variables. I usually document all global variable in a preset I call “Init” with translator “Init Global Variables”. For local variables I document them within each translator. In addition to initializing them I put in comments prior to the initialization, what each is for: example

//fader 1 target
g1=0
// fader 1 current postion
ga=0
// fader 1 timer running statuts
ha=0
// precision
ia=3

( at February 5, 2018 4:22 pm)
0
Private answer

I just updated my awk file that captures all global variables (hopefully I covered all cases)

It is attached below

# bmt.awk
# Document all Global Variables in a Bome BMT Project File
# By Steven J. Caldwell 11-Feb-2018
# please send any corrections to the author
# bome@sniz.biz
# Steps
# 1) Eport your project into a text file
# 2) Run the following command
# $awk -f bmt.awk filename | sort -t: -k 1 -n | uniq > outputfile
# Caputures global variables only and saves to the output file
# Format of output file will look like this
# …data excluded above
# 26.3: Bank Select LSB – gb
# 26.3: Bank Select LSB – gd
# 26.3: Bank Select LSB – gf
# 26.3: Bank Select LSB – ha
# 26.3: Bank Select LSB – hb
# 26.3: Bank Select LSB – hc
# 314 Total Translators

 

 

Attachments:
Marked as spam
Posted by (Q&A Forum: 31, Answers: 2442)
February 11, 2018 5:46 pm
0
Private answer

I created a quick and dirty awk script that does something similar. Right now it seems to handles rules section pretty well but I have yet to figure out how to implement input and output.

I invoke it with the following *nix command

awk -f scriptfilename inputfilename | sort | uniq

Here is the script. Anyone, feel free to improve on it and re-publish/share.

Steve

bome@sniz.biz

Independent Bome Programming Specialist

Bome Q&A moderator

————–

 

BEGIN {IGNORECASE }
match($0, /([x].*)(Translator.*)/,a) {tr++; name[tr]=a[2] ;}
# I don’t think I need the below unless I want to print it
#/.*//.*/ {print}
match($0,/(.*)([g-z][a-z0-9])([=<>])/, a) {var=a[2]; var2[var,tr]++ }
#;printf(“%s:%s:%sn”,name[tr],var, var2[var,tr]) }
match($0,/([=<>])([g-z][a-z0-9])(.*)/,a) {var=a[2]; var2[var,tr]++ }
match($0,/(==)([g-z][a-z0-9])(.*)/,a) {var=a[2]; var2[var,tr]++ }
match($0,/(.*)([g-z][a-z0-9])(==)/, a) {var=a[2]; var2[var,tr]++ }
match($0,/(!=)([g-z][a-z0-9])(.*)/,a) {var=a[2]; var2[var,tr]++ }
match($0,/(.*)([g-z][a-z0-9])(!=)/, a) {var=a[2]; var2[var,tr]++ }
match($0,/(.*then.*)([g-z][a-z0-9])(=)/, a) {var=a[2]; var2[var,tr]++ }
match($0,/(.*then.*)(=)([g-z][a-z0-9])/,a) {var=a[3]; var2[var,tr]++ }
# The below matches input and output but still needs work. Commenting out for now
# First
#match($0,/(^Incoming[^’]*)(‘)([g-z][a-z0-9])(‘)/,a) {var=a[3]; var2[var,tr]++ }
# Need to figure out if any others might need to iterate over the string
# Last
#match($0,/(^Incoming.*)(‘)([g-z][a-z0-9])(‘)/,a) {var=a[3]; var2[var,tr]++ }
# First
#match($0,/(^Outgoing: MIDI[^s]*)(s)([g-z][a-z0-9])(s)/,a) {var=a[3]; var2[var,tr]++ }
# Last
#match($0,/(^Outgoing: MIDI.*)(s)([g-z][a-z0-9])(s)/,a) {var=a[3]; var2[var,tr]++ }
END {
for (y in var2)
{
z = substr(y,3,length(y))
b = substr(y,4)
#print b,
print name[b], substr(y,1,2)
}
#for (x=1; x<=tr ; x++)
#print x ,” “name[x]
#print tr ” Total Translators”
}

 

Marked as spam
Posted by (Q&A Forum: 31, Answers: 2442)
February 6, 2018 7:58 pm
Votes
Answers
Topic
1
vote
4
answers
asked 6 days ago by
updated 5 days ago by
0
votes
2
answers
asked 2 weeks ago by
updated 2 weeks ago by
0
votes
3
answers
asked 1 month ago by
updated 1 month ago by
0
votes
2
answers
asked 3 months ago by
updated 1 month ago by
1 2 3 5