Psai's playback logic is based on the concept of musical intensity. Whenever a Theme is playing, psai is permanently trying to adapt the musical intensity to the current gameplay situation. It does so by continuously enqueueing musical Segments of an intensity that currently fits the best. All a game developer has to do is to map the current gameplay intensity to a value between 1% and 100%, and then pass it to psai's function for triggering Themes, along with the id of the desired theme. To map the intensity to a percentage value you can e.g. use the remaining health-points of the player, or maybe the number of attacking enemies.
Automatic decrease of Intensity
After you triggered a theme with a certain intensity, the psai's internal intensity will immediately be set to this new level. If no more trigger calls follow, psai's intensity will automatically and consistently decrease. The rate of this fall-off can be authored per Theme within the psai Editor. The purpose of this decrease is that game developers don't have to check back on psai's playback status to eventually turn off any themes, of nothing is happening. Instead it is sufficient to place trigger-events within your game world and/or your gameplay logic, and psai will take care of the rest.
To keep psai's intensity level in-line with your current game situation (like during a battle with dynamic intensity), just trigger the same theme repeatedly, and thereby pass the updated intensity value. A trigger interval of one second is usually sufficient for a common soundtrack. Please see the Best Practice section for more information on how to achieve a highly adaptive soundtrack.
If you would like to temporarily deactivate the automatic decrease of intensity, use the Hold Intensity function.