[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.49,1.50 mixer.h,1.24,1.25
Max Horn
fingolfin at users.sourceforge.net
Sun Aug 18 14:43:02 CEST 2002
Update of /cvsroot/scummvm/scummvm/sound
In directory usw-pr-cvs1:/tmp/cvs-serv12000/sound
Modified Files:
mixer.cpp mixer.h
Log Message:
move _volume_table creation into constructor, and discard it in destructor
Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- mixer.cpp 11 Aug 2002 11:56:06 -0000 1.49
+++ mixer.cpp 18 Aug 2002 21:42:22 -0000 1.50
@@ -23,6 +23,16 @@
#include "stdafx.h"
#include "scumm.h"
+SoundMixer::SoundMixer()
+{
+ _volume_table = (int16 *)calloc(256 * sizeof(int16), 1);
+}
+
+SoundMixer::~SoundMixer()
+{
+ free(_volume_table);
+}
+
void SoundMixer::uninsert(Channel * chan)
{
@@ -146,8 +156,6 @@
bool SoundMixer::bind_to_system(OSystem *syst)
{
- _volume_table = (int16 *)calloc(256 * sizeof(int16), 1);
-
uint rate = (uint) syst->property(OSystem::PROP_GET_SAMPLE_RATE, 0);
_output_rate = rate;
@@ -211,10 +219,10 @@
// The volume table takes 8 bit unsigned data as index and returns 16 bit signed
for (i = 0; i < 128; i++)
- _volume_table[i] = i * volume ;
+ _volume_table[i] = i * volume;
for (i = -128; i < 0; i++)
- _volume_table[i+256] = i * volume ;
+ _volume_table[i+256] = i * volume;
}
void SoundMixer::set_music_volume(int volume)
Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- mixer.h 18 Aug 2002 17:48:18 -0000 1.24
+++ mixer.h 18 Aug 2002 21:42:22 -0000 1.25
@@ -24,6 +24,7 @@
#define MIXER_H
#include <stdio.h>
+
#ifdef COMPRESSED_SOUND_FILE
#include <mad.h>
#endif
@@ -145,6 +146,9 @@
Channel *_channels[NUM_CHANNELS];
PlayingSoundHandle *_handles[NUM_CHANNELS];
+
+ SoundMixer();
+ ~SoundMixer();
int insert_at(PlayingSoundHandle *handle, int index, Channel * chan);
void append(void *data, uint32 len);
More information about the Scummvm-git-logs
mailing list