Skip to content

Commit 7aac18f

Browse files
committed
Compile Warnings
1 parent 81af0e5 commit 7aac18f

File tree

11 files changed

+36
-35
lines changed

11 files changed

+36
-35
lines changed

src/AudioTools/CoreAudio/AudioBasic/Int24_3bytes_t.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ class int24_3bytes_t {
132132
} // namespace audio_tools
133133

134134
#ifdef USE_TYPETRAITS
135+
#include <limits>
135136

136137
namespace std {
137138
template<> class numeric_limits<audio_tools::int24_3bytes_t> {

src/AudioTools/CoreAudio/AudioBasic/Int24_4bytes_t.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ class int24_4bytes_t {
137137
} // namespace audio_tools
138138

139139
#ifdef USE_TYPETRAITS
140+
#include <limits>
140141

141142
namespace std {
142143
template<> class numeric_limits<audio_tools::int24_4bytes_t> {

src/AudioTools/CoreAudio/AudioEffects/AudioEffect.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -273,20 +273,20 @@ class Delay : public AudioEffect {
273273

274274
void setDepth(float value) {
275275
depth = value;
276-
if (depth > 1.0)
277-
depth = 1.0;
278-
if (depth < 0)
279-
depth = 0.0;
276+
if (depth > 1.0f)
277+
depth = 1.0f;
278+
if (depth < 0.0f)
279+
depth = 0.0f;
280280
}
281281

282282
float getDepth() { return depth; }
283283

284284
void setFeedback(float feed) {
285285
feedback = feed;
286-
if (feedback > 1.0)
287-
feedback = 1.0;
288-
if (feedback < 0)
289-
feedback = 0.0;
286+
if (feedback > 1.0f)
287+
feedback = 1.0f;
288+
if (feedback < 0.0f)
289+
feedback = 0.0f;
290290
}
291291

292292
float getFeedback() { return feedback; }
@@ -306,7 +306,7 @@ class Delay : public AudioEffect {
306306
int32_t delayed_value = buffer[delay_line_index];
307307

308308
// Mix the above with current audio and write the results back to output
309-
int32_t out = ((1.0 - depth) * input) + (depth * delayed_value);
309+
int32_t out = ((1.0f - depth) * input) + (depth * delayed_value);
310310

311311
// Update each delay line
312312
buffer[delay_line_index] = clip(feedback * (delayed_value + input));
@@ -322,7 +322,7 @@ class Delay : public AudioEffect {
322322

323323
protected:
324324
Vector<effect_t> buffer{0};
325-
float feedback = 0.0, duration = 0.0, sampleRate = 0.0, depth = 0.0;
325+
float feedback = 0.0f, duration = 0.0f, sampleRate = 0.0f, depth = 0.0f;
326326
size_t delay_len_samples = 0;
327327
size_t delay_line_index = 0;
328328

@@ -510,7 +510,7 @@ class Compressor : public AudioEffect {
510510

511511
/// Defines the compression ratio from 0 to 1
512512
void setCompressionRatio(float compressionRatio){
513-
if (compressionRatio<1.0){
513+
if (compressionRatio < 1.0f){
514514
gainreduce = compressionRatio;
515515
}
516516
recalculate();

src/AudioTools/CoreAudio/AudioEffects/PitchShift.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ template <typename T> class VariableSpeedRingBuffer : public BaseBuffer<T> {
238238
}
239239

240240
T read() {
241-
assert(read_increment != 0.0);
241+
assert(read_increment != 0.0f);
242242
T result = peek();
243243
read_pos_float += read_increment;
244244
handleReadWriteOverrun(last_value);
@@ -283,8 +283,8 @@ template <typename T> class VariableSpeedRingBuffer : public BaseBuffer<T> {
283283
protected:
284284
Vector<T> buffer{0};
285285
int buffer_size;
286-
float read_pos_float = 0.0;
287-
float read_increment = 0.0;
286+
float read_pos_float = 0.0f;
287+
float read_increment = 0.0f;
288288
int write_pos = 0;
289289
// used to handle overruns:
290290
T last_value = 0; // record last read value

src/AudioTools/CoreAudio/AudioEffects/SoundGenerator.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ template <class T> class SineWaveGenerator : public SoundGenerator<T> {
213213
float m_amplitude = 1.0f;
214214
float m_deltaTime = 0.0f;
215215
float m_phase = 0.0f;
216-
const float double_Pi = PI * 2.0f;
216+
const float double_Pi = 2.0f * PI;
217217

218218
void logStatus() {
219219
SoundGenerator<T>::info.logStatus();
@@ -243,8 +243,8 @@ template <class T> class FastSineGenerator : public SineWaveGenerator<T> {
243243
T result = SineWaveGenerator<T>::m_amplitude * sine(angle);
244244
SineWaveGenerator<T>::m_cycles +=
245245
SineWaveGenerator<T>::m_frequency * SineWaveGenerator<T>::m_deltaTime;
246-
if (SineWaveGenerator<T>::m_cycles > 1.0) {
247-
SineWaveGenerator<T>::m_cycles -= 1.0;
246+
if (SineWaveGenerator<T>::m_cycles > 1.0f) {
247+
SineWaveGenerator<T>::m_cycles -= 1.0f;
248248
}
249249
return result;
250250
}

src/AudioTools/CoreAudio/AudioIO.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class TransformationReader {
5454

5555
// we read half the necessary bytes
5656
if (buffer.size() == 0) {
57-
int size = (0.5 / p_transform->getByteFactor() * len);
57+
int size = (0.5f / p_transform->getByteFactor() * len);
5858
// process full samples/frames
5959
size = size / 4 * 4;
6060
LOGI("read size: %d", size);

src/AudioTools/CoreAudio/Buffers.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ class BaseBuffer {
147147
/// Returns the level of the buffer in %
148148
virtual float levelPercent() {
149149
// prevent div by 0.
150-
if (size()==0) return 0.0;
151-
return 100.0 * static_cast<float>(available()) / static_cast<float>(size());
150+
if (size()==0) return 0.0f;
151+
return 100.0f * static_cast<float>(available()) / static_cast<float>(size());
152152
}
153153

154154
protected:

src/AudioTools/CoreAudio/MusicalNotes.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,17 @@ class MusicalNotes {
199199

200200
/// Determine frequency of MIDI note
201201
float midiNoteToFrequency(int x) const {
202-
float a = 440; //frequency of A (coomon value is 440Hz)
203-
return (a / 32) * pow(2, ((x - 9) / 12.0f));
202+
float a = 440.0f; //frequency of A (coomon value is 440Hz)
203+
return (a / 32.0f) * powf(2.0f, ((x - 9) / 12.0f));
204204
}
205205

206206
/// Provide MIDI note for frequency
207207
int frequencyToMidiNote(float freq) const {
208-
return log(freq/440.0f)/log(2) * 12.0f + 69.0f;
208+
return logf(freq/440.0f)/logf(2) * 12.0f + 69.0f;
209209
}
210210

211211
float stkNoteToFrequency(int noteNumber) const {
212-
return 220.0f * pow( 2.0f, (noteNumber - 57.0f) / 12.0f );
212+
return 220.0f * powf( 2.0f, (noteNumber - 57.0f) / 12.0f );
213213
}
214214

215215
protected:

src/AudioTools/CoreAudio/ResampleStream.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class ResampleStream : public ReformatBaseStream {
194194
}
195195
}
196196

197-
float getByteFactor() { return 1.0 / step_size; }
197+
float getByteFactor() { return 1.0f / step_size; }
198198

199199
protected:
200200
Vector<uint8_t> last_samples{0};
@@ -221,7 +221,7 @@ class ResampleStream : public ReformatBaseStream {
221221
size_t write(Print *p_out, const uint8_t *buffer, size_t bytes,
222222
size_t &written) {
223223
this->p_out = p_out;
224-
if (step_size == 1.0) {
224+
if (step_size == 1.0f) {
225225
written = p_out->write(buffer, bytes);
226226
return written;
227227
}

src/AudioTools/CoreAudio/VolumeControl.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,12 @@ class CachedVolumeControl : public VolumeControl {
5454
/// determines a multiplication factor (0.0 to 1.0) from an input value (0.0 to 1.0).
5555
virtual float getVolumeFactor(float volume) {
5656
if (p_vc==nullptr) return 1.0f; // prevent NPE
57-
if (abs(volume-in)<0.01f){
57+
if (fabs(volume-in)<0.01f){
5858
return out;
59-
} else {
60-
in = volume;
61-
out = p_vc->getVolumeFactor(volume);
62-
return out;
63-
}
59+
}
60+
in = volume;
61+
out = p_vc->getVolumeFactor(volume);
62+
return out;
6463
}
6564

6665
protected:
@@ -86,9 +85,9 @@ class LogarithmicVolumeControl : public VolumeControl {
8685

8786
// provides a factor in the range of 0.0 to 1.0
8887
virtual float getVolumeFactor(float input) {
89-
float b = pow(((1/ym)-1), 2);
88+
float b = powf(((1/ym)-1), 2);
9089
float a = 1.0f / (b - 1.0f);
91-
float volumeFactor = pow(b,input) * a - a;
90+
float volumeFactor = powf(b,input) * a - a;
9291
return limit(volumeFactor);
9392
}
9493

0 commit comments

Comments
 (0)