From 70b7ebb33901d3dff5426c1c2fa12bc5087b721a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 22 Aug 2009 12:35:49 +0000 Subject: Patch #2826508: "Motorola A1200/E6/A1600 (motoezx) patch" svn-id: r43636 --- backends/platform/linuxmoto/linuxmoto-sdl.cpp | 69 +++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 backends/platform/linuxmoto/linuxmoto-sdl.cpp (limited to 'backends/platform/linuxmoto/linuxmoto-sdl.cpp') diff --git a/backends/platform/linuxmoto/linuxmoto-sdl.cpp b/backends/platform/linuxmoto/linuxmoto-sdl.cpp new file mode 100644 index 0000000000..bc163c807c --- /dev/null +++ b/backends/platform/linuxmoto/linuxmoto-sdl.cpp @@ -0,0 +1,69 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + + +#include "backends/platform/linuxmoto/linuxmoto-sdl.h" + +void OSystem_LINUXMOTO::preprocessEvents(SDL_Event *event) { + if (event->type == SDL_ACTIVEEVENT) { + if (event->active.state == SDL_APPINPUTFOCUS && !event->active.gain) { + suspendAudio(); + for (;;) { + if (!SDL_WaitEvent(event)) { + SDL_Delay(10); + continue; + } + if (event->type == SDL_QUIT) + return; + if (event->type != SDL_ACTIVEEVENT) + continue; + if (event->active.state == SDL_APPINPUTFOCUS && event->active.gain) { + resumeAudio(); + return; + } + } + } + } +} + +void OSystem_LINUXMOTO::suspendAudio() { + SDL_CloseAudio(); + _audioSuspended = true; +} + +int OSystem_LINUXMOTO::resumeAudio() { + if (!_audioSuspended) + return -2; + if (SDL_OpenAudio(&_obtained, NULL) < 0){ + return -1; + } + SDL_PauseAudio(0); + _audioSuspended = false; + return 0; +} + +void OSystem_LINUXMOTO::setupMixer() { + OSystem_SDL::setupMixer(); +} -- cgit v1.2.3 From 1cedb6577111bca746628b0d3f4b0e8b232338c5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 22 Aug 2009 13:18:26 +0000 Subject: Give meaningful name to variable svn-id: r43647 --- backends/platform/linuxmoto/linuxmoto-sdl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends/platform/linuxmoto/linuxmoto-sdl.cpp') diff --git a/backends/platform/linuxmoto/linuxmoto-sdl.cpp b/backends/platform/linuxmoto/linuxmoto-sdl.cpp index bc163c807c..82c69bc7d7 100644 --- a/backends/platform/linuxmoto/linuxmoto-sdl.cpp +++ b/backends/platform/linuxmoto/linuxmoto-sdl.cpp @@ -56,7 +56,7 @@ void OSystem_LINUXMOTO::suspendAudio() { int OSystem_LINUXMOTO::resumeAudio() { if (!_audioSuspended) return -2; - if (SDL_OpenAudio(&_obtained, NULL) < 0){ + if (SDL_OpenAudio(&_obtainedRate, NULL) < 0){ return -1; } SDL_PauseAudio(0); -- cgit v1.2.3