Skip to content

Commit

Permalink
Adjust maximum volume
Browse files Browse the repository at this point in the history
  • Loading branch information
sh123 committed Oct 28, 2024
1 parent 141eee9 commit 2a216ff
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@
#define CFG_AUDIO_RESAMPLE_COEFF 2 // 1 or 2 only
#define CFG_AUDIO_CODEC2_MODE CODEC2_MODE_1600
#define CFG_AUDIO_MAX_PKT_SIZE 48 // maximum super frame size
#define CFG_AUDIO_MAX_VOL 500 // maximum volume
#define CFG_AUDIO_VOL 300 // default volume
#define CFG_AUDIO_MAX_VOL 2000 // maximum volume
#define CFG_AUDIO_VOL 500 // default volume

// audio, opus
#define CFG_AUDIO_OPUS_BITRATE 3200
Expand Down
2 changes: 1 addition & 1 deletion include/version.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef VERSION_H
#define VERSION_H

#define LORADV_VERSION "1.0.15"
#define LORADV_VERSION "1.0.16"

#endif // VERSION_H
5 changes: 1 addition & 4 deletions src/audio_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void AudioTask::start(std::shared_ptr<const Config> config, std::shared_ptr<Radi

void AudioTask::changeVolume(int deltaVolume)
{
int newVolume = volume_ + deltaVolume;
int newVolume = volume_ + 10 * deltaVolume;
if (newVolume >= 0 && newVolume <= maxVolume_)
setVolume(newVolume);
}
Expand Down Expand Up @@ -280,7 +280,6 @@ void AudioTask::audioTaskRecord()
pmService_->lightSleepReset();
packetSize = 0;
}
if (!isPttOn_) break;
// read and encode one sample
size_t bytesRead;
int16_t *pcmReadBuffer = pcmResampleBuffer_;
Expand All @@ -291,9 +290,7 @@ void AudioTask::audioTaskRecord()
Utils::audio_downsample_2x(pcmReadBuffer, pcmFrameBuffer_, readDataSize);
pcmReadBuffer = pcmFrameBuffer_;
}
if (!isPttOn_) break;
int encodedFrameSize = audioCodec_->encode(encodedFrameBuffer_, pcmReadBuffer);
if (!isPttOn_) break;
// transfer data to the radio packet queue
for (int i = 0; i < encodedFrameSize; i++) {
radioTask_->writeNextByte(encodedFrameBuffer_[i]);
Expand Down
2 changes: 1 addition & 1 deletion src/settings_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class SettingsAudioVolItem : public SettingsItem {
public:
SettingsAudioVolItem(std::shared_ptr<Config> config, int index) : SettingsItem(config, index) {}
void changeValue(int delta) {
long newVal = config_->AudioVol + delta;
long newVal = config_->AudioVol + 10 * delta;
if (newVal >= 0 && newVal <= CFG_AUDIO_MAX_VOL) config_->AudioVol = newVal;
}
void getName(std::stringstream &s) const { s << index_ << ".Volume"; }
Expand Down

0 comments on commit 2a216ff

Please sign in to comment.