Quote:
Originally Posted by AdRiAnIlloO
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.
__________________