Update with current status
[gnash.git] / libcore / swf / StartSoundTag.h
blob6a2454308877dfbd96224df7fbe21ec23bda5fc9
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
19 #ifndef GNASH_SWF_STARTSOUND_TAG_H
20 #define GNASH_SWF_STARTSOUND_TAG_H
22 #include "ControlTag.h" // for inheritance
23 #include "SWF.h" // for TagType definition
24 #include "SoundInfoRecord.h"
26 #include <cstdint> // for std::uint16_t and friends
29 // Forward declarations
30 namespace gnash {
31 class SWFStream;
32 class movie_definition;
33 class sound_sample;
34 class RunResources;
37 namespace gnash {
38 namespace SWF {
40 /// SWF Tag StartSound (15)
42 /// See http://sswf.sourceforge.net/SWFalexref.html#tag_startsound
43 ///
44 class StartSoundTag : public ControlTag
46 /// This should be a reference to an earlier DefineSound tag id
47 /// but in this implementation is instead the sound_handler specific
48 /// identifier corresponding to it.
49 /// movie_definition keeps a mapping between SWF-defined DefineSound
50 /// identifier and sound_handler-provided identifier.
51 /// This one is the latter, probably so with the intention of avoiding
52 /// a lookup at every execution...
53 ///
54 std::uint16_t m_handler_id;
56 /// Create a StartSoundTag for starting the given sound sample
58 /// The stream is assumed to be positioned right after the
59 /// sound_id field of the tag structure.
60 ///
61 /// @param in The SWFStream to initialize the tag from.
62 /// @param sound_handler_id
63 /// Sound sample identifier as provided by sound_handler (sic!)
64 ///
65 StartSoundTag(SWFStream& in, int sound_id)
67 m_handler_id(sound_id)
69 _soundInfo.read(in);
72 SoundInfoRecord _soundInfo;
74 public:
76 // This is not a state tag.
77 void executeActions(MovieClip* /* m */, DisplayList& /* dlist */) const;
79 /// Load a SWF::STARTSOUND tag.
80 static void loader(SWFStream& in, TagType tag, movie_definition& m,
81 const RunResources& r);
85 /// StartSound2Tag (SWF9)
87 /// Very similar to StartSoundTag, but uses a SoundClassName instead of
88 /// DisplayObject ID. This is not implemented.
89 class StartSound2Tag
91 public:
93 /// Load a SWF::STARTSOUND2 tag.
94 static void loader(SWFStream& in, TagType tag, movie_definition& m,
95 const RunResources& r);
98 } // namespace gnash::SWF
99 } // namespace gnash
102 #endif // GNASH_SWF_STARTSOUND_TAG_H
105 // Local Variables:
106 // mode: C++
107 // indent-tabs-mode: t
108 // End: