Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: sdog on January 22, 2015, 08:45:31 PM

Title: Wwise - Unity - Playmaker
Post by: sdog on January 22, 2015, 08:45:31 PM
Hi Guys,

I have a small question. Iam a Sounddesigenr and Composer for Films and start now to go also into Gamesound. I work with wwise and i love it. Now i work on a project where the gamesdesigner workes with Unity and Playmaker. Iam a totally noob in playmaker and have no idea how it workes. The GD dont know wwise and like i saw u can only trigger Audioclips in Playmaker. Is it possible to trigger also Wwise Events?

THanx a lot!
Title: Re: Wwise - Unity - Playmaker
Post by: ViRiX Dreamcore on January 23, 2015, 03:58:42 AM
I'm afraid you'd have to write a special event for that.

I and a few others have been asking for Wwise and/or FMOD Studio support for a while. If someone writes it and posts it on the asset store even, this would be great.

There are however some other audio tools in the Asset Store that do work such as Master Audio which I've used for some dynamic music. Yeah it's not perfect, but it does give you a lot of flexibility.

Hopefully this will come in the future.
Title: Re: Wwise - Unity - Playmaker
Post by: sdog on January 23, 2015, 03:08:02 PM
Okey, iam the last one who knows how to write a code :D but is this so difficult, that nobody has done it till now? There are allready a lot of scripts. I think all u need is to have the 4 Importent items: PlayEvent, Ambient, Switch and State.
Here a code i find in the Net. Maybe we can together find a solution or a overall special event:


Code: [Select]
{

uint bankID;
// Use this for initialization
protected void LoadBank () {

AkSoundEngine.LoadBank ("HEREBANKNAME", AkSoundEngine.AK_DEFAULT_POOL_ID, out bankID);
}

// Update is called once per frame
void Update () {

}

public void PlayEvent (string eventName)
{
AkSoundEngine.PostEvent (eventName, gameObject);
}

public void StopEvent (string eventName, int fadeout)
{
uint eventID;
eventID = AkSoundEngine.GetIDFromString (eventName);
AkSoundEngine.ExecuteActionOnEvent (eventID, AkActionOnEventType.AkActionOnEventType_Stop, gameObject, fadeout * 1000, AkCurveInterpolation.AkCurveInterpolation_Sine);
}

public void PauseEvent (string eventName, int fadeout)
{
uint eventID;
eventID = AkSoundEngine.GetIDFromString (eventName);
AkSoundEngine.ExecuteActionOnEvent (eventID, AkActionOnEventType.AkActionOnEventType_Pause, gameObject, fadeout * 1000, AkCurveInterpolation.AkCurveInterpolation_Sine);
}

public void ResumeEvent (string eventName, int fadeout)
{
uint eventID;
eventID = AkSoundEngine.GetIDFromString (eventName);
AkSoundEngine.ExecuteActionOnEvent (eventID, AkActionOnEventType.AkActionOnEventType_Resume, gameObject, fadeout * 1000, AkCurveInterpolation.AkCurveInterpolation_Sine);
}

}

the Playmaker code for Audio is

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Audio)]
[Tooltip("Plays the Audio Clip set with Set Audio Clip or in the Audio Source inspector on a Game Object. Optionally plays a one shot Audio Clip.")]
public class AudioPlay : FsmStateAction
{
[RequiredField]
[CheckForComponent(typeof(AudioSource))]
[Tooltip("The GameObject with an AudioSource component.")]
public FsmOwnerDefault gameObject;

[HasFloatSlider(0,1)]
        [Tooltip("Set the volume.")]
public FsmFloat volume;

[ObjectType(typeof(AudioClip))]
[Tooltip("Optionally play a 'one shot' AudioClip. NOTE: Volume cannot be adjusted while playing a 'one shot' AudioClip.")]
public FsmObject oneShotClip;

[Tooltip("Event to send when the AudioClip finishes playing.")]
public FsmEvent finishedEvent;

private AudioSource audio;

public override void Reset()
{
gameObject = null;
volume = 1f;
oneShotClip = null;
    finishedEvent = null;
}

public override void OnEnter()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go != null)
{
// cache the AudioSource component

audio = go.audio;
if (audio != null)
{
var audioClip = oneShotClip.Value as AudioClip;

if (audioClip == null)
{
audio.Play();

if (!volume.IsNone)
{
audio.volume = volume.Value;
}

return;
}

if (!volume.IsNone)
{
audio.PlayOneShot(audioClip, volume.Value);
}
else
{
audio.PlayOneShot(audioClip);
}

return;
}
}

// Finish if failed to play sound

Finish();
}

public override void OnUpdate ()
{
if (audio == null)
{
Finish();
}
else
{
if (!audio.isPlaying)
{
Fsm.Event(finishedEvent);
Finish();
}
                else if (!volume.IsNone && volume.Value != audio.volume)
{
audio.volume = volume.Value;
}
}
}
}
}

how to modify it, that u can use ur audio events, switches aso in playmaker?
Title: Re: Wwise - Unity - Playmaker
Post by: tttlllrrr on June 16, 2016, 09:22:44 PM
Seems like this guy has been making headway with this:


Wwise PlayMaker Action:
http://pastebin.com/CSVnbsUq
Title: Re: Wwise - Unity - Playmaker
Post by: Jono not Bono on October 16, 2022, 10:26:58 PM
Hi Guys,

I have a small question. Iam a Sounddesigenr and Composer for Films and start now to go also into Gamesound. I work with wwise and i love it. Now i work on a project where the gamesdesigner workes with Unity and Playmaker. Iam a totally noob in playmaker and have no idea how it workes. The GD dont know wwise and like i saw u can only trigger Audioclips in Playmaker. Is it possible to trigger also Wwise Events?

THanx a lot!

Did you make any headway with this? I dream of using Wwise and Playmaker but not a coder. Very curious to see if anyone has created some actions to use with Wwise and Playmaker.

Wwise is just such an incredible tool. I was using FMOD but I prefer Wwise so much more!

Jono
Title: Re: Wwise - Unity - Playmaker
Post by: MarkD on November 12, 2023, 11:08:24 AM
I recently wrote a few actions for my Wwise intergration into Unity for use with Playmaker. 

I'm not a programmer, so I wonder if there is anyone here with a high level of coding experience who could check my code to make sure it's optimized and performant?

And of course after that, I'll definitely be willing to share what I've got.
Title: Re: Wwise - Unity - Playmaker
Post by: djaydino on November 12, 2023, 11:29:28 AM
Hi.
I would suggest you to join discord, there are many there that can program a bit and can help verify :)