private Chuck() { // Store the location of data files setDataDir(Application.streamingAssetsPath); // Important in the editor, where native static arrays won't be cleaned up when entering / exiting play mode cleanRegisteredChucks(); // First id is 0 _nextValidID = 0; // Store exposed parameter names -> ids ids = new Dictionary <string, System.UInt32>(); // Store external ints -> callbacks to avoid garbage collection of callbacks intCallbacks = new Dictionary <string, IntCallback>(); floatCallbacks = new Dictionary <string, FloatCallback>(); // Create and store callbacks chout_delegate = new MyLogCallback(ChoutCallback); cherr_delegate = new MyLogCallback(CherrCallback); stdout_delegate = new MyLogCallback(StdoutCallback); stderr_delegate = new MyLogCallback(StderrCallback); // Store pointers to callbacks inside ChucK's inner workings setStdoutCallback(stdout_delegate); setStderrCallback(stderr_delegate); }
private static extern bool setStderrCallback(MyLogCallback callback);
private static extern bool setCherrCallback(System.UInt32 chuckID, MyLogCallback callback);