~aleteoryx/muditaos

ref: ef3f840a4dfa76f16dd009c536782a8b28fec6e9 muditaos/module-audio/Audio/VolumeScaler.hpp -rw-r--r-- 871 bytes
ef3f840a — Marcin Smoczyński [EGD-6049] Add voice call over HSP 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once
#include "AudioCommon.hpp"

/// @brief Converts volume between system and bluetooth ranges.
namespace audio::volume::scaler
{
    /// @brief Takes volume level and converts it to according one for the system.
    /// @param avrcpVolume - AVRCP volume level.
    /// @return Volume level scaled to satisfy system's range [audio::minVolume, audio::maxVolume].
    Volume toSystemVolume(std::uint8_t avrcpVolume) noexcept;
    /// @brief Takes volume level and converts it to according one for the AVRCP.
    /// @param systemVolume - system volume level.
    /// @return Volume level scaled to satisfy AVRCP's range [0, 127].
    std::uint8_t toAvrcpVolume(float systemVolume) noexcept;
} // namespace audio::volume::scaler