private void InitDuckedCategoryDefs() { if (this.m_DuckAllCategories && (this.m_GlobalDuckDef != null)) { this.m_DuckedCategoryDefs = new List <SoundDuckedCategoryDef>(); IEnumerator enumerator = Enum.GetValues(typeof(SoundCategory)).GetEnumerator(); try { while (enumerator.MoveNext()) { SoundCategory current = (SoundCategory)((int)enumerator.Current); if (current != SoundCategory.NONE) { SoundDuckedCategoryDef dst = new SoundDuckedCategoryDef(); SoundUtils.CopyDuckedCategoryDef(this.m_GlobalDuckDef, dst); dst.m_Category = current; this.m_DuckedCategoryDefs.Add(dst); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable == null) { } disposable.Dispose(); } } }
public Sound(string name, SoundCategory category) { Name = name; Category = category; AudioFile = String.Format("/AppSoundsAndImages/Audio/{0}/{1}.mp3", category, name); ImageFile = String.Format("/AppSoundsAndImages/Images/{0}/{1}.jpg", category, name); }
public Sound(string name, SoundCategory soundCategory) { Name = name; Category = soundCategory; AudioFile = string.Format("/assets/Audio/{1}/{0}.wav", name, soundCategory); ImageFile = string.Format("/assets/Images/{1}/{0}.png", name, soundCategory); }
/// <summary> /// ボリュームの取得 /// </summary> /// <param name="soundCategory">サウンドカテゴリ</param> /// <returns>ボリューム (0-1)</returns> public float GetVolume(SoundCategory soundCategory) { string volumeName = null; switch (soundCategory) { case SoundCategory.Master: volumeName = MasterVolumeName; break; case SoundCategory.Bgm: volumeName = BgmVolumeName; break; case SoundCategory.Se: volumeName = SeVolumeName; break; case SoundCategory.Voice: volumeName = VoiceVolumeName; break; default: Debug.LogWarning($"Invalid SoundCategory. [soundCategory={soundCategory}]"); break; } if (!string.IsNullOrEmpty(volumeName)) { audioMixer.GetFloat(volumeName, out float dbVolume); float volume = SoundUtil.CalcGetDbToVolume(dbVolume); return(volume); } else { return(0.0f); } }
// Local Utils private void AddSoundToTypeList(AudioSource source, SoundCategory type) { if (!m_PlayingSoundsByType.ContainsKey(source)) { m_PlayingSoundsByType.Add(source, type); } }
public void test() { SoundCategory testCategory = new SoundCategory("Test Category"); SoundGroup testGroup = new SoundGroup("Test Group"); SoundSource testSource = new SoundSource("Test Source"); SoundCategory test2 = new SoundCategory("Test Category 2"); SoundGroup testgroup2 = new SoundGroup("Test Group 2"); SoundSource testsource2 = new SoundSource("Test Source 2"); AudioClip testaudio = (AudioClip)Resources.Load("Jump",typeof(AudioClip)); AudioClip testaudio2 = (AudioClip)Resources.Load("Jump1",typeof(AudioClip)); testSource.setGameObject(GameObject.FindGameObjectWithTag("Dragged")); testSource.addAudioClip(testaudio); testSource.addAudioClip(testaudio2); testgroup2.sources.Add(testsource2); test2.groups.Add(testgroup2); _categories.Add(test2); testGroup.sources.Add(testSource); testCategory.groups.Add(testGroup); _categories.Add(testCategory); }
public Sound(string name, SoundCategory category) { this.Name = name; this.Category = category; AudioFile = $"/Assets/Audio/{category}/{name}.wav"; ImageFile = $"/Assets/Images/{category}/{name}.png"; }
public Sound(string name, SoundCategory category) { Name = name; Category = category; Audiofile = $"/Assets/Audio/{category}/{name}.wav"; ImageFile = $"/Assets/Audio/{category}/{name}.png"; }
public Sound(string name, SoundCategory category) { Name = name; Category = category; AudioFile = String.Format("/Assets/Audio/{0}/{1}.wav", category, name); ImageFile = String.Format("/Assets/Images/{0}/{1}.png", category, name); }
public Sound(string Name, SoundCategory Category) { name = Name; category = Category; audioFile = $"/Assets/Audio/{Category}/{Name}.wav"; imageFile = $"/Assets/Images/{Category}/{Name}.png"; }
public Sound(string name, SoundCategory category) { Name = name; Category = category; ImagePath = string.Format("Assets/Images/{0}/{1}.png", category, name); AudioPath = string.Format("Assets/Audio/{0}/{1}.wav", category, name); }
public async Task <IHttpActionResult> PutSoundCategory(int id, SoundCategory soundCategory) { if (!this.ModelState.IsValid) { return(BadRequest(this.ModelState)); } if (id != soundCategory.Id) { return(BadRequest()); } this.db.Entry(soundCategory).State = EntityState.Modified; try { await this.db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SoundCategoryExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public static void GetSoundByCategory(ObservableCollection<Sound> sounds, SoundCategory soundCategory) { var allSounds = getSounds(); var filterSounds = allSounds.Where(p => p.Category == soundCategory).ToList(); sounds.Clear(); filterSounds.ForEach(p => sounds.Add(p)); }
public static void GetSoundsByCategory(ObservableCollection <Sound> sounds, SoundCategory soundCategory) { var filteredSounds = getSounds().Where(p => p.Category == soundCategory).ToList(); sounds.Clear(); filteredSounds.ForEach(p => sounds.Add(p)); }
//getters & setters public Sound(String name, SoundCategory category) { Name = name; Category = category; AudioFile = String.Format("/Assets/Audio/{0}/{1}.wav", category, name); // reads in audio files for each category and then name ImageFile = String.Format("/Assets/Images/{0}/{1}.png", category, name); // reads in image files for each category and then name }// Sound constructor
//停止某个类别的声音 public void StopCategory(SoundCategory _Cat) { foreach (var item in soundCategoryDic[_Cat]) { item.Stop(); } }
public Sound(string name,SoundCategory category) { Name = name; Category = category; AudioFile = String.Format("/Assets/Audio/{0}/{1}.wav", category, name); ImageFile = String.Format("/Assets/Images/{0}/{1}.png", category, name); }
public static Option GetCategoryVolumeOption(SoundCategory cat) { Option iNVALID = Option.INVALID; SoundDataTables.s_categoryVolumeOptionMap.TryGetValue(cat, out iNVALID); return(iNVALID); }
public SoundEffect(Sounds soundId, SoundPosition position, SoundCategory category = SoundCategory.Master, float pitch = 1.0f, float volume = 1f) { this.SoundId = soundId; this.Position = position; this.Category = category; this.Pitch = pitch; this.Volume = volume; }
public Sound(string name, SoundCategory soundCategory) { Name = name; Category = soundCategory; AudioFile = String.Format("/Assets/Audio/{0}/{1}.mp3", Category, name); ImageFile = String.Format("/Assets/Images/{0}/{1}.jpg", Category, name); }
public static bool IsCategoryAudible(SoundCategory cat) { if (GetCategoryVolume(cat) <= Mathf.Epsilon) { return(false); } return(IsCategoryEnabled(cat)); }
public AudioSource Play3DSound(string soundName, float volume, SoundCategory category, Transform parent) { AudioSource source = PlaySound(soundName, volume, category); source.transform.parent = parent; return(source); }
public static void GetSoundByCategory(SoundCategory category, ObservableCollection <Sound> sounds) { var allSounds = GetSounds(); var filterSound = allSounds.Where(p => p.Category == category).ToList(); sounds.Clear(); filterSound.ForEach(p => sounds.Add(p)); }
public static void GetSoundsByCategory(ObservableCollection <Sound> sounds, SoundCategory category) { var allSounds = getSounds(); //added all sounds var filteredSounds = allSounds.Where(sound => sound.Category == category).ToList(); //filtered sounds to category sounds.Clear(); filteredSounds.ForEach(sound => sounds.Add(sound));//lambda expression }
public static void GetSoundByCategory(ObservableCollection <Sound> sounds, SoundCategory category) { var value = SetSound(); var newvalue = value.Where(p => p.Category == category).ToList(); sounds.Clear(); newvalue.ForEach(p => sounds.Add(p)); }
public static void GetSoundsByCategory(ObservableCollection <Sound> sounds, SoundCategory category) { var allSounds = getSounds(); var filteredSounds = allSounds.Where(sound => sound.Category == category).ToList(); sounds.Clear(); filteredSounds.ForEach(sound => sounds.Add(sound)); }
public static void GetSoundsByCategory(ObservableCollection <Sound> sounds, SoundCategory requiredCategory) { sounds.Clear(); var AllSounds = GetSounds(); var FilteredSounds = AllSounds.Where(p => p.Category == requiredCategory).ToList(); FilteredSounds.ForEach(p => sounds.Add(p)); }
public SoundEffect(Sounds soundId, SoundPosition position, SoundCategory category = SoundCategory.Master, float pitch = 1f, float volume = 1f) { SoundId = soundId; Position = position; Category = category; Pitch = pitch; Volume = volume; }
public static void GetSoundsByCategory(ObservableCollection <Sound> sounds, SoundCategory soundCategory) { var allSounds = getSounds(); var filteredSounds = allSounds.Where(p => p.Category == soundCategory).ToList(); sounds.Clear(); // clears collection of anything in there filteredSounds.ForEach(p => sounds.Add(p)); // reads in all sounds and populates the collection by category }
/// <summary> /// Play a sound and make it loop forever, you will have to stop it manualy. /// </summary> /// <param name="soundName"></param> /// <param name="volume"></param> /// <returns></returns> public AudioSource PlayLoopSound(string soundName, float volume, SoundCategory category) { AudioSource source = PlaySound(soundName, volume, category); source.loop = true; return(source); }
public Sound(string name, string soundName, SoundCategory category) { SoundName = soundName; Name = name; Category = category; SoundName = soundName; AudioFile = String.Format("/Assets/Audio/{0}/{1}.mp3", category, name); ImageFile = String.Format("/Assets/Images/{0}/{1}.jpg", category, name); }
//New constructor to include artist and album public Sound(string name, string artist, string album, SoundCategory category) { Name = name; Artist = artist; Album = album; Category = category; AudioFile = $"/Assets/Audio/{category}/{name}.mp3"; ImageFile = $"/Assets/Images/{category}/{name}.png"; }
private void MenuListView_ItemClick(object sender, ItemClickEventArgs e) { SoundCategory Category = (SoundCategory)(((MenuItem)e.ClickedItem).Category); CategoryTextBlock.Text = Category.ToString(); SoundManager.GetSoundsByCategory(Sounds, Category); BackButton.Visibility = Visibility.Visible; MySplitView.IsPaneOpen = false; }
/// <summary> /// /// </summary> /// <param name="s"></param> /// <param name="cat"> Set to null to bypass auto volume settings.</param> /// <param name="loop"></param> /// <param name="volume"></param> /// <param name="pitch"></param> /// <param name="pan"></param> internal static void PlaySound(SoundEffect s, SoundCategory cat, bool loop = false, float volume = 1, float pitch = 0, float pan = 0) { if (s == null || s.IsDisposed) return; if (cat == SoundCategory.Music) volume = Manager.GameSettings.MusicVolume; if (cat == SoundCategory.SFX) volume = Manager.GameSettings.SFXVolume; s.Play(volume, pitch, pan); if (loop && !looping.ContainsKey(s)) looping.Add(s, new SFXData(volume, pitch, pan)); }
/// <summary> /// Registers a single sound in a given category, creating it /// if needed. /// </summary> public void Register(string category, FileInfo soundFile) { // Create the category if we don't have it, otherwise load // it into a variable SoundCategory sc = null; if (!categories.Contains(category)) { sc = new SoundCategory(); sc.Name = category; categories[category] = sc; } else { sc = categories[category]; } // Add this file sc.Add(soundFile); }