~aleteoryx/muditaos

ref: fe79d2d934e34e36af20d6875e74a185bedffc49 muditaos/module-audio/Audio/VolumeScaler.hpp -rw-r--r-- 871 bytes
fe79d2d9 — Bartosz Cichocki [EGD-6809] Block building unrebased commit 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