Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
LogicElements.h
1// trax track library
2// AD 2014
3//
4// "You taint the fox and now you let him run"
5//
6// Tenfold Loadstar
7//
8// Copyright (c) 2025 Trend Redaktions- und Verlagsgesellschaft mbH
9// Copyright (c) 2019 Marc-Michael Horstmann
10//
11// Permission is hereby granted to any person obtaining a copy of this software
12// and associated source code (the "Software"), to use, view, and study the
13// Software for personal or internal business purposes, subject to the following
14// conditions:
15//
16// 1. Redistribution, modification, sublicensing, or commercial use of the
17// Software is NOT permitted without prior written consent from the copyright
18// holder.
19//
20// 2. The Software is provided "AS IS", without warranty of any kind, express
21// or implied.
22//
23// 3. All copies of the Software must retain this license notice.
24//
25// For further information, please contact: horstmann.marc@trendverlag.de
26
27#pragma once
28
29#include "Configuration.h"
30#include "Identified.h"
31
32#include <memory>
33
34namespace trax{
35
36 struct Jack;
37 struct MultiPlug;
38 struct SocketRegistry;
39
45 struct Lockable{
46
48 virtual void Lock() = 0;
49
50
52 virtual void Unlock() = 0;
53
54
56 virtual void ToggleLock() = 0;
57
58
60 virtual bool IsLocked() const = 0;
61
62
64 virtual MultiPlug& PlugToLock() = 0;
65
66
68 virtual Jack& JackOnLock() = 0;
69
70
72 virtual MultiPlug& PlugToUnlock() = 0;
73
74
76 virtual Jack& JackOnUnlock() = 0;
77
78
81
82
84 virtual Jack& JackOnLockChange() = 0;
85
86
87 virtual ~Lockable() = default;
88 };
89
90
95 struct PulseCounter : Identified<PulseCounter>
96 {
98 static dclspc std::unique_ptr<PulseCounter> Make() noexcept;
99
100
102 virtual const char* TypeName() const noexcept = 0;
103
104
106 virtual void CountUp() noexcept = 0;
107
108
110 virtual void CountDown() noexcept = 0;
111
112
116 virtual void Threshold( int threshold ) = 0;
117
118
120 virtual int Threshold() const noexcept = 0;
121
122
126 virtual void Counter( int counter ) = 0;
127
128
130 virtual int Counter() const noexcept = 0;
131
132
134 virtual void Reset() noexcept = 0;
135
136
138 virtual MultiPlug& PlugToCountUp() = 0;
139
140
143
144
146 virtual MultiPlug& PlugToReset() = 0;
147
148
152
153
157
158
160 virtual Jack& JackOnCountUp() = 0;
161
162
164 virtual Jack& JackOnCountDown() = 0;
165
166
169 virtual void RegisterSockets( SocketRegistry& registry ) = 0;
170
171
173 virtual void UnregisterSockets( SocketRegistry& registry ) = 0;
174 };
175
176}
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
A jack a plug can get connected with.
Definition Jack.h:83
Interface for locking and unlocking an object.
Definition LogicElements.h:45
virtual void Lock()=0
Locks the object for further input.
virtual Jack & JackOnUnlock()=0
Jack that pulses on unlock.
virtual MultiPlug & PlugToLock()=0
virtual Jack & JackOnLockChange()=0
Jack that pulses if the lock state changes.
virtual MultiPlug & PlugToLockToggle()=0
Plug to toggle the lock state by pulse.
virtual MultiPlug & PlugToUnlock()=0
virtual void ToggleLock()=0
Toggles the lock state.
virtual Jack & JackOnLock()=0
virtual void Unlock()=0
Unlocks the object to execute input again.
virtual bool IsLocked() const =0
A MultiPlug provides a variable number of actual Plugs to one input slot.
Definition Plug.h:307
A counter can be incremented or decremented by pulses. It will itself issue a pulse every time a cert...
Definition LogicElements.h:96
static dclspc std::unique_ptr< PulseCounter > Make() noexcept
Makes a PulseCounter object.
virtual void Counter(int counter)=0
Sets the counter to a specific value.
virtual Jack & JackOnReachThreshold()=0
If the counter reaches the threshold from either side the counter triggers a pulse in this Jack.
virtual void CountDown() noexcept=0
Decrements the counter by 1.
virtual void UnregisterSockets(SocketRegistry &registry)=0
Removes all references to Plugs and Jacks from the module.
virtual Jack & JackOnCountUp()=0
If the counter gets counted up it triggers a pulse in this jack.
virtual MultiPlug & PlugToReset()=0
Plug whose pulses reset the counter to 0.
virtual Jack & JackOnLeaveThreshold()=0
If the counter leaves the threshold to either side the counter triggers a pulse in this Jack.
virtual void Reset() noexcept=0
Resets the counter to 0.
virtual void CountUp() noexcept=0
Increments the counter by 1.
virtual Jack & JackOnCountDown()=0
If the counter gets counted down it triggers a pulse in this jack.
virtual MultiPlug & PlugToCountDown()=0
Plug whose pulses decrement the counter by 1.
virtual const char * TypeName() const noexcept=0
virtual void RegisterSockets(SocketRegistry &registry)=0
Registers all the Plugs with the module and supplies the Jacks with plug ids for connecting.
virtual MultiPlug & PlugToCountUp()=0
Plug whose pulses increment the counter by 1.
virtual void Threshold(int threshold)=0
Sets the threshold to a specific value.
Interface for a registry that reconnects Plugs and Jacks according to their IDs.
Definition SocketRegistry.h:40