Fix dsound looping when moving/resizing window
Add MOVE_START/MOVE_END events to detect when the window is moved or resized and pause sound on Windows to prevent the DirectSound driver from looping. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
93fbb5618d
commit
36e88fafb6
|
@ -824,6 +824,8 @@ EVT_DROP_FILES(MainFrame::OnDropFile)
|
||||||
|
|
||||||
// for window geometry
|
// for window geometry
|
||||||
EVT_MOVE(MainFrame::OnMove)
|
EVT_MOVE(MainFrame::OnMove)
|
||||||
|
EVT_MOVE_START(MainFrame::OnMoveStart)
|
||||||
|
EVT_MOVE_END(MainFrame::OnMoveEnd)
|
||||||
EVT_SIZE(MainFrame::OnSize)
|
EVT_SIZE(MainFrame::OnSize)
|
||||||
|
|
||||||
// For tracking menubar state.
|
// For tracking menubar state.
|
||||||
|
@ -879,6 +881,20 @@ void MainFrame::OnMove(wxMoveEvent&) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// On Windows pause sound when moving and resizing the window to prevent dsound
|
||||||
|
// from looping.
|
||||||
|
void MainFrame::OnMoveStart(wxMoveEvent&) {
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
soundPause();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainFrame::OnMoveEnd(wxMoveEvent&) {
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
soundResume();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void MainFrame::OnSize(wxSizeEvent& event)
|
void MainFrame::OnSize(wxSizeEvent& event)
|
||||||
{
|
{
|
||||||
wxFrame::OnSize(event);
|
wxFrame::OnSize(event);
|
||||||
|
|
|
@ -382,6 +382,8 @@ private:
|
||||||
void OnMenu(wxContextMenuEvent&);
|
void OnMenu(wxContextMenuEvent&);
|
||||||
// window geometry
|
// window geometry
|
||||||
void OnMove(wxMoveEvent& event);
|
void OnMove(wxMoveEvent& event);
|
||||||
|
void OnMoveStart(wxMoveEvent& event);
|
||||||
|
void OnMoveEnd(wxMoveEvent& event);
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
// Load a named wxDialog from the XRC file
|
// Load a named wxDialog from the XRC file
|
||||||
wxDialog* LoadXRCDialog(const char* name);
|
wxDialog* LoadXRCDialog(const char* name);
|
||||||
|
|
Loading…
Reference in New Issue