Gnash
0.8.10
|
00001 // DefineButtonSoundTag.h: sounds for Button DisplayObjects. 00002 // 00003 // Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 00004 // Free Software Foundation, Inc 00005 // 00006 // This program is free software; you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 3 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // This program is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with this program; if not, write to the Free Software 00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 // 00020 00021 #ifndef GNASH_SWF_DEFINEBUTTONSOUNDTAG_H 00022 #define GNASH_SWF_DEFINEBUTTONSOUNDTAG_H 00023 00024 #include "SoundInfoRecord.h" 00025 #include "SWF.h" 00026 00027 #include <vector> 00028 00029 namespace gnash { 00030 class SWFStream; 00031 class RunResources; 00032 class movie_definition; 00033 class sound_sample; 00034 } 00035 00036 namespace gnash { 00037 namespace SWF { 00038 00039 class DefineButtonSoundTag 00040 { 00041 00042 public: 00043 00044 struct ButtonSound 00045 { 00046 boost::uint16_t soundID; 00047 sound_sample* sample; 00048 SoundInfoRecord soundInfo; 00049 00050 ButtonSound() 00051 : 00052 soundID(0), 00053 sample(0) 00054 {} 00055 00056 }; 00057 00058 typedef std::vector<ButtonSound> Sounds; 00059 00060 static void loader(SWFStream& in, TagType tag, movie_definition& m, 00061 const RunResources& r); 00062 00063 const ButtonSound& getSound(Sounds::size_type index) const 00064 { 00065 // There should be exactly four sounds. 00066 assert (index < 4); 00067 return _sounds[index]; 00068 } 00069 00070 private: 00071 00073 // 00075 DefineButtonSoundTag(SWFStream& in, movie_definition& m); 00076 00077 void read(SWFStream& in, movie_definition& m); 00078 00079 Sounds _sounds; 00080 00081 }; 00082 00083 } 00084 } 00085 00086 #endif