playMaker

Author Topic: FMOD support  (Read 7618 times)

JonathanBurroughs

  • Junior Playmaker
  • **
  • Posts: 73
  • Some kind of independent game developer
    • @HiFiHair
FMOD support
« on: April 24, 2014, 08:25:43 AM »
Hey all,

I posted a query in Playmaker Help about any existing FMOD support, given the recent announcement that FMOD is free for indies with budgets under $100,000.

If that support doesn't already exist having an action set to support FMOD would be incredibly powerful.

JonathanBurroughs

  • Junior Playmaker
  • **
  • Posts: 73
  • Some kind of independent game developer
    • @HiFiHair
Re: FMOD support
« Reply #1 on: April 29, 2014, 08:42:59 AM »
Going to give this a bump. Support for the FMOD Unity Integration native plugin would be fantastic. Although based on the support documentation it doesn't look like an impossible task to make my own audio controller C# script and drive exposed variables from playMaker.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: FMOD support
« Reply #2 on: May 06, 2014, 07:09:31 AM »
Hi,

 I have added a trello task for it, Dont forget to up vote.

https://trello.com/c/D3ZtmsxD/71-fmod

Bye,

 Jean

JonathanBurroughs

  • Junior Playmaker
  • **
  • Posts: 73
  • Some kind of independent game developer
    • @HiFiHair
Re: FMOD support
« Reply #3 on: May 07, 2014, 02:50:23 PM »
Thanks, jeanfabre! That's really excellent of you. I've put in a vote as you suggest. For the time being I'm going to see how much I can control in a C# interface between FMOD and PlayMaker.

Magomusica

  • Playmaker Newbie
  • *
  • Posts: 5
Re: FMOD support
« Reply #4 on: June 22, 2016, 10:40:44 PM »
I have added a trello task for it, Dont forget to up vote.

Awesome! I noticed on trello you said you've moved it to your To Do list, Jean. Any update on this? FMOD support in Playmaker would make all the difference in the world for my project. Thanks for working on this!

Magomusica

  • Playmaker Newbie
  • *
  • Posts: 5
Re: FMOD support
« Reply #5 on: July 02, 2017, 03:06:55 PM »
Jean,

I realize there are a few things above FMOD on the Trello TO DO list, but really there isn't much Playmaker can't do with regards to making a legit game, except for support for professional interactive audio tools. I can't imagine that building Playmaker actions for FMOD is that big of a task at all, as I know that the engineers I work with claim it to be extremely simple and requiring only a few lines of code to get started. This would bring Playmaker into the audio community in a big way. I've been waiting on it for literally over 2 years, as Playmaker is one of the only options for non-code-savvy audio designers like myself for making a game.

Again, I'm sure this would be a quick task for you, and would bring so much functionality and applicability to Playmaker! Please bump it up on the TO DO list!

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: FMOD support
« Reply #6 on: July 02, 2017, 09:16:34 PM »
Magomusica,

I can look into it, but make no promises. If your audio engineer friends just think its a few lines of code, they are welcome at it. But 99% of the time, it takes more than that. There are plenty of assets on the list and even more that are not on the list. If you are in need of something done right away, you can always try and sponsor something to get completed or contact the asset author for them to get the ball rolling.

Again, I will have a look and see what the situation is regarding the code and playmaker.

alexlange

  • Playmaker Newbie
  • *
  • Posts: 16
Re: FMOD support
« Reply #7 on: February 11, 2018, 11:10:30 PM »
Here you go, save it as FMODPlayOneShot.cs.

-------------------------------------------------
using HutongGames.PlayMaker;

    [ActionCategory("FMOD")]
    [Tooltip("FMOD.PlayOneShot at owner's position")]
    public class FMODPlayOneShot : FsmStateAction {

        public FsmOwnerDefault owner;
        public FsmString eventPath;

        public override void Reset()
        {
            owner = null;
        }
       
        public override void OnEnter()
        {
             FMODUnity.RuntimeManager.PlayOneShot(eventPath.Value, Fsm.GetOwnerDefaultTarget(owner).transform.position);
            Finish();
        }
    }

ViRiX Dreamcore

  • Playmaker Newbie
  • *
  • Posts: 34
Re: FMOD support
« Reply #8 on: October 23, 2021, 06:11:52 PM »
I know this is bumped, but figured I'd update the script to work with the current version of PlayMaker.

--------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//You may not need these, but I put them here anyway just in case.



namespace HutongGames.PlayMaker.Actions
{
    [ActionCategory("FMOD")]
    [Tooltip("FMOD.PlayOneShot at owner's position")]
    public class FMODPlayOneShot : FsmStateAction
    {

        public FsmOwnerDefault owner;
        public FsmString eventPath;

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

        public override void OnEnter()
        {
            FMODUnity.RuntimeManager.PlayOneShot(eventPath.Value, Fsm.GetOwnerDefaultTarget(owner).transform.position);
            Finish();
        }
    }
}



ViRiX Dreamcore

  • Playmaker Newbie
  • *
  • Posts: 34
Re: FMOD support
« Reply #9 on: November 02, 2021, 06:02:43 PM »
Hi! I've created two new actions for FMOD> One just plays an instance of an event, while the other plays one with parameter control. I'd like to be able to add more parameters or have an action with just parameter control, but so far, no dice. I'm no programmer, so this is all I could come up with. (Took me hours for these xD)

PlayFMODEvent

using UnityEngine;
using FMODUnity;
namespace HutongGames.PlayMaker.Actions
{

   [ActionCategory("FMOD")]
   [Tooltip("This plays a spatialized instance of an event. However, it can be 2D as well if set up that way in FMOD Studio. ")]
   public class PlayFMODEvent : FsmStateAction
   {

      private FMOD.Studio.EventInstance Instance;


      public FsmOwnerDefault owner;

      [RequiredField]
      [Tooltip("You need the full Event path.")]
      public FsmString FMODEvent;

      // Code that runs on entering the state.
      public override void OnEnter()
      {
         Instance = FMODUnity.RuntimeManager.CreateInstance(FMODEvent.Value);
         Instance.set3DAttributes(RuntimeUtils.To3DAttributes(Fsm.GetOwnerDefaultTarget(owner).transform.position));

         Instance.start();
         Instance.release();
         
      }




   }

}


PlayEventWithParameter

using UnityEngine;
using FMODUnity;

namespace HutongGames.PlayMaker.Actions
{

   [ActionCategory("FMOD")]
   [Tooltip("This plays an event from FMOD and has controls for a single parameter.")]
   public class PlayEventWithParameter : FsmStateAction
   {
      private FMOD.Studio.EventInstance Instance;

      private FMOD.Studio.PARAMETER_ID paramID;

      public FsmOwnerDefault owner;
      public FsmString FMODEvent;
      public FsmString ParameterName;
      public FsmFloat ParameterValue;
      public bool Everyframe;

      public override void Reset()
      {
         owner = null;
         Everyframe = false;

      }

      // Code that runs on entering the state.
      public override void OnEnter()
      {
         Instance = FMODUnity.RuntimeManager.CreateInstance(FMODEvent.Value);
         Instance.set3DAttributes(RuntimeUtils.To3DAttributes(Fsm.GetOwnerDefaultTarget(owner).transform.position));

         FMOD.Studio.EventDescription eventInfo;

         Instance.getDescription(out eventInfo);

         FMOD.Studio.PARAMETER_DESCRIPTION paramDescription;

         eventInfo.getParameterDescriptionByName(ParameterName.Value, out paramDescription);

         paramID = paramDescription.id;

         Instance.start();
         Instance.release();


      }

      // Code that runs every frame.
      public override void OnUpdate()
      {
         Instance.setParameterByID(paramID, ParameterValue.Value);
         if (!Everyframe)
         {
            Finish();
         }

      }


   }

}