diff options
author | Max Horn | 2009-07-01 20:51:04 +0000 |
---|---|---|
committer | Max Horn | 2009-07-01 20:51:04 +0000 |
commit | a6b57dc3a986f749ca8f915b461b184d48390757 (patch) | |
tree | d6c3e5e46743dd5073b8853613d61e501fa76fcd /sound/softsynth/mt32 | |
parent | 62acda5fdbe0daaeae9e1d0f08044b8be4ee98cf (diff) | |
download | scummvm-rg350-a6b57dc3a986f749ca8f915b461b184d48390757.tar.gz scummvm-rg350-a6b57dc3a986f749ca8f915b461b184d48390757.tar.bz2 scummvm-rg350-a6b57dc3a986f749ca8f915b461b184d48390757.zip |
- Added GCC_PRINTF attribute to several funcs where it makes sense
- change some constants from double to float, to avoid "loss of precision due to implicit conversion" warnings
- removed duplicate prototypes for some funcs
- fixed some "increases required alignment of target type" warnings
svn-id: r42009
Diffstat (limited to 'sound/softsynth/mt32')
-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 |
4 files changed, 20 insertions, 20 deletions
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) { |