public void Play(float pitch, float pan, float volume, bool loopTrack) { _volume = volume; if (!IsPlaying) { _currentClipInstance = SoundEffectFile.CreateInstance(); _currentClipInstance.Pitch = pitch; _currentClipInstance.Pan = pan; _currentClipInstance.Volume = volume; _currentClipInstance.IsLooped = loopTrack; _currentClipInstance.Play(); } }
private bool AddSoundEffect(string soundEffectName, SoundEffectFile soundEffectFile, bool forceReplace) { var soundEffectFileLower = soundEffectName.ToLowerInvariant(); if (SoundEffectFiles.ContainsKey(soundEffectFileLower)) { if (forceReplace && SoundEffectFiles[soundEffectFileLower].IsStandard) { SoundEffectFiles.Remove(soundEffectFileLower); } else { return(true); } } SoundEffectFiles.Add(soundEffectFileLower, new SoundEffectClip(soundEffectFile)); //if (!soundEffectFile.ForceLoad()) //{ // Logger.Log(Logger.LogTypes.Warning, $"SoundTrack.cs: File at \"{soundEffectFile.LocalPath}\" is not a valid music file!"); // return false; //} return(true); }
public SoundEffectClip(SoundEffectFile soundEffectFile) { SoundEffectFile = soundEffectFile; }