The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
sound_music_track.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2016 by David White <[email protected]>
3  Copyright (C) 2009 - 2016 by Ignacio R. Morelle <[email protected]>
4  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
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 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #ifndef SOUND_MUSIC_TRACK_HPP_INCLUDED
17 #define SOUND_MUSIC_TRACK_HPP_INCLUDED
18 
19 #include <string>
20 
21 class config;
22 
23 namespace sound {
24 
25 /**
26  * Internal representation of music tracks.
27  */
29 {
30 public:
31  music_track();
32  music_track(const config& node);
33  music_track(const std::string& v_name);
34  void write(config& parent_node, bool append) const;
35 
36  bool valid() const { return file_path_.empty() != true; }
37 
38  bool append() const { return append_; }
39  bool immediate() const { return immediate_; }
40  bool shuffle() const { return shuffle_; }
41  bool play_once() const { return once_; }
42  int ms_before() const { return ms_before_; }
43  int ms_after() const { return ms_after_; }
44 
45  const std::string& file_path() const { return file_path_; }
46  const std::string& id() const { return id_; }
47  const std::string& title() const { return title_; }
48 
49  void set_play_once(bool v) { once_ = v; }
50 
51 private:
52  void resolve();
53 
57 
59 
60  bool once_;
61  bool append_;
62  bool immediate_;
63  bool shuffle_;
64 };
65 
66 } /* end namespace sound */
67 
68 inline bool operator==(const sound::music_track& a, const sound::music_track& b) {
69  return a.file_path() == b.file_path();
70 }
71 inline bool operator!=(const sound::music_track& a, const sound::music_track& b) {
72  return a.file_path() != b.file_path();
73 }
74 
75 #endif /* ! SOUND_MUSIC_TRACK_HPP_INCLUDED */
bool operator==(const sound::music_track &a, const sound::music_track &b)
bool operator!=(const sound::music_track &a, const sound::music_track &b)
void set_play_once(bool v)
const std::string & title() const
Audio output for sound and music.
Definition: sound.cpp:43
GLdouble GLdouble GLdouble b
Definition: glew.h:6966
const GLdouble * v
Definition: glew.h:1359
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:7319
const std::string & file_path() const
void write(config &parent_node, bool append) const
Internal representation of music tracks.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
GLsizei const GLcharARB ** string
Definition: glew.h:4503
const std::string & id() const