gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash/backend sound_handler_sdl.cpp


From: Vitaly Alexeev
Subject: [Gnash-commit] gnash/backend sound_handler_sdl.cpp
Date: Wed, 01 Nov 2006 16:00:33 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Vitaly Alexeev <alexeev>        06/11/01 16:00:33

Modified files:
        backend        : sound_handler_sdl.cpp 

Log message:
        open audio if it is closed

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_sdl.cpp?cvsroot=gnash&r1=1.31&r2=1.32

Patches:
Index: sound_handler_sdl.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_sdl.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- sound_handler_sdl.cpp       30 Oct 2006 22:40:51 -0000      1.31
+++ sound_handler_sdl.cpp       1 Nov 2006 16:00:33 -0000       1.32
@@ -51,7 +51,7 @@
        audioSpec.channels = 2;
        audioSpec.callback = sdl_audio_callback;
        audioSpec.userdata = this;
-       audioSpec.samples = 2048;               //512 - not enough for  
videostream     //vv
+       audioSpec.samples = 2048;               //512 - not enough for  
videostream
 }
 
 SDL_sound_handler::~SDL_sound_handler()
@@ -327,7 +327,6 @@
                }
                soundOpened = true;
 
-
        }
 
        ++soundsPlaying;
@@ -473,7 +472,7 @@
        return muted;
 }
 
-void   SDL_sound_handler::attach_aux_streamer(aux_streamer_ptr ptr, void* 
owner)       //vv
+void   SDL_sound_handler::attach_aux_streamer(aux_streamer_ptr ptr, void* 
owner)
 {
        assert(owner);
        assert(ptr);
@@ -485,9 +484,20 @@
                return;
        }
        m_aux_streamer[owner] = ptr;
+
+       if (!soundOpened) {
+               if (SDL_OpenAudio(&audioSpec, NULL) < 0 ) {
+                       gnash::log_error("Unable to START SOUND: %s\n", 
SDL_GetError());
+                       pthread_mutex_unlock(&mutex);
+                       return;
+               }
+               soundOpened = true;
+       }
+       SDL_PauseAudio(0);
+
 }
 
-void   SDL_sound_handler::detach_aux_streamer(void* owner)     //vv
+void   SDL_sound_handler::detach_aux_streamer(void* owner)
 {
        m_aux_streamer.erase(owner);
 }
@@ -659,7 +669,7 @@
 
        // If nothing to play there is no reason to play
        // Is this a potential deadlock problem?
-       if (handler->soundsPlaying == 0 && handler->m_aux_streamer.size() == 0) 
{       //vv
+       if (handler->soundsPlaying == 0 && handler->m_aux_streamer.size() == 0) 
{
                SDL_PauseAudio(1);
                return;
        }
@@ -671,7 +681,7 @@
        memset(buffer, 0, buffer_length);
 
 
-       // call NetStream audio callbacks       //vv
+       // call NetStream audio callbacks
        if (handler->m_aux_streamer.size() > 0)
        {
                Uint8* buf = new Uint8[buffer_length];




reply via email to

[Prev in Thread] Current Thread [Next in Thread]