diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/audiostream.cpp | 19 | ||||
-rw-r--r-- | sound/mixer.cpp | 8 | ||||
-rw-r--r-- | sound/rate.cpp | 6 |
3 files changed, 23 insertions, 10 deletions
diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp index ef96c2594b..d88ea852a9 100644 --- a/sound/audiostream.cpp +++ b/sound/audiostream.cpp @@ -19,6 +19,7 @@ * */ +#include "stdafx.h" #include "audiostream.h" #include "mixer.h" #include "common/engine.h" @@ -40,9 +41,11 @@ static inline int16 readSample(const byte *ptr) { } } +#ifndef _MSC_VER #pragma mark - #pragma mark --- LinearMemoryStream --- #pragma mark - +#endif template<bool stereo, bool is16Bit, bool isUnsigned> @@ -72,9 +75,11 @@ public: }; +#ifndef _MSC_VER #pragma mark - #pragma mark --- WrappedMemoryStream --- #pragma mark - +#endif // Wrapped memory stream, to be used by the ChannelStream class (and possibly others?) @@ -153,9 +158,11 @@ void WrappedMemoryStream<stereo, is16Bit, isUnsigned>::append(const byte *data, } +#ifndef _MSC_VER #pragma mark - #pragma mark --- MP3 (MAD) stream --- #pragma mark - +#endif #ifdef USE_MAD @@ -174,9 +181,11 @@ MP3InputStream::MP3InputStream() { #endif +#ifndef _MSC_VER #pragma mark - #pragma mark --- Ogg Vorbis stream --- #pragma mark - +#endif #ifdef USE_VORBIS @@ -255,9 +264,11 @@ void VorbisInputStream::refill() { #endif +#ifndef _MSC_VER #pragma mark - #pragma mark --- Input stream factories --- #pragma mark - +#endif template<bool stereo> @@ -294,16 +305,16 @@ static WrappedAudioInputStream *makeWrappedInputStream(uint32 len, bool isUnsign AudioInputStream *makeLinearInputStream(byte _flags, const byte *ptr, uint32 len) { if (_flags & SoundMixer::FLAG_STEREO) { - return makeLinearInputStream<true>(ptr, len, _flags & SoundMixer::FLAG_UNSIGNED, _flags & SoundMixer::FLAG_16BITS); + return makeLinearInputStream<true>(ptr, len, _flags & SoundMixer::FLAG_UNSIGNED, _flags & SoundMixer::FLAG_16BITS != 0); } else { - return makeLinearInputStream<false>(ptr, len, _flags & SoundMixer::FLAG_UNSIGNED, _flags & SoundMixer::FLAG_16BITS); + return makeLinearInputStream<false>(ptr, len, _flags & SoundMixer::FLAG_UNSIGNED, _flags & SoundMixer::FLAG_16BITS != 0); } } WrappedAudioInputStream *makeWrappedInputStream(byte _flags, uint32 len) { if (_flags & SoundMixer::FLAG_STEREO) { - return makeWrappedInputStream<true>(len, _flags & SoundMixer::FLAG_UNSIGNED, _flags & SoundMixer::FLAG_16BITS); + return makeWrappedInputStream<true>(len, _flags & SoundMixer::FLAG_UNSIGNED, _flags & SoundMixer::FLAG_16BITS != 0); } else { - return makeWrappedInputStream<false>(len, _flags & SoundMixer::FLAG_UNSIGNED, _flags & SoundMixer::FLAG_16BITS); + return makeWrappedInputStream<false>(len, _flags & SoundMixer::FLAG_UNSIGNED, _flags & SoundMixer::FLAG_16BITS != 0); } } diff --git a/sound/mixer.cpp b/sound/mixer.cpp index d9245e4eaf..3af9c1f4ed 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -677,7 +677,7 @@ ChannelRaw::ChannelRaw(SoundMixer *mixer, PlayingSoundHandle *handle, void *soun // TODO: add support for SoundMixer::FLAG_REVERSE_STEREO // Get a rate converter instance - _converter = makeRateConverter(rate, mixer->getOutputRate(), flags & SoundMixer::FLAG_STEREO); + _converter = makeRateConverter(rate, mixer->getOutputRate(), flags & SoundMixer::FLAG_STEREO != 0); #else _pos = 0; _fpPos = 0; @@ -725,7 +725,7 @@ void ChannelRaw::mix(int16 *data, uint len) { const int volume = _mixer->getVolume(); uint tmpLen = len; - _converter->flow(*_input, data, &tmpLen, volume); + _converter->flow(*_input, data, (st_size_t *) &tmpLen, volume); #else byte *s, *end; @@ -768,7 +768,7 @@ ChannelStream::ChannelStream(SoundMixer *mixer, PlayingSoundHandle *handle, void // TODO: add support for SoundMixer::FLAG_REVERSE_STEREO // Get a rate converter instance - _converter = makeRateConverter(rate, mixer->getOutputRate(), flags & SoundMixer::FLAG_STEREO); + _converter = makeRateConverter(rate, mixer->getOutputRate(), flags & SoundMixer::FLAG_STEREO != 0); #else _flags = flags; _bufferSize = buffer_size; @@ -846,7 +846,7 @@ void ChannelStream::mix(int16 *data, uint len) { const int volume = _mixer->getVolume(); uint tmpLen = len; - _converter->flow(*_input, data, &tmpLen, volume); + _converter->flow(*_input, data, (st_size_t *) &tmpLen, volume); #else if (_pos == _endOfData) { // Normally, the stream stays around even if all its data is used up. diff --git a/sound/rate.cpp b/sound/rate.cpp index 0acabd363f..89751029f7 100644 --- a/sound/rate.cpp +++ b/sound/rate.cpp @@ -141,7 +141,7 @@ resume: while (rate->ipos > rate->opos && obuf < oend) { // interpolate - out = ilast[0] + (((icur[0] - ilast[0]) * rate->opos_frac + (1UL << (FRAC_BITS-1))) >> FRAC_BITS); + out = (st_sample_t) (ilast[0] + (((icur[0] - ilast[0]) * rate->opos_frac + (1UL << (FRAC_BITS-1))) >> FRAC_BITS)); // adjust volume out = out * vol / 256; @@ -150,7 +150,7 @@ resume: if (stereo) { // interpolate - out = ilast[1] + (((icur[1] - ilast[1]) * rate->opos_frac + (1UL << (FRAC_BITS-1))) >> FRAC_BITS); + out = (st_sample_t) (ilast[1] + (((icur[1] - ilast[1]) * rate->opos_frac + (1UL << (FRAC_BITS-1))) >> FRAC_BITS)); // adjust volume out = out * vol / 256; } @@ -180,7 +180,9 @@ the_end: } +#ifndef _MSC_VER #pragma mark - +#endif LinearRateConverter::LinearRateConverter(st_rate_t inrate, st_rate_t outrate) { |