Topic: Functions for playing multimedia files in bgt using MCI
Hello everyone, saldations to all!
This code I'm going to share, I did based on an existing bgt class called "ultrarec" I found out there.
This class allows you to record audio directly in bgt using the windows MCI interface, which allows you to perform operations with multimedia files, of the most diverse.
I was thinking about this that I decided to quickly write functions to play supported files, such as mp3 for example, besides being able to work with other mci commands, all with bgt.
I want to thank the creator of the ultrarec class for making it easy to access some functions of the winmm.dll library.
To use the script, it's quite simple:
load: Loads a multimedia file. For example: test.mp3, music.wav or music.mid.
Returns true if successful or false if error occurs.
Play: Play the previously loaded file, without waiting for the playback to finish.
Returns true if you have been able to play or false otherwise.
play_wait: It plays the previously loaded file and waits for the file to finish playing. Returns true if you have been able to play or false otherwise.
is_playing: Returns true if the file is playing or false otherwise.
Stop: For file playback. Returns true on success or false in case of an error.
send_command: Sends an MCI command to execute. Returns a string containing the result. This function came from the original class and had almost no modifications.
Download the script here:
https://www.dropbox.com/s/ne7tiqsox136t … r.rar?dl=1
Along with it has another file demonstrating how it works.