public IObservable <Unit> Initialize(string name)
        {
            // set cue info
            cueSheet.name    = name;
            cueSheet.acbFile = name + ".acb";
            cueSheet.awbFile = name + ".awb";

            if (!CriSoundUtility.AddCueSheet(cueSheet))
            {
                throw new ArgumentException();
            }

            CriAtomExAcb acb = CriAtom.GetAcb(name);

            CriAtomEx.CueInfo cueInfo;
            if (!acb.GetCueInfo(name, out cueInfo))
            {
                throw new ArgumentException();
            }
            Length = cueInfo.length;

            return(Observable
                   .ReturnUnit()
                   .Do(_ => CriAtomExLatencyEstimator.InitializeModule())
                   .SelectMany(_ => Observable
                               .EveryUpdate()
                               .Select(__ => CriAtomExLatencyEstimator.GetCurrentInfo())
                               .Where(x => x.status == CriAtomExLatencyEstimator.Status.Processing))
                   .Do(x => EstimatedLatency = x.estimated_latency)
                   .Do(_ => CriAtomExLatencyEstimator.FinalizeModule())
                   .AsUnitObservable());
        }
Exemplo n.º 2
0
        /// <summary>
        /// 初期化.
        /// </summary>
        void Start()
        {
#if UNITY_EDITOR
            gameview = EditorWindow.GetWindow(typeof(EditorWindow).Assembly.GetType("UnityEditor.GameView"));
#endif
            // 音の遅延の計測を開始する.
            SoundLatency = PlayerPrefs.GetInt("SoundLatency", -1);
            if (SoundLatency < 0)
            {
#if USE_CRI
                CriAtomExLatencyEstimator.InitializeModule();
                StartCoroutine(CheckSoundLatency());
#else
                SoundLatency = 0;
#endif
            }
        }