Skip to content
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

Merged
merged 3 commits into from
Feb 26, 2020
Merged

Conversation

xianyinchen
Copy link
Contributor

@xianyinchen xianyinchen changed the title free AudioMix partial wake locks, and android device can enter power … free AudioMix partial wake locks, and android device can enter power save Feb 17, 2020
Comment on lines 366 to 369

if (_audioEngineImpl) {
_audioEngineImpl->onPause();
}
Copy link
Contributor

@PPpro PPpro Feb 19, 2020

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 平台也要提供空实现

Comment on lines 378 to 381

if (_audioEngineImpl) {
_audioEngineImpl->onResume();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@cocos-robot cocos-robot changed the base branch from v2.3.1 to v2.3.1-release February 24, 2020 09:30
Copy link
Contributor

@cocos-robot cocos-robot left a 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!

@@ -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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

接口的命名可以考虑下. 这里的 pauseonPause 是无关的, onPause 更接近 onGamePaused

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AudioEngine::onResume 也存在类似的问题

Copy link
Contributor Author

@xianyinchen xianyinchen Feb 26, 2020

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SantyWang SantyWang merged commit 6451912 into cocos:v2.3.1-release Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants