| 190 | } |
| 191 | |
| 192 | static int GetSampleRate() |
| 193 | { |
| 194 | dmAndroid::ThreadAttacher thread; |
| 195 | JNIEnv* env = thread.GetEnv(); |
| 196 | if (env == 0) |
| 197 | { |
| 198 | return 44100; |
| 199 | } |
| 200 | |
| 201 | jclass sound_class = dmAndroid::LoadClass(env, "com.defold.sound.Sound"); |
| 202 | |
| 203 | jmethodID get_sample_rate = env->GetStaticMethodID(sound_class, "getSampleRate", "(Landroid/content/Context;I)I"); |
| 204 | assert(get_sample_rate); |
| 205 | jint sample_rate = env->CallStaticIntMethod(sound_class, get_sample_rate, thread.GetActivity()->clazz, 44100); |
| 206 | |
| 207 | env->DeleteLocalRef(sound_class); |
| 208 | |
| 209 | return (int)sample_rate; |
| 210 | } |
| 211 | |
| 212 | dmSound::Result DeviceOpenSLOpen(const dmSound::OpenDeviceParams* params, dmSound::HDevice* device) |
| 213 | { |
no test coverage detected