DSPatch v.10.2.3
Loading...
Searching...
No Matches
Circuit.h
1/******************************************************************************
2DSPatch - The Refreshingly Simple C++ Dataflow Framework
3Copyright (c) 2024, Marcus Tomlinson
4
5BSD 2-Clause License
6
7Redistribution and use in source and binary forms, with or without
8modification, are permitted provided that the following conditions are met:
9
101. Redistributions of source code must retain the above copyright notice, this
11 list of conditions and the following disclaimer.
12
132. Redistributions in binary form must reproduce the above copyright notice,
14 this list of conditions and the following disclaimer in the documentation
15 and/or other materials provided with the distribution.
16
17THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27******************************************************************************/
28
29#pragma once
30
31#include <dspatch/Component.h>
32
33namespace DSPatch
34{
35
36namespace internal
37{
38class Circuit;
39}
40
42
66class DLLEXPORT Circuit final
67{
68public:
69 NONCOPYABLE( Circuit );
70
71 Circuit();
72 ~Circuit();
73
74 bool AddComponent( const Component::SPtr& component );
75
76 bool RemoveComponent( const Component::SPtr& component );
77 void RemoveAllComponents();
78
79 int GetComponentCount() const;
80
81 bool ConnectOutToIn( const Component::SPtr& fromComponent, int fromOutput, const Component::SPtr& toComponent, int toInput );
82
83 bool DisconnectComponent( const Component::SPtr& component );
84 void DisconnectAllComponents();
85
86 void SetBufferCount( int bufferCount );
87 int GetBufferCount() const;
88
89 void SetThreadCount( int threadCount );
90 int GetThreadCount() const;
91
92 void Tick();
93 void Sync();
94
95 void StartAutoTick();
96 void StopAutoTick();
97 void PauseAutoTick();
98 void ResumeAutoTick();
99
100 void Optimize();
101
102private:
103 internal::Circuit* p;
104};
105
106} // namespace DSPatch
Workspace for adding and routing components.
Definition Circuit.h:67