コード例 #1
0
ファイル: TestLibPD.cs プロジェクト: etienne-p/UnityLibPD
    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);
    }
コード例 #2
0
 void Dispose(bool isDisposing)
 {
     LibPD.Unsubscribe(DoneReceiver);
     LibPD.ComputeAudio(false);
     if (_patchHandle > 0)
     {
         LibPD.ClosePatch(_patchHandle);
     }
 }
コード例 #3
0
ファイル: PDPatchManager.cs プロジェクト: Dracir/semicolon
 public void Close(params string[] patchesName)
 {
     foreach (string patchName in patchesName)
     {
         if (patches.ContainsKey(patchName))
         {
             LibPD.ClosePatch(patches[patchName]);
             patches.Remove(patchName);
         }
     }
 }
コード例 #4
0
 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();
 }
コード例 #5
0
        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;
            }
        }
コード例 #6
0
    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);
    }
コード例 #7
0
ファイル: LibPdFilterRead.cs プロジェクト: AVUIs/wat
 public bool closePatch(int patchHandle)
 {
     return(LibPD.ClosePatch(patchHandle));
 }
コード例 #8
0
 public void closePatch()
 {
     //LibPD.Print -= Receive;
     LibPD.ClosePatch(SPatch);
     LibPD.Release();
 }
コード例 #9
0
ファイル: PatchPlayer.cs プロジェクト: ozansarier/unipd
 // Close patch and release Pd on quit
 void OnDestroy()
 {
     LibPD.ClosePatch(patchHandle);
     LibPD.Release();
 }