public int Play(AudioClip clip, AudioGroup audioGroup, float fadeInTime = 0, float volume = 1, float pitch = 1, bool loop = false, string tag = "") { if (_isSFXMute) { return(-1); } var sfxList = _sfxsDictionary[audioGroup]; if (sfxList.Count < _sfxsLimit[audioGroup]) { AudioSFX sfx = Instantiate <AudioSFX>(_audioSFXPrefab, Vector3.zero, Quaternion.identity, _sfxPoolTransform); sfx.Setup(clip.name, tag); sfxList.Insert(0, sfx); Play(sfx.AudioSource, clip, audioGroup, fadeInTime, volume, pitch, loop, tag); return(sfx.ID); } else { for (int i = (sfxList.Count - 1); i >= 0; --i) { if (!sfxList[i].IsActiveAndPlaying) { sfxList[i].Setup(clip.name, tag); Play(sfxList[i].AudioSource, clip, audioGroup, fadeInTime, volume, pitch, loop, tag); return(sfxList[i].ID); } } return(-1); } }
private void LoadGroupVolume(AudioGroup audioGroup) { string key = audioGroup + _volumeSuffix; _groupsVolume[audioGroup] = PlayerPrefs.GetFloat(key); SetMixerVolume0To1(Mixer, key, _groupsVolume[audioGroup]); }
public void SetValue(AudioGroup group, float value) { var volume = group.GetMixerVolume(value); audioMixer.SetFloat(group.Name, volume); PlayerPrefs.SetFloat(group.Name, value); }
protected override void Awake() { base.Awake(); this.m_zombies = new Array32 <Zombie>(1048576u); this.m_instances = new Array16 <ZombieInstance>(65536u); this.m_zombieGrid = new ushort[4665600]; this.m_renderBuffer = new ulong[1024]; this.m_materialBlock = new MaterialPropertyBlock(); this.ID_Color = Shader.PropertyToID("_Color"); this.ID_Speed = Animator.StringToHash("Speed"); this.ID_State = Animator.StringToHash("State"); this.ID_ZombieLocation = new int[16]; this.ID_ZombieColor = new int[16]; for (int i = 0; i < 16; i++) { this.ID_ZombieLocation[i] = Shader.PropertyToID("_CitizenLocation" + i); this.ID_ZombieColor[i] = Shader.PropertyToID("_CitizenColor" + i); } this.m_zombieLayer = LayerMask.NameToLayer("Citizens"); this.m_audioGroup = new AudioGroup(5, new SavedFloat(Settings.effectAudioVolume, Settings.gameSettingsFile, DefaultSettings.effectAudioVolume, true)); uint num; this.m_zombies.CreateItem(out num); ushort num2; this.m_instances.CreateItem(out num2); }
private AudioGroup GetAudioGroup(GameObject forSource) { AudioGroup audioGroup = null; _audioGroups.TryGetValue(forSource, out audioGroup); return(audioGroup); }
protected override void Awake() { base.Awake(); this.m_audioLocation = Path.Combine(DataLocation.gameContentPath, "Audio"); this.m_currentMusicFile = null; this.m_previousMusicFile = null; this.m_streamCrossFade = 0; this.m_listenerInfo = new AudioManager.ListenerInfo(); this.m_defaultGroup = new AudioGroup(3, new SavedFloat(Settings.uiAudioVolume, Settings.gameSettingsFile, DefaultSettings.uiAudioVolume, true)); this.m_ambientGroup = new AudioGroup(3, new SavedFloat(Settings.ambientAudioVolume, Settings.gameSettingsFile, DefaultSettings.ambientAudioVolume, true)); this.m_serviceProximity = new float[21]; this.m_subServiceProximity = new float[15]; this.m_eventBuffer = new FastList <AudioManager.SimulationEvent>(); this.m_mainAudioVolume = new SavedFloat(Settings.mainAudioVolume, Settings.gameSettingsFile, DefaultSettings.mainAudioVolume, true); this.m_musicAudioVolume = new SavedFloat(Settings.musicAudioVolume, Settings.gameSettingsFile, DefaultSettings.musicAudioVolume, true); this.m_tempBuffer1 = new byte[16384]; this.m_tempBuffer2 = new byte[16384]; this.m_streamBuffer = new float[65536]; this.m_streamLock = new object(); this.m_streamThread = new Thread(new ThreadStart(this.StreamThread)); this.m_streamThread.Name = "Music Stream"; this.m_streamThread.Priority = ThreadPriority.AboveNormal; this.m_streamThread.Start(); if (!this.m_streamThread.IsAlive) { CODebugBase <LogChannel> .Error(LogChannel.Core, "Audio stream thread failed to start!"); } GameObject gameObject = new GameObject("Audio Listener"); Object.DontDestroyOnLoad(gameObject); this.m_audioListener = gameObject.AddComponent <AudioListener>(); this.m_audioListener.enabled = false; gameObject.AddComponent <MusicFilter>(); }
private void UpdateUI(AudioGroup group, Slider slider, Text text) { var value = AudioManager.instance.GetValue(group); slider.value = value; text.text = Mathf.Round(value * 100).ToString(); }
public DestroyMonitor() { buildingManager = Singleton <BuildingManager> .instance; simulationManager = Singleton <SimulationManager> .instance; economyManager = Singleton <EconomyManager> .instance; coverageManager = Singleton <CoverageManager> .instance; nullAudioGroup = new AudioGroup(0, new SavedFloat("NOTEXISTINGELEMENT", Settings.gameSettingsFile, 0, false)); }
private void Awake() { for (int i = 0; i < this.m_AudioGroups.Count; i++) { AudioGroup group = this.m_AudioGroups[i]; group.audioSource = gameObject.AddComponent <AudioSource>(); } }
public void SetGroupVolume(AudioGroup audioGroup, float value) { _groupsVolume[audioGroup] = value; string key = audioGroup + _volumeSuffix; PlayerPrefs.SetFloat(key, value); SetMixerVolume0To1(Mixer, key, value); }
/* * private int DeleteGroup(int groupId) { * return _groupsCollection.Delete(x => x.Id == groupId); * } */ private int AddGroup(string name) { AudioGroup group = new AudioGroup(); group.Name = name; int id = _groupsCollection.Insert(group); return(id); }
IEnumerator Fade(AudioSource toFade, AudioGroup group = null, int groupIndex = -1) { if (!curFading.ContainsKey(toFade)) { yield break; } if (!toFade.isPlaying && curFading[toFade] > 0) { toFade.Play(); } float startVolume = group != null ? group.curVolumes[groupIndex] : toFade.volume; float targVolume = curFading[toFade]; float fadeAmount = 0f; while (fadeAmount < 1f) { if (!curFading.ContainsKey(toFade)) { yield break; } // if audio is refaded, restart the fade from current volume if (targVolume != curFading[toFade]) { StartCoroutine(Fade(toFade)); yield break; } float newVol = Mathf.Lerp(startVolume, targVolume, fadeAmount); if (group != null) { group.curVolumes[groupIndex] = newVol; newVol *= masterVol; } toFade.volume = newVol; fadeAmount += Time.deltaTime / fadeTime; yield return(0); } if (group != null) { group.curVolumes[groupIndex] = curFading[toFade]; } toFade.volume = curFading[toFade] * (group != null ? masterVol : 1f); if (curFading[toFade] <= 0) { toFade.Pause(); } curFading.Remove(toFade); }
public void StopAllByTag(AudioGroup audioGroup, string tag) { List <AudioSFX> sfxs = _sfxsDictionary[audioGroup].FindAll(sfx => sfx.Tag.Equals(tag)); foreach (AudioSFX sfx in sfxs) { Stop(audioGroup, sfx.ID); } }
public void Stop(AudioGroup audioGroup, int sfxId, float fadeOutTime = 0) { int index = _sfxsDictionary[audioGroup].FindIndex(sfx => sfx.ID.Equals(sfxId)); if (index != -1) { Stop(_sfxsDictionary[audioGroup][index].AudioSource, audioGroup, fadeOutTime); } }
public void Stop(AudioGroup audioGroup, string name, float fadeOutTime = 0) { int index = _sfxsDictionary[audioGroup].FindIndex(s => s.name.Equals("SFX_" + name)); if (index != -1) { Stop(_sfxsDictionary[audioGroup][index].AudioSource, audioGroup, fadeOutTime); } }
public void Stop(AudioSource source, AudioGroup audioGroup, float fadeOutTime = 0) { if (fadeOutTime > 0) { Job.Create(FadeOut(source, fadeOutTime)); } else { source.Stop(); } }
//Getter public float Get_Volume(AudioGroup group) { if (group == AudioGroup.BGM) { return(BGM_Volume + 80); } else { return(SE_Volume + 80); } }
public void StopSound(AudioGroup audioGroup) { soundDictionary.TryGetValue(audioGroup, out SoundTrack soundTrack); if (soundTrack?.sounds.Length > 0) { foreach (Sound sound in soundTrack.sounds) { sound.source.Stop(); } } }
public void AddAudioGroup(E_AUDIO_GROUP_TYPE eGroupType) { if (!m_AudioGroupList.ContainsKey(eGroupType)) { AudioGroup NewGroup = Instantiate <AudioGroup>(AudioGroupTemplate); NewGroup.gameObject.name = string.Concat(eGroupType.ToString(), " Auidio Group"); NewGroup.gameObject.transform.SetParent(m_trGroup); NewGroup.Init(eGroupType); m_AudioGroupList.Add(eGroupType, NewGroup); } }
public void Play(AudioSource source, AudioGroup audioGroup, float fadeInTime = 0) { if (fadeInTime > 0) { Job.Create(FadeIn(source, fadeInTime)); } else { source.Play(); } }
void FadeOutGroup(AudioGroup audioGroup) { for (int i = 0; i < audioGroup.sources.Length; i++) { AudioSource source = audioGroup.sources[i]; if (source) { FadeSource(source, 0, audioGroup, i); } } }
private AudioGroup GetOrAddAudioGroup(GameObject forSource) { AudioGroup audioGroup = GetAudioGroup(forSource); if (audioGroup == null) { audioGroup = new AudioGroup(); _audioGroups.Add(forSource, audioGroup); } return(audioGroup); }
void FadeSource(AudioSource toFade, float toVolume, AudioGroup group = null, int groupIndex = -1) { if (curFading.ContainsKey(toFade)) { curFading[toFade] = toVolume; } else { curFading.Add(toFade, toVolume); StartCoroutine(Fade(toFade, group, groupIndex)); } }
private AudioProgram UpdateProgram(Dictionary <string, object> programDict) { string currentGroupName = (string)programDict["currentGroupName"]; string updateGroupName = (string)programDict["updateGroupName"]; string currentProgramName = (string)programDict["currentName"]; string updateProgramName = (string)programDict["updateName"]; AudioProgram currentProgram = _programsCollection.FindOne(x => x.GroupName == currentGroupName && x.Name == currentProgramName); if (currentProgram != null) { //are we changing the group name if (!updateGroupName.Equals(currentProgram.GroupName)) { //we are changing the group name; so is the current program the last program in the current group? //if so then delete the old group IEnumerable <AudioProgram> programs = _programsCollection.Find(x => x.GroupName.Equals(currentProgram.GroupName)); if (programs.Count() == 1) { //this is the last program with a GroupName that is changing, so delete the group _groupsCollection.Delete(x => x.Name.Equals(currentProgram.GroupName)); } } //does the new group exist in db? int groupId; AudioGroup group = _groupsCollection.FindOne(x => x.Name.Equals(updateGroupName)); if (group == null) //if not then create it { groupId = AddGroup(updateGroupName); } else { groupId = group.Id; } AudioProgram audioProgram = new AudioProgram(); audioProgram.Id = currentProgram.Id; audioProgram.Name = updateProgramName; audioProgram.Start = (int)programDict["Start"]; audioProgram.Stop = (int)programDict["Stop"]; audioProgram.Dow = (ArrayList)programDict["Dow"]; audioProgram.Url = (string)programDict["Url"]; audioProgram.GroupName = updateGroupName; audioProgram.GroupId = groupId; bool found = _programsCollection.Update(audioProgram); //debug 'found' return(currentProgram); } else { return(null); } }
public void SetAudioGroup(E_AUDIO_GROUP_TYPE eAudioGroup) { if (SoundManager.Instance == null) { return; } m_AudioGroup = SoundManager.Instance.GetAudioGroup(eAudioGroup); if (m_AudioGroup != null) { m_AudioGroup.AddAudioObject(this); } }
List <AudioObject> AudioObjectsInAudioGroup(AudioGroup _group, List <AudioObject> _list) { List <AudioObject> _audioObjects = new List <AudioObject>(); for (int i = 0; i < _list.Count; i++) { if (_list[i].audioGroup.name == _group.name) { _audioObjects.Add(_list[i]); } } return(_audioObjects); }
public void Play(AudioSource source, AudioClip clip, AudioGroup audioGroup, float fadeInTime = 0, float volume = 1, float pitch = 1, bool loop = false, string tag = "") { if (_isSFXMute) { return; } source.clip = clip; source.volume = volume; source.pitch = pitch; source.loop = loop; Play(source, audioGroup, fadeInTime); }
private void CreateEffect() { AudioGroup.Play(GetComponent <AudioGroup> ().hit, gameObject); if (BattleGame.instance.mapCamera.cameraControl.IsPointInsideCamera(gameObject.transform.position)) { BattleGame.instance.mapCamera.cameraControl.Shake(); } GameObject effectObj = GameObject.Instantiate(explode) as GameObject; RenderHelper.ChangeWholeModelColor(effectObj, Color.red); effectObj.transform.position = new Vector3(transform.position.x, 1, transform.position.z); }
private bool UpdateSession(string groupName) { AudioGroup group = _groupsCollection.FindOne(x => x.Name.Equals(groupName)); if (group != null) { AudioSession audioSession = new AudioSession(); audioSession.Id = 1; audioSession.GroupId = group.Id; audioSession.GroupName = groupName; return(_sessionCollection.Update(audioSession)); } return(false); }
void FadeInGroup(AudioGroup audioGroup) { for (int i = 0; i < audioGroup.sources.Length; i++) { AudioSource source = audioGroup.sources[i]; if (source && i < audioGroup.targVols.Length) { FadeSource(source, audioGroup.targVols[i], audioGroup, i); } else { Debug.LogWarning("Audiogroup " + audioGroup.groupName + " isn't set up properly"); } } }
void FadeInGroup( AudioGroup audioGroup ) { for ( int i = 0; i < audioGroup.sources.Length; i++ ) { AudioSource source = audioGroup.sources[i]; if ( source && i < audioGroup.targVols.Length ) FadeSource ( source, audioGroup.targVols[i], audioGroup, i ); else Debug.LogWarning ( "Audiogroup " + audioGroup.groupName + " isn't set up properly" ); } }
void FadeOutGroup( AudioGroup audioGroup ) { for ( int i = 0; i < audioGroup.sources.Length; i++ ) { AudioSource source = audioGroup.sources[i]; if ( source ) FadeSource ( source, 0, audioGroup, i ); } }
void FadeSource( AudioSource toFade, float toVolume, AudioGroup group = null, int groupIndex = -1 ) { if ( curFading.ContainsKey ( toFade ) ) curFading[toFade] = toVolume; else { curFading.Add ( toFade, toVolume ); StartCoroutine ( Fade( toFade, group, groupIndex ) ); } }
void ScheduleNextSong(AudioGroup group, int startSampleOffset, int sampleLength, uint busStartTime) { lock (anchorLock) { // Adjust the sampleLength. sampleLength = (sampleLength > 0) ? sampleLength : group.TotalSampleTime - startSampleOffset; nextSong = new AudioToBusAnchor(group, startSampleOffset, sampleLength); nextSong.busSampleStartTime = busStartTime; } }
public override void PlayEffect(InstanceID id, EffectInfo.SpawnArea area, Vector3 velocity, float acceleration, float magnitude, AudioManager.ListenerInfo listenerInfo, AudioGroup audioGroup) { }
public bool IsAudioPlaying(AudioGroup group) { bool bPlaying = false; lock (anchorLock) { if (prevSong.IsValid() && prevSong.audioGroup == group) { bPlaying = prevSong.IsPlayingAtBusTime(busPlaySampleTime); } else if (curSong.IsValid() && curSong.audioGroup == group) { bPlaying = curSong.IsPlayingAtBusTime(busPlaySampleTime); } } return bPlaying; }
public void Restart() { //Stop(); //Play(); //if(curMusic != null) // curMusic.ClearLayerData(); AudioGroup groupToTrigger = (curMusic != null) ? curMusic : playbackMusic; curMusic = null; //hack to ensure it actually plays now! ScheduleNextMusic(groupToTrigger); }
/// <summary> /// Schedule's the provided Audio to be started at the sample location in the currently /// playing track indicated in the curSongSampleTransLoc parameter. /// If no song is currently playing, the playback occurs immediately. /// If the currently playing song has already played (or been read) beyond the transition point, this returns <c>false</c>. /// </summary> /// <returns><c>true</c>, if audio was scheduled, <c>false</c> otherwise.</returns> /// <param name="group">The audio group to schedule.</param> /// <param name="curSongSampleTransLoc">The sample location in the currently playing song to transition at. A value of <c>0</c> means "when the current song ends".</param> /// <param name="startSampleOffset">The start sample offset for the scheduled audio group.</param> /// <param name="sampleLength">The sample length of the audio to playback. A value of <c>0</c> means "until the end".</param> /// <param name="bReplaceIfExists">If set to <c>true</c> any previously queued song will be overwritten.</param> public bool PlayAudioScheduled(AudioGroup group, int curSongSampleTransLoc = 0, int startSampleOffset = 0, int sampleLength = 0, bool bReplaceIfExists = false) { bool bQueued = false; lock (anchorLock) { if (!nextSong.IsValid() || bReplaceIfExists) { if (!curSong.IsValid()) { // Just play it. Nothing already scheduled. bQueued = PlayAudio(group, startSampleOffset, sampleLength, bReplaceIfExists); } else if (curSongSampleTransLoc == 0) { // Play it after the current song completes. if (!sourceCom.isPlaying) { Play(); } // Schedule it! ScheduleNextSong(group, startSampleOffset, sampleLength, 0); bQueued = true; } else if(curSongSampleTransLoc >= curSong.audioSampleStartTime + (int)(busReadSampleTime - curSong.busSampleStartTime)) { // Play it at a specific location in the song. if (!sourceCom.isPlaying) { Play(); } // Schedule it! uint busScheduledTime = curSong.busSampleStartTime + (uint)(curSongSampleTransLoc - curSong.audioSampleStartTime); ScheduleNextSong(group, startSampleOffset, sampleLength, busScheduledTime); bQueued = true; } } } return bQueued; }
public bool PlayAudio(AudioGroup group, int startSampleOffset = 0, int sampleLength = 0, bool bReplaceIfExists = false) { bool bQueued = false; lock (anchorLock) { // TODO: Validate Group! Make sure that the length of the associated clip is greater than the buffer we have? Also, that it's not null? // If the length of the associated clip is LESS than the playback buffer, how do we handle the transition situation, etc.? Right now it would // simply go to silence. if (!nextSong.IsValid() || bReplaceIfExists) { if (!sourceCom.isPlaying) { Play(); } // Schedule the next song for "now". Instead of busReadSampleTime, "0" should also work. ScheduleNextSong(group, startSampleOffset, sampleLength, busReadSampleTime); bQueued = true; } } return bQueued; }
public void ClearAnchor() { audioGroup = null; }
public AudioToBusAnchor(AudioGroup _group, int _audioSampleStartTime, int _audioSampleLength) { audioGroup = _group; audioSampleStartTime = _audioSampleStartTime; audioSampleLength = _audioSampleLength; busSampleStartTime = 0; }
public AudioToBusAnchor() { audioGroup = null; audioSampleLength = 0; audioSampleStartTime = 0; busSampleStartTime = 0; }
IEnumerator Fade( AudioSource toFade, AudioGroup group = null, int groupIndex = -1 ) { if ( !curFading.ContainsKey( toFade ) ) yield break; if ( !toFade.isPlaying && curFading[toFade] > 0 ) toFade.Play (); float startVolume = group != null ? group.curVolumes[groupIndex] : toFade.volume; float targVolume = curFading[toFade]; float fadeAmount = 0f; while ( fadeAmount < 1f ) { if ( !curFading.ContainsKey( toFade ) ) yield break; // if audio is refaded, restart the fade from current volume if ( targVolume != curFading[toFade] ) { StartCoroutine ( Fade ( toFade ) ); yield break; } float newVol = Mathf.Lerp ( startVolume, targVolume, fadeAmount ); if ( group != null ) { group.curVolumes[groupIndex] = newVol; newVol *= masterVol; } toFade.volume = newVol; fadeAmount += Time.deltaTime / fadeTime; yield return 0; } if ( group != null ) group.curVolumes[groupIndex] = curFading[toFade]; toFade.volume = curFading[toFade] * ( group != null ? masterVol : 1f ); if ( curFading[toFade] <= 0 ) toFade.Pause (); curFading.Remove ( toFade ); }
void OnAudioEnded(AudioGroup group, int sampleTime) { if (curMusic == group) { Debug.Log("Audio ended!"); if (AutoLoop) { transMusic = curMusic; transMusicTime = 0; Debug.Log("Looping Music!"); } if (sampleTime != curMusicTime) { PerformChoreographyForTimeSlice(curMusic, curMusicTime + 1, sampleTime); } // Save some time if we're simply replaying the previous music. if (curMusic != transMusic) { group.UnregisterKoreography(); // Clean out Koreography linkages. group.ClearLayerData(); // Free up some space. } // Make sure we've loaded the new Koreography. if (transMusic != null && !transMusic.IsKoreographyRegistered()) { transMusic.RegisterKoreography(); } curMusic = transMusic; transMusic = null; curMusicTime = transMusicTime - 1; // -1 to get the initial sample. transMusicTime = 0; // Trigger the callback! if (MusicEnded != null) { MusicEnded(group); } if (AutoLoop) { AudioGroup groupToTrigger = curMusic; curMusic = null; //hack to ensure it actually plays now! ScheduleNextMusic(groupToTrigger); } } else { Debug.LogWarning("Unexpected music has completed playback."); } }
public void PlayMusic(AudioGroup group, int startSampleOffset = 0, int lengthInSamples = 0, bool bReplaceIfExists = false) { // TODO: Warn if channels/frequency not matching! // TODO: Validate AudioGroup (!group.IsEmpty())! if (!group.IsReady()) { group.InitLayerData(); } if (curMusic != null) { transMusic = group; transMusicTime = startSampleOffset; } else { curMusic = group; curMusicTime = startSampleOffset - 1; // -1 to get the initial sample. } group.RegisterKoreography(); if (!bus.PlayAudio(group, startSampleOffset, lengthInSamples, bReplaceIfExists)) { Debug.LogWarning("PlayMusic() failed with group: " + group + ", likely something already in the AudioBus?"); } }
private void Initialize() { this._buildingManager = Singleton<BuildingManager>.instance; this._simulationManager = Singleton<SimulationManager>.instance; this._effectManager = Singleton<EffectManager>.instance; this._economyManager = Singleton<EconomyManager>.instance; this._coverageManager = Singleton<CoverageManager>.instance; this._nullAudioGroup = new AudioGroup(0, new SavedFloat("NOTEXISTINGELEMENT", Settings.gameSettingsFile, 0f, false)); }
public void ScheduleNextMusic(AudioGroup group, int curMusicTransLoc = 0, int startSampleOffset = 0, int lengthInSamples = 0, bool bReplaceIfExists = false) { // TODO: Warn if channels/frequency not matching! // TODO: Validate AudioGroup (!group.IsEmpty())! if (!group.IsReady()) { group.InitLayerData(); // Delay this? } if (curMusic == null) { // Just play now. curMusic = group; curMusicTime = startSampleOffset - 1; // -1 to get the initial sample. bus.PlayAudio(group, startSampleOffset, lengthInSamples, bReplaceIfExists); } else if (transMusic == null || bReplaceIfExists) { if (bus.IsNextSongScheduled()) { // Next song is already in, meaning we're likely waiting for curSong to transition in. Save until buffers clear enough // to allow scheduling. if (!transInfo.bValid || bReplaceIfExists) { // Override or just make sure there's nothing there. transMusic = null; transMusicTime = 0; // Set up info for another try later! transInfo.bValid = true; transInfo.group = group; transInfo.curMusicTransLoc = curMusicTransLoc; transInfo.startSampleOffset = startSampleOffset; transInfo.lengthInSamples = lengthInSamples; transInfo.bReplaceIfExists = bReplaceIfExists; } else { Debug.LogWarning("MusicPlayer::ScheduleNextMusic() - Transition music already scheduled!"); } } else { // Set up the transition. transMusic = group; transMusicTime = startSampleOffset; // Koreography registration occurs later. That way we don't double-up or trigger unwanted samples until later. bus.PlayAudioScheduled(group, curMusicTransLoc, startSampleOffset, lengthInSamples, bReplaceIfExists); } } // else - don't do anything - we already have music scheduled and we were told NOT to replace it. }
void OnAudioEnded(AudioGroup songGroup, int sampleTime) { if (AudioEnded != null) { AudioEnded(songGroup, sampleTime); } }
void PerformChoreographyForTimeSlice(AudioGroup group, int startTime, int endTime) { for (int i = 0; i < curMusic.NumLayers; ++i) { AudioClip clip = curMusic.GetClipAtLayer(i); Koreographer.Instance.ProcessChoreography(clip, startTime, endTime); } }
public int GetSampleTimeOfAudio(AudioGroup group) { int sampleTime = 0; lock (anchorLock) { if (prevSong.IsValid() && prevSong.audioGroup == group) { sampleTime = GetSampleTimeOfAnchor(prevSong); } else if (curSong.IsValid() && curSong.audioGroup == group) { sampleTime = GetSampleTimeOfAnchor(curSong); } } return sampleTime; }