Gnash  0.8.11dev
DefineButtonSoundTag.h
Go to the documentation of this file.
1 // DefineButtonSoundTag.h: sounds for Button DisplayObjects.
2 //
3 // Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 
21 #ifndef GNASH_SWF_DEFINEBUTTONSOUNDTAG_H
22 #define GNASH_SWF_DEFINEBUTTONSOUNDTAG_H
23 
24 #include "SoundInfoRecord.h"
25 #include "SWF.h"
26 
27 #include <vector>
28 
29 namespace gnash {
30  class SWFStream;
31  class RunResources;
32  class movie_definition;
33  class sound_sample;
34 }
35 
36 namespace gnash {
37 namespace SWF {
38 
40 {
41 
42 public:
43 
44  struct ButtonSound
45  {
46  std::uint16_t soundID;
49 
51  :
52  soundID(0),
53  sample(nullptr)
54  {}
55 
56  };
57 
58  typedef std::vector<ButtonSound> Sounds;
59 
60  static void loader(SWFStream& in, TagType tag, movie_definition& m,
61  const RunResources& r);
62 
63  const ButtonSound& getSound(Sounds::size_type index) const
64  {
65  // There should be exactly four sounds.
66  assert (index < 4);
67  return _sounds[index];
68  }
69 
70 private:
71 
73  //
76 
77  void read(SWFStream& in, movie_definition& m);
78 
79  Sounds _sounds;
80 
81 };
82 
83 }
84 }
85 
86 #endif
gnash::log_swferror
void log_swferror(StringType msg, Args... args)
Definition: log.h:325
gnash::SWF::DefineButtonSoundTag
Definition: DefineButtonSoundTag.h:40
gnash::SWF::DefineButtonSoundTag::Sounds
std::vector< ButtonSound > Sounds
Definition: DefineButtonSoundTag.h:58
gnash::SWF::TagType
TagType
SWF tag types. Symbolic names copied from Ming.
Definition: SWF.h:31
DefineButtonSoundTag.h
gnash::SWF::DefinitionTag
Immutable data representing the definition of a movie display element.
Definition: DefinitionTag.h:48
SoundInfoRecord.h
gnash::SWF::DefineButtonSoundTag::ButtonSound::soundID
std::uint16_t soundID
Definition: DefineButtonSoundTag.h:46
gnash::typeName
std::string typeName(const T &inst)
Definition: utility.h:93
_
#define _(String)
Definition: log.h:44
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::key::m
@ m
Definition: GnashKey.h:159
utility.h
gnash::SWF::DefineButtonTag
A class for parsing DefineButton and DefineButton2 tags.
Definition: DefineButtonTag.h:198
gnash::SWF::DEFINEBUTTONSOUND
@ DEFINEBUTTONSOUND
Definition: SWF.h:49
gnash::movie_definition
Client program's interface to the definition of a movie or sprite.
Definition: movie_definition.h:96
gnash::SWF::DefineButtonTag::hasSound
bool hasSound() const
Does this button have an associated DefineButtonSoundTag?
Definition: DefineButtonTag.h:222
IF_VERBOSE_MALFORMED_SWF
#define IF_VERBOSE_MALFORMED_SWF(x)
Definition: log.h:404
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::SWF::DefineButtonSoundTag::ButtonSound
Definition: DefineButtonSoundTag.h:45
DefineButtonTag.h
gnash::SWF::DefineButtonSoundTag::ButtonSound::ButtonSound
ButtonSound()
Definition: DefineButtonSoundTag.h:50
gnash::SWF::DefineButtonTag::addSoundTag
void addSoundTag(std::unique_ptr< SWF::DefineButtonSoundTag > soundTag)
Definition: DefineButtonTag.h:226
gnash::RunResources
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:54
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
gnash::SWF::DefineButtonSoundTag::getSound
const ButtonSound & getSound(Sounds::size_type index) const
Definition: DefineButtonSoundTag.h:63
gnash::SWF::DefineButtonSoundTag::ButtonSound::sample
sound_sample * sample
Definition: DefineButtonSoundTag.h:47
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::SWF::DefineButtonSoundTag::loader
static void loader(SWFStream &in, TagType tag, movie_definition &m, const RunResources &r)
Definition: DefineButtonSoundTag.cpp:41
movie_definition.h
gnash::SWFStream
SWF stream wrapper class.
Definition: SWFStream.h:59
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
SWFStream.h
gnash::SWF::DefineButtonSoundTag::ButtonSound::soundInfo
SoundInfoRecord soundInfo
Definition: DefineButtonSoundTag.h:48