フィルタ作成クラスの共通部分を集めた抽象基底クラス。 プロパティの管理部分はこのクラスでする。
예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        public FilterGeneratorForm(FilterGenerator fg)
        {
            //
            // Windows フォーム デザイナ サポートに必要です。
            //
            InitializeComponent();

            this.generator = fg;
            //Init();
        }
예제 #4
0
		public FilterGeneratorForm(FilterGenerator fg)
		{
			//
			// Windows フォーム デザイナ サポートに必要です。
			//
			InitializeComponent();

			this.generator = fg;
			//Init();
		}
예제 #5
0
 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);
         }
     }
 }
예제 #6
0
 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);
         }
     }
 }
예제 #7
0
        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));
        }
예제 #8
0
        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));
        }
예제 #9
0
        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();
        }
예제 #10
0
        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();
        }
예제 #11
0
 public void Add(FilterGenerator gen, double gain, int delay)
 {
     this.arrayProperties[0].Add(gen, gain, delay);
 }
예제 #12
0
 public void Add(FilterGenerator gen)
 {
     this.arrayProperties[0].Add(gen);
 }
예제 #13
0
 /// <summary>
 /// XML から FilterGenerator を作成。
 /// </summary>
 /// <param name="xreader">入力</param>
 /// <returns>作成した FilterGenerator</returns>
 internal static FilterGenerator CreateFromXml(XmlElement elem)
 {
     return(FilterGenerator.CreateFromXml(elem, null));
 }
예제 #14
0
 public void SetSubfilter(int i, FilterGenerator gen)
 {
     this.arrayProperties[0][i, 0] = gen;
 }
예제 #15
0
		public void Add(FilterGenerator gen)
		{
			this.arrayProperties[0].Add(gen);
		}
예제 #16
0
파일: Basic.cs 프로젝트: ufcpp/UfcppSample
		public void SetSubfilter(int i, FilterGenerator gen)
		{
			this.arrayProperties[0][i, 0] = gen;
		}
예제 #17
0
파일: Mixer.cs 프로젝트: ufcpp/UfcppSample
		public void Add(FilterGenerator gen, double gain, int delay)
		{
			this.arrayProperties[0].Add(gen, gain, delay);
		}