public static FMOD.Studio.EventInstance CreateInstance(Guid guid)
 {
     FMOD.Studio.EventDescription eventDesc = GetEventDescription(guid);
     FMOD.Studio.EventInstance    newInstance;
     eventDesc.createInstance(out newInstance);
     return(newInstance);
 }
Exemple #2
0
        private void load()
        {
            _desc = System.Instance.GetEventDescription(_path);
            Utilities.checkResult(_desc.createInstance(out _instance));

            Ready = true;
        }
Exemple #3
0
 public static void TryOut(string eventPath)
 {
     FMOD.Studio.EventDescription mydesc = FMODUnity.RuntimeManager.GetEventDescription(eventPath);
     if (mydesc != null)
     {
         Guid descId = new Guid();
         mydesc.getID(out descId);
         Log.Info("GUID from FMODUnity.RuntimeManager.GetEventDescription('{0}'): {1}", eventPath, descId.ToString());
     }
 }
Exemple #4
0
 public static void PreviewStop()
 {
     if (previewEventInstance != null)
     {
         previewEventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
         previewEventInstance.release();
         previewEventInstance = null;
         previewEventDesc     = null;
         previewBank.unload();
         masterBank.unload();
     }
 }
        void Lookup()
        {
            eventDescription = RuntimeManager.GetEventDescription(EventReference);

            if (eventDescription.isValid())
            {
                for (int i = 0; i < Params.Length; i++)
                {
                    FMOD.Studio.PARAMETER_DESCRIPTION param;
                    eventDescription.getParameterDescriptionByName(Params[i].Name, out param);
                    Params[i].ID = param.id;
                }
            }
        }
Exemple #6
0
        public static FMOD.Studio.EventInstance CreateInstance(Guid guid)
        {
            FMOD.Studio.EventDescription eventDesc = GetEventDescription(guid);
            FMOD.Studio.EventInstance    newInstance;
            eventDesc.createInstance(out newInstance);

            #if UNITY_EDITOR
            bool is3D = false;
            eventDesc.is3D(out is3D);
            if (is3D)
            {
                // Set position to 1e+18F, set3DAttributes should be called by the dev after this.
                newInstance.set3DAttributes(RuntimeUtils.To3DAttributes(new Vector3(1e+18F, 1e+18F, 1e+18F)));
                instance.eventPositionWarnings.Add(newInstance);
            }
            #endif

            return(newInstance);
        }
 void Awake()
 {
     for (int i = 0; i < Emitters.Length; i++)
     {
         var emitterRef = Emitters[i];
         if (emitterRef.Target != null && !string.IsNullOrEmpty(emitterRef.Target.Event))
         {
             FMOD.Studio.EventDescription eventDesc = FMODUnity.RuntimeManager.GetEventDescription(emitterRef.Target.Event);
             if (eventDesc.isValid())
             {
                 for (int j = 0; j < Emitters[i].Params.Length; j++)
                 {
                     FMOD.Studio.PARAMETER_DESCRIPTION param;
                     eventDesc.getParameterDescriptionByName(emitterRef.Params[j].Name, out param);
                     emitterRef.Params[j].ID = param.id;
                 }
             }
         }
     }
 }
        private void UnloadAllBankSampleData()
        {
            int bankCount;

            Instance.studioSystem.getBankCount(out bankCount);
            if (bankCount > 0)
            {
                FMOD.Studio.Bank[] bankArray = new FMOD.Studio.Bank[bankCount];
                Instance.studioSystem.getBankList(out bankArray);
                for (int i = 0; i < bankCount; i++)
                {
                    int eventCount;
                    bankArray[i].getEventCount(out eventCount);
                    if (eventCount > 0)
                    {
                        FMOD.Studio.EventDescription[] eventArray = new FMOD.Studio.EventDescription[eventCount];
                        bankArray[i].getEventList(out eventArray);
                        for (int j = 0; j < eventCount; j++)
                        {
                            int instanceCount;
                            eventArray[j].getInstanceCount(out instanceCount);
                            if (instanceCount > 0)
                            {
                                FMOD.Studio.EventInstance[] instanceArray = new FMOD.Studio.EventInstance[instanceCount];
                                eventArray[j].getInstanceList(out instanceArray);
                                for (int k = 0; k < instanceCount; k++)
                                {
                                    instanceArray[k].stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
                                    instanceArray[k].release();
                                }
                            }
                        }
                    }
                }

                for (int i = 0; i < bankCount; i++)
                {
                    bankArray[i].unloadSampleData();
                }
            }
        }
Exemple #9
0
        public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
        {
#if UNITY_EDITOR
            if (!eventReference.IsNull)
#else
            if (!cachedParameters && !eventReference.IsNull)
#endif
            {
                FMOD.Studio.EventDescription eventDescription = RuntimeManager.GetEventDescription(eventReference);

                for (int i = 0; i < parameters.Length; i++)
                {
                    FMOD.Studio.PARAMETER_DESCRIPTION parameterDescription;
                    eventDescription.getParameterDescriptionByName(parameters[i].Name, out parameterDescription);
                    parameters[i].ID = parameterDescription.id;
                }

                List <ParameterAutomationLink> parameterLinks = template.parameterLinks;

                for (int i = 0; i < parameterLinks.Count; i++)
                {
                    FMOD.Studio.PARAMETER_DESCRIPTION parameterDescription;
                    eventDescription.getParameterDescriptionByName(parameterLinks[i].Name, out parameterDescription);
                    parameterLinks[i].ID = parameterDescription.id;
                }

                cachedParameters = true;
            }

            var playable = ScriptPlayable <FMODEventPlayableBehavior> .Create(graph, template);

            behavior = playable.GetBehaviour();

            behavior.TrackTargetObject = TrackTargetObject;
            behavior.eventReference    = eventReference;
            behavior.stopType          = stopType;
            behavior.parameters        = parameters;
            behavior.OwningClip        = OwningClip;

            return(playable);
        }
        public static FMOD.Studio.EventDescription GetEventDescription(Guid guid)
        {
            FMOD.Studio.EventDescription eventDesc = null;
            if (Instance.cachedDescriptions.ContainsKey(guid) && Instance.cachedDescriptions[guid].isValid())
            {
                eventDesc = Instance.cachedDescriptions[guid];
            }
            else
            {
                var result = Instance.studioSystem.getEventByID(guid, out eventDesc);

                if (result != FMOD.RESULT.OK)
                {
                    throw new EventNotFoundException(guid);
                }

                if (eventDesc != null && eventDesc.isValid())
                {
                    Instance.cachedDescriptions[guid] = eventDesc;
                }
            }
            return(eventDesc);
        }
Exemple #11
0
        public bool Initialize(VoiceoverManager manager)
        {
            if (manager == null)
            {
                return(false);
            }
            else
            {
                voiceoverManager = manager;
            }

            if (!string.IsNullOrEmpty(masterVoiceoverEvent))
            {
                eventDescription = FMODUnity.RuntimeManager.GetEventDescription(masterVoiceoverEvent);

                if (eventDescription.isValid())
                {
                    eventDescription.is3D(out is3D);
                    eventDescription.getMaximumDistance(out maxDistance);
                }
                else
                {
                    Debug.LogError("The master voiceover event is invalid for '" + speaker.ToString() + "'.");
                    return(false);
                }
            }
            else
            {
                Debug.LogError("The master voiceover event is missing for '" + speaker.ToString() + "'.");
                return(false);
            }

            voiceoverCallback        = new FMOD.Studio.EVENT_CALLBACK(VoiceEventCallback);
            initializationSuccesfull = true;

            return(true);
        }
 void Lookup()
 {
     eventDescription = RuntimeManager.GetEventDescription(Event);
 }
 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;
     }
 }
Exemple #14
0
 internal EventDescription(FMOD.Studio.EventDescription eventDescription)
 {
     Native = eventDescription;
 }
 void Lookup()
 {
     eventDescription = RuntimeManager.GetEventDescription(Event);
 }
Exemple #16
0
 static void Prefix(ref string eventPath, FMOD.Studio.EventDescription eventDesc)
 {
     // Log.Info("FMODUWE.GetEventDescription - eventPath: {0}", eventPath.ToString());
     Main.ConvertEventPath(ref eventPath);
 }
Exemple #17
0
 static void Postfix(string eventPath, FMOD.Studio.EventDescription eventDesc)
 {
 }