MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
PlotSource.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace MayaFlux::Nodes {
6class Node;
7namespace Network {
8 class NodeNetwork;
9}
10}
11
12namespace MayaFlux::Buffers {
13class AudioBuffer;
14}
15
16namespace MayaFlux::Kakshya {
17class PlotContainer;
18}
19
21
22/**
23 * @class Source
24 * @brief Chainable builder for PlotContainer construction.
25 *
26 * Eliminates manual container creation, index threading, and
27 * mark_ready_for_processing() calls. .as() adds a series and records its
28 * index; the following .with() binds a source to it. Pairs may be chained
29 * indefinitely. Call .build() as the terminal to obtain the container.
30 *
31 * @code
32 * auto container = Source()
33 * .as("fm_sine", 512, Role::SPATIAL_Y, DataModality::AUDIO_1D).with(sine)
34 * .as("mod", 512, Role::SPATIAL_Y, DataModality::AUDIO_1D).with(mod)
35 * .build();
36 * @endcode
37 */
38class MAYAFLUX_API Source {
39public:
40 Source();
41
42 /**
43 * @brief Add a named series and record its index for the next with() call.
44 * @param name Series name.
45 * @param count Sample count.
46 * @param role Semantic role.
47 * @param modality Data modality.
48 */
49 Source& as(
50 std::string name,
51 uint64_t count,
53 Kakshya::DataModality modality);
54
55 /** @brief Bind a Node to the last series added by as(). */
56 Source& from(std::shared_ptr<Nodes::Node> node);
57
58 /** @brief Bind an AudioBuffer to the last series added by as(). */
59 Source& from(std::shared_ptr<Buffers::AudioBuffer> buf);
60
61 /** @brief Bind a NodeNetwork to the last series added by as(). */
62 Source& from(std::shared_ptr<Nodes::Network::NodeNetwork> net);
63
64 /** @brief Bind a callable to the last series added by as(). */
65 Source& from(std::function<void(std::vector<double>&)> fn);
66
67 /**
68 * @brief Finalise and return the constructed container.
69 * @return Ready PlotContainer with all series added and sources bound.
70 */
71 [[nodiscard]] std::shared_ptr<Kakshya::PlotContainer> build();
72
73private:
74 std::shared_ptr<Kakshya::PlotContainer> m_container;
75 uint32_t m_last_index { 0 };
76};
77
78} // namespace MayaFlux::Portal::Forma::Plot
size_t count
std::shared_ptr< Kakshya::PlotContainer > m_container
Chainable builder for PlotContainer construction.
DataModality
Data modality types for cross-modal analysis.
Definition NDData.hpp:81
Contains the node-based computational processing system components.
Definition Chronie.hpp:14
Role
Semantic role of the dimension.
Definition NDData.hpp:150