/// <summary> /// XML から FilterGenerator を作成。 /// </summary> /// <param name="xreader">入力</param> /// <returns>作成した FilterGenerator</returns> internal static FilterGenerator CreateFromXml(XmlElement elem, Converter converter) { Assembly asm = Assembly.GetExecutingAssembly(); FilterGenerator gen = (FilterGenerator)asm.CreateInstance("SoundLibrary.Filter." + elem.LocalName + "Generator"); if (gen == null) { throw new NotSupportedException("SoundLibrary.Filter." + elem.LocalName + " は実装されていません。"); } if (converter != null) { gen.converter = converter; } XmlAttribute att; att = elem.Attributes["samplingRate"]; if (att != null) { gen.SamplingRate = double.Parse(att.Value); } att = elem.Attributes["dB"]; if (att != null) { gen.IsDB = att.Value == "true"; } gen.FromXml(elem); return(gen); }
/// <summary> /// XML ファイル内のフィルタ構成情報から FilterGenerator を作成。 /// </summary> /// <param name="filename">XML ファイル名</param> /// <returns>作成した FilterGenerator</returns> public static FilterGenerator CreateFromXml(string filename, Converter converter) { XmlDocument xdoc = new XmlDocument(); xdoc.Load(filename); FilterGenerator gen = CreateFromXml(xdoc.DocumentElement, converter); return(gen); }
public FilterGeneratorForm(FilterGenerator fg) { // // Windows フォーム デザイナ サポートに必要です。 // InitializeComponent(); this.generator = fg; //Init(); }
public override void FromXml(XmlElement elem) { foreach (XmlNode node in elem.ChildNodes) { if (node is XmlElement) { FilterGenerator gen = FilterGenerator.CreateFromXml((XmlElement)node, this.converter); this.Add(gen); } } }
public override void FromXml(XmlElement elem) { foreach (XmlNode node in elem.ChildNodes) { if (node is XmlElement) { double gain = this.converter.ToPower(node.Attributes["gain"].Value); FilterGenerator gen = FilterGenerator.CreateFromXml((XmlElement)node.FirstChild, this.converter); this.Add(gen, gain); } } }
public override IFilter GetFilter() { int len = this.Length; IFilter[] filters = new IFilter[len]; for (int i = 0; i < len; ++i) { FilterGenerator gen = this.GetSubfilter(i); filters[i] = gen.GetFilter(); } return(new SerialConnector(filters)); }
public override IFilter GetFilter() { int len = this.Length; Mixer.Tuple[] tuples = new Mixer.Tuple[len]; for (int i = 0; i < len; ++i) { double gain = this.GetGain(i); FilterGenerator gen = this.GetSubfilter(i); IFilter filter = gen.GetFilter(); tuples[i] = new Mixer.Tuple(filter, gain); } return(new Mixer(tuples)); }
public override void ToXml(XmlWriter xwriter) { xwriter.WriteStartElement("SerialConnector"); int len = this.Length; for (int i = 0; i < len; ++i) { FilterGenerator gen = this.GetSubfilter(i); gen.ToXml(xwriter); } xwriter.WriteEndElement(); }
public override void ToXml(XmlWriter xwriter) { xwriter.WriteStartElement("Mixer"); int len = this.Length; for (int i = 0; i < len; ++i) { xwriter.WriteStartElement("Filter"); xwriter.WriteAttributeString("gain", this.GetGain(i).ToString()); FilterGenerator gen = this.GetSubfilter(i); gen.ToXml(xwriter); xwriter.WriteEndElement(); } xwriter.WriteEndElement(); }
public void Add(FilterGenerator gen, double gain, int delay) { this.arrayProperties[0].Add(gen, gain, delay); }
public void Add(FilterGenerator gen) { this.arrayProperties[0].Add(gen); }
/// <summary> /// XML から FilterGenerator を作成。 /// </summary> /// <param name="xreader">入力</param> /// <returns>作成した FilterGenerator</returns> internal static FilterGenerator CreateFromXml(XmlElement elem) { return(FilterGenerator.CreateFromXml(elem, null)); }
public void SetSubfilter(int i, FilterGenerator gen) { this.arrayProperties[0][i, 0] = gen; }