diff options
author | Norbert Lange | 2009-07-17 21:23:54 +0000 |
---|---|---|
committer | Norbert Lange | 2009-07-17 21:23:54 +0000 |
commit | bb64bf008d03e01760a468d0df8cacb164725d41 (patch) | |
tree | d73710df5b07f3fa1ca30e719c1c1f58ebe0b107 /sound | |
parent | 81ac29ebca30c352646a5b21de512087cb96a672 (diff) | |
parent | 53756ef1d022a959b24c041e18f55eef34e60dd3 (diff) | |
download | scummvm-rg350-bb64bf008d03e01760a468d0df8cacb164725d41.tar.gz scummvm-rg350-bb64bf008d03e01760a468d0df8cacb164725d41.tar.bz2 scummvm-rg350-bb64bf008d03e01760a468d0df8cacb164725d41.zip |
merge with trunk
svn-id: r42574
Diffstat (limited to 'sound')
-rw-r--r-- | sound/aiff.cpp | 2 | ||||
-rw-r--r-- | sound/flac.cpp | 10 | ||||
-rw-r--r-- | sound/iff_sound.cpp (renamed from sound/iff.cpp) | 2 | ||||
-rw-r--r-- | sound/iff_sound.h (renamed from sound/iff.h) | 0 | ||||
-rw-r--r-- | sound/module.mk | 2 | ||||
-rw-r--r-- | sound/shorten.cpp | 8 | ||||
-rw-r--r-- | sound/shorten.h | 12 | ||||
-rw-r--r-- | sound/softsynth/mt32/partial.cpp | 22 | ||||
-rw-r--r-- | sound/softsynth/mt32/synth.cpp | 6 | ||||
-rw-r--r-- | sound/softsynth/mt32/synth.h | 4 | ||||
-rw-r--r-- | sound/softsynth/mt32/tables.cpp | 8 | ||||
-rw-r--r-- | sound/vorbis.cpp | 2 |
12 files changed, 49 insertions, 29 deletions
diff --git a/sound/aiff.cpp b/sound/aiff.cpp index 884becb212..3c8a7f02a4 100644 --- a/sound/aiff.cpp +++ b/sound/aiff.cpp @@ -94,7 +94,7 @@ bool loadAIFFFromStream(Common::SeekableReadStream &stream, int &size, int &rate uint16 numChannels = 0, bitsPerSample = 0; uint32 numSampleFrames = 0, offset = 0, blockSize = 0, soundOffset = 0; - while ((!foundCOMM || !foundSSND) && !stream.ioFailed()) { + while (!(foundCOMM && foundSSND) && !stream.err() && !stream.eos()) { uint32 length, pos; stream.read(buf, 4); diff --git a/sound/flac.cpp b/sound/flac.cpp index 5b6a04b726..bb633b8352 100644 --- a/sound/flac.cpp +++ b/sound/flac.cpp @@ -402,21 +402,23 @@ int FlacInputStream::readBuffer(int16 *buffer, const int numSamples) { } inline ::FLAC__SeekableStreamDecoderReadStatus FlacInputStream::callbackRead(FLAC__byte buffer[], FLAC_size_t *bytes) { - if (*bytes == 0) + if (*bytes == 0) { #ifdef LEGACY_FLAC return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; /* abort to avoid a deadlock */ #else return FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */ #endif + } const uint32 bytesRead = _inStream->read(buffer, *bytes); - if (bytesRead == 0 && _inStream->ioFailed()) + if (bytesRead == 0) { #ifdef LEGACY_FLAC - return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; + return _inStream->eos() ? FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK : FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; #else - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; + return _inStream->eos() ? FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM : FLAC__STREAM_DECODER_READ_STATUS_ABORT; #endif + } *bytes = static_cast<uint>(bytesRead); #ifdef LEGACY_FLAC diff --git a/sound/iff.cpp b/sound/iff_sound.cpp index 1df58b178c..60a1486ed5 100644 --- a/sound/iff.cpp +++ b/sound/iff_sound.cpp @@ -23,7 +23,7 @@ * */ -#include "sound/iff.h" +#include "sound/iff_sound.h" #include "sound/audiostream.h" #include "sound/mixer.h" #include "common/func.h" diff --git a/sound/iff.h b/sound/iff_sound.h index 82106cb75e..82106cb75e 100644 --- a/sound/iff.h +++ b/sound/iff_sound.h diff --git a/sound/module.mk b/sound/module.mk index 5f8ef0dbbe..aabe7fe729 100644 --- a/sound/module.mk +++ b/sound/module.mk @@ -5,7 +5,7 @@ MODULE_OBJS := \ aiff.o \ audiocd.o \ audiostream.o \ - iff.o \ + iff_sound.o \ flac.o \ fmopl.o \ mididrv.o \ diff --git a/sound/shorten.cpp b/sound/shorten.cpp index b550a5afec..e8066a49be 100644 --- a/sound/shorten.cpp +++ b/sound/shorten.cpp @@ -23,6 +23,10 @@ * */ +#include "sound/shorten.h" + +#ifdef SOUND_SHORTEN_H + // Based on etree's Shorten tool, version 3.6.1 // http://etree.org/shnutils/shorten/ @@ -32,7 +36,6 @@ #include "common/util.h" #include "common/stream.h" -#include "sound/shorten.h" #include "sound/audiostream.h" #include "sound/mixer.h" @@ -526,3 +529,6 @@ AudioStream *makeShortenStream(Common::SeekableReadStream &stream) { } } // End of namespace Audio + +#endif // defined(SOUND_SHORTEN_H) + diff --git a/sound/shorten.h b/sound/shorten.h index fa45ecc65d..c2a40280d3 100644 --- a/sound/shorten.h +++ b/sound/shorten.h @@ -23,6 +23,14 @@ * */ +// The code in this file is currently only used in SAGA2 (in the +// SAGA engine), so if that engine isn't enabled, we will skip +// compiling it. If you plan to use this code in another engine, +// you will have to add the proper define check here. +// Also please add the define check at the comment after the +// matching #endif further down this file. +#if defined(ENABLE_SAGA2) + #ifndef SOUND_SHORTEN_H #define SOUND_SHORTEN_H @@ -53,3 +61,7 @@ AudioStream *makeShortenStream(Common::ReadStream &stream); } // End of namespace Audio #endif + +#endif // defined(ENABLE_SAGA2) + + diff --git a/sound/softsynth/mt32/partial.cpp b/sound/softsynth/mt32/partial.cpp index 02610798dc..871eff03d2 100644 --- a/sound/softsynth/mt32/partial.cpp +++ b/sound/softsynth/mt32/partial.cpp @@ -35,9 +35,9 @@ // powf, resulting in a linker error because of multiple definitions. // Hence we re-define them here. The only potential drawback is that it // might be a little bit slower this way. -#define powf pow -#define floorf floor -#define fabsf fabs +#define powf(x,y) ((float)pow(x,y)) +#define floorf(x) ((float)floorf(x)) +#define fabsf(x) ((float)fabs(x)) #endif #define FIXEDPOINT_UDIV(x, y, point) (((x) << (point)) / ((y))) @@ -504,10 +504,10 @@ Bit16s *Partial::mixBuffersRingMix(Bit16s * buf1, Bit16s *buf2, int len) { a = ((float)*buf1) / 8192.0f; b = ((float)*buf2) / 8192.0f; a = (a * b) + a; - if (a>1.0) - a = 1.0; - if (a<-1.0) - a = -1.0; + if (a > 1.0f) + a = 1.0f; + if (a < -1.0f) + a = -1.0f; *buf1 = (Bit16s)(a * 8192.0f); buf1++; buf2++; @@ -537,10 +537,10 @@ Bit16s *Partial::mixBuffersRing(Bit16s * buf1, Bit16s *buf2, int len) { a = ((float)*buf1) / 8192.0f; b = ((float)*buf2) / 8192.0f; a *= b; - if (a>1.0) - a = 1.0; - if (a<-1.0) - a = -1.0; + if (a > 1.0f) + a = 1.0f; + if (a < -1.0f) + a = -1.0f; *buf1 = (Bit16s)(a * 8192.0f); buf1++; buf2++; diff --git a/sound/softsynth/mt32/synth.cpp b/sound/softsynth/mt32/synth.cpp index bedae241b3..547b2bb9b3 100644 --- a/sound/softsynth/mt32/synth.cpp +++ b/sound/softsynth/mt32/synth.cpp @@ -35,9 +35,9 @@ // powf, resulting in a linker error because of multiple definitions. // Hence we re-define them here. The only potential drawback is that it // might be a little bit slower this way. -#define powf pow -#define floorf floor -#define fabsf fabs +#define powf(x,y) ((float)pow(x,y)) +#define floorf(x) ((float)floorf(x)) +#define fabsf(x) ((float)fabs(x)) #endif namespace MT32Emu { diff --git a/sound/softsynth/mt32/synth.h b/sound/softsynth/mt32/synth.h index 9d57c8d3cd..3fc303d322 100644 --- a/sound/softsynth/mt32/synth.h +++ b/sound/softsynth/mt32/synth.h @@ -22,7 +22,7 @@ #ifndef MT32EMU_SYNTH_H #define MT32EMU_SYNTH_H -#include <stdarg.h> +#include "common/scummsys.h" class revmodel; @@ -256,7 +256,7 @@ protected: int report(ReportType type, const void *reportData); File *openFile(const char *filename, File::OpenMode mode); void closeFile(File *file); - void printDebug(const char *fmt, ...); + void printDebug(const char *fmt, ...) GCC_PRINTF(2, 3); public: static Bit8u calcSysexChecksum(const Bit8u *data, Bit32u len, Bit8u checksum); diff --git a/sound/softsynth/mt32/tables.cpp b/sound/softsynth/mt32/tables.cpp index bf35db776a..16fc4f71e5 100644 --- a/sound/softsynth/mt32/tables.cpp +++ b/sound/softsynth/mt32/tables.cpp @@ -35,9 +35,9 @@ // powf, resulting in a linker error because of multiple definitions. // Hence we re-define them here. The only potential drawback is that it // might be a little bit slower this way. -#define powf pow -#define floorf floor -#define fabsf fabs +#define powf(x,y) ((float)pow(x,y)) +#define floorf(x) ((float)floorf(x)) +#define fabsf(x) ((float)fabs(x)) #endif #define FIXEDPOINT_MAKE(x, point) ((Bit32u)((1 << point) * x)) @@ -730,7 +730,7 @@ Tables::Tables() { bool Tables::init(Synth *synth, PCMWaveEntry *pcmWaves, float sampleRate, float masterTune) { if (sampleRate <= 0.0f) { - synth->printDebug("Bad sampleRate (%d <= 0.0f)", sampleRate); + synth->printDebug("Bad sampleRate (%f <= 0.0f)", sampleRate); return false; } if (initialisedSampleRate == 0.0f) { diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp index 9658f8f257..8b8bb8f649 100644 --- a/sound/vorbis.cpp +++ b/sound/vorbis.cpp @@ -60,7 +60,7 @@ static size_t read_stream_wrap(void *ptr, size_t size, size_t nmemb, void *datas static int seek_stream_wrap(void *datasource, ogg_int64_t offset, int whence) { Common::SeekableReadStream *stream = (Common::SeekableReadStream *)datasource; - stream->seek(offset, whence); + stream->seek((int32)offset, whence); return stream->pos(); } |