Obtain Audio Filename

Status
Not open for further replies.

Rink27

Veteran
Veteran
Joined
Jul 18, 2014
Messages
222
Reaction score
13
First Language
English
Primarily Uses
RMMV
Hello. Is there a script command that can return the filename of the currently playing bgm/bgs/me?

Edit: I'm aware of $dataMap.bgm.name but there are songs that would not be called through map properties.
 
Last edited:

biud436

Veteran
Veteran
Joined
Sep 28, 2014
Messages
172
Reaction score
180
First Language
Korean
Primarily Uses
RMMV
Here's the code that returns an audio file name :

Code:
AudioManager.getBgmFileName = function() {
  return this._currentBgm && this._bgmBuffer && this._currentBgm.name || "";
};

AudioManager.getBgsFileName = function() {
  return this._currentBgs && this._bgsBuffer && this._currentBgs.name || "";
};

AudioManager.getMeFileName = function() {
  if(!this._meBuffer) return "";
  var url = this._meBuffer._url;
  if(url.match(/(?:audio\/me\/)(.*).(?:ogg|m4a)/)) {
    return RegExp.$1;
  }
  return "";
};
if the audio buffer is valid, it will return its name. if not, it will return the empty string instead of its name.
 

Rink27

Veteran
Veteran
Joined
Jul 18, 2014
Messages
222
Reaction score
13
First Language
English
Primarily Uses
RMMV
Thank you very much @biud436. I'd report the thread to be closed now.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,038
Members
137,568
Latest member
invidious
Top