mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-08 13:36:29 +00:00
add read only option "sample_rate". Let default value to 22050
This commit is contained in:
parent
f6bdd08e3f
commit
14d320b82e
@ -176,6 +176,11 @@ void set_language(const std::string& s)
|
||||
prefs["locale"] = s;
|
||||
}
|
||||
|
||||
unsigned int sample_rate()
|
||||
{
|
||||
return lexical_cast_default<unsigned int>(prefs["sample_rate"], 22050);
|
||||
}
|
||||
|
||||
int music_volume()
|
||||
{
|
||||
return lexical_cast_default<int>(prefs["music_volume"], 100);
|
||||
|
@ -64,6 +64,8 @@ namespace preferences {
|
||||
bool sound_on();
|
||||
bool set_sound(bool ison);
|
||||
|
||||
unsigned int sample_rate();
|
||||
|
||||
int sound_volume();
|
||||
void set_sound_volume(int vol);
|
||||
|
||||
|
@ -210,7 +210,7 @@ bool init_sound() {
|
||||
return false;
|
||||
|
||||
if(!mix_ok) {
|
||||
if(Mix_OpenAudio(MIX_DEFAULT_FREQUENCY,MIX_DEFAULT_FORMAT,2,buf_size) == -1) {
|
||||
if(Mix_OpenAudio(preferences::sample_rate(), MIX_DEFAULT_FORMAT, 2, buf_size) == -1) {
|
||||
mix_ok = false;
|
||||
ERR_AUDIO << "Could not initialize audio: " << Mix_GetError() << "\n";
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user