~aleteoryx/muditaos

dc48e6c7e7c0da0c1574f7a36634331e5ffd15df — Lukasz Mastalerz 2 years ago 80905d5
[CP-1841] Distorted playback and poor device control responsiveness

Fixed problem with an unresponding device after playing specific WAV files.
WAV files encoded with ADPCM are not supported now by the devices.
3 files changed, 22 insertions(+), 0 deletions(-)

M harmony_changelog.md
M module-audio/tags_fetcher/TagsFetcher.cpp
M pure_changelog.md
M harmony_changelog.md => harmony_changelog.md +1 -0
@@ 15,6 15,7 @@
* Fixed settings frontlight intensity in on demand mode
* Fixed problem that UI could be occasionally broken
* Fixed problem with displaying end of title when playing song in loop was selected.
* Fixed problem with an unresponding device after playing specific WAV files.

### Added


M module-audio/tags_fetcher/TagsFetcher.cpp => module-audio/tags_fetcher/TagsFetcher.cpp +20 -0
@@ 3,12 3,28 @@

#include "TagsFetcher.hpp"
#include <Utils.hpp>
#include <riff/wav/wavproperties.h>
#include "fileref.h"

namespace tags::fetcher
{
    namespace
    {
        bool isFormatSupported(TagLib::AudioProperties *properties)
        {
            /* WAV formats from taglib wav properties :
             * 0 for unknown, 1 for PCM, 2 for ADPCM, 3 for 32/64-bit IEEE754
             *
             * MuditaOS does not support WAV ADPCM encoding
             * */
            constexpr auto WAV_ADPCM = 2;
            auto wav_properties      = dynamic_cast<const TagLib::RIFF::WAV::Properties *>(properties);
            if (wav_properties == nullptr) {
                return true;
            }
            return wav_properties->format() != WAV_ADPCM;
        }

        std::string getTitleFromFilePath(const std::string &path)
        {
            const auto pos = path.rfind('/');


@@ 25,6 41,10 @@ namespace tags::fetcher
            if (!tagReader.isNull() && (tags != nullptr)) {
                const auto properties = tagReader.audioProperties();

                if (!isFormatSupported(properties)) {
                    return std::nullopt;
                }

                constexpr bool unicode = true;

                const auto artist  = tags->artist().to8Bit(unicode);

M pure_changelog.md => pure_changelog.md +1 -0
@@ 34,6 34,7 @@
* Fixed redundant logs about CSQ reporting mode
* Fixed adding USSD codes to phonebook
* Fixed slider-related crash on phone turn off
* Fixed problem with an unresponding device after playing specific WAV files.


## [1.7.0 2023-03-23]