public void Stop() { if (instance != null) { instance.stop(AllowFadeout ? FMOD.Studio.STOP_MODE.ALLOWFADEOUT : FMOD.Studio.STOP_MODE.IMMEDIATE); instance.release(); instance = null; } enabled = false; }
// Use this for initialization void Start () { _eventGrow = FMODUnity.RuntimeManager.CreateInstance (_EventGrow); _eventHeight = FMODUnity.RuntimeManager.CreateInstance (_EventHeight); _eventSplit = FMODUnity.RuntimeManager.CreateInstance (_EventSplit); _eventPush = FMODUnity.RuntimeManager.CreateInstance (_EventPush); _eventJump = FMODUnity.RuntimeManager.CreateInstance (_EventJump); _eventJump = FMODUnity.RuntimeManager.CreateInstance (_EventJump); _eventJump.getParameter (Parameter_nameJump, out _varSoundJump); }
void Awake() { #if !MOBILE_INPUT // Create a layer mask for the floor layer. floorMask = LayerMask.GetMask("Floor"); #endif anim = GetComponent<Animator>(); playerRigidbody = GetComponent<Rigidbody>(); isMoving = false; footStepsAudio = FMOD_StudioSystem.instance.GetEvent("event:/sfx/player/footSteps"); footStepsAudio.getParameter("distFromCave", out verb); }
public void Play() { if (TriggerOnce && hasTriggered) { return; } if (String.IsNullOrEmpty(Event)) { return; } if (eventDescription == null) { Lookup(); eventDescription.isOneshot(out isOneshot); } // Let previous oneshot instances play out if (isOneshot && instance != null) { instance.release(); instance = null; } if (instance == null) { eventDescription.createInstance(out instance); } instance.set3DAttributes(RuntimeUtils.To3DAttributes(gameObject, cachedRigidBody)); foreach(var param in Params) { instance.setParameterValue(param.Name, param.Value); } instance.start(); hasTriggered = true; // Only want to update if we need to set 3D attributes bool is3d = false; eventDescription.is3D(out is3d); if (is3d) { enabled = true; } }
// Use this for initialization void Start () { _event = FMODUnity.RuntimeManager.CreateInstance (Event); _event.getParameter (Parameter_name, out _varSound); _event.start (); }
void SetParameter(FMOD.Studio.EventInstance e, string name, float value) { e.setParameterByName(name, value); }
/// <summary> /// setup ui on start /// </summary> private void Start() { // Initializing sounds bucketPlacedOnSnow_sfx = FMODUnity.RuntimeManager.CreateInstance("event:/SFX/BucketPlacedOnSnow"); throwWoodToFire_sfx = FMODUnity.RuntimeManager.CreateInstance("event:/SFX/ThrowWoodToFire"); startStove_sfx = FMODUnity.RuntimeManager.CreateInstance("event:/SFX/StartStove"); bucket.button.onClick.AddListener(() => { switch (GameStateMachine.Instance.CurrentMinigame) { case Minigame.SNOW_GATHERING: bucketPlacedOnSnow_sfx.start(); if (minigameSnowGathering.BucketState) { if (minigameSnowGathering.BucketIsFull) { BucketFillState = BucketState.SNOWY; } minigameSnowGathering.BucketState = false; } else if (bucket.state == BucketState.EMPTY) { minigameSnowGathering.BucketState = true; } break; case Minigame.SNOW_MELTING: if (BucketFillState != BucketState.EMPTY) { if (!minigameSnowMelting.BucketPlaced) { startStove_sfx.start(); } minigameSnowMelting.ToggleBucket(!minigameSnowMelting.BucketPlaced); if (BucketFillState == BucketState.BOILED) { Resources.Instance.AddWater(Constants.WATER_PER_BUCKET); BucketFillState = BucketState.EMPTY; } } break; } }); furniturePieces.button.onClick.AddListener(() => { if (GameStateMachine.Instance.CurrentMinigame == Minigame.FIRE_REFUELING) { if (minigameFireRefueling.AddToFire()) { // play wood throwing sound effects throwWoodToFire_sfx.start(); FurniturePieceCount--; } } }); BucketFillState = BucketState.EMPTY; FurniturePieceCount = 0; blurContainerMaterialInstance = new Material(blurContainer.material); blurContainer.material = blurContainerMaterialInstance; DisableAllMinigames(); StartCoroutine(DelayedStart()); }
void Update() { if (instance != null) { instance.set3DAttributes(RuntimeUtils.To3DAttributes(gameObject, cachedRigidBody)); FMOD.Studio.PLAYBACK_STATE state; instance.getPlaybackState(out state); if (state == FMOD.Studio.PLAYBACK_STATE.STOPPED) { instance.release(); instance = null; enabled = false; } } }
public void Play() { if (TriggerOnce && hasTriggered) { return; } if (String.IsNullOrEmpty(Event)) { return; } if (eventDescription == null) { Lookup(); } bool isOneshot = false; if (!Event.StartsWith("snapshot", StringComparison.CurrentCultureIgnoreCase)) { eventDescription.isOneshot(out isOneshot); } bool is3D; eventDescription.is3D(out is3D); if (instance != null && !instance.isValid()) { instance = null; } // Let previous oneshot instances play out if (isOneshot && instance != null) { instance.release(); instance = null; } if (instance == null) { eventDescription.createInstance(out instance); // Only want to update if we need to set 3D attributes if (is3D) { var rigidBody = GetComponent <Rigidbody>(); var transform = GetComponent <Transform>(); instance.set3DAttributes(RuntimeUtils.To3DAttributes(gameObject, rigidBody)); RuntimeManager.AttachInstanceToGameObject(instance, transform, rigidBody); } } foreach (var param in Params) { instance.setParameterValue(param.Name, param.Value); } instance.start(); hasTriggered = true; }
public static bool SetResonanceAudioSourceMaxDistance(FMOD.Studio.EventInstance eventInstance, float maxDistanceValue) { if (!eventInstance.isValid() || maxDistanceValue < 0) { return(false); } FMOD.RESULT result; FMOD.ChannelGroup channelGroup; result = eventInstance.getChannelGroup(out channelGroup); if (result != FMOD.RESULT.OK) { Debug.Log(result); return(false); } int dspNumber; result = channelGroup.getNumDSPs(out dspNumber); if (result != FMOD.RESULT.OK) { Debug.Log(result); return(false); } for (int i = 0; i < dspNumber; i++) { FMOD.DSP dsp; result = channelGroup.getDSP(i, out dsp); if (result != FMOD.RESULT.OK) { Debug.Log(result); continue; } result = dsp.getInfo(out string name, out uint version, out int channels, out int configWidth, out int configHeight); if (result != FMOD.RESULT.OK) { Debug.Log(result); continue; } if (name == "Resonance Audio Source") { result = dsp.getNumParameters(out int parameterNumber); if (result != FMOD.RESULT.OK) { Debug.Log(result); continue; } for (int j = 0; j < parameterNumber; j++) { result = dsp.getParameterInfo(j, out FMOD.DSP_PARAMETER_DESC description); if (result != FMOD.RESULT.OK) { Debug.Log(result); continue; } string stringName = System.Text.Encoding.UTF8.GetString(description.name); if (String.Equals(stringName, "Max Distance", StringComparison.InvariantCultureIgnoreCase)) { result = dsp.setParameterFloat(j, maxDistanceValue); if (result != FMOD.RESULT.OK) { Debug.Log(result); continue; } return(true); } } } } return(false); }
//创建暂停界面逻辑 public void CreatePauseMenu() { Audio.Play(Sfxs.ui_game_pause); Audio.PauseGameplaySfx = true; snapshot = Audio.CreateSnapshot(Snapshots.PAUSE_MENU); var menu = new TextMenu(); // Resume Button menu.Add(new TextMenu.Button(Dialog.Clean("pico8_pause_continue")).Pressed(() => menu.OnCancel())); // Restart Button menu.Add(new TextMenu.Button(Dialog.Clean("pico8_pause_restart")).Pressed(() => { pauseMenu = null; music(-1, 0, 0); new FadeWipe(this, false, () => { Audio.BusStopAll(Buses.GAMEPLAY, false); Audio.PauseGameplaySfx = false; Audio.EndSnapshot(snapshot); snapshot = null; ResetScreen(); game = null; gameFrame = 0; gameActive = true; new FadeWipe(this, true); }); })); // Quit Button menu.Add(new TextMenu.Button(Dialog.Clean("pico8_pause_quit")).Pressed(() => { leaving = true; gameActive = false; pauseMenu = null; music(-1, 0, 0); new FadeWipe(this, false, () => { Audio.BusStopAll(Buses.GAMEPLAY, false); Audio.PauseGameplaySfx = false; Audio.EndSnapshot(snapshot); Audio.Stop(bgSfx); snapshot = null; //返回关卡场景 if (ReturnTo != null) { if (ReturnTo is Level) { (ReturnTo as Level).Session.Audio.Apply(); new FadeWipe(ReturnTo, true); } Engine.Scene = ReturnTo; } //返回主菜单场景 else { Engine.Scene = new OverworldLoader(Overworld.StartMode.Titlescreen); } }); })); menu.OnCancel = menu.OnESC = menu.OnPause = () => { Audio.PauseGameplaySfx = false; Audio.EndSnapshot(snapshot); snapshot = null; gameDelay = 0.1f; pauseMenu = null; gameActive = true; menu.RemoveSelf(); }; gameActive = false; pauseMenu = menu; }
public void Enable() { instance = FMODUnity.RuntimeManager.CreateInstance(fmodEvent); instance.start(); }
void Update() { if (shooter.canShoot) { _haloEvent.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); } switch (phase) { case AIM_PHASE: if (startAiming && Input.GetMouseButton(0)) { // TODO: initiate aim prediction shooter.Shoot(TeleBallPredictorPrefab); GetComponentInChildren <Animator>().Play("Aim"); } else if (Input.GetMouseButtonDown(0)) { startAiming = true; } else if (Input.GetMouseButtonUp(0) && startAiming) { startAiming = false; // TODO: shoot at mouse _haloEvent = FMODUnity.RuntimeManager.CreateInstance(_haloSoundPath); _haloEvent.start(); foreach (var predictor in GameObject.FindGameObjectsWithTag("TelePredictor")) { Destroy(predictor.gameObject); } shooter.Shoot(TeleBallPrefab, true); GetComponentInChildren <Animator>().Play("Throw"); phase = TELE_PHASE; shooter.canShoot = false; teleporter.canTeleport = true; } break; case TELE_PHASE: if (teleBallRef == null || !teleBallRef.gameObject.activeSelf) { phase = AIM_PHASE; teleBallRef = null; teleBallRefAnim = null; shooter.canShoot = true; teleBallPositionIsValid = false; } else if (Input.GetMouseButton(0)) { // TODO: allow physics to proceed? if (teleBallRef) { teleBallRefAnim.SetOn(false); _haloEvent.setParameterValue("Active", 0); } } else { if (teleBallRef) { teleBallRefAnim.SetOn(true); _haloEvent.setParameterValue("Active", 1); } if (teleBallPositionIsValid) { // TODO: teleport once position on teleBall is valid TeleportToBall(); } } break; } }
public override void Begin() { bgSfx = Audio.Play(Sfxs.env_amb_03_pico8_closeup); base.Begin(); }
/// <summary> /// Doesn't seem to work. /// </summary> /// <param name="eventInstance"></param> /// <param name="minDistance"></param> /// <param name="maxDistance"></param> public static void Get3DAttenuationSettings(FMOD.Studio.EventInstance eventInstance, out float minDistance, out float maxDistance) { eventInstance.getProperty(FMOD.Studio.EVENT_PROPERTY.MINIMUM_DISTANCE, out minDistance); eventInstance.getProperty(FMOD.Studio.EVENT_PROPERTY.MAXIMUM_DISTANCE, out maxDistance); }
public static float GetParameterValue(FMOD.Studio.EventInstance eventInstance, string parameterName) { eventInstance.getParameterByName(parameterName, out float paramValue); return(paramValue); }
public static void SetParameter(FMOD.Studio.EventInstance eventInstance, string parameterName, float parameterValue) { eventInstance.setParameterByName(parameterName, parameterValue); }
private void PlayVO() { reactionVOInstance = FMODUnity.RuntimeManager.CreateInstance(reactionVO); FMODUnity.RuntimeManager.AttachInstanceToGameObject(reactionVOInstance, this.transform, this.GetComponent <Rigidbody>()); reactionVOInstance.start(); }
public static void CreateMenu(EverestModule self, TextMenu menu, bool inGame, FMOD.Studio.EventInstance snapshot) { menu.Add(new TextMenu.OnOff("Enabled", Settings.Enabled).Change((b) => { Settings.Enabled = b; foreach (TextMenu.Item item in normalOptions) { item.Visible = b; } keyConfigMenu.Visible = b; moreOptionsTextMenu.Visible = b; foreach (TextMenu.Item item in hiddenOptions) { item.Visible = false; } if (!b && Settings.ShowHitboxes) { ((TextMenu.OnOff)normalOptions.First()).LeftPressed(); } })); CreateNormalOptions(menu, inGame); foreach (TextMenu.Item item in normalOptions) { menu.Add(item); item.Visible = Settings.Enabled; TrySetNeedRelaunch(menu, item); } keyConfigMenu = new TextMenu.Button(Dialog.Clean("options_keyconfig")).Pressed(() => { menu.Focused = false; Engine.Scene.Add(new ModuleSettingsKeyboardConfigUI(self) { OnClose = () => menu.Focused = true }); Engine.Scene.OnEndOfFrame += () => Engine.Scene.Entities.UpdateLists(); }); moreOptionsTextMenu = new TextMenu.Button("modoptions_celestetas_moreoptions".DialogCleanOrNull() ?? "More Options").Pressed(() => { ToggleMoreOptionsMenuItem(menu, true); moreOptionsTextMenu.Visible = false; menu.Selection += 1; }); menu.Add(keyConfigMenu); menu.Add(moreOptionsTextMenu); keyConfigMenu.Visible = Settings.Enabled; moreOptionsTextMenu.Visible = Settings.Enabled; CreateHiddenOptions(menu, inGame); foreach (TextMenu.Item item in hiddenOptions) { menu.Add(item); item.Visible = false; TrySetNeedRelaunch(menu, item); } }
public override void CreateModMenuSection(TextMenu menu, bool inGame, FMOD.Studio.EventInstance snapshot) { CreateModMenuSectionHeader(menu, inGame, snapshot); Menu.CreateMenu(this, menu, inGame); }
public void TightenBeltEvent() { FMOD.Studio.EventInstance beltTightenEvent = FMODUnity.RuntimeManager.CreateInstance("event:/SFX/Belt/BeltTighten"); beltTightenEvent.start(); beltTightenEvent.release(); }
public void Add(FMOD.Studio.EventInstance instance) { instances.Add(instance); }
public void HelmetStartSlidingOntoHeadEvent() { FMOD.Studio.EventInstance helmetEvent = FMODUnity.RuntimeManager.CreateInstance("event:/SFX/HelmetApplication/HelmetApplication"); helmetEvent.start(); helmetEvent.release(); }
static FMOD.RESULT DialogueEventCallback(FMOD.Studio.EVENT_CALLBACK_TYPE type, FMOD.Studio.EventInstance instance, IntPtr parameterPtr) { // Retrieve the user data IntPtr stringPtr; instance.getUserData(out stringPtr); // Get the string object GCHandle stringHandle = GCHandle.FromIntPtr(stringPtr); String key = stringHandle.Target as String; switch (type) { case FMOD.Studio.EVENT_CALLBACK_TYPE.CREATE_PROGRAMMER_SOUND: { FMOD.MODE soundMode = FMOD.MODE.DEFAULT | FMOD.MODE.CREATESTREAM; var parameter = (FMOD.Studio.PROGRAMMER_SOUND_PROPERTIES)Marshal.PtrToStructure(parameterPtr, typeof(FMOD.Studio.PROGRAMMER_SOUND_PROPERTIES)); if (key.Contains(".")) { FMOD.Sound dialogueSound; var soundResult = FMODUnity.RuntimeManager.CoreSystem.createSound(Application.streamingAssetsPath + "/" + key, soundMode, out dialogueSound); if (soundResult == FMOD.RESULT.OK) { parameter.sound = dialogueSound.handle; parameter.subsoundIndex = -1; Marshal.StructureToPtr(parameter, parameterPtr, false); } } else { FMOD.Studio.SOUND_INFO dialogueSoundInfo; var keyResult = FMODUnity.RuntimeManager.StudioSystem.getSoundInfo(key, out dialogueSoundInfo); if (keyResult != FMOD.RESULT.OK) { break; } FMOD.Sound dialogueSound; var soundResult = FMODUnity.RuntimeManager.CoreSystem.createSound(dialogueSoundInfo.name_or_data, soundMode | dialogueSoundInfo.mode, ref dialogueSoundInfo.exinfo, out dialogueSound); if (soundResult == FMOD.RESULT.OK) { parameter.sound = dialogueSound.handle; parameter.subsoundIndex = dialogueSoundInfo.subsoundindex; Marshal.StructureToPtr(parameter, parameterPtr, false); } } } break; case FMOD.Studio.EVENT_CALLBACK_TYPE.DESTROY_PROGRAMMER_SOUND: { var parameter = (FMOD.Studio.PROGRAMMER_SOUND_PROPERTIES)Marshal.PtrToStructure(parameterPtr, typeof(FMOD.Studio.PROGRAMMER_SOUND_PROPERTIES)); var sound = new FMOD.Sound(); sound.handle = parameter.sound; sound.release(); } break; case FMOD.Studio.EVENT_CALLBACK_TYPE.DESTROYED: // Now the event has been destroyed, unpin the string // memory so it can be garbage collected stringHandle.Free(); break; } return(FMOD.RESULT.OK); }
static FMOD.RESULT VoiceEventCallback(FMOD.Studio.EVENT_CALLBACK_TYPE type, IntPtr instancePtr, IntPtr parameterPtr) { FMOD.Studio.EventInstance instance = new FMOD.Studio.EventInstance(instancePtr); // Note: this is just a new wrapper, not a new event instance. IntPtr stringPtr; instance.getUserData(out stringPtr); GCHandle stringHandle = GCHandle.FromIntPtr(stringPtr); String key = stringHandle.Target as String; switch (type) { case FMOD.Studio.EVENT_CALLBACK_TYPE.CREATE_PROGRAMMER_SOUND: { FMOD.MODE soundMode = FMOD.MODE.LOOP_NORMAL | FMOD.MODE.CREATECOMPRESSEDSAMPLE | FMOD.MODE.NONBLOCKING; var parameter = (FMOD.Studio.PROGRAMMER_SOUND_PROPERTIES)Marshal.PtrToStructure(parameterPtr, typeof(FMOD.Studio.PROGRAMMER_SOUND_PROPERTIES)); if (key.Contains(".")) { FMOD.Sound dialogueSound; var soundResult = FMODUnity.RuntimeManager.CoreSystem.createSound(Application.streamingAssetsPath + "/" + key, soundMode, out dialogueSound); if (soundResult == FMOD.RESULT.OK) { parameter.sound = dialogueSound.handle; parameter.subsoundIndex = -1; Marshal.StructureToPtr(parameter, parameterPtr, false); } } else { FMOD.Studio.SOUND_INFO dialogueSoundInfo; var keyResult = FMODUnity.RuntimeManager.StudioSystem.getSoundInfo(key, out dialogueSoundInfo); if (keyResult != FMOD.RESULT.OK) { break; } FMOD.Sound dialogueSound; var soundResult = FMODUnity.RuntimeManager.CoreSystem.createSound(dialogueSoundInfo.name_or_data, soundMode | dialogueSoundInfo.mode, ref dialogueSoundInfo.exinfo, out dialogueSound); if (soundResult == FMOD.RESULT.OK) { parameter.sound = dialogueSound.handle; parameter.subsoundIndex = dialogueSoundInfo.subsoundindex; Marshal.StructureToPtr(parameter, parameterPtr, false); } } break; } case FMOD.Studio.EVENT_CALLBACK_TYPE.DESTROY_PROGRAMMER_SOUND: { var parameter = (FMOD.Studio.PROGRAMMER_SOUND_PROPERTIES)Marshal.PtrToStructure(parameterPtr, typeof(FMOD.Studio.PROGRAMMER_SOUND_PROPERTIES)); var sound = new FMOD.Sound(parameter.sound); sound.release(); break; } case FMOD.Studio.EVENT_CALLBACK_TYPE.DESTROYED: { stringHandle.Free(); break; } } return(FMOD.RESULT.OK); }
public void Play() { if (TriggerOnce && hasTriggered) { return; } if (String.IsNullOrEmpty(Event)) { return; } if (eventDescription == null) { Lookup(); } bool isOneshot = false; if (!Event.StartsWith("snapshot", StringComparison.CurrentCultureIgnoreCase)) { eventDescription.isOneshot(out isOneshot); } bool is3D; eventDescription.is3D(out is3D); if (instance != null && !instance.isValid()) { instance = null; } // Let previous oneshot instances play out if (isOneshot && instance != null) { instance.release(); instance = null; } if (instance == null) { eventDescription.createInstance(out instance); // Only want to update if we need to set 3D attributes if (is3D) { var rigidBody = GetComponent<Rigidbody>(); var transform = GetComponent<Transform>(); instance.set3DAttributes(RuntimeUtils.To3DAttributes(gameObject, rigidBody)); RuntimeManager.AttachInstanceToGameObject(instance, transform, rigidBody); } } foreach(var param in Params) { instance.setParameterValue(param.Name, param.Value); } instance.start(); hasTriggered = true; }
protected override void CreateModMenuSectionHeader(TextMenu menu, bool inGame, FMOD.Studio.EventInstance snapshot) { base.CreateModMenuSectionHeader(menu, inGame, snapshot); if (failedLoadingDeps) { menu.Add(new TextMenuExt.SubHeaderExt(Dialog.Clean("communalhelper_failedloadingdeps")) { TextColor = Color.OrangeRed, HeightExtra = 0f, }); } }
void Update() { if (studioSystem != null) { studioSystem.update(); bool foundListener = false; bool hasAllListeners = false; int numListeners = 0; for (int i = FMOD.CONSTANTS.MAX_LISTENERS - 1; i >= 0; i--) { if (!foundListener && HasListener[i]) { numListeners = i + 1; foundListener = true; hasAllListeners = true; } if (!HasListener[i] && foundListener) { hasAllListeners = false; } } if (foundListener) { studioSystem.setNumListeners(numListeners); } if (!hasAllListeners && !listenerWarningIssued) { listenerWarningIssued = true; UnityEngine.Debug.LogWarning("FMOD Studio Integration: Please add an 'FMOD Studio Listener' component to your a camera in the scene for correct 3D positioning of sounds"); } for (int i = 0; i < attachedInstances.Count; i++) { FMOD.Studio.PLAYBACK_STATE playbackState = FMOD.Studio.PLAYBACK_STATE.STOPPED; attachedInstances[i].instance.getPlaybackState(out playbackState); if (!attachedInstances[i].instance.isValid() || playbackState == FMOD.Studio.PLAYBACK_STATE.STOPPED || attachedInstances[i].transform == null // destroyed game object ) { attachedInstances.RemoveAt(i); i--; continue; } if (attachedInstances[i].rigidBody) { attachedInstances[i].instance.set3DAttributes(RuntimeUtils.To3DAttributes(attachedInstances[i].transform, attachedInstances[i].rigidBody)); } else { attachedInstances[i].instance.set3DAttributes(RuntimeUtils.To3DAttributes(attachedInstances[i].transform, attachedInstances[i].rigidBody2D)); } } #if UNITY_EDITOR MuteAllEvents(UnityEditor.EditorUtility.audioMasterMute); #endif #if UNITY_EDITOR // Catch any 3D events that are being played at the origin foreach (FMOD.Studio.EventDescription desc in cachedDescriptions.Values) { if (!desc.isValid()) { continue; } bool is3d; desc.is3D(out is3d); if (!is3d) { continue; } string path; desc.getPath(out path); int instanceCount; desc.getInstanceCount(out instanceCount); FMOD.Studio.EventInstance[] instances = new FMOD.Studio.EventInstance[instanceCount]; desc.getInstanceList(out instances); for (int i = 0; i < instances.Length; i++) { if (warnedInvalidInstances.ContainsKey(instances[i].getRaw())) { continue; } FMOD.ATTRIBUTES_3D attributes = new FMOD.ATTRIBUTES_3D(); instances[i].get3DAttributes(out attributes); if (attributes.position.x == 0 && attributes.position.y == 0 && attributes.position.z == 0) { warnedInvalidInstances.Add(instances[i].getRaw(), true); #if UNITY_5_X Debug.LogWarningFormat("FMOD Studio: Instance of Event {0} found playing at the origin. EventInstance.set3DAttributes() should be called on all 3D events", path); #else Debug.LogWarning(string.Format("FMOD Studio: Instance of Event {0} found playing at the origin. EventInstance.set3DAttributes() should be called on all 3D events", path)); #endif } } } #endif } }
private void PlayVoiceFmodSoundEvent(List <string> voices) { fmodEvent_Voice = FMODUnity.RuntimeManager.CreateInstance(string.Format(voices[Random.Range(0, voices.Count)], robotIndex)); fmodEvent_Voice.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(Vector3.zero)); fmodEvent_Voice.start(); }
private void Start() { footstep = FMODUnity.RuntimeManager.CreateInstance("event:/SFX/Footsteps"); InvokeRepeating("PlayFootsteps", 0.0f, movingSpeed); }
void Start() { InvokeRepeating("CallFootsteps", 0, stepSpeed); stepSound = FMODUnity.RuntimeManager.CreateInstance(Steps); initialStepSpeed = stepSpeed; }
public SoundStruct(FMOD.Studio.EventInstance sound, string name) // constructor { this.name = name; this.instance = sound; }
void Update() { if (firstUpdate) { enabled = false; HandleGameEvent(EmitterGameEvent.LevelStart); firstUpdate = false; } if (instance != null) { instance.set3DAttributes(RuntimeUtils.To3DAttributes(gameObject, cachedRigidBody)); FMOD.Studio.PLAYBACK_STATE state; instance.getPlaybackState(out state); if (state == FMOD.Studio.PLAYBACK_STATE.STOPPED) { instance.release(); instance = null; enabled = false; } } }
public static void PreviewStop() { if (previewEventInstance != null) { previewEventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE); previewEventInstance.release(); previewEventInstance = null; previewEventDesc = null; if (previewBank != null) { previewBank.unload(); } masterBank.unload(); masterBank = null; previewBank = null; previewState = PreviewState.Stopped; } }
private void PlayVoiceFmodSoundEvent(string voice) { fmodEvent_Voice = FMODUnity.RuntimeManager.CreateInstance(string.Format(voice, robotIndex)); fmodEvent_Voice.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(Vector3.zero)); fmodEvent_Voice.start(); }