I'm proud to present the DarkBASIC Enhanced Audio Plugin.
Media capabilities include playing Ogg Vorbis, MP3, FLAC, WAV (uncompressed), AIFF, MOD, S3M, XM, and IT files. Extra features include the use of 3D world Trigger Zones with audio that you load into your game.
The command list (plus parameters) are included below for reference:
LOAD AUDIO audio index number, filename
DELETE AUDIO audio index number
PLAY AUDIO audio index number
STOP AUDIO audio index number
PAUSE AUDIO audio index number
RESUME AUDIO audio index number
LOOP AUDIO audio index number
AUDIO VOLUME audio index number, volume (float)
*NOTE: volume 0.0 = silence, 1.0 = maximum volume (default)
AUDIO PAN audio index number, pan (float)
*NOTE: pan -1.0 = left, 0.0 = center (default), 1.0 = right
AUDIO PITCH SHIFT audio index number, pitch shift (float)
*NOTE: pitch shift range 0.5 to 2.0
GET AUDIO VOLUME audio index number (returns float)
GET AUDIO PAN audio index number (returns float)
GET AUDIO PITCH SHIFT audio index number (returns float)
AUDIO PLAYING audio index number (returns true or false)
AUDIO SEEKABLE audio index number (returns true or false)
AUDIO LENGTH audio index number (returns number of frames in the streaming sound or returns 0 for not seekable)
AUDIO POSITION audio index number (returns current position in frames)
AUDIO SET POSITION audio index number, position
AUDIO USE DEVICE device (1 = winmm, 2 = DirectSound)
AUDIO EXIST audio index number (returns true or false)
SET AUDIO TRIGGER ZONE trigger index, audio index, trigger x, trigger y, trigger z, height, width, depth, trigger type
*NOTE: Trigger Types,
1 = Play sound when trigger entered, stops when trigger exited.
2 = Play sound when trigger entered, keeps playing till done even if the trigger area is exited.
3 = Plays sound only once.
4 = Loops sound when trigger entered, stops sound when trigger exited.
CHECK AUDIO TRIGGER ZONE trigger index, current x position, current y position, current z position
AUDIO WHITE NOISE audio index number
AUDIO PINK NOISE audio index number
AUDIO RESET PLAYED trigger index number
Installation:
DarkBASIC_EAP_15.exe - This is the automatic installation file. Very simple to use installer, and was tailored to work with users that have DarkBASIC Pro installed on their computer.
audiodll.zip - This archive is for users that cannot use the above installer and need to manually install the plugin onto their pc.
Instructions for a manual install:
audiodll.ini - Add this file to your keywords folder.
audiodll.dll - Add this file to your plugins-user folder.
Documentation was not provided in the installation files because of the simplicity of this plugin. Should the need arise for documentation or source code examples, I can release patch updates for this plugin.
I am currently looking into exanding this plugin to include features for saving/creating various audio formats. Any suggestions for development are welcomed as well!
Enjoy!