ADL: Fix Signed vs. Unsigned Compiler Warnings.

This is a subtle issue associated with the Common::Frac usage. The
frac_t type is signed (int32), but the symbols such as FRAC_ONE are
defined by an enumeration which will default to unsigned int for
members. Unsure if the common code needs changing, but other usages fix
the warning by casting the enumeration values to frac_t so doing this
for now.
This commit is contained in:
D G Turner 2017-01-15 07:10:38 +00:00
parent 75894a871c
commit 8b4460e310

View File

@ -55,7 +55,7 @@ Speaker::Speaker(int sampleRate) :
void Speaker::startTone(double freq) {
_halfWaveLen = _halfWaveRem = doubleToFrac(_rate / freq / 2);
if (_halfWaveLen < FRAC_ONE) {
if (_halfWaveLen < (frac_t)FRAC_ONE) {
// Tone out of range at this sample rate
stopTone();
}
@ -70,7 +70,7 @@ void Speaker::generateSamples(int16 *buffer, int numSamples) {
int offset = 0;
while (offset < numSamples) {
if (_halfWaveRem >= 0 && _halfWaveRem < FRAC_ONE) {
if (_halfWaveRem >= 0 && _halfWaveRem < (frac_t)FRAC_ONE) {
// Rising/falling edge
// Switch level
_curSample = ~_curSample;