Gnash  0.8.11dev
StartSoundTag.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc.
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef GNASH_SWF_STARTSOUND_TAG_H
20 #define GNASH_SWF_STARTSOUND_TAG_H
21 
22 #include "ControlTag.h" // for inheritance
23 #include "SWF.h" // for TagType definition
24 #include "SoundInfoRecord.h"
25 
26 #include <cstdint> // for std::uint16_t and friends
27 
28 
29 // Forward declarations
30 namespace gnash {
31  class SWFStream;
32  class movie_definition;
33  class sound_sample;
34  class RunResources;
35 }
36 
37 namespace gnash {
38 namespace SWF {
39 
41 //
44 class StartSoundTag : public ControlTag
45 {
54  std::uint16_t m_handler_id;
55 
57  //
65  StartSoundTag(SWFStream& in, int sound_id)
66  :
67  m_handler_id(sound_id)
68  {
69  _soundInfo.read(in);
70  }
71 
72  SoundInfoRecord _soundInfo;
73 
74 public:
75 
76  // This is not a state tag.
77  void executeActions(MovieClip* /* m */, DisplayList& /* dlist */) const;
78 
80  static void loader(SWFStream& in, TagType tag, movie_definition& m,
81  const RunResources& r);
82 
83 };
84 
86 //
90 {
91 public:
92 
94  static void loader(SWFStream& in, TagType tag, movie_definition& m,
95  const RunResources& r);
96 };
97 
98 } // namespace gnash::SWF
99 } // namespace gnash
100 
101 
102 #endif // GNASH_SWF_STARTSOUND_TAG_H
103 
104 
105 // Local Variables:
106 // mode: C++
107 // indent-tabs-mode: t
108 // End:
sound_handler.h
gnash::SWF::SoundInfoRecord::loopCount
int loopCount
Number of loops started by an execution of this tag.
Definition: SoundInfoRecord.h:66
movie_root.h
gnash::SWF::ControlTag
Control tags are swf tags that control the operation of the movie.
Definition: ControlTag.h:44
gnash::SWFStream::skip_to_tag_end
void skip_to_tag_end()
Discard all bytes up to end of tag.
Definition: SWFStream.h:354
ControlTag.h
gnash::sound::sound_handler::startSound
void startSound(int id, int loops, const SoundEnvelopes *env, bool allowMultiple, unsigned int inPoint=0, unsigned int outPoint=std::numeric_limits< unsigned int >::max())
Start playback of an event sound.
Definition: sound_handler.cpp:517
gnash::log_swferror
void log_swferror(StringType msg, Args... args)
Definition: log.h:325
gnash::SWF::StartSoundTag::executeActions
void executeActions(MovieClip *, DisplayList &) const
Execute Action tags.
Definition: StartSoundTag.cpp:80
gnash::SWF::STARTSOUND
@ STARTSOUND
Definition: SWF.h:47
gnash::SWF::TagType
TagType
SWF tag types. Symbolic names copied from Ming.
Definition: SWF.h:31
gnash::SWF::StartSoundTag::loader
static void loader(SWFStream &in, TagType tag, movie_definition &m, const RunResources &r)
Load a SWF::STARTSOUND tag.
Definition: StartSoundTag.cpp:39
gnash::sound::sound_handler::stopEventSound
virtual void stopEventSound(int sound_handle)
Remove scheduled requests to play the specified sound buffer slot.
Definition: sound_handler.cpp:283
gnash::SWF::STARTSOUND2
@ STARTSOUND2
Definition: SWF.h:115
SoundInfoRecord.h
_
#define _(String)
Definition: log.h:44
gnash::SWFStream::read_string
void read_string(std::string &to)
Reads a null-terminated string from the given file and assigns it to the given std::string,...
Definition: SWFStream.cpp:395
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::SWF::SoundInfoRecord::read
void read(SWFStream &in)
Definition: SoundInfoRecord.cpp:32
gnash::SWF::SoundInfoRecord::inPoint
unsigned int inPoint
In point, 44100 for one second.
Definition: SoundInfoRecord.h:79
gnash::key::m
@ m
Definition: GnashKey.h:159
gnash::MovieClip
A MovieClip is a container for DisplayObjects.
Definition: MovieClip.h:84
gnash::movie_definition
Client program's interface to the definition of a movie or sprite.
Definition: movie_definition.h:96
IF_VERBOSE_MALFORMED_SWF
#define IF_VERBOSE_MALFORMED_SWF(x)
Definition: log.h:404
gnash::DisplayList
A list of on-stage DisplayObjects, ordered by depth.
Definition: DisplayList.h:65
gnash::SWF::SoundInfoRecord
Definition: SoundInfoRecord.h:36
gnash::sound_sample
An identifier for a sound sample managed by a sound_handler.
Definition: sound_definition.h:62
gnash::key::r
@ r
Definition: GnashKey.h:164
gnash::getRunResources
const RunResources & getRunResources(const as_object &o)
Get the RunResources from an as_object.
Definition: as_object.cpp:1142
gnash::SWF::StartSoundTag
SWF Tag StartSound (15)
Definition: StartSoundTag.h:45
MovieClip.h
gnash::SWF::StartSound2Tag::loader
static void loader(SWFStream &in, TagType tag, movie_definition &m, const RunResources &r)
Load a SWF::STARTSOUND2 tag.
Definition: StartSoundTag.cpp:110
gnash::RunResources
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:54
gnash::sound_sample::m_sound_handler_id
int m_sound_handler_id
Definition: sound_definition.h:65
gnash::SWF::SoundInfoRecord::outPoint
unsigned int outPoint
Out point, 44100 for one second.
Definition: SoundInfoRecord.h:87
gnash::SWF::SoundInfoRecord::envelopes
sound::SoundEnvelopes envelopes
Sound effects (envelopes) for this start of the sound.
Definition: SoundInfoRecord.h:93
IF_VERBOSE_PARSE
#define IF_VERBOSE_PARSE(x)
Definition: log.h:378
gnash::log_parse
void log_parse(StringType msg, Args... args)
Definition: log.h:313
StartSoundTag.h
log.h
gnash::sound::sound_handler
Sound mixer.
Definition: sound_handler.h:88
sound_definition.h
gnash::getObject
as_object * getObject(const DisplayObject *d)
Return the as_object associated with a DisplayObject if it exists.
Definition: DisplayObject.h:1160
SWF.h
gnash::SWFStream::read_u16
std::uint16_t read_u16()
Read a aligned unsigned 16-bit value from the stream.
Definition: SWFStream.cpp:332
RunResources.h
gnash::sound::SoundEnvelopes
std::vector< SoundEnvelope > SoundEnvelopes
A vector of SoundEnvelope objects.
Definition: SoundEnvelope.h:60
gnash::SWF::SoundInfoRecord::stopPlayback
bool stopPlayback
If true this tag actually stops the sound rather then playing it.
Definition: SoundInfoRecord.h:73
gnash::SWF::SoundInfoRecord::noMultiple
bool noMultiple
Definition: SoundInfoRecord.h:53
movie_definition.h
gnash::RunResources::soundHandler
sound::sound_handler * soundHandler() const
Get a pointer to a sound::sound_handler set by a hosting application.
Definition: RunResources.h:96
gnash::SWFStream
SWF stream wrapper class.
Definition: SWFStream.h:59
gnash::SWFStream::align
void align()
Consume all bits of current byte.
Definition: SWFStream.h:135
gnash::SWFStream::ensureBytes
void ensureBytes(unsigned long needed)
Ensure the requested number of bytes are available for an aligned read in the currently opened tag.
Definition: SWFStream.cpp:50
gnash::key::SWF
@ SWF
Definition: GnashKey.h:331
gnash::log_unimpl
void log_unimpl(StringType msg, Args... args)
Definition: log.h:289
SWFStream.h
gnash::SWF::StartSound2Tag
StartSound2Tag (SWF9)
Definition: StartSoundTag.h:90