Skip to content

Commit c96bed8

Browse files
committed
VS1053Stream: cleanup float conversions
1 parent bc032fe commit c96bed8

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/AudioTools/AudioLibs/VS1053Stream.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -197,38 +197,38 @@ class VS1053Stream : public AudioStream, public VolumeSupport {
197197
bool setVolume(float vol) override {
198198
// make sure that value is between 0 and 1
199199
float volume = vol;
200-
if (volume>1.0) volume = 1.0;
201-
if (volume<0.0) volume = 0.0;
200+
if (volume>1.0f) volume = 1.0f;
201+
if (volume<0.0f) volume = 0.0f;
202202
LOGD("setVolume: %f", volume);
203203
if (p_vs1053!=nullptr){
204204
// Set the player volume.Level from 0-100, higher is louder
205-
p_vs1053->setVolume(volume*100.0);
205+
p_vs1053->setVolume(volume*100.0f);
206206
}
207207
return true;
208208
}
209209

210210
/// provides the volume
211211
float volume() override {
212212
TRACED();
213-
if (p_vs1053==nullptr) return -1.0;
214-
return p_vs1053->getVolume()/100.0;;
213+
if (p_vs1053==nullptr) return -1.0f;
214+
return p_vs1053->getVolume() / 100.0f;;
215215
}
216216

217217
/// Adjusting the left and right volume balance, higher to enhance the right side, lower to enhance the left side.
218218
void setBalance(float bal){
219219
float balance = bal;
220-
if (balance<-1.0) balance = -1;
221-
if (balance>1.0) balance = 1;
220+
if (balance<-1.0f) balance = -1.0f;
221+
if (balance>1.0f) balance = 1.0f;
222222
LOGD("setBalance: %f", balance);
223223
if (p_vs1053!=nullptr){
224-
p_vs1053->setBalance(balance*100.0);
224+
p_vs1053->setBalance(balance*100.0f);
225225
}
226226
}
227227
/// Get the currenet balance setting (-1.0..1.0)
228228
float balance(){
229229
TRACED();
230-
if (p_vs1053==nullptr) return -1.0;
231-
return static_cast<float>(p_vs1053->getBalance())/100.0;
230+
if (p_vs1053==nullptr) return -1.0f;
231+
return static_cast<float>(p_vs1053->getBalance()) / 100.0f;
232232
}
233233

234234
/// Write audio data
@@ -282,10 +282,10 @@ class VS1053Stream : public AudioStream, public VolumeSupport {
282282
/// Sets the treble amplitude value (range 0 to 1.0)
283283
void setTreble(float val){
284284
float value = val;
285-
if (value<0.0) value = 0.0;
286-
if (value>1.0) value = 1.0;
285+
if (value<0.0f) value = 0.0f;
286+
if (value>1.0f) value = 1.0f;
287287
LOGD("setTreble: %f", value);
288-
getVS1053().setTreble(value*100);
288+
getVS1053().setTreble(value*100.0f);
289289
}
290290

291291
/// Provides the Bass amplitude value
@@ -297,10 +297,10 @@ class VS1053Stream : public AudioStream, public VolumeSupport {
297297
/// Sets the bass amplitude value (range 0 to 1.0)
298298
void setBass(float val){
299299
float value = val;
300-
if (value<0.0) value = 0.0;
301-
if (value>1.0) value = 1.0;
300+
if (value<0.0f) value = 0.0f;
301+
if (value>1.0f) value = 1.0f;
302302
LOGD("setBass: %f", value);
303-
getVS1053().setBass(value*100.0);
303+
getVS1053().setBass(value*100.0f);
304304
}
305305

306306
/// Sets the treble frequency limit in hz (range 0 to 15000)

0 commit comments

Comments
 (0)