Advertisement
sifterstudios

FMOD Overloads for PlayOneShot (Volume, Parameters)

Aug 19th, 2022
1,371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.51 KB | Gaming | 0 0
  1. public static void PlayOneShotVolume(EventReference eventReference, float volume,
  2.             Vector3 position = new Vector3())
  3.         {
  4.             try
  5.             {
  6.                 PlayOneShotVolume(eventReference.Guid, volume, position);
  7.             }
  8.             catch (EventNotFoundException)
  9.             {
  10.                 RuntimeUtils.DebugLogWarning("[FMOD] Event not found: " + eventReference);
  11.             }
  12.         }
  13.  
  14.         public static void PlayOneShotVolume(string path, float volume, Vector3 position = new Vector3())
  15.         {
  16.             try
  17.             {
  18.                 PlayOneShotVolume(PathToGUID(path), volume, position);
  19.             }
  20.             catch (EventNotFoundException)
  21.             {
  22.                 RuntimeUtils.DebugLogWarning("[FMOD] Event not found: " + path);
  23.             }
  24.         }
  25.  
  26.         public static void PlayOneShotVolume(FMOD.GUID guid, float volume, Vector3 position = new Vector3())
  27.         {
  28.             var instance = CreateInstance(guid);
  29.             instance.set3DAttributes(RuntimeUtils.To3DAttributes(position));
  30.             instance.setVolume(volume);
  31.             instance.start();
  32.             instance.release();
  33.         }
  34.  
  35.  
  36.         public static void PlayOneShotLabeledParam(EventReference eventReference, PARAMETER_ID id, string label,
  37.             Vector3 position = new Vector3())
  38.         {
  39.             try
  40.             {
  41.                 PlayOneShotLabeledParam(eventReference.Guid, id, label, position);
  42.             }
  43.             catch (EventNotFoundException)
  44.             {
  45.                 RuntimeUtils.DebugLogWarning("[FMOD] Event not found: " + eventReference);
  46.             }
  47.         }
  48.  
  49.         public static void PlayOneShotLabeledParam(string path, PARAMETER_ID id, string label,
  50.             Vector3 position = new Vector3())
  51.         {
  52.             try
  53.             {
  54.                 PlayOneShotLabeledParam(PathToGUID(path), id, label, position);
  55.             }
  56.             catch (EventNotFoundException)
  57.             {
  58.                 RuntimeUtils.DebugLogWarning("[FMOD] Event not found: " + path);
  59.             }
  60.         }
  61.  
  62.         public static void PlayOneShotLabeledParam(FMOD.GUID guid, PARAMETER_ID id, string label,
  63.             Vector3 position = new Vector3())
  64.         {
  65.             var instance = CreateInstance(guid);
  66.             instance.set3DAttributes(RuntimeUtils.To3DAttributes(position));
  67.             instance.start();
  68.             instance.setParameterByIDWithLabel(id, label);
  69.             instance.release();
  70.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement