Fix pause/next-frame
Pause only sound on menu open on Windows, and resume on menu close if emulator is not paused. This is to avoid DirectSound looping on menu open. Fix #788 Fix #1077 Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
d3f8cc1714
commit
3cef52b72d
|
@ -104,7 +104,7 @@ bool DirectSound::init(long sampleRate)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(hr = pDirectSound->SetCooperativeLevel((HWND)wxGetApp().frame->GetHandle(), DSSCL_EXCLUSIVE))) {
|
if (FAILED(hr = pDirectSound->SetCooperativeLevel((HWND)wxGetApp().frame->GetHandle(), DSSCL_PRIORITY))) {
|
||||||
wxLogError(_("Cannot SetCooperativeLevel %08x"), hr);
|
wxLogError(_("Cannot SetCooperativeLevel %08x"), hr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1143,32 +1143,18 @@ void MainFrame::MenuPopped(wxMenuEvent& evt)
|
||||||
evt.Skip();
|
evt.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pause game if menu pops up.
|
// On Windows, opening the menubar will stop the app, but DirectSound will
|
||||||
//
|
// loop, so we pause audio here.
|
||||||
// This is a feature most people don't like, and it causes problems with
|
|
||||||
// keyboard game keys on mac, so we will disable it for now.
|
|
||||||
//
|
|
||||||
// On Windows, there will still be a pause because of how the windows event
|
|
||||||
// model works, in addition the audio will loop with SDL, so we still pause on
|
|
||||||
// Windows.
|
|
||||||
//
|
|
||||||
// TODO: This needs to be fixed properly.
|
|
||||||
//
|
|
||||||
void MainFrame::SetMenusOpened(bool state)
|
void MainFrame::SetMenusOpened(bool state)
|
||||||
{
|
{
|
||||||
if ((menus_opened = state)) {
|
menus_opened = state;
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
paused = true;
|
if (menus_opened)
|
||||||
panel->Pause();
|
soundPause();
|
||||||
|
else if (!paused)
|
||||||
|
soundResume();
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
else {
|
|
||||||
#ifdef __WXMSW__
|
|
||||||
paused = false;
|
|
||||||
pause_next = false;
|
|
||||||
panel->Resume();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShowModal that also disables emulator loop
|
// ShowModal that also disables emulator loop
|
||||||
|
|
Loading…
Reference in New Issue