public PdOperation(string filePath) { _patchHandle = LibPD.OpenPatch(filePath); LibPD.Bang += LibPD_Bang; LibPD.Subscribe(DoneReceiver); LibPD.OpenAudio(0, 2, SampleRate); LibPD.ComputeAudio(true); }
public static void loadPatch() { SDllHandle = LoadLibrary("libpdcsharp.dll"); LibPD.ReInit(); LibPD.OpenAudio(2, 3, 44100); SPatch = LibPD.OpenPatch(@"..\..\test_csharp.pd"); LibPD.ComputeAudio(true); }
private int OpenPd() { int bufferSize; int noOfBuffers; AudioSettings.GetDSPBufferSize(out bufferSize, out noOfBuffers); numberOfTicks = bufferSize / LibPD.BlockSize; int unitySR = AudioSettings.outputSampleRate; return(LibPD.OpenAudio(2, 2, unitySR)); }
void OpenAudio() { if (LibPD.OpenAudio(2, 2, sampleRate) == 0) { initialized = true; } else { Logger.LogError("Failed to start LibPD."); } }
/// <summary> /// Sets up communication with libPd. /// </summary> void SetUpPd() { // Open Pd file _patchHandle = LibPD.OpenPatch("../../pd/test.pd"); // Subscribe to receiver LibPD.Float += LibPd_Float; LibPD.Subscribe(CursorReceiver); // Set up audio format for Pd LibPD.OpenAudio(0, 2, SampleRate); // Start audio LibPD.ComputeAudio(true); }
public static void loadPatch() { if (loader == null) { loader = IsLinux() ? (IDllLoader) new LinuxDllLoader() : (IDllLoader) new WindowsDllLoader(); } SDllHandle = loader.LoadLibrary("libpdcsharp." + (IsLinux() ? "so" : "dll")); LibPD.ReInit(); LibPD.OpenAudio(2, 3, 44100); SPatch = LibPD.OpenPatch(@"../../test_csharp.pd"); LibPD.ComputeAudio(true); }
public void loadPatch() { Debug.Log("Load patch:" + path); // we can also work in stereo or more: LibPD.OpenAudio (2, 2, 48000); if (!islibpdready) { LibPD.OpenAudio(1, 1, 48000); } SPatch = LibPD.OpenPatch(path); LibPD.ComputeAudio(true); islibpdready = true; //LibPD.Print += Receive; }
// Initialise Pd with Unity's sample rate and calculate number of ticks. Returns 0 on success. public int initPd() { int bufferSize; int noOfBuffers; AudioSettings.GetDSPBufferSize(out bufferSize, out noOfBuffers); // Calculate number of ticks for process callback numberOfTicks = bufferSize / LibPD.BlockSize; // Get Unity's sample rate int unitySR = AudioSettings.outputSampleRate; // Initialise Pd with 2 ins and outs and Unity's samplerate. Project dependent. return(LibPD.OpenAudio(2, 2, unitySR)); }
// Startup audio engine public static void Startup() { LibPD.ReInit(); LibPD.Print += printCallback; LibPD.Float += floatCallback; LibPD.Bang += bangCallback; LibPD.OpenAudio(1, 2, 44100); LibPD.ComputeAudio(true); handle = LibPD.OpenPatch("patch/soundsystem.pd"); PortAudio.Pa_Initialize(); PortAudio.Pa_OpenDefaultStream(out stream, 1, 2, (uint)PortAudio.PaSampleFormat.paFloat32, 44100, 256, renderCallback, (IntPtr)null); PortAudio.Pa_StartStream(stream); }
// Initialise Pd with Unity's sample rate and calculate number of ticks. Returns 0 on success. public int openPd() { int bufferSize; int noOfBuffers; AudioSettings.GetDSPBufferSize(out bufferSize, out noOfBuffers); // Calculate number of ticks for process callback numberOfTicks = bufferSize / LibPD.BlockSize; // Get Unity's sample rate int unitySR = AudioSettings.outputSampleRate; // Initialise Pd with 2 ins and outs and Unity's samplerate. Project dependent. int pdOpen = -1; pdOpen = LibPD.OpenAudio(2, 2, unitySR); if (pdOpen == 0) { islibpdready = true; } return(pdOpen); }