add sound-volume option

This commit is contained in:
doitux
2007-06-13 09:27:28 +00:00
parent 32a0d99a54
commit f225ef8956
15 changed files with 1363 additions and 1174 deletions
+7 -3
View File
@@ -15,8 +15,8 @@
using namespace std;
SDLPlayer::SDLPlayer()
: soundData(NULL), currentChannel(0) , audioEnabled(0)
SDLPlayer::SDLPlayer(ConfigFile *c)
: soundData(NULL), currentChannel(0) , audioEnabled(0), myConfig(c)
{
initAudio();
}
@@ -83,7 +83,11 @@ void SDLPlayer::playSound(string audioString, int playerID) {
sound = Mix_QuickLoad_WAV(soundData);
// set channel 2 to be behind and right, and 100 units away
// set channel 0 to settings volume
Mix_Volume(0,myConfig->readConfigInt("SoundVolume")*10);
// set 3d effect
if(!Mix_SetPosition(0, position, distance)) {
printf("Mix_SetPosition: %s\n", Mix_GetError());
// no position effect, is it ok?
+4 -1
View File
@@ -23,6 +23,7 @@
#endif
#include <string>
#include "configfile.h"
/**
@author FThauer FHammer <webmaster@pokerth.net>
@@ -31,7 +32,7 @@ class SDLPlayer : public QObject{
Q_OBJECT
public:
SDLPlayer();
SDLPlayer(ConfigFile*);
~SDLPlayer();
@@ -52,6 +53,8 @@ private:
bool audioEnabled;
ConfigFile *myConfig;
};
#endif