Esempio n. 1
0
        protected override bool BeginRecording(RecordingSession session)
        {
            if (!base.BeginRecording(session))
            {
                return(false);
            }

            try
            {
                Settings.FileNameGenerator.CreateDirectory(session);
            }
            catch (Exception)
            {
                Debug.LogError(string.Format("Atom recorder output directory \"{0}\" could not be created.", Settings.FileNameGenerator.BuildAbsolutePath(session)));
                return(false);
            }

            var initializer  = FindObjectOfType <CriWareInitializer>();
            int samplingRate = initializer.atomConfig.outputSamplingRate;

            if (samplingRate == 0)
            {
                samplingRate = 48000;
            }

            try
            {
                var path = Settings.FileNameGenerator.BuildAbsolutePath(session);

                waveFileCreator = new WaveFileCreator(
                    path,
                    numChannels: 2,
                    samplingRate,
                    numbites: 16
                    );

                CriAtomExOutputAnalyzer.Config config = new CriAtomExOutputAnalyzer.Config
                {
                    enablePcmCapture         = true,
                    enablePcmCaptureCallback = true,
                    numCapturedPcmSamples    = Settings.NumSamples
                };

                analyzer = new CriAtomExOutputAnalyzer(config);
                analyzer.SetPcmCaptureCallback(PcmCapture);

                analyzer.AttachDspBus("MasterOut");

                return(true);
            }
            catch
            {
                if (RecorderOptions.VerboseMode)
                {
                    Debug.LogError("AudioRecorder unable to create MovieEncoder.");
                }
            }

            return(false);
        }
Esempio n. 2
0
    IEnumerator RecordCoroutine()
    {
        while (CriAtom.CueSheetsAreLoading)
        {
            yield return(null);
        }

        /* Initialize CriAtomExOutputAnalyzer for PCM capture. */
        CriAtomExOutputAnalyzer.Config config = new CriAtomExOutputAnalyzer.Config
        {
            enablePcmCapture         = true,
            enablePcmCaptureCallback = true,
            numCapturedPcmSamples    = numSamples
        };

        analyzer = new CriAtomExOutputAnalyzer(config);
        analyzer.SetPcmCaptureCallback(PcmCapture);

        analyzer.AttachDspBus("MasterOut");

        IsRecording = true;
    }