Object representing a snapshot in the mixer.
void Start() { // Start the music with the title screen one. currentSnapshot = TitleScreen; // Make it last through all scenes. DontDestroyOnLoad(this); }
static public int TransitionTo(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.Audio.AudioMixerSnapshot self = (UnityEngine.Audio.AudioMixerSnapshot)checkSelf(l); System.Single a1; checkType(l, 2, out a1); self.TransitionTo(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
private void UnPause() { Time.timeScale = 1; current = levelMusic; LevelMusicSource.UnPause(); current.TransitionTo(TransitionSeconds); StartCoroutine(PauseMusic(PauseMusicSource, current, TransitionSeconds * TimeWarpingFactor)); }
private void TransitionToSnapshot(AudioMixerSnapshot snapshot, float timeToReach) { if (snapshot == null || snapshot.audioMixer != this) { return; } snapshot.TransitionTo(timeToReach); }
void OnTriggerEnter( Collider col ) { AudioMixerSnapshot[] ams = new AudioMixerSnapshot[1]{snapshot}; if(audioMixer != null) { audioMixer.TransitionToSnapshots( ams, new float[1]{1.0f}, 1.0f ); } }
private void TransitionToSnapshot(AudioMixerSnapshot snapshot, float timeToReach) { if ((UnityEngine.Object) snapshot == (UnityEngine.Object) null) throw new ArgumentException("null Snapshot passed to AudioMixer.TransitionToSnapshot of AudioMixer '" + this.name + "'"); if ((UnityEngine.Object) snapshot.audioMixer != (UnityEngine.Object) this) throw new ArgumentException("Snapshot '" + snapshot.name + "' passed to AudioMixer.TransitionToSnapshot is not a snapshot from AudioMixer '" + this.name + "'"); snapshot.TransitionTo(timeToReach); }
private void Pause() { Time.timeScale = TimeWarpingFactor; current = pauseMusic; PauseMusicSource.UnPause(); current.TransitionTo(TransitionSeconds * TimeWarpingFactor); StartCoroutine(RepauseLater(TransitionSeconds * TimeWarpingFactor)); StartCoroutine(PauseMusic(LevelMusicSource, current, TransitionSeconds * TimeWarpingFactor)); }
IEnumerator PauseMusic(AudioSource toPause, AudioMixerSnapshot current, float time) { yield return new WaitForSeconds(time); if (this.current == current) { toPause.Pause(); } }
void Start() { sound_manager = GameObject.FindGameObjectWithTag("Sound_Manager").GetComponent<Sound_Manager>().GetInstance(); if (sound_manager.GetInstance() != null) { snapshot_normal = sound_manager.GetInstance().master_mixer.FindSnapshot("Snapshot"); snapshot_attack = sound_manager.GetInstance().master_mixer.FindSnapshot("Snapshot_Attack"); } }
// Use this for initialization void Start() { daySnapshot = myAudioMixer.FindSnapshot("Day"); nightSnapshot = myAudioMixer.FindSnapshot("Night"); if (transform.position.y > 0) day = true; else day = false; }
private void TransitionToSnapshot(AudioMixerSnapshot snapshot, float timeToReach) { if ((UnityEngine.Object)snapshot == (UnityEngine.Object)null) { throw new ArgumentException("null Snapshot passed to AudioMixer.TransitionToSnapshot of AudioMixer '" + this.name + "'"); } if ((UnityEngine.Object)snapshot.audioMixer != (UnityEngine.Object) this) { throw new ArgumentException("Snapshot '" + snapshot.name + "' passed to AudioMixer.TransitionToSnapshot is not a snapshot from AudioMixer '" + this.name + "'"); } snapshot.TransitionTo(timeToReach); }
static public int get_audioMixer(IntPtr l) { try { UnityEngine.Audio.AudioMixerSnapshot self = (UnityEngine.Audio.AudioMixerSnapshot)checkSelf(l); pushValue(l, self.audioMixer); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int get_audioMixer(IntPtr l) { try { UnityEngine.Audio.AudioMixerSnapshot self = (UnityEngine.Audio.AudioMixerSnapshot)checkSelf(l); pushValue(l, true); pushValue(l, self.audioMixer); return(2); } catch (Exception e) { return(error(l, e)); } }
private void TransitionToSnapshot(AudioMixerSnapshot snapshot, float timeToReach) { if (snapshot == null) { throw new ArgumentException("null Snapshot passed to AudioMixer.TransitionToSnapshot of AudioMixer '" + base.name + "'"); } if (snapshot.audioMixer != this) { throw new ArgumentException("Snapshot '" + snapshot.name + "' passed to AudioMixer.TransitionToSnapshot is not a snapshot from AudioMixer '" + base.name + "'"); } snapshot.TransitionTo(timeToReach); }
// Use this for initialization void Start() { myAudioMixer.SetFloat("sfxVol",0.75f); myAudioMixer.SetFloat("musicVol",0.75f); mainCam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>(); myRewindSound = this.gameObject.GetComponent<AudioSource>(); RewindSnap = myAudioMixer.FindSnapshot("Rewind"); NormalSnap = myAudioMixer.FindSnapshot("Normal"); NormalSnap.TransitionTo(.5f); StartCoroutine("record"); }
private void TransitionToSnapshot(AudioMixerSnapshot snapshot, float timeToReach) { if (snapshot == null) { throw new ArgumentException("null Snapshot passed to AudioMixer.TransitionToSnapshot of AudioMixer '" + base.name + "'"); } if (snapshot.audioMixer != this) { string[] textArray1 = new string[] { "Snapshot '", snapshot.name, "' passed to AudioMixer.TransitionToSnapshot is not a snapshot from AudioMixer '", base.name, "'" }; throw new ArgumentException(string.Concat(textArray1)); } snapshot.TransitionTo(timeToReach); }
static public int TransitionTo(IntPtr l) { try { UnityEngine.Audio.AudioMixerSnapshot self = (UnityEngine.Audio.AudioMixerSnapshot)checkSelf(l); System.Single a1; checkType(l, 2, out a1); self.TransitionTo(a1); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int TransitionTo(IntPtr l) { try { UnityEngine.Audio.AudioMixerSnapshot self = (UnityEngine.Audio.AudioMixerSnapshot)checkSelf(l); System.Single a1; checkType(l, 2, out a1); self.TransitionTo(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static int FindSnapshot(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Audio.AudioMixer obj = (UnityEngine.Audio.AudioMixer)ToLua.CheckObject <UnityEngine.Audio.AudioMixer>(L, 1); string arg0 = ToLua.CheckString(L, 2); UnityEngine.Audio.AudioMixerSnapshot o = obj.FindSnapshot(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void Awake() { if (this.CompareTag("AddKick")) { enterSnapShot = kickSnapShot; exitSnapShot = kickSnapShot; pitch = 1; } else if (this.CompareTag("AddSnare")) { enterSnapShot = addSnareSnapShot; exitSnapShot = kickSnapShot; pitch = 1.1f; } else if (this.CompareTag("AddBass")) { enterSnapShot = addBassSnapShot; exitSnapShot = kickSnapShot; pitch = 1.2f; } else if (this.CompareTag("AddArp1")) { enterSnapShot = addArp1SnapShot; exitSnapShot = kickSnapShot; pitch = 1.3f; } else if (this.CompareTag("AddArp2")) { enterSnapShot = addArp2SnapShot; exitSnapShot = kickSnapShot; pitch = 1.4f; } else if (this.CompareTag("AddLead1")) { enterSnapShot = addLead1SnapShot; exitSnapShot = kickSnapShot; pitch = 1.5f; } else if (this.CompareTag("AddLead2")) { enterSnapShot = addLead2SnapShot; exitSnapShot = kickSnapShot; pitch = 1.6f; } }
public override void OnEnter(Uzu.PanelEnterContext context) { _bgm_handle = Main.AudioController.PlayBgm(AudioClipIds.BGM_MAIN_LOOP); _bgm_handle._handle_audio_source.outputAudioMixerGroup = _bgm_mixer_group; _audio_normal_snapshot = _bgm_mixer_group.audioMixer.FindSnapshot("Normal"); _audio_paused_snapshot = _bgm_mixer_group.audioMixer.FindSnapshot("Paused"); this.bgm_audio_set_paused_mode(false); gameObject.SetActive(true); _home_score.set_string("0"); _home_score.set_string("0"); _time_text.set_string("0:00:00"); set_pause_icon_alpha(0); _tar_pause_icon_alpha = 0; _quarter_text.set_string(Main.LevelController._quarter_display); //Main.LevelController.StartLevel(); _fadein.set_alpha(1.0f); _fadein.set_target_alpha(0.0f); }
public void TransitTo(bool roar) { // If player begins the game. if (currentSnapshot == EndScreen) { currentSnapshot = TitleScreen; } // If player ends the first level. if (currentSnapshot == Level1) { currentSnapshot = EndScreen; } // If player restarts the game. if (currentSnapshot == TitleScreen) { currentSnapshot = Level1; } // Make the transition with the desired speed. currentSnapshot.TransitionTo(transitionSpeed); }
internal void TransitionToSnapshot(AudioMixerSnapshot snapshot, float timeToReach) { bool flag = snapshot == null; if (flag) { throw new ArgumentException("null Snapshot passed to AudioMixer.TransitionToSnapshot of AudioMixer '" + base.name + "'"); } bool flag2 = snapshot.audioMixer != this; if (flag2) { throw new ArgumentException(string.Concat(new string[] { "Snapshot '", snapshot.name, "' passed to AudioMixer.TransitionToSnapshot is not a snapshot from AudioMixer '", base.name, "'" })); } this.TransitionToSnapshotInternal(snapshot, timeToReach); }
public void Transition(int music) { if (music == 1) { snapshot = snapshotTitle; snapshot.TransitionTo (1.5f); } else if (music == 2) { snapshot = snapshotCastle; snapshot.TransitionTo (1.5f); } else if (music == 3) { snapshot = snapshotWin; snapshot.TransitionTo (1.5f); } else if (music == 4) { snapshot = snapshotDeath; snapshot.TransitionTo (1.5f); } }
public void transitionTo(int snapshot) { switch (snapshot) { case(1): introSource.Play (); intro.TransitionTo (timeTransition); currentSnap = intro; break; case(2): inGameSource.Play (); inGame.TransitionTo (timeTransition); currentSnap = inGame; break; case(3): paused.TransitionTo (timeTransition); currentSnap = paused; break; case(4): outroSource.Play (); outro.TransitionTo (timeTransition); currentSnap = outro; break; } }
void Awake() { if( m_mixingType == MixingType.PlayOneShot ) { if( m_audioSource == null ) Debug.LogError( gameObject.name + " AudioSource is not assigned" ); } if( m_mixingType == MixingType.FadeInOutParameter ) { if( m_audioMixer == null ) Debug.LogError( gameObject.name + " AudioMixer is not assigned" ); if( m_audioSource == null ) Debug.LogError( gameObject.name + " AudioSource is not assigned" ); } if( m_mixingType == MixingType.FadeToSnapshot ) { if( !string.IsNullOrEmpty(m_snapshotName) ) m_snapshot = m_audioMixer.FindSnapshot(m_snapshotName); else Debug.LogError( gameObject.name + " Snapshot name isn't assigned" ); } }
public MA_SnapshotInfo(AudioMixerSnapshot snap, float wt) { snapshot = snap; weight = wt; }
public void Set(Automation.TargetParam param, float value) { if (m_ignoreParam.Contains(param)) // 무시 목록에 없을 때만 실행한다. return; var info = s_infoDict[param]; if (info.mixerParamName != null) // ExposedParam을 조절하는 케이스 { m_mixer.SetFloat(info.mixerParamName, info.ToMixerParamValue(value)); } else { // Snapshot을 조절하는 케이스 AudioMixerSnapshot [] snapshots; if (!m_snapshotDict.TryGetValue(param, out snapshots)) // 해당 파라미터에 맞는 스냅샷 목록을 아직 레퍼런스로 소유하고 있지 않다면, 찾아서 등록 { int namecount = info.snapshotNames.Length; snapshots = new AudioMixerSnapshot[namecount]; for (int i = 0; i < namecount; i++) { snapshots[i] = m_mixer.FindSnapshot(info.snapshotNames[i]); } m_snapshotDict[param] = snapshots; } var calcvalue = info.ToMixerParamValue(value); _temp_snapshot_weight[0] = 1 - calcvalue; _temp_snapshot_weight[1] = calcvalue; m_mixer.TransitionToSnapshots(snapshots, _temp_snapshot_weight, 0.1f); } }
public extern void TransitionToSnapshots(AudioMixerSnapshot[] snapshots, float[] weights, float timeToReach);
// Start is called before the first frame update void Start() { battleSnapshot = mainMixer.FindSnapshot("Battle"); normalSnapshot = mainMixer.FindSnapshot("Normal"); }
public MixerSnapshotType(AudioMixerSnapshot snapshot) { Snapshot = snapshot; }
/**--------------------------------------------------------------------------------- * Initiates audioholder, snapshots, sounds and mixers. * Is used when first audio is called. */ private void initAudio() { GameObject audioHolder = Instantiate(Resources.Load("AudioHolder", typeof(GameObject))) as GameObject; DontDestroyOnLoad(audioHolder); AudioSource[] audioSources = audioHolder.GetComponents<AudioSource>(); loopSound = audioSources[0]; jumpSound = audioSources[1]; slideSound = audioSources[2]; collisionSound = audioSources[3]; fallingSound = audioSources[4]; winSound = audioSources[5]; MasterMixer = Resources.Load<AudioMixer>("Audio/MasterMixer"); paused = MasterMixer.FindSnapshot("Paused"); unPaused = MasterMixer.FindSnapshot("Unpaused"); }
// Use this for initialization void Start() { current = levelMusic; }
//Created this function to use to transition to various snapshots public void ToSnapshot(AudioMixerSnapshot snapshot, float time) { snapshot.TransitionTo (time); }
private extern void TransitionToSnapshotInternal(AudioMixerSnapshot snapshot, float timeToReach);
/// <summary>Finds matching snapshot in snapshots[] and performs multi-snapshot transition</summary> public void SetSnapshot (AudioMixerSnapshot snapshot, float weight, float transitionTime) { for (int i = 0; i < snapshots.Length; i++) { if (snapshot == snapshots[i]) { weights[i] = weight; MusicMixer.TransitionToSnapshots(snapshots, weights, transitionTime); return; } } Debug.LogError("Snapshot Doesn't match anything in Snapshots[]!"); }
public void FadeMusic(AudioMixerSnapshot snap, float duration) { if (snap != null) { snap.TransitionTo(duration); } }
public void FadeMusic(AudioMixerSnapshot snap) { if (snap != null) { FadeMusic(snap, m_standardTransitionTime); } }
public override void ShowGUI() { #if UNITY_5 numSnapshots = EditorGUILayout.IntSlider ("Number of snapshots:", numSnapshots, 1, 10); if (numSnapshots == 1) { snapshot = (AudioMixerSnapshot) EditorGUILayout.ObjectField ("Snapshot:", snapshot, typeof (AudioMixerSnapshot), false); } else { audioMixer = (AudioMixer) EditorGUILayout.ObjectField ("Audio mixer:", audioMixer, typeof (AudioMixer), false); if (numSnapshots < snapshotMixes.Count) { snapshotMixes.RemoveRange (numSnapshots, snapshotMixes.Count - numSnapshots); } else if (numSnapshots > snapshotMixes.Count) { if (numSnapshots > snapshotMixes.Capacity) { snapshotMixes.Capacity = numSnapshots; } for (int i=snapshotMixes.Count; i<numSnapshots; i++) { snapshotMixes.Add (new SnapshotMix ()); } } for (int i=0; i<snapshotMixes.Count; i++) { snapshotMixes[i].snapshot = (AudioMixerSnapshot) EditorGUILayout.ObjectField ("Snapshot " + (i+1).ToString () + ":", snapshotMixes[i].snapshot, typeof (AudioMixerSnapshot), false); snapshotMixes[i].weight = EditorGUILayout.FloatField ("Weight " + (i+1).ToString () + ":", snapshotMixes[i].weight); } } changeTime = EditorGUILayout.Slider ("Transition time (s):", changeTime, 0f, 10f); if (changeTime > 0f) { willWait = EditorGUILayout.Toggle ("Wait until finish?", willWait); } #else EditorGUILayout.HelpBox ("This Action is only available for Unity 5", MessageType.Info); #endif AfterRunningOption (); }