[Scummvm-cvs-logs] CVS: scummvm/scumm/smush channel.h,1.5,1.6 imuse_channel.cpp,1.7,1.8 scumm_renderer.cpp,1.8,1.9 scumm_renderer.h,1.7,1.8
Pawe? Ko?odziejski
aquadran at users.sourceforge.net
Wed Sep 18 01:07:01 CEST 2002
Update of /cvsroot/scummvm/scummvm/scumm/smush
In directory usw-pr-cvs1:/tmp/cvs-serv4813
Modified Files:
channel.h imuse_channel.cpp scumm_renderer.cpp
scumm_renderer.h
Log Message:
fixed naming convention and added support 11khz for Smush sound channels
Index: channel.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/channel.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- channel.h 31 Aug 2002 13:29:09 -0000 1.5
+++ channel.h 18 Sep 2002 08:06:14 -0000 1.6
@@ -54,6 +54,7 @@
virtual int32 availableSoundData() const = 0;
virtual void getSoundData(int16 * sound_buffer, int32 size) = 0; // size is in sample
virtual void getSoundData(int8 * sound_buffer, int32 size) = 0;
+ virtual int32 getRate() = 0;
virtual bool getParameters(int32 &rate, bool &stereo, bool &is_16bit) = 0;
virtual int32 getTrackIdentifier() const = 0;
};
@@ -94,6 +95,7 @@
int32 availableSoundData() const;
void getSoundData(int16 * sound_buffer, int32 size);
void getSoundData(int8 * sound_buffer, int32 size) { error("16bit request for SAUD channel should never happen"); };
+ int32 getRate() { return _frequency; }
bool getParameters(int32 &rate, bool &stereo, bool &is_16bit) {
rate = _frequency;
stereo = true;
@@ -146,6 +148,7 @@
int32 availableSoundData() const;
void getSoundData(int16 * sound_buffer, int32 size);
void getSoundData(int8 * sound_buffer, int32 size);
+ int32 getRate() { return _rate; }
bool getParameters(int32 &rate, bool &stereo, bool &is_16bit) {
rate = _frequency;
stereo = (_channels == 2);
Index: imuse_channel.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/imuse_channel.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- imuse_channel.cpp 30 Aug 2002 15:24:16 -0000 1.7
+++ imuse_channel.cpp 18 Sep 2002 08:06:15 -0000 1.8
@@ -306,8 +306,14 @@
void ImuseChannel::getSoundData(int16 * snd, int32 size) {
if(_dataSize <= 0 || _bitsize <= 8) error("invalid call to imuse_channel::read_sound_data()");
if(_channels == 2) size *= 2;
- for(int32 i = 0; i < size; i++)
- snd[i] = READ_BE_UINT16(_sbuffer + 2 * i);
+ if(_rate == 11025) {
+ for(int32 i = 0; i < size; i++)
+ snd[i * 2] = READ_BE_UINT16(_sbuffer + 2 * i);
+ snd[i * 2 + 1] = snd[i * 2];
+ } else {
+ for(int32 i = 0; i < size; i++)
+ snd[i] = READ_BE_UINT16(_sbuffer + 2 * i);
+ }
delete []_sbuffer;
assert(_sbufferSize == 2 * size);
_sbuffer = 0;
@@ -318,8 +324,14 @@
void ImuseChannel::getSoundData(int8 * snd, int32 size) {
if(_dataSize <= 0 || _bitsize > 8) error("invalid call to imuse_channel::read_sound_data()");
if(_channels == 2) size *= 2;
- for(int32 i = 0; i < size; i++)
- snd[i] = _sbuffer[i];
+ if(_rate == 11025) {
+ for(int32 i = 0; i < size; i++)
+ snd[i * 2] = _sbuffer[i];
+ snd[i * 2 + 1] = _sbuffer[i];
+ } else {
+ for(int32 i = 0; i < size; i++)
+ snd[i] = _sbuffer[i];
+ }
delete []_sbuffer;
_sbuffer = 0;
_sbufferSize = 0;
Index: scumm_renderer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/scumm_renderer.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- scumm_renderer.cpp 15 Sep 2002 05:38:04 -0000 1.8
+++ scumm_renderer.cpp 18 Sep 2002 08:06:15 -0000 1.9
@@ -28,7 +28,7 @@
#include "scumm/scumm.h"
#include "scumm/sound.h"
-class scumm_mixer : public Mixer {
+class ScummMixer : public Mixer {
private:
SoundMixer * _mixer; //!< pointer to the SoundMixer instance
struct {
@@ -39,8 +39,8 @@
} _channels[SoundMixer::NUM_CHANNELS]; //!< The map of track and channels
int _nextIndex;
public:
- scumm_mixer(SoundMixer *);
- virtual ~scumm_mixer();
+ ScummMixer(SoundMixer *);
+ virtual ~ScummMixer();
bool init();
_Channel * findChannel(int32 track);
bool addChannel(_Channel * c);
@@ -49,7 +49,7 @@
bool update();
};
-scumm_mixer::scumm_mixer(SoundMixer * m) : _mixer(m), _nextIndex(0) {
+ScummMixer::ScummMixer(SoundMixer * m) : _mixer(m), _nextIndex(0) {
for(int32 i = 0; i < SoundMixer::NUM_CHANNELS; i++) {
_channels[i].id = -1;
_channels[i].chan = 0;
@@ -57,15 +57,15 @@
}
}
-scumm_mixer::~scumm_mixer() {
+ScummMixer::~ScummMixer() {
}
-bool scumm_mixer::init() {
- debug(9, "scumm_mixer::init()");
+bool ScummMixer::init() {
+ debug(9, "ScummMixer::init()");
return true;
}
-_Channel * scumm_mixer::findChannel(int32 track) {
+_Channel * ScummMixer::findChannel(int32 track) {
debug(9, "scumm_mixer::findChannel(%d)", track);
for(int32 i = 0; i < SoundMixer::NUM_CHANNELS; i++) {
if(_channels[i].id == track)
@@ -74,11 +74,11 @@
return 0;
}
-bool scumm_mixer::addChannel(_Channel * c) {
+bool ScummMixer::addChannel(_Channel * c) {
int32 track = c->getTrackIdentifier();
int32 i;
- debug(9, "scumm_mixer::addChannel(%d)", track);
+ debug(9, "ScummMixer::addChannel(%d)", track);
for(i = 0; i < SoundMixer::NUM_CHANNELS; i++) {
if(_channels[i].id == track)
@@ -119,8 +119,8 @@
return false;
}
-bool scumm_mixer::handleFrame() {
- debug(9, "scumm_mixer::handleFrame()");
+bool ScummMixer::handleFrame() {
+ debug(9, "ScummMixer::handleFrame()");
for(int i = 0; i < SoundMixer::NUM_CHANNELS; i++) {
if(_channels[i].id != -1) {
debug(9, "updating channel %d (%p)", _channels[i].id, _channels[i].chan);
@@ -140,8 +140,9 @@
if(is_short) {
// FIXME this is one more data copy... we could get rid of it...
- short * data = new int16[size * (stereo ? 2 : 1)];
+ short * data = new int16[size * (stereo ? 2 : 1) * 2];
_channels[i].chan->getSoundData(data, size);
+ if(_channels[i].chan->getRate() == 11025) size *= 2;
size *= stereo ? 4 : 2;
// append to _sound
@@ -155,8 +156,9 @@
delete []data;
} else {
- int8 * data = new int8[size * (stereo ? 2 : 1)];
+ int8 * data = new int8[size * (stereo ? 2 : 1) * 2];
_channels[i].chan->getSoundData(data, size);
+ if(_channels[i].chan->getRate() == 11025) size *= 2;
size *= stereo ? 2 : 1;
// append to _sound
@@ -175,8 +177,8 @@
return true;
}
-bool scumm_mixer::stop() {
- debug(9, "scumm_mixer::stop()");
+bool ScummMixer::stop() {
+ debug(9, "ScummMixer::stop()");
for(int i = 0; i < SoundMixer::NUM_CHANNELS; i++) {
if(_channels[i].id != -1) {
delete _channels[i].chan;
@@ -203,7 +205,7 @@
Mixer * ScummRenderer::getMixer() {
if(_smixer == 0) {
_scumm->_sound->pauseBundleMusic(true);
- _smixer = new scumm_mixer(_scumm->_mixer);
+ _smixer = new ScummMixer(_scumm->_mixer);
if(!_smixer) error("unable to allocate a smush mixer");
s_renderer = this;
_scumm->_timer->installProcedure(&smush_handler, _insaneSpeed);
Index: scumm_renderer.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/smush/scumm_renderer.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- scumm_renderer.h 15 Sep 2002 05:38:04 -0000 1.7
+++ scumm_renderer.h 18 Sep 2002 08:06:15 -0000 1.8
@@ -36,14 +36,14 @@
#include "brenderer.h"
-class scumm_mixer;
+class ScummMixer;
class Scumm;
class Mixer;
class ScummRenderer : public BaseRenderer {
private:
Scumm * _scumm;
- scumm_mixer * _smixer;
+ ScummMixer * _smixer;
uint32 _insaneSpeed;
volatile bool _wait;
public:
More information about the Scummvm-git-logs
mailing list