baldram / ESP_VS1053_Library

A library for VS1053 MP3 Codec Breakout adapted for Espressif ESP8266 and ESP32 boards.
https://platformio.org/lib/show/1744/ESP_VS1053_Library
GNU General Public License v3.0
114 stars 36 forks source link

Add left and right volume balance enhancement #53

Closed fabitom closed 4 years ago

fabitom commented 4 years ago

Enhancement for adjusting the left and right volume balance. According to documentation the lowest value (total silence) for SCI_VOL is 0xFEFE (instead FFFF) so I also modify map function.

map(valueL, 0, 100, 0xFE, 0x00);
baldram commented 4 years ago

Thank you for the pull request. How about the backward compatibility if the new setBalance is not used at all in the code. Is there a possibility to set some default initial value? Or it's not mandatory to set. How does it behave?

fabitom commented 4 years ago

Thank you for the pull request. How about the backward compatibility if the new setBalance is not used at all in the code. Is there a possibility to set some default initial value?

there is, if curbalance = 0 then the function will generate same result. Only map function will be execute two times (separate for left and right channel).

Edit: Right, its not static. We should be safe now.

baldram commented 4 years ago

Ah ok, I see curbalance is initialized with zero.