[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 14:33:39 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Tomas Groth <tgc> 06/10/16 14:33:38
Modified files:
. : ChangeLog
backend : sound_handler_gst.cpp sound_handler_sdl.cpp
sound_handler_sdl.h
doc/C : internals.xml
server : button_character_instance.cpp gnash.h sound.cpp
sound.h
server/asobj : ASSound.cpp
server/parser : button_character_def.cpp button_character_def.h
Log message:
Added support for sound envelopes, and updated the docs about sdl sound
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1237&r2=1.1238
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_gst.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_sdl.cpp?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_sdl.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/doc/C/internals.xml?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/gnash.h?cvsroot=gnash&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sound.cpp?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sound.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/ASSound.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/button_character_def.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/button_character_def.h?cvsroot=gnash&r1=1.2&r2=1.3
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1237
retrieving revision 1.1238
diff -u -b -r1.1237 -r1.1238
--- ChangeLog 16 Oct 2006 14:27:43 -0000 1.1237
+++ ChangeLog 16 Oct 2006 14:33:38 -0000 1.1238
@@ -1,3 +1,14 @@
+2006-10-16 Tomas Groth Christensen <address@hidden>
+
+ * doc/C/internals.xml: Updated the docs about the SDL soundhandler
+ * backend/sound_handler_gst.cpp: Dummy support for sound envelopes
+ * backend/sound_handler_sdl.cpp, backend/sound_handler_sdl.h,
+ server/button_character_instance.cpp, server/gnash.h,
+ server/sound.cpp, server/sound.h, server/asobj/ASSound.cpp,
+ server/parser/button_character_def.cpp,
+ server/parser/button_character_def.h: Added support for volume
+ control using sound envelopes.
+
2006-10-16 Sandro Santilli <address@hidden>
* testsuite/misc-ming.all/: ButtonEventsTest-Runner.cpp,
Index: backend/sound_handler_gst.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_gst.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- backend/sound_handler_gst.cpp 7 Oct 2006 14:20:27 -0000 1.19
+++ backend/sound_handler_gst.cpp 16 Oct 2006 14:33:38 -0000 1.20
@@ -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.19 2006/10/07 14:20:27 tgc Exp $ */
+/* $Id: sound_handler_gst.cpp,v 1.20 2006/10/16 14:33:38 tgc Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -363,7 +363,7 @@
}*/
- virtual void play_sound(int sound_handle, int loop_count, int
/*offset*/, long start_position)
+ virtual void play_sound(int sound_handle, int loop_count, int
/*offset*/, long start_position, std::vector<sound_envelope>* /*envelopes*/)
// Play the index'd sample.
{
Index: backend/sound_handler_sdl.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_sdl.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- backend/sound_handler_sdl.cpp 15 Oct 2006 09:11:20 -0000 1.23
+++ backend/sound_handler_sdl.cpp 16 Oct 2006 14:33:38 -0000 1.24
@@ -237,7 +237,8 @@
}
-void SDL_sound_handler::play_sound(int sound_handle, int loop_count, int
/*offset*/, long start_position)
+void SDL_sound_handler::play_sound(int sound_handle, int loop_count, int
offset, long start_position, std::vector<sound_envelope>* envelopes)
+//uint8_t env_count, uint32_t* envelopes)
// Play the index'd sample.
{
pthread_mutex_lock(&mutex);
@@ -264,9 +265,15 @@
// Copy data-info to the active_sound
sound->data_size = m_sound_data[sound_handle]->data_size;
sound->data = m_sound_data[sound_handle]->data;
+
+ // Set the given options of the sound
sound->position = start_position;
if (start_position < 0) sound->position = 0;
-
+ sound->offset = (m_sound_data[sound_handle]->stereo ? offset :
offset*2); // offset is stored as stereo
+ if (offset < 0) sound->offset = 0;
+ sound->envelopes = envelopes;
+ sound->current_env = 0;
+ sound->samples_played = 0;
// Set number of loop we should do. -1 is infinte loop, 0 plays it
once, 1 twice etc.
sound->loop_count = loop_count;
@@ -279,6 +286,9 @@
avcodec_register_all();// change this to only register mp3?
sound->codec = avcodec_find_decoder(CODEC_ID_MP3);
+ // Init the parser
+ sound->parser = av_parser_init(CODEC_ID_MP3);
+
if (!sound->codec) {
gnash::log_error("Your FFMPEG can't decode MP3?!\n");
pthread_mutex_unlock(&mutex);
@@ -525,6 +535,68 @@
return new SDL_sound_handler;
}
+// AS-volume adjustment
+void adjust_volume(int16_t* data, int size, int volume)
+{
+ for (int i=0; i < size*0.5; i++) {
+ data[i] = data[i] * volume/100;
+ }
+}
+
+// envelope-volume adjustment
+void use_envelopes(active_sound* sound, int length)
+{
+ // Check if this is the time to use envelopes yet
+ if (sound->current_env == 0 && sound->envelopes->at(0).m_mark44 >
sound->samples_played+length/2) {
+ return;
+
+ // switch to the next envelope if needed and possible
+ } else if (sound->current_env < sound->envelopes->size()-1 &&
sound->envelopes->at(sound->current_env+1).m_mark44 >= sound->samples_played) {
+ sound->current_env++;
+ }
+
+ // Current envelope position
+ int32_t cur_env_pos = sound->envelopes->at(sound->current_env).m_mark44;
+
+ // Next envelope position
+ int32_t next_env_pos = 0;
+ if (sound->current_env == (sound->envelopes->size()-1)) {
+ // If there is no "next envelope" then set the next envelope
start point to be unreachable
+ next_env_pos = cur_env_pos + length;
+ } else {
+ next_env_pos =
sound->envelopes->at(sound->current_env+1).m_mark44;
+ }
+
+ int startpos = 0;
+ // Make sure we start adjusting at the right sample
+ if (sound->current_env == 0 &&
sound->envelopes->at(sound->current_env).m_mark44 > sound->samples_played) {
+ startpos = sound->raw_position +
(sound->envelopes->at(sound->current_env).m_mark44 - sound->samples_played)*2;
+ } else {
+ startpos = sound->raw_position;
+ }
+ int16_t* data = (int16_t*) (sound->raw_data + startpos);
+
+ for (int i=0; i < length/2; i+=2) {
+ float left =
(float)sound->envelopes->at(sound->current_env).m_level0 / 32768.0;
+ float right =
(float)sound->envelopes->at(sound->current_env).m_level1 / 32768.0;
+
+ data[i] = (int16_t)(data[i] * left); // Left
+ data[i+1] = (int16_t)(data[i+1] * right); // Right
+
+ if ((sound->samples_played+(length/2-i)) >= next_env_pos &&
sound->current_env != (sound->envelopes->size()-1)) {
+ sound->current_env++;
+ // Next envelope position
+ if (sound->current_env == (sound->envelopes->size()-1))
{
+ // If there is no "next envelope" then set the
next envelope start point to be unreachable
+ next_env_pos = cur_env_pos + length;
+ } else {
+ next_env_pos =
sound->envelopes->at(sound->current_env+1).m_mark44;
+ }
+ }
+ }
+}
+
+
// The callback function which refills the buffer with data
void sdl_audio_callback (void *udata, Uint8 *stream, int buffer_length)
{
@@ -563,12 +635,21 @@
// First we mix what is decoded
int index = 0;
if (sound->raw_data_size - sound->raw_position
> 0) {
+ // If the volume needs adjustments we
call a function to do that
+ if (handler->m_sound_data[i]->volume !=
100) {
+
adjust_volume((int16_t*)(sound->raw_data + sound->raw_position),
+ sound->raw_data_size -
sound->raw_position,
+
handler->m_sound_data[i]->volume);
+ } else if (sound->envelopes != NULL) {
+ use_envelopes(sound,
sound->raw_data_size - sound->raw_position);
+ }
SDL_MixAudio(stream, (const
Uint8*)(sound->raw_data + sound->raw_position),
sound->raw_data_size -
sound->raw_position,
SDL_MIX_MAXVOLUME);
index = sound->raw_data_size -
sound->raw_position;
}
sound->raw_position += index;
+ sound->samples_played += index;
// Then we decode some data
int outsize = 0;
@@ -579,13 +660,21 @@
sound->position = 0;
}
- memset(sound->raw_data, 0,
sound->raw_data_size);
- int bytes_decoded =
avcodec_decode_audio(sound->cc,
+ if (sound->raw_data_size > 0)
memset(sound->raw_data, 0, sound->raw_data_size);
+
+ uint8_t* frame;
+ int framesize;
+
+ long bytes_decoded =
av_parser_parse(sound->parser, sound->cc, &frame, &framesize,
+ (uint8_t *)(sound->data
+ sound->position), sound->data_size - sound->position,
+ 0 ,0); //pts, dts
+
+ int tmp = 0;
+ tmp = avcodec_decode_audio(sound->cc,
(int16_t *)sound->raw_data,
&outsize,
- (uint8_t *)(sound->data +
sound->position),
- //AVCODEC_MAX_AUDIO_FRAME_SIZE);
- sound->data_size -
sound->position);
+ frame,
+ framesize);
if (bytes_decoded < 0) {
gnash::log_error("Error while decoding
MP3-stream\n");
@@ -688,28 +777,60 @@
sound->raw_position = 0;
+ // If the volume needs adjustments we call a
function to do that
+ if (handler->m_sound_data[i]->volume != 100) {
+
adjust_volume((int16_t*)(sound->raw_data + sound->raw_position),
+ sound->raw_data_size -
sound->raw_position,
+
handler->m_sound_data[i]->volume);
+ } else if (sound->envelopes != NULL) {
+ use_envelopes(sound, buffer_length -
index);
+ }
// Then we mix the newly decoded data
SDL_MixAudio((Uint8*)(stream+index),(const
Uint8*) sound->raw_data,
buffer_length - index,
SDL_MIX_MAXVOLUME);
+
sound->raw_position = buffer_length - index;
+ sound->samples_played += buffer_length - index;
+
// When the current sound has enough decoded data to
fill
// the buffer, we do just that.
} else if (sound->raw_data_size - sound->raw_position
>= buffer_length ) {
+ // If the volume needs adjustments we call a
function to do that
+ if (handler->m_sound_data[i]->volume != 100) {
+
adjust_volume((int16_t*)(sound->raw_data + sound->raw_position),
+ sound->raw_data_size -
sound->raw_position,
+
handler->m_sound_data[i]->volume);
+ } else if (sound->envelopes != NULL) {
+ use_envelopes(sound, buffer_length);
+ }
+
// Mix the raw data
SDL_MixAudio((Uint8*)(stream),(const Uint8*)
(sound->raw_data + sound->raw_position),
buffer_length,
SDL_MIX_MAXVOLUME);
+
sound->raw_position += buffer_length;
+ sound->samples_played += buffer_length;
+
// When the current sound doesn't have anymore data to
decode,
// and doesn't loop (anymore), but still got unplayed
data,
// we put the last data on the stream
} else if (sound->raw_data_size - sound->raw_position <
buffer_length && sound->raw_data_size > sound->raw_position) {
+ // If the volume needs adjustments we call a
function to do that
+ if (handler->m_sound_data[i]->volume != 100) {
+
adjust_volume((int16_t*)(sound->raw_data + sound->raw_position),
+ sound->raw_data_size -
sound->raw_position,
+
handler->m_sound_data[i]->volume);
+ } else if (sound->envelopes != NULL) {
+ use_envelopes(sound,
sound->raw_data_size - sound->raw_position);
+ }
+
// Mix the remaining data
SDL_MixAudio((Uint8*)(stream),(const Uint8*)
(sound->raw_data + sound->raw_position),
sound->raw_data_size -
sound->raw_position,
@@ -723,6 +844,7 @@
if (sound->position == sound->data_size &&
sound->loop_count == 0 && handler->m_sound_data[i]->format == 2) {
#ifdef USE_FFMPEG
avcodec_close(sound->cc);
+ av_parser_close(sound->parser);
#elif defined(USE_MAD)
mad_synth_finish(&sound->synth);
mad_frame_finish(&sound->frame);
Index: backend/sound_handler_sdl.h
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_sdl.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- backend/sound_handler_sdl.h 15 Oct 2006 09:11:20 -0000 1.3
+++ backend/sound_handler_sdl.h 16 Oct 2006 14:33:38 -0000 1.4
@@ -37,6 +37,7 @@
// ffmpeg stuff
AVCodec *codec;
AVCodecContext *cc;
+ AVCodecParserContext* parser;
#elif defined(USE_MAD)
// mad stuff
mad_stream stream;
@@ -62,8 +63,21 @@
// The decompressed data
uint8_t* raw_data;
+ // Numbers of loops
long loop_count;
+ // Offset, only used with mp3 streams
+ int offset;
+
+ // Envelopes
+ std::vector<gnash::sound_handler::sound_envelope>* envelopes;
+
+ // Current envelope
+ uint32_t current_env;
+
+ // Number if samples played
+ long samples_played;
+
} active_sound;
@@ -88,7 +102,7 @@
// sample rate
int sample_rate;
- // Volume, SWF range: 0-100, SDL range 0-128
+ // Volume for AS-sounds, range: 0-100
// It's the SWF range that is represented here
int volume;
@@ -130,7 +144,7 @@
// Play the index'd sample.
virtual void play_sound(int sound_handle, int loop_count, int offset,
- long start_position);
+ long start_position,
std::vector<sound_envelope>* envelopes);
virtual void stop_sound(int sound_handle);
Index: doc/C/internals.xml
===================================================================
RCS file: /sources/gnash/gnash/doc/C/internals.xml,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- doc/C/internals.xml 15 Oct 2006 16:13:57 -0000 1.26
+++ doc/C/internals.xml 16 Oct 2006 14:33:38 -0000 1.27
@@ -1752,12 +1752,12 @@
<sect3 id="soundparsing">
<title>Sound parsing</title>
<para>
- When Gnash parses a SWF-file, it hands over the sounds to the
- sound handler. Since the event-sounds are contained in one frame, the
- entire event-sound is retrieved at once, while a soundstream maybe not
- be completely retrived before the entire SWF-file has been parsed. But
- since the entire soundstream doesn't need to be present when playback
- start, it is not nessesary to wait.
+ When Gnash parses a SWF-file, it creates a sound handler if possible
+ and hands over the sounds to it. Since the event-sounds are contained
+ in one frame, the entire event-sound is retrieved at once, while
a
+ soundstream maybe not be completely retrived before the entire
+ SWF-file has been parsed. But since the entire soundstream doesn't need
+ to be present when playback start, it is not nessesary to wait.
</para>
</sect3>
@@ -1774,19 +1774,26 @@
</sect3>
<sect3 id="sdlsound">
- <title>The SDL backend</title>
+ <title>The SDL sound backend</title>
<para>
- The SDL only support event-sounds, and it is not very likely that
- it will ever support soundstream. When receiving an event-sound it
- decodes it at once, using either an internal ADPCM decoder, or the
- madlib mp3-decoder, and then stores the audio-output in a raw format
- readable by SDL. When playing a sound all the raw data is
- transfered to SDL which plays it. The advantage with the
- SDL backend is that it gives instant playback when asked (no
- decoding delay, and very little setup delay). The drawbacks are that it
- doesn't support soundstreams, and that it decodes everything when
- parsing, which means that there can be a considerable pause when
- decoding large audio blocks.
+ The current SDL sound backend has replaced the original sound
+ handler, based on SDL_mixer, which by design had some limitations,
+ making it difficult to implement needed features such as support
+ for soundstreams.
+ The SDL sound backend support both event-sounds and soundstreams,
+ and using gnash's internal ADPCM, and optionally MP3 support, using
+ either FFMPEG or LIBMAD.
+ When receiving sounddata it is stored without being decoded, unless
+ it is ADPCM, which is decoded in the parser. When playing, backend
+ relies on a function callback for retrieving output sound, which is
+ decoded and resampled if needed, and all soundoutput is mixed together.
+ The current SDL sound backend was made since gnash needed a working
+ sound backend as soon as possible, and since the gstreamer backend at
+ the time suffered from bugs and/or lack of features in gstreamer. The
+ result was the most complete and best soundhandler so far.
+ The advantages of the SDL soundhandler is speed, and ease of use,
+ while it's only real disadvantage is that it has to be compiled with
+ mp3 support, which some linux distrobutions will probably not like...
</para>
</sect3>
@@ -1794,10 +1801,9 @@
<title>The Gstreamer backend</title>
<para>
The Gstreamer backend, though not complete, supports both soundstreams
- and event-sounds. When receiving sounddata it stores it uncompressed,
- unless if its ADPCM event-sounds, then it decodes in the same manner
- that the SDL backend does. When the playback starts, the backend
- setup a
+ and event-sounds. When receiving sounddata it stores it compressed,
+ unless if its ADPCM event-sounds, which it decodes by the parser.
+ When the playback starts, the backend setup a
Gstreamer bin containing a decoder (and other things needed) and places
it in a Gstreamer pipeline, which plays the audio. All the sounddata is
not passed at once, but in small chuncks, and via callbacks the
Index: server/button_character_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/button_character_instance.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/button_character_instance.cpp 12 Oct 2006 16:37:25 -0000
1.4
+++ server/button_character_instance.cpp 16 Oct 2006 14:33:38 -0000
1.5
@@ -436,7 +436,7 @@
}
else
{
-
s->play_sound(bs.m_sam->m_sound_handler_id, bs.m_sound_style.m_loop_count, 0,
0);
+
s->play_sound(bs.m_sam->m_sound_handler_id, bs.m_sound_style.m_loop_count, 0,
0, (bs.m_sound_style.m_envelopes.size() == 0 ? NULL :
&bs.m_sound_style.m_envelopes));
}
}
}
Index: server/gnash.h
===================================================================
RCS file: /sources/gnash/gnash/server/gnash.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- server/gnash.h 14 Oct 2006 03:22:52 -0000 1.61
+++ server/gnash.h 16 Oct 2006 14:33:38 -0000 1.62
@@ -35,7 +35,7 @@
//
//
-/* $Id: gnash.h,v 1.61 2006/10/14 03:22:52 nihilus Exp $ */
+/* $Id: gnash.h,v 1.62 2006/10/16 14:33:38 tgc Exp $ */
/// \mainpage
///
@@ -404,6 +404,14 @@
class DSOEXPORT sound_handler
{
public:
+
+ struct sound_envelope
+ {
+ uint32_t m_mark44;
+ uint16_t m_level0;
+ uint16_t m_level1;
+ };
+
enum format_type
{
FORMAT_RAW = 0, // unspecified format. Useful for
8-bit sounds???
@@ -442,7 +450,7 @@
// gnash calls this when it wants you to play the defined sound.
// loop_count == 0 means play the sound once (1 means play it twice,
etc)
- virtual void play_sound(int sound_handle, int loop_count, int
secondOffset, long start) = 0;
+ virtual void play_sound(int sound_handle, int loop_count, int
secondOffset, long start, std::vector<sound_envelope>* envelopes) = 0;
// stops all sounds currently playing in a SWF file without
stopping the playhead.
// Sounds set to stream will resume playing as the playhead moves
over the frames they are in.
Index: server/sound.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sound.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/sound.cpp 26 Aug 2006 18:32:58 -0000 1.18
+++ server/sound.cpp 16 Oct 2006 14:33:38 -0000 1.19
@@ -73,7 +73,22 @@
if (has_in_point) { in_point = in->read_u32(); }
if (has_out_point) { out_point = in->read_u32(); }
if (has_loops) { m_loop_count = in->read_u16(); }
- // if (has_envelope) { env_count = read_uint8(); read envelope entries;
}
+
+ if (has_envelope)
+ {
+ int nPoints = in->read_u8();
+ m_envelopes.resize(nPoints);
+ for (int i=0; i < nPoints; i++)
+ {
+ m_envelopes[i].m_mark44 = in->read_u32();
+ m_envelopes[i].m_level0 = in->read_u16();
+ m_envelopes[i].m_level1 = in->read_u16();
+ }
+ }
+ else
+ {
+ m_envelopes.resize(0);
+ }
m_handler_id = sam->m_sound_handler_id;
m->add_execute_tag(this);
@@ -93,7 +108,7 @@
}
else
{
- s_sound_handler->play_sound(m_handler_id, m_loop_count,
0,0);
+ s_sound_handler->play_sound(m_handler_id, m_loop_count,
0,0, (m_envelopes.size() == 0 ? NULL : &m_envelopes));
}
}
}
@@ -119,22 +134,10 @@
using globals::s_sound_handler;
if (s_sound_handler)
{
- s_sound_handler->play_sound(m_handler_id, 0, 0, m_start);
+ s_sound_handler->play_sound(m_handler_id, 0, 0, m_start, NULL);
}
}
-
- // void define_button_sound(...) ???
-
-
-// @@ currently not implemented
-// void sound_stream_loader(stream* in, int tag_type, movie_definition*
m)
-// // Load the various stream-related tags: SoundStreamHead,
-// // SoundStreamHead2, SoundStreamBlock.
-// {
-// }
-
-
//
// ADPCM
//
Index: server/sound.h
===================================================================
RCS file: /sources/gnash/gnash/server/sound.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/sound.h 26 Aug 2006 18:45:50 -0000 1.4
+++ server/sound.h 16 Oct 2006 14:33:38 -0000 1.5
@@ -14,7 +14,6 @@
#include "impl.h"
#include "execute_tag.h" // for sound tags
-
namespace gnash {
class sound_sample_impl : public sound_sample
@@ -38,6 +37,10 @@
uint16_t m_handler_id;
int m_loop_count;
bool m_stop_playback;
+ std::vector<sound_handler::sound_envelope> m_envelopes;
+
+ // envelopes for the current sound instance
+ uint32_t* envelopes;
start_sound_tag()
:
Index: server/asobj/ASSound.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/ASSound.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/asobj/ASSound.cpp 26 Aug 2006 22:58:12 -0000 1.3
+++ server/asobj/ASSound.cpp 16 Oct 2006 14:33:38 -0000 1.4
@@ -157,7 +157,7 @@
sound_as_object* so = (sound_as_object*)
(as_object*) fn.this_ptr;
assert(so);
- s->play_sound(so->sound_id, loop, secondOffset, 0);
+ s->play_sound(so->sound_id, loop, secondOffset, 0,
NULL);
}
}
Index: server/parser/button_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/button_character_def.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/parser/button_character_def.cpp 2 Oct 2006 16:28:11 -0000
1.3
+++ server/parser/button_character_def.cpp 16 Oct 2006 14:33:38 -0000
1.4
@@ -95,6 +95,7 @@
button_character_definition::button_character_definition()
:
m_sound(NULL)
+
// Constructor.
{
}
@@ -118,6 +119,7 @@
if (m_has_in_point) m_in_point = in->read_u32();
if (m_has_out_point) m_out_point = in->read_u32();
if (m_has_loops) m_loop_count = in->read_u16();
+
if (m_has_envelope)
{
int nPoints = in->read_u8();
@@ -134,6 +136,7 @@
m_envelopes.resize(0);
}
+
IF_VERBOSE_PARSE(
log_parse(" has_envelope = %d", m_has_envelope);
log_parse(" has_loops = %d", m_has_loops);
Index: server/parser/button_character_def.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/button_character_def.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- server/parser/button_character_def.h 12 Oct 2006 16:37:25 -0000
1.2
+++ server/parser/button_character_def.h 16 Oct 2006 14:33:38 -0000
1.3
@@ -63,12 +63,6 @@
class button_character_definition : public character_def
{
public:
- struct sound_envelope
- {
- uint32_t m_mark44;
- uint16_t m_level0;
- uint16_t m_level1;
- };
struct sound_info
{
@@ -83,7 +77,7 @@
uint32_t m_in_point;
uint32_t m_out_point;
uint16_t m_loop_count;
- std::vector<sound_envelope> m_envelopes;
+ std::vector<sound_handler::sound_envelope> m_envelopes;
};
struct button_sound_info
- [Gnash-commit] gnash ChangeLog backend/sound_handler_gst.cpp b...,
Tomas Groth <=