$zout = gzopen('php://stdout', 'wb'); $PlayContext = new NWC2PlayContext(); $FileMode = false; $HiddenStaff = false; while (!gzeof($zin)) { $l = gzgets($zin, 32000); if (!preg_match('/^\\|/', $l)) { gzwrite($zout, $l); if (preg_match('/^\\!NoteWorthyComposer\\(([0-9\\.]+)/', $l, $m)) { $FileMode = $m[1]; } continue; } if (preg_match('/^\\|AddStaff/', $l)) { unset($PlayContext); $PlayContext = new NWC2PlayContext(); $HiddenStaff = false; gzwrite($zout, $l); continue; } if (preg_match('/^\\|StaffProperties\\|/', $l) && preg_match('/\\|Visible:\\s*([Y,N])/', $l, $m)) { $HiddenStaff = $m[1] == "N"; } if ($HiddenStaff) { gzwrite($zout, $l); continue; } $o = new NWC2ClipItemWithPitchPos($l, !$FileMode); if (!$FileMode && $o->IsContextInfo()) { $PlayContext->UpdateContext($o); continue;
$staffPos = @intval($NOTENAME_POSITION); $abortMsg = false; $txtout = ""; // $clip = new NWC2Clip('php://stdin'); if (!$useLyric) { $txtout .= $clip->GetClipHeader() . "\n"; } if ($clip->Mode != "Single") { trigger_error("Clip mode of {$clip->Mode} is not supported", E_USER_ERROR); } if ($clip->Version > "2.5") { trigger_error("The notation clip uses an unknown format version ({$clip->Version}), so it may not be processed correctly", E_USER_NOTICE); } $barnotecnt = 0; $PlayContext = new NWC2PlayContext(); foreach ($clip->Items as $item) { $is_fake = substr($item, 0, 6) == "|Fake|"; $o = new NWC2ClipItem($is_fake ? trim(substr($item, 5)) . "|Fake" : $item); if ($is_fake) { $PlayContext->UpdateContext($o); continue; } if (in_array($o->GetObjType(), array('Note', 'Chord', 'RestChord', 'Rest'))) { $notenameText = ""; $lyricOpt = isset($o->Opts["Opts"]["Lyric"]) ? $o->Opts["Opts"]["Lyric"] : "Default"; $isGrace = isset($o->Opts["Dur"]["Grace"]); $isInTie = false; $isAllInTie = true; for ($loop = 0; $loop < 2; $loop++) { $notes = $o->GetTaggedOptAsArray($loop > 0 ? "Pos2" : "Pos", array());
$staffPos = @intval($NOTENAME_POSITION); $abortMsg = false; $txtout = ""; // $clip = new NWC2Clip('php://stdin'); if (!$useLyric) { $txtout .= $clip->GetClipHeader() . "\n"; } if ($clip->Mode != "Single") { trigger_error("Clip mode of {$clip->Mode} is not supported", E_USER_ERROR); } if ($clip->Version > "2.5") { trigger_error("The notation clip uses an unknown format version ({$clip->Version}), so it may not be processed correctly", E_USER_NOTICE); } $barnotecnt = 0; $PlayContext = new NWC2PlayContext(); foreach ($clip->Items as $item) { $o = new NWC2ClipItem($item, true); if ($o->IsContextInfo()) { $PlayContext->UpdateContext($o); continue; } if (in_array($o->GetObjType(), array('Note', 'Chord', 'RestChord', 'Rest'))) { $notenameText = ""; $lyricOpt = isset($o->Opts["Opts"]["Lyric"]) ? $o->Opts["Opts"]["Lyric"] : "Default"; $isGrace = isset($o->Opts["Dur"]["Grace"]); $isInTie = false; $isAllInTie = true; for ($loop = 0; $loop < 2; $loop++) { $notes = $o->GetTaggedOptAsArray($loop > 0 ? "Pos2" : "Pos", array()); foreach ($notes as $i => $notepitchTxt) {
if (preg_match('/^\\/duration\\=([0-9]+)/i', $v, $m)) { $ARPEGGIO_DURATION = intval($m[1]); } else { if (preg_match('/^\\/sequence\\=(.*)$/i', $v, $m)) { $ARPEGGIO_SEQUENCE = $m[1]; } } } $clip = new NWC2Clip('php://stdin'); if (count($clip->Items) < 1) { trigger_error("Please select at least one chord", E_USER_ERROR); } echo $clip->GetClipHeader() . "\n"; $ArpeggioAllowedHere = true; $WarnAboutInboundTie = false; $PlayContext = new NWC2PlayContext(); foreach ($clip->Items as $item) { $o = new NWC2ClipItem($item, true); if ($o->IsContextInfo()) { $PlayContext->UpdateContext($o); continue; } $baseDur = getBaseDur($o); // // If this is a non-grace chord and is not preceded by a grace note, // and it is larger than an 8th note in duration, then add an arpeggio if ($ArpeggioAllowedHere && $o->GetObjType() == "Chord" && !isset($o->Opts["Dur"]["Grace"]) && strpos('_|Whole|Half|4th|8th|16th|', "|{$baseDur}|")) { // Create the Arpeggio.ms object, then update its properties as needed $userObj = new NWC2ClipItem('|User|Arpeggio.ms|Pos:0|Class:Standard|Dir:up|Rate:16|Color:0|Visibility:Default'); $chordnotes = $o->GetTaggedOptAsArray("Pos", array()); $chordnotes2 = $o->GetTaggedOptAsArray("Pos2");