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); } } } }
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 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); }