Skip to main content
Topic: GlobalMod StemLength=0 problem (Read 3209 times) previous topic - next topic

GlobalMod StemLength=0 problem

When I run any GlobalMod command on:
Code: [Select · Download]
!NoteWorthyComposerClip(2.0,Single)
|Note|Dur:Half|Pos:0|Opts:StemLength=0
!NoteWorthyComposerClip-End
I get:
Code: [Select · Download]
!NoteWorthyComposerClip(2.0,Single)
|Note|Dur:Half|Pos:0
!NoteWorthyComposerClip-End
No problem with: StemLength=1

Odd that Note objects would be parsed at all if the Command is, e.g.: Bar Visibility=Default
Could be a global assumption that zero must be the default and can be safely removed.

Version is: 2006-08-11 1.2
Registered user since 1996

Bug in User Tool Starter Kit

Reply #1
This happens with other tools as well. It is a bug in the NWC2 User Tool Starter Kit. Input like this:

Code: [Select · Download]
|Note|Dur:4th|Pos:0|Opts:StemLength=0

is changed to this by the start kit library:

Code: [Select · Download]
|Note|Dur:4th|Pos:0|Opts:StemLength

Test script:

Code: [Select · Download]
<?php
require_once("lib/nwc2clips.inc");

$clip = new NWC2Clip('php://stdin');

foreach ($clip->Items as $item) {
$o = new NWC2ClipItem($item);
echo "Ref: $item";
echo "New: ".$o->ReconstructClipText()."\n";
unset($o);
}

$usermsg = <<<__EOMSG
See the standard output file for a comparison of the library
output to the input clip.
__EOMSG;
//
fputs(STDERR,$usermsg);

exit(NWC2RC_REPORT);
?>

We will release an updated starter kit soon.

Re: GlobalMod StemLength=0 problem

Reply #2
Thanks. Glad I didn't look too hard for it. The lib would have been the last place I'd look.
Makes sense since it was doing it with every command.
Registered user since 1996

Re: GlobalMod StemLength=0 problem

Reply #3
If you need an immediate fix, change line 81 of obj_NWC2ClipItem.inc to:

Code: [Select · Download]
if ($v2 || is_numeric($v2) || (is_string($v2) && strlen($v2))) $s .= "=$v2";

Re: GlobalMod StemLength=0 problem

Reply #4
On second thought, this is a better fix:

Code: [Select · Download]
if ($v2 !== "") $s .= "=$v2";

Re: GlobalMod StemLength=0 problem

Reply #5
if ($v2 !== "") $s .= "=$v2";

Seems to work just fine.
Registered user since 1996