sfile_get_duration(szFilename[])
Return duration of sound ( Float ) it's not work on mp3 files encoded with dynamic bitrate ( VBR )
First parametr is path to the file.
get_duration(iData[SParam])
Also return duration of sound ( Float ) as sfile_get_duration it's not work on mp3 files with VBR
Parametr is table with information load with sfile_loaddata()
sfile_is_valid(szFilename[])
Return true or false if sound can be played in cs
sfile_type(szFilename[])
Return what type of file is it
SFILE_MP3
SFILE_WAV
SFILE_UNKNOWN
sfile_loaddata(szFilename[], iData[SParam])
Load information about song return SRES_NOT_EXISTS if not found file
For mp3 file return
SRES_BAD_PARAMETERS
SRES_OK
For wav file
SRES_BAD_SIGNATURE
SRES_OK
First parametr is path to file
Second is special table where information about song will be writen
SOUND_FREQ - frequence of sound
SOUND_BYTERATE - byterate
SOUND_CHAN_NUM - ammount of channels
SOUND_DURATION_F - duration of sound to get this use
Float:iData[SOUND_DURATION_F])
get_duration(iData)
sfile_loaddata_mp3(szFilename[], iData[SParam])
Same as sfile_loaddata but only for mp3 files
sfile_loaddata_wav(szFilename[], iData[SParam])
Same as sfile_loaddata but only for wav files
Example:
Code: Select all
#include <amxmodx>
#include <amxmisc>
#include <soundinfo>
#define PLUGIN "Wav"
#define VERSION "1.0"
#define AUTHOR "R3X"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("sinfo", "sinfo",0, "<sound> //path from cstrike");
}
public sinfo(id){
new szFilename[32];
read_argv(1, szFilename, 31);
switch(sfile_type(szFilename)){
case SFILE_MP3: log_amx("MP3");
case SFILE_WAV: log_amx("WAV");
default: log_amx("UNKNOWN");
}
new iData[SParam];
if(sfile_loaddata(szFilename, iData) == SRES_OK){
client_print(id, print_console, "Freq = %d", iData[SOUND_FREQ]);
client_print(id, print_console, "ByteRate = %d", iData[SOUND_BYTERATE]);
client_print(id, print_console, "Channels = %d", iData[SOUND_CHAN_NUM]);
client_print(id, print_console, "Duration = %f", Float:iData[SOUND_DURATION_F]);
client_print(id, print_console, "Duration = %f", sfile_get_duration(szFilename));
if(sfile_is_valid(szFilename))
client_print(id, print_console, "Valid!");
else
client_print(id, print_console, "Invalid!");
}
return PLUGIN_HANDLED
}