do a reversion for Sapient

This commit is contained in:
Ali El Gariani 2007-04-25 01:20:00 +00:00
parent c997de74b4
commit 1d7be21104
4 changed files with 11 additions and 84 deletions

View file

@ -67,9 +67,6 @@ manager::manager()
read(prefs, *stream);
set_music_volume(music_volume());
set_sound_volume(sound_volume());
set_UI_volume(UI_volume());
set_bell_volume(bell_volume());
set_sound_sources_volume(sound_sources_volume());
set_show_haloes(prefs["show_haloes"] != "no");
if(prefs["remember_timer_settings"] != "yes") {
@ -304,40 +301,6 @@ void set_UI_volume(int vol)
sound::set_UI_volume(UI_volume());
}
int sound_sources_volume()
{
return lexical_cast_default<int>(prefs["sound_sources_volume"], 100);
}
void set_sound_sources_volume(int vol)
{
prefs["sound_sources_volume"] = lexical_cast_default<std::string>(vol, "100");
sound::set_sound_sources_volume(sound_sources_volume());
}
bool sound_sources_on()
{
return prefs["sound_sources"] != "no";
}
bool set_sound_sources(bool ison)
{
if(!sound_sources_on() && ison) {
prefs["sound_sources"] = "yes";
if(!sound_on() && !music_on() && !turn_bell() && !UI_sound_on()) {
if(!sound::init_sound()) {
prefs["sound_sources"] = "no";
return false;
}
}
} else if(sound_sources_on() && !ison) {
prefs["sound_sources"] = "no";
sound::stop_sound_sources();
if(!music_on() && !sound_on() && !turn_bell() && !UI_sound_on)
sound::close_sound();
}
return true;
}
bool adjust_gamma()
{
@ -530,7 +493,7 @@ bool set_turn_bell(bool ison)
{
if(!turn_bell() && ison) {
prefs["turn_bell"] = "yes";
if(!music_on() && !sound_on() && !sound_sources_on() && !UI_sound_on()) {
if(!music_on() && !sound_on() && !UI_sound_on()) {
if(!sound::init_sound()) {
prefs["turn_bell"] = "no";
return false;
@ -539,7 +502,7 @@ bool set_turn_bell(bool ison)
} else if(turn_bell() && !ison) {
prefs["turn_bell"] = "no";
sound::stop_bell();
if(!music_on() && !sound_on() && !sound_sources_on() && !UI_sound_on())
if(!music_on() && !sound_on() && !UI_sound_on())
sound::close_sound();
}
return true;
@ -554,7 +517,7 @@ bool set_UI_sound(bool ison)
{
if(!UI_sound_on() && ison) {
prefs["UI_sound"] = "yes";
if(!music_on() && !sound_on() && !turn_bell() && !sound_sources_on()) {
if(!music_on() && !sound_on() && !turn_bell()) {
if(!sound::init_sound()) {
prefs["UI_sound"] = "no";
return false;
@ -563,7 +526,7 @@ bool set_UI_sound(bool ison)
} else if(UI_sound_on() && !ison) {
prefs["UI_sound"] = "no";
sound::stop_UI_sound();
if(!music_on() && !sound_on() && !turn_bell() && !sound_sources_on())
if(!music_on() && !sound_on() && !turn_bell())
sound::close_sound();
}
return true;
@ -586,7 +549,7 @@ bool sound_on() {
bool set_sound(bool ison) {
if(!sound_on() && ison) {
prefs["sound"] = "yes";
if(!music_on() && !turn_bell() && !UI_sound_on() && !sound_sources_on()) {
if(!music_on() && !turn_bell() && !UI_sound_on()) {
if(!sound::init_sound()) {
prefs["sound"] = "no";
return false;
@ -595,7 +558,7 @@ bool set_sound(bool ison) {
} else if(sound_on() && !ison) {
prefs["sound"] = "no";
sound::stop_sound();
if(!music_on() && !turn_bell() && !UI_sound_on() && !sound_sources_on())
if(!music_on() && !turn_bell() && !UI_sound_on())
sound::close_sound();
}
return true;
@ -608,7 +571,7 @@ bool music_on() {
bool set_music(bool ison) {
if(!music_on() && ison) {
prefs["music"] = "yes";
if(!sound_on() && !turn_bell() && !UI_sound_on() && !sound_sources_on()) {
if(!sound_on() && !turn_bell() && !UI_sound_on()) {
if(!sound::init_sound()) {
prefs["music"] = "no";
return false;
@ -618,7 +581,7 @@ bool set_music(bool ison) {
sound::play_music();
} else if(music_on() && !ison) {
prefs["music"] = "no";
if(!sound_on() && !turn_bell() && !UI_sound_on() && !sound_sources_on())
if(!sound_on() && !turn_bell() && !UI_sound_on())
sound::close_sound();
else
sound::stop_music();

View file

@ -89,11 +89,6 @@ namespace preferences {
int UI_volume();
void set_UI_volume(int vol);
bool sound_sources_on();
bool set_sound_sources(bool ison);
int sound_sources_volume();
void set_sound_sources_volume(int vol);
bool music_on();
bool set_music(bool ison);

View file

@ -346,7 +346,6 @@ bool init_sound() {
set_sound_volume(preferences::sound_volume());
set_UI_volume(preferences::UI_volume());
set_sound_sources_volume(preferences::sound_sources_volume());
set_music_volume(preferences::music_volume());
set_bell_volume(preferences::bell_volume());
@ -465,21 +464,6 @@ void stop_UI_sound() {
}
}
void stop_sound_sources() {
if(mix_ok) {
Mix_HaltGroup(SOUND_SOURCES);
sound_cache_iterator itor = sound_cache.begin();
while(itor != sound_cache.end())
{
if(itor->group == SOUND_SOURCES) {
itor = sound_cache.erase(itor);
} else {
++itor;
}
}
}
}
void think_about_music(void)
{
if (!music_start_time) {
@ -634,8 +618,8 @@ void write_music_play_list(config& snapshot)
void reposition_sound(int id, unsigned int distance)
{
audio_lock lock();
for(unsigned int ch = 0; ch < channel_ids.size(); ++ch) {
int & ch_id = channel_ids[ch];
for(int ch = 0; ch < channel_ids.size(); ++ch) {
int& ch_id = channel_ids[ch];
if(ch_id == id) {
if(distance >= DISTANCE_SILENT) {
Mix_FadeOutChannel(ch, 100);
@ -779,8 +763,7 @@ void set_sound_volume(int vol)
if(vol > MIX_MAX_VOLUME)
vol = MIX_MAX_VOLUME;
// Bell, UI and sound sources have separate channels which we
// can't set up from this
// Bell has separate channel which we can't set up from this
for (unsigned i = 0; i < n_of_channels; i++){
if(i != UI_sound_channel && i != bell_channel) {
Mix_Volume(i, vol);
@ -809,16 +792,4 @@ void set_UI_volume(int vol)
}
}
void set_sound_sources_volume(int vol)
{
if(mix_ok && vol >= 0) {
if(vol > MIX_MAX_VOLUME)
vol = MIX_MAX_VOLUME;
for (unsigned i = source_channel_start; i - source_channel_start < source_channels; i++) {
Mix_Volume(i, vol);
}
}
}
} // end of sound namespace

View file

@ -35,7 +35,6 @@ void stop_music();
void stop_sound();
void stop_UI_sound();
void stop_bell();
void stop_sound_sources();
// Read config entry, alter track list accordingly.
void play_music_config(const config &music);
@ -84,7 +83,6 @@ void set_music_volume(int vol);
void set_sound_volume(int vol);
void set_bell_volume(int vol);
void set_UI_volume(int vol);
void set_sound_sources_volume(int vol);
}