public static WiringDocument CreateBlankWiringDocument(string docName) { WiringDocument wd = new WiringDocument(true, string.Empty); wd.SetName(docName); return(wd); }
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))); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); } }
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)); }
/// <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);
//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); }
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)); }
public new void Clear() { this.activeDocument = null; base.Clear(); this.documentMessages.Clear(); }
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); }
public bool EnsureActive() { if (this.activeDocument == null && this.Count() > 0) { this.activeDocument = this.GetDocument(0); } return(this.activeDocument != null); }
public override PxPre.Phonics.GenBase SpawnGenerator( float freq, float beatsPerSec, int samplesPerSec, float amp, WiringDocument spawnFrom, WiringCollection collection) { return(null); }
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)); }
protected bool RemoveDocument(WiringDocument doc) { if (this.documents.Remove(doc) == false) { return(false); } this.documentLookup.Remove(doc.guid); return(true); }
public bool ReferencesDocument(WiringDocument wd) { foreach (ParamBase pb in this.nodeParams) { if (pb.ReferencesDocument(wd) == true) { return(true); } } return(false); }
public bool ContainsDocument(WiringDocument doc) { foreach (WiringDocument docIt in this.documents) { if (docIt == doc) { return(true); } } return(false); }
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); }
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); }
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)); }
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); }
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); }
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); }
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); }
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); }
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)); }
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)); } }