Provided Methods

Updated 2 weeks ago

Usage

Provided Methods

Without going into detail (the names might explain themselves), here are all methods this library provides:

  • public static SharedAudioComponent GetSharedAudioComponent();
  • public static void CleanSharedAudioComponent();
  • public static void CleanEverySharedAudioComponent();
  • public static AudioList AudioListCreateNew();
  • public static AudioList AudioListGetDefault();
  • public static AudioList AudioListGetByName();
  • public static AudioList AudioListGetLongest();
  • public static AudioList AudioListGetShortest();
  • public static AudioList AudioListGetRandom();
  • public static AudioList AudioListGetRandomByWeight();
  • public static int AudioListGetIndex();
  • public static AudioList AudioListGetNextInAllAudioLists();
  • public static void RemoveAudioList();
  • public static void RemoveAudioClip();
  • public static void RemoveAudioClipRange();
  • public static void RemoveDuplicates();
  • public static void RemoveNull();
  • public static void RemoveLoadType();
  • public static AudioClip AudioClipAddNew();
  • public static AudioClip[] AudioClipAddNewRange();
  • public static AudioClip[] AudioClipAddNewRangeCapped();
  • public static AudioClip AudioClipGetByName();
  • public static AudioClip AudioClipGetNextInAudioList();
  • public static AudioClip AudioClipGetRandom();
  • public static AudioClip AudioClipGetRandomByWeight();
  • public static AudioClip[] AudioClipGetAll();
  • public static int AudioClipGetIndex();
  • public static AudioClipWithWeight AudioClipGetAudioClipWithWeight();
  • public static AudioList AudioClipGetAudioList();
  • public static AudioList[] AudioClipGetEveryAudioList();

These methods are flexible enough to be able to get basically any piece of information from another piece of information.

  • For example, after getting a randomly weighted AudioClip in an AudioList, you can then get an AudioClip at the same index in another AudioList (in the case of something like faraway versions of the same sound effect) with this monstrosity of a line:
    • farawayClip = SharedAudioMethods.AudioListGetByName("FarAudioList", SharedAudioMethods.GetSharedAudioComponent(__instance.gameObject)) .weightedClipsList[SharedAudioMethods.AudioClipGetIndex(nearbyClip, SharedAudioMethods.AudioClipGetAudioList(nearbyClip, SharedAudioMethods.GetSharedAudioComponent(__instance.gameObject)))].audioClip;

So, I (with my very limited programming knowledge) believe this system to be functional, and although I don't know if I will use all of these in my own mods, I think this should be enough to answer any absurd question I might have to create multiple AudioLists with multiple AudioClips to find back by name and reference individually and then roll for randomly and and then get its index in the AudioList to then get the next AudioClip in the list, etcetera, etcetera...