gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Sandro Santilli
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-633-g2cba2ba
Date: Sat, 13 Aug 2011 07:53:57 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  2cba2bac31734e1c33465c0cf929f29d5d226ac3 (commit)
      from  b787ed547dc1de96be8c3b7227ac1fa0754cd601 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=2cba2bac31734e1c33465c0cf929f29d5d226ac3


commit 2cba2bac31734e1c33465c0cf929f29d5d226ac3
Author: Sandro Santilli <address@hidden>
Date:   Sat Aug 13 09:42:08 2011 +0200

    Sound.stop() invoked on an unattached Sound stops all event sounds.
    
    Includes a new stopAllEventSounds() interface to sound_handler.
    Includes automated testcase. Fixes bug #33888.
    Thanks to Jan Flanders for the hint.

diff --git a/NEWS b/NEWS
index 3e03167..22edd68 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ Improvements since 0.8.9 release are:
  * Implement onSoundComplete() for event sounds.
  * Fix MovieClip.onLoad event dispatching and constant pools handling, fixing
    support for movies generated by the evil Adobe Captivate tool (#33521).
+ * Fix unattached Sound.stop() semantic (#33888) enjoy Super Mario!
 
 Gnash 0.8.9
 2011/03/19
diff --git a/libcore/asobj/Sound_as.cpp b/libcore/asobj/Sound_as.cpp
index 982b7cc..5ec4559 100644
--- a/libcore/asobj/Sound_as.cpp
+++ b/libcore/asobj/Sound_as.cpp
@@ -744,7 +744,12 @@ Sound_as::stop(int si)
                 _inputStream=0;
             }
         } else {
-            _soundHandler->stopEventSound(soundId);
+            if ( ! _attachedCharacter ) {
+                // See https://savannah.gnu.org/bugs/index.php?33888
+                _soundHandler->stopAllEventSounds();
+            } else {
+                _soundHandler->stopEventSound(soundId);
+            }
         }
     } else {
         _soundHandler->stopEventSound(si);
diff --git a/libsound/sdl/sound_handler_sdl.cpp 
b/libsound/sdl/sound_handler_sdl.cpp
index c164271..5456442 100644
--- a/libsound/sdl/sound_handler_sdl.cpp
+++ b/libsound/sdl/sound_handler_sdl.cpp
@@ -166,6 +166,13 @@ SDL_sound_handler::stopEventSound(int soundHandle)
 }
 
 void
+SDL_sound_handler::stopAllEventSounds()
+{
+    boost::mutex::scoped_lock lock(_mutex);
+    sound_handler::stopAllEventSounds();
+}
+
+void
 SDL_sound_handler::stopStreamingSound(int soundHandle)
 {
     boost::mutex::scoped_lock lock(_mutex);
diff --git a/libsound/sdl/sound_handler_sdl.h b/libsound/sdl/sound_handler_sdl.h
index ad3b817..b41411e 100644
--- a/libsound/sdl/sound_handler_sdl.h
+++ b/libsound/sdl/sound_handler_sdl.h
@@ -106,6 +106,9 @@ public:
     // See dox in sound_handler.h
     virtual void stopEventSound(int sound_handle);
 
+    // See dox in sound_handler.h
+    virtual void stopAllEventSounds();
+
     virtual void stopStreamingSound(int sound_handle);
 
     // See dox in sound_handler.h
diff --git a/libsound/sound_handler.cpp b/libsound/sound_handler.cpp
index 9d7a5a1..1b97539 100644
--- a/libsound/sound_handler.cpp
+++ b/libsound/sound_handler.cpp
@@ -245,6 +245,23 @@ sound_handler::stopEventSound(int handle)
 
 }
 
+void
+sound_handler::stopAllEventSounds()
+{
+#ifdef GNASH_DEBUG_SOUNDS_MANAGEMENT
+    log_debug("stopAllEventSounds called");
+#endif
+
+    for (Sounds::iterator i=_sounds.begin(), e=_sounds.end(); i != e; ++i)
+    {
+        EmbedSound* sounddata = *i;
+        if (!sounddata) continue; // possible ?
+
+        stopEmbedSoundInstances(*sounddata);
+    }
+
+}
+
 void   
 sound_handler::stopEmbedSoundInstances(StreamingSoundData& def)
 {
diff --git a/libsound/sound_handler.h b/libsound/sound_handler.h
index 6747d4e..12939ef 100644
--- a/libsound/sound_handler.h
+++ b/libsound/sound_handler.h
@@ -131,6 +131,10 @@ public:
     /// @param sound_handle     id for the sound to be stopped
     virtual void stopEventSound(int sound_handle);
 
+    /// Stop all instances of all playing event sounds. 
+    //
+    virtual void stopAllEventSounds();
+
     /// Discard the sound data for an embedded event sound
     //
     /// Only embedded event sounds are deleted; this happens when the
diff --git a/testsuite/misc-swfc.all/Makefile.am 
b/testsuite/misc-swfc.all/Makefile.am
index 5203def..5d2f487 100644
--- a/testsuite/misc-swfc.all/Makefile.am
+++ b/testsuite/misc-swfc.all/Makefile.am
@@ -49,6 +49,7 @@ BOGO_SCTESTS = \
 INTERACTIVE_SCTESTS = \
        button_test1.sc \
        button_test2.sc  \
+       sound_stop.sc  \
        $(NULL)
 
 AM_CPPFLAGS = -I.. \
@@ -81,6 +82,7 @@ EXTRA_DIST = $(SANE_SCTESTS) $(BOGO_SCTESTS) $(AUXMOVIES) 
$(INTERACTIVE_SCTESTS)
 
 check_PROGRAMS = \
        button_test1runner \
+       sound_stop_runner \
        $(NULL)
 
 abs_mediadir = $(abs_top_srcdir)/testsuite/media 
@@ -130,6 +132,21 @@ button_test1runner_DEPENDENCIES = \
        $(GNASH_LIBS) \
        $(NULL)
 
+sound_stop_runner_SOURCES = \
+       sound_stop_runner.cpp \
+       $(NULL)
+sound_stop_runner_LDADD = \
+       $(GNASH_LIBS) \
+       $(NULL)
+sound_stop_runner_CXXFLAGS = \
+       -DBUILDDIR='"$(top_builddir)/testsuite/misc-swfc.all"' \
+       $(NULL)
+sound_stop_runner_DEPENDENCIES = \
+       sound_stop.swf \
+       $(GNASH_LIBS) \
+       $(NULL)
+
+
 CLEANFILES =  \
        $(TEST_CASES) \
        gnash-dbg.log \
diff --git a/testsuite/misc-swfc.all/sound_stop.sc 
b/testsuite/misc-swfc.all/sound_stop.sc
new file mode 100644
index 0000000..4046270
--- /dev/null
+++ b/testsuite/misc-swfc.all/sound_stop.sc
@@ -0,0 +1,60 @@
+/*
+ *   Copyright (C) 2011 Free Software Foundation, Inc.
+ *
+ * This is free software; you can redistribute and/or modify it under
+ * the terms of the GNU General Public Licence. See the COPYING file.
+ */ 
+
+.flash bbox=400x200 filename="sound_test.swf" version=6 fps=1 background=white
+
+.frame 1
+
+    #include "check.sc" // for MEDIA..
+
+    .sound audio1 MEDIA(brokenchord.wav)
+    .sound audio2 MEDIA(brokenchord.wav)
+    .sound audio3 MEDIA(brokenchord.wav)
+
+    .action:
+        createTextField("tf", 0, 0, 0, 0, 0);
+        tf.autoSize = true;
+        tf.text = "You should hear a three notes chord forming.";
+    .end
+
+.frame 2
+
+    .action:
+        s1 = new Sound();
+        s1.attachSound("audio1");
+        s1.start(0, 100);
+    .end
+
+
+.frame 3
+    .action:
+        s2 = new Sound();
+        s2.attachSound("audio2");
+        s2.start(0, 100);
+    .end
+
+.frame 4
+    .action:
+        s3 = new Sound();
+        s3.attachSound("audio3");
+        s3.start(0, 100);
+    .end
+
+.frame 9
+    .action:
+        s4 = new Sound();
+        s4.stop();
+    .end
+
+.frame 10
+    .action:
+        tf.text += "\n";
+        tf.text += "Now all sounds should be off";
+        stop();
+    .end
+
+.end
diff --git a/testsuite/misc-swfc.all/sound_stop_runner.cpp 
b/testsuite/misc-swfc.all/sound_stop_runner.cpp
new file mode 100644
index 0000000..352f020
--- /dev/null
+++ b/testsuite/misc-swfc.all/sound_stop_runner.cpp
@@ -0,0 +1,66 @@
+/* 
+ *   Copyright (C) 2011 Free Software Foundation, Inc.
+ * 
+ * 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 3 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ */ 
+
+#define INPUT_FILENAME "sound_stop.swf"
+
+#include "MovieTester.h"
+#include "GnashException.h"
+#include "log.h"
+#include "VM.h"
+
+#include "check.h"
+#include <string>
+#include <cassert>
+
+using namespace gnash;
+using namespace std;
+
+int
+main(int /*argc*/, char** /*argv*/)
+{
+    string filename = string(BUILDDIR) + string("/") + string(INPUT_FILENAME);
+    auto_ptr<MovieTester> t;
+
+    gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+    dbglogfile.setVerbosity(2);
+
+    MovieTester tester(filename);
+
+    check_equals(tester.soundsStarted(), 0);
+    check_equals(tester.soundsStopped(), 0);
+
+    for (int i=0; i<3; ++i) {
+        tester.advance();
+        check_equals(tester.soundsStarted(), i+1);
+        check_equals(tester.soundsStopped(), 0);
+    }
+
+    for (int i=3; i<7; ++i) {
+        tester.advance();
+        check_equals(tester.soundsStarted(), 3);
+        check_equals(tester.soundsStopped(), 0);
+    }
+
+    tester.advance();
+    check_equals(tester.soundsStarted(), 3);
+    check_equals(tester.soundsStopped(), 3);
+
+}
+

-----------------------------------------------------------------------

Summary of changes:
 NEWS                                               |    1 +
 libcore/asobj/Sound_as.cpp                         |    7 ++-
 libsound/sdl/sound_handler_sdl.cpp                 |    7 ++
 libsound/sdl/sound_handler_sdl.h                   |    3 +
 libsound/sound_handler.cpp                         |   17 ++++++
 libsound/sound_handler.h                           |    4 +
 testsuite/misc-swfc.all/Makefile.am                |   17 ++++++
 testsuite/misc-swfc.all/sound_stop.sc              |   60 ++++++++++++++++++++
 .../sound_stop_runner.cpp}                         |   53 ++++++++----------
 9 files changed, 138 insertions(+), 31 deletions(-)
 create mode 100644 testsuite/misc-swfc.all/sound_stop.sc
 copy testsuite/{misc-swfmill.all/missing_bitmapTestRunner.cpp => 
misc-swfc.all/sound_stop_runner.cpp} (51%)


hooks/post-receive
-- 
Gnash



reply via email to

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