void updateSplitterCount() { int cur = signal.nodes.Count; if (count > cur) { for (int i = 0; i < count - cur; i++) { splitterNodeSignalGenerator s = (Instantiate(splitterNodePrefab, transform, false) as GameObject).GetComponent <splitterNodeSignalGenerator>(); s.setup(signal, flow); signal.nodes.Add(s); s.transform.localPosition = new Vector3(-.04f * signal.nodes.Count, 0, 0); } } else { for (int i = 0; i < cur - count; i++) { signalGenerator s = signal.nodes.Last(); signal.nodes.RemoveAt(signal.nodes.Count - 1); Destroy(s.gameObject); } } handleA.localPosition = new Vector3(-.02f * signal.nodes.Count, 0, 0); handleB.localPosition = new Vector3(-.02f * signal.nodes.Count, 0, 0); handleA.localScale = new Vector3(.04f * (signal.nodes.Count + 1), 0.04f, 0.04f); handleB.localScale = new Vector3(.04f * (signal.nodes.Count + 1), 0.04f, 0.04f); }
void updateConnection(omniJack j) { if (connected == j) { return; } if (connected != null) { endConnection(); } if (manipulatorObjScript != null) { manipulatorObjScript.hapticPulse(1000); } connected = j; connected.beginConnection(this); signal = connected.homesignal; plugTrans.position = connected.transform.position; plugTrans.rotation = connected.transform.rotation; plugTrans.parent = connected.transform; plugTrans.Rotate(-90, 0, 0); plugTrans.Translate(0, 0, -.02f); }
void updateMixerCount() { int cur = signal.incoming.Count; if (count > cur) { for (int i = 0; i < count - cur; i++) { signalGenerator s = (Instantiate(mixerPrefab, transform, false) as GameObject).GetComponent <signalGenerator>(); faderList.Add(s as fader); s.transform.localPosition = new Vector3(-.03f - .04f * signal.incoming.Count, 0, 0); signal.incoming.Add(s); float fL = 1 + faderLength * 4f; faderList.Last().updateFaderLength(fL); Vector3 pos = faderList.Last().transform.localPosition; pos.z = -.12f * fL + .12f; faderList.Last().transform.localPosition = pos; } } else // count < cur { for (int i = 0; i < cur - count; i++) { signalGenerator s = signal.incoming.Last(); faderList.RemoveAt(signal.incoming.Count - 1); signal.incoming.RemoveAt(signal.incoming.Count - 1); Destroy(s.gameObject); } } }
public void setFlow(bool on) { flow = on; if (flow) { symbolquad.transform.localPosition = new Vector3(.00075f, -.0016f, .0217f); symbolquad.transform.localRotation = Quaternion.Euler(0, 180, 0); symbolquadB.transform.localPosition = new Vector3(.00075f, -.0016f, -.0217f); symbolquadB.transform.localRotation = Quaternion.Euler(0, 180, 0); } else { symbolquad.transform.localPosition = new Vector3(.0025f, .0012f, .0217f); symbolquadB.transform.localPosition = new Vector3(.0025f, .0012f, -.0217f); symbolquad.transform.localRotation = Quaternion.Euler(0, 0, 90); symbolquadB.transform.localRotation = Quaternion.Euler(0, 0, 90); } if (jack.near != null) { jack.near.Destruct(); jack.signal = null; } jack.outgoing = flow; if (flow) { sig = mainSig; } else { sig = jack.signal; } }
void Update() { if (input.signal != incoming) { incoming = input.signal; } statusObject.SetActive(noteOn); }
void Update() { if (input.signal != externalPulse) { externalPulse = input.signal; } //**TODO implement input overrides for dials from sound source if (colorPercentRed != colorDialRed.percent) { UpdateColor(); } if (colorPercentBlue != colorDialBlue.percent) { UpdateColor(); } if (colorPercentGreen != colorDialGreen.percent) { UpdateColor(); } if (locationX != locationDialX.percent) { UpdateLocation(); } if (locationY != locationDialY.percent) { UpdateLocation(); } if (locationZ != locationDialZ.percent) { UpdateLocation(); } if (rotationX != rotationDialX.percent) { UpdateRotation(); } if (rotationY != rotationDialY.percent) { UpdateRotation(); } if (rotationZ != rotationDialZ.percent) { UpdateRotation(); } float newIntensity = vol * intensityMultiplier; if (newIntensity > maxIntensityDial.percent * maxIntensity) { newIntensity = maxIntensityDial.percent * maxIntensity; } targetLight.intensity = newIntensity; }
public void beginConnection(omniPlug plug) { near = plug; far = plug.otherPlug; if (!outgoing && near.otherPlug.signal != null) { signal = near.otherPlug.signal; } }
public override void Awake() { sig = mainSig; jack = GetComponentInChildren <omniJack>(); symbolquad.material.SetTexture("_MainTex", flowTex); symbolquad.material.SetColor("_TintColor", Color.HSVToRGB(0.1f, .62f, .7f)); symbolquadB.material.SetTexture("_MainTex", flowTex); symbolquadB.material.SetColor("_TintColor", Color.HSVToRGB(0.1f, .62f, .7f)); }
void Update() { if (incomingA != inputA.signal) { incomingA = inputA.signal; } if (incomingB != inputB.signal) { incomingB = inputB.signal; } }
void Awake() { signal = transform.parent.GetComponent <signalGenerator>(); if (speakerRim != null) { rimMat = speakerRim.GetComponent <Renderer>().material; rimMat.SetFloat("_EmissionGain", .45f); speakerRim.SetActive(false); } }
void Update() { if (flow) { return; } if (sig != jack.signal) { sig = jack.signal; } }
void Update() { float mod = dirSwitch.switchVal ? 1 : -1; if (dirSwitch.switchVal != player.playdirection) { player.playdirection = dirSwitch.switchVal; } player.playbackSpeed = Mathf.Pow(speedDial.percent, 2) * 4 * mod; player.amplitude = volumeDial.percent * 2; if (loopSwitch.switchVal != player.looping) { player.looping = loopSwitch.switchVal; } if (player.speedGen != speedInput.signal) { player.speedGen = speedInput.signal; } if (player.ampGen != volumeInput.signal) { player.ampGen = volumeInput.signal; } if (player.seqGen != controlInput.signal) { player.seqGen = controlInput.signal; } if (seq != controlInput.signal) { seq = controlInput.signal; } if (tailSlider.percent != player.trackBounds.y) { player.trackBounds.y = tailSlider.percent; player.updateTrackBounds(); } if (headSlider.percent != player.trackBounds.x) { player.trackBounds.x = headSlider.percent; player.updateTrackBounds(); } tailSlider.bounds.y = headSlider.transform.localPosition.x; headSlider.bounds.x = tailSlider.transform.localPosition.x; }
void Update() { if (input.signal != externalPulse) { externalPulse = input.signal; } if (hits > 0) { if (hits % 2 != 0) { toggleRealCam(!broadcasting); } hits = 0; } }
void Update() { if (input.signal != incoming) { incoming = input.signal; } if (updateDesired) { float val = (curValue + 1) / 2f; percentQuad.localScale = new Vector3(val, 1, 1); percentQuad.localPosition = new Vector3((1 - val) / 2f, 0, 0); updateDesired = false; } }
void Update() { SelectStepUpdate(); dimensions[0] = Mathf.CeilToInt((stretchNode.localPosition.x + cubeConst * .75f) / -cubeConst); dimensions[1] = Mathf.CeilToInt((stretchNode.localPosition.y + cubeConst * .75f) / -cubeConst); if (dimensions[0] < 1) { dimensions[0] = 1; } if (dimensions[1] < 1) { dimensions[1] = 1; } if (dimensions[0] > max) { dimensions[0] = max; } if (dimensions[1] > max) { dimensions[1] = max; } UpdateDimensions(); UpdateStepSelect(); if (beatSpeed != beatSlider.switchVal) { beatSpeed = beatSlider.switchVal; _beatManager.updateBeatNoTriplets(beatSpeed); } if (swingPercent != swingDial.percent) { swingPercent = swingDial.percent; _beatManager.updateSwing(swingPercent); } if (externalPulse != controlInput.signal) { externalPulse = controlInput.signal; _beatManager.toggleMC(externalPulse == null); if (externalPulse != null) { forcePlay(false); } } }
void Update() { if (speakerOut.near == null) { curSignal = signal; } else { curSignal = null; } if (prevSignal != curSignal) { output.incoming = prevSignal = curSignal; updateSpeaker(); } }
void Update() { if (outgoing) { return; } if (near == null) { signal = null; return; } if (near.otherPlug.connected == null) { signal = null; } else if (signal != near.otherPlug.signal) { signal = near.otherPlug.signal; } }
public void Activate(omniPlug siblingPlug, omniJack jackIn, Vector3[] tempPath, Color tempColor) { float h, s, v; Color.RGBToHSV(tempColor, out h, out s, out v); Color c1 = Color.HSVToRGB(h, .8f, .5f); Color c2 = Color.HSVToRGB(h, .8f, .2f); cordColor = tempColor; lr.material.SetColor("_TintColor", c2); mat.SetColor("_TintColor", c1); mouseoverFeedback.GetComponent <Renderer>().material.SetColor("_TintColor", c1); if (outputPlug) { plugPath = tempPath.ToList <Vector3>(); updateLineVerts(); calmTime = 1; } otherPlug = siblingPlug; connected = jackIn; connected.beginConnection(this); signal = connected.homesignal; plugTrans.position = connected.transform.position; plugTrans.rotation = connected.transform.rotation; plugTrans.parent = connected.transform; plugTrans.Rotate(-90, 0, 0); plugTrans.Translate(0, 0, -.02f); transform.parent = plugTrans.parent; transform.position = plugTrans.position; transform.rotation = plugTrans.rotation; plugTrans.parent = transform; lastOtherPlugPos = otherPlug.plugTrans.transform.position; lastPos = transform.position; }
IEnumerator SaveRoutine(string filename, float[] clip, int length, TextMesh txt, signalGenerator sig) { txt.gameObject.SetActive(true); txt.text = "Saving..."; FileStream _filestream = new FileStream(filename, FileMode.Create); BinaryWriter _binarystream = new BinaryWriter(_filestream); WavHeader(_binarystream, length); CompressClip(clip, clip.Length); int counter = 0; for (int i = 0; i < length; i++) { Int16 sample = Convert.ToInt16( Mathf.Clamp(clip[i],-1f,1f) * 32760 ); _binarystream.Write((short)sample); counter++; if (counter > 10000) { counter = 0; txt.text = "Saving... " + (int)(100 * (float)i / length) + "% Complete"; yield return null; } } _binarystream.Close(); _filestream.Close(); txt.text = "Saved"; sampleManager.instance.AddRecording(filename); txt.text = "Saved"; savingInProgress = false; txt.gameObject.SetActive(false); sig.updateTape(filename); yield return new WaitForSeconds(1.5f); }
void Update() { if (input.signal != externalPulse) { externalPulse = input.signal; } targetBay.SetActive(activated); //**TODO implement input overrides for dials from sound source if (colorPercentRed != colorDialRed.percent) { UpdateColor(); } if (colorPercentBlue != colorDialBlue.percent) { UpdateColor(); } if (colorPercentGreen != colorDialGreen.percent) { UpdateColor(); } if (locationX != locationDialX.percent) { UpdateLocation(); } if (locationY != locationDialY.percent) { UpdateLocation(); } if (locationZ != locationDialZ.percent) { UpdateLocation(); } if (rotationX != rotationDialX.percent) { UpdateRotation(); } if (rotationY != rotationDialY.percent) { UpdateRotation(); } if (rotationZ != rotationDialZ.percent) { UpdateRotation(); } float newIntensity = vol * intensityMultiplier; if (newIntensity > maxIntensityDial.percent * maxIntensity) { newIntensity = maxIntensityDial.percent * maxIntensity; } targetParticles.GetComponent <ParticleSea>().yAnimSpeed = newIntensity; targetParticles.GetComponent <ParticleSea>().xAnimSpeed = newIntensity; targetParticles.GetComponent <ParticleSea>().x_meshSpacing = newIntensity; targetParticles.GetComponent <ParticleSea>().y_meshSpacing = newIntensity; targetParticles.GetComponent <ParticleSea>().meshHeightScale = newIntensity; }
public Coroutine Save(string filename, float[] clip, int channels, int length, TextMesh txt, signalGenerator sig) { savingInProgress = true; if (!filename.ToLower().EndsWith(".wav")) filename += ".wav"; return StartCoroutine(SaveRoutine(filename, clip, length, txt, sig)); }
public void setup(signalGenerator s, bool f) { sig = mainSig = s; setFlow(f); }
void Update() { bool updated = false; lock (_spawnLock) { if (toSpawn.Keys.Count > 0) { foreach (KeyValuePair <int, Vector2> entry in toSpawn) { SpawnTimelineEvent(entry.Key, entry.Value); } toSpawn.Clear(); } } if (heightHandle != null) { if (heightHandle.transform.localPosition.y != _gridParams.getGridHeight()) { _gridParams.setTrackHeight(heightHandle.transform.localPosition.y); updateHeight(); refreshGrid(); } } if (unitSlider.switchVal != _gridParams.snapResolution) { _gridParams.updateUnitResolution(unitSlider.switchVal); _timelineGridRender.updateGrid(_gridParams); } overdub = overdubSwitch.switchVal; notelock = notelockSwitch.switchVal; if (snapSwitch.switchVal != snapping) { snapping = snapSwitch.switchVal; for (int i = 0; i < _tlEvents.Count; i++) { _tlEvents[i].updateSnap(snapping); } } _timelinePlayer.looping = loopSwitch.switchVal; if (playInput.signal != playSignal) { playSignal = playInput.signal; } if (recInput.signal != recSignal) { recSignal = recInput.signal; } if (tailMarkerHandle.curState == manipObject.manipState.grabbed) { if (tailMarkerHandle.transform.localPosition.x < gridHandle.transform.localPosition.x) { Vector3 pos = gridHandle.transform.localPosition; pos.x = tailMarkerHandle.transform.localPosition.x; gridHandle.transform.localPosition = pos; if (gridHandle.curState == manipObject.manipState.grabbed) { gridHandle.recalcOffset(); } updated = true; } _gridParams.head_tail.y = Mathf.RoundToInt(_gridParams.XtoUnit(tailMarkerHandle.transform.localPosition.x)); Vector3 p1 = tailMarkerLine.localPosition; p1.x = _gridParams.UnittoX(_gridParams.head_tail.y); tailMarkerLine.localPosition = p1; headMarkerHandle.xBounds.x = p1.x + _gridParams.unitSize; } else if (tailMarkerHandle.transform.localPosition.x != tailMarkerLine.localPosition.x) { Vector3 p1 = tailMarkerHandle.transform.localPosition; p1.x = tailMarkerLine.localPosition.x; tailMarkerHandle.transform.localPosition = p1; } if (headMarkerHandle.curState == manipObject.manipState.grabbed) { _gridParams.head_tail.x = Mathf.RoundToInt(_gridParams.XtoUnit(headMarkerHandle.transform.localPosition.x)); Vector3 p1 = headMarkerLine.localPosition; p1.x = _gridParams.UnittoX(_gridParams.head_tail.x); headMarkerLine.localPosition = p1; tailMarkerHandle.xBounds.y = p1.x - _gridParams.unitSize; } else if (headMarkerHandle.transform.localPosition.x != headMarkerLine.localPosition.x) { Vector3 p1 = headMarkerHandle.transform.localPosition; p1.x = headMarkerLine.localPosition.x; headMarkerHandle.transform.localPosition = p1; } if (gridHandle.curState == manipObject.manipState.grabbed) { updated = true; } if (updated) { _scrollInterface.handleUpdate(gridHandle.transform.localPosition.x); } }