diff --git a/CMakeLists.txt b/CMakeLists.txt index 62d531f5..de98fbe6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.12) project(libmodplug) -set(VERSION "0.8.9.1") +set(VERSION "0.8.10.0") option(BUILD_SHARED_LIBS "Build Shared Library (DLL)" OFF) diff --git a/configure.ac b/configure.ac index c51a591f..57bd9fe4 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.63]) -AC_INIT([libmodplug],[0.8.9.1]) +AC_INIT([libmodplug],[0.8.10.0]) AC_CONFIG_SRCDIR([Makefile.am]) AM_INIT_AUTOMAKE diff --git a/src/modplug.cpp b/src/modplug.cpp index bb4ab627..73490fa6 100644 --- a/src/modplug.cpp +++ b/src/modplug.cpp @@ -81,6 +81,11 @@ namespace ModPlug } } +long ModPlug_GetVersion(void) +{ + return LIBMODPLUG_VERSION; +} + ModPlugFile* ModPlug_Load(const void* data, int size) { ModPlugFile* result = new ModPlugFile; @@ -265,6 +270,21 @@ void ModPlug_Seek(ModPlugFile* file, int millisecond) file->mSoundFile.SetCurrentPos((int)(millisecond * postime)); } +int ModPlug_Tell(ModPlugFile *file) +{ + int currentPos = (int)file->mSoundFile.GetCurrentPos(); + int maxpos; + int maxtime = (int)file->mSoundFile.GetSongTime() * 1000; + float postime; + maxpos = (int)file->mSoundFile.GetMaxPosition(); + postime = 0.0f; + if (maxtime != 0.0f) + postime = (float)maxpos / (float)maxtime; + if (postime == 0.0f) + return 0; + return (int) ((float)currentPos / postime); +} + void ModPlug_GetSettings(ModPlug_Settings* settings) { memcpy(settings, &ModPlug::gSettings, sizeof(ModPlug_Settings)); diff --git a/src/modplug.h b/src/modplug.h index f7f78b7c..a525c091 100644 --- a/src/modplug.h +++ b/src/modplug.h @@ -11,6 +11,16 @@ extern "C" { #endif +#define LIBMODPLUG_MAJOR 0L +#define LIBMODPLUG_MINOR 8L +#define LIBMODPLUG_REVISION 10L +#define LIBMODPLUG_PATCH 0L +#define LIBMODPLUG_VERSION \ + ((LIBMODPLUG_MAJOR <<24) | \ + (LIBMODPLUG_MINOR <<16) | \ + (LIBMODPLUG_REVISION<< 8) | \ + (LIBMODPLUG_PATCH)) + #if defined(_WIN32) || defined(__CYGWIN__) # if defined(MODPLUG_BUILD) && defined(DLL_EXPORT) /* building libmodplug as a dll for windows */ # define MODPLUG_EXPORT __declspec(dllexport) @@ -25,6 +35,8 @@ extern "C" { #define MODPLUG_EXPORT #endif +MODPLUG_EXPORT long ModPlug_GetVersion(void); + struct _ModPlugFile; typedef struct _ModPlugFile ModPlugFile; @@ -67,6 +79,9 @@ MODPLUG_EXPORT int ModPlug_GetLength(ModPlugFile* file); * ModPlug_GetLength() does not report the full length. */ MODPLUG_EXPORT void ModPlug_Seek(ModPlugFile* file, int millisecond); +/* Get the absolute playing position in song, in milliseconds. */ +MODPLUG_EXPORT int ModPlug_Tell(ModPlugFile* file); + enum _ModPlug_Flags { MODPLUG_ENABLE_OVERSAMPLING = 1 << 0, /* Enable oversampling (*highly* recommended) */