示例#1
0
 public void PlayRirisVoice(GameObject go, AK.Wwise.Event voice)
 {
     if (GameManager.Instance.config.soundActive.voice ||
         GameManager.Instance.config.soundActive.all)
     {
         voice.Post(go);
     }
 }
示例#2
0
 public void StopRirisSFX(GameObject go, AK.Wwise.Event sfx)
 {
     if (GameManager.Instance.config.soundActive.sfx ||
         GameManager.Instance.config.soundActive.all)
     {
         sfx.Stop(go);
     }
 }
示例#3
0
 public void PlayMonsterSFX(GameObject go, AK.Wwise.Event sfx)
 {
     if (GameManager.Instance.config.soundActive.sfx ||
         GameManager.Instance.config.soundActive.all ||
         GameStatus.currentGameState != CurrentGameState.Dead)
     {
         sfx.Post(go);
     }
 }
    /// <summary>
    ///     This method is used to post events that use the Wwise Audio Input plug-in.
    /// </summary>
    /// <param name="akEvent">The event to post.</param>
    /// <param name="gameObject">The GameObject that the event will be posted on.</param>
    /// <param name="sampleDelegate">The C# audio sample delegate.</param>
    /// <param name="formatDelegate">
    ///     The C# audio format delegate. If not specified, defaults to a mono source running at the
    ///     sample rate of the sound engine.
    /// </param>
    /// <returns>The playingID of the newly instantiated sound associated with the posted event.</returns>
    public static uint PostAudioInputEvent(AK.Wwise.Event akEvent, UnityEngine.GameObject gameObject,
                                           AudioSamplesDelegate sampleDelegate, AudioFormatDelegate formatDelegate = null)
    {
        TryInitialize();
        var playingID = akEvent.Post(gameObject, (uint)AkCallbackType.AK_EndOfEvent, EventCallback);

        AddPlayingID(playingID, sampleDelegate, formatDelegate);
        return(playingID);
    }
    public static MinMaxEventDuration GetMinMaxDuration(AK.Wwise.Event akEvent)
    {
        var result            = new MinMaxEventDuration();
        var FullSoundbankPath = AkBasePathGetter.GetPlatformBasePath();
        var filename          = System.IO.Path.Combine(FullSoundbankPath, "SoundbanksInfo.xml");
        var MaxDuration       = 1000000.0f;

        if (System.IO.File.Exists(filename))
        {
            var doc = new System.Xml.XmlDocument();
            doc.Load(filename);

            var soundBanks = doc.GetElementsByTagName("SoundBanks");
            for (var i = 0; i < soundBanks.Count; i++)
            {
                var soundBank = soundBanks[i].SelectNodes("SoundBank");
                for (var j = 0; j < soundBank.Count; j++)
                {
                    var includedEvents = soundBank[j].SelectNodes("IncludedEvents");
                    for (var ie = 0; ie < includedEvents.Count; ie++)
                    {
                        var events = includedEvents[i].SelectNodes("Event");
                        for (var e = 0; e < events.Count; e++)
                        {
                            if (events[e].Attributes["Id"] != null && uint.Parse(events[e].Attributes["Id"].InnerText) == (uint)akEvent.ID)
                            {
                                if (events[e].Attributes["DurationType"] != null &&
                                    events[e].Attributes["DurationType"].InnerText == "Infinite")
                                {
                                    // Set both min and max to MaxDuration for infinite events
                                    result.MinDuration = MaxDuration;
                                    result.MaxDuration = MaxDuration;
                                }

                                if (events[e].Attributes["DurationMin"] != null)
                                {
                                    result.MinDuration = float.Parse(events[e].Attributes["DurationMin"].InnerText);
                                }
                                if (events[e].Attributes["DurationMax"] != null)
                                {
                                    result.MaxDuration = float.Parse(events[e].Attributes["DurationMax"].InnerText);
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }

        return(result);
    }
    private UnityEngine.Vector2 getMinMaxDuration(AK.Wwise.Event akEvent)
    {
        UnityEngine.Vector2 result = UnityEngine.Vector2.zero;

        var eventInfo = AkWwiseProjectInfo.GetData().GetEventInfo(akEvent.Id);

        if (eventInfo != null)
        {
            result.x = eventInfo.minDuration;
            result.y = eventInfo.maxDuration;
        }

        return(result);
    }
示例#7
0
 public void PlayPlayerVoice(GameObject go, AK.Wwise.Event voice)
 {
     if (GameManager.Instance.config.soundActive.voice ||
         GameManager.Instance.config.soundActive.all)
     {
         try
         {
             voice.Post(go);
         }
         catch
         {
             MCSoundManager.LoadBank();
         }
     }
 }
示例#8
0
 public void PlaySound(GameObject go, AK.Wwise.Event bgm)
 {
     if (GameManager.Instance.config.soundActive.sfx ||
         GameManager.Instance.config.soundActive.all)
     {
         try
         {
             bgm.Post(go);
         }
         catch
         {
             MCSoundManager.LoadBank();
         }
     }
 }
示例#9
0
 public void StopAmbient(GameObject go, AK.Wwise.Event amb)
 {
     if (GameManager.Instance.config.soundActive.ambient ||
         GameManager.Instance.config.soundActive.all)
     {
         try
         {
             amb.Stop(go);
         }
         catch
         {
             MCSoundManager.LoadBank();
         }
     }
 }
示例#10
0
 public void StopBGM(GameObject go, AK.Wwise.Event bgm)
 {
     if (GameManager.Instance.config.soundActive.bgm &&
         GameManager.Instance.config.soundActive.all)
     {
         try
         {
             bgm.Stop(go);
         }
         catch
         {
             MCSoundManager.LoadBank();
         }
     }
 }
示例#11
0
 public void PlayPlayerSFX(GameObject go, AK.Wwise.Event sfx)
 {
     //Debug.Log("Play Player SFX : " + sfx.Name + MCSoundManager.SoundCall++);
     if (GameManager.Instance.config.soundActive.sfx ||
         GameManager.Instance.config.soundActive.all)
     {
         try
         {
             sfx.Post(go);
         }
         catch
         {
             MCSoundManager.LoadBank();
         }
     }
 }
示例#12
0
 public void StopMonsterSFX(GameObject go, AK.Wwise.Event sfx)
 {
     sfx.Stop(go);
 }
 public static T SetAudioEvent <T>(this T entity, AK.Wwise.Event value)
     where T : AnimationEventParameters
 {
     entity.SetField("audioEvent", value);
     return(entity);
 }
示例#14
0
    /// <summary>
    /// Updates the associated clip information and the event durations.
    /// </summary>
    /// <returns>Returns true if the Wwise event is found in the project data.</returns>
    private static bool UpdateClipInformation(UnityEngine.Timeline.TimelineClip clip, AK.Wwise.Event akEvent,
                                              UnityEditor.SerializedObject serializedObject, bool setClipDuration)
    {
        var clipDuration = MinimumDurationInSeconds;
        var eventInfo    = AkWwiseProjectInfo.GetData().GetEventInfo(akEvent.Id);

        if (eventInfo != null)
        {
            serializedObject.FindProperty("eventDurationMin").floatValue = eventInfo.minDuration;
            serializedObject.FindProperty("eventDurationMax").floatValue = eventInfo.maxDuration;

            if (eventInfo.maxDuration > clipDuration)
            {
                clipDuration = eventInfo.maxDuration;
            }
        }

        if (clip != null)
        {
            clip.displayName = akEvent.Name;
            if (setClipDuration)
            {
                clip.duration = clipDuration;
            }
        }

        return(eventInfo != null && eventInfo.maxDuration > 0);
    }
示例#15
0
 public abstract void Post(AK.Wwise.Event audioEvent, GameObject gameObject, string name, string poolName);
示例#16
0
        public override void Post(AK.Wwise.Event audioEvent, GameObject gameObject, string name, string poolName)
        {
            var poolable = Pooler.Instance.RequestFromPool <AudioPoolable>(poolName);

            poolable.Post(audioEvent, gameObject, name);
        }
        /// <summary>
        /// Updates the associated clip information and the event durations.
        /// </summary>
        /// <returns>Returns true if the Wwise event is found in the project data.</returns>
        private static bool UpdateClipInformation(UnityEngine.Timeline.TimelineClip clip, AK.Wwise.Event akEvent,
                                                  UnityEditor.SerializedObject serializedObject, bool setClipDuration)
        {
            var clipDuration = MinimumDurationInSeconds;
            var maxDuration  = -1.0f;
            var minDuration  = -1.0f;

            AkUtilities.GetEventDurations(akEvent.Id, ref maxDuration, ref minDuration);
            if (maxDuration != -1.0f)
            {
                serializedObject.FindProperty("eventDurationMin").floatValue = minDuration;
                serializedObject.FindProperty("eventDurationMax").floatValue = maxDuration;

                if (maxDuration > clipDuration)
                {
                    clipDuration = maxDuration;
                }
            }

            if (clip != null)
            {
                clip.displayName = akEvent.Name;
                if (setClipDuration)
                {
                    clip.duration = clipDuration;
                }
            }

            return(maxDuration != -1.0f);
        }
示例#18
0
 public static T SetSoundEvent <T>(this T entity, AK.Wwise.Event value)
     where T : ActionDefinition
 {
     entity.SetField("soundEvent", value);
     return(entity);
 }
 public static T SetStopEvent <T>(this T entity, AK.Wwise.Event value)
     where T : EffectProxyDefinition
 {
     entity.SetField("stopEvent", value);
     return(entity);
 }
示例#20
0
 /// <summary>
 /// Post event by using this poolable object
 /// </summary>
 public void Post(AK.Wwise.Event audioEvent, GameObject target, string targetName)
 {
     AkSoundEngine.RegisterGameObj(gameObject, targetName);
     targetObj = target;
     audioEvent.Post(gameObject, (uint)AkCallbackType.AK_EndOfEvent, OnCallback);
 }