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
Client program&#39;s interface to the definition of a movie or sprite.
Definition: movie_definition.h:95
std::uint16_t soundID
Definition: DefineButtonSoundTag.h:46
TagType
SWF tag types. Symbolic names copied from Ming.
Definition: SWF.h:30
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
Definition: GnashKey.h:164
Definition: DefineButtonSoundTag.h:44
Definition: DefineButtonSoundTag.h:39
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:53
sound_sample * sample
Definition: DefineButtonSoundTag.h:47
Definition: SoundInfoRecord.h:35
ButtonSound()
Definition: DefineButtonSoundTag.h:50
const ButtonSound & getSound(Sounds::size_type index) const
Definition: DefineButtonSoundTag.h:63
SoundInfoRecord soundInfo
Definition: DefineButtonSoundTag.h:48
Definition: GnashKey.h:159
static void loader(SWFStream &in, TagType tag, movie_definition &m, const RunResources &r)
Definition: DefineButtonSoundTag.cpp:41
An identifier for a sound sample managed by a sound_handler.
Definition: sound_definition.h:61
Definition: GnashKey.h:331
SWF stream wrapper class.
Definition: SWFStream.h:58
std::vector< ButtonSound > Sounds
Definition: DefineButtonSoundTag.h:58