bool MCSystemPlaySound(const char *p_file, bool p_looping) { //MCLog("MCSystemPlaySound(%s, %s)", p_file, p_looping?"true":"false"); bool t_success; if (s_sound_file != nil) { MCCStringFree(s_sound_file); s_sound_file = nil; } s_sound_file = MCS_resolvepath(p_file); const char *t_apk_file = nil; if (path_to_apk_path(s_sound_file, t_apk_file)) MCAndroidEngineCall("playSound", "bsbb", &t_success, t_apk_file, true, p_looping); else MCAndroidEngineCall("playSound", "bsbb", &t_success, s_sound_file, false, p_looping); if (!t_success) { MCCStringFree(s_sound_file); s_sound_file = nil; } return t_success; }
bool MCSystemPlaySoundOnChannel(const char *p_channel, const char *p_file, MCSoundChannelPlayType p_type, MCObjectHandle *p_object) { bool t_success; t_success = true; const char *t_apk_file = nil;; if (t_success) if (path_to_apk_path(p_file, t_apk_file)) MCAndroidEngineRemoteCall("playSoundOnChannel", "bsssibj", &t_success, p_channel, t_apk_file, p_file, (int32_t) p_type, true, (long) p_object); else MCAndroidEngineRemoteCall("playSoundOnChannel", "bsssibj", &t_success, p_channel, p_file, p_file, (int32_t) p_type, false, (long) p_object); return t_success; }
MCSystemFileHandle *MCAndroidSystem::OpenFile(const char *p_path, uint32_t p_mode, bool p_map) { static const char *s_modes[] = { "r", "w", "r+", "a" }; const char *t_apk_path = nil; if (path_to_apk_path(p_path, t_apk_path)) return MCAssetFileHandle::Open(t_apk_path, s_modes[p_mode & 0xff]); else { MCSystemFileHandle *t_handle; t_handle = MCStdioFileHandle::Open(p_path, s_modes[p_mode & 0xff]); if (t_handle == NULL && p_mode == kMCSystemFileModeUpdate) t_handle = MCStdioFileHandle::Open(p_path, "w+"); return t_handle; } }
bool MCSystemPlaySoundOnChannel(const char *p_channel, const char *p_file, MCSoundChannelPlayType p_type, MCObjectHandle *p_object) { bool t_success; t_success = true; const char *t_apk_file = nil;; // IM-2013-11-13: [[ Bug 11428 ]] Resolve path to make sure asset paths are valid char *t_resolved_path; t_resolved_path = nil; if (t_success) t_success = nil != (t_resolved_path = MCS_resolvepath(p_file)); if (t_success) if (path_to_apk_path(t_resolved_path, t_apk_file)) MCAndroidEngineRemoteCall("playSoundOnChannel", "bsssibj", &t_success, p_channel, t_apk_file, p_file, (int32_t) p_type, true, (long) p_object); else MCAndroidEngineRemoteCall("playSoundOnChannel", "bsssibj", &t_success, p_channel, t_resolved_path, p_file, (int32_t) p_type, false, (long) p_object); MCCStringFree(t_resolved_path); return t_success; }
Exec_stat MCAndroidPlayerControl::Set(MCNativeControlProperty p_property, MCExecPoint &ep) { bool t_bool = false; int32_t t_integer; jobject t_view; t_view = GetView(); switch (p_property) { case kMCNativeControlPropertyContent: { bool t_success = true; MCCStringFree(m_path); t_success = MCCStringClone(ep.getcstring(), m_path); if (MCCStringBeginsWith(m_path, "http://") || MCCStringBeginsWith(m_path, "https://")) { MCAndroidObjectRemoteCall(t_view, "setUrl", "bs", &t_success, m_path); } else { char *t_resolved_path = nil; bool t_is_asset = false; const char *t_asset_path = nil; t_resolved_path = MCS_resolvepath(m_path); t_is_asset = path_to_apk_path(t_resolved_path, t_asset_path); MCAndroidObjectRemoteCall(t_view, "setFile", "bsb", &t_success, t_is_asset ? t_asset_path : t_resolved_path, t_is_asset); MCCStringFree(t_resolved_path); } return ES_NORMAL; } case kMCNativeControlPropertyShowController: { if (!ParseBoolean(ep, t_bool)) return ES_ERROR; MCAndroidObjectRemoteCall(t_view, "setShowController", "vb", nil, t_bool); return ES_NORMAL; } case kMCNativeControlPropertyCurrentTime: { if (!ParseInteger(ep, t_integer)) return ES_ERROR; MCAndroidObjectRemoteCall(t_view, "setCurrentTime", "vi", nil, t_integer); return ES_NORMAL; } case kMCNativeControlPropertyLooping: { if (!ParseBoolean(ep, t_bool)) return ES_ERROR; MCAndroidObjectRemoteCall(t_view, "setLooping", "vb", nil, t_bool); return ES_NORMAL; } default: break; } return MCAndroidControl::Set(p_property, ep); }