Interesting topic. A User Tool to modify volumes is not complicated once you get the correct input from the user. It occurs to me that Instrument Change Command is a near perfect user interface. So, I present this tool:
<?php // rg_DynVolMod.php ver 1.0
define('URL', 'http://my.noteworthysoftware.com/?topic=7739.0');
$styles = explode('|', 'ppp|pp|p|mp|mf|f|ff|fff'); // ordered Dynamic Styles
require_once("lib/nwc2clips.inc");
$io = gzfile('php://stdin'); // allow compressed input, fwiw
if ($patch = preg_grep('/^\|Instrument\|Name:\"[Xx]\"/', $io)) { // X or x
$o = new NWC2ClipItem(current($patch)); // 1st match in selection (or file)
if ($o->Opts['Name'] == 'X') unset($io[key($patch)]); // remove
$dynVel = array_combine($styles, $o->GetTaggedOptAsArray('DynVel'));
foreach(preg_grep('/^\|Dynamic\|/', $io) as $k=>$v) {
$o = new NWC2ClipItem($v);
if ($dynVel[$o->Opts['Style']] == '1') continue; // ignore
$o->Opts['Opts']['Volume'] = $dynVel[$o->Opts['Style']];
$io[$k] = $o->ReconstructClipText().PHP_EOL;
}
echo join($io);
if ($argc > 1) exit(NWC2RC_REPORT); // any arg causes report
} else fwrite(STDERR, ' See: '.URL); // err if no matching patch
?>
and this nwctxt to try it out on:!NoteWorthyComposer(2.5)
|AddStaff|Name:"Staff"
|Instrument|Name:"X"|Trans:0|DynVel:1,30,45,60,75,92,108,1|Pos:7
|Dynamic|Style:ppp|Pos:-7|Wide:Y
|Spacer|Width:300
|Dynamic|Style:pp|Pos:-7|Wide:Y
|Spacer|Width:300
|Dynamic|Style:p|Pos:-7|Wide:Y
|Spacer|Width:300
|Dynamic|Style:mp|Pos:-7|Wide:Y
|AddStaff|Name:"Staff-1"
|StaffProperties|BoundaryTop:10|BoundaryBottom:10
|StaffProperties|Channel:2
|Dynamic|Style:mf|Pos:-7|Wide:Y
|Spacer|Width:300
|Dynamic|Style:f|Pos:-7|Wide:Y
|Spacer|Width:300
|Dynamic|Style:ff|Pos:-7|Wide:Y
|Spacer|Width:300
|Dynamic|Style:fff|Pos:-7|Wide:Y
!NoteWorthyComposer-End
0.151 rg_ZenTxt v1.0