public OneSample(XmlNode element) { if (element.Attributes["soundLine"] != null) { var number = uint.Parse(element.Attributes["soundLine"].Value); if (number >= Project.current.lines.Count) { throw new BadFileException(); } SoundLine = Project.current.lines[(int)number]; } else { SoundLine = Project.current.lines[0]; } length = float.Parse(element.Attributes["length"].Value, CultureInfo.InvariantCulture); offset = float.Parse(element.Attributes["offset"].Value, CultureInfo.InvariantCulture); innerOffset = float.Parse(element.Attributes["innerOffset"].Value, CultureInfo.InvariantCulture); speed = float.Parse(element.Attributes["speed"].Value, CultureInfo.InvariantCulture); if (element.Attributes["name"] != null) { Name = element.Attributes["name"].Value; } sample = SampledSound.FindByUrl(element.Attributes["src"].Value); }
public SamplePlayItem(XmlNode element) { Pitch = float.Parse(element.Attributes["pitch"].Value, CultureInfo.InvariantCulture); if (element.Attributes["playToEnd"] != null) { PlayToEnd = bool.Parse(element.Attributes["playToEnd"].Value); } if (element.Attributes["r"] != null) { R = float.Parse(element.Attributes["r"].Value, CultureInfo.InvariantCulture); } sample = SampledSound.FindByUrl(element.Attributes["src"].Value); }
internal static SampledSound FindByUrl(string url) { if (filesByPaths.ContainsKey(url)) { return(filesByPaths[url]); } else { var file = new SampledSound(url); filesByPaths[url] = file; return(file); } }
public OneSample(SampledSound sample) { this.sample = sample; Length = this.sample.Length; }