Skip to main content

Setup

Properties


Samplerate

  • Type: double

  • Summary: Get or Set the sample rate of the engine

  • Description: Represents the sample rate at which the engine operates. Adjusting the sample rate may affect the quality and performance of audio processing.

  • Example:

    // Setting the Samplerate
    Reactional.Setup.Samplerate = 44100;

    // Getting the Samplerate
    double rate = Reactional.Setup.Samplerate;

BlockSize

  • Type: int

  • Summary: Get or Set the block size of the engine

  • Description: Represents the block size of the engine. The block size may affect the engine's processing capabilities, with larger blocks potentially offering better performance at the cost of increased latency.

  • Example:

    // Setting the BlockSize
    Reactional.Setup.BlockSize = 512;

    // Getting the BlockSize
    int blockSize = Reactional.Setup.BlockSize;

Lookahead

  • Type: int

  • Description: Delays audio to be able to processing engine events ahead of time

  • Example:

    // Setting the Lookahead
    Reactional.Setup.Lookahead = 1;

    // Getting the Lookahead
    int blockSize = Reactional.Setup.Lookahead;

IsValid

  • Type: bool

  • Description: Checks the validity of the ReactionalManager instance in the scene. Returns true if a valid instance exists; otherwise, it logs an error and returns false.

  • Example:

    bool valid = Reactional.Setup.IsValid;

AllowPlay

  • Type: bool

  • Description: Determines whether the ReactionalEngine instance is allowed to play. When true, the system is allowed to Process and Play audio. When false, the system is halted and no audio is played.

  • Example:

    // Enabling play
    Reactional.Setup.AllowPlay = true;

    // Checking if play is allowed
    bool canPlay = Reactional.Setup.AllowPlay;

Methods


InitAudio

  • Return Type: void
  • Parameters: int bufferSize = -1, int sampleRate = -1
  • Description: Initializes the audio settings for the engine. If no values are provided for bufferSize and sampleRate, it fetches the default values using AudioSettings.

UpdateBundles

  • Return Type: void
  • Description: Reads all bundles and populates the ReactionalManager in the inspector. Useful for Runtime reading of bundles added post release.

LoadBundles

  • Return Type: async void
  • Description: Loads all asset bundles found in the StreamingAssets folder.

LoadBundle

  • Return Type: async void

  • Description: Loads a specific asset bundle from the StreamingAssets folder. This is a convenience method; the first theme and playlist of the first bundle will be selected by default. Automatically loads all Sections in bundle.

  • Example:

    await Reactional.Setup.LoadBundle("MyMusicProject_12030");

LoadSection

  • Return Type: async void

  • Description: Loads a specific section from a specific asset bundle from the StreamingAssets folder. This is a convenience method; the first theme and playlist of said section will be selected by default. Automatically loads all Themes and Playlists in section.

  • Example:

    await Reactional.Setup.LoadSection("MyMusicProject_12030", "Level2");

LoadPlaylist

  • Return Type: async Task

  • Description: Loads a specific playlist from a specific asset bundle from the StreamingAssets folder. Automatically loads all Tracks.

  • Overloads:

    LoadPlaylist(string bundleName, string sectionName, string playlistName)
    LoadPlaylist(string bundleName, string playlistName)
    LoadPlaylist(int bundleIndex, string playlistName)
    LoadPlaylist(string playlistName = "")
  • Example:

    await Reactional.Setup.LoadPlaylist("MyMusicProject_12030", "DefaultPlaylist");

LoadTrack

  • Return Type: async void

  • Description: Loads a specific track from a specific asset bundle from the StreamingAssets folder.

  • Example:

    await Reactional.Setup.LoadTrack("MyMusicProject_12030", "Summertime is sometimes hot");

LoadTheme

  • Return Type: async Task

  • Description: Loads a specific track from a specific asset bundle from the StreamingAssets folder.

  • Overloads:

    LoadTheme(string bundleName, string sectionName, string themeName)
    LoadTheme(string themeName = "")
  • Example:

    await Reactional.Setup.LoadTheme("Epic Encounters");

Enumerators


LoadType

  • Values:
    LoadInBackground  = 0
    Synchronous = 1
  • Description: Selecting load type for certain methods.

UpdateMode

  • Values:
    Main        = 0
    Threaded = 1
    AudioThread = 2
  • Description: Selecting which thread the engine runs on.

AudioOutputMode

  • Values:
    Unity   = 0
    Custom = 1
  • Description: Designates if Unity's default audio output setup will be in use.