2017-05-27 00:15:00

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.
It is!
Download the script here:
https://www.dropbox.com/s/ne7tiqsox136t … r.rar?dl=1

Along with it has another file demonstrating how it works.
Enjoy!

2017-05-27 00:49:31

@Gabriel i don't recommend use of mp3, mainly for looping purposes.

2017-05-27 01:43:57

brian.kurosawa wrote:

@Gabriel i don't recommend use of mp3, mainly for looping purposes.

Yes, for more complex things it may not be a good option. But maybe for a basic playback without needing a conversion, it's a good alternative. In case you need to convert mp3s to work directly with the bgt sound class, a good day is to use mpg123, which does this almost at the speed of light. Lol. Of course the machine's processing speed also helps a lot.
greetings

2017-05-28 18:02:08

Oh dude thanks for that, Interested in libraries since I see what It could do!

---
Co-founder of Sonorous Arts.
Check out Sonorous Arts on github: https://github.com/sonorous-arts/
my Discord: kianoosh.shakeri2#2988

2017-05-29 04:27:54

hello,
sceems good
although bgt's dll class sucks, but anyway, maybe some functions could be supported from win API