sound.hpp

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

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs