Beispiel #1
0
    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();
    }
        internal void StartMonoBehaviour()
        {
            if (FirebaseHandler.firebaseHandler == null)
            {
                FirebaseHandler.firebaseHandler = this;
            }
            GameObject gameObject = new GameObject("Firebase Services");

            FirebaseHandler.firebaseMonoBehaviour = gameObject.AddComponent <FirebaseMonoBehaviour>();
            UnitySynchronizationContext.Create(gameObject);
            UnityEngine.Object.DontDestroyOnLoad(gameObject);
        }