From add0a7351acea4e2f285d5c028e218505c05a6e0 Mon Sep 17 00:00:00 2001 From: Niall Moody Date: Mon, 27 Nov 2023 15:53:57 +0000 Subject: [PATCH] Apple Silicon support for LibPdInstance.cs --- Assets/Scripts/LibPdInstance.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Assets/Scripts/LibPdInstance.cs b/Assets/Scripts/LibPdInstance.cs index 5e1733f..1c4d444 100644 --- a/Assets/Scripts/LibPdInstance.cs +++ b/Assets/Scripts/LibPdInstance.cs @@ -507,8 +507,16 @@ public class LibPdInstance : MonoBehaviour /// Initialise LibPd. void Awake() { + //Initialise libpd if possible, report any errors. + int initErr = libpd_queued_init(); + if (initErr != 0) + { + Debug.LogWarning("Warning; libpd_init() returned " + initErr); + Debug.LogWarning("(if you're running this in the editor that probably just means this isn't the first time you've run your game, and is not a problem)"); + } + //Initialise libpd, if it's not already. - if(!pdInitialised) + if (!pdInitialised) { //Setup hooks. printHook = new LibPdPrintHook(PrintOutput); @@ -550,13 +558,6 @@ public class LibPdInstance : MonoBehaviour midiByteHook = new LibPdMidiByteHook(MidiByteOutput); libpd_set_queued_midibytehook(midiByteHook); - //Initialise libpd if possible, report any errors. - int initErr = libpd_queued_init(); - if(initErr != 0) - { - Debug.LogWarning("Warning; libpd_init() returned " + initErr); - Debug.LogWarning("(if you're running this in the editor that probably just means this isn't the first time you've run your game, and is not a problem)"); - } pdInitialised = true; //Try and add the patch directory to libpd's search path for