Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions cocos/audio/AudioEngineImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void AudioEngineImpl::setVolume(AUDIO_ID audioID,float volume)

auto error = alGetError();
if (error != AL_NO_ERROR) {
ALOGE("%s: audio id = %d, error = %x", __FUNCTION__,audioID,error);
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x", __FUNCTION__,audioID,error);
}
}
}
Expand All @@ -254,7 +254,7 @@ void AudioEngineImpl::setLoop(AUDIO_ID audioID, bool loop)

auto error = alGetError();
if (error != AL_NO_ERROR) {
ALOGE("%s: audio id = %d, error = %x", __FUNCTION__,audioID,error);
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x", __FUNCTION__,audioID,error);
}
}
}
Expand All @@ -271,7 +271,7 @@ bool AudioEngineImpl::pause(AUDIO_ID audioID)
auto error = alGetError();
if (error != AL_NO_ERROR) {
ret = false;
ALOGE("%s: audio id = %d, error = %x\n", __FUNCTION__,audioID,error);
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x\n", __FUNCTION__,audioID,error);
}

return ret;
Expand All @@ -285,7 +285,7 @@ bool AudioEngineImpl::resume(AUDIO_ID audioID)
auto error = alGetError();
if (error != AL_NO_ERROR) {
ret = false;
ALOGE("%s: audio id = %d, error = %x\n", __FUNCTION__,audioID,error);
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x\n", __FUNCTION__,audioID,error);
}

return ret;
Expand Down Expand Up @@ -342,7 +342,7 @@ float AudioEngineImpl::getCurrentTime(AUDIO_ID audioID)

auto error = alGetError();
if (error != AL_NO_ERROR) {
ALOGE("%s, audio id:%d,error code:%x", __FUNCTION__,audioID,error);
ALOGE("%s, audio id:" AUDIO_ID_PRID ",error code:%x", __FUNCTION__,audioID,error);
}
}
}
Expand All @@ -367,15 +367,15 @@ bool AudioEngineImpl::setCurrentTime(AUDIO_ID audioID, float time)
else {
if (player->_audioCache->_framesRead != player->_audioCache->_totalFrames &&
(time * player->_audioCache->_sampleRate) > player->_audioCache->_framesRead) {
ALOGE("%s: audio id = %d", __FUNCTION__,audioID);
ALOGE("%s: audio id = " AUDIO_ID_PRID, __FUNCTION__,audioID);
break;
}

alSourcef(player->_alSource, AL_SEC_OFFSET, time);

auto error = alGetError();
if (error != AL_NO_ERROR) {
ALOGE("%s: audio id = %d, error = %x", __FUNCTION__,audioID,error);
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x", __FUNCTION__,audioID,error);
}
ret = true;
}
Expand Down
16 changes: 8 additions & 8 deletions cocos/audio/apple/AudioEngineImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *bids)

auto error = alGetError();
if (error != AL_NO_ERROR) {
ALOGE("%s: audio id = %zu, error = %x", __PRETTY_FUNCTION__,audioID,error);
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x", __PRETTY_FUNCTION__,audioID,error);
}
}
}
Expand Down Expand Up @@ -531,7 +531,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *bids)

auto error = alGetError();
if (error != AL_NO_ERROR) {
ALOGE("%s: audio id = %zu, error = %x", __PRETTY_FUNCTION__,audioID,error);
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x", __PRETTY_FUNCTION__,audioID,error);
}
}
}
Expand All @@ -557,7 +557,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *bids)
auto error = alGetError();
if (error != AL_NO_ERROR) {
ret = false;
ALOGE("%s: audio id = %zu, error = %x", __PRETTY_FUNCTION__,audioID,error);
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x", __PRETTY_FUNCTION__,audioID,error);
}

return ret;
Expand All @@ -579,7 +579,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *bids)
auto error = alGetError();
if (error != AL_NO_ERROR) {
ret = false;
ALOGE("%s: audio id = %zu, error = %x", __PRETTY_FUNCTION__,audioID,error);
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x", __PRETTY_FUNCTION__,audioID,error);
}

return ret;
Expand Down Expand Up @@ -634,7 +634,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *bids)

auto error = alGetError();
if (error != AL_NO_ERROR) {
ALOGE("%s, audio id:%zu,error code:%x", __PRETTY_FUNCTION__,audioID,error);
ALOGE("%s, audio id:" AUDIO_ID_PRID ",error code:%x", __PRETTY_FUNCTION__,audioID,error);
}
}
}
Expand All @@ -659,15 +659,15 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *bids)
else {
if (player->_audioCache->_framesRead != player->_audioCache->_totalFrames &&
(time * player->_audioCache->_sampleRate) > player->_audioCache->_framesRead) {
ALOGE("%s: audio id = %zu", __PRETTY_FUNCTION__,audioID);
ALOGE("%s: audio id = " AUDIO_ID_PRID, __PRETTY_FUNCTION__,audioID);
break;
}

alSourcef(player->_alSource, AL_SEC_OFFSET, time);

auto error = alGetError();
if (error != AL_NO_ERROR) {
ALOGE("%s: audio id = %zu, error = %x", __PRETTY_FUNCTION__,audioID,error);
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x", __PRETTY_FUNCTION__,audioID,error);
}
ret = true;
}
Expand Down Expand Up @@ -716,7 +716,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *bids)
std::string filePath;
if (player->_finishCallbak) {
auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID];
filePath = *audioInfo.filePath;
filePath = audioInfo.filePath;
}

AudioEngine::remove(audioID);
Expand Down
5 changes: 1 addition & 4 deletions cocos/audio/include/AudioEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include "platform/CCPlatformConfig.h"
#include "platform/CCPlatformMacros.h"
#include "audio/include/AudioMacros.h"
#include "audio/include/Export.h"
#include <functional>
#include <list>
Expand All @@ -37,10 +38,6 @@
#undef ERROR
#endif // ERROR

#if !defined(AUDIO_ID)
#define AUDIO_ID int
#endif

/**
* @addtogroup audio
* @{
Expand Down
5 changes: 2 additions & 3 deletions cocos/audio/include/AudioMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG > 0
#define CHECK_AL_ERROR_DEBUG() \
do { \
GLenum __error = alGetError(); \
ALenum __error = alGetError(); \
if (__error) { \
ALOGE("OpenAL error 0x%04X in %s %s %d\n", __error, __FILE__, __FUNCTION__, __LINE__); \
} \
Expand All @@ -82,6 +82,5 @@ do { \
break; \
}

#if !defined(AUDIO_ID)
#define AUDIO_ID int
#endif
#define AUDIO_ID_PRID "%d"