Merge pull request #1462 from wenbin1989/gles20

fix getDeviceModel bug in android CocosDenshion
This commit is contained in:
minggo 2012-10-16 18:32:13 -07:00
commit 0cca1cb023
2 changed files with 7 additions and 6 deletions

View File

@ -155,16 +155,17 @@ SimpleAudioEngine::SimpleAudioEngine()
methodInfo.env->DeleteLocalRef(methodInfo.classID); methodInfo.env->DeleteLocalRef(methodInfo.classID);
const char* deviceModel = methodInfo.env->GetStringUTFChars(jstr, NULL); const char* deviceModel = methodInfo.env->GetStringUTFChars(jstr, NULL);
methodInfo.env->ReleaseStringUTFChars(jstr, deviceModel);
methodInfo.env->DeleteLocalRef(jstr);
LOGD(deviceModel); LOGD(deviceModel);
if (strcmp(I9100_MODEL, deviceModel) == 0) if (strcmp(I9100_MODEL, deviceModel) == 0)
{ {
LOGD("i9100 model\nSwitch to OpenSLES"); LOGD("i9100 model\nSwitch to OpenSLES");
s_bI9100 = true; s_bI9100 = true;
} }
methodInfo.env->ReleaseStringUTFChars(jstr, deviceModel);
methodInfo.env->DeleteLocalRef(jstr);
} }
SimpleAudioEngine::~SimpleAudioEngine() SimpleAudioEngine::~SimpleAudioEngine()

View File

@ -18,7 +18,7 @@ OpenSLEngine::~OpenSLEngine()
/********************************************************************************** /**********************************************************************************
* jni * jni
**********************************************************************************/ **********************************************************************************/
#define CLASS_NAME "org/cocos2dx/lib/Cocos2dxActivity" #define CLASS_NAME "org/cocos2dx/lib/Cocos2dxHelper"
typedef struct JniMethodInfo_ typedef struct JniMethodInfo_
{ {
@ -672,4 +672,4 @@ float OpenSLEngine::getEffectsVolume()
{ {
float volume = (m_effectVolume - MIN_VOLUME_MILLIBEL) / (1.0f * RANGE_VOLUME_MILLIBEL); float volume = (m_effectVolume - MIN_VOLUME_MILLIBEL) / (1.0f * RANGE_VOLUME_MILLIBEL);
return volume; return volume;
} }