示例#1
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        if (this.input.IsConnected() == false)
        {
            return(null);
        }

        PxPre.Phonics.GenBase gb =
            this.input.Reference.SpawnGenerator(
                freq,
                beatsPerSec,
                samplesPerSec,
                amp,
                spawnFrom,
                collection);

        float timeStall = this.holdTime.GetWavelength(freq, beatsPerSec);

        return(new PxPre.Phonics.GenHold(gb, (int)(timeStall * samplesPerSec)));
    }
示例#2
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        if (this.input.IsConnected() == false)
        {
            return(ZeroGen());
        }

        PxPre.Phonics.GenBase gb =
            this.input.Reference.SpawnGenerator(
                freq,
                beatsPerSec,
                samplesPerSec,
                amp,
                spawnFrom,
                collection);

        return
            (new PxPre.Phonics.GenMAD(
                 gb,
                 this.mul.value,
                 this.add.value));
    }
示例#3
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        if (this.input.IsConnected() == false)
        {
            return(null);
        }

        PxPre.Phonics.GenBase gb =
            this.input.Reference.SpawnGenerator(
                freq,
                beatsPerSec,
                samplesPerSec,
                amp,
                spawnFrom,
                collection);

        float factor = this.factor.value;

        float integrateFactor = Mathf.Lerp(1.0f, 10.0f, factor);
        float decayFactor     = Mathf.Lerp(0.9f, 0.999f, factor);

        return(new PxPre.Phonics.GenSmear(gb, integrateFactor, decayFactor));
    }
示例#4
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        float len =
            this.release.GetWavelength(freq, beatsPerSec);


        if (this.input.IsConnected() == false)
        {
            return
                (new PxPre.Phonics.GenReleaseEmpty(
                     samplesPerSec,
                     len));
        }

        PxPre.Phonics.GenBase gb =
            this.input.Reference.SpawnGenerator(
                freq,
                beatsPerSec,
                samplesPerSec,
                amp,
                spawnFrom,
                collection);

        return
            (new PxPre.Phonics.GenRelease(
                 samplesPerSec,
                 gb,
                 len));
    }
示例#5
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        float off = this.offset.GetWavelength(freq, beatsPerSec);
        float len = this.attack.GetWavelength(freq, beatsPerSec);

        if (this.input.IsConnected() == false)
        {
            return
                (new PxPre.Phonics.GenLinAttackEmpty(
                     (int)(off * samplesPerSec),
                     (int)(len * samplesPerSec)));
        }

        PxPre.Phonics.GenBase ip =
            this.input.Reference.SpawnGenerator(
                freq,
                beatsPerSec,
                samplesPerSec,
                amp,
                spawnFrom,
                collection);



        return(new PxPre.Phonics.GenLinAttack(
                   (int)(off * samplesPerSec),
                   (int)(len * samplesPerSec),
                   ip));
    }
示例#6
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        if (this.connectionA.IsConnected() == false && this.connectionB.IsConnected() == false)
        {
            return(ZeroGen());
        }

        if (this.connectionA.IsConnected() == false)
        {
            return
                (this.connectionB.Reference.SpawnGenerator(
                     freq,
                     beatsPerSec,
                     samplesPerSec,
                     amp,
                     spawnFrom,
                     collection));
        }

        if (this.connectionB.IsConnected() == false)
        {
            return
                (this.connectionA.Reference.SpawnGenerator(
                     freq,
                     beatsPerSec,
                     samplesPerSec,
                     amp,
                     spawnFrom,
                     collection));
        }

        PxPre.Phonics.GenBase gba =
            this.connectionA.Reference.SpawnGenerator(
                freq,
                beatsPerSec,
                samplesPerSec,
                amp,
                spawnFrom,
                collection);

        PxPre.Phonics.GenBase gbb =
            this.connectionB.Reference.SpawnGenerator(
                freq,
                beatsPerSec,
                samplesPerSec,
                amp,
                spawnFrom,
                collection);

        return
            (new PxPre.Phonics.GenAdd(
                 gba,
                 gbb));
    }
示例#7
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        if (this.input.IsConnected() == false)
        {
            return(ZeroGen());
        }

        PxPre.Phonics.GenBase gb =
            this.input.Reference.SpawnGenerator(
                freq,
                beatsPerSec,
                samplesPerSec,
                amp,
                spawnFrom,
                collection);

        float len =
            this.offset.GetWavelength(freq, beatsPerSec);

        return
            (new PxPre.Phonics.GenDelay(
                 samplesPerSec,
                 gb,
                 this.voiceCt.value,
                 len,
                 this.dampen.value));
    }
示例#8
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        if (this.input.IsConnected() == false)
        {
            return(ZeroGen());
        }

        PxPre.Phonics.GenBase gb =
            this.input.Reference.SpawnGenerator(
                freq,
                beatsPerSec,
                samplesPerSec,
                amp,
                spawnFrom,
                collection);

        float offset = this.offset.GetWavelength(freq, beatsPerSec);
        float record = this.recordAmt.GetWavelength(freq, beatsPerSec);

        PxPre.Phonics.GenCycle.OffsetPass offsetType = PxPre.Phonics.GenCycle.OffsetPass.Pass;
        switch (this.offsetType.value)
        {
        default:
        case (int)PxPre.Phonics.GenCycle.OffsetPass.Pass:
            offsetType = PxPre.Phonics.GenCycle.OffsetPass.Pass;
            break;

        case (int)PxPre.Phonics.GenCycle.OffsetPass.Silent:
            offsetType = PxPre.Phonics.GenCycle.OffsetPass.Silent;
            break;

        case (int)PxPre.Phonics.GenCycle.OffsetPass.Hold:
            offsetType = PxPre.Phonics.GenCycle.OffsetPass.Hold;
            break;
        }

        return
            (new PxPre.Phonics.GenCycle(
                 (int)(offset * samplesPerSec),
                 (int)(record * samplesPerSec),
                 offsetType,
                 gb));
    }
示例#9
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        PxPre.Phonics.GenBase ret = null;

        if (this.gate.Value == true)
        {
            if (this.inputA.IsConnected() == true)
            {
                ret =
                    this.inputA.Reference.SpawnGenerator(
                        freq,
                        beatsPerSec,
                        samplesPerSec,
                        amp,
                        spawnFrom,
                        collection);
            }
        }
        else
        {
            if (this.inputB.IsConnected() == true)
            {
                ret =
                    this.inputB.Reference.SpawnGenerator(
                        freq,
                        beatsPerSec,
                        samplesPerSec,
                        amp,
                        spawnFrom,
                        collection);
            }
        }

        if (ret == null)
        {
            return(ZeroGen());
        }

        return(ret);
    }
示例#10
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        if (this.input.IsConnected() == false)
        {
            return(null);
        }

        PxPre.Phonics.GenBase gb =
            this.input.Reference.SpawnGenerator(
                freq,
                beatsPerSec,
                samplesPerSec,
                amp,
                spawnFrom,
                collection);

        if (gb != null)
        {
            switch (this.clampType.value)
            {
            case enumFull:
                return(new PxPre.Phonics.GenClampFull(gb));

            case enumPos:
                return(new PxPre.Phonics.GenClampPos(gb));

            case enumNeg:
                return(new PxPre.Phonics.GenClampNeg(gb));
            }
        }

        return(ZeroGen());
    }
示例#11
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        if (this.input.IsConnected() == false)
        {
            return
                (new PxPre.Phonics.GenADSREmpty(
                     samplesPerSec,
                     this.paramOffset.value,
                     this.paramAttackTime.value,
                     this.paramDecayTime.value,
                     this.paramSustainVal.value,
                     this.paramRelease.value));
        }

        PxPre.Phonics.GenBase gb =
            this.input.Reference.SpawnGenerator(
                freq,
                beatsPerSec,
                samplesPerSec,
                amp,
                spawnFrom,
                collection);

        return(new PxPre.Phonics.GenADSR(
                   gb,
                   samplesPerSec,
                   this.paramOffset.value,
                   this.paramAttackTime.value,
                   this.paramDecayTime.value,
                   this.paramSustainVal.value,
                   this.paramRelease.value));
    }
示例#12
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        if (this.input.IsConnected() == false)
        {
            return(null);
        }


        PxPre.Phonics.GenBase gb =
            this.input.Reference.SpawnGenerator(
                freq,
                beatsPerSec,
                samplesPerSec,
                amp,
                spawnFrom,
                collection);

        int mode = this.outputType.value;

        if (mode == enumPos)
        {
            return(new PxPre.Phonics.GenSignPos(samplesPerSec, gb));
        }
        else if (mode == enumNeg)
        {
            return(new PxPre.Phonics.GenSignNeg(samplesPerSec, gb));
        }
        else
        {
            return(new PxPre.Phonics.GenSign(samplesPerSec, gb));
        }
    }
示例#13
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        float len =
            this.duration.GetWavelength(freq, beatsPerSec);

        if (this.input.IsConnected() == false)
        {
            return
                (new PxPre.Phonics.GenLinDecayEmpty(
                     this.offset.value,
                     len,
                     this.sustain.value,
                     samplesPerSec));
        }

        PxPre.Phonics.GenBase ip =
            this.input.Reference.SpawnGenerator(
                freq,
                beatsPerSec,
                samplesPerSec,
                amp,
                spawnFrom,
                collection);

        return(new PxPre.Phonics.GenLinDecay(
                   this.offset.value,
                   len,
                   this.sustain.value,
                   samplesPerSec,
                   ip));
    }
示例#14
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        if (this.input.IsConnected() == false)
        {
            return(ZeroGen());
        }

        float f    = freq;
        float fmod = Mathf.Pow(2.0f, this.freqOff.value);

        List <PxPre.Phonics.GenBase> gens = new List <PxPre.Phonics.GenBase>();

        for (int i = 0; i < phonicCt.value; ++i)
        {
            PxPre.Phonics.GenBase gb =
                this.input.Reference.SpawnGenerator(
                    f,
                    beatsPerSec,
                    samplesPerSec,
                    amp,
                    spawnFrom,
                    collection);

            gens.Add(gb);

            amp *= this.dampen.value;
            f   *= fmod;
        }

        return(new PxPre.Phonics.GenBatch(gens.ToArray()));
    }
示例#15
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        if (this.input.IsConnected() == false)
        {
            return(ZeroGen());
        }

        PxPre.Phonics.GenBase gb =
            this.input.Reference.SpawnGenerator(
                freq,
                beatsPerSec,
                samplesPerSec,
                amp,
                spawnFrom,
                collection);

        bool passOnStut  = this.pass.value;
        bool startOnPlay = this.start.value;

        float stutterTime = this.stutterTime.GetWavelength(freq, beatsPerSec);
        float stutterPer  = this.stutterPercent.value;

        // If the parameter is set to something ineffective,
        // just bypass the stutter and optimize it out.
        if (stutterPer == 1.0f)
        {
            if (startOnPlay == true)
            {
                return(gb);
            }
            else
            {
                return(ZeroGen());
            }
        }
        if (stutterPer == 0.0f)
        {
            if (startOnPlay == true)
            {
                return(ZeroGen());
            }
            else
            {
                return(gb);
            }
        }

        int windowSamples = (int)(stutterTime * samplesPerSec);

        windowSamples = Mathf.Max(windowSamples, 2);
        //
        int playSamples = (int)(stutterPer * windowSamples);

        playSamples = Mathf.Max(playSamples, 1);
        //
        int stutterSamples = windowSamples - playSamples;


        if (passOnStut == true)
        {
            return
                (new PxPre.Phonics.GenStutterPass(
                     gb,
                     playSamples,
                     stutterSamples,
                     startOnPlay));
        }
        else
        {
            return
                (new PxPre.Phonics.GenStutterHold(
                     gb,
                     playSamples,
                     stutterSamples,
                     startOnPlay));
        }
    }
示例#16
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        if (this.connectionA.IsConnected() == false && this.connectionB.IsConnected() == false)
        {
            return(ZeroGen());
        }

        PxPre.Phonics.GenBase ga = null;
        if (this.connectionA.IsConnected() == true)
        {
            ga =
                this.connectionA.Reference.SpawnGenerator(
                    freq,
                    beatsPerSec,
                    samplesPerSec,
                    amp,
                    spawnFrom,
                    collection);
        }

        PxPre.Phonics.GenBase gb = null;
        if (this.connectionB.IsConnected() == true)
        {
            gb =
                this.connectionB.Reference.SpawnGenerator(
                    freq,
                    beatsPerSec,
                    samplesPerSec,
                    amp,
                    spawnFrom,
                    collection);
        }


        PxPre.Phonics.GenBase gf = null;
        if (this.connectionFactor.IsConnected() == true)
        {
            gf =
                this.connectionFactor.Reference.SpawnGenerator(
                    freq,
                    beatsPerSec,
                    samplesPerSec,
                    amp,
                    spawnFrom,
                    collection);
        }
        else
        {
            // If we have both inputs but no factor, return halfsies
            if (ga != null && gb == null)
            {
                gf = new PxPre.Phonics.GenConstant(0.5f);
            }
            // Or else just return which-ever is valid
            else if (ga == null)
            {
                return(gb);
            }
            else
            {
                return(ga);
            }
        }

        if (ga == null)
        {
            ga = ZeroGen();
        }

        if (gb == null)
        {
            gb = ZeroGen();
        }

        return(new PxPre.Phonics.GenLerp(ga, gb, gf));
    }