parent
370d1853b5
commit
9475d10d10
@ -0,0 +1,24 @@ |
||||
/*
|
||||
* Copyright 2024 jacqueline <me@jacqueline.id.au> |
||||
* |
||||
* SPDX-License-Identifier: GPL-3.0-only |
||||
*/ |
||||
|
||||
#include "tts/player.hpp" |
||||
|
||||
#include "esp_log.h" |
||||
|
||||
namespace tts { |
||||
|
||||
[[maybe_unused]] static constexpr char kTag[] = "ttsplay"; |
||||
|
||||
Player::Player(tasks::WorkerPool& worker, |
||||
drivers::PcmBuffer& output, |
||||
audio::FatfsStreamFactory& factory) |
||||
: bg_(worker), stream_factory_(factory), output_(output) {} |
||||
|
||||
auto Player::playFile(const std::string& path) -> void { |
||||
ESP_LOGI(kTag, "playing '%s'", path.c_str()); |
||||
} |
||||
|
||||
} // namespace tts
|
@ -0,0 +1,38 @@ |
||||
/*
|
||||
* Copyright 2024 jacqueline <me@jacqueline.id.au> |
||||
* |
||||
* SPDX-License-Identifier: GPL-3.0-only |
||||
*/ |
||||
|
||||
#pragma once |
||||
|
||||
#include <string> |
||||
|
||||
#include "audio/fatfs_stream_factory.hpp" |
||||
#include "drivers/pcm_buffer.hpp" |
||||
#include "tasks.hpp" |
||||
|
||||
namespace tts { |
||||
|
||||
/*
|
||||
* A TTS Player is the output stage of the TTS pipeline. It receives a stream |
||||
* of filenames that should be played, and handles decoding these files and |
||||
* sending them to the output buffer. |
||||
*/ |
||||
class Player { |
||||
public: |
||||
Player(tasks::WorkerPool&, drivers::PcmBuffer&, audio::FatfsStreamFactory&); |
||||
|
||||
auto playFile(const std::string& path) -> void; |
||||
|
||||
// Not copyable or movable.
|
||||
Player(const Player&) = delete; |
||||
Player& operator=(const Player&) = delete; |
||||
|
||||
private: |
||||
tasks::WorkerPool& bg_; |
||||
audio::FatfsStreamFactory& stream_factory_; |
||||
drivers::PcmBuffer& output_; |
||||
}; |
||||
|
||||
} // namespace tts
|
Loading…
Reference in new issue