- Timestamp:
- 10/02/08 01:32:37 (3 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/actionscript/flmml/trunk/src/com/txt_nifty/sketch/flmml/MML.as
r19331 r20421 21 21 protected var m_noteShift:int; 22 22 protected var m_warning:String; 23 protected var m_maxPipe:int; 24 protected static var MAX_PIPE:int = 3; 23 25 24 26 public function MML() { … … 191 193 m_tracks[m_trackNo].recGate2(getUInt(2) * 2); // '*2' according to TSSCP 192 194 break; 195 /*case 'i': // Input 196 { 197 var sens:int = 0; 198 next(); 199 sens = getUInt(sens); 200 if (getChar() == ',') { 201 next(); 202 a = getUInt(a); 203 if (a > m_maxPipe) a = m_maxPipe; 204 } 205 m_tracks[m_trackNo].recInput(sens, a); 206 } 207 // @i[n],[m] m:pipe no 208 // if (n == 0) off 209 // else sensitivity = n (max:8) 210 break; 211 case 'o': // Output 212 { 213 var mode:int = 0; 214 next(); 215 mode = getUInt(mode); 216 if (getChar() == ',') { 217 next(); 218 a = getUInt(a); 219 if (a > m_maxPipe) { 220 m_maxPipe = a; 221 if (m_maxPipe >= MAX_PIPE) m_maxPipe = a = MAX_PIPE; 222 } 223 } 224 m_tracks[m_trackNo].recOutput(mode, a); 225 } 226 // @o[n],[m] m:pipe no 227 // if (n == 0) off 228 // if (n == 1) overwrite 229 // if (n == 2) add 230 break;*/ 193 231 default: 194 232 m_form = getUInt(m_form); … … 436 474 } 437 475 438 protected function macroInMacro(str:String, idArr:Array, valArr:Array):String { 476 protected function macroInMacro(str:String, idArr:Array, valArr:Array, id0:String):String { 477 var idx:int; 439 478 for(var i:int = 0; i < idArr.length; i++) { 440 479 var id:String = "$"+idArr[i]; 441 480 //trace("id:"+id); 442 var idx:int= str.indexOf(id);481 idx = str.indexOf(id); 443 482 while(idx >= 0) { 444 483 str = str.substring(0, idx) + valArr[i] + str.substring(idx + id.length); 445 484 idx = str.indexOf(id, idx); 446 485 } 486 } 487 // recursive call is prevented. 488 id0 = "$" + id0; 489 idx = str.indexOf(id0); 490 while(idx >= 0) { 491 str = str.substring(0, idx) + valArr[i] + str.substring(idx + id0.length); 492 idx = str.indexOf(id0, idx); 493 warning(MWarning.RECURSIVE_MACRO, id0); 447 494 } 448 495 return str; … … 454 501 var idArr:Array = new Array(); 455 502 var valArr:Array = new Array(); 456 var i:int;457 503 var last:int; 458 504 // [a-zA-Z][a-zA-Z0-9#\+\(\)_]* … … 483 529 // first definition 484 530 if (idx < 0) { 485 token[1] = macroInMacro(token[1], idArr, valArr );531 token[1] = macroInMacro(token[1], idArr, valArr, id[0]); 486 532 //trace("define $"+id[i]+"="+token[1]); 487 insertLenOrder(idArr, valArr, id[ i], token[1]);533 insertLenOrder(idArr, valArr, id[0], token[1]); 488 534 } 489 535 // macro redefinition 490 536 else { 491 token[1] = macroInMacro(token[1], idArr, valArr );537 token[1] = macroInMacro(token[1], idArr, valArr, id[0]); 492 538 //trace("redefine $"+id[i]+"="+token[1]); 493 539 valArr[idx] = token[1]; … … 592 638 m_form = MOscillator.PULSE; 593 639 m_noteShift = 0; 640 m_maxPipe = 0; 594 641 595 642 processComment(str); … … 616 663 m_sequencer.connect(m_tracks[i]); 617 664 } 665 m_sequencer.createPipes(m_maxPipe+1); 618 666 619 667 // dispatch event
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)