This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[EXTENSION] Sound Info Library v1.0.1


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rasv
Junior Member
Join Date: Apr 2017
Old 08-26-2017 , 19:49   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #1

fixed with Microsoft Visual C++ 2010 and Microsoft Visual C++ 2010 sp1
rasv is offline
rasv
Junior Member
Join Date: Apr 2017
Old 08-26-2017 , 20:42   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #2

nvm now i just crash whenever someone is a t on the server too long which is weird, im usin a custom jihad plugin

[apparently the csgo birthday update broke the jihad we had, sound info library or both]

Last edited by rasv; 08-27-2017 at 00:37.
rasv is offline
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 09-04-2017 , 06:45   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #3

This does not work correctly with VPKs (like TF2's sound/vo/ folder)

Code:
TagLib: Could not open file /home/tf2/serverfiles/tf/sound/vo/sniper_item_birdhead_round_start02.mp3
__________________
MAGNAT2645 is offline
AdRiAnIlloO
Member
Join Date: Jul 2015
Location: Spain
Old 11-04-2021 , 16:07   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #4

Hi there,

Quote:
Originally Posted by MAGNAT2645 View Post
This does not work correctly with VPKs (like TF2's sound/vo/ folder)

Code:
TagLib: Could not open file /home/tf2/serverfiles/tf/sound/vo/sniper_item_birdhead_round_start02.mp3
Quote:
Originally Posted by StrikerMan780 View Post
Bump from hell, but is there a chance this could be updated to support getting the length of a song or sound that's inside a VPK or the SteamPipe folders?
In case it's still useful for anyone, I've edited SoundLib to support reading from VPKs (more generally, from any gameinfo.txt search path).

Download from: https://github.com/Adrianilloo/soundlib/releases

However, it's worth to note that, funny enough, at least for HL2MP, server-side sound VPKs don't contain the sound/music files themselves -which was probably done by Valve to save space-, making it necessary to copy VPKs from client anyway (or extract the relevant song files using GCFScape).

Cya!

Last edited by AdRiAnIlloO; 11-05-2021 at 10:27.
AdRiAnIlloO is offline
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 11-05-2021 , 13:49   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #5

Quote:
Originally Posted by AdRiAnIlloO View Post
Hi there,





In case it's still useful for anyone, I've edited SoundLib to support reading from VPKs (more generally, from any gameinfo.txt search path).

Download from: https://github.com/Adrianilloo/soundlib/releases

However, it's worth to note that, funny enough, at least for HL2MP, server-side sound VPKs don't contain the sound/music files themselves -which was probably done by Valve to save space-, making it necessary to copy VPKs from client anyway (or extract the relevant song files using GCFScape).

Cya!
Hi. Can you please also implement methodmap natives (in the extension) from this?
Code:
methodmap SoundFile < Handle {
    /**
    * Opens a sound file.
    *
    * @note Sound files are closed with CloseHandle().
    *
    * @param file                File to open
    * @param relativeToSound     if true, it is relative to the sound directory, otherwise you have to build the path yourself
    * @return                    A Handle to the sound file, null on open error.
    */
    public SoundFile(const char[] file, bool relativeToSound=true) { return view_as< SoundFile >( OpenSoundFile( file, relativeToSound ) ); }

    /**
    * Gets the length of the sound file in seconds
    *
    * @return                    The song length in seconds
    */
    property int Length {
        public get() { return GetSoundLength( this ); }
    }

    /**
    * Gets the length of the sound file in seconds as float.
    * Note: this probably won't work with some VBR encoded mp3's
    *
    * @return                    The song length in seconds as float
    */
    property float LengthFloat {
        public get() { return GetSoundLengthFloat( this ); }
    }

    /**
    * Get the Bit rate of sound (kbps)
    *
    * @return                    Sound bitrate (cell)
    */
    property int BitRate {
         public get() { return GetSoundBitRate( this ); }
    }

    /**
    * Get the Sampling rate of sound (hz)
    *
    * @return                    Sampling rate (cell)
    */
    property int SamplingRate {
        public get() { return GetSoundSamplingRate( this ); }
    }

    /**
    * Get the Artist of the sound
    *
    * @param buffer              Buffer to use for storing the string.
    * @param maxlength           Maximum length of the buffer.
    * @return                    Length of string written to buffer.
    */
    public int GetArtist(char[] buffer, int maxlength) { return GetSoundArtist( this, buffer, maxlength ); }

    /**
    * Get the Track title of sound
    *
    * @param buffer              Buffer to use for storing the string.
    * @param maxlength           Maximum length of the buffer.
    * @return                    Length of string written to buffer.
    */
    public int GetTitle(char[] buffer, int maxlength) { return GetSoundTitle( this, buffer, maxlength ); }

    /**
    * Get the Track number of the sound
    *
    * @return                    Sound number (cell)
    */
    property int Number {
        public get() { return GetSoundNum( this ); }
    }

    /**
    * Get the Album of the sound
    *
    * @param buffer              Buffer to use for storing the string.
    * @param maxlength           Maximum length of the buffer.
    * @return                    Length of string written to buffer.
    */
    public int GetAlbum(char[] buffer, int maxlength) { return GetSoundAlbum( this, buffer, maxlength ); }

    /**
    * Get the Year of sound
    *
    * @return                    Sound year (cell)
    */
    property int Year {
        public get() { return GetSoundYear( this ); }
    }

    /**
    * Get the Comment of the sound
    *
    * @param buffer              Buffer to use for storing the string.
    * @param maxlength           Maximum length of the buffer.
    * @return                    Length of string written to buffer.
    */
    public int GetComment(char[] buffer, int maxlength) { return GetSoundComment( this, buffer, maxlength ); }

    /**
    * Get the Genre of the sound
    *
    * @param buffer              Buffer to use for storing the string.
    * @param maxlength           Maximum length of the buffer.
    * @return                    Length of string written to buffer.
    */
    public int GetGenre(char[] buffer, int maxlength) { return GetSoundGenre( this, buffer, maxlength ); }
};
So it doesn't have to be a wrapper.
__________________

Last edited by MAGNAT2645; 11-05-2021 at 14:06.
MAGNAT2645 is offline
AdRiAnIlloO
Member
Join Date: Jul 2015
Location: Spain
Old 11-08-2021 , 11:11   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #6

Quote:
Originally Posted by MAGNAT2645 View Post
Hi. Can you please also implement methodmap natives (in the extension) from this?
Code:
methodmap SoundFile < Handle {
    /**
    * Opens a sound file.
    *
    * @note Sound files are closed with CloseHandle().
    *
    * @param file                File to open
    * @param relativeToSound     if true, it is relative to the sound directory, otherwise you have to build the path yourself
    * @return                    A Handle to the sound file, null on open error.
    */
    public SoundFile(const char[] file, bool relativeToSound=true) { return view_as< SoundFile >( OpenSoundFile( file, relativeToSound ) ); }

    /**
    * Gets the length of the sound file in seconds
    *
    * @return                    The song length in seconds
    */
    property int Length {
        public get() { return GetSoundLength( this ); }
    }

    /**
    * Gets the length of the sound file in seconds as float.
    * Note: this probably won't work with some VBR encoded mp3's
    *
    * @return                    The song length in seconds as float
    */
    property float LengthFloat {
        public get() { return GetSoundLengthFloat( this ); }
    }

    /**
    * Get the Bit rate of sound (kbps)
    *
    * @return                    Sound bitrate (cell)
    */
    property int BitRate {
         public get() { return GetSoundBitRate( this ); }
    }

    /**
    * Get the Sampling rate of sound (hz)
    *
    * @return                    Sampling rate (cell)
    */
    property int SamplingRate {
        public get() { return GetSoundSamplingRate( this ); }
    }

    /**
    * Get the Artist of the sound
    *
    * @param buffer              Buffer to use for storing the string.
    * @param maxlength           Maximum length of the buffer.
    * @return                    Length of string written to buffer.
    */
    public int GetArtist(char[] buffer, int maxlength) { return GetSoundArtist( this, buffer, maxlength ); }

    /**
    * Get the Track title of sound
    *
    * @param buffer              Buffer to use for storing the string.
    * @param maxlength           Maximum length of the buffer.
    * @return                    Length of string written to buffer.
    */
    public int GetTitle(char[] buffer, int maxlength) { return GetSoundTitle( this, buffer, maxlength ); }

    /**
    * Get the Track number of the sound
    *
    * @return                    Sound number (cell)
    */
    property int Number {
        public get() { return GetSoundNum( this ); }
    }

    /**
    * Get the Album of the sound
    *
    * @param buffer              Buffer to use for storing the string.
    * @param maxlength           Maximum length of the buffer.
    * @return                    Length of string written to buffer.
    */
    public int GetAlbum(char[] buffer, int maxlength) { return GetSoundAlbum( this, buffer, maxlength ); }

    /**
    * Get the Year of sound
    *
    * @return                    Sound year (cell)
    */
    property int Year {
        public get() { return GetSoundYear( this ); }
    }

    /**
    * Get the Comment of the sound
    *
    * @param buffer              Buffer to use for storing the string.
    * @param maxlength           Maximum length of the buffer.
    * @return                    Length of string written to buffer.
    */
    public int GetComment(char[] buffer, int maxlength) { return GetSoundComment( this, buffer, maxlength ); }

    /**
    * Get the Genre of the sound
    *
    * @param buffer              Buffer to use for storing the string.
    * @param maxlength           Maximum length of the buffer.
    * @return                    Length of string written to buffer.
    */
    public int GetGenre(char[] buffer, int maxlength) { return GetSoundGenre( this, buffer, maxlength ); }
};
So it doesn't have to be a wrapper.
Done: https://github.com/Adrianilloo/sound...e/soundlib.inc

Thanks for your contribution.

Sample output from working methodmap based API:

Code:
sm plugins reload soundlib_demo
[SM] Plugin soundlib test reloaded successfully.
sm_soundinfo 02 CP Violation.mp3
Song Info 02 CP Violation.mp3
Sound Length: 105
Sound Length (float): 105.508575
Birate: 320
Sampling Rate: 44100
Artist: Valve
Title: CP Violation
Num 2
Album: The Soundtrack of Half-Life 2
Year: 2004
Comment: 0
Genre: Soundtrack
If you're going to test sounds from VPKs (and/or additional search paths), or just my upgraded extension in general, let me know how it goes (whether you find any issue etc.).

[+General info: I recently added support to SaySounds plugin (which uses SoundLib) with required edits to support VPK / search path reading as well, which requires my edited SoundLib: https://github.com/Gh0sty/SaysoundsHE]

Last edited by AdRiAnIlloO; 11-08-2021 at 11:20.
AdRiAnIlloO is offline
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 11-09-2021 , 05:09   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #7

Quote:
Originally Posted by AdRiAnIlloO View Post
Done: https://github.com/Adrianilloo/sound...e/soundlib.inc

Thanks for your contribution.

Sample output from working methodmap based API:

Code:
sm plugins reload soundlib_demo
[SM] Plugin soundlib test reloaded successfully.
sm_soundinfo 02 CP Violation.mp3
Song Info 02 CP Violation.mp3
Sound Length: 105
Sound Length (float): 105.508575
Birate: 320
Sampling Rate: 44100
Artist: Valve
Title: CP Violation
Num 2
Album: The Soundtrack of Half-Life 2
Year: 2004
Comment: 0
Genre: Soundtrack
If you're going to test sounds from VPKs (and/or additional search paths), or just my upgraded extension in general, let me know how it goes (whether you find any issue etc.).

[+General info: I recently added support to SaySounds plugin (which uses SoundLib) with required edits to support VPK / search path reading as well, which requires my edited SoundLib: https://github.com/Gh0sty/SaysoundsHE]
Thanks, but i meant native functions in the methodmap.
For example:
Code:
	property float LengthFloat
	{
		public native get();
	}

	property int Year
	{
		public native get();
	}
And native methods would be declared in the extension as natives.
Code:
sp_nativeinfo_t g_SoundLibraryNatives[] =
{
	{"OpenSoundFile",			OpenSoundFile},
	{"GetSoundLength",			GetSoundLength},
	{"GetSoundLengthFloat",		GetSoundLengthFloat},
	{"GetSoundBitRate",			GetSoundBitRate},
	{"GetSoundSamplingRate",	        GetSoundSamplingRate},
	{"GetSoundArtist",			GetSoundArtist},
	{"GetSoundTitle",			        GetSoundTitle},
	{"GetSoundNum",				GetSoundNum},
	{"GetSoundAlbum",			GetSoundAlbum},
	{"GetSoundYear",			        GetSoundYear},
	{"GetSoundComment",			GetSoundComment},
	{"GetSoundGenre",			GetSoundGenre},

        // native methods
        {"SoundFile.LengthFloat.get",         GetSoundLengthFloat},
        {"SoundFile.Year.get",                   GetSoundYear},
        // and for all other native methods

	{NULL,				        NULL},
};
__________________

Last edited by MAGNAT2645; 11-09-2021 at 05:11.
MAGNAT2645 is offline
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 10-21-2017 , 22:50   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #8

Dont load on windows server 2008, any way to fix?

I already installed visual 2010

Regards.

#EDIT

SOLVED

Just installed x86 version also !!

Regards.
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM

Last edited by rodrigo286; 10-22-2017 at 14:14.
rodrigo286 is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: România
Old 08-04-2018 , 15:31   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #9

instaled it but sm exts list looks like this
Code:
<FAILED> file "soundlib.ext.so": libz.so.1: cannot open shared object file: No such file or directory
This Post should be a fix, but i dont know what I'm supposted to do. Any help is welcome!
kratoss1812 is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 08-04-2018 , 15:40   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #10

Quote:
Originally Posted by kratoss1812 View Post
instaled it but sm exts list looks like this
Code:
<FAILED> file "soundlib.ext.so": libz.so.1: cannot open shared object file: No such file or directory
This Post should be a fix, but i dont know what I'm supposted to do. Any help is welcome!
You would need root access and install that library on the machine that hosts your server. It may not be possible, if you are renting a game server.
__________________
Spirit_12 is offline
Reply



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 09:22.


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