コード例 #1
0
        void StartCapture()
        {
                        #if UNITY_EDITOR
            if (UnityEditor.EditorApplication.isPaused)
            {
                return;
            }
                        #endif

            Debug.Assert(_outSamples == null);
            Debug.Assert(_wavWriter == null);

            _pendingSampleCount = 0;
            int coeffCount = Ambisonic.GetCoeffCount(_order);
            Debug.Assert(coeffCount == 4 || coeffCount == 9 || coeffCount == 16);

            lock (this)
            {
                foreach (AmbisonicSource source in _sources)
                {
                    SetupSource(source);
                }

                string path = Path.Combine(Application.persistentDataPath, _filename);
                if (_capture)
                {
                    path = _capture.LastFilePath + ".wav";
                }
                Debug.Log("[AVProMovieCapture] Writing Ambisonic WAV to " + path);
                _wavWriter = new WavWriter(path, coeffCount, AudioSettings.outputSampleRate, WavWriter.SampleFormat.Float32);

                _outSamples = new float[coeffCount * AudioSettings.outputSampleRate * 1];                       // 1 second buffer
            }
        }
コード例 #2
0
        void OnEnable()
        {
            string path = Path.Combine(Application.persistentDataPath, _filename);

            Debug.Log("[AVProMovieCapture] Writing WAV to " + path);
            _wavWriter = new WavWriter(path, UnityAudioCapture.GetUnityAudioChannelCount(), AudioSettings.outputSampleRate, WavWriter.SampleFormat.Float32);
        }
コード例 #3
0
 void StopCapture()
 {
     if (_wavWriter != null)
     {
         lock (_wavWriter)
         {
             FlushWavWriter();
             _wavWriter.Dispose();
             _wavWriter  = null;
             _outSamples = null;
         }
     }
 }
コード例 #4
0
 void OnDisable()
 {
     _wavWriter.Dispose();
     _wavWriter = null;
 }