[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.18,1.19 mixer.h,1.12,1.13
Nicolas Bacca
arisme at users.sourceforge.net
Wed May 1 15:23:03 CEST 2002
Update of /cvsroot/scummvm/scummvm/sound
In directory usw-pr-cvs1:/tmp/cvs-serv21446
Modified Files:
mixer.cpp mixer.h
Log Message:
Pause and start of volume support
Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** mixer.cpp 1 May 2002 09:56:14 -0000 1.18
--- mixer.cpp 1 May 2002 22:22:22 -0000 1.19
***************
*** 72,75 ****
--- 72,79 ----
void SoundMixer::mix(int16 *buf, uint len) {
+
+ if (_paused)
+ return;
+
if (_premix_proc) {
_premix_proc(_premix_param, buf, len);
***************
*** 118,121 ****
--- 122,129 ----
}
+ void SoundMixer::pause(bool paused) {
+ _paused = paused;
+ }
+
bool SoundMixer::has_active_channel() {
for(int i=0; i!=NUM_CHANNELS; i++)
***************
*** 283,286 ****
--- 291,295 ----
void SoundMixer::Channel_MP3::mix(int16 *data, uint len) {
mad_fixed_t const *ch;
+ const int16 *vol_tab = _mixer->_volume_table;
if (_to_be_destroyed) {
***************
*** 295,299 ****
_silence_cut--;
} else {
! *data++ += scale_sample(*ch++);
len--;
}
--- 304,308 ----
_silence_cut--;
} else {
! *data++ += (int16)((float)scale_sample(*ch++) * ((float)vol_tab[1] / (float)128));
len--;
}
***************
*** 360,363 ****
--- 369,373 ----
mad_fixed_t const *ch;
mad_timer_t frame_duration;
+ const int16 *vol_tab = _mixer->_volume_table;
if (_to_be_destroyed) {
***************
*** 411,415 ****
ch = _synth.pcm.samples[0] + _pos_in_frame;
while ((_pos_in_frame < _synth.pcm.length) && (len > 0)) {
! *data++ += scale_sample(*ch++);
len--;
_pos_in_frame++;
--- 421,425 ----
ch = _synth.pcm.samples[0] + _pos_in_frame;
while ((_pos_in_frame < _synth.pcm.length) && (len > 0)) {
! *data++ += (int16)((float)scale_sample(*ch++) * ((float)vol_tab[1] / (float)128));
len--;
_pos_in_frame++;
Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** mixer.h 29 Apr 2002 08:28:27 -0000 1.12
--- mixer.h 1 May 2002 22:22:22 -0000 1.13
***************
*** 109,112 ****
--- 109,114 ----
int16 *_volume_table;
+ bool _paused;
+
enum {
NUM_CHANNELS = 16,
***************
*** 157,160 ****
--- 159,165 ----
/* set the volume, 0-256 */
void set_volume(int volume);
+
+ /* pause - unpause */
+ void pause(bool paused);
};
More information about the Scummvm-git-logs
mailing list