-
Notifications
You must be signed in to change notification settings - Fork 570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
free AudioMix partial wake locks, and android device can enter power save #2137
Conversation
cocos/audio/AudioEngine.cpp
Outdated
|
||
if (_audioEngineImpl) { | ||
_audioEngineImpl->onPause(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里如果只是安卓平台才需要的操作,可以加上 #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
的判断,这样 ios 上就不用提供空实现了
否则可能 windows mac 平台也要提供空实现
cocos/audio/AudioEngine.cpp
Outdated
|
||
if (_audioEngineImpl) { | ||
_audioEngineImpl->onResume(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xianyinchen, v2.3.1 branch will be deleted, so we edited the base branch to v2.3.1-release, or this PR will be killed by GitHub.
Please review the commits history to ensure that the PR does not polluted by unneeded commits from your origin branch.
If you need to merge to other branch, you can first click the Edit button on the right side of the PR title, then switch the base branch.
If necessary, welcome to resubmit a new PR. Thanks!
…save. add for android only.
@@ -73,6 +73,9 @@ class AudioEngineImpl : public cocos2d::Ref | |||
void uncacheAll(); | |||
void preload(const std::string& filePath, const std::function<void(bool)>& callback); | |||
|
|||
void onResume(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
接口的命名可以考虑下. 这里的 pause
和 onPause
是无关的, onPause 更接近 onGamePaused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AudioEngine::onResume
也存在类似的问题
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我参考 AudioEngine::onPause 和 AudioEngine::onResume 两个接口,这个事件本来应该在前后台事件中处理,但是音频管理并没有提供前后台的处理接口,都是间接触发 onPause 和 onResume,我直接写成 AudioEngine::onPause -> AudioEngineImpl::onPause, 从理解上会比较直接,即使暂停情况,AudioEngineImpl::onPause 的处理也不存在任何问题。
@@ -345,6 +345,7 @@ -(void)keyboardWillShow: (NSNotification*) notification | |||
|
|||
-(void)keyboardWillHide: (NSNotification*) notification | |||
{ | |||
cocos2d::EditBox::complete(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/cocos-creator/2d-tasks/issues/2302