diff options
author | Max Horn | 2003-08-05 17:52:47 +0000 |
---|---|---|
committer | Max Horn | 2003-08-05 17:52:47 +0000 |
commit | 4ae47a74bf2c1e79b182ea0301b0bbdd6170e60e (patch) | |
tree | 2382a384f044fe4f6162e03950446d777eed06f4 /scumm | |
parent | 59bd4cb49316021a515df32ac4337f5ccad506bd (diff) | |
download | scummvm-rg350-4ae47a74bf2c1e79b182ea0301b0bbdd6170e60e.tar.gz scummvm-rg350-4ae47a74bf2c1e79b182ea0301b0bbdd6170e60e.tar.bz2 scummvm-rg350-4ae47a74bf2c1e79b182ea0301b0bbdd6170e60e.zip |
added support for output sample rates > 32767 (still limited to a max of 65535, but all we care about are 44100 and 48000 anyway)
svn-id: r9510
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/player_v2.cpp | 17 | ||||
-rw-r--r-- | scumm/player_v2.h | 16 |
2 files changed, 16 insertions, 17 deletions
diff --git a/scumm/player_v2.cpp b/scumm/player_v2.cpp index 901302a0cc..ff9e6f1fca 100644 --- a/scumm/player_v2.cpp +++ b/scumm/player_v2.cpp @@ -801,15 +801,14 @@ void Player_V2::next_freqs(ChannelInfo *channel) { } } -void Player_V2::do_mix (int16 *data, int len) { +void Player_V2::do_mix (int16 *data, uint len) { mutex_up(); - int step; + uint step; do { step = len; if (step > (_next_tick >> FIXP_SHIFT)) step = (_next_tick >> FIXP_SHIFT); - if (_pcjr) generatePCjrSamples(data, step); else @@ -833,8 +832,8 @@ void Player_V2::do_mix (int16 *data, int len) { mutex_down(); } -void Player_V2::lowPassFilter(int16 *sample, int len) { - for (int i = 0; i < len; i++) { +void Player_V2::lowPassFilter(int16 *sample, uint len) { + for (uint i = 0; i < len; i++) { _level = (_level * _decay + (unsigned int)sample[i] * (0x10000-_decay)) >> 16; sample[i] = _level; @@ -842,12 +841,12 @@ void Player_V2::lowPassFilter(int16 *sample, int len) { } void Player_V2::squareGenerator(int channel, int freq, int vol, - int noiseFeedback, int16 *sample, int len) { + int noiseFeedback, int16 *sample, uint len) { int period = _update_step * freq; if (period == 0) period = _update_step; - for (int i = 0; i < len; i++) { + for (uint i = 0; i < len; i++) { unsigned int duration = 0; if (_timer_output & (1 << channel)) @@ -883,7 +882,7 @@ void Player_V2::squareGenerator(int channel, int freq, int vol, } } -void Player_V2::generateSpkSamples(int16 *data, int len) { +void Player_V2::generateSpkSamples(int16 *data, uint len) { int winning_channel = -1; for (int i = 0; i < 4; i++) { if (winning_channel == -1 @@ -904,7 +903,7 @@ void Player_V2::generateSpkSamples(int16 *data, int len) { lowPassFilter(data, len); } -void Player_V2::generatePCjrSamples(int16 *data, int len) { +void Player_V2::generatePCjrSamples(int16 *data, uint len) { int i, j; int freq, vol; diff --git a/scumm/player_v2.h b/scumm/player_v2.h index 1bdfa96382..6aec549407 100644 --- a/scumm/player_v2.h +++ b/scumm/player_v2.h @@ -92,9 +92,9 @@ private: bool _pcjr; int _header_len; - int _sample_rate; - int _next_tick; - int _tick_len; + uint32 _sample_rate; + uint32 _next_tick; + uint32 _tick_len; unsigned int _update_step; unsigned int _decay; unsigned int _level; @@ -129,13 +129,13 @@ private: void chainNextSound(); static void premix_proc(void *param, int16 *buf, uint len); - void do_mix (int16 *buf, int len); + void do_mix (int16 *buf, uint len); - void lowPassFilter(int16 *data, int len); + void lowPassFilter(int16 *data, uint len); void squareGenerator(int channel, int freq, int vol, - int noiseFeedback, int16 *sample, int len); - void generateSpkSamples(int16 *data, int len); - void generatePCjrSamples(int16 *data, int len); + int noiseFeedback, int16 *sample, uint len); + void generateSpkSamples(int16 *data, uint len); + void generatePCjrSamples(int16 *data, uint len); }; |