aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
authorMax Horn2010-03-10 21:03:50 +0000
committerMax Horn2010-03-10 21:03:50 +0000
commit43abd0e0192d290d3cf256bbc7cf16869031b98b (patch)
tree86a1ee482408c74066eaf510526054e5f9d53ae9 /engines/scumm
parentc97ee14a65afc0b8a11ef5c10105e966f67a5934 (diff)
downloadscummvm-rg350-43abd0e0192d290d3cf256bbc7cf16869031b98b.tar.gz
scummvm-rg350-43abd0e0192d290d3cf256bbc7cf16869031b98b.tar.bz2
scummvm-rg350-43abd0e0192d290d3cf256bbc7cf16869031b98b.zip
cleanup
svn-id: r48230
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/player_mod.cpp9
-rw-r--r--engines/scumm/player_mod.h4
-rw-r--r--engines/scumm/player_nes.cpp6
-rw-r--r--engines/scumm/player_nes.h4
-rw-r--r--engines/scumm/player_pce.cpp6
-rw-r--r--engines/scumm/player_pce.h4
-rw-r--r--engines/scumm/player_sid.cpp4
-rw-r--r--engines/scumm/player_sid.h4
-rw-r--r--engines/scumm/player_v1.cpp2
-rw-r--r--engines/scumm/player_v2.cpp10
-rw-r--r--engines/scumm/player_v2.h8
-rw-r--r--engines/scumm/player_v2cms.cpp16
12 files changed, 37 insertions, 40 deletions
diff --git a/engines/scumm/player_mod.cpp b/engines/scumm/player_mod.cpp
index 28ee5059e6..02be600270 100644
--- a/engines/scumm/player_mod.cpp
+++ b/engines/scumm/player_mod.cpp
@@ -31,10 +31,9 @@
namespace Scumm {
-Player_MOD::Player_MOD(Audio::Mixer *mixer) {
+Player_MOD::Player_MOD(Audio::Mixer *mixer)
+ : _mixer(mixer), _sampleRate(mixer->getOutputRate()) {
int i;
- _mixer = mixer;
- _samplerate = _mixer->getOutputRate();
_mixamt = 0;
_mixpos = 0;
@@ -69,7 +68,7 @@ void Player_MOD::setMusicVolume(int vol) {
void Player_MOD::setUpdateProc(ModUpdateProc *proc, void *param, int freq) {
_playproc = proc;
_playparam = param;
- _mixamt = _samplerate / freq;
+ _mixamt = _sampleRate / freq;
}
void Player_MOD::clearUpdateProc() {
_playproc = NULL;
@@ -185,7 +184,7 @@ void Player_MOD::do_mix(int16 *data, uint len) {
Audio::st_volume_t vol_r = (127 + _channels[i].pan) * _channels[i].vol / 127;
for (uint j = 0; j < dlen; j++) {
// simple linear resample, unbuffered
- int delta = (uint32)(_channels[i].freq * 0x10000) / _samplerate;
+ int delta = (uint32)(_channels[i].freq * 0x10000) / _sampleRate;
uint16 cfrac = ~_channels[i].ctr & 0xFFFF;
if (_channels[i].ctr + delta < 0x10000)
cfrac = delta;
diff --git a/engines/scumm/player_mod.h b/engines/scumm/player_mod.h
index ba709e2430..7c0e5916a3 100644
--- a/engines/scumm/player_mod.h
+++ b/engines/scumm/player_mod.h
@@ -63,7 +63,7 @@ public:
}
bool isStereo() const { return true; }
bool endOfData() const { return false; }
- int getRate() const { return _samplerate; }
+ int getRate() const { return _sampleRate; }
private:
enum {
@@ -86,7 +86,7 @@ private:
uint32 _mixamt;
uint32 _mixpos;
- int _samplerate;
+ const int _sampleRate;
soundChan _channels[MOD_MAXCHANS];
diff --git a/engines/scumm/player_nes.cpp b/engines/scumm/player_nes.cpp
index 0aaa8f9895..2e6f625fd9 100644
--- a/engines/scumm/player_nes.cpp
+++ b/engines/scumm/player_nes.cpp
@@ -591,10 +591,10 @@ Player_NES::Player_NES(ScummEngine *scumm, Audio::Mixer *mixer) {
int i;
_vm = scumm;
_mixer = mixer;
- _sample_rate = _mixer->getOutputRate();
- _apu = new APUe::APU(_sample_rate);
+ _sampleRate = _mixer->getOutputRate();
+ _apu = new APUe::APU(_sampleRate);
- _samples_per_frame = _sample_rate / 60;
+ _samples_per_frame = _sampleRate / 60;
_current_sample = 0;
for (i = 0; i < NUMSLOTS; i++) {
diff --git a/engines/scumm/player_nes.h b/engines/scumm/player_nes.h
index bed23d7c85..b2eafb79b0 100644
--- a/engines/scumm/player_nes.h
+++ b/engines/scumm/player_nes.h
@@ -60,7 +60,7 @@ public:
int readBuffer(int16 *buffer, const int numSamples);
bool isStereo() const { return false; }
bool endOfData() const { return false; }
- int getRate() const { return _sample_rate; }
+ int getRate() const { return _sampleRate; }
private:
@@ -81,7 +81,7 @@ private:
Audio::Mixer *_mixer;
Audio::SoundHandle _soundHandle;
APUe::APU *_apu;
- int _sample_rate;
+ int _sampleRate;
int _samples_per_frame;
int _current_sample;
int _maxvol;
diff --git a/engines/scumm/player_pce.cpp b/engines/scumm/player_pce.cpp
index 4c7f2980bc..3e81e7c276 100644
--- a/engines/scumm/player_pce.cpp
+++ b/engines/scumm/player_pce.cpp
@@ -717,14 +717,14 @@ Player_PCE::Player_PCE(ScummEngine *scumm, Audio::Mixer *mixer) {
}
_mixer = mixer;
- _sample_rate = _mixer->getOutputRate();
+ _sampleRate = _mixer->getOutputRate();
_vm = scumm;
- _samplesPerPeriod = 2 * (int)(_sample_rate / UPDATE_FREQ);
+ _samplesPerPeriod = 2 * (int)(_sampleRate / UPDATE_FREQ);
_sampleBuffer = new int16[_samplesPerPeriod];
_sampleBufferCnt = 0;
- _psg = new PSG_HuC6280(PSG_CLOCK, _sample_rate);
+ _psg = new PSG_HuC6280(PSG_CLOCK, _sampleRate);
_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
}
diff --git a/engines/scumm/player_pce.h b/engines/scumm/player_pce.h
index b3d51edbf9..99c7c80699 100644
--- a/engines/scumm/player_pce.h
+++ b/engines/scumm/player_pce.h
@@ -89,13 +89,13 @@ public:
int readBuffer(int16 *buffer, const int numSamples);
bool isStereo() const { return true; }
bool endOfData() const { return false; }
- int getRate() const { return _sample_rate; }
+ int getRate() const { return _sampleRate; }
private:
ScummEngine *_vm;
Audio::Mixer *_mixer;
Audio::SoundHandle _soundHandle;
- int _sample_rate;
+ int _sampleRate;
int _maxvol;
private:
diff --git a/engines/scumm/player_sid.cpp b/engines/scumm/player_sid.cpp
index a17343b4a4..eed38cd219 100644
--- a/engines/scumm/player_sid.cpp
+++ b/engines/scumm/player_sid.cpp
@@ -1249,7 +1249,7 @@ Player_SID::Player_SID(ScummEngine *scumm, Audio::Mixer *mixer) {
_music_timer = 0;
_mixer = mixer;
- _sample_rate = _mixer->getOutputRate();
+ _sampleRate = _mixer->getOutputRate();
_vm = scumm;
// sound speed is slightly different on NTSC and PAL machines
@@ -1314,7 +1314,7 @@ void Player_SID::initSID() {
_sid = new Resid::SID();
_sid->set_sampling_parameters(
timingProps[_videoSystem].clockFreq,
- _sample_rate);
+ _sampleRate);
_sid->enable_filter(true);
_sid->reset();
diff --git a/engines/scumm/player_sid.h b/engines/scumm/player_sid.h
index bfc9453070..1b643a8fbd 100644
--- a/engines/scumm/player_sid.h
+++ b/engines/scumm/player_sid.h
@@ -71,7 +71,7 @@ public:
int readBuffer(int16 *buffer, const int numSamples);
bool isStereo() const { return false; }
bool endOfData() const { return false; }
- int getRate() const { return _sample_rate; }
+ int getRate() const { return _sampleRate; }
private:
Resid::SID *_sid;
@@ -85,7 +85,7 @@ private:
ScummEngine *_vm;
Audio::Mixer *_mixer;
Audio::SoundHandle _soundHandle;
- int _sample_rate;
+ int _sampleRate;
int _maxvol;
Common::Mutex _mutex;
diff --git a/engines/scumm/player_v1.cpp b/engines/scumm/player_v1.cpp
index 2d43eb378b..28cd37698c 100644
--- a/engines/scumm/player_v1.cpp
+++ b/engines/scumm/player_v1.cpp
@@ -42,7 +42,7 @@ Player_V1::Player_V1(ScummEngine *scumm, Audio::Mixer *mixer, bool pcjr)
for (int i = 0; i < 4; ++i)
clear_channel(i);
- _mplex_step = (_sample_rate << FIXP_SHIFT) / 1193000;
+ _mplex_step = (_sampleRate << FIXP_SHIFT) / 1193000;
_next_chunk = _repeat_chunk = 0;
_forced_level = 0;
_random_lsr = 0;
diff --git a/engines/scumm/player_v2.cpp b/engines/scumm/player_v2.cpp
index 06e9e929c6..764b7ae3fe 100644
--- a/engines/scumm/player_v2.cpp
+++ b/engines/scumm/player_v2.cpp
@@ -339,7 +339,7 @@ Player_V2::Player_V2(ScummEngine *scumm, Audio::Mixer *mixer, bool pcjr) {
_isV3Game = (scumm->_game.version >= 3);
_vm = scumm;
_mixer = mixer;
- _sample_rate = _mixer->getOutputRate();
+ _sampleRate = _mixer->getOutputRate();
_header_len = (scumm->_game.features & GF_OLD_BUNDLE) ? 4 : 6;
@@ -352,7 +352,7 @@ Player_V2::Player_V2(ScummEngine *scumm, Audio::Mixer *mixer, bool pcjr) {
clear_channel(i);
_next_tick = 0;
- _tick_len = (_sample_rate << FIXP_SHIFT) / FREQ_HZ;
+ _tick_len = (_sampleRate << FIXP_SHIFT) / FREQ_HZ;
// Initialize V3 music timer
_music_timer_ctr = _music_timer = 0;
@@ -381,11 +381,11 @@ void Player_V2::set_pcjr(bool pcjr) {
if (_pcjr) {
_decay = PCJR_DECAY;
- _update_step = (_sample_rate << FIXP_SHIFT) / (111860 * 2);
+ _update_step = (_sampleRate << FIXP_SHIFT) / (111860 * 2);
_freqs_table = pcjr_freq_table;
} else {
_decay = SPK_DECAY;
- _update_step = (_sample_rate << FIXP_SHIFT) / (1193000 * 2);
+ _update_step = (_sampleRate << FIXP_SHIFT) / (1193000 * 2);
_freqs_table = spk_freq_table;
}
@@ -393,7 +393,7 @@ void Player_V2::set_pcjr(bool pcjr) {
* sample rate doubles.
*/
int i;
- for (i = 0; (_sample_rate << i) < 30000; i++)
+ for (i = 0; (_sampleRate << i) < 30000; i++)
_decay = _decay * _decay / 65536;
diff --git a/engines/scumm/player_v2.h b/engines/scumm/player_v2.h
index 83094617da..498cfdc1d7 100644
--- a/engines/scumm/player_v2.h
+++ b/engines/scumm/player_v2.h
@@ -90,7 +90,7 @@ public:
}
bool isStereo() const { return true; }
bool endOfData() const { return false; }
- int getRate() const { return _sample_rate; }
+ int getRate() const { return _sampleRate; }
protected:
bool _isV3Game;
@@ -101,7 +101,7 @@ protected:
bool _pcjr;
int _header_len;
- uint32 _sample_rate;
+ uint32 _sampleRate;
uint32 _next_tick;
uint32 _tick_len;
unsigned int _update_step;
@@ -177,7 +177,7 @@ public:
int readBuffer(int16 *buffer, const int numSamples);
bool isStereo() const { return true; }
bool endOfData() const { return false; }
- int getRate() const { return _sample_rate; }
+ int getRate() const { return _sampleRate; }
protected:
@@ -289,7 +289,7 @@ protected:
int _header_len;
- uint32 _sample_rate;
+ uint32 _sampleRate;
uint32 _next_tick;
uint32 _tick_len;
diff --git a/engines/scumm/player_v2cms.cpp b/engines/scumm/player_v2cms.cpp
index ccc93df902..7b3eb87c02 100644
--- a/engines/scumm/player_v2cms.cpp
+++ b/engines/scumm/player_v2cms.cpp
@@ -30,6 +30,7 @@
#include "sound/mixer.h"
namespace Scumm {
+
#define FREQ_HZ 236 // Don't change!
#define FIXP_SHIFT 16
@@ -55,8 +56,7 @@ namespace Scumm {
#define PROCESS_VIBRATO 5
/* this structure defines a channel */
-struct saa1099_channel
-{
+struct saa1099_channel {
int frequency; /* frequency (0x00..0xff) */
int freq_enable; /* frequency enable */
int noise_enable; /* noise enable */
@@ -71,8 +71,7 @@ struct saa1099_channel
};
/* this structure defines a noise channel */
-struct saa1099_noise
-{
+struct saa1099_noise {
/* vars to simulate the noise generator output */
double counter;
double freq;
@@ -80,8 +79,7 @@ struct saa1099_noise
};
/* this structure defines a SAA1099 chip */
-struct SAA1099
-{
+struct SAA1099 {
int stream; /* our stream */
int noise_params[2]; /* noise generators parameters */
int env_enable[2]; /* envelope generators enable */
@@ -818,7 +816,7 @@ Player_V2CMS::Player_V2CMS(ScummEngine *scumm, Audio::Mixer *mixer) {
_vm = scumm;
_mixer = mixer;
// debug("mixer rate: %d", _mixer->getOutputRate());
- _sample_rate = CMS_RATE;
+ _sampleRate = CMS_RATE;
_header_len = (scumm->_game.features & GF_OLD_BUNDLE) ? 4 : 6;
@@ -831,7 +829,7 @@ Player_V2CMS::Player_V2CMS(ScummEngine *scumm, Audio::Mixer *mixer) {
clear_channel(i);
_next_tick = 0;
- _tick_len = (_sample_rate << FIXP_SHIFT) / FREQ_HZ;
+ _tick_len = (_sampleRate << FIXP_SHIFT) / FREQ_HZ;
// Initialize V3 music timer
_music_timer_ctr = _music_timer = 0;
@@ -878,7 +876,7 @@ Player_V2CMS::Player_V2CMS(ScummEngine *scumm, Audio::Mixer *mixer) {
_cmsVoices[7].octaveOutput = &(_cmsChips[1].octave[1]);
// inits the CMS Emulator like in the original
- g_cmsEmu = new CMSEmulator(_sample_rate);
+ g_cmsEmu = new CMSEmulator(_sampleRate);
static const byte cmsInitData[13*2] = {
0x1C, 0x02,
0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x00, 0x05, 0x00,