This plugin processes the first bar object (note, text, line, etc.) in a passage selection, or each bar object in a non-passage selection. It gets the time signature and current tempo in beats per minute, figures out the size of the beat under the current time signature, and adds a formatted metronome mark at the location of the selected object.
If there is an existing tempo or mm text at the location where the plugin wants to write its text, it will ask you to replace the existing text or skip writing a new text.
There is no dialog, and no options.
You can add a correct mm text anywhere in the score. As with manually added mm text, the text will not change automatically if you change the tempo elsewhere in the score. The tempo value is fixed when you create the text.
In this plugin, a plugin can access the current tempo at any location in beats per minute. It is great to have access to the tempo, but to make up an mm text I need to know the size of the beat.
I do this by getting the current time signature, figuring out if it is a compound meter, using some fairly strange rules that Sib appears to use (3/4 is simple, 3/8 is compound, some but not all other numerators divisible by 3 are compound, etc).
I figure out the size of the beat and make up a formatted string that says beat note = bpm.
My requirement in writing this plugin was to create an mm text that would cause correct playback tempo. I needed to match the beat size that the transport window uses. It appears to do that in all cases I have tested. It will not deal with tempo text like Allegro, or any variants of the beat size. A score in Sib 6 format to test with is attached. A screen shot of the results is attached to the following comment.