playMaker

Author Topic: Audio Toolkit Play  (Read 14722 times)

TomEllard

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Audio Toolkit Play
« Reply #15 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.

PIXELCRY

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Audio Toolkit Play
« Reply #16 on: January 19, 2013, 02:20:06 AM »
still no news for the action to attach a played sound to a gameobject?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Audio Toolkit Play
« Reply #17 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
« Last Edit: February 28, 2013, 01:37:50 PM by jeanfabre »

PIXELCRY

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Audio Toolkit Play
« Reply #18 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
« Last Edit: January 23, 2013, 03:17:29 AM by PIXELCRY »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Audio Toolkit Play
« Reply #19 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

PIXELCRY

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Audio Toolkit Play
« Reply #20 on: January 26, 2013, 01:21:23 AM »
dont worry, bumped it will be :D

rollingdjs

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Audio Toolkit Play
« Reply #21 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

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Audio Toolkit Play
« Reply #22 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

spiral

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Audio Toolkit Play
« Reply #23 on: June 06, 2013, 10:02:03 PM »
Hi jean, can you make an action for pitch?

Thanks

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Audio Toolkit Play
« Reply #24 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

spiral

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Audio Toolkit Play
« Reply #25 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


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Audio Toolkit Play
« Reply #26 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