Skip to content

Commit

Permalink
Merge pull request robotology#2664 from randaz81/audio_gain
Browse files Browse the repository at this point in the history
Audio gain fix
  • Loading branch information
randaz81 authored Jul 26, 2021
2 parents e58ffbe + 1aaf5b1 commit 0876f08
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/release/yarp_3_5/audio_gain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
audio_gain {#yarp_3_5}
-----------

Important Changes
-----------------

## Libraries

### `dev`

* fixed parsing of parameters `hw_gain` and `sw_gain` in the two classes `AudioPlayerDeviceBase` and `AudioRecorderDeviceBase`
2 changes: 2 additions & 0 deletions src/libYARP_dev/src/yarp/dev/AudioPlayerDeviceBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ bool AudioPlayerDeviceBase::configurePlayerAudioDevice(yarp::os::Searchable& con
m_audioplayer_cfg.frequency = config.check("rate", Value(0), "audio sample rate (0=automatic)").asInt32();
m_audioplayer_cfg.numSamples = config.check("samples", Value(0), "number of samples per network packet (0=automatic). For chunks of 1 second of recording set samples=rate. Channels number is handled internally.").asInt32();
m_audioplayer_cfg.numChannels = config.check("channels", Value(0), "number of audio channels (0=automatic, max is 2)").asInt32();
m_hw_gain = config.check("hw_gain", Value(1.0), "HW gain").asFloat32();
m_sw_gain = config.check("sw_gain", Value(1.0), "SW gain").asFloat32();

if (m_audioplayer_cfg.numChannels == 0) {
m_audioplayer_cfg.numChannels = DEFAULT_NUM_CHANNELS;
Expand Down
2 changes: 2 additions & 0 deletions src/libYARP_dev/src/yarp/dev/AudioRecorderDeviceBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ bool AudioRecorderDeviceBase::configureRecorderAudioDevice(yarp::os::Searchable&
m_audiorecorder_cfg.frequency = config.check("rate", Value(0), "audio sample rate (0=automatic)").asInt32();
m_audiorecorder_cfg.numSamples = config.check("samples", Value(0), "number of samples per network packet (0=automatic). For chunks of 1 second of recording set samples=rate. Channels number is handled internally.").asInt32();
m_audiorecorder_cfg.numChannels = config.check("channels", Value(0), "number of audio channels (0=automatic, max is 2)").asInt32();
m_hw_gain = config.check("hw_gain", Value(1.0), "HW gain").asFloat32();
m_sw_gain = config.check("sw_gain", Value(1.0), "SW gain").asFloat32();

if (m_audiorecorder_cfg.frequency == 0) {
m_audiorecorder_cfg.frequency = DEFAULT_SAMPLE_RATE;
Expand Down

0 comments on commit 0876f08

Please sign in to comment.