[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11384: SDL_OpenAudio changes the de
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11384: SDL_OpenAudio changes the desired SDL_AudioSpec, which can lead it to |
Date: |
Fri, 07 Aug 2009 14:06:37 +0200 |
User-agent: |
Bazaar (1.16.1) |
------------------------------------------------------------
revno: 11384
author: Ed Martin <address@hidden>
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Fri 2009-08-07 14:06:37 +0200
message:
SDL_OpenAudio changes the desired SDL_AudioSpec, which can lead it to
fail if a sound device becomes unavailable between calls to openAudio().
Reset the SDL_AudioSpec on each call. Fixes bug #27071 (thanks to
Ed Martin for the bug report and the patch).
modified:
libsound/sdl/sound_handler_sdl.cpp
=== modified file 'libsound/sdl/sound_handler_sdl.cpp'
--- a/libsound/sdl/sound_handler_sdl.cpp 2009-08-07 07:11:40 +0000
+++ b/libsound/sdl/sound_handler_sdl.cpp 2009-08-07 12:06:37 +0000
@@ -33,7 +33,6 @@
#include "log.h" // will import boost::format too
#include "GnashException.h" // for SoundException
-//#include <cmath>
#include <vector>
#include <boost/scoped_array.hpp>
#include <SDL.h>
@@ -78,6 +77,21 @@
void
SDL_sound_handler::initAudio()
{
+ // NOTE: we open and close the audio card for the sole purpose
+ // of throwing an exception on error (unavailable audio
+ // card). Normally we'd want to open the audio card only
+ // when needed (it has a cost in number of wakeups).
+ //
+ openAudio();
+ closeAudio();
+
+}
+
+void
+SDL_sound_handler::openAudio()
+{
+ if ( _audioOpened ) return; // nothing to do
+
// This is our sound settings
audioSpec.freq = 44100;
@@ -95,25 +109,10 @@
//512 - not enough for videostream
audioSpec.samples = 2048;
- // NOTE: we open and close the audio card for the sole purpose
- // of throwing an exception on error (unavailable audio
- // card). Normally we'd want to open the audio card only
- // when needed (it has a cost in number of wakeups).
- //
- openAudio();
- closeAudio();
-
-}
-
-void
-SDL_sound_handler::openAudio()
-{
- if ( _audioOpened ) return; // nothing to do
-
if (SDL_OpenAudio(&audioSpec, NULL) < 0 ) {
boost::format fmt = boost::format(
- _("Unable to open SDL audio: %s"))
- % SDL_GetError();
+ _("Unable to open SDL audio: %s"))
+ % SDL_GetError();
throw SoundException(fmt.str());
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11384: SDL_OpenAudio changes the desired SDL_AudioSpec, which can lead it to,
Benjamin Wolsey <=