This Open Key thing is great, but can I have parentheses, please?
beaTunes 4 introduced the capability to easily copy key values to the comment field during analysis. Pretty handy, as it allows easy access to key values from applications that don't really support keys (e.g. iTunes). Recently, I was told, that this works really well, but it would be even better to have parentheses around the Open Key code to better distinguish 2d
from 12d
when searching.
Thanks to the plugin API, there was a super simple solution to this: Just write a custom Key Text Renderer. The two needed classes, Key
and KeyTextRenderer
, are documented here and here.
And this is what the Groovy code looks like:
import com.tagtraum.audiokern.key.Key import com.tagtraum.beatunes.KeyTextRenderer class BracedOpenKey implements KeyTextRenderer { /** * Create a textual representation for a Key object. * * @param key key * @return textual representation */ def String toKeyString(Key key) { String openKeyCode = key.getOpenKeyCode() // create the final string return "($openKeyCode)" // <- this is where we add the parentheses! } /** * Create a tooltip representation for a key object. * This may also include html-tags. * * @param key key * @return tooltip representation */ def String toToolTip(Key key) { toKeyString(key) } /** * Short name of this renderer. To be used in the user interface. * * @return name */ def String getName() { "Braced OpenKey" } }
To install, just save it in a file called BracedOpenKey.groovy
and place it in the plugins folder. Upon restart, it will show up in the display format preferences and the export-as-comment option (see screenshot above).
Labels: beaTlet, Key, Plugin, TipsAndTricks
0 Comments:
Post a Comment
<< Home