Raised This Month: $12 Target: $400
 3% 

[EXTENSION] Sound Info Library v1.0.1


Post New Thread Reply   
 
Thread Tools Display Modes
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 08-05-2018 , 08:17   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #91

You need, at least, the 32-bit version of libz. You can ask the server host/owner to install it.

There may be other missing 32-bit libraries. If you have shell access, you can run ldd on the extension to see.

Last edited by Fyren; 08-05-2018 at 08:18.
Fyren is offline
blaisefps
Junior Member
Join Date: Dec 2019
Old 01-28-2020 , 21:17   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #92

[18] <FAILED> file "soundlib.ext.so": libz.so.1: cannot open shared object file: No such file or directory


help? pls
blaisefps 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 #93

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 #94

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 #95

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 #96

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
AdRiAnIlloO
Member
Join Date: Jul 2015
Location: Spain
Old 11-14-2021 , 18:56   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #97

Alright,

Updated the extension again with the native connection of methodmap instead.

I didn't understand you at first and ended up thinking the wrong idea as I wasn't used to that kind of task.

Last edited by AdRiAnIlloO; 11-25-2021 at 12:13.
AdRiAnIlloO is offline
OneMore
Senior Member
Join Date: Feb 2019
Old 10-15-2022 , 21:22   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #98

May I ask you to upload here the already compiled extension for Linux?
Unfortunately, I don't have access to the server command line to compile...
OneMore is offline
AdRiAnIlloO
Member
Join Date: Jul 2015
Location: Spain
Old 10-17-2022 , 04:08   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #99

Releases are here in the ZIP present, both for Linux and Windows: https://github.com/Adrianilloo/soundlib/releases

Last edited by AdRiAnIlloO; 10-17-2022 at 04:09.
AdRiAnIlloO is offline
Alienmario
Senior Member
Join Date: Aug 2013
Old 01-14-2024 , 16:09   Re: [EXTENSION] Sound Info Library v1.0.1
Reply With Quote #100

Quote:
Originally Posted by AdRiAnIlloO View Post
Releases are here in the ZIP present, both for Linux and Windows: https://github.com/Adrianilloo/soundlib/releases
Hi, Couldn't open an issue so posting here.

I'm using this extension on both existent and nonexistent sound files. This works as expected.
However on linux there are errors being spammed in console:
Code:
Tried to Seek NULL file handle!
FS:  Tried to Read NULL file handle!
Could this be hidden?
Alienmario 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 14:31.


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