[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog backend/sound_handler_gst.cpp b...
From: |
Tomas Groth |
Subject: |
[Gnash-commit] gnash ChangeLog backend/sound_handler_gst.cpp b... |
Date: |
Mon, 16 Oct 2006 22:17:14 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Tomas Groth <tgc> 06/10/16 22:17:14
Modified files:
. : ChangeLog
backend : sound_handler_gst.cpp sound_handler_sdl.cpp
sound_handler_sdl.h
server : gnash.h
Log message:
Added support for muting and unmuting soundhandlers.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1253&r2=1.1254
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_gst.cpp?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_sdl.cpp?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_sdl.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/gnash.h?cvsroot=gnash&r1=1.62&r2=1.63
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1253
retrieving revision 1.1254
diff -u -b -r1.1253 -r1.1254
--- ChangeLog 16 Oct 2006 20:41:35 -0000 1.1253
+++ ChangeLog 16 Oct 2006 22:17:14 -0000 1.1254
@@ -1,7 +1,13 @@
2006-10-16 Tomas Groth Christensen <address@hidden>
+ * backend/sound_handler_gst.cpp, backend/sound_handler_sdl.cpp,
+ backend/sound_handler_sdl.h, server/gnash.h: Added support for
+ muting and unmuting soundhandlers.
+
+2006-10-16 Tomas Groth Christensen <address@hidden>
+
* backend/sound_handler_sdl.cpp: Fixed stop_all_sounds() and
- sound_sound().
+ stop_sound().
* server/sprite_instance.cpp: When a movie is stopped/paused
or jumps to a new frame the audio playback now stops.
Index: backend/sound_handler_gst.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_gst.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- backend/sound_handler_gst.cpp 16 Oct 2006 14:33:38 -0000 1.20
+++ backend/sound_handler_gst.cpp 16 Oct 2006 22:17:14 -0000 1.21
@@ -18,7 +18,7 @@
// Based on sound_handler_sdl.cpp by Thatcher Ulrich http://tulrich.com 2003
// which has been donated to the Public Domain.
-/* $Id: sound_handler_gst.cpp,v 1.20 2006/10/16 14:33:38 tgc Exp $ */
+/* $Id: sound_handler_gst.cpp,v 1.21 2006/10/16 22:17:14 tgc Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -119,9 +119,13 @@
// Is the loop running?
bool looping;
+ // Is the audio muted?
+ bool muted;
+
GST_sound_handler()
: soundsPlaying(0),
- looping(false)
+ looping(false),
+ muted(false)
{
// init gstreamer
gst_init(NULL, NULL);
@@ -367,10 +371,10 @@
// Play the index'd sample.
{
- // Check if the sound exists.
- if (sound_handle < 0 || (unsigned int) sound_handle >=
m_sound_data.size())
+ // Check if the sound exists, or if audio is muted
+ if (sound_handle < 0 || (unsigned int) sound_handle >=
m_sound_data.size() || muted)
{
- // Invalid handle.
+ // Invalid handle, or audio is muted.
return;
}
@@ -601,7 +605,7 @@
// for what sounds is associated with what SWF.
virtual void stop_all_sounds()
{
- for (size_t i = m_sound_data.size(); i > 0; i--) //Optimized
+ for (size_t i = m_sound_data.size()-1; i >= 0; i--) //Optimized
stop_sound(i);
}
@@ -659,6 +663,18 @@
}
+ // gnash calls this to mute audio
+ virtual void mute() {
+ stop_all_sounds();
+ muted = true;
+ }
+
+ // gnash calls this to unmute audio
+ virtual void unmute() {
+ muted = false;
+ }
+
+
};
Index: backend/sound_handler_sdl.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_sdl.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- backend/sound_handler_sdl.cpp 16 Oct 2006 20:41:35 -0000 1.25
+++ backend/sound_handler_sdl.cpp 16 Oct 2006 22:17:14 -0000 1.26
@@ -39,7 +39,8 @@
SDL_sound_handler::SDL_sound_handler()
: soundOpened(false),
- soundsPlaying(0)
+ soundsPlaying(0),
+ muted(false)
{
// Init mutex
pthread_mutex_init(&mutex , NULL);
@@ -243,10 +244,10 @@
{
pthread_mutex_lock(&mutex);
- // Check if the sound exists.
- if (sound_handle < 0 || (unsigned int) sound_handle >=
m_sound_data.size())
+ // Check if the sound exists, or if audio is muted
+ if (sound_handle < 0 || (unsigned int) sound_handle >=
m_sound_data.size() || muted)
{
- // Invalid handle.
+ // Invalid handle or muted
pthread_mutex_unlock(&mutex);
return;
}
@@ -458,6 +459,18 @@
pthread_mutex_unlock(&mutex);
}
+// gnash calls this to mute audio
+void SDL_sound_handler::mute() {
+ stop_all_sounds();
+ muted = true;
+}
+
+// gnash calls this to unmute audio
+void SDL_sound_handler::unmute() {
+ muted = false;
+}
+
+
void SDL_sound_handler::convert_raw_data(
int16_t** adjusted_data,
Index: backend/sound_handler_sdl.h
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_sdl.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- backend/sound_handler_sdl.h 16 Oct 2006 14:33:38 -0000 1.4
+++ backend/sound_handler_sdl.h 16 Oct 2006 22:17:14 -0000 1.5
@@ -127,6 +127,9 @@
// Keeps track of numbers of playing sounds
int soundsPlaying;
+ // Is the audio muted?
+ bool muted;
+
// mutex for making sure threads doesn't mess things up
pthread_mutex_t mutex;
@@ -161,6 +164,11 @@
virtual void get_info(int sound_handle, int* format, bool* stereo);
+ // gnash calls this to mute audio
+ virtual void mute();
+
+ // gnash calls this to unmute audio
+ virtual void unmute();
// Converts input data to the SDL output format.
virtual void convert_raw_data(int16_t** adjusted_data,
Index: server/gnash.h
===================================================================
RCS file: /sources/gnash/gnash/server/gnash.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- server/gnash.h 16 Oct 2006 14:33:38 -0000 1.62
+++ server/gnash.h 16 Oct 2006 22:17:14 -0000 1.63
@@ -35,7 +35,7 @@
//
//
-/* $Id: gnash.h,v 1.62 2006/10/16 14:33:38 tgc Exp $ */
+/* $Id: gnash.h,v 1.63 2006/10/16 22:17:14 tgc Exp $ */
/// \mainpage
///
@@ -473,6 +473,13 @@
// gnash calls this when it's done with a particular sound.
virtual void delete_sound(int sound_handle) = 0;
+ // gnash calls this to mute audio
+ virtual void mute() = 0;
+
+ // gnash calls this to unmute audio
+ virtual void unmute() = 0;
+
+
virtual ~sound_handler() {};
// Utility function to uncompress ADPCM.