Audio/VMPlayer

From TDN

Introduction

Default support for music in TGE is fairly minimal, to say the least. It consists of playing, stopping, looping, and volume control. While this suffices for most sounds in a game, it just doesn't cut it for music. In the past game programmers using TGE were forced to manually implement features commonly used for playing music in games, such as fading, transitioning between songs, randomly playing songs, etc.

VMPlayer (Virtual Music Player) changes all of that. Simply put, it's a script resource that adds some advanced music playing capabilities to the Torque Game Engine. To be more precise, think of it as a media player with no GUI, that's made specifically for playing music in your TGE games.

Note that this resource supports only TGE 1.4 and higher.

Features

Common Music Player Functions - VMPlayer includes the commonly used features you would expect from any music player, such as play, pause, stop, rewind, fastforward, skip tracks, etc.

Playlists - Create multiple playlists and add as many songs as you like to each playlist. Playlists are perfect for grouping similar songs together, whether they are grouped based on game level/map, grouped by the mood of the songs, or any other grouping you can imagine. For instance, an RPG could load and play an "eerie" playlist when the player enters a dungeon and an "upbeat" playlist when the user enters a town.

Random - Randomly play tracks in your playlist. A great way to mix things up.

Repeat - Repeat the same song infinately or repeat entire playlists.

Fading - Automatically fade songs in when they start and fade them out as they end. No more abrupt music stoppages that make a game sound unprofessional.

Cross Fading - Cross fading allows you to smoothly transition from one song to another by fading out the current song while simultaneously fading in the next song. This is perfect for those games where you want the background music to dynamically change based when what is currently happening in your game.

Play Only User Defined Segments of Songs - This handy feature allows you to optionally specify a starting and ending time for each song in your playlist. This allows you to only play a small segment of a song rather than the entire song. It's also useful to remove that extra 5 seconds of white noise at the end some songs.

Synchronize Your Game with Your Music - Ever notice how background music in movies perfectly match events in the movie? VMPlayer gives the programmer this same ability by automatically calling user specified functions at user defined points in a song. This could allow you to flash a bolt of lightning in front of the player exactly when your background music hits its cresendo, or spawn a monster directly behind the player when your music is especially scary.

Let the Player Control the Music - Imagine being able to enable players of your FPS game to modify and create their OWN playlists and play their OWN music in your game while they play. VMPlayer is built with all the features you need to do this, including saving/reading of custom playlists to/from disk. All you need to do is develop the user interface for the user!

Easy to Use - Despite all the features of VMPlayer, it's actually very easy to use. In fact, it's faster to add new songs to your game and play them using VMPlayer than it is to do so using TGE without VMPlayer. It's literally as simple as placing the new song file in your data directory and calling VMPlayer.PlaySong(filename). No need to ever create AudioProfiles or AudioDescriptions, as VMPlayer handles that for you behind the scenes.

The feature list of VMPlayer is even longer than this, but the features listed above cover all the major features. For a complete listing of everything possible in VMPlayer, see the VMPlayer Resource:

VMPlayer


Installing

Download the VMPlayer. Follow the instructions on the resource page to get these scripts working.