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); } } } }
/** * <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()); }
/** * <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 static IEnumerable <string> GetCueNameList(string cueSheetName) { var acb = CriAtom.GetAcb(cueSheetName); var result = acb.GetCueInfoList().Select(x => x.name); return(result); }
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(); }
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 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(); } } }
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()); }
// 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); }
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>(); }
public void AddCueSheet(CriAtomCueSheet cueSheet) { if (!CriSoundUtility.AddCueSheet(cueSheet)) { return; } var acb = CriAtom.GetAcb(cueSheet.name); if (acb == null) { Debug.unityLogger.LogError(GetType().Name, "NotFound cue sheet"); return; } foreach (var cue in acb.GetCueInfoList()) { cueSheetDictionary.Add(cue.name, cueSheet.name); } }