summaryrefslogtreecommitdiff
path: root/src/audio/include/audio_source.hpp
blob: e062fd1aaa515fb049a21f03433708da23594799 (plain)
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
/*
 * Copyright 2023 jacqueline <me@jacqueline.id.au>
 *
 * SPDX-License-Identifier: GPL-3.0-only
 */

#pragma once

#include <stdint.h>

#include <memory>

#include "freertos/FreeRTOS.h"
#include "freertos/portmacro.h"
#include "freertos/semphr.h"

#include "stream_info.hpp"

namespace audio {

class IAudioSource {
 public:
  virtual ~IAudioSource() {}

  /*
   * Synchronously fetches data from this source.
   */
  virtual auto Read(std::function<bool(StreamInfo::Format)>,
                    std::function<size_t(cpp::span<const std::byte>)>,
                    TickType_t) -> void = 0;
};

}  // namespace audio