Example #1
0
        public Oscillator(OscillatorType oscType)
        {
            Name = "Oscillator";
            Type = oscType;

            randomProvider = new Random();

            InputPort    = new Port[2];
            InputPort[0] = new Port(this, 0, "f", PortType.Input);
            InputPort[1] = new Port(this, 1, "t0", PortType.Input);

            OutputPort    = new Port[1];
            OutputPort[0] = new Port(this, 0, "Out", PortType.Output);
        }
Example #2
0
        public Oscillator(XmlNode x) : this()
        {
            if (x.Attributes["a"] != null)
            {
                A = float.Parse(x.Attributes["a"].Value, CultureInfo.InvariantCulture);
            }
            if (x.Attributes["d"] != null)
            {
                D = float.Parse(x.Attributes["d"].Value, CultureInfo.InvariantCulture);
            }
            if (x.Attributes["s"] != null)
            {
                S = float.Parse(x.Attributes["s"].Value, CultureInfo.InvariantCulture);
            }
            if (x.Attributes["r"] != null)
            {
                R = float.Parse(x.Attributes["r"].Value, CultureInfo.InvariantCulture);
            }
            if (x.Attributes["randomPhase"] != null)
            {
                randomPhase = bool.Parse(x.Attributes["randomPhase"].Value);
            }
            if (x.Attributes["type"] != null)
            {
                Type = (OscillatorType)Enum.Parse(typeof(OscillatorType), x.Attributes["type"].Value);
            }

            if (x.Attributes["squareRatio"] != null)
            {
                squareRatio = float.Parse(x.Attributes["squareRatio"].Value, CultureInfo.InvariantCulture);
            }
            if (x.Attributes["volume"] != null)
            {
                volume = float.Parse(x.Attributes["volume"].Value, CultureInfo.InvariantCulture);
            }
            Pitchs.Clear();
            foreach (XmlElement pitch in x.ChildNodes)
            {
                Pitchs.Add(float.Parse(pitch.Attributes["value"].Value, CultureInfo.InvariantCulture));
            }
        }
Example #3
0
 public static float SampleOscillator(OscillatorType type, int beats)
 {
     return(m_beat.GetBeat(beats));
 }
Example #4
0
 public Oscillator(OscillatorType type, float duty = 0.5f)
 {
     Type = type;
     PulseDuty = duty;
 }