Raised This Month: $32 Target: $400
 8% 

[EXTENSION] Sound Library (mp3/wav)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 08-03-2008 , 18:21   [EXTENSION] Sound Library (mp3/wav)
Reply With Quote #1

THIS EXTENSION IS DEPRECATED, USE MY NEW ONE: [EXTENSION] Sound Info Library 0.9 beta

Description:

This extension provides functions for reading useful infos out of mp3 and wav files (sound length, bitrate, sampling rate, mp3 ID3 tag...), I decided to do this because the hl2 internal GetSoundDuration function doesn't work properly.
It can be used in plugins like saysounds, and other sound player plugins.

Atm this is for windows only, but I I'm going to add linux support later.

Code:
**
 * Opens a sound file.
 *
 * @note Sound files are closed with CloseHandle().
 *
 * @param file            File to open.
 * @return                A Handle to the sound file, INVALID_HANDLE on open error.
 */
native Handle:OpenSoundFile(const String:file[]);



/**
 * Gets the sound length of a sound
 *
 * @param hndl            Handle to the sound file.
 * @return                The song length in seconds
 */
native Float:GetSoundLength(Handle:hndl);



/**
 * Get the Bit rate of sound (kbps)
 *
 * @param hndl            Handle to the sound file
 * @param buffer        Buffer to use for storing the string.
 * @param maxlength        Maximum length of the buffer.
 * @return                Length of string written to buffer.
 */
native GetSoundBitRate(Handle:hndl);



/**
 * Get the Sampling rate of sound (hz)
 *
 * @param hndl            Handle to the sound file
 * @param buffer        Buffer to use for storing the string.
 * @param maxlength        Maximum length of the buffer.
 * @return                Length of string written to buffer.
 */
native GetSoundSamplingRate(Handle:hndl);



/**
 * Get the Artist of mp3 sound
 *
 * @param hndl            Handle to the sound file
 * @param buffer        Buffer to use for storing the string.
 * @param maxlength        Maximum length of the buffer.
 * @return                Length of string written to buffer.
 */
native GetSoundMp3Artist(Handle:hndl, String:buffer[], maxlength);



/**
 * Get the Track title of mp3 sound
 *
 * @param hndl            Handle to the sound file
 * @param buffer        Buffer to use for storing the string.
 * @param maxlength        Maximum length of the buffer.
 * @return                Length of string written to buffer.
 */
native GetSoundMp3Title(Handle:hndl, String:buffer[], maxlength);



/**
 * Get the Track number of mp3 sound
 *
 * @param hndl            Handle to the sound file
 * @param buffer        Buffer to use for storing the string.
 * @param maxlength        Maximum length of the buffer.
 * @return                Length of string written to buffer.
 */
native GetSoundMp3Num(Handle:hndl);



/**
 * Get the Album of mp3 sound
 *
 * @param hndl            Handle to the sound file
 * @param buffer        Buffer to use for storing the string.
 * @param maxlength        Maximum length of the buffer.
 * @return                Length of string written to buffer.
 */
native GetSoundMp3Album(Handle:hndl, String:buffer[], maxlength);



/**
 * Get the Year of mp3 sound
 *
 * @param hndl            Handle to the sound file
 * @param buffer        Buffer to use for storing the string.
 * @param maxlength        Maximum length of the buffer.
 * @return                Length of string written to buffer.
 */
native GetSoundMp3Year(Handle:hndl, String:buffer[], maxlength);



/**
 * Get the Comment of mp3 sound
 *
 * @param hndl            Handle to the sound file
 * @param buffer        Buffer to use for storing the string.
 * @param maxlength        Maximum length of the buffer.
 * @return                Length of string written to buffer.
 */
native GetSoundMp3Comment(Handle:hndl, String:buffer[], maxlength);



/**
 * Get the Genre of mp3 sound
 *
 * @param hndl            Handle to the sound file
 * @param buffer        Buffer to use for storing the string.
 * @param maxlength        Maximum length of the buffer.
 * @return                Length of string written to buffer.
 */
native GetSoundMp3Genre(Handle:hndl, String:buffer[], maxlength);
Attached Files
File Type: rar release_soundlib-extension_0.5.rar (115.9 KB, 582 views)
File Type: rar soundlib_extension_source_0.5.rar (66.4 KB, 444 views)

Last edited by berni; 11-04-2011 at 14:07.
berni is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 08-03-2008 , 22:05   Re: Sound Library extension (mp3/wav)
Reply With Quote #2

Nice, I was kinda screwed by the deprecation of GetSoundDuration, this fixes that
__________________
Greyscale is offline
PAL-18
AlliedModders Donor
Join Date: Jul 2010
Old 07-29-2011 , 14:50   Re: [EXTENSION] Sound Library (mp3/wav)
Reply With Quote #3

Will a linux version be available?
PAL-18 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-29-2011 , 15:08   Re: [EXTENSION] Sound Library (mp3/wav)
Reply With Quote #4

Quote:
Originally Posted by PAL-18 View Post
Will a linux version be available?
I'm pretty sure this extension is deprecated in favor of the Sound Info Library extension by the same author, which does have a Linux build.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-29-2011 at 16:49.
Powerlord is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:57.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode