array(), "Pos2" => array()); function __construct($itemtext,$remapFakes=false) { parent::__construct($itemtext,$remapFakes); foreach ($this->PitchTags() as $tag) { foreach ($this->GetTaggedOptAsArray($tag, array()) as $np) $this->PitchPos[$tag][] = new NWC2NotePitchPos($np); } } function PitchTags() { switch ($this->ObjType) { case 'Note': return array('Pos'); case 'Chord': return array('Pos', 'Pos2'); case 'RestChord': return array('Pos2'); default: return array(); } } function __toString() { foreach ($this->PitchTags() as $tag) { unset($this->Opts[$tag]); // clear foreach ($this->PitchPos[$tag] as $npp) $this->Opts[$tag][] = $npp->ReconstructClipText(); } return $this->ReconstructClipText(); } } // array_shift($argv); // remove argv[0] preg_match('/^([\#bnxv]*)(-?\d*)(\w*)(\^?)(!?\d*)/', implode($argv), $m); $tieAll = $m[0]==''; // empty commandline, tie everything $acc = str_split($m[1]); // remove any of #bnxv $shift = (int) $m[2]; // move notes if not zero $head = str_split($m[3]); // change these to default notehead $zapTie = $m[4]=='^'; // remove ties $color = str_split($m[5]); // change these to default color if ($argc > 2) fputs(STDERR, print_r($m, true)); $clip = new NWC2Clip(); echo $clip->GetClipHeader().PHP_EOL; foreach ($clip->Items as $item) { $o = new myClipItemWithPitchPos($item); foreach ($o->PitchPos as $np) { foreach ($np as $npp) { if (in_array($npp->Accidental, $acc)) $npp->Accidental = ''; $npp->Position+= $shift; if(in_array($npp->Notehead, $head)) $npp->Notehead = ''; if($tieAll) $npp->Tied = '^'; else if($zapTie) $npp->Tied = ''; if(in_array($npp->Color, $color)) $npp->Color = ''; } } echo $o.PHP_EOL; // o$->__toString() } echo $clip->GetClipFooter().PHP_EOL; ?>