~aleteoryx/muditaos

ref: 80bdde9c9629b946454439871b77dee94d57ef75 muditaos/module-bsp/board/rt1051/bsp/audio/RT1051BluetoothAudio.hpp -rw-r--r-- 1.2 KiB
80bdde9c — Marcin Smoczyński ADd changelog for v0.53.1 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include "FreeRTOS.h"
#include "macros.h"
#include "task.h"
#include "bsp/audio/bsp_audio.hpp"
#include <module-bluetooth/Bluetooth/Device.hpp>
#include <mutex.hpp>

namespace bsp
{
    class RT1051BluetoothAudio final : public AudioDevice
    {
        static constexpr uint16_t stackSize = 1024;

      public:
        RT1051BluetoothAudio(AudioDevice::audioCallback_t callback);
        ~RT1051BluetoothAudio() final;

        AudioDevice::RetCode Start(const Format &format) final;
        AudioDevice::RetCode Stop() final;
        AudioDevice::RetCode OutputVolumeCtrl(float vol) final;
        AudioDevice::RetCode InputGainCtrl(float gain) final;
        AudioDevice::RetCode OutputPathCtrl(OutputPath outputPath) final;
        AudioDevice::RetCode InputPathCtrl(InputPath inputPath) final;
        bool IsFormatSupported(const Format &format) final;

        TaskHandle_t outWorkerThread;
        AudioData_t audioData;
        QueueHandle_t sourceQueue;
        DeviceMetadata_t metadata;
        void OutStop();

      private:
        void Init();
        void OutStart();
    };

} // namespace bsp