Пример #1
0
		public virtual   void parseAutomations(global::haxe.root.Xml node)
		{
			unchecked 
			{
				{
					object __temp_iterator421 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator421, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator421, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							string _g = c._get_nodeName();
							switch (_g)
							{
								case "Automation":
								{
									this.parseAutomation(c);
									break;
								}
								
								
							}
							
						}
						
					}
					
				}
				
			}
		}
Пример #2
0
		public virtual   void parseAutomation(global::haxe.root.Xml node)
		{
			unchecked 
			{
				string type = default(string);
				bool isLinear = false;
				string barId = default(string);
				double ratioPosition = ((double) (0) );
				double @value = ((double) (0) );
				int reference = 0;
				string text = default(string);
				{
					object __temp_iterator422 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator422, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator422, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							string _g = c._get_nodeName();
							switch (_g)
							{
								case "Type":
								{
									type = this.getValue(c);
									break;
								}
								
								
								case "Linear":
								{
									isLinear = string.Equals(this.getValue(c).ToLower(), "true");
									break;
								}
								
								
								case "Bar":
								{
									barId = this.getValue(c);
									break;
								}
								
								
								case "Position":
								{
									ratioPosition = global::Std.parseFloat(this.getValue(c));
									break;
								}
								
								
								case "Value":
								{
									global::haxe.root.Array<object> parts = global::haxe.lang.StringExt.split(this.getValue(c), " ");
									@value = global::Std.parseFloat(global::haxe.lang.Runtime.toString(parts[0]));
									reference = global::Std.parseInt(global::haxe.lang.Runtime.toString(parts[1])).@value;
									break;
								}
								
								
								case "Text":
								{
									text = this.getValue(c);
									break;
								}
								
								
							}
							
						}
						
					}
					
				}
				
				if (string.Equals(type, default(string))) 
				{
					return ;
				}
				
				global::alphatab.model.Automation automation = default(global::alphatab.model.Automation);
				switch (type)
				{
					case "Tempo":
					{
						automation = global::alphatab.model.Automation.builtTempoAutomation(isLinear, ratioPosition, @value, reference);
						break;
					}
					
					
				}
				
				automation.text = text;
				if (( automation != default(global::alphatab.model.Automation) )) 
				{
					if ( ! (this._automations.exists(barId)) ) 
					{
						this._automations.@set(barId, new global::haxe.root.Array<object>());
					}
					
					((global::haxe.root.Array<object>) (global::haxe.root.Array<object>.__hx_cast<object>(((global::haxe.root.Array) (this._automations.@get(barId).@value) ))) ).push(automation);
				}
				
			}
		}
Пример #3
0
		public virtual   void parseScoreNode(global::haxe.root.Xml node)
		{
			unchecked 
			{
				{
					object __temp_iterator419 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator419, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator419, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							string _g = c._get_nodeName();
							switch (_g)
							{
								case "Title":
								{
									this.score.title = this.getValue(c.firstChild());
									break;
								}
								
								
								case "SubTitle":
								{
									this.score.subTitle = this.getValue(c.firstChild());
									break;
								}
								
								
								case "Artist":
								{
									this.score.artist = this.getValue(c.firstChild());
									break;
								}
								
								
								case "Album":
								{
									this.score.album = this.getValue(c.firstChild());
									break;
								}
								
								
								case "Words":
								{
									this.score.words = this.getValue(c.firstChild());
									break;
								}
								
								
								case "Music":
								{
									this.score.music = this.getValue(c.firstChild());
									break;
								}
								
								
								case "WordsAndMusic":
								{
									if (( ( c.firstChild() != default(global::haxe.root.Xml) ) &&  ! (string.Equals(c.firstChild().toString(), ""))  )) 
									{
										this.score.words = this.getValue(c.firstChild());
										this.score.music = this.getValue(c.firstChild());
									}
									
									break;
								}
								
								
								case "Copyright":
								{
									this.score.copyright = this.getValue(c.firstChild());
									break;
								}
								
								
								case "Tabber":
								{
									this.score.tab = this.getValue(c.firstChild());
									break;
								}
								
								
							}
							
						}
						
					}
					
				}
				
			}
		}
Пример #4
0
		public virtual   void parseMasterTrackNode(global::haxe.root.Xml node)
		{
			unchecked 
			{
				{
					object __temp_iterator420 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator420, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator420, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							string _g = c._get_nodeName();
							switch (_g)
							{
								case "Automations":
								{
									this.parseAutomations(c);
									break;
								}
								
								
								case "Tracks":
								{
									this._tracksMapping = global::haxe.lang.StringExt.split(this.getValue(c), " ");
									break;
								}
								
								
							}
							
						}
						
					}
					
				}
				
			}
		}
Пример #5
0
		public virtual   string getValue(global::haxe.root.Xml n)
		{
			unchecked 
			{
				if (( ( n.nodeType == global::haxe.root.Xml.Element ) || ( n.nodeType == global::haxe.root.Xml.Document ) )) 
				{
					global::haxe.root.StringBuf txt = new global::haxe.root.StringBuf();
					{
						object __temp_iterator417 = n.iterator();
						while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator417, "hasNext", 407283053, default(global::haxe.root.Array))) ))
						{
							global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator417, "next", 1224901875, default(global::haxe.root.Array))) );
							object x = this.getValue(c);
							txt.b.Append(((object) (global::Std.@string(x)) ));
						}
						
					}
					
					{
						string s = txt.toString();
						return s.Trim();
					}
					
				}
				 else 
				{
					return n._get_nodeValue();
				}
				
			}
		}
Пример #6
0
		public virtual   global::haxe.root.Xml findChildElement(global::haxe.root.Xml node, string name)
		{
			unchecked 
			{
				{
					object __temp_iterator418 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator418, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator418, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							if (string.Equals(c._get_nodeName(), name)) 
							{
								return c;
							}
							
						}
						
					}
					
				}
				
				return default(global::haxe.root.Xml);
			}
		}
Пример #7
0
		public virtual   void parseRhythm(global::haxe.root.Xml node)
		{
			unchecked 
			{
				global::alphatab.importer.GpxRhythm rhythm = new global::alphatab.importer.GpxRhythm();
				string rhythmId = node.@get("id");
				{
					object __temp_iterator440 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator440, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator440, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							string _g = c._get_nodeName();
							switch (_g)
							{
								case "NoteValue":
								{
									string _g1 = this.getValue(c);
									switch (_g1)
									{
										case "Whole":
										{
											rhythm.@value = global::alphatab.model.Duration.Whole;
											break;
										}
										
										
										case "Half":
										{
											rhythm.@value = global::alphatab.model.Duration.Half;
											break;
										}
										
										
										case "Quarter":
										{
											rhythm.@value = global::alphatab.model.Duration.Quarter;
											break;
										}
										
										
										case "Eighth":
										{
											rhythm.@value = global::alphatab.model.Duration.Eighth;
											break;
										}
										
										
										case "16th":
										{
											rhythm.@value = global::alphatab.model.Duration.Sixteenth;
											break;
										}
										
										
										case "32nd":
										{
											rhythm.@value = global::alphatab.model.Duration.ThirtySecond;
											break;
										}
										
										
										case "64th":
										{
											rhythm.@value = global::alphatab.model.Duration.SixtyFourth;
											break;
										}
										
										
									}
									
									break;
								}
								
								
								case "PrimaryTuplet":
								{
									rhythm.tupletNumerator = global::Std.parseInt(c.@get("num")).@value;
									rhythm.tupletDenominator = global::Std.parseInt(c.@get("den")).@value;
									break;
								}
								
								
								case "AugmentationDot":
								{
									rhythm.dots = global::Std.parseInt(c.@get("count")).@value;
									break;
								}
								
								
							}
							
						}
						
					}
					
				}
				
				this._rhythmById.@set(rhythmId, rhythm);
			}
		}
Пример #8
0
		public virtual   void parseBar(global::haxe.root.Xml node)
		{
			unchecked 
			{
				global::alphatab.model.Bar bar = new global::alphatab.model.Bar();
				string barId = node.@get("id");
				{
					object __temp_iterator430 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator430, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator430, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							string _g = c._get_nodeName();
							switch (_g)
							{
								case "Voices":
								{
									this._voicesOfBar.@set(barId, global::haxe.lang.StringExt.split(this.getValue(c), " "));
									break;
								}
								
								
								case "Clef":
								{
									string _g1 = this.getValue(c);
									switch (_g1)
									{
										case "Neutral":
										{
											bar.clef = global::alphatab.model.Clef.Neutral;
											break;
										}
										
										
										case "G2":
										{
											bar.clef = global::alphatab.model.Clef.G2;
											break;
										}
										
										
										case "F4":
										{
											bar.clef = global::alphatab.model.Clef.F4;
											break;
										}
										
										
										case "C4":
										{
											bar.clef = global::alphatab.model.Clef.C4;
											break;
										}
										
										
										case "C3":
										{
											bar.clef = global::alphatab.model.Clef.C3;
											break;
										}
										
										
									}
									
									break;
								}
								
								
							}
							
						}
						
					}
					
				}
				
				this._barsById.@set(barId, bar);
			}
		}
Пример #9
0
		public virtual   void parseNote(global::haxe.root.Xml node)
		{
			unchecked 
			{
				global::alphatab.model.Note note = new global::alphatab.model.Note();
				string noteId = node.@get("id");
				{
					object __temp_iterator437 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator437, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator437, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							string _g = c._get_nodeName();
							switch (_g)
							{
								case "Properties":
								{
									this.parseNoteProperties(c, note, noteId);
									break;
								}
								
								
								case "AntiAccent":
								{
									if (string.Equals(this.getValue(c).ToLower(), "normal")) 
									{
										note.isGhost = true;
									}
									
									break;
								}
								
								
								case "LetRing":
								{
									note.isLetRing = true;
									break;
								}
								
								
								case "Trill":
								{
									note.trillValue = global::Std.parseInt(this.getValue(c)).@value;
									note.trillSpeed = global::alphatab.model.Duration.Sixteenth;
									break;
								}
								
								
								case "Accent":
								{
									global::haxe.lang.Null<int> accentFlags = global::Std.parseInt(this.getValue(c));
									if (( (( accentFlags.@value & 1 )) != 0 )) 
									{
										note.isStaccato = true;
									}
									
									if (( (( accentFlags.@value & 4 )) != 0 )) 
									{
										note.accentuated = global::alphatab.model.AccentuationType.Heavy;
									}
									
									if (( (( accentFlags.@value & 8 )) != 0 )) 
									{
										note.accentuated = global::alphatab.model.AccentuationType.Normal;
									}
									
									break;
								}
								
								
								case "Tie":
								{
									if (string.Equals(c.@get("origin").ToLower(), "true")) 
									{
										note.isTieOrigin = true;
									}
									
									if (string.Equals(c.@get("destination").ToLower(), "true")) 
									{
										note.isTieDestination = true;
									}
									
									break;
								}
								
								
								case "Vibrato":
								{
									string _g1 = this.getValue(c);
									switch (_g1)
									{
										case "Slight":
										{
											note.vibrato = global::alphatab.model.VibratoType.Slight;
											break;
										}
										
										
										case "Wide":
										{
											note.vibrato = global::alphatab.model.VibratoType.Wide;
											break;
										}
										
										
									}
									
									break;
								}
								
								
							}
							
						}
						
					}
					
				}
				
				this._noteById.@set(noteId, note);
			}
		}
Пример #10
0
		public virtual   void parseNoteProperties(global::haxe.root.Xml node, global::alphatab.model.Note note, string noteId)
		{
			unchecked 
			{
				bool isBended = false;
				global::alphatab.model.BendPoint bendOrigin = default(global::alphatab.model.BendPoint);
				global::haxe.lang.Null<int> bendMiddleValue = default(global::haxe.lang.Null<int>);
				global::haxe.lang.Null<int> bendMiddleOffset1 = default(global::haxe.lang.Null<int>);
				global::haxe.lang.Null<int> bendMiddleOffset2 = default(global::haxe.lang.Null<int>);
				global::alphatab.model.BendPoint bendDestination = default(global::alphatab.model.BendPoint);
				{
					object __temp_iterator438 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator438, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator438, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							string _g = c._get_nodeName();
							switch (_g)
							{
								case "Property":
								{
									string name = c.@get("name");
									switch (name)
									{
										case "String":
										{
											note.@string = ( global::Std.parseInt(this.getValue(this.findChildElement(c, "String"))).@value + 1 );
											break;
										}
										
										
										case "Fret":
										{
											note.fret = global::Std.parseInt(this.getValue(this.findChildElement(c, "Fret"))).@value;
											break;
										}
										
										
										case "Tapped":
										{
											this._tappedNotes.@set(noteId, true);
											break;
										}
										
										
										case "HarmonicType":
										{
											global::haxe.root.Xml htype = this.findChildElement(c, "HType");
											if (( htype != default(global::haxe.root.Xml) )) 
											{
												string _g1 = this.getValue(htype);
												switch (_g1)
												{
													case "NoHarmonic":
													{
														note.harmonicType = global::alphatab.model.HarmonicType.None;
														break;
													}
													
													
													case "Natural":
													{
														note.harmonicType = global::alphatab.model.HarmonicType.Natural;
														break;
													}
													
													
													case "Artificial":
													{
														note.harmonicType = global::alphatab.model.HarmonicType.Artificial;
														break;
													}
													
													
													case "Pinch":
													{
														note.harmonicType = global::alphatab.model.HarmonicType.Pinch;
														break;
													}
													
													
													case "Tap":
													{
														note.harmonicType = global::alphatab.model.HarmonicType.Tap;
														break;
													}
													
													
													case "Semi":
													{
														note.harmonicType = global::alphatab.model.HarmonicType.Semi;
														break;
													}
													
													
													case "Feedback":
													{
														note.harmonicType = global::alphatab.model.HarmonicType.Feedback;
														break;
													}
													
													
												}
												
											}
											
											break;
										}
										
										
										case "HarmonicFret":
										{
											global::haxe.root.Xml hfret = this.findChildElement(c, "HFret");
											if (( hfret != default(global::haxe.root.Xml) )) 
											{
												note.harmonicValue = global::Std.parseFloat(this.getValue(hfret));
											}
											
											break;
										}
										
										
										case "PalmMuted":
										{
											if (( this.findChildElement(c, "Enable") != default(global::haxe.root.Xml) )) 
											{
												note.isPalmMute = true;
											}
											
											break;
										}
										
										
										case "Octave":
										{
											note.octave = global::Std.parseInt(this.getValue(this.findChildElement(c, "Number"))).@value;
											break;
										}
										
										
										case "Bended":
										{
											isBended = true;
											break;
										}
										
										
										case "BendOriginValue":
										{
											if (( bendOrigin == default(global::alphatab.model.BendPoint) )) 
											{
												bendOrigin = new global::alphatab.model.BendPoint(((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ), ((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ));
											}
											
											{
												double x = ( global::Std.parseFloat(this.getValue(this.findChildElement(c, "Float"))) * 0.04 );
												bendOrigin.@value = ((int) (x) );
											}
											
											break;
										}
										
										
										case "BendOriginOffset":
										{
											if (( bendOrigin == default(global::alphatab.model.BendPoint) )) 
											{
												bendOrigin = new global::alphatab.model.BendPoint(((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ), ((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ));
											}
											
											{
												double x1 = ( global::Std.parseFloat(this.getValue(this.findChildElement(c, "Float"))) * 0.6 );
												bendOrigin.offset = ((int) (x1) );
											}
											
											break;
										}
										
										
										case "BendMiddleValue":
										{
											double x2 = ( global::Std.parseFloat(this.getValue(this.findChildElement(c, "Float"))) * 0.04 );
											bendMiddleValue = new global::haxe.lang.Null<int>(new global::haxe.lang.Null<int>(((int) (x2) ), true).@value, true);
											break;
										}
										
										
										case "BendMiddleOffset1":
										{
											double x3 = ( global::Std.parseFloat(this.getValue(this.findChildElement(c, "Float"))) * 0.6 );
											bendMiddleOffset1 = new global::haxe.lang.Null<int>(new global::haxe.lang.Null<int>(((int) (x3) ), true).@value, true);
											break;
										}
										
										
										case "BendMiddleOffset2":
										{
											double x4 = ( global::Std.parseFloat(this.getValue(this.findChildElement(c, "Float"))) * 0.6 );
											bendMiddleOffset2 = new global::haxe.lang.Null<int>(new global::haxe.lang.Null<int>(((int) (x4) ), true).@value, true);
											break;
										}
										
										
										case "BendDestinationValue":
										{
											if (( bendDestination == default(global::alphatab.model.BendPoint) )) 
											{
												bendDestination = new global::alphatab.model.BendPoint(new global::haxe.lang.Null<int>(60, true), ((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ));
											}
											
											{
												double x5 = ( global::Std.parseFloat(this.getValue(this.findChildElement(c, "Float"))) * 0.04 );
												bendDestination.@value = ((int) (x5) );
											}
											
											break;
										}
										
										
										case "BendDestinationOffset":
										{
											if (( bendDestination == default(global::alphatab.model.BendPoint) )) 
											{
												bendDestination = new global::alphatab.model.BendPoint(((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ), ((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ));
											}
											
											{
												double x6 = ( global::Std.parseFloat(this.getValue(this.findChildElement(c, "Float"))) * 0.6 );
												bendDestination.offset = ((int) (x6) );
											}
											
											break;
										}
										
										
										case "HopoOrigin":
										{
											if (( this.findChildElement(c, "Enable") != default(global::haxe.root.Xml) )) 
											{
												note.isHammerPullOrigin = true;
											}
											
											break;
										}
										
										
										case "HopoDestination":
										{
											{
											}
											
											break;
										}
										
										
										case "Slide":
										{
											global::haxe.lang.Null<int> slideFlags = global::Std.parseInt(this.getValue(this.findChildElement(c, "Flags")));
											if (( (( slideFlags.@value & 1 )) != 0 )) 
											{
												note.slideType = global::alphatab.model.SlideType.Shift;
											}
											
											if (( (( slideFlags.@value & 2 )) != 0 )) 
											{
												note.slideType = global::alphatab.model.SlideType.Legato;
											}
											
											if (( (( slideFlags.@value & 4 )) != 0 )) 
											{
												note.slideType = global::alphatab.model.SlideType.OutDown;
											}
											
											if (( (( slideFlags.@value & 8 )) != 0 )) 
											{
												note.slideType = global::alphatab.model.SlideType.OutUp;
											}
											
											if (( (( slideFlags.@value & 16 )) != 0 )) 
											{
												note.slideType = global::alphatab.model.SlideType.IntoFromBelow;
											}
											
											if (( (( slideFlags.@value & 32 )) != 0 )) 
											{
												note.slideType = global::alphatab.model.SlideType.IntoFromAbove;
											}
											
											break;
										}
										
										
									}
									
									break;
								}
								
								
							}
							
						}
						
					}
					
				}
				
				if (isBended) 
				{
					if (( bendOrigin == default(global::alphatab.model.BendPoint) )) 
					{
						bendOrigin = new global::alphatab.model.BendPoint(((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ), ((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ));
					}
					
					if (( bendDestination == default(global::alphatab.model.BendPoint) )) 
					{
						bendDestination = new global::alphatab.model.BendPoint(new global::haxe.lang.Null<int>(60, true), ((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ));
					}
					
					global::haxe.root.Array<object> bend = new global::haxe.root.Array<object>();
					bend.push(bendOrigin);
					if (( ( ! (global::haxe.lang.Runtime.eq((bendMiddleOffset1).toDynamic(), (default(global::haxe.lang.Null<int>)).toDynamic())) ) && ( ! (global::haxe.lang.Runtime.eq((bendMiddleValue).toDynamic(), (default(global::haxe.lang.Null<int>)).toDynamic())) ) )) 
					{
						bend.push(new global::alphatab.model.BendPoint(((global::haxe.lang.Null<int>) (bendMiddleOffset1) ), ((global::haxe.lang.Null<int>) (bendMiddleValue) )));
					}
					
					if (( ( ! (global::haxe.lang.Runtime.eq((bendMiddleOffset2).toDynamic(), (default(global::haxe.lang.Null<int>)).toDynamic())) ) && ( ! (global::haxe.lang.Runtime.eq((bendMiddleValue).toDynamic(), (default(global::haxe.lang.Null<int>)).toDynamic())) ) )) 
					{
						bend.push(new global::alphatab.model.BendPoint(((global::haxe.lang.Null<int>) (bendMiddleOffset2) ), ((global::haxe.lang.Null<int>) (bendMiddleValue) )));
					}
					
					if (( ( global::haxe.lang.Runtime.eq((bendMiddleOffset1).toDynamic(), (default(global::haxe.lang.Null<int>)).toDynamic()) && global::haxe.lang.Runtime.eq((bendMiddleOffset2).toDynamic(), (default(global::haxe.lang.Null<int>)).toDynamic()) ) && ( ! (global::haxe.lang.Runtime.eq((bendMiddleValue).toDynamic(), (default(global::haxe.lang.Null<int>)).toDynamic())) ) )) 
					{
						bend.push(new global::alphatab.model.BendPoint(new global::haxe.lang.Null<int>(30, true), ((global::haxe.lang.Null<int>) (bendMiddleValue) )));
					}
					
					bend.push(bendDestination);
					note.bendPoints = bend;
				}
				
			}
		}
Пример #11
0
		public virtual   void parseBeatProperties(global::haxe.root.Xml node, global::alphatab.model.Beat beat)
		{
			unchecked 
			{
				bool isWhammy = false;
				global::alphatab.model.BendPoint whammyOrigin = default(global::alphatab.model.BendPoint);
				global::haxe.lang.Null<int> whammyMiddleValue = default(global::haxe.lang.Null<int>);
				global::haxe.lang.Null<int> whammyMiddleOffset1 = default(global::haxe.lang.Null<int>);
				global::haxe.lang.Null<int> whammyMiddleOffset2 = default(global::haxe.lang.Null<int>);
				global::alphatab.model.BendPoint whammyDestination = default(global::alphatab.model.BendPoint);
				{
					object __temp_iterator435 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator435, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator435, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							string _g = c._get_nodeName();
							switch (_g)
							{
								case "Property":
								{
									string name = c.@get("name");
									switch (name)
									{
										case "Brush":
										{
											if (string.Equals(this.getValue(this.findChildElement(c, "Direction")), "Up")) 
											{
												beat.brushType = global::alphatab.model.BrushType.BrushUp;
											}
											 else 
											{
												beat.brushType = global::alphatab.model.BrushType.BrushDown;
											}
											
											break;
										}
										
										
										case "PickStroke":
										{
											if (string.Equals(this.getValue(this.findChildElement(c, "Direction")), "Up")) 
											{
												beat.pickStroke = global::alphatab.model.PickStrokeType.Up;
											}
											 else 
											{
												beat.pickStroke = global::alphatab.model.PickStrokeType.Down;
											}
											
											break;
										}
										
										
										case "Slapped":
										{
											if (( this.findChildElement(c, "Enable") != default(global::haxe.root.Xml) )) 
											{
												beat.slap = true;
											}
											
											break;
										}
										
										
										case "Popped":
										{
											if (( this.findChildElement(c, "Enable") != default(global::haxe.root.Xml) )) 
											{
												beat.pop = true;
											}
											
											break;
										}
										
										
										case "VibratoWTremBar":
										{
											string _g1 = this.getValue(this.findChildElement(c, "Strength"));
											switch (_g1)
											{
												case "Wide":
												{
													beat.vibrato = global::alphatab.model.VibratoType.Wide;
													break;
												}
												
												
												case "Slight":
												{
													beat.vibrato = global::alphatab.model.VibratoType.Slight;
													break;
												}
												
												
											}
											
											break;
										}
										
										
										case "WhammyBar":
										{
											isWhammy = true;
											break;
										}
										
										
										case "WhammyBarExtend":
										{
											{
											}
											
											break;
										}
										
										
										case "WhammyBarOriginValue":
										{
											if (( whammyOrigin == default(global::alphatab.model.BendPoint) )) 
											{
												whammyOrigin = new global::alphatab.model.BendPoint(((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ), ((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ));
											}
											
											{
												double x = ( global::Std.parseFloat(this.getValue(this.findChildElement(c, "Float"))) * 0.04 );
												whammyOrigin.@value = ((int) (x) );
											}
											
											break;
										}
										
										
										case "WhammyBarOriginOffset":
										{
											if (( whammyOrigin == default(global::alphatab.model.BendPoint) )) 
											{
												whammyOrigin = new global::alphatab.model.BendPoint(((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ), ((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ));
											}
											
											{
												double x1 = ( global::Std.parseFloat(this.getValue(this.findChildElement(c, "Float"))) * 0.6 );
												whammyOrigin.offset = ((int) (x1) );
											}
											
											break;
										}
										
										
										case "WhammyBarMiddleValue":
										{
											double x2 = ( global::Std.parseFloat(this.getValue(this.findChildElement(c, "Float"))) * 0.04 );
											whammyMiddleValue = new global::haxe.lang.Null<int>(new global::haxe.lang.Null<int>(((int) (x2) ), true).@value, true);
											break;
										}
										
										
										case "WhammyBarMiddleOffset1":
										{
											double x3 = ( global::Std.parseFloat(this.getValue(this.findChildElement(c, "Float"))) * 0.6 );
											whammyMiddleOffset1 = new global::haxe.lang.Null<int>(new global::haxe.lang.Null<int>(((int) (x3) ), true).@value, true);
											break;
										}
										
										
										case "WhammyBarMiddleOffset2":
										{
											double x4 = ( global::Std.parseFloat(this.getValue(this.findChildElement(c, "Float"))) * 0.6 );
											whammyMiddleOffset2 = new global::haxe.lang.Null<int>(new global::haxe.lang.Null<int>(((int) (x4) ), true).@value, true);
											break;
										}
										
										
										case "WhammyBarDestinationValue":
										{
											if (( whammyDestination == default(global::alphatab.model.BendPoint) )) 
											{
												whammyDestination = new global::alphatab.model.BendPoint(new global::haxe.lang.Null<int>(60, true), ((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ));
											}
											
											{
												double x5 = ( global::Std.parseFloat(this.getValue(this.findChildElement(c, "Float"))) * 0.04 );
												whammyDestination.@value = ((int) (x5) );
											}
											
											break;
										}
										
										
										case "WhammyBarDestinationOffset":
										{
											if (( whammyDestination == default(global::alphatab.model.BendPoint) )) 
											{
												whammyDestination = new global::alphatab.model.BendPoint(((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ), ((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ));
											}
											
											{
												double x6 = ( global::Std.parseFloat(this.getValue(this.findChildElement(c, "Float"))) * 0.6 );
												whammyDestination.offset = ((int) (x6) );
											}
											
											break;
										}
										
										
									}
									
									break;
								}
								
								
							}
							
						}
						
					}
					
				}
				
				if (isWhammy) 
				{
					if (( whammyOrigin == default(global::alphatab.model.BendPoint) )) 
					{
						whammyOrigin = new global::alphatab.model.BendPoint(((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ), ((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ));
					}
					
					if (( whammyDestination == default(global::alphatab.model.BendPoint) )) 
					{
						whammyDestination = new global::alphatab.model.BendPoint(new global::haxe.lang.Null<int>(60, true), ((global::haxe.lang.Null<int>) (default(global::haxe.lang.Null<int>)) ));
					}
					
					global::haxe.root.Array<object> whammy = new global::haxe.root.Array<object>();
					whammy.push(whammyOrigin);
					if (( ( ! (global::haxe.lang.Runtime.eq((whammyMiddleOffset1).toDynamic(), (default(global::haxe.lang.Null<int>)).toDynamic())) ) && ( ! (global::haxe.lang.Runtime.eq((whammyMiddleValue).toDynamic(), (default(global::haxe.lang.Null<int>)).toDynamic())) ) )) 
					{
						whammy.push(new global::alphatab.model.BendPoint(((global::haxe.lang.Null<int>) (whammyMiddleOffset1) ), ((global::haxe.lang.Null<int>) (whammyMiddleValue) )));
					}
					
					if (( ( ! (global::haxe.lang.Runtime.eq((whammyMiddleOffset2).toDynamic(), (default(global::haxe.lang.Null<int>)).toDynamic())) ) && ( ! (global::haxe.lang.Runtime.eq((whammyMiddleValue).toDynamic(), (default(global::haxe.lang.Null<int>)).toDynamic())) ) )) 
					{
						whammy.push(new global::alphatab.model.BendPoint(((global::haxe.lang.Null<int>) (whammyMiddleOffset2) ), ((global::haxe.lang.Null<int>) (whammyMiddleValue) )));
					}
					
					if (( ( global::haxe.lang.Runtime.eq((whammyMiddleOffset1).toDynamic(), (default(global::haxe.lang.Null<int>)).toDynamic()) && global::haxe.lang.Runtime.eq((whammyMiddleOffset2).toDynamic(), (default(global::haxe.lang.Null<int>)).toDynamic()) ) && ( ! (global::haxe.lang.Runtime.eq((whammyMiddleValue).toDynamic(), (default(global::haxe.lang.Null<int>)).toDynamic())) ) )) 
					{
						whammy.push(new global::alphatab.model.BendPoint(new global::haxe.lang.Null<int>(30, true), ((global::haxe.lang.Null<int>) (whammyMiddleValue) )));
					}
					
					whammy.push(whammyDestination);
					beat.whammyBarPoints = whammy;
				}
				
			}
		}
Пример #12
0
		public virtual   void parseBeat(global::haxe.root.Xml node)
		{
			unchecked 
			{
				global::alphatab.model.Beat beat = new global::alphatab.model.Beat();
				string beatId = node.@get("id");
				{
					object __temp_iterator434 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator434, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator434, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							string _g = c._get_nodeName();
							switch (_g)
							{
								case "Notes":
								{
									this._notesOfBeat.@set(beatId, global::haxe.lang.StringExt.split(this.getValue(c), " "));
									break;
								}
								
								
								case "Rhythm":
								{
									this._rhythmOfBeat.@set(beatId, c.@get("ref"));
									break;
								}
								
								
								case "Fadding":
								{
									if (string.Equals(this.getValue(c), "FadeIn")) 
									{
										beat.fadeIn = true;
									}
									
									break;
								}
								
								
								case "Tremolo":
								{
									string _g1 = this.getValue(c);
									switch (_g1)
									{
										case "1/2":
										{
											beat.tremoloSpeed = new global::haxe.lang.Null<global::alphatab.model.Duration>(new global::haxe.lang.Null<global::alphatab.model.Duration>(global::alphatab.model.Duration.Eighth, true).@value, true);
											break;
										}
										
										
										case "1/4":
										{
											beat.tremoloSpeed = new global::haxe.lang.Null<global::alphatab.model.Duration>(new global::haxe.lang.Null<global::alphatab.model.Duration>(global::alphatab.model.Duration.Sixteenth, true).@value, true);
											break;
										}
										
										
										case "1/8":
										{
											beat.tremoloSpeed = new global::haxe.lang.Null<global::alphatab.model.Duration>(new global::haxe.lang.Null<global::alphatab.model.Duration>(global::alphatab.model.Duration.ThirtySecond, true).@value, true);
											break;
										}
										
										
									}
									
									break;
								}
								
								
								case "Chord":
								{
									beat.chordId = this.getValue(c);
									break;
								}
								
								
								case "Hairpin":
								{
									string _g11 = this.getValue(c);
									switch (_g11)
									{
										case "Crescendo":
										{
											beat.crescendo = global::alphatab.rendering.glyphs.CrescendoType.Crescendo;
											break;
										}
										
										
										case "Decrescendo":
										{
											beat.crescendo = global::alphatab.rendering.glyphs.CrescendoType.Decrescendo;
											break;
										}
										
										
									}
									
									break;
								}
								
								
								case "Arpeggio":
								{
									if (string.Equals(this.getValue(c), "Up")) 
									{
										beat.brushType = global::alphatab.model.BrushType.ArpeggioUp;
									}
									 else 
									{
										beat.brushType = global::alphatab.model.BrushType.ArpeggioDown;
									}
									
									break;
								}
								
								
								case "Properties":
								{
									this.parseBeatProperties(c, beat);
									break;
								}
								
								
								case "FreeText":
								{
									beat.text = this.getValue(c);
									break;
								}
								
								
								case "Dynamic":
								{
									string _g12 = this.getValue(c);
									switch (_g12)
									{
										case "PPP":
										{
											beat.dynamicValue = global::alphatab.model.DynamicValue.PPP;
											break;
										}
										
										
										case "PP":
										{
											beat.dynamicValue = global::alphatab.model.DynamicValue.PP;
											break;
										}
										
										
										case "P":
										{
											beat.dynamicValue = global::alphatab.model.DynamicValue.P;
											break;
										}
										
										
										case "MP":
										{
											beat.dynamicValue = global::alphatab.model.DynamicValue.MP;
											break;
										}
										
										
										case "MF":
										{
											beat.dynamicValue = global::alphatab.model.DynamicValue.MF;
											break;
										}
										
										
										case "F":
										{
											beat.dynamicValue = global::alphatab.model.DynamicValue.F;
											break;
										}
										
										
										case "FF":
										{
											beat.dynamicValue = global::alphatab.model.DynamicValue.FF;
											break;
										}
										
										
										case "FFF":
										{
											beat.dynamicValue = global::alphatab.model.DynamicValue.FFF;
											break;
										}
										
										
									}
									
									break;
								}
								
								
								case "GraceNotes":
								{
									string _g13 = this.getValue(c);
									switch (_g13)
									{
										case "OnBeat":
										{
											beat.graceType = global::alphatab.model.GraceType.OnBeat;
											break;
										}
										
										
										case "BeforeBeat":
										{
											beat.graceType = global::alphatab.model.GraceType.BeforeBeat;
											break;
										}
										
										
									}
									
									break;
								}
								
								
							}
							
						}
						
					}
					
				}
				
				this._beatById.@set(beatId, beat);
			}
		}
Пример #13
0
		public virtual   void parseVoice(global::haxe.root.Xml node)
		{
			unchecked 
			{
				global::alphatab.model.Voice voice = new global::alphatab.model.Voice();
				string voiceId = node.@get("id");
				{
					object __temp_iterator432 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator432, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator432, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							string _g = c._get_nodeName();
							switch (_g)
							{
								case "Beats":
								{
									this._beatsOfVoice.@set(voiceId, global::haxe.lang.StringExt.split(this.getValue(c), " "));
									break;
								}
								
								
							}
							
						}
						
					}
					
				}
				
				this._voiceById.@set(voiceId, voice);
			}
		}
Пример #14
0
		public virtual   void parseTrack(global::haxe.root.Xml node)
		{
			unchecked 
			{
				global::alphatab.model.Track track = new global::alphatab.model.Track();
				string trackId = node.@get("id");
				{
					object __temp_iterator424 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator424, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator424, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							string _g = c._get_nodeName();
							switch (_g)
							{
								case "Name":
								{
									track.name = this.getValue(c);
									break;
								}
								
								
								case "ShortName":
								{
									track.shortName = this.getValue(c);
									break;
								}
								
								
								case "Properties":
								{
									this.parseTrackProperties(track, c);
									break;
								}
								
								
								case "GeneralMidi":
								{
									this.parseGeneralMidi(track, c);
									break;
								}
								
								
								case "PlaybackState":
								{
									string state = this.getValue(c);
									track.playbackInfo.isSolo = string.Equals(state, "Solo");
									track.playbackInfo.isMute = string.Equals(state, "Mute");
									break;
								}
								
								
							}
							
						}
						
					}
					
				}
				
				this._tracksById.@set(trackId, track);
			}
		}
Пример #15
0
		public virtual   void parseDom(global::haxe.root.Xml xml)
		{
			unchecked 
			{
				if (( xml.nodeType == global::haxe.root.Xml.Document )) 
				{
					xml = xml.firstElement();
				}
				
				if (string.Equals(xml._get_nodeName(), "GPIF")) 
				{
					this.score = new global::alphatab.model.Score();
					{
						object __temp_iterator416 = xml.iterator();
						while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator416, "hasNext", 407283053, default(global::haxe.root.Array))) ))
						{
							global::haxe.root.Xml n = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator416, "next", 1224901875, default(global::haxe.root.Array))) );
							if (( n.nodeType == global::haxe.root.Xml.Element )) 
							{
								string _g = n._get_nodeName();
								switch (_g)
								{
									case "Score":
									{
										this.parseScoreNode(n);
										break;
									}
									
									
									case "MasterTrack":
									{
										this.parseMasterTrackNode(n);
										break;
									}
									
									
									case "Tracks":
									{
										this.parseTracksNode(n);
										break;
									}
									
									
									case "MasterBars":
									{
										this.parseMasterBarsNode(n);
										break;
									}
									
									
									case "Bars":
									{
										this.parseBars(n);
										break;
									}
									
									
									case "Voices":
									{
										this.parseVoices(n);
										break;
									}
									
									
									case "Beats":
									{
										this.parseBeats(n);
										break;
									}
									
									
									case "Notes":
									{
										this.parseNotes(n);
										break;
									}
									
									
									case "Rhythms":
									{
										this.parseRhythms(n);
										break;
									}
									
									
								}
								
							}
							
						}
						
					}
					
				}
				 else 
				{
					throw global::haxe.lang.HaxeException.wrap(global::alphatab.importer.ScoreImporter.UnsupportedFormat);
				}
				
				this.buildModel();
			}
		}
Пример #16
0
		public virtual   void parseTrackProperties(global::alphatab.model.Track track, global::haxe.root.Xml node)
		{
			unchecked 
			{
				{
					object __temp_iterator426 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator426, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator426, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							string _g = c._get_nodeName();
							switch (_g)
							{
								case "Property":
								{
									this.parseTrackProperty(track, c);
									break;
								}
								
								
							}
							
						}
						
					}
					
				}
				
			}
		}
Пример #17
0
		public virtual   void parseMasterBar(global::haxe.root.Xml node)
		{
			unchecked 
			{
				global::alphatab.model.MasterBar masterBar = new global::alphatab.model.MasterBar();
				{
					object __temp_iterator428 = node.iterator();
					while (((bool) (global::haxe.lang.Runtime.callField(__temp_iterator428, "hasNext", 407283053, default(global::haxe.root.Array))) ))
					{
						global::haxe.root.Xml c = ((global::haxe.root.Xml) (global::haxe.lang.Runtime.callField(__temp_iterator428, "next", 1224901875, default(global::haxe.root.Array))) );
						if (( c.nodeType == global::haxe.root.Xml.Element )) 
						{
							string _g = c._get_nodeName();
							switch (_g)
							{
								case "Time":
								{
									global::haxe.root.Array<object> timeParts = global::haxe.lang.StringExt.split(this.getValue(c), "/");
									masterBar.timeSignatureNumerator = global::Std.parseInt(global::haxe.lang.Runtime.toString(timeParts[0])).@value;
									masterBar.timeSignatureDenominator = global::Std.parseInt(global::haxe.lang.Runtime.toString(timeParts[1])).@value;
									break;
								}
								
								
								case "DoubleBar":
								{
									masterBar.isDoubleBar = true;
									break;
								}
								
								
								case "Section":
								{
									masterBar.section = new global::alphatab.model.Section();
									masterBar.section.marker = this.getValue(this.findChildElement(c, "Letter"));
									masterBar.section.text = this.getValue(this.findChildElement(c, "Text"));
									break;
								}
								
								
								case "Repeat":
								{
									if (string.Equals(c.@get("start").ToLower(), "true")) 
									{
										masterBar.isRepeatStart = true;
									}
									
									if (( string.Equals(c.@get("end").ToLower(), "true") &&  ! (string.Equals(c.@get("count"), default(string)))  )) 
									{
										masterBar.repeatCount = global::Std.parseInt(c.@get("count")).@value;
									}
									
									break;
								}
								
								
								case "AlternateEndings":
								{
									global::haxe.root.Array<object> alternateEndings = global::haxe.lang.StringExt.split(this.getValue(c), " ");
									int i = 0;
									{
										int _g2 = 0;
										int _g1 = alternateEndings.length;
										while (( _g2 < _g1 ))
										{
											int k = _g2++;
											i |= ( 1 << ( -1 + global::Std.parseInt(global::haxe.lang.Runtime.toString(alternateEndings[i])).@value ) );
										}
										
									}
									
									masterBar.alternateEndings = i;
									break;
								}
								
								
								case "Bars":
								{
									this._barsOfMasterBar.push(global::haxe.lang.StringExt.split(this.getValue(c), " "));
									break;
								}
								
								
								case "TripletFeel":
								{
									string _g11 = this.getValue(c);
									switch (_g11)
									{
										case "NoTripletFeel":
										{
											masterBar.tripletFeel = global::alphatab.model.TripletFeel.NoTripletFeel;
											break;
										}
										
										
										case "Triplet8th":
										{
											masterBar.tripletFeel = global::alphatab.model.TripletFeel.Triplet8th;
											break;
										}
										
										
										case "Triplet16th":
										{
											masterBar.tripletFeel = global::alphatab.model.TripletFeel.Triplet16th;
											break;
										}
										
										
										case "Dotted8th":
										{
											masterBar.tripletFeel = global::alphatab.model.TripletFeel.Dotted8th;
											break;
										}
										
										
										case "Dotted16th":
										{
											masterBar.tripletFeel = global::alphatab.model.TripletFeel.Dotted16th;
											break;
										}
										
										
										case "Scottish8th":
										{
											masterBar.tripletFeel = global::alphatab.model.TripletFeel.Scottish8th;
											break;
										}
										
										
										case "Scottish16th":
										{
											masterBar.tripletFeel = global::alphatab.model.TripletFeel.Scottish16th;
											break;
										}
										
										
									}
									
									break;
								}
								
								
							}
							
						}
						
					}
					
				}
				
				this._masterBars.push(masterBar);
			}
		}