mirror of https://github.com/axmolengine/axmol.git
Delete unused code
This commit is contained in:
parent
93f549a0ad
commit
893134c79d
|
@ -122,37 +122,7 @@ public class Cocos2dxHelper {
|
|||
|
||||
PackageManager pm = activity.getPackageManager();
|
||||
boolean isSupportLowLatency = pm.hasSystemFeature(PackageManager.FEATURE_AUDIO_LOW_LATENCY);
|
||||
|
||||
Log.d(TAG, "isSupportLowLatency:" + isSupportLowLatency);
|
||||
|
||||
int sampleRate = 44100;
|
||||
int bufferSizeInFrames = 192;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 17) {
|
||||
AudioManager am = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
|
||||
// use reflection to remove dependence of API 17 when compiling
|
||||
|
||||
// AudioManager.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE);
|
||||
final Class audioManagerClass = AudioManager.class;
|
||||
Object[] parameters = new Object[]{Cocos2dxReflectionHelper.<String>getConstantValue(audioManagerClass, "PROPERTY_OUTPUT_SAMPLE_RATE")};
|
||||
final String strSampleRate = Cocos2dxReflectionHelper.<String>invokeInstanceMethod(am, "getProperty", new Class[]{String.class}, parameters);
|
||||
|
||||
// AudioManager.getProperty(AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER);
|
||||
parameters = new Object[]{Cocos2dxReflectionHelper.<String>getConstantValue(audioManagerClass, "PROPERTY_OUTPUT_FRAMES_PER_BUFFER")};
|
||||
final String strBufferSizeInFrames = Cocos2dxReflectionHelper.<String>invokeInstanceMethod(am, "getProperty", new Class[]{String.class}, parameters);
|
||||
|
||||
try {
|
||||
sampleRate = Integer.parseInt(strSampleRate);
|
||||
bufferSizeInFrames = Integer.parseInt(strBufferSizeInFrames);
|
||||
} catch (NumberFormatException e) {
|
||||
Log.e(TAG, "parseInt failed", e);
|
||||
}
|
||||
Log.d(TAG, "sampleRate: " + sampleRate + ", framesPerBuffer: " + bufferSizeInFrames);
|
||||
} else {
|
||||
Log.d(TAG, "android version is lower than 17");
|
||||
}
|
||||
|
||||
nativeSetAudioDeviceInfo(isSupportLowLatency, sampleRate, bufferSizeInFrames);
|
||||
Log.d(TAG, String.format("android version is %d, isSupportLowLatency: %s", Build.VERSION.SDK_INT, isSupportLowLatency ? "true" : "false") );
|
||||
|
||||
final ApplicationInfo applicationInfo = activity.getApplicationInfo();
|
||||
|
||||
|
|
|
@ -42,9 +42,6 @@ static const char* className = "org.cocos2dx.lib.Cocos2dxHelper";
|
|||
static EditTextCallback s_editTextCallback = nullptr;
|
||||
static void* s_ctx = nullptr;
|
||||
|
||||
static int __deviceSampleRate = 44100;
|
||||
static int __deviceAudioBufferSizeInFrames = 192;
|
||||
|
||||
static std::string g_apkPath;
|
||||
|
||||
using namespace cocos2d;
|
||||
|
@ -61,18 +58,6 @@ JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetContext(JNI
|
|||
FileUtilsAndroid::setassetmanager(AAssetManager_fromJava(env, assetManager));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetAudioDeviceInfo(JNIEnv*,
|
||||
jclass,
|
||||
jboolean isSupportLowLatency,
|
||||
jint deviceSampleRate,
|
||||
jint deviceAudioBufferSizeInFrames)
|
||||
{
|
||||
__deviceSampleRate = deviceSampleRate;
|
||||
__deviceAudioBufferSizeInFrames = deviceAudioBufferSizeInFrames;
|
||||
LOGD("nativeSetAudioDeviceInfo: sampleRate: %d, bufferSizeInFrames: %d", __deviceSampleRate,
|
||||
__deviceAudioBufferSizeInFrames);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetEditTextDialogResult(JNIEnv* env,
|
||||
jclass,
|
||||
jbyteArray text)
|
||||
|
@ -166,16 +151,6 @@ int getObbAssetFileDescriptorJNI(const char* path, int64_t* startOffset, int64_t
|
|||
return fd;
|
||||
}
|
||||
|
||||
int getDeviceSampleRate()
|
||||
{
|
||||
return __deviceSampleRate;
|
||||
}
|
||||
|
||||
int getDeviceAudioBufferSizeInFrames()
|
||||
{
|
||||
return __deviceAudioBufferSizeInFrames;
|
||||
}
|
||||
|
||||
void conversionEncodingJNI(const char* src, int byteSize, const char* fromCharset, char* dst, const char* newCharset)
|
||||
{
|
||||
JniMethodInfo methodInfo;
|
||||
|
|
|
@ -38,8 +38,4 @@ extern void conversionEncodingJNI(const char* src,
|
|||
const char* fromCharset,
|
||||
char* dst,
|
||||
const char* newCharset);
|
||||
|
||||
extern int getDeviceSampleRate();
|
||||
extern int getDeviceAudioBufferSizeInFrames();
|
||||
|
||||
#endif /* __Java_org_cocos2dx_lib_Cocos2dxHelper_H__ */
|
||||
|
|
Loading…
Reference in New Issue