/* * Initialise all Callbacks, pass the poiner of functions to the hooks in LibPD through the methods * defined in UnityPdReceiver.cpp */ private static void SetAllCallbacks() { // callback_delegate are converted into a function pointer that can be used in unmanaged code. debugLogCallback = new DebugLogDelegate(DebugLog); IntPtr intptr_delegatePrint = Marshal.GetFunctionPointerForDelegate(debugLogCallback); LibPD_SetDebugFunction(intptr_delegatePrint); bangCallback = new ReceiveBangDelegate(ReceivedBang); IntPtr intptr_delegateBang = Marshal.GetFunctionPointerForDelegate(bangCallback); LibPD_SetBangFunction(intptr_delegateBang); floatCallback = new ReceiveFloatDelegate(ReceivedFloat); IntPtr intptr_delegateFloat = Marshal.GetFunctionPointerForDelegate(floatCallback); LibPD_SetFloatFunction(intptr_delegateFloat); symbolCallback = new ReceiveSymbolDelegate(ReceivedSymbol); IntPtr intptr_delegateSymbol = Marshal.GetFunctionPointerForDelegate(symbolCallback); LibPD_SetSymbolFunction(intptr_delegateSymbol); }
static void Main(string[] args) { sharedBuffer = Marshal.AllocCoTaskMem(0); debugLogCallback = DebugLog; audioCallback = ReadAudio; outputResultCallback = OutputResult; set_debug_log_func(debugLogCallback); // set_audio_callback(audioCallback); set_result_func(outputResultCallback); set_log_to_file("julius_log.txt"); var thread = new Thread(new ThreadStart(() => { start(@"../../../../../unity/Assets/StreamingAssets/grammar-kit/grammar/mic.jconf"); DebugLog("FINISHED"); })); thread.Start(); Thread.Sleep(100000); finish(); Thread.Sleep(3000); }
void SetupDebugDelegate() { DebugLogDelegate callbackDelegate = new DebugLogDelegate(CallbackFunction); IntPtr intPtrDelegate = Marshal.GetFunctionPointerForDelegate(callbackDelegate); SetDebugFunction(intPtrDelegate); }
void Awake() { Debug.Log("OSSIA: Starting"); if (!set) { set = true; // Setup the log so that the errors in the C API are shown in the // Unity3D console callback_delegate = new DebugLogDelegate(DebugLogCallback); // Convert callback_delegate into a function pointer that can be // used in unmanaged code. IntPtr intptr_delegate = Marshal.GetFunctionPointerForDelegate(callback_delegate); // Call the API passing along the function pointer. Ossia.Network.ossia_set_debug_logger(intptr_delegate); local_protocol = new Ossia.Local(); local_device = new Ossia.Device(local_protocol, appName); scene_node = local_device.GetRootNode().AddChild("scene"); Queue = new Ossia.MessageQueue(local_device); oscq_protocol = new Ossia.OSCQuery(scorePort, unityPort); local_protocol.ExposeTo(oscq_protocol); } }
public void RemoveDebugCallback(DebugLogDelegate Function) { if (mDebugLogDelegate != null) { mDebugLogDelegate -= Function; } }
public static void Begin(string path) { context = UnitySynchronizationContext.Create(); clip = Microphone.Start("", true, ClipLengthSeconds, SamplingRate); samplesFromMicrophone = new float[clip.samples * clip.channels]; samplesInInt16 = new Int16[clip.samples * clip.channels]; sharedBuffer = Marshal.AllocCoTaskMem(clip.samples * clip.channels * 2); debugLogCallback = DebugLog; audioCallback = ReadAudio; outputResultCallback = OutputResult; set_debug_log_func(debugLogCallback); set_audio_callback(audioCallback); set_result_func(outputResultCallback); set_log_to_file("julius_log.txt"); var thread = new Thread(new ThreadStart(() => { start(path); DebugLog("Thread Finished"); })); thread.Start(); }
private static void SetupLogMechanism() { DebugLogDelegate logCallback = new DebugLogDelegate(LogCallBack); _sLogDelegate = Marshal.GetFunctionPointerForDelegate(logCallback); // Call the API passing along the function pointer. PluginSetLogDelegate(_sLogDelegate); }
InstallDebugLogCallback() { _callbackdelegate = new DebugLogDelegate(WriteLogLineDelegate); // Convert delegate into a function pointer to pass to native plugin IntPtr callbackpointer = Marshal.GetFunctionPointerForDelegate(_callbackdelegate); // Pass the pointer to native plugin unity2vsg_Debug_SetDebugLogCallback(callbackpointer); }
public void AddDebugCallback(DebugLogDelegate Function) { if (mDebugLogDelegate == null) { mDebugLogDelegate = new DebugLogDelegate(Function); } else { mDebugLogDelegate += Function; } }
/// <summary> /// Initializes a new instance of the <see cref="Ceen.Httpd+RunnerControl"/> class. /// </summary> /// <param name="stoptoken">The stoptoken.</param> /// <param name="usessl">A flag indicating if this runner is using SSL</param> /// <param name="config">The server config.</param> public RunnerControl(CancellationToken stoptoken, bool usessl, ServerConfig config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } StopToken = stoptoken; StopToken.Register(() => Stop("_")); Config = config; m_maxactive = config.MaxActiveRequests; m_throttletask.SetResult(true); m_debuglogger = config.DebugLogHandler; m_useSSL = usessl; }
static void Main(string[] args) { var thread = new Thread(new ThreadStart(() => { d = DebugLog; r = Result; set_debug_log_func(d); set_result_func(r); initialize(@"C:\Users\chiepomme\Downloads\grammar-kit-4.3.1\grammar-kit-4.3.1\SampleGrammars\fruit\testmic.jconf"); })); thread.Start(); Thread.Sleep(20000); stop(); }
public static void FlushDebug(DebugLogDelegate Callback) { // if we have no listeners, do fast flush bool HasListeners = (Callback != null) && (Callback.GetInvocationList().Length > 0); if (HasListeners) { // IOS (and aot-only platforms cannot get a function pointer. Find a workaround! #if UNITY_IOS && !UNITY_EDITOR FlushDebug(System.IntPtr.Zero); #else FlushDebug(Marshal.GetFunctionPointerForDelegate(Callback)); #endif } else { FlushDebug(System.IntPtr.Zero); } }
public TCPServerUnity(int port, DebugLogDelegate pLogDelegate, UpdateControls pUpMotors, Object pLock) { // Set Delegate to log mDebug += pLogDelegate; // Set Delegate to update Motors values mUpdateControls += pUpMotors; stopListen = false; // Set the lock between threads (Defined on the unity script) thisLock = pLock; // Create TcpListerner object this.tcpListener = new TcpListener(IPAddress.Any, port); // Doing like this we're not going to block ... this.listenThread = new Thread(new ThreadStart(ListenForClients)); // Start thread this.listenThread.Start(); }
static extern void set_debug_log_func(DebugLogDelegate debugLog);
public static extern void set_debug_log_func(DebugLogDelegate func);
public static extern void set_debug_log_func(DebugLogDelegate ptr);
private static extern void OpenCVForUnity_SetDebugLogFunc(DebugLogDelegate func);
private void Start() { mouseLook.Init (transform, cam.transform); targetAngle = 0.0f; // Setup so that DLL can call Unity's Debug.Log DebugLogDelegate callback_delegate = new DebugLogDelegate( DebugLog ); // Convert callback_delegate into a function pointer that can be // used in unmanaged code. IntPtr intptr_delegate = Marshal.GetFunctionPointerForDelegate(callback_delegate); // Call the API passing along the function pointer. SetDebugLogFptr( intptr_delegate ); if (!WiimoteInit ()) { Debug.Log("Wiimote initialization failed."); } sp.Open(); }
public static void SetDebugLogFunc(DebugLogDelegate func) { set_debug_log_func(func); }
public static extern void SetErrorFunc(DebugLogDelegate func);
private static extern void set_debug_log_func(DebugLogDelegate func);