[Scummvm-cvs-logs] CVS: scummvm/sword2/driver d_sound.cpp,1.77,1.78 d_sound.h,1.28,1.29
Torbj?rn Andersson
eriktorbjorn at users.sourceforge.net
Tue Oct 28 23:54:13 CET 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm README,1.192,1.193
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sword2 anims.cpp,1.36,1.37 controls.cpp,1.37,1.38 controls.h,1.7,1.8 function.cpp,1.30,1.31 speech.cpp,1.35,1.36
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sword2/driver
In directory sc8-pr-cvs1:/tmp/cvs-serv13468/driver
Modified Files:
d_sound.cpp d_sound.h
Log Message:
Use the ScummVM config manager instead of a separate BS2-specific config
file, plus some other cleanup. I don't know how the config manager decides
if/when to save the settings to file, but we can worry about that later.
Index: d_sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/d_sound.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- d_sound.cpp 28 Oct 2003 19:51:30 -0000 1.77
+++ d_sound.cpp 29 Oct 2003 07:53:05 -0000 1.78
@@ -36,9 +36,9 @@
#include "sound/audiostream.h"
#include "sound/mixer.h"
#include "sound/rate.h"
+#include "sword2/sword2.h"
#include "sword2/driver/driver96.h"
#include "sword2/driver/d_sound.h"
-#include "sword2/sword2.h"
namespace Sword2 {
@@ -130,10 +130,10 @@
Sound::Sound(SoundMixer *mixer) {
_mutex = g_system->create_mutex();
- _soundOn = 0;
- _speechStatus = 0;
- _fxPaused = 0;
- _speechPaused = 0;
+ _soundOn = false;
+ _speechStatus = false;
+ _fxPaused = false;
+ _speechPaused = false;
_speechVol = 14;
_fxVol = 14;
_speechMuted = 0;
@@ -146,7 +146,7 @@
memset(_fx, 0, sizeof(_fx));
_soundHandleSpeech = 0;
- _soundOn = 1;
+ _soundOn = true;
_converter = makeRateConverter(_music[0].getRate(), _mixer->getOutputRate(), _music[0].isStereo(), false);
@@ -411,13 +411,13 @@
// Start the speech playing
- _speechPaused = 1;
+ _speechPaused = true;
uint32 flags = SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE;
_mixer->playRaw(&_soundHandleSpeech, data16, bufferSize, 22050, flags, -1, volume, p);
- _speechStatus = 1;
+ _speechStatus = true;
}
// DipMusic();
@@ -435,7 +435,7 @@
if (_speechStatus) {
g_engine->_mixer->stopHandle(_soundHandleSpeech);
- _speechStatus = 0;
+ _speechStatus = false;
return RD_OK;
}
return RDERR_SPEECHNOTPLAYING;
@@ -453,7 +453,7 @@
return RDSE_SAMPLEPLAYING;
if (!_soundHandleSpeech) {
- _speechStatus = 0;
+ _speechStatus = false;
return RDSE_SAMPLEFINISHED;
}
return RDSE_SAMPLEPLAYING;
@@ -465,7 +465,11 @@
*/
void Sound::setSpeechVolume(uint8 volume) {
+ if (volume > 14)
+ volume = 14;
+
_speechVol = volume;
+
if (_soundHandleSpeech != 0 && !_speechMuted && getSpeechStatus() == RDSE_SAMPLEPLAYING) {
g_engine->_mixer->setChannelVolume(_soundHandleSpeech, 16 * _speechVol);
}
@@ -481,11 +485,11 @@
/**
* Mutes/Unmutes the speech.
- * @param mute If mute is 0, restore the volume to the last set master level.
- * Otherwise the speech is muted (volume 0).
+ * @param mute If mute is false, restore the volume to the last set master
+ * level. Otherwise the speech is muted (volume 0).
*/
-void Sound::muteSpeech(uint8 mute) {
+void Sound::muteSpeech(bool mute) {
_speechMuted = mute;
if (getSpeechStatus() == RDSE_SAMPLEPLAYING) {
@@ -496,10 +500,10 @@
}
/**
- * @return the speech's mute state, 1 if mute, 0 if not mute
+ * @return the speech's mute state, true if mute, false if not mute
*/
-uint8 Sound::isSpeechMute(void) {
+bool Sound::isSpeechMute(void) {
return _speechMuted;
}
@@ -509,7 +513,7 @@
void Sound::pauseSpeech(void) {
if (getSpeechStatus() == RDSE_SAMPLEPLAYING) {
- _speechPaused = 1;
+ _speechPaused = true;
g_engine->_mixer->pauseHandle(_soundHandleSpeech, true);
}
}
@@ -520,7 +524,7 @@
void Sound::unpauseSpeech(void) {
if (_speechPaused) {
- _speechPaused = 0;
+ _speechPaused = false;
g_engine->_mixer->pauseHandle(_soundHandleSpeech, false);
}
}
@@ -649,7 +653,7 @@
_fx[i]._flags |= SoundMixer::FLAG_LOOP;
else
_fx[i]._flags &= ~SoundMixer::FLAG_LOOP;
-
+
_fx[i]._volume = vol;
// Start the sound effect playing
@@ -722,11 +726,16 @@
if (i == MAXFX)
return RDERR_FXNOTOPEN;
+ if (vol > 14)
+ vol = 14;
+
_fx[i]._volume = vol;
+
if (!_fxMuted) {
- g_engine->_mixer->setChannelVolume(_fx[i]._handle, vol * _fxVol);
+ g_engine->_mixer->setChannelVolume(_fx[i]._handle, _fx[i]._volume * _fxVol);
g_engine->_mixer->setChannelPan(_fx[i]._handle, panTable[pan + 16]);
}
+
return RD_OK;
}
@@ -807,7 +816,7 @@
} else
_fx[i]._paused = false;
}
- _fxPaused = 1;
+ _fxPaused = true;
}
}
@@ -821,7 +830,7 @@
_fx[i]._paused = false;
}
}
- _fxPaused = 1;
+ _fxPaused = true;
}
}
@@ -832,7 +841,7 @@
g_engine->_mixer->pauseHandle(_fx[i]._handle, false);
}
}
- _fxPaused = 0;
+ _fxPaused = false;
}
}
@@ -851,6 +860,9 @@
*/
void Sound::setFxVolume(uint8 volume) {
+ if (volume > 14)
+ volume = 14;
+
_fxVol = volume;
// Now update the volume of any fxs playing
@@ -862,11 +874,11 @@
/**
* Mutes/Unmutes the sound effects.
- * @param mute If mute is 0, restore the volume to the last set master level.
- * Otherwise the sound effects are muted (volume 0).
+ * @param mute If mute is false, restore the volume to the last set master
+ * level. Otherwise the sound effects are muted (volume 0).
*/
-void Sound::muteFx(uint8 mute) {
+void Sound::muteFx(bool mute) {
_fxMuted = mute;
// Now update the volume of any fxs playing
@@ -880,10 +892,10 @@
}
/**
- * @return the sound effects's mute state, 1 if mute, 0 if not mute
+ * @return the sound effects's mute state, true if mute, false if not mute
*/
-uint8 Sound::isFxMute(void) {
+bool Sound::isFxMute(void) {
return _fxMuted;
}
@@ -1117,6 +1129,9 @@
*/
void Sound::setMusicVolume(uint8 volume) {
+ if (volume > 16)
+ volume = 16;
+
_musicVol = volume;
}
@@ -1130,19 +1145,19 @@
/**
* Mutes/Unmutes the music.
- * @param mute If mute is 0, restore the volume to the last set master level.
- * Otherwise the music is muted (volume 0).
+ * @param mute If mute is false, restore the volume to the last set master
+ * level. Otherwise the music is muted (volume 0).
*/
-void Sound::muteMusic(uint8 mute) {
+void Sound::muteMusic(bool mute) {
_musicMuted = mute;
}
/**
- * @return the music's mute state, 1 if mute, 0 if not mute
+ * @return the music's mute state, true if mute, false if not mute
*/
-uint8 Sound::isMusicMute(void) {
+bool Sound::isMusicMute(void) {
return _musicMuted;
}
Index: d_sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/d_sound.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- d_sound.h 4 Oct 2003 08:31:20 -0000 1.28
+++ d_sound.h 29 Oct 2003 07:53:05 -0000 1.29
@@ -79,19 +79,18 @@
FxHandle _fx[MAXFX];
MusicHandle _music[MAXMUS + 1];
+ bool _soundOn;
+ bool _speechStatus;
+ bool _speechPaused;
+ bool _fxPaused;
+ bool _musicMuted;
+ bool _speechMuted;
+ bool _fxMuted;
uint8 _musicVol;
-
- uint8 _soundOn;
- uint8 _speechStatus;
- uint8 _fxPaused;
- uint8 _speechPaused;
uint8 _speechVol;
uint8 _fxVol;
- uint8 _speechMuted;
- uint8 _fxMuted;
PlayingSoundHandle _soundHandleSpeech;
- uint8 _musicMuted;
int32 getFxIndex(int32 id);
int32 dipMusic();
@@ -127,16 +126,16 @@
uint8 getFxVolume(void);
uint8 getSpeechVolume(void);
uint8 getMusicVolume(void);
- uint8 isMusicMute(void);
- uint8 isFxMute(void);
- uint8 isSpeechMute(void);
+ bool isMusicMute(void);
+ bool isFxMute(void);
+ bool isSpeechMute(void);
void stopMusic(void);
void setFxVolume(uint8 vol);
void setSpeechVolume(uint8 vol);
void setMusicVolume(uint8 vol);
- void muteMusic(uint8 mute);
- void muteFx(uint8 mute);
- void muteSpeech(uint8 mute);
+ void muteMusic(bool mute);
+ void muteFx(bool mute);
+ void muteSpeech(bool mute);
int32 isFxOpen(int32 id);
int32 setFxIdVolumePan(int32 id, uint8 vol, int8 pan);
int32 setFxIdVolume(int32 id, uint8 vol);
- Previous message: [Scummvm-cvs-logs] CVS: scummvm README,1.192,1.193
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sword2 anims.cpp,1.36,1.37 controls.cpp,1.37,1.38 controls.h,1.7,1.8 function.cpp,1.30,1.31 speech.cpp,1.35,1.36
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list