[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.41,1.42 mixer.h,1.21,1.22
Max Horn
fingolfin at users.sourceforge.net
Sat Jun 21 12:53:02 CEST 2003
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv22405
Modified Files:
mixer.cpp mixer.h
Log Message:
cleanup
Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- mixer.cpp 15 Jun 2003 01:56:47 -0000 1.41
+++ mixer.cpp 21 Jun 2003 19:52:12 -0000 1.42
@@ -27,15 +27,14 @@
class ChannelRaw : public Channel {
- SoundMixer *_mixer;
- void *_ptr;
+ byte *_ptr;
uint32 _pos;
uint32 _size;
uint32 _fpSpeed;
uint32 _fpPos;
uint32 _realSize, _rate;
byte _flags;
- void *_loop_ptr;
+ byte *_loop_ptr;
uint32 _loop_size;
public:
@@ -46,7 +45,6 @@
};
class ChannelStream : public Channel {
- SoundMixer *_mixer;
byte *_ptr;
byte *_endOfData;
byte *_endOfBuffer;
@@ -70,8 +68,7 @@
#ifdef USE_MAD
class ChannelMP3 : public Channel {
- SoundMixer *_mixer;
- void *_ptr;
+ byte *_ptr;
struct mad_stream _stream;
struct mad_frame _frame;
struct mad_synth _synth;
@@ -89,9 +86,8 @@
};
-class ChannelMP3CDMusic:public Channel {
- SoundMixer *_mixer;
- void *_ptr;
+class ChannelMP3CDMusic : public Channel {
+ byte *_ptr;
struct mad_stream _stream;
struct mad_frame _frame;
struct mad_synth _synth;
@@ -115,7 +111,6 @@
#ifdef USE_VORBIS
class ChannelVorbis : public Channel {
- SoundMixer *_mixer;
OggVorbis_File *_ov_file;
int _end_pos;
bool _eof_flag, _is_cd_track;
@@ -662,7 +657,7 @@
_id = id;
_mixer = mixer;
_flags = flags;
- _ptr = sound;
+ _ptr = (byte *)sound;
_pos = 0;
_fpPos = 0;
_fpSpeed = (1 << 16) * rate / mixer->_outputRate;
@@ -698,15 +693,15 @@
len = _size;
_size -= len;
- s = (byte *)_ptr + _pos;
- end = (byte *)_ptr + _realSize;
+ s = _ptr + _pos;
+ end = _ptr + _realSize;
const uint32 fp_speed = _fpSpeed;
const int16 *vol_tab = _mixer->_volumeTable;
mixer_helper_table[_flags & 0x07] (data, &len, &s, &_fpPos, fp_speed, vol_tab, end, (_flags & SoundMixer::FLAG_REVERSE_STEREO) ? true : false);
- _pos = s - (byte *)_ptr;
+ _pos = s - _ptr;
if (_size < 1) {
if (_flags & SoundMixer::FLAG_LOOP) {
@@ -747,7 +742,7 @@
_toBeDestroyed = false;
_setTimeOut = timeout;
- /* adjust the magnitute to prevent division error */
+ // adjust the magnitude to prevent division error
while (size & 0xFFFF0000)
size >>= 1, rate = (rate >> 1) + 1;
@@ -845,7 +840,7 @@
_posInFrame = 0xFFFFFFFF;
_position = 0;
_size = size;
- _ptr = sound;
+ _ptr = (byte *)sound;
_toBeDestroyed = false;
mad_stream_init(&_stream);
@@ -927,7 +922,7 @@
return;
}
- mad_stream_buffer(&_stream, ((unsigned char *)_ptr) + _position,
+ mad_stream_buffer(&_stream, _ptr + _position,
_size + MAD_BUFFER_GUARD - _position);
if (mad_frame_decode(&_frame, &_stream) == -1) {
@@ -941,7 +936,7 @@
}
mad_synth_frame(&_synth, &_frame);
_posInFrame = 0;
- _position = _stream.next_frame - (unsigned char *)_ptr;
+ _position = _stream.next_frame - _ptr;
}
}
@@ -965,7 +960,7 @@
_duration = duration;
_initialized = false;
_bufferSize = MP3CD_BUFFERING_SIZE;
- _ptr = malloc(MP3CD_BUFFERING_SIZE);
+ _ptr = (byte *)malloc(MP3CD_BUFFERING_SIZE);
_toBeDestroyed = false;
mad_stream_init(&_stream);
@@ -998,7 +993,7 @@
return;
}
// Resync
- mad_stream_buffer(&_stream, (unsigned char *)_ptr, _size);
+ mad_stream_buffer(&_stream, _ptr, _size);
skip_loop = 2;
while (skip_loop != 0) {
if (mad_frame_decode(&_frame, &_stream) == 0) {
@@ -1061,11 +1056,11 @@
} else {
not_decoded = _stream.bufend - _stream.next_frame;
memcpy(_ptr, _stream.next_frame, not_decoded);
- _size = _file->read((unsigned char *)_ptr + not_decoded, _bufferSize - not_decoded);
+ _size = _file->read(_ptr + not_decoded, _bufferSize - not_decoded);
}
_stream.error = (enum mad_error)0;
// Restream
- mad_stream_buffer(&_stream, (unsigned char *)_ptr, _size + not_decoded);
+ mad_stream_buffer(&_stream, _ptr, _size + not_decoded);
if (mad_frame_decode(&_frame, &_stream) == -1) {
debug(1, "Error decoding after restream %d !", _stream.error);
}
Index: mixer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- mixer.h 18 Jun 2003 21:10:05 -0000 1.21
+++ mixer.h 21 Jun 2003 19:52:12 -0000 1.22
@@ -40,12 +40,15 @@
typedef uint32 PlayingSoundHandle;
class File;
+class SoundMixer;
class Channel {
+protected:
+ SoundMixer *_mixer;
public:
bool _toBeDestroyed;
int _id;
- Channel() : _id(-1) {}
+ Channel() : _mixer(0), _toBeDestroyed(false), _id(-1) {}
virtual void mix(int16 *data, uint len) = 0;
void destroy() {
_toBeDestroyed = true;
More information about the Scummvm-git-logs
mailing list