psai API Reference  1.5
psai API Reference Documentation


Welcome to the psai API Reference!

In this document you will find the API reference and the most basic instructions for setting up and using psai in your game. The psai API is rather slim, since much of the work is done by the composer using our authoring tool psai EDITOR. For a more general introduction to psai and its features, please refer to the psai Manual included in this SDK.

Setting up psai

To use psai in your project, you need to...

  1. add psai\inc to your additional include directories
  2. #include "psai.h" (located in the inc folder of the psai native api)
  3. link one of the static import libs \lib\psai.lib (loading the 'psai.dll' release version) or \lib\psai_log.lib (loading the 'psai_log.dll' for generating debug output to 'psai.log')
  4. copy the files \release-dll\psai.dll and / or \log-dll\psai_log.dll to your project binary output folder
  5. The psai EDITOR creates a folder containing all the data needed for the playback of your interactive soundtrack. Copy the folder to your project, remember the subfolders name ("psaiData" in the following example). Make sure to preserve the directory structure.

  6. Within your project's sourcecode, create your instance of psai::PsaiCore, passing the path to your subfolder, like this:
    psai::PsaiCore myPsaiInstance = psai::PsaiCore::Create("psaiData");
  7. Now you are ready for triggering music themes. For example, trigger theme 1 with a starting intensity of 50% by calling
    psai::PsaiCore::triggerMusicTheme(1, 0.5f);

Using psai

Each psai method will return as quickly as possible, and all the work is done by background worker threads. Therefore it is not necessary to create a dedicated thread for psai, just call it from your game loop. Calling psai from different threads is no problem though - all of psai's methods are thread-safe.