Skip to content

Commit 4bd8c03

Browse files
authored
Merge pull request #6 from simdsoft/GLenum_to_ALenum
fix typo, GLenum to ALenum
2 parents 47c0239 + bf807f8 commit 4bd8c03

File tree

4 files changed

+18
-22
lines changed

4 files changed

+18
-22
lines changed

cocos/audio/AudioEngineImpl.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ void AudioEngineImpl::setVolume(AUDIO_ID audioID,float volume)
233233

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

255255
auto error = alGetError();
256256
if (error != AL_NO_ERROR) {
257-
ALOGE("%s: audio id = %d, error = %x", __FUNCTION__,audioID,error);
257+
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x", __FUNCTION__,audioID,error);
258258
}
259259
}
260260
}
@@ -271,7 +271,7 @@ bool AudioEngineImpl::pause(AUDIO_ID audioID)
271271
auto error = alGetError();
272272
if (error != AL_NO_ERROR) {
273273
ret = false;
274-
ALOGE("%s: audio id = %d, error = %x\n", __FUNCTION__,audioID,error);
274+
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x\n", __FUNCTION__,audioID,error);
275275
}
276276

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

291291
return ret;
@@ -342,7 +342,7 @@ float AudioEngineImpl::getCurrentTime(AUDIO_ID audioID)
342342

343343
auto error = alGetError();
344344
if (error != AL_NO_ERROR) {
345-
ALOGE("%s, audio id:%d,error code:%x", __FUNCTION__,audioID,error);
345+
ALOGE("%s, audio id:" AUDIO_ID_PRID ",error code:%x", __FUNCTION__,audioID,error);
346346
}
347347
}
348348
}
@@ -367,15 +367,15 @@ bool AudioEngineImpl::setCurrentTime(AUDIO_ID audioID, float time)
367367
else {
368368
if (player->_audioCache->_framesRead != player->_audioCache->_totalFrames &&
369369
(time * player->_audioCache->_sampleRate) > player->_audioCache->_framesRead) {
370-
ALOGE("%s: audio id = %d", __FUNCTION__,audioID);
370+
ALOGE("%s: audio id = " AUDIO_ID_PRID, __FUNCTION__,audioID);
371371
break;
372372
}
373373

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

376376
auto error = alGetError();
377377
if (error != AL_NO_ERROR) {
378-
ALOGE("%s: audio id = %d, error = %x", __FUNCTION__,audioID,error);
378+
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x", __FUNCTION__,audioID,error);
379379
}
380380
ret = true;
381381
}

cocos/audio/apple/AudioEngineImpl.mm

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *bids)
503503

504504
auto error = alGetError();
505505
if (error != AL_NO_ERROR) {
506-
ALOGE("%s: audio id = %zu, error = %x", __PRETTY_FUNCTION__,audioID,error);
506+
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x", __PRETTY_FUNCTION__,audioID,error);
507507
}
508508
}
509509
}
@@ -531,7 +531,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *bids)
531531

532532
auto error = alGetError();
533533
if (error != AL_NO_ERROR) {
534-
ALOGE("%s: audio id = %zu, error = %x", __PRETTY_FUNCTION__,audioID,error);
534+
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x", __PRETTY_FUNCTION__,audioID,error);
535535
}
536536
}
537537
}
@@ -557,7 +557,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *bids)
557557
auto error = alGetError();
558558
if (error != AL_NO_ERROR) {
559559
ret = false;
560-
ALOGE("%s: audio id = %zu, error = %x", __PRETTY_FUNCTION__,audioID,error);
560+
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x", __PRETTY_FUNCTION__,audioID,error);
561561
}
562562

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

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

635635
auto error = alGetError();
636636
if (error != AL_NO_ERROR) {
637-
ALOGE("%s, audio id:%zu,error code:%x", __PRETTY_FUNCTION__,audioID,error);
637+
ALOGE("%s, audio id:" AUDIO_ID_PRID ",error code:%x", __PRETTY_FUNCTION__,audioID,error);
638638
}
639639
}
640640
}
@@ -659,15 +659,15 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *bids)
659659
else {
660660
if (player->_audioCache->_framesRead != player->_audioCache->_totalFrames &&
661661
(time * player->_audioCache->_sampleRate) > player->_audioCache->_framesRead) {
662-
ALOGE("%s: audio id = %zu", __PRETTY_FUNCTION__,audioID);
662+
ALOGE("%s: audio id = " AUDIO_ID_PRID, __PRETTY_FUNCTION__,audioID);
663663
break;
664664
}
665665

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

668668
auto error = alGetError();
669669
if (error != AL_NO_ERROR) {
670-
ALOGE("%s: audio id = %zu, error = %x", __PRETTY_FUNCTION__,audioID,error);
670+
ALOGE("%s: audio id = " AUDIO_ID_PRID ", error = %x", __PRETTY_FUNCTION__,audioID,error);
671671
}
672672
ret = true;
673673
}
@@ -716,7 +716,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *bids)
716716
std::string filePath;
717717
if (player->_finishCallbak) {
718718
auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID];
719-
filePath = *audioInfo.filePath;
719+
filePath = audioInfo.filePath;
720720
}
721721

722722
AudioEngine::remove(audioID);

cocos/audio/include/AudioEngine.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include "platform/CCPlatformConfig.h"
2929
#include "platform/CCPlatformMacros.h"
30+
#include "audio/include/AudioMacros.h"
3031
#include "audio/include/Export.h"
3132
#include <functional>
3233
#include <list>
@@ -37,10 +38,6 @@
3738
#undef ERROR
3839
#endif // ERROR
3940

40-
#if !defined(AUDIO_ID)
41-
#define AUDIO_ID int
42-
#endif
43-
4441
/**
4542
* @addtogroup audio
4643
* @{

cocos/audio/include/AudioMacros.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
#if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG > 0
6363
#define CHECK_AL_ERROR_DEBUG() \
6464
do { \
65-
GLenum __error = alGetError(); \
65+
ALenum __error = alGetError(); \
6666
if (__error) { \
6767
ALOGE("OpenAL error 0x%04X in %s %s %d\n", __error, __FILE__, __FUNCTION__, __LINE__); \
6868
} \
@@ -82,6 +82,5 @@ do { \
8282
break; \
8383
}
8484

85-
#if !defined(AUDIO_ID)
8685
#define AUDIO_ID int
87-
#endif
86+
#define AUDIO_ID_PRID "%d"

0 commit comments

Comments
 (0)