From 4f0a264146d1a42c86cde7e40382447c681685f3 Mon Sep 17 00:00:00 2001 From: "jean.chalard" Date: Tue, 2 Feb 2010 09:11:44 +0000 Subject: [PATCH] J : * Add a method to abstract the file size. --- JGE/include/JSoundSystem.h | 1 + JGE/src/JSfx.cpp | 5 +++++ JGE/src/pc/JSfx.cpp | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/JGE/include/JSoundSystem.h b/JGE/include/JSoundSystem.h index 0a44525ef..7dd8e33d5 100644 --- a/JGE/include/JSoundSystem.h +++ b/JGE/include/JSoundSystem.h @@ -74,6 +74,7 @@ class JSample int mVoice; + unsigned long fileSize(); #if defined (WIN32) || defined (LINUX) #ifdef WITH_FMOD FSOUND_SAMPLE *mSample; diff --git a/JGE/src/JSfx.cpp b/JGE/src/JSfx.cpp index 7df04b5b6..35e06c398 100644 --- a/JGE/src/JSfx.cpp +++ b/JGE/src/JSfx.cpp @@ -48,6 +48,11 @@ JSample::~JSample() releaseWaveData(mSample); } +unsigned long JSample;:fileSize() +{ + return mSample->fileSize; +} + JSoundSystem* JSoundSystem::mInstance = NULL; JSoundSystem* JSoundSystem::GetInstance() diff --git a/JGE/src/pc/JSfx.cpp b/JGE/src/pc/JSfx.cpp index ebad5a109..4bb474e1f 100644 --- a/JGE/src/pc/JSfx.cpp +++ b/JGE/src/pc/JSfx.cpp @@ -58,6 +58,14 @@ JSample::~JSample() #endif } +unsigned long JSample::fileSize() +{ +#ifdef WITH_FMOD + return FSOUND_Sample_GetLength(mSample); +#else + return 0; +#endif +} ////////////////////////////////////////////////////////////////////////// JSoundSystem* JSoundSystem::mInstance = NULL;