00001 /* $Id: sound_music_track.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */ 00002 /* 00003 Copyright (C) 2003 - 2012 by David White <dave@whitevine.net> 00004 Copyright (C) 2009 - 2012 by Ignacio R. Morelle <shadowm2006@gmail.com> 00005 Part of the Battle for Wesnoth Project http://www.wesnoth.org/ 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY. 00013 00014 See the COPYING file for more details. 00015 */ 00016 00017 #ifndef SOUND_MUSIC_TRACK_HPP_INCLUDED 00018 #define SOUND_MUSIC_TRACK_HPP_INCLUDED 00019 00020 #include <string> 00021 00022 class config; 00023 00024 namespace sound { 00025 00026 /** 00027 * Internal representation of music tracks. 00028 */ 00029 class music_track 00030 { 00031 public: 00032 music_track(); 00033 music_track(const config& node); 00034 music_track(const std::string& v_name); 00035 void write(config& parent_node, bool append); 00036 00037 bool valid() const { return file_path_.empty() != true; } 00038 00039 bool append() const { return append_; } 00040 bool immediate() const { return immediate_; } 00041 bool play_once() const { return once_; } 00042 int ms_before() const { return ms_before_; } 00043 int ms_after() const { return ms_after_; } 00044 00045 const std::string& file_path() const { return file_path_; } 00046 const std::string& id() const { return id_; } 00047 00048 void set_play_once(bool v) { once_ = v; } 00049 00050 private: 00051 void resolve(); 00052 00053 std::string id_; 00054 std::string file_path_; 00055 00056 int ms_before_, ms_after_; 00057 00058 bool once_; 00059 bool append_; 00060 bool immediate_; 00061 }; 00062 00063 } /* end namespace sound */ 00064 00065 inline bool operator==(const sound::music_track& a, const sound::music_track& b) { 00066 return a.file_path() == b.file_path(); 00067 } 00068 inline bool operator!=(const sound::music_track& a, const sound::music_track& b) { 00069 return a.file_path() != b.file_path(); 00070 } 00071 00072 #endif /* ! SOUND_MUSIC_TRACK_HPP_INCLUDED */
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:03:10 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |