sound.hpp

Go to the documentation of this file.
00001 /* $Id: sound.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */
00002 /*
00003    Copyright (C) 2003 - 2012 by David White <dave@whitevine.net>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
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 2 of the License, or
00009    (at your option) any later version.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY.
00012 
00013    See the COPYING file for more details.
00014 */
00015 #ifndef SOUND_HPP_INCLUDED
00016 #define SOUND_HPP_INCLUDED
00017 
00018 #include "events.hpp"
00019 
00020 #include <string>
00021 
00022 class config;
00023 
00024 namespace sound {
00025 
00026 enum channel_group {
00027     NULL_CHANNEL = -1,
00028     SOUND_SOURCES = 0,
00029     SOUND_BELL,
00030     SOUND_TIMER,
00031     SOUND_UI,
00032     SOUND_FX
00033 };
00034 
00035 bool init_sound();
00036 void close_sound();
00037 void reset_sound();
00038 
00039 void stop_music();
00040 void stop_sound();
00041 void stop_UI_sound();
00042 void stop_bell();
00043 
00044 // Read config entry, alter track list accordingly.
00045 void play_music_config(const config &music_node);
00046 // Act on any track list changes from above.
00047 void commit_music_changes();
00048 
00049 // Play this particular music file over and over and over.
00050 void play_music_repeatedly(const std::string& id);
00051 // Play this particular music file once, then silence.
00052 void play_music_once(const std::string& id);
00053 // Empty the playlist
00054 void empty_playlist();
00055 // Start playing current music.
00056 void play_music();
00057 
00058 // Change parameters of a playing sound, given its id
00059 void reposition_sound(int id, unsigned int distance);
00060 #define DISTANCE_SILENT     255
00061 
00062 // Check if there's a sound associated with given id playing
00063 bool is_sound_playing(int id);
00064 
00065 // Stop sound associated with a given id
00066 void stop_sound(int id);
00067 
00068 // Play sound, or random one of comma-separated sounds.
00069 void play_sound(const std::string& files, channel_group group = SOUND_FX, unsigned int repeats = 0);
00070 
00071 // Play sound, or random one of comma-separated sounds. Use specified
00072 // distance and associate it with specified id (of a sound source).
00073 void play_sound_positioned(const std::string &files, int id, int repeats, unsigned int distance);
00074 
00075 // Play sound, or random one of comma-separated sounds in bell channel
00076 void play_bell(const std::string& files);
00077 
00078 // Play sound, or random one of comma-separated sounds in timer channel
00079 void play_timer(const std::string& files, int loop_ticks, int fadein_ticks);
00080 
00081 // Play user-interface sound, or random one of comma-separated sounds.
00082 void play_UI_sound(const std::string& files);
00083 
00084 // A class to periodically check for new music that needs to be played
00085 class music_thinker : public events::pump_monitor {
00086     void process(events::pump_info &info);
00087 };
00088 
00089 // Save music playlist for snapshot
00090 void write_music_play_list(config& snapshot);
00091 
00092 void set_music_volume(int vol);
00093 void set_sound_volume(int vol);
00094 void set_bell_volume(int vol);
00095 void set_UI_volume(int vol);
00096 
00097 }
00098 
00099 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:03:10 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs