M changelog.md => changelog.md +4 -0
@@ 4,6 4,10 @@
* `[cellular]` Integration with basic flow for SIM card (cellular<>GUI)
+### Fixed
+
+* `[audio]` Fix playback of mono sound using headphones
+
## [0.48.1 2020-11-23]
### Added
M module-audio/Audio/Operation/PlaybackOperation.cpp => module-audio/Audio/Operation/PlaybackOperation.cpp +10 -3
@@ 90,9 90,16 @@ namespace audio
eventCallback = callback;
state = State::Active;
- currentProfile->SetInOutFlags(tags->num_channel == 2
- ? static_cast<uint32_t>(bsp::AudioDevice::Flags::OutputStereo)
- : static_cast<uint32_t>(bsp::AudioDevice::Flags::OutputMono));
+ if (tags->num_channel == channel::stereoSound) {
+ currentProfile->SetInOutFlags(static_cast<uint32_t>(bsp::AudioDevice::Flags::OutputStereo));
+ }
+ else {
+ currentProfile->SetInOutFlags(static_cast<uint32_t>(bsp::AudioDevice::Flags::OutputMono));
+ if (currentProfile->GetOutputPath() == bsp::AudioDevice::OutputPath::Headphones) {
+ currentProfile->SetOutputPath(bsp::AudioDevice::OutputPath::HeadphonesMono);
+ }
+ }
+
currentProfile->SetSampleRate(tags->sample_rate);
auto ret = audioDevice->Start(currentProfile->GetAudioFormat());
M module-audio/Audio/decoder/decoder.hpp => module-audio/Audio/decoder/decoder.hpp +5 -0
@@ 12,6 12,11 @@
namespace audio
{
+ namespace channel
+ {
+ constexpr inline auto monoSound = 1;
+ constexpr inline auto stereoSound = 2;
+ } // namespace channel
struct Tags
{