Esempio n. 1
0
        private void LoadCueInfo(UnityEngine.Object acbAsset)
        {
            cueInfos = new List <CueInfo>();

            // 指定したACBファイル名(キューシート名)を指定してキュー情報を取得.
            var assetPath = AssetDatabase.GetAssetPath(acbAsset);
            var fullPath  = UnityPathUtility.GetProjectFolderPath() + assetPath;
            var acb       = CriAtomExAcb.LoadAcbFile(null, fullPath, "");

            if (acb != null)
            {
                var list = acb.GetCueInfoList();

                foreach (var item in list)
                {
                    var path = PathUtility.GetPathWithoutExtension(assetPath);

                    var cueInfo = new CueInfo(string.Empty, path, item.name, item.userData);

                    cueInfos.Add(cueInfo);
                }

                acb.Dispose();
            }
        }
Esempio n. 2
0
        public static CriAtomEx.CueInfo[] GetCueInfoList(CriAtomCueSheet cueSheet)
        {
            if (string.IsNullOrEmpty(cueSheet.name))
            {
                return(null);
            }

            CriAtomEx.CueInfo[] result = null;

            while (!CriFsPlugin.isInitialized || !CriAtomPlugin.isInitialized)
            {
                Debug.Log("Sleep");
                Thread.Sleep(1000);
            }

            try
            {
                var acb = CriAtomExAcb.LoadAcbFile(null,
                                                   Path.Combine(Application.streamingAssetsPath, cueSheet.acbFile),
                                                   Path.Combine(Application.streamingAssetsPath, cueSheet.awbFile));
                if (acb != null)
                {
                    result = acb.GetCueInfoList();
                    acb.Dispose();
                }
            }
            catch (Exception e)
            {
                Debug.unityLogger.LogException(e);
            }

            return(result);
        }
Esempio n. 3
0
    new void Awake()
    {
        if (CheckInstance())
        {
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
            return;
        }


        Current = this;
        MusicList.Add(this);
#if ADX
        MusicSource = new SoundCue(GetComponent <CriAtomSource>());
        ACBData     = CriAtom.GetAcb(MusicSource.source.cueSheet);
        ACBData.GetCueInfo(MusicSource.source.cueName, out CueInfo);
#else
        MusicSource = new SoundCue(GetComponent <AudioSource>());
#endif
        QuantizedCue = new List <SoundCue>();

        SamplesPerUnit = (long)(SamplingRate * (60.0 / (Tempo_ * mtBeat_)));
        SamplesPerBeat = SamplesPerUnit * mtBeat_;
        SamplesPerBar  = SamplesPerUnit * mtBar_;

        MusicTimeUnit = (double)SamplesPerUnit / (double)SamplingRate;

        Initialize();
    }
        public void Play(CriAtomSource atomSource, CriAtomClipPlayConfig config)
        {
            this.IsClipPlaying = true;

            if (atomSource == null)
            {
                return;
            }

            if (config.cueSheetName != m_lastCueSheetName)
            {
                m_acb = CriAtom.GetAcb(config.cueSheetName);
            }
            if (m_acb != null)
            {
                atomSource.player.SetCue(m_acb, config.cueName);
                this.CueLength     = GetCueLengthSec(m_acb, config.cueName);
                m_lastCueSheetName = config.cueSheetName;

                if (this.playback.status != CriAtomExPlayback.Status.Removed)
                {
                    this.playback.Stop();
                }

                if (this.CueLength > 0)
                {
                    atomSource.player.SetStartTime(config.startTimeMs);
                    atomSource.player.Loop(config.loop);
                    this.playback = atomSource.player.Start();
                }
            }
        }
Esempio n. 5
0
    /**
     * <summary>非同期に、指定したキュー名のキューを再生開始します。</summary>
     * <param name="cueName">キュー名</param>
     * <returns>コルーチン</returns>
     * \par 説明:
     * Unityのコルーチン機能を使い、非同期に実行されます。
     * 本関数は MonoBehaviour::StartCoroutine の引数に指定して呼び出してください。
     */
    private IEnumerator PlayAsync(string cueName)
    {
        CriAtomExAcb acb = null;

        while (acb == null && !String.IsNullOrEmpty(this.cueSheet))
        {
            acb = CriAtom.GetAcb(this.cueSheet);
            if (acb == null)
            {
                yield return(null);
            }
        }
        this.player.SetCue(acb, cueName);
#if !UNITY_EDITOR && UNITY_ANDROID
        if (androidUseLowLatencyVoicePool)
        {
            this.player.SetSoundRendererType(CriAtomEx.SoundRendererType.Native);
        }
        else
        {
            this.player.SetSoundRendererType(CriAtomEx.androidDefaultSoundRendererType);
        }
#endif
        if (this.hasValidPosition == false)
        {
            this.SetInitialSourcePosition();
            this.hasValidPosition = true;
        }
        if (this.status == Status.Stop)
        {
            this.player.Loop(this._loop);
        }
        this.player.Start();
    }
        public void PreviewPlay(Guid trackId, bool instantStop, CriAtomClipPlayConfig config)
        {
            this.IsClipPlaying = true;

            if (config.cueSheetName != m_lastCueSheetName)
            {
                m_acb = CriAtomTimelinePreviewer.Instance.GetAcb(config.cueSheetName);
            }
            if (m_acb != null)
            {
                CriAtomTimelinePreviewer.Instance.SetCue(trackId, m_acb, config.cueName);
                this.CueLength     = GetCueLengthSec(m_acb, config.cueName);
                m_lastCueSheetName = config.cueSheetName;

                if (this.playback.status != CriAtomExPlayback.Status.Removed)
                {
                    this.playback.Stop();
                }

                if (this.CueLength > 0)
                {
                    CriAtomTimelinePreviewer.Instance.SetStartTime(trackId, config.startTimeMs);
                    CriAtomTimelinePreviewer.Instance.SetLoop(trackId, config.loop);
                    this.playback = CriAtomTimelinePreviewer.Instance.Play(trackId);
                    if (instantStop)
                    {
                        WaitAndStop();
                    }
                }
            }
        }
Esempio n. 7
0
    public void PlayBGM()
    {
        bool startFlag = false;

        CriAtomSource.Status status = atomSourceBgm.status;
        if ((status == CriAtomSource.Status.Stop) || (status == CriAtomSource.Status.PlayEnd))
        {
            this.playbackBGM = atomSourceBgm.Play(100);
            startFlag        = true;
        }

        /*	Move to the next block except for the first playback. */
        if (startFlag == false)
        {
            int          cur = this.playbackBGM.GetCurrentBlockIndex();
            CriAtomExAcb acb = CriAtom.GetAcb("PinballMain");
            if (acb != null)
            {
                acb.GetCueInfo("BGM", out this.cueInfo);

                cur++;
                if (this.cueInfo.numBlocks > 0)
                {
                    this.playbackBGM.SetNextBlockIndex(cur % this.cueInfo.numBlocks);
                }
            }
        }
    }
Esempio n. 8
0
    /**
     * <summary>指定したキューIDのキューを再生開始します。</summary>
     * <param name="cueId">キューID</param>
     * <returns>再生ID</returns>
     * \par 説明:
     * CriAtomSource::cueName プロパティの設定に関わらず、本関数に指定したキューIDのキューを再生します。
     */
    public CriAtomExPlayback Play(int cueId)
    {
        CriAtomExAcb acb = null;

        if (!String.IsNullOrEmpty(this.cueSheet))
        {
            acb = CriAtom.GetAcb(this.cueSheet);
        }
        this.player.SetCue(acb, cueId);
#if !UNITY_EDITOR && UNITY_ANDROID
        if (androidUseLowLatencyVoicePool)
        {
            this.player.SetSoundRendererType(CriAtomEx.SoundRendererType.Native);
        }
        else
        {
            this.player.SetSoundRendererType(CriAtomEx.SoundRendererType.Asr);
        }
#endif
        if (this.hasValidPosition == false)
        {
            this.SetInitialSourcePosition();
            this.hasValidPosition = true;
        }
        if (this.status == Status.Stop)
        {
            this.player.Loop(this._loop);
        }
        return(this.player.Start());
    }
Esempio n. 9
0
    private CriAtomExAcb LoadAcbFile(CriFsBinder binder, string acbFile, string awbFile)
    {
        if (String.IsNullOrEmpty(acbFile))
        {
            return(null);
        }

        string acbPath = acbFile;

        if ((binder == null) && CriWare.Common.IsStreamingAssetsPath(acbPath))
        {
            acbPath = Path.Combine(CriWare.Common.streamingAssetsPath, acbPath);
        }

        string awbPath = awbFile;

        if (!String.IsNullOrEmpty(awbPath))
        {
            if ((binder == null) && CriWare.Common.IsStreamingAssetsPath(awbPath))
            {
                awbPath = Path.Combine(CriWare.Common.streamingAssetsPath, awbPath);
            }
        }

        return(CriAtomExAcb.LoadAcbFile(binder, acbPath, awbPath));
    }
Esempio n. 10
0
    void Awake()
    {
        MusicList.Add(this);
        musicSource_ = GetComponent <CriAtomSource>();
        if (Current_ == null || musicSource_.playOnStart)
        {
            if (musicSource_.playOnStart)
            {
                musicSource_.playOnStart = false;
                playOnStart_             = true;
            }
            Current_ = this;
        }
        acbData_ = CriAtom.GetAcb(musicSource_.cueSheet);
        acbData_.GetCueInfo(musicSource_.cueName, out cueInfo_);

        double beatSec = (60.0 / Tempo);

        samplesPerUnit_  = (int)(SamplingRate * (beatSec / UnitPerBeat));
        samplesPerBeat_  = (int)(SamplingRate * beatSec);
        samplesPerBar_   = (int)(SamplingRate * UnitPerBar * (beatSec / UnitPerBeat));
        musicalTimeUnit_ = (double)samplesPerUnit_ / (double)SamplingRate;

        Initialize();
    }
        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());
        }
Esempio n. 12
0
    /**
     * <summary>ACB情報の取得</summary>
     * <param name="acb">ACB</param>
     * <param name="acbInfo">ACB情報</param>
     * <returns>情報が取得できたか</returns>
     * \par 説明:
     * ACBデータの各種情報を取得します。
     */
    public static bool GetAcbInfo(CriAtomExAcb acb, out AcbInfo acbInfo)
    {
        AcbInfoForMarshaling x;
        bool result = criAtomExAcb_GetAcbInfo(acb.nativeHandle, out x) == 1;

        x.Convert(out acbInfo);
        return(result);
    }
Esempio n. 13
0
 private void PlayPreview(CriAtomExAcb acb, string cuename)
 {
     if (previewPlayer == null)
     {
         previewPlayer = new CriAtomEditor.PreviewPlayer();
     }
     previewPlayer.Play(acb, cuename);
 }
Esempio n. 14
0
 private void OnLostFocus()
 {
     StopPreview();
     if (previewAcb != null)
     {
         previewAcb.Dispose();
         previewAcb = null;
     }
     lastAcbName = "";
 }
Esempio n. 15
0
        private void GetAcbInfoListCore(string searchPath, ref int acbIndex)
        {
            string[] files = System.IO.Directory.GetFiles(searchPath);
            foreach (string file in files)
            {
                if (System.IO.Path.GetExtension(file.Replace("\\", "/")) == ".acb")
                {
                    AcbInfo acbInfo = new AcbInfo(System.IO.Path.GetFileNameWithoutExtension(file),
                                                  acbIndex, "", System.IO.Path.GetFileName(file), "", "");
                    /* 指定したACBファイル名(キューシート名)を指定してキュー情報を取得 */
                    CriAtomExAcb acb = CriAtomExAcb.LoadAcbFile(null, file.Replace("\\", "/"), "");
                    if (acb != null)
                    {
                        /* キュー名リストの作成 */
                        CriAtomEx.CueInfo[] cueInfoList = acb.GetCueInfoList();
                        foreach (CriAtomEx.CueInfo cueInfo in cueInfoList)
                        {
                            CueInfo tmpCueInfo = new CueInfo(cueInfo.name, cueInfo.id, cueInfo.userData);
                            bool    found      = false;
                            foreach (var key in acbInfo.cueInfoList)
                            {
                                if (key.id == cueInfo.id)
                                {
                                    found = true;
                                    break;
                                }
                            }
                            if (found == false)
                            {
                                acbInfo.cueInfoList.Add(tmpCueInfo);
                            }
                            else
                            {
                                //  inGame時のサブシーケンスの場合あり
                                //Debug.Log("already exists in the dictionay id:" + cueInfo.id.ToString() +"name:" + cueInfo.name);
                            }
                        }
                        acb.Dispose();
                    }
                    else
                    {
                        Debug.Log("GetAcbInfoList LoadAcbFile. acb is null. " + file);
                    }
                    tmpAcbInfoList.Add(acbInfo);
                    acbIndex++;
                }
            }

            //  directory
            string[] directories = System.IO.Directory.GetDirectories(searchPath);
            foreach (string directory in directories)
            {
                GetAcbInfoListCore(directory, ref acbIndex);
            }
        }
Esempio n. 16
0
 public void SetCue(Guid trackId, CriAtomExAcb acb, string cueName)
 {
     if (acb != null && string.IsNullOrEmpty(cueName) == false)
     {
         this.GetPlayer(trackId).SetCue(acb, cueName);
     }
     else
     {
         Debug.LogWarning("[CRIWARE] Timeline Previewer: insufficient ACB or cue name");
     }
 }
Esempio n. 17
0
    /**
     * <summary>ACBデータの取得</summary>
     * <returns>CriAtomExAcbオブジェクト</returns>
     * \par 説明:
     * 非同期にロードしたACBデータを取得します。<br>
     * 本関数は、 ::CriAtomExAcbLoader::GetStatus の戻り値が Complete に遷移してから呼び出してください。<br>
     */
    public CriAtomExAcb MoveAcb()
    {
        IntPtr movedAcbHandle = criAtomExAcbLoader_MoveAcbHandle(this.handle);

        if (movedAcbHandle != IntPtr.Zero)
        {
            CriAtomExAcb movedAcb = new CriAtomExAcb(movedAcbHandle, this.data);
            this.data = null;
            return(movedAcb);
        }
        return(null);
    }
 private double GetCueLengthSec(CriAtomExAcb acb, string cueName)
 {
     CriAtomEx.WaveformInfo waveInfo;
     if (acb != null && acb.GetWaveFormInfo(cueName, out waveInfo) == true)
     {
         return(waveInfo.numSamples / (double)waveInfo.samplingRate);
     }
     else
     {
         return(0);
     }
 }
Esempio n. 19
0
 private void TryInitializePlugin()
 {
     if (CriAtomPlugin.IsLibraryInitialized() == false)
     {
         if (previewAcb != null)
         {
             previewAcb  = null;
             lastAcbName = "";
         }
     }
     CriAtomEditor.InitializePluginForEditor();
 }
Esempio n. 20
0
    // internal

    protected override bool ReadyInternal()
    {
        atomSource_ = GetComponent <CriAtomSource>();
        if (atomSource_.playOnStart)
        {
            atomSource_.playOnStart = false;
            PlayOnStart             = true;
        }
        acbData_ = CriAtom.GetAcb(atomSource_.cueSheet);
        acbData_.GetCueInfo(atomSource_.cueName, out cueInfo_);
        Meter.Validate(0);
        return(true);
    }
Esempio n. 21
0
 private void OnDisable()
 {
     if (previewAcb != null)
     {
         previewAcb.Dispose();
         previewAcb = null;
     }
     lastCuesheet = "";
     if (previewPlayer != null)
     {
         previewPlayer.Dispose();
         previewPlayer = null;
     }
 }
    private void OnDisable()
    {
#if CRI_UNITY_EDITOR_PREVIEW
        if (previewAcb != null)
        {
            previewAcb.Dispose();
            previewAcb = null;
        }
        if (previewPlayer != null)
        {
            previewPlayer.Dispose();
            previewPlayer = null;
        }
#endif
    }
Esempio n. 23
0
        private void Initialize()
        {
            _cueAcb = CriAtom.GetAcb(_cueSheetName);

            if (_useObjectPoolInUniRx)
            {
                _sourcePool = new AtomSourcePoolOnUniRx(_sourcePrefab.gameObject);
            }
            else
            {
                _sourcePool = new AtomSourcePool(_sourcePrefab.gameObject);
            }

            _activeSources       = new List <CriAtomSource>();
            _disableSourceBuffer = new List <CriAtomSource>();
        }
 /* プレビュ用:音声データ設定・再生関数 */
 private void StartPreviewPlayer()
 {
     if (isPreviewReady == false)
     {
         PreparePreview();
     }
     if (isPreviewReady == true)
     {
         if (previewAcb == null || lastCuesheet != this.source.cueSheet)
         {
             if (previewAcb != null)
             {
                 previewAcb.Dispose();
                 previewAcb = null;
             }
             foreach (var cuesheet in atomComponent.cueSheets)
             {
                 if (cuesheet.name == this.source.cueSheet)
                 {
                     strPreviewAcb = Path.Combine(CriWare.streamingAssetsPath, cuesheet.acbFile);
                     strPreviewAwb = (cuesheet.awbFile == null) ? null : Path.Combine(CriWare.streamingAssetsPath, cuesheet.awbFile);
                     previewAcb    = CriAtomExAcb.LoadAcbFile(null, strPreviewAcb, strPreviewAwb);
                     lastCuesheet  = cuesheet.name;
                 }
             }
         }
         if (previewAcb != null)
         {
             if (previewPlayer != null)
             {
                 previewPlayer.SetCue(previewAcb, this.source.cueName);
                 previewPlayer.SetVolume(this.source.volume);
                 previewPlayer.SetPitch(this.source.pitch);
                 previewPlayer.Loop(this.source.loop);
                 previewPlayer.Start();
             }
             else
             {
                 Debug.LogWarning("[CRIWARE] Player is not ready. Please try reloading the inspector");
             }
         }
         else
         {
             Debug.LogWarning("[CRIWARE] Specified cue sheet could not be found");
         }
     }
 }
Esempio n. 25
0
    private CriAtomExAcb LoadAcbData(byte[] acbData, CriFsBinder binder, string awbFile)
    {
        if (acbData == null)
        {
            return(null);
        }

        string awbPath = awbFile;

        if (!String.IsNullOrEmpty(awbPath))
        {
            if ((binder == null) && CriWare.IsStreamingAssetsPath(awbPath))
            {
                awbPath = Path.Combine(CriWare.streamingAssetsPath, awbPath);
            }
        }

        return(CriAtomExAcb.LoadAcbData(acbData, binder, awbPath));
    }
Esempio n. 26
0
        private static CueInfo[] LoadAcbInfo(string path)
        {
            var result = new List <CueInfo>();

            CriForceInitializer.Initialize();

            var guids = AssetDatabase.FindAssets(string.Empty, new string[] { path });

            var acbAssets = guids
                            .Select(x => AssetDatabase.GUIDToAssetPath(x))
                            .Where(x => Path.GetExtension(x) == CriAssetDefinition.AcbExtension)
                            .Select(x => AssetDatabase.LoadMainAssetAtPath(x))
                            .ToArray();

            foreach (var acbAsset in acbAssets)
            {
                // 指定したACBファイル名(キューシート名)を指定してキュー情報を取得.
                var assetPath = AssetDatabase.GetAssetPath(acbAsset);
                var fullPath  = UnityPathUtility.GetProjectFolderPath() + assetPath;
                var acb       = CriAtomExAcb.LoadAcbFile(null, fullPath, "");

                if (acb != null)
                {
                    var cueInfos = acb.GetCueInfoList().ToArray();

                    foreach (var cueInfo in cueInfos)
                    {
                        var acbPath = assetPath.Replace(path + PathUtility.PathSeparator, string.Empty);

                        acbPath = PathUtility.GetPathWithoutExtension(acbPath);

                        result.Add(new CueInfo(cueInfo.name, acbPath, cueInfo.userData));
                    }

                    acb.Dispose();
                }
            }

            return(result.ToArray());
        }
Esempio n. 27
0
    /* プレビュ用:音声データ設定・再生関数 */
    private void StartPreviewPlayer()
    {
        if (previewPlayer == null)
        {
            return;
        }

        if (lastCuesheet != this.source.cueSheet)
        {
            if (previewAcb != null)
            {
                previewAcb.Dispose();
                previewAcb = null;
            }
            foreach (var cuesheet in atomComponent.cueSheets)
            {
                if (cuesheet.name == this.source.cueSheet)
                {
                    strPreviewAcb = Path.Combine(CriWare.Common.streamingAssetsPath, cuesheet.acbFile);
                    strPreviewAwb = (cuesheet.awbFile == null) ? null : Path.Combine(CriWare.Common.streamingAssetsPath, cuesheet.awbFile);
                    previewAcb    = CriAtomExAcb.LoadAcbFile(null, strPreviewAcb, strPreviewAwb);
                    lastCuesheet  = cuesheet.name;
                }
            }
        }
        if (previewAcb != null)
        {
            previewPlayer.player.SetVolume(this.source.volume);
            previewPlayer.player.SetPitch(this.source.pitch);
            previewPlayer.player.Loop(this.source.loop);
            previewPlayer.Play(previewAcb, this.source.cueName);
        }
        else
        {
            Debug.LogWarning("[CRIWARE] Specified cue sheet could not be found");
        }
    }
Esempio n. 28
0
        /* 音声データ設定・再生 */
        public void Play(CriAtomExAcb acb, string cueName)
        {
            if (isPlayerReady == false)
            {
                this.Initialize();
            }

            if (acb != null)
            {
                if (player != null)
                {
                    player.SetCue(acb, cueName);
                    player.Start();
                }
                else
                {
                    Debug.LogWarning("[CRIWARE] Player is not ready. Please try reloading the inspector");
                }
            }
            else
            {
                Debug.LogWarning("[CRIWARE] Atom Player for editor: internal error");
            }
        }
Esempio n. 29
0
 public SoundSheet(string assetPath, CriAtomExAcb acb) : this(assetPath)
 {
     Acb = acb;
 }
Esempio n. 30
0
	/**
	 * <summary>音声データのセット(キュー名指定)</summary>
	 * <param name="acb">ACBオブジェクト</param>
	 * <param name="name">キュー名</param>
	 * キュー名を、AtomExプレーヤに関連付けます。<br/>
	 * 本関数でキュー名を指定後、 ::CriAtomExPlayer::Start 
	 * 関数で再生を開始すると、指定されたキューが再生されます。<br/>
	 * \par 例:
	 * \code
	 * 		:
	 * 	// プレーヤの作成
	 * 	CriAtomExPlayer player = new CriAtomExPlayer();
	 * 	
	 * 	// ACFファイルの登録
	 * 	CriAtomEx.RegisterAcf(null, "sample.acf");
	 * 	
	 * 	// ACBファイルのロード
	 * 	CriAtomExAcb acb = CriAtomExAcb.LoadAcbFile(null, "sample.acb", "sample.awb");
	 * 	
	 * 	// 再生するキューの名前を指定
	 * 	player.SetCue(acb, "gun_shot");
	 * 	
	 * 	// セットされた音声データを再生
	 * 	player.Start();
	 * 		:
	 * \endcode
	 * 尚、一旦セットしたデータの情報は、
	 * 他のデータがセットされるまでAtomExプレーヤ内に保持されます。<br/>
	 * そのため、同じデータを何度も再生する場合には、
	 * 再生毎にデータをセットしなおす必要はありません。<br/>
	 * ( ::CriAtomExPlayer::Start 関数を繰り返し実行可能です。)
	 * \par 備考:
	 * ::CriAtomExPlayer::SetCue 関数でキューをセットした場合、
	 * 以下の関数で設定されたパラメータは無視されます。<br/>
	 * 	- ::CriAtomExPlayer::SetFormat
	 * 	- ::CriAtomExPlayer::SetNumChannels
	 * 	- ::CriAtomExPlayer::SetSamplingRate
	 * 	.
	 * (音声フォーマットやチャンネル数、サンプリングレート等の情報は、
	 * ACB ファイルの情報を元に自動的にセットされます。)<br/>
	 * \sa CriAtomExPlayer::Start
	 */
	public void SetCue(CriAtomExAcb acb, string name)
	{
		criAtomExPlayer_SetCueName(this.handle, 
			(acb != null) ? acb.nativeHandle : IntPtr.Zero, name);
	}
Esempio n. 31
0
    private void GetAcbInfoListCore(string searchPath)
    {
        acbInfoList.Clear();
        string[] files = null;
        try {
            files = Directory.GetFiles(searchPath, "*.acb", SearchOption.AllDirectories);
        } catch (Exception ex) {
            if (ex is ArgumentException || ex is ArgumentNullException)
            {
                Debug.LogWarning("[CRIWARE] Insufficient search path. Please check the path for file searching.");
            }
            else if (ex is DirectoryNotFoundException)
            {
                Debug.LogWarning("[CRIWARE] Search path not found: " + searchPath);
            }
            else
            {
                Debug.LogError("[CRIWARE] Error getting ACB files. Message: " + ex.Message);
            }
        }
        if (files == null)
        {
            return;
        }

        int acbIndex = 0;

        foreach (string file in files)
        {
            AcbInfo acbInfo = new AcbInfo(
                Path.GetFileNameWithoutExtension(file),
                acbIndex++,
                "",
                TryGetRelFilePath(file),
                TryGetAwbFile(file));
            /* 指定したACBファイル名(キューシート名)を指定してキュー情報を取得 */
            string       acbFilePath = file.Replace("\\", "/");
            CriAtomExAcb acb         = CriAtomExAcb.LoadAcbFile(null, acbFilePath, "");
            if (acb != null)
            {
                acbInfo.assetGuid = AssetDatabase.AssetPathToGUID("Assets" + acbFilePath.Substring(Application.dataPath.Length));
                /* キュー名リストの作成 */
                CriAtomEx.CueInfo[] cueInfoList = acb.GetCueInfoList();
                foreach (CriAtomEx.CueInfo cueInfo in cueInfoList)
                {
                    bool found = false;
                    foreach (var key in acbInfo.cueInfoList)
                    {
                        if (key.id == cueInfo.id)
                        {
                            found = true;
                            break;
                        }
                    }
                    if (found == false)
                    {
                        var newCueInfo = new CueInfo(cueInfo.name, cueInfo.id, cueInfo.userData, Convert.ToBoolean(cueInfo.headerVisibility));
                        acbInfo.cueInfoList.Add(newCueInfo);
                        if (newCueInfo.isPublic)
                        {
                            acbInfo.publicCueInfoList.Add(newCueInfo);
                        }
                    }
                    else
                    {
                        /* inGame時のサブシーケンスの場合あり */
                        Debug.Log("[CRIWARE] Duplicate cue ID " + cueInfo.id.ToString() + " in cue sheet " + acbInfo.name + ". Last cue name:" + cueInfo.name);
                    }
                }
                acb.Dispose();
            }
            else
            {
                Debug.Log("[CRIWARE] Failed to load ACB file: " + file);
            }
            acbInfoList.Add(acbInfo);
        }
    }
Esempio n. 32
0
	/**
	 * <summary>音声データのセット(キューインデックス指定)</summary>
	 * <param name="player">AtomExプレーヤ</param>
	 * <param name="acb">ACBオブジェクト</param>
	 * <param name="index">キューインデックス</param>
	 * キューインデックスを、AtomExプレーヤに関連付けます。<br/>
	 * 本関数でキューインデックスを指定後、 ::CriAtomExPlayer::Start
	 * 関数で再生を開始すると、指定されたキューが再生されます。
	 * \par 例:
	 * \code
	 * 		:
	 * 	// プレーヤの作成
	 * 	CriAtomExPlayer player = new CriAtomExPlayer();
	 * 	
	 * 	// ACFファイルの登録
	 * 	CriAtomEx.RegisterAcf(null, "sample.acf");
	 * 	
	 * 	// ACBファイルのロード
	 * 	CriAtomExAcb acb = CriAtomExAcb.LoadAcbFile(null, "sample.acb", "sample.awb");
	 * 	
	 * 	// 再生するキューのインデックスを指定
	 * 	player.SetCueIndex(acb, 300);
	 * 	
	 * 	// セットされた音声データを再生
	 * 	player.Start();
	 * 		:
	 * \endcode
	 * 尚、一旦セットしたデータの情報は、
	 * 他のデータがセットされるまでAtomExプレーヤ内に保持されます。<br/>
	 * そのため、同じデータを何度も再生する場合には、
	 * 再生毎にデータをセットしなおす必要はありません。<br/>
	 * ( ::CriAtomExPlayer::Start 関数を繰り返し実行可能です。)
	 * \par 備考:
	 * ::CriAtomExPlayer::SetCueIndex 関数でキューをセットした場合、
	 * 以下の関数で設定されたパラメータは無視されます。<br/>
	 * 	- ::CriAtomExPlayer::SetFormat
	 * 	- ::CriAtomExPlayer::SetNumChannels
	 * 	- ::CriAtomExPlayer::SetSamplingRate
	 * 	.
	 * (音声フォーマットやチャンネル数、サンプリングレート等の情報は、
	 * ACB ファイルの情報を元に自動的にセットされます。)<br/>
	 * <br/>
	 * 本関数を使用することで、キュー名やキューIDを指定せずにプレーヤに対して
	 * 音声をセットすることが可能です。<br/>
	 * (キュー名やキューIDがわからない場合でも、
	 * ACBファイル内のコンテンツを一通り再生可能なので、
	 * デバッグ用途に利用可能です。)<br/>
	 * \sa CriAtomExPlayer::Start
	 */
	public void SetCueIndex(CriAtomExAcb acb, int index)
	{
		criAtomExPlayer_SetCueIndex(this.handle, 
			(acb != null) ? acb.nativeHandle : IntPtr.Zero, index);
	}