issue #1683: Using full path in CocosDenshion API.

This commit is contained in:
James Chen 2013-01-27 21:10:53 +08:00
parent f2dad83610
commit fa7175f6f7
1 changed files with 20 additions and 8 deletions

View File

@ -24,6 +24,8 @@ THE SOFTWARE.
#include "SimpleAudioEngine.h" #include "SimpleAudioEngine.h"
#include "SimpleAudioEngine_objc.h" #include "SimpleAudioEngine_objc.h"
#include "cocos2d.h"
USING_NS_CC;
static void static_end() static void static_end()
{ {
@ -174,12 +176,16 @@ void SimpleAudioEngine::end()
void SimpleAudioEngine::preloadBackgroundMusic(const char* pszFilePath) void SimpleAudioEngine::preloadBackgroundMusic(const char* pszFilePath)
{ {
static_preloadBackgroundMusic(pszFilePath); // Changing file path to full path
std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath);
static_preloadBackgroundMusic(fullPath.c_str());
} }
void SimpleAudioEngine::playBackgroundMusic(const char* pszFilePath, bool bLoop) void SimpleAudioEngine::playBackgroundMusic(const char* pszFilePath, bool bLoop)
{ {
static_playBackgroundMusic(pszFilePath, bLoop); // Changing file path to full path
std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath);
static_playBackgroundMusic(fullPath.c_str(), bLoop);
} }
void SimpleAudioEngine::stopBackgroundMusic(bool bReleaseData) void SimpleAudioEngine::stopBackgroundMusic(bool bReleaseData)
@ -224,32 +230,38 @@ void SimpleAudioEngine::setBackgroundMusicVolume(float volume)
float SimpleAudioEngine::getEffectsVolume() float SimpleAudioEngine::getEffectsVolume()
{ {
return static_getEffectsVolume(); return static_getEffectsVolume();
} }
void SimpleAudioEngine::setEffectsVolume(float volume) void SimpleAudioEngine::setEffectsVolume(float volume)
{ {
static_setEffectsVolume(volume); static_setEffectsVolume(volume);
} }
unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop) unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop)
{ {
return static_playEffect(pszFilePath, bLoop); // Changing file path to full path
std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath);
return static_playEffect(fullPath.c_str(), bLoop);
} }
void SimpleAudioEngine::stopEffect(unsigned int nSoundId) void SimpleAudioEngine::stopEffect(unsigned int nSoundId)
{ {
static_stopEffect(nSoundId); static_stopEffect(nSoundId);
} }
void SimpleAudioEngine::preloadEffect(const char* pszFilePath) void SimpleAudioEngine::preloadEffect(const char* pszFilePath)
{ {
static_preloadEffect(pszFilePath); // Changing file path to full path
std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath);
static_preloadEffect(fullPath.c_str());
} }
void SimpleAudioEngine::unloadEffect(const char* pszFilePath) void SimpleAudioEngine::unloadEffect(const char* pszFilePath)
{ {
static_unloadEffect(pszFilePath); // Changing file path to full path
std::string fullPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(pszFilePath);
static_unloadEffect(fullPath.c_str());
} }
void SimpleAudioEngine::pauseEffect(unsigned int uSoundId) void SimpleAudioEngine::pauseEffect(unsigned int uSoundId)