• У форума будет новый домен? Да, мы далеко уже не только игровой форум Подробнее...
Иконка ресурса

Sound Info Library 1.0.1

Нет прав для скачивания
Поскольку внутренняя функциональность движков исходного кода для расчета длины звукового файла не ра
Исходный код на Github: bcserv/soundlib - Форки и запросы на тягу приветствуются

Licenses:
GPL, LGPL, MPL

Поскольку внутренняя функциональность движков исходного кода для расчета длины звукового файла не работает, я решил написать собственное расширение, которое обрабатывает вычисления. Я потратил много времени на это.
Я выпустил расширение, которое может считывать различную информацию из mp3-файлов или файлов в целом, которые имеют тэг id3 помимо длины звука.

Заметка: в некоторых случаях он, вероятно, не может прочитать точные mp3 в кодировке VBR.

Если библиотека не загружается в Windows, установите это:
Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)
Microsoft Visual C++ 2010 SP1 Redistributable Package (x64)

Если написано «libz.so.1: невозможно открыть общий объектный файл: такой файл или каталог отсутствуют», прочитайте эту позициюt:

ia32-libs - это метапакет. В Debian и более старых версиях Ubuntu «зависимости» ia32-libs - это всего лишь 10 или около того наиболее распространенных библиотек, для которых людям нужны 32-битные версии.

В более новых версиях Ubuntu ia32-libs является синонимом ia32-libs-multiarch, что представляет собой полный беспорядок и заставляет меня задуматься, почему разработчики Ubuntu думают, что они делают.

Я не думаю, что стабильный (squeeze) Debian сделал это, но Ubuntu перешел на многоархивную версию apt, в которой вы можете указать

Bash:
apt-get install package-name:i386
to get the 32-bit version of it.

So...

Bash:
apt-get install libz1:i386
Вероятно, lib32z1 - это просто оболочка для вышеперечисленного, если вы используете Ubuntu.

Вот список вещей, которые он может прочитать:

  • sound length
  • bit rate
  • sampling rate
  • Artist (Id3)
  • Title (Id3)
  • Sound Num (Id3)
  • Year (Id3)
  • Album (Id3)
  • Commend (Id3)
  • Genre (Id3)
Я думаю, что это очень полезно для таких плагинов, как sayounds
smile.gif
Enjoy

Example code

C#:
    new Handle:soundfile = OpenSoundFile("funnysounds/myfunnysound.mp3");
    
    if (soundfile == INVALID_HANDLE) {
        PrintToServer("Invalid handle !");
        return Plugin_Handled;
    }

    PrintToServer("Sound Length: %f seconds", GetSoundLengthFloat(soundfile));

    CloseHandle(soundFile);


Список функций:

C++:
/**
 * 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, INVALID_HANDLE on open error.
 */
native Handle:OpenSoundFile(const String:file[], bool:relativeToSound=true);

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

/**
 * Gets the length of the sound file in seconds as float.
 * Note: this probably won't work with some VBR encoded mp3's
 *
 * @param hndl            Handle to the sound file.
 * @return                The song length in seconds as float
 */
native Float:GetSoundLengthFloat(Handle:hndl);

/**
 * Get the Bit rate of sound (kbps)
 *
 * @param hndl            Handle to the sound file
 * @return                sound bitrate (cell)
 */
native GetSoundBitRate(Handle:hndl);

/**
 * Get the Sampling rate of sound (hz)
 *
 * @param hndl            Handle to the sound file
 * @return                sampling rate (cell)
 */
native GetSoundSamplingRate(Handle:hndl);

/**
 * Get the Artist of the 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 GetSoundArtist(Handle:hndl, String:buffer[], maxlength);

/**
 * Get the Track title of  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 GetSoundTitle(Handle:hndl, String:buffer[], maxlength);

/**
 * Get the Track number of the sound
 *
 * @param hndl            Handle to the sound file
 * @return                sound number (cell)
 */
native GetSoundNum(Handle:hndl);

/**
 * Get the Album of the 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 GetSoundAlbum(Handle:hndl, String:buffer[], maxlength);

/**
 * Get the Year of  sound
 *
 * @param hndl            Handle to the sound file
 * @return                sound year (cell)
 */
native GetSoundYear(Handle:hndl);

/**
 * Get the Comment of the 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 GetSoundComment(Handle:hndl, String:buffer[], maxlength);

/**
 * Get the Genre of the 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 GetSoundGenre(Handle:hndl, String:buffer[], maxlength);

Это расширение использует Taglib библиотека, Я скомпилировал статические библиотеки для Windows и Linux.
The Taglib is under the GNU Lesser General Public License (LGPL) and the Mozilla Public License (MPL).
  • Мне нравится
Реакции: hirowatch
Автор
Cubix
Скачивания
1
Просмотры
210
Первый выпуск
Обновление
Оценка
0.00 звёзд 0 оценок

Другие ресурсы пользователя Cubix

Сверху