MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
SoundFileBridge.cpp
Go to the documentation of this file.
1#include "SoundFileBridge.hpp"
2
4
6
9
12
13namespace MayaFlux::Buffers {
14
16 const std::shared_ptr<Kakshya::SoundFileContainer>& file_container,
17 uint32_t source_channel)
18 : SoundContainerBuffer(channel_id, Config::get_buffer_size(), std::dynamic_pointer_cast<Kakshya::StreamContainer>(file_container), source_channel)
19{
20}
21
23{
24 m_capture_stream = std::make_shared<Kakshya::DynamicSoundStream>(
26 get_container()->get_structure().get_channel_count());
27
28 m_stream_writer = std::make_shared<SoundStreamWriter>(m_capture_stream);
29
30 auto chain = get_processing_chain();
31 if (!chain) {
32 chain = std::make_shared<BufferProcessingChain>();
34 }
35 chain->set_preferred_token(token);
36
37 chain->add_postprocessor(m_stream_writer, shared_from_this());
38
40}
41
42} // namespace MayaFlux::Buffers
static MayaFlux::Nodes::ProcessingToken token
Definition Timers.cpp:8
virtual void set_processing_chain(const std::shared_ptr< BufferProcessingChain > &chain, bool force=false) override
Sets the audio transformation chain for this buffer.
virtual void enforce_default_processing(bool should_process) override
Controls whether the audio buffer should use default processing.
virtual std::shared_ptr< BufferProcessingChain > get_processing_chain() override
Gets the audio transformation chain attached to this buffer.
std::shared_ptr< Kakshya::StreamContainer > get_container() const
Get the backing StreamContainer.
AudioBuffer implementation backed by a StreamContainer.
std::shared_ptr< SoundStreamWriter > m_stream_writer
void setup_processors(Buffers::ProcessingToken token) override
Setup the processing chain with automatic input/output.
std::shared_ptr< Kakshya::DynamicSoundStream > m_capture_stream
SoundFileBridge(uint32_t channel_id, const std::shared_ptr< Kakshya::SoundFileContainer > &file_container, uint32_t source_channel=0)
Construct a file-to-stream bridge.
ProcessingToken
Bitfield enum defining processing characteristics and backend requirements for buffer operations.
uint32_t get_sample_rate()
Gets the sample rate from the default engine.
Definition Config.cpp:46