コード例 #1
0
    public static WiringDocument CreateBlankWiringDocument(string docName)
    {
        WiringDocument wd = new WiringDocument(true, string.Empty);

        wd.SetName(docName);
        return(wd);
    }
コード例 #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(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)));
    }
コード例 #3
0
ファイル: LLDNReference.cs プロジェクト: Reavenk/Phonics_Core
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        if (string.IsNullOrEmpty(reference.referenceGUID) == true)
        {
            return(ZeroGen());
        }

        WiringDocument wd = collection.GetDocument(reference.referenceGUID);

        // The last one is a check against cyclic redundancy. There are
        // other things that prevent this, but if for some reason those
        // fail, we check one last time and just shut down the process
        // with a zero signal.
        if (wd == null || wd.Output == null || wd == spawnFrom)
        {
            return(ZeroGen());
        }

        return
            (wd.Output.SpawnGenerator(
                 freq,
                 beatsPerSec,
                 samplesPerSec,
                 amp,
                 spawnFrom,
                 collection));
    }
コード例 #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
ファイル: LLDNDelay.cs プロジェクト: Reavenk/Phonics_Core
    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));
    }
コード例 #6
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));
    }
コード例 #7
0
ファイル: LLDNSmear.cs プロジェクト: Reavenk/Phonics_Core
    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));
    }
コード例 #8
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        float useFreq =
            this.timeLen.GetFrequency(
                freq,
                beatsPerSec);

        float finalGain = amp * this.gain.value;

        if (finalGain == 1.0f)
        {
            return
                (new PxPre.Phonics.GenSawtoothWaveUnit(
                     useFreq,
                     0.0,
                     samplesPerSec));
        }
        else
        {
            return
                (new PxPre.Phonics.GenSawtoothWave(
                     useFreq,
                     0.0,
                     samplesPerSec,
                     finalGain));
        }
    }
コード例 #9
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));
    }
コード例 #10
0
 /// <summary>
 /// Create a GenBase based off the node's parameters and connections.
 /// </summary>
 /// <param name="freq">The frequency of the note being generated.</param>
 /// <param name="beatsPerSec">The BPM of the node.</param>
 /// <param name="samplesPerSec">The samples per second of the PCM being generated.</param>
 /// <param name="amp">The amplitude generators should generate at.</param>
 /// <returns>The GenBase generator.</returns>
 public abstract PxPre.Phonics.GenBase SpawnGenerator(
     float freq,
     float beatsPerSec,
     int samplesPerSec,
     float amp,
     WiringDocument spawnFrom,
     WiringCollection collection);
コード例 #11
0
    //public bool RemoveNodeFromActive(GNBase node, bool removeConnections)
    //{
    //    if(this.activeDocument == null)
    //        return false;
    //
    //    return this.activeDocument.RemoveNode(node, removeConnections);
    //}

    public bool RemoveDocument(WiringDocument doc, bool resetActive = true)
    {
        if (doc == null)
        {
            return(false);
        }

        if (base.RemoveDocument(doc) == false)
        {
            return(false);
        }

        if (this.activeDocument == doc)
        {
            this.activeDocument = null;
            if (resetActive == true)
            {
                if (this.Count() > 0)
                {
                    this.activeDocument = this.GetDocument(0);
                }
            }
        }
        return(true);
    }
コード例 #12
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));
    }
コード例 #13
0
    public new void Clear()
    {
        this.activeDocument = null;

        base.Clear();

        this.documentMessages.Clear();
    }
コード例 #14
0
ファイル: LLDNOutput.cs プロジェクト: Reavenk/Phonics_Core
    public bool TreeAppearsValid(WiringCollection wc, WiringDocument owner)
    {
        if (this.conInput.IsConnected() == false)
        {
            return(false);
        }

        Queue <LLDNBase> toScan = new Queue <LLDNBase>();

        toScan.Enqueue(this.conInput.Reference);

        while (toScan.Count > 0)
        {
            LLDNBase f = toScan.Dequeue();
            if (f.CanMakeNoise() == true)
            {
                return(true);
            }

            if (f.nodeType == NodeType.Reference && wc != null)
            {
                LLDNReference refr = f as LLDNReference;
                if (refr != null && string.IsNullOrEmpty(refr.reference.referenceGUID) == false && owner != null)
                {
                    WiringDocument refWD = wc.GetDocument(refr.reference.referenceGUID);
                    if (refWD != null)
                    {
                        if (refWD == owner)
                        {
                            return(false);
                        }

                        if (refWD.Output != null)
                        {
                            toScan.Enqueue(refWD.Output);
                        }
                    }
                }
            }

            foreach (ParamConnection pc in f.GetParamConnections())
            {
                if (pc.IsConnected() == false)
                {
                    continue;
                }

                if (f.VerifyConnectionUsed(pc) == false)
                {
                    continue;
                }

                toScan.Enqueue(pc.Reference);
            }
        }

        return(false);
    }
コード例 #15
0
    public bool EnsureActive()
    {
        if (this.activeDocument == null && this.Count() > 0)
        {
            this.activeDocument = this.GetDocument(0);
        }

        return(this.activeDocument != null);
    }
コード例 #16
0
ファイル: LLDNHighlight.cs プロジェクト: Reavenk/Phonics_Core
 public override PxPre.Phonics.GenBase SpawnGenerator(
     float freq,
     float beatsPerSec,
     int samplesPerSec,
     float amp,
     WiringDocument spawnFrom,
     WiringCollection collection)
 {
     return(null);
 }
コード例 #17
0
 public override PxPre.Phonics.GenBase SpawnGenerator(
     float freq,
     float beatsPerSec,
     int samplesPerSec,
     float amp,
     WiringDocument spawnFrom,
     WiringCollection collection)
 {
     return(new PxPre.Phonics.GenConstant(this.floatVal.value));
 }
コード例 #18
0
    protected bool RemoveDocument(WiringDocument doc)
    {
        if (this.documents.Remove(doc) == false)
        {
            return(false);
        }

        this.documentLookup.Remove(doc.guid);
        return(true);
    }
コード例 #19
0
 public bool ReferencesDocument(WiringDocument wd)
 {
     foreach (ParamBase pb in this.nodeParams)
     {
         if (pb.ReferencesDocument(wd) == true)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #20
0
 public bool ContainsDocument(WiringDocument doc)
 {
     foreach (WiringDocument docIt in this.documents)
     {
         if (docIt == doc)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #21
0
    public bool InsertDocument(WiringDocument wd, int idx)
    {
        if (this.documentLookup.ContainsKey(wd.guid))
        {
            return(false);
        }

        this.documents.Insert(idx, wd);
        this.documentLookup.Add(wd.guid, wd);

        return(true);
    }
コード例 #22
0
    protected bool AddDocument(WiringDocument wd)
    {
        if (this.documentLookup.ContainsKey(wd.guid))
        {
            return(false);
        }

        this.documents.Add(wd);
        this.documentLookup.Add(wd.guid, wd);

        return(true);
    }
コード例 #23
0
ファイル: LLDNCycle.cs プロジェクト: Reavenk/Phonics_Core
    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));
    }
コード例 #24
0
    public bool SetActiveDocument(WiringDocument doc, bool ignoreCurrent = true)
    {
        if (ignoreCurrent == true && doc == this.activeDocument)
        {
            return(false);
        }

        if (this.ContainsDocument(doc) == false)
        {
            return(false);
        }

        this.activeDocument = doc;
        return(true);
    }
コード例 #25
0
    public bool ReferencesDocument(WiringDocument wd, bool includeSelf = true)
    {
        if (includeSelf == true && wd == this)
        {
            return(true);
        }

        foreach (LLDNBase gnb in this.generators)
        {
            if (gnb.ReferencesDocument(wd) == true)
            {
                return(true);
            }
        }
        return(false);
    }
コード例 #26
0
ファイル: LLDNGate.cs プロジェクト: Reavenk/Phonics_Core
    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);
    }
コード例 #27
0
    public WiringDocument AddNewWiringDocument(string docName, bool setActive)
    {
        WiringDocument wd = new WiringDocument(true, string.Empty);

        wd.SetName(docName);

        if (this.AddDocument(wd) == false)
        {
            return(null);
        }

        if (setActive == true)
        {
            this.SetActiveDocument(wd);
        }

        return(wd);
    }
コード例 #28
0
    public bool RepositionIndex(int prevPos, int newPos)
    {
        if (prevPos < 0 || newPos < 0)
        {
            return(false);
        }

        if (prevPos >= this.documents.Count || newPos >= this.documents.Count)
        {
            return(false);
        }

        WiringDocument doc = this.documents[prevPos];

        this.documents.RemoveAt(prevPos);
        this.documents.Insert(newPos, doc);

        return(true);
    }
コード例 #29
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        float useFreq =
            this.timeLen.GetFrequency(
                freq,
                beatsPerSec);

        return
            (new PxPre.Phonics.GenTriangleWave(
                 useFreq,
                 samplesPerSec,
                 amp * this.gain.value));
    }
コード例 #30
0
    public override PxPre.Phonics.GenBase SpawnGenerator(
        float freq,
        float beatsPerSec,
        int samplesPerSec,
        float amp,
        WiringDocument spawnFrom,
        WiringCollection collection)
    {
        float finalGain = amp * this.gain.value;

        if (finalGain == 1.0f)
        {
            return(new PxPre.Phonics.GenWhiteUnit());
        }
        else
        {
            return(new PxPre.Phonics.GenWhite(finalGain));
        }
    }