mail[Wesnoth-commits] r14081 - in /branches/1.2/src: preferences.cpp preferences.hpp sound.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edb on October 26, 2006 - 12:22:
Author: edb
Date: Thu Oct 26 12:22:11 2006
New Revision: 14081

URL: http://svn.gna.org/viewcvs/wesnoth?rev=14081&view=rev
Log:
add read only option "sample_rate". Let default value to 22050

Modified:
    branches/1.2/src/preferences.cpp
    branches/1.2/src/preferences.hpp
    branches/1.2/src/sound.cpp

Modified: branches/1.2/src/preferences.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.2/src/preferences.cpp?rev=14081&r1=14080&r2=14081&view=diff
==============================================================================
--- branches/1.2/src/preferences.cpp (original)
+++ branches/1.2/src/preferences.cpp Thu Oct 26 12:22:11 2006
@@ -174,6 +174,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()

Modified: branches/1.2/src/preferences.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.2/src/preferences.hpp?rev=14081&r1=14080&r2=14081&view=diff
==============================================================================
--- branches/1.2/src/preferences.hpp (original)
+++ branches/1.2/src/preferences.hpp Thu Oct 26 12:22:11 2006
@@ -63,6 +63,8 @@
        // which will cause it to conflict with the sound namespace
        bool sound_on();
        bool set_sound(bool ison);
+
+       unsigned int sample_rate();
 
        int sound_volume();
        void set_sound_volume(int vol);

Modified: branches/1.2/src/sound.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.2/src/sound.cpp?rev=14081&r1=14080&r2=14081&view=diff
==============================================================================
--- branches/1.2/src/sound.cpp (original)
+++ branches/1.2/src/sound.cpp Thu Oct 26 12:22:11 2006
@@ -210,7 +210,7 @@
                        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;




Related Messages


Powered by MHonArc, Updated Thu Oct 26 12:41:12 2006