/// <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);
    }
    /// <summary>
    ///     This method is used to post events that use the Wwise Audio Input plug-in.
    /// </summary>
    /// <param name="akEventName">The name of 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(string akEventName, UnityEngine.GameObject gameObject,
                                           AudioSamplesDelegate sampleDelegate, AudioFormatDelegate formatDelegate = null)
    {
        TryInitialize();
        var playingID =
            AkSoundEngine.PostEvent(akEventName, gameObject, (uint)AkCallbackType.AK_EndOfEvent, EventCallback, null);

        AddPlayingID(playingID, sampleDelegate, formatDelegate);
        return(playingID);
    }
Exemple #3
0
    static void AddPlayingID(uint playingID, AudioSamplesDelegate sampleDelegate, AudioFormatDelegate formatDelegate)
    {
        if (playingID == AkSoundEngine.AK_INVALID_PLAYING_ID || sampleDelegate == null)
        {
            return;
        }

        audioSamplesDelegates.Add(playingID, sampleDelegate);
        if (formatDelegate != null)
        {
            audioFormatDelegates.Add(playingID, formatDelegate);
        }
    }