Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: jeanfabre on September 03, 2012, 10:34:29 AM

Title: Audio Toolkit Play
Post by: jeanfabre on September 03, 2012, 10:34:29 AM
Hi,

 Just a simple action to play a audio item when using Audio Toolkit

http://u3d.as/content/clock-stone-software-gmb-h/audio-toolkit/2AG (http://u3d.as/content/clock-stone-software-gmb-h/audio-toolkit/2AG)

I don't own a version, so it's blind coding, please let me know if that doesn't work out :)

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2012. All rights reserved.

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Audio toolkit")]
[Tooltip("Play an Audio item")]
public class AudioToolkitPlay : FsmStateAction
{
[RequiredField]
public FsmString reference;


public override void Reset()
{
reference = null;
}

public override void OnEnter()
{
AudioController.Play(reference.Value);
}

}
}

bye,

 Jean
Title: Re: Audio Toolkit Play
Post by: TomEllard on September 08, 2012, 01:57:07 AM
Thank you that works. Of course the moment you do this you are going to need to stop it again! Hacked your script:

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2012. All rights reserved.

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Audio toolkit")]
[Tooltip("Stop Playing an Audio item")]
public class AudioToolkitStop : FsmStateAction
{
[RequiredField]
public FsmString reference;


public override void Reset()
{
reference = null;
}

public override void OnEnter()
{
AudioController.Stop(reference.Value);
}

}
}

At some point we will need to be able to address a different Audio Controller, being a component on another object. So we'll need to add a way to select the object on which the component is attached. Cheers.
Title: Re: Audio Toolkit Play
Post by: jeanfabre on September 10, 2012, 04:42:06 AM
Hi,

 excellent, this is the spirit yes, simply hack other actions, If you have trouble making other actions let me know,

bye,

 Jean
Title: Re: Audio Toolkit Play
Post by: PIXELCRY on November 30, 2012, 04:14:53 AM
Hi, thanks for this it work well just the sound is not parented to the game object, so when game object move with 3d sound its not good.

i used this script:

Code: [Select]
using UnityEngine;
using System.Collections;

public class PlaySfxOnce : MonoBehaviour {


public string sfxID;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void onCall () {
AudioController.Play( sfxID, transform );

}
}

can we change it to an action like this where we can define the gameobject to parent the sound with a action public field for gameobject target? i tried to do like in my script but it return an error
Title: Re: Audio Toolkit Play
Post by: PIXELCRY on December 02, 2012, 12:14:20 AM
praying for Jeanfabre to pay some more few attention to this toolkit ;D

Here is the free version

http://u3d.as/content/clock-stone-software-gmb-h/audio-toolkit-free-version/2Bi

Title: Re: Audio Toolkit Play
Post by: PIXELCRY on December 10, 2012, 10:04:04 PM
hi still any way to get some help for these actions?
Title: Re: Audio Toolkit Play
Post by: jeanfabre on December 11, 2012, 04:38:42 AM
Hi,

 I hear you, tho I have 300+ posts to go catch up as I was away for some time. So please keep bumping this, I will do my best to cover that toolkit. Bump this next monday or something. Never fear bumping what you want, this helps a lot. This toolkit seems very simple, so I might be able to squeeze the basic needs to begin with.

bye,

 Jean
Title: Re: Audio Toolkit Play
Post by: PIXELCRY on December 15, 2012, 01:32:17 AM
thank you Jeanfabre if i can help you in any way just let me know !
Title: Re: Audio Toolkit Play
Post by: jeanfabre on December 17, 2012, 05:29:46 PM
:) can you make my day with few more hours ;D

I have to turn down projects, it's that bad at this moment, so I must honor paid work at the moment, things are getting easier in january generally, so keep bumping this thread please, this is the best way ( and actually a message to everyone reading this that would like some attention to other threads I might have missed or forgot about... keep bumping, this is the best way to see where to focus)

bye,

 Jean
Title: Re: Audio Toolkit Play
Post by: PIXELCRY on December 18, 2012, 07:43:59 PM
actually what would be nice

-setup the volume of a category
-start/stop/pause a category or playlist
-read and parent a sound to a gameobject ( like explained above )
Title: Re: Audio Toolkit Play
Post by: PIXELCRY on December 21, 2012, 11:04:46 AM
still no news for the actions? :-[
Title: Re: Audio Toolkit Play
Post by: PIXELCRY on December 27, 2012, 11:23:04 PM
merry Christmas to Jean Fabre, please dont forget my christmas audio toolkit actions! ;D
Title: Re: Audio Toolkit Play
Post by: jeanfabre on January 01, 2013, 09:15:32 AM
 :D :D
Title: Re: Audio Toolkit Play
Post by: KozTheBoss on January 05, 2013, 08:23:48 AM
This is very interesting, I'll be keeping an eye on this :) friendly bump, and thanks for all that you are doing!
Title: Re: Audio Toolkit Play
Post by: PIXELCRY on January 05, 2013, 09:42:28 AM
This is very interesting, I'll be keeping an eye on this :) friendly bump, and thanks for all that you are doing!
/assist :D
Title: Re: Audio Toolkit Play
Post by: TomEllard on January 13, 2013, 03:29:32 AM
Yeah I ran into this one as well. Audio Toolkit will create a new object at the point where the call is made with the sound attached. If the calling object keeps moving on, then the sound gets left behind.

So really what would have happen is to instantiate the sound object and then immediately make it a child of the calling object. Something like 'Set Parent' would do it, but you would have to attach that to the new object on the fly.
Title: Re: Audio Toolkit Play
Post by: PIXELCRY on January 19, 2013, 02:20:06 AM
still no news for the action to attach a played sound to a gameobject?
Title: Re: Audio Toolkit Play
Post by: jeanfabre on January 21, 2013, 01:40:05 AM
Hi,

 Ok, please find a updated play action that will accept all the different play functions. again it's blind coded, I don't own AudioToolkit yet, so tell me if that works as expected.

UPDATE: now with finished event, you can optionnaly set an event that will be fired with the audio reference finished playing.

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Audio toolkit")]
[Tooltip("Play an Audio item. Optionnaly send an event when autio item finished playing")]
public class AudioToolkitPlay : FsmStateAction
{
[RequiredField]
public FsmString reference;

public FsmVector3 worldPosition;

public FsmOwnerDefault parent;

public FsmFloat volume;

public FsmFloat delay;

public FsmFloat startTime;

public FsmEvent AudioCompletlyPlayedEvent;


public override void Reset()
{
reference = null;

worldPosition = null;
parent = null;
volume = 1f;
delay = 0f;
startTime = 0f;
AudioCompletlyPlayedEvent = null;
}

public override void OnEnter()
{
var go = Fsm.GetOwnerDefaultTarget(parent);

AudioObject _obj;

if (go == null)
{
_obj = AudioController.Play(reference.Value,worldPosition.Value,volume.Value,delay.Value,startTime.Value);
}else{
_obj = AudioController.Play(reference.Value,worldPosition.Value,go.transform,volume.Value,delay.Value,startTime.Value);
}

if (AudioCompletlyPlayedEvent!=null)
{
_obj.completelyPlayedDelegate = OnAudioCompleteleyPlayed;
}


}

void OnAudioCompleteleyPlayed( AudioObject audioObj )
    {
        Debug.Log( "Finished playing " + audioObj.audioID + " with clip " + audioObj.audio.clip.name );
Fsm.Event(AudioCompletlyPlayedEvent);
Finish();
    }

}
}

bye,

 Jean
Title: Re: Audio Toolkit Play
Post by: PIXELCRY on January 23, 2013, 02:57:02 AM
thank you Jean Fabre this is awesome, dont know if i can ask a little more. :D

i need an action to send and event when playing a sound file is finish, maybe can use this:

http://unity.clockstone.com/audiotoolkitreference/html/P_AudioObject_completelyPlayedDelegate.htm

just a public string for the sound ID and select what event return
Title: Re: Audio Toolkit Play
Post by: jeanfabre on January 24, 2013, 08:50:27 AM
Hi,

 Can you bump this thread next week? I'll have a look then, if not earlier on.

 bye,

 Jean
Title: Re: Audio Toolkit Play
Post by: PIXELCRY on January 26, 2013, 01:21:23 AM
dont worry, bumped it will be :D
Title: Re: Audio Toolkit Play
Post by: rollingdjs on February 28, 2013, 04:52:23 AM
I'll bump this. A send event after a sound file is finished would be quite useful to me
Title: Re: Audio Toolkit Play
Post by: jeanfabre on February 28, 2013, 01:43:27 PM
Hi,

 ok, updated the action to feature now an optional event to be fired when audio finishes.

bye,

 Jean
Title: Re: Audio Toolkit Play
Post by: spiral on June 06, 2013, 10:02:03 PM
Hi jean, can you make an action for pitch?

Thanks
Title: Re: Audio Toolkit Play
Post by: jeanfabre on June 07, 2013, 02:06:34 AM
Hi,

 I have some issues understanding how to work it out, I have an action made up but I need to study how to set it up properly.

Let me contact the author to know how to do this properly.

bye,

 Jean
Title: Re: Audio Toolkit Play
Post by: spiral on June 07, 2013, 12:16:00 PM
From clockstone
You have access to all properties. Use AudioController.GetAudioItem("myAudioID") to get the AudioItem, then all subitems are in AudioItem.subItems. See the reference documentation for more info (http://unity.clockstone.com/audiotoo...nce/Index.html

This is from unity forums

I dont understand too.



Thankmyou

Title: Re: Audio Toolkit Play
Post by: jeanfabre on June 10, 2013, 01:05:25 AM
Hi,

 We are in contact already, don't worry, I have everything I need, I'll be posting soon on this.

bye,

 Jean