The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
sound.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2016 by David White <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 #ifndef SOUND_HPP_INCLUDED
15 #define SOUND_HPP_INCLUDED
16 
17 #include "events.hpp"
18 
19 #include <string>
20 
21 class config;
22 
23 namespace sound {
24 
32 };
33 
34 bool init_sound();
35 void close_sound();
36 void reset_sound();
37 
38 void stop_music();
39 void stop_sound();
40 void stop_UI_sound();
41 void stop_bell();
42 
43 // Read config entry, alter track list accordingly.
44 void play_music_config(const config &music_node);
45 // Act on any track list changes from above.
47 
48 // Play this particular music file over and over and over.
49 void play_music_repeatedly(const std::string& id);
50 // Play this particular music file once, then silence.
51 void play_music_once(const std::string& id);
52 // Empty the playlist
53 void empty_playlist();
54 // Start playing current music.
55 void play_music();
56 
57 // Change parameters of a playing sound, given its id
58 void reposition_sound(int id, unsigned int distance);
59 #define DISTANCE_SILENT 255
60 
61 // Check if there's a sound associated with given id playing
62 bool is_sound_playing(int id);
63 
64 // Stop sound associated with a given id
65 void stop_sound(int id);
66 
67 // Play sound, or random one of comma-separated sounds.
68 void play_sound(const std::string& files, channel_group group = SOUND_FX, unsigned int repeats = 0);
69 
70 // Play sound, or random one of comma-separated sounds. Use specified
71 // distance and associate it with specified id (of a sound source).
72 void play_sound_positioned(const std::string &files, int id, int repeats, unsigned int distance);
73 
74 // Play sound, or random one of comma-separated sounds in bell channel
75 void play_bell(const std::string& files);
76 
77 // Play sound, or random one of comma-separated sounds in timer channel
78 void play_timer(const std::string& files, int loop_ticks, int fadein_ticks);
79 
80 // Play user-interface sound, or random one of comma-separated sounds.
81 void play_UI_sound(const std::string& files);
82 
83 // A class to periodically check for new music that needs to be played
86 };
87 
88 // Save music playlist for snapshot
89 void write_music_play_list(config& snapshot);
90 
91 void set_music_volume(int vol);
92 void set_sound_volume(int vol);
93 void set_bell_volume(int vol);
94 void set_UI_volume(int vol);
95 
96 }
97 
98 #endif
void empty_playlist()
Definition: sound.cpp:480
void close_sound()
Definition: sound.cpp:362
bool is_sound_playing(int id)
Definition: sound.cpp:678
void play_sound_positioned(const std::string &files, int id, int repeats, unsigned int distance)
Definition: sound.cpp:689
void stop_music()
Definition: sound.cpp:411
channel_group
Definition: sound.hpp:25
logger & info()
Definition: log.cpp:91
void set_UI_volume(int vol)
Definition: sound.cpp:890
void stop_sound()
Definition: sound.cpp:422
Audio output for sound and music.
Definition: sound.cpp:43
void play_music_once(const std::string &file)
Definition: sound.cpp:472
void write_music_play_list(config &snapshot)
Definition: sound.cpp:644
void reposition_sound(int id, unsigned int distance)
Definition: sound.cpp:654
void play_sound(const std::string &files, channel_group group, unsigned int repeats)
Definition: sound.cpp:818
bool init_sound()
Definition: sound.cpp:314
void reset_sound()
Definition: sound.cpp:389
void set_bell_volume(int vol)
Definition: sound.cpp:879
void stop_UI_sound()
Definition: sound.cpp:457
void play_music()
Definition: sound.cpp:485
void play_music_config(const config &music_node)
Definition: sound.cpp:552
void set_sound_volume(int vol)
Definition: sound.cpp:859
void set_music_volume(int vol)
Definition: sound.cpp:849
void process(events::pump_info &info)
Definition: sound.cpp:598
void stop_bell()
Definition: sound.cpp:441
void play_bell(const std::string &files)
Definition: sound.cpp:826
GLboolean GLuint group
Definition: glew.h:2589
void play_timer(const std::string &files, int loop_ticks, int fadein_ticks)
Definition: sound.cpp:834
void play_music_repeatedly(const std::string &id)
Definition: sound.cpp:536
void play_UI_sound(const std::string &files)
Definition: sound.cpp:842
void commit_music_changes()
Definition: sound.cpp:621
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