public static IEnumerable <string> GetCueNameList(string cueSheetName) { var acb = CriAtom.GetAcb(cueSheetName); var result = acb.GetCueInfoList().Select(x => x.name); return(result); }
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()); }
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(); } } }
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(); }
// Start is called before the first frame update void Start() { BGMSlider.value = BGMVol; CriAtom.SetCategoryVolume("Music", BGMVol); SESlider.value = SEVol; CriAtom.SetCategoryVolume("SFX", SEVol); }
/** * <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(); }
/** * <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()); }
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); } } } }
/* * newDontRemoveExistsCueSheet == false の場合、古いキューシートを登録解除して、新しいキューシートの登録を行う。 * ただし同じキューシートの再登録は回避する */ private void MargeCueSheet(CriAtomCueSheet[] newCueSheets, bool newDontRemoveExistsCueSheet) { if (!newDontRemoveExistsCueSheet) { for (int i = 0; i < this.cueSheets.Length;) { int index = Array.FindIndex(newCueSheets, sheet => sheet.name == this.cueSheets[i].name); if (index < 0) { CriAtom.RemoveCueSheet(this.cueSheets[i].name); } else { i++; } } } foreach (var sheet1 in newCueSheets) { var sheet2 = this.GetCueSheetInternal(sheet1.name); if (sheet2 == null) { CriAtom.AddCueSheet(null, sheet1.acbFile, sheet1.awbFile, null); } } }
/* 古いキューシートを登録解除して、新しいキューシートの登録を行う。 * ただし同じキューシートの再登録は回避する */ private void MargeCueSheet(CriAtomCueSheet[] newCueSheets) { for (int i = 0; i < this.cueSheets.Length;) { int j = 0; for (j = 0; j < newCueSheets.Length; j++) { if (newCueSheets[j].name == this.cueSheets[i].name) { break; } } if (j == newCueSheets.Length) { CriAtom.RemoveCueSheet(this.cueSheets[i].name); } else { i++; } } foreach (var sheet1 in newCueSheets) { var sheet2 = this.GetCueSheetInternal(sheet1.name); if (sheet2 == null) { this.AddCueSheetInternal(null, sheet1.acbFile, sheet1.awbFile, null); } } }
/* @cond DOXYGEN_IGNORE */ #region Functions for internal use private void Setup() { CriAtom.instance = this; CriAtomPlugin.InitializeLibrary(); if (!String.IsNullOrEmpty(this.acfFile)) { string acfPath = Path.Combine(CriWare.streamingAssetsPath, this.acfFile); CriAtomEx.RegisterAcf(null, acfPath); } if (!String.IsNullOrEmpty(dspBusSetting)) { AttachDspBusSetting(dspBusSetting); } foreach (var cueSheet in this.cueSheets) { cueSheet.acb = this.LoadAcbFile(null, cueSheet.acbFile, cueSheet.awbFile); } if (this.dontDestroyOnLoad) { GameObject.DontDestroyOnLoad(this.gameObject); } }
private void OnEnable() { //m_Slider.value = AudioListener.volume; //スライダーの値が変更されたら音量も変更する //m_Slider.onValueChanged.AddListener((sliderValue) => AudioListener.volume = sliderValue); atomSlider.value = CriAtom.GetCategoryVolume(BGMCategoryName); }
// Use this for initialization. void Start() { /* The DSP bus setting is specified on the CRIWARE Object side. */ //CriAtom.AttachDspBusSetting("DspBusSetting_0"); /* Add the level monitor feature for in-game previewing. */ CriAtom.SetBusAnalyzer(true); }
private SoundSheet GetSoundSheet(CueInfo cueInfo) { if (cueInfo == null) { return(null); } var assetPath = cueInfo.CueSheetPath; var soundSheet = managedSoundSheets.GetValueOrDefault(assetPath); if (soundSheet == null) { // パス情報生成. var acbPath = SoundSheet.AcbPath(assetPath); var awbPath = SoundSheet.AwbPath(assetPath); // ACBファイルのロード. CriAtomCueSheet cueSheet = null; try { cueSheet = CriAtom.AddCueSheet(assetPath, acbPath, awbPath); } catch (Exception ex) { Debug.LogException(ex); return(null); } if (cueSheet.acb == null) { return(null); } // ロードしたACBを保持した状態で再生成. soundSheet = new SoundSheet(assetPath, cueSheet.acb); managedSoundSheets.Add(soundSheet.AssetPath, soundSheet); var builder = new StringBuilder(); builder.AppendFormat("Load : {0} : {1}", cueInfo.Cue, cueInfo.CueId).AppendLine(); builder.AppendLine(); builder.AppendFormat("Cue : {0}", cueInfo.Cue).AppendLine(); builder.AppendFormat("CueId : {0}", cueInfo.CueId).AppendLine(); builder.AppendFormat("FileName : {0}", Path.GetFileName(acbPath)).AppendLine(); if (!string.IsNullOrEmpty(cueInfo.Summary)) { builder.AppendFormat("Summary: {0}", cueInfo.Summary).AppendLine(); } UnityConsole.Event(ConsoleEventName, ConsoleEventColor, builder.ToString()); } return(soundSheet); }
public void LoadCueSheet(string cueSheetName, int bgmCueId) { CriAtom.RemoveCueSheet(beforeBGMCueSheetName); beforeBGMCueSheetName = cueSheetName; CriAtom.AddCueSheet(beforeBGMCueSheetName, beforeBGMCueSheetName + ".acb", null, null); bgmSource.cueSheet = beforeBGMCueSheetName; bgmSource.volume = bgmVolume; bgmSource.Play(bgmCueId); }
public void LoadCpk() { CriPackageManager.I.LoadCPK("Common/common.cpk", (bool isSuceeded, CriPackageLoadController.BinderData data) => { //hoge CriAtom.AddCueSheet("Common/BGM", "Common/BGM.acb", "Common/BGM.awb", data.Binder); CriAtom.AddCueSheet("Common/SE", "Common/SE.acb", "", data.Binder); }); }
public override void OnInspectorGUI() { if (this.source == null) { return; } Undo.RecordObject(target, null); GUI.changed = false; { EditorGUI.indentLevel++; this.source.cueSheet = EditorGUILayout.TextField("Cue Sheet", this.source.cueSheet); this.source.cueName = EditorGUILayout.TextField("Cue Name", this.source.cueName); #if CRI_UNITY_EDITOR_PREVIEW GUI.enabled = false; atomComponent = (CriAtom)EditorGUILayout.ObjectField("CriAtom Object", atomComponent, typeof(CriAtom), true); GUI.enabled = (atomComponent != null); GUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Preview", GUILayout.MaxWidth(EditorGUIUtility.labelWidth - 5)); if (GUILayout.Button("Play", GUILayout.MaxWidth(60))) { StartPreviewPlayer(); } if (GUILayout.Button("Stop", GUILayout.MaxWidth(60))) { StopPreviewPlayer(); } } GUILayout.EndHorizontal(); GUI.enabled = true; #endif this.source.playOnStart = EditorGUILayout.Toggle("Play On Start", this.source.playOnStart); EditorGUILayout.Space(); this.source.volume = EditorGUILayout.Slider("Volume", this.source.volume, 0.0f, 1.0f); this.source.pitch = EditorGUILayout.Slider("Pitch", this.source.pitch, -1200f, 1200); this.source.loop = EditorGUILayout.Toggle("Loop", this.source.loop); this.source.use3dPositioning = EditorGUILayout.Toggle("3D Positioning", this.source.use3dPositioning); this.showAndroidConfig = EditorGUILayout.Foldout(this.showAndroidConfig, "Android Config"); if (this.showAndroidConfig) { EditorGUI.indentLevel++; EditorGUILayout.BeginHorizontal(); style.stretchWidth = true; this.source.androidUseLowLatencyVoicePool = EditorGUILayout.Toggle("Low Latency Playback", this.source.androidUseLowLatencyVoicePool); EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel--; } } if (GUI.changed) { EditorUtility.SetDirty(this.source); } }
private void OnEnable() { this.source = (CriAtomSource)base.target; this.style = new GUIStyle(); #if CRI_UNITY_EDITOR_PREVIEW /* シーンからCriAtomコンポーネントを見つけ出す */ atomComponent = (CriAtom)FindObjectOfType(typeof(CriAtom)); #endif }
public static bool RemoveCueSheet(CriAtomCueSheet cueSheet) { if (cueSheet == null || string.IsNullOrEmpty(cueSheet.name)) { return(false); } CriAtom.RemoveCueSheet(cueSheet.name); return(true); }
private void Volume() { if (!isSoundFade) { BGMVolume = BGMSlider.value; SEVolume = SESlider.value; CriAtom.SetCategoryVolume("BGM", BGMVolume / 10); CriAtom.SetCategoryVolume("Jingle", SEVolume / 10); CriAtom.SetCategoryVolume("SE", SEVolume / 10); CriAtom.SetCategoryVolume("wind", SEVolume / 10); } }
void Start() { Dc_OBJ = GameObject.FindGameObjectWithTag("Dc"); Dc = Dc_OBJ.GetComponent <Data_cabinet>(); Dc.Set_Time_Script(time); ops.Set_Dc_Script(Dc); CriAtom.SetBusAnalyzer(false); perfectTime = PlayerPrefs.GetFloat("perfectTime"); greatTime = PlayerPrefs.GetFloat("greatTime"); goodTime = PlayerPrefs.GetFloat("goodTime"); poorTime = PlayerPrefs.GetFloat("poorTime"); }
// Token: 0x060159D5 RID: 88533 RVA: 0x005807B4 File Offset: 0x0057E9B4 private bool GetCueInfo(string sheetName, string cueName, out CriAtomEx.CueInfo cueInfo) { cueInfo = default(CriAtomEx.CueInfo); CriAtomCueSheet cueSheet = CriAtom.GetCueSheet(sheetName); if (cueSheet == null) { global::Debug.LogError(string.Format("Failed to get cue sheet: {0}", sheetName)); return(false); } return(cueSheet.acb.GetCueInfo(cueName, out cueInfo)); }
// Token: 0x060159CF RID: 88527 RVA: 0x005806AC File Offset: 0x0057E8AC public void CRIAddCueSheet(string sheetName, string acbFullPath, string awbFullPath) { if (CriAtom.GetCueSheet(sheetName) == null) { CriAtomCueSheet criAtomCueSheet = CriAtom.AddCueSheet(sheetName, acbFullPath, awbFullPath, null); if (criAtomCueSheet == null || (criAtomCueSheet.acbFile == string.Empty && criAtomCueSheet.awbFile == string.Empty)) { global::Debug.LogError(string.Format("Failed to add cue sheet: sheetName={0}, acbFullPath={1}, awbFullPath={2}", sheetName, acbFullPath, awbFullPath)); this.CRIRemoveCueSheet(sheetName); } } }
private void Shutdown() { foreach (var cueCheet in this.cueSheets) { if (cueCheet.acb != null) { cueCheet.acb.Dispose(); cueCheet.acb = null; } } CriAtomPlugin.FinalizeLibrary(); CriAtom.instance = null; }
/** * <summary>キューシートの追加(メモリからの読み込み)</summary> * <param name='name'>キューシート名</param> * <param name='acbData'>ACBデータ</param> * <param name='awbFile'>AWBファイルパス</param> * <param name='awbBinder'>AWB用バインダオブジェクト(オプション)</param> * <returns>キューシートオブジェクト</returns> * <remarks> * <para header='説明'>引数に指定したデータとファイルパス情報からキューシートの追加を行います。<br/> * 同時に複数のキューシートを登録することが可能です。<br/> * <br/> * ファイルパスに対して相対パスを指定した場合は StreamingAssets フォルダからの相対でファイルをロードします。<br/> * 絶対パス、あるいはURLを指定した場合には指定したパスでファイルをロードします。<br/> * <br/> * CPKファイルにパッキングされたAWBファイルからキューシートを追加する場合は、 * awbBinder引数にCPKをバインドしたバインダを指定してください。<br/> * なお、バインダ機能はADX2LEではご利用になれません。<br/></para> * </remarks> */ public static CriAtomCueSheet AddCueSheet(string name, byte[] acbData, string awbFile, CriFsBinder awbBinder = null) { #if CRIWARE_FORCE_LOAD_ASYNC return(CriAtom.AddCueSheetAsync(name, acbData, awbFile, awbBinder)); #else CriAtomCueSheet cueSheet = CriAtom.instance.AddCueSheetInternal(name, "", awbFile, awbBinder); if (Application.isPlaying) { cueSheet.acb = CriAtom.instance.LoadAcbData(acbData, awbBinder, awbFile); } return(cueSheet); #endif }
public static bool AddCueSheet(CriAtomCueSheet cueSheet) { if (cueSheet == null || string.IsNullOrEmpty(cueSheet.name)) { return(false); } CriAtom.AddCueSheet( cueSheet.name, cueSheet.acbFile, cueSheet.awbFile); return(true); }
// 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 OnEnable() { this.source = (CriAtomSource)base.target; this.style = new GUIStyle(); m_followsOriginalSource = serializedObject.FindProperty("randomize3dConfig.followsOriginalSource"); m_calculationType = serializedObject.FindProperty("randomize3dConfig.calculationType"); m_calculationParameters = serializedObject.FindProperty("randomize3dConfig.calculationParameters"); #if CRI_UNITY_EDITOR_PREVIEW /* シーンからCriAtomコンポーネントを見つけ出す */ atomComponent = (CriAtom)FindObjectOfType(typeof(CriAtom)); #endif previewPlayer = new CriAtomEditor.PreviewPlayer(); }
// Update is called once per frame void Update() { if (_fadeOut) { _volume -= 0.01f; //BGMのボリュームを段階的に下げる CriAtom.SetCategoryVolume("BGM", _volume); if (_volume == 0.0f) { _volume = 0.0f; } } }
private void Shutdown() { this.player.Dispose(); foreach (var cueCheet in this.cueSheets) { if (cueCheet.acb != null) { cueCheet.acb.Dispose(); cueCheet.acb = null; } } CriAtomPlugin.FinalizeLibrary(); CriAtom.instance = null; }
private void Setup() { CriAtom.instance = this; CriAtomPlugin.InitializeLibrary(); if (!String.IsNullOrEmpty(this.acfFile)) { string acfPath = Path.Combine(CriWare.streamingAssetsPath, this.acfFile); CriAtomEx.RegisterAcf(null, acfPath); } if (!String.IsNullOrEmpty(dspBusSetting)) { AttachDspBusSetting(dspBusSetting); } foreach (var cueSheet in this.cueSheets) { cueSheet.acb = this.LoadAcbFile(cueSheet.acbFile, cueSheet.awbFile); } if (this.dontDestroyOnLoad) { GameObject.DontDestroyOnLoad(this.gameObject); } this.player = new CriAtomExPlayer(); }
private void OnEnable() { atom = (CriAtom)base.target; }
void GetSource() { if (this.atom == null) { // ref : http://qiita.com/shin5734/items/fcf02aa84516dfad5d9c // Project & Sceneにある GameObject を持つ全オブジェクトを取得 foreach(GameObject obj in Resources.FindObjectsOfTypeAll(typeof(GameObject))) { string path = AssetDatabase.GetAssetOrScenePath(obj); string sceneExtension = ".unity"; bool isExistInScene = Path.GetExtension(path).Equals(sceneExtension); if(isExistInScene){ CriAtom tmpAtom = obj.GetComponent<CriAtom>(); if(tmpAtom != null) { this.atom = tmpAtom;//シーン上のAtomSourceを借りる(再生用) break; } // シーンのオブジェクトを格納するリストに登録 }else{ // プロジェクトのオブジェクトを格納するリストに登録 } } } }