No categories assigned

Using welove.audio Engine in Unity

We currently support welove.audio Engine in Unity on 64-bit Microsoft Windows. The Core Rendering Engine binaries are in wla.dll and the functionality is accessible via WeloveAudioPlayer.cs C# script.

Basic usage

download-engine-api-files.png
welove-audio-player-script-component.png
  1. Get the welove.audio Engine API files
    1. Have your game project open in Unity
    2. Download the WLA Unity Player archive. You may access this from "Downloads" in the project editor on https://app.welove.audio
    3. Unpack the archive
    4. Copy the Assets directory in the WLA Unity Player archive to your Unity project so that you have the following files:
      • Assets/Assemblies/wla.dll
      • Assets/Scripts/WeloveAudioPlayer.cs
  2. Define the music for your game
    1. Use our website https://app.welove.audio to generate a new music project for your game. See Adaptive Music Design.
    2. Choose the music and check out the .zip file
    3. Create directory Assets/StreamingAssets in your Unity project file
    4. Extract the contents of the .zip file to this directory. You should see files such as:
      • Assets/StreamingAssets/Music/project/*.avalon_project (1 per project)
      • Assets/StreamingAssets/Music/project/*.avalon_page
      • Assets/StreamingAssets/Music/modules/*.avalon_bank
      • Assets/StreamingAssets/Music/modules/*.avalon_module
  3. Do a bit of coding
    1. Instantiate WeloveAudioPlayer.cs
      • Create an empty game object. Let's call it "Music".
      • In this "Music" game object, create an AudioSource component.
      • Add WeloveAudioPlayer.cs as a component of the "Music" game object. See also WeloveAudioPlayer.
    2. Enter the project production code into the component. The project production code looks like 5d31cd3425ca3533ccf107ed. See also WeloveAudioPlayer.
    3. Optionally, you may also specify the name of the page which is to be activated when the game starts.
    4. If you specified the correct project production code and a correct page name, you should hear the music after pressing the Unity's Play button.
    5. Utilize the API functions listed in the next section to access music. See also WeloveAudioPlayer.
  4. Purchase the music
    1. When you're happy with the choices and setup of the music in your game, you're more than welcome to purchase it. Click the "Shopping Cart" button.
    2. Note: The music which has not been purchased will have an audible watermark "welove adaptive audio" and the music project (.zip file) will be valid only for 30 days.

Getting more music / Modifying an existing project

It is of course possible to purchase more music for your project and/or create more pages. Please note the following:

  • If you change the name of a page, add a new page, change parameters:
    • You need to re-download the .zip file and replace the existing files in your Unity project with those you downloaded.
  • If you add more music assets:
    • Before the assets are checked out -- In order to test them in your game, you will need to re-download the .zip file. Please note that the new music assets will contain a watermark.
    • After the assets are checked out -- The watermark will be gone, however, you sill need to re-download the .zip file.

Code snippets

// To reach the WLA player component anywhere in your game:
var player = (WeloveAudioPlayer)FindObjectOfType(typeof(WeloveAudioPlayer));
// You might want to check if it really exits, of course.
if (player == null) { /* can't do any of the music stuff here */ }

// To activate a page:
// Assuming "MENU" is the Page Name (a.k.a. production code)
// of a page you wish to run
player.WlaActivatePage("MENU"); 

// To deactivate a page:
player.WlaDeactivatePage("MENU");

// To set a parameter value:
// Assuming "FIGHT" is a globally exposed parameter.
// (Please note that the word 'register' is a synonym to 'parameter' currently in use.)
player.WlaSetRegisterValue("FIGHT", 1.0);

// To enable logging to file:
// The file gets created c:\dummy
player.WlaEnableDebugLog();

// To set the master volume:
// Utilize the Unity Mixer.