void UpdateFromModel() { soundEffect = soundEffectSystem.GetSoundEffect(sfxId); // Be forgiving with data errors because this data can come from serialized // data, over the network, etc, so just fail instead of crashing if there // is something wrong: if (soundEffect.content.effectType != SoundEffectType.Synthesized) { Debug.LogWarning("SynthSoundEditor can only edit synth based sounds."); Close(); return; } if (soundEffect.content.synthParams == null) { Debug.LogWarning("SynthSoundEditor: missing synth params. Can't edit."); Close(); return; } UpdateWidgetsFromModel(); ClipSynthesizer synth = new ClipSynthesizer(soundEffect.content.synthParams); previewClip = synth.GetAudioClip(); }
private void PreloadAndCacheSoundEffect(SoundEffect sfx) { if (sfx.content.effectType == SoundEffectType.Synthesized) { ClipSynthesizer synth = new ClipSynthesizer(sfx.content.synthParams); audioClipCache[sfx.id] = synth.GetAudioClip(); } else if (sfx.content.effectType == SoundEffectType.SteamWorkshop) { workshopAssetSource.Get(sfx.content.steamWorkshopId, result => OnWorkshopAssetLoaded(sfx, result)); } else { Debug.LogWarning("Unknown SFX type: " + sfx.content.effectType + " for id " + sfx.id); } }