void OnGUI() { float x = 0; float y = 0; float btnWidth = Screen.width * .4f; float btnHeight = btnWidth * .2f; float margin = 20.0f; if (!patchOpened) { if (GUI.Button(new Rect(x, y, btnWidth, btnHeight), "Open Patch")) { patchOpened = true; libPd.OpenPatch(patch, id => patchId = id); libPd.LoadClip("sample0", clip, "sample_length"); libPd.Subscribe("frequency"); } } else if (patchId != -1 && GUI.Button(new Rect(x, y, btnWidth, btnHeight), "Close patch")) { libPd.ClosePatch(patchId); patchOpened = false; } y += btnHeight + margin; GUI.Label(new Rect(x, y, btnWidth, btnHeight), "Pitch:"); y += margin; pitch = GUI.HorizontalSlider(new Rect(x, y, btnWidth, btnHeight), pitch, .0f, 1.0f); libPd.SendFloat("pitch", pitch); Debug.Log("STREAM OF FLOATS: " + LibPD.receivedFloatValue); }
void Dispose(bool isDisposing) { LibPD.Unsubscribe(DoneReceiver); LibPD.ComputeAudio(false); if (_patchHandle > 0) { LibPD.ClosePatch(_patchHandle); } }
public void Close(params string[] patchesName) { foreach (string patchName in patchesName) { if (patches.ContainsKey(patchName)) { LibPD.ClosePatch(patches[patchName]); patches.Remove(patchName); } } }
void Dispose(bool isDisposing) { // Unsubscribe from all message receivers LibPD.Unsubscribe(CursorReceiver); LibPD.Float -= LibPd_Float; // Disable audio LibPD.ComputeAudio(false); if (_patchHandle > 0) { // Close patch LibPD.ClosePatch(_patchHandle); } LibPD.Release(); }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects). } LibPD.ClosePatch(patchSystemId); LibPD.Release(); // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
void OnGUI() { float x = 0; float y = 0; float btnWidth = Screen.width * .4f; float btnHeight = btnWidth * .2f; float margin = 20.0f; if (!patchOpened) { if (GUI.Button(new Rect(x, y, btnWidth, btnHeight), "Open Patch")) { patchOpened = true; libPd.OpenPatch(patch, id => patchId = id); libPd.Subscribe("frequency"); /* * Microphone stream */ var audio = GetComponent <AudioSource>(); audio.clip = Microphone.Start("Built-in Microphone", true, 1, 44100); audio.loop = true; while (!(Microphone.GetPosition(null) > 0)) { } audio.Play(); libPd.SendFloat("metroOnOff", 1); // Turn frequency snapshots ON } } else if (patchId != -1 && GUI.Button(new Rect(x, y, btnWidth, btnHeight), "Close Patch")) { libPd.ClosePatch(patchId); patchOpened = false; } y += btnHeight + margin; GUI.Label(new Rect(x, y, btnWidth, btnHeight), "Pitch:"); y += margin; inputGain = GUI.HorizontalSlider(new Rect(x, y, btnWidth, btnHeight), inputGain, .0f, 1.0f); libPd.SendFloat("inputGain", inputGain); Debug.Log("STREAM OF FLOATS: " + LibPD.receivedFloatValue); }
public bool closePatch(int patchHandle) { return(LibPD.ClosePatch(patchHandle)); }
public void closePatch() { //LibPD.Print -= Receive; LibPD.ClosePatch(SPatch); LibPD.Release(); }
// Close patch and release Pd on quit void OnDestroy() { LibPD.ClosePatch(patchHandle); LibPD.Release(); }