fun loadSoundEffects(): Boolean { var attempts = 3 val reply = LoadSoundEffectReply() synchronized(reply) { sendMsg(mAudioHandler, MSG_LOAD_SOUND_EFFECTS, SENDMSG_QUEUE, 0, 0, reply, 0) while (reply.mStatus === 1 && attempts-- > 0) { try { reply.wait(SOUND_EFECTS_LOAD_TIMEOUT_MS) } catch (e: InterruptedException) { Log.w(TAG, "loadSoundEffects Interrupted while waiting sound pool loaded.") } } } return reply.mStatus === 0 }
Loads samples into the soundpool . This method must be called at first when sound effects are enabled