From bb1c49dfa484db080938cff6f8f70167c9026a1c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 24 Jul 2007 19:26:47 +0000 Subject: Consistently rename all C++ files .cpp/.hpp. Fix (some) inclusion guard names to not clash with other libs. git-svn-id: http://svn.drobilla.net/lad/ingen@613 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/AudioBuffer.cpp | 5 +- src/libs/engine/AudioBuffer.h | 83 ----- src/libs/engine/AudioBuffer.hpp | 83 +++++ src/libs/engine/AudioDriver.h | 57 --- src/libs/engine/AudioDriver.hpp | 57 +++ src/libs/engine/Buffer.h | 66 ---- src/libs/engine/Buffer.hpp | 66 ++++ src/libs/engine/BufferFactory.cpp | 8 +- src/libs/engine/BufferFactory.h | 35 -- src/libs/engine/BufferFactory.hpp | 35 ++ src/libs/engine/ClientBroadcaster.cpp | 31 +- src/libs/engine/ClientBroadcaster.h | 104 ------ src/libs/engine/ClientBroadcaster.hpp | 104 ++++++ src/libs/engine/Connection.cpp | 12 +- src/libs/engine/Connection.h | 94 ----- src/libs/engine/Connection.hpp | 94 +++++ src/libs/engine/Controller.h | 83 ----- src/libs/engine/Controller.hpp | 83 +++++ src/libs/engine/DSSINode.cpp | 12 +- src/libs/engine/DSSINode.h | 107 ------ src/libs/engine/DSSINode.hpp | 107 ++++++ src/libs/engine/DataType.h | 75 ---- src/libs/engine/DataType.hpp | 75 ++++ src/libs/engine/DirectResponder.h | 53 --- src/libs/engine/DirectResponder.hpp | 53 +++ src/libs/engine/Driver.h | 120 ------- src/libs/engine/Driver.hpp | 120 +++++++ src/libs/engine/DuplexPort.cpp | 13 +- src/libs/engine/DuplexPort.h | 61 ---- src/libs/engine/DuplexPort.hpp | 60 ++++ src/libs/engine/Engine.cpp | 40 +-- src/libs/engine/Engine.h | 113 ------ src/libs/engine/Engine.hpp | 113 ++++++ src/libs/engine/Event.h | 94 ----- src/libs/engine/Event.hpp | 94 +++++ src/libs/engine/EventSource.h | 64 ---- src/libs/engine/EventSource.hpp | 64 ++++ src/libs/engine/GraphObject.cpp | 6 +- src/libs/engine/GraphObject.h | 120 ------- src/libs/engine/GraphObject.hpp | 120 +++++++ src/libs/engine/InputPort.cpp | 12 +- src/libs/engine/InputPort.h | 77 ---- src/libs/engine/InputPort.hpp | 77 ++++ src/libs/engine/InternalNode.h | 52 --- src/libs/engine/InternalNode.hpp | 52 +++ src/libs/engine/JackAudioDriver.cpp | 38 +- src/libs/engine/JackAudioDriver.h | 179 ---------- src/libs/engine/JackAudioDriver.hpp | 179 ++++++++++ src/libs/engine/JackMidiDriver.cpp | 16 +- src/libs/engine/JackMidiDriver.h | 112 ------ src/libs/engine/JackMidiDriver.hpp | 112 ++++++ src/libs/engine/LADSPANode.cpp | 10 +- src/libs/engine/LADSPANode.h | 63 ---- src/libs/engine/LADSPANode.hpp | 63 ++++ src/libs/engine/LV2Node.cpp | 16 +- src/libs/engine/LV2Node.h | 66 ---- src/libs/engine/LV2Node.hpp | 66 ++++ src/libs/engine/LashDriver.cpp | 6 +- src/libs/engine/LashDriver.h | 58 --- src/libs/engine/LashDriver.hpp | 58 +++ src/libs/engine/Makefile.am | 284 +++++++-------- src/libs/engine/MidiBuffer.cpp | 2 +- src/libs/engine/MidiBuffer.h | 77 ---- src/libs/engine/MidiBuffer.hpp | 77 ++++ src/libs/engine/MidiControlNode.cpp | 16 +- src/libs/engine/MidiControlNode.h | 68 ---- src/libs/engine/MidiControlNode.hpp | 68 ++++ src/libs/engine/MidiDriver.h | 83 ----- src/libs/engine/MidiDriver.hpp | 83 +++++ src/libs/engine/MidiNoteNode.cpp | 18 +- src/libs/engine/MidiNoteNode.h | 87 ----- src/libs/engine/MidiNoteNode.hpp | 87 +++++ src/libs/engine/MidiTriggerNode.cpp | 12 +- src/libs/engine/MidiTriggerNode.h | 64 ---- src/libs/engine/MidiTriggerNode.hpp | 64 ++++ src/libs/engine/Node.h | 113 ------ src/libs/engine/Node.hpp | 110 ++++++ src/libs/engine/NodeBase.cpp | 18 +- src/libs/engine/NodeBase.h | 108 ------ src/libs/engine/NodeBase.hpp | 108 ++++++ src/libs/engine/NodeFactory.cpp | 24 +- src/libs/engine/NodeFactory.h | 96 ----- src/libs/engine/NodeFactory.hpp | 96 +++++ src/libs/engine/OSCBuffer.cpp | 2 +- src/libs/engine/OSCBuffer.h | 63 ---- src/libs/engine/OSCBuffer.hpp | 63 ++++ src/libs/engine/OSCClientSender.cpp | 26 +- src/libs/engine/OSCClientSender.h | 141 -------- src/libs/engine/OSCClientSender.hpp | 141 ++++++++ src/libs/engine/OSCDriver.h | 83 ----- src/libs/engine/OSCDriver.hpp | 83 +++++ src/libs/engine/OSCEngineReceiver.cpp | 20 +- src/libs/engine/OSCEngineReceiver.h | 127 ------- src/libs/engine/OSCEngineReceiver.hpp | 127 +++++++ src/libs/engine/OSCResponder.cpp | 6 +- src/libs/engine/OSCResponder.h | 70 ---- src/libs/engine/OSCResponder.hpp | 70 ++++ src/libs/engine/ObjectSender.cpp | 22 +- src/libs/engine/ObjectSender.h | 58 --- src/libs/engine/ObjectSender.hpp | 58 +++ src/libs/engine/ObjectStore.cpp | 14 +- src/libs/engine/ObjectStore.h | 64 ---- src/libs/engine/ObjectStore.hpp | 63 ++++ src/libs/engine/OmInProcess.cpp | 8 +- src/libs/engine/OutputPort.cpp | 4 +- src/libs/engine/OutputPort.h | 64 ---- src/libs/engine/OutputPort.hpp | 64 ++++ src/libs/engine/Patch.cpp | 14 +- src/libs/engine/Patch.h | 136 ------- src/libs/engine/Patch.hpp | 136 +++++++ src/libs/engine/Plugin.cpp | 10 +- src/libs/engine/Plugin.h | 156 -------- src/libs/engine/Plugin.hpp | 156 ++++++++ src/libs/engine/Port.cpp | 10 +- src/libs/engine/Port.h | 93 ----- src/libs/engine/Port.hpp | 91 +++++ src/libs/engine/PostProcessor.cpp | 8 +- src/libs/engine/PostProcessor.h | 58 --- src/libs/engine/PostProcessor.hpp | 58 +++ src/libs/engine/QueuedEngineInterface.cpp | 12 +- src/libs/engine/QueuedEngineInterface.h | 171 --------- src/libs/engine/QueuedEngineInterface.hpp | 171 +++++++++ src/libs/engine/QueuedEvent.h | 99 ------ src/libs/engine/QueuedEvent.hpp | 99 ++++++ src/libs/engine/QueuedEventSource.cpp | 8 +- src/libs/engine/QueuedEventSource.h | 110 ------ src/libs/engine/QueuedEventSource.hpp | 110 ++++++ src/libs/engine/ThreadManager.h | 43 --- src/libs/engine/ThreadManager.hpp | 43 +++ src/libs/engine/TransportNode.cpp | 14 +- src/libs/engine/TransportNode.h | 49 --- src/libs/engine/TransportNode.hpp | 49 +++ src/libs/engine/Tree.h | 141 -------- src/libs/engine/Tree.hpp | 141 ++++++++ src/libs/engine/TreeImplementation.h | 395 --------------------- src/libs/engine/TreeImplementation.hpp | 395 +++++++++++++++++++++ src/libs/engine/engine.cpp | 12 +- src/libs/engine/engine.h | 46 --- src/libs/engine/engine.hpp | 46 +++ src/libs/engine/events.h | 61 ---- src/libs/engine/events.hpp | 61 ++++ src/libs/engine/events/AddNodeEvent.cpp | 30 +- src/libs/engine/events/AddNodeEvent.h | 81 ----- src/libs/engine/events/AddNodeEvent.hpp | 81 +++++ src/libs/engine/events/AddPortEvent.cpp | 38 +- src/libs/engine/events/AddPortEvent.h | 66 ---- src/libs/engine/events/AddPortEvent.hpp | 66 ++++ src/libs/engine/events/AllNotesOffEvent.cpp | 8 +- src/libs/engine/events/AllNotesOffEvent.h | 51 --- src/libs/engine/events/AllNotesOffEvent.hpp | 51 +++ src/libs/engine/events/ClearPatchEvent.cpp | 24 +- src/libs/engine/events/ClearPatchEvent.h | 55 --- src/libs/engine/events/ClearPatchEvent.hpp | 55 +++ src/libs/engine/events/ConnectionEvent.cpp | 26 +- src/libs/engine/events/ConnectionEvent.h | 90 ----- src/libs/engine/events/ConnectionEvent.hpp | 90 +++++ src/libs/engine/events/CreatePatchEvent.cpp | 24 +- src/libs/engine/events/CreatePatchEvent.h | 66 ---- src/libs/engine/events/CreatePatchEvent.hpp | 66 ++++ src/libs/engine/events/DSSIConfigureEvent.cpp | 12 +- src/libs/engine/events/DSSIConfigureEvent.h | 50 --- src/libs/engine/events/DSSIConfigureEvent.hpp | 50 +++ src/libs/engine/events/DSSIControlEvent.cpp | 10 +- src/libs/engine/events/DSSIControlEvent.h | 52 --- src/libs/engine/events/DSSIControlEvent.hpp | 52 +++ src/libs/engine/events/DSSIProgramEvent.cpp | 12 +- src/libs/engine/events/DSSIProgramEvent.h | 50 --- src/libs/engine/events/DSSIProgramEvent.hpp | 50 +++ src/libs/engine/events/DSSIUpdateEvent.cpp | 12 +- src/libs/engine/events/DSSIUpdateEvent.h | 55 --- src/libs/engine/events/DSSIUpdateEvent.hpp | 55 +++ src/libs/engine/events/DeactivateEvent.cpp | 6 +- src/libs/engine/events/DeactivateEvent.h | 43 --- src/libs/engine/events/DeactivateEvent.hpp | 43 +++ src/libs/engine/events/DestroyEvent.cpp | 36 +- src/libs/engine/events/DestroyEvent.h | 79 ----- src/libs/engine/events/DestroyEvent.hpp | 79 +++++ src/libs/engine/events/DisablePatchEvent.cpp | 16 +- src/libs/engine/events/DisablePatchEvent.h | 53 --- src/libs/engine/events/DisablePatchEvent.hpp | 53 +++ src/libs/engine/events/DisconnectNodeEvent.cpp | 34 +- src/libs/engine/events/DisconnectNodeEvent.h | 69 ---- src/libs/engine/events/DisconnectNodeEvent.hpp | 69 ++++ src/libs/engine/events/DisconnectPortEvent.cpp | 34 +- src/libs/engine/events/DisconnectPortEvent.h | 71 ---- src/libs/engine/events/DisconnectPortEvent.hpp | 71 ++++ src/libs/engine/events/DisconnectionEvent.cpp | 24 +- src/libs/engine/events/DisconnectionEvent.h | 89 ----- src/libs/engine/events/DisconnectionEvent.hpp | 89 +++++ src/libs/engine/events/EnablePatchEvent.cpp | 14 +- src/libs/engine/events/EnablePatchEvent.h | 57 --- src/libs/engine/events/EnablePatchEvent.hpp | 57 +++ src/libs/engine/events/LoadPluginsEvent.cpp | 12 +- src/libs/engine/events/LoadPluginsEvent.h | 48 --- src/libs/engine/events/LoadPluginsEvent.hpp | 48 +++ src/libs/engine/events/Makefile.am | 116 +++--- src/libs/engine/events/MidiLearnEvent.cpp | 14 +- src/libs/engine/events/MidiLearnEvent.h | 85 ----- src/libs/engine/events/MidiLearnEvent.hpp | 85 +++++ src/libs/engine/events/NoteOffEvent.cpp | 14 +- src/libs/engine/events/NoteOffEvent.h | 53 --- src/libs/engine/events/NoteOffEvent.hpp | 53 +++ src/libs/engine/events/NoteOnEvent.cpp | 16 +- src/libs/engine/events/NoteOnEvent.h | 55 --- src/libs/engine/events/NoteOnEvent.hpp | 55 +++ src/libs/engine/events/PingQueuedEvent.h | 48 --- src/libs/engine/events/PingQueuedEvent.hpp | 48 +++ src/libs/engine/events/RegisterClientEvent.cpp | 8 +- src/libs/engine/events/RegisterClientEvent.h | 57 --- src/libs/engine/events/RegisterClientEvent.hpp | 57 +++ src/libs/engine/events/RenameEvent.cpp | 18 +- src/libs/engine/events/RenameEvent.h | 68 ---- src/libs/engine/events/RenameEvent.hpp | 68 ++++ src/libs/engine/events/RequestAllObjectsEvent.cpp | 12 +- src/libs/engine/events/RequestAllObjectsEvent.h | 51 --- src/libs/engine/events/RequestAllObjectsEvent.hpp | 51 +++ src/libs/engine/events/RequestMetadataEvent.cpp | 14 +- src/libs/engine/events/RequestMetadataEvent.h | 57 --- src/libs/engine/events/RequestMetadataEvent.hpp | 57 +++ src/libs/engine/events/RequestObjectEvent.cpp | 20 +- src/libs/engine/events/RequestObjectEvent.h | 56 --- src/libs/engine/events/RequestObjectEvent.hpp | 56 +++ src/libs/engine/events/RequestPluginEvent.cpp | 18 +- src/libs/engine/events/RequestPluginEvent.h | 56 --- src/libs/engine/events/RequestPluginEvent.hpp | 56 +++ src/libs/engine/events/RequestPluginsEvent.cpp | 10 +- src/libs/engine/events/RequestPluginsEvent.h | 55 --- src/libs/engine/events/RequestPluginsEvent.hpp | 55 +++ src/libs/engine/events/RequestPortValueEvent.cpp | 16 +- src/libs/engine/events/RequestPortValueEvent.h | 57 --- src/libs/engine/events/RequestPortValueEvent.hpp | 57 +++ src/libs/engine/events/SetMetadataEvent.cpp | 12 +- src/libs/engine/events/SetMetadataEvent.h | 55 --- src/libs/engine/events/SetMetadataEvent.hpp | 55 +++ src/libs/engine/events/SetPortValueEvent.cpp | 16 +- src/libs/engine/events/SetPortValueEvent.h | 57 --- src/libs/engine/events/SetPortValueEvent.hpp | 57 +++ src/libs/engine/events/SetPortValueQueuedEvent.cpp | 18 +- src/libs/engine/events/SetPortValueQueuedEvent.h | 58 --- src/libs/engine/events/SetPortValueQueuedEvent.hpp | 58 +++ src/libs/engine/events/UnregisterClientEvent.cpp | 10 +- src/libs/engine/events/UnregisterClientEvent.h | 57 --- src/libs/engine/events/UnregisterClientEvent.hpp | 57 +++ src/libs/engine/instantiations.cpp | 6 +- src/libs/engine/tuning.h | 40 --- src/libs/engine/tuning.hpp | 40 +++ src/libs/engine/types.h | 33 -- src/libs/engine/types.hpp | 33 ++ src/libs/engine/util.h | 74 ---- src/libs/engine/util.hpp | 74 ++++ 250 files changed, 7793 insertions(+), 7813 deletions(-) delete mode 100644 src/libs/engine/AudioBuffer.h create mode 100644 src/libs/engine/AudioBuffer.hpp delete mode 100644 src/libs/engine/AudioDriver.h create mode 100644 src/libs/engine/AudioDriver.hpp delete mode 100644 src/libs/engine/Buffer.h create mode 100644 src/libs/engine/Buffer.hpp delete mode 100644 src/libs/engine/BufferFactory.h create mode 100644 src/libs/engine/BufferFactory.hpp delete mode 100644 src/libs/engine/ClientBroadcaster.h create mode 100644 src/libs/engine/ClientBroadcaster.hpp delete mode 100644 src/libs/engine/Connection.h create mode 100644 src/libs/engine/Connection.hpp delete mode 100644 src/libs/engine/Controller.h create mode 100644 src/libs/engine/Controller.hpp delete mode 100644 src/libs/engine/DSSINode.h create mode 100644 src/libs/engine/DSSINode.hpp delete mode 100644 src/libs/engine/DataType.h create mode 100644 src/libs/engine/DataType.hpp delete mode 100644 src/libs/engine/DirectResponder.h create mode 100644 src/libs/engine/DirectResponder.hpp delete mode 100644 src/libs/engine/Driver.h create mode 100644 src/libs/engine/Driver.hpp delete mode 100644 src/libs/engine/DuplexPort.h create mode 100644 src/libs/engine/DuplexPort.hpp delete mode 100644 src/libs/engine/Engine.h create mode 100644 src/libs/engine/Engine.hpp delete mode 100644 src/libs/engine/Event.h create mode 100644 src/libs/engine/Event.hpp delete mode 100644 src/libs/engine/EventSource.h create mode 100644 src/libs/engine/EventSource.hpp delete mode 100644 src/libs/engine/GraphObject.h create mode 100644 src/libs/engine/GraphObject.hpp delete mode 100644 src/libs/engine/InputPort.h create mode 100644 src/libs/engine/InputPort.hpp delete mode 100644 src/libs/engine/InternalNode.h create mode 100644 src/libs/engine/InternalNode.hpp delete mode 100644 src/libs/engine/JackAudioDriver.h create mode 100644 src/libs/engine/JackAudioDriver.hpp delete mode 100644 src/libs/engine/JackMidiDriver.h create mode 100644 src/libs/engine/JackMidiDriver.hpp delete mode 100644 src/libs/engine/LADSPANode.h create mode 100644 src/libs/engine/LADSPANode.hpp delete mode 100644 src/libs/engine/LV2Node.h create mode 100644 src/libs/engine/LV2Node.hpp delete mode 100644 src/libs/engine/LashDriver.h create mode 100644 src/libs/engine/LashDriver.hpp delete mode 100644 src/libs/engine/MidiBuffer.h create mode 100644 src/libs/engine/MidiBuffer.hpp delete mode 100644 src/libs/engine/MidiControlNode.h create mode 100644 src/libs/engine/MidiControlNode.hpp delete mode 100644 src/libs/engine/MidiDriver.h create mode 100644 src/libs/engine/MidiDriver.hpp delete mode 100644 src/libs/engine/MidiNoteNode.h create mode 100644 src/libs/engine/MidiNoteNode.hpp delete mode 100644 src/libs/engine/MidiTriggerNode.h create mode 100644 src/libs/engine/MidiTriggerNode.hpp delete mode 100644 src/libs/engine/Node.h create mode 100644 src/libs/engine/Node.hpp delete mode 100644 src/libs/engine/NodeBase.h create mode 100644 src/libs/engine/NodeBase.hpp delete mode 100644 src/libs/engine/NodeFactory.h create mode 100644 src/libs/engine/NodeFactory.hpp delete mode 100644 src/libs/engine/OSCBuffer.h create mode 100644 src/libs/engine/OSCBuffer.hpp delete mode 100644 src/libs/engine/OSCClientSender.h create mode 100644 src/libs/engine/OSCClientSender.hpp delete mode 100644 src/libs/engine/OSCDriver.h create mode 100644 src/libs/engine/OSCDriver.hpp delete mode 100644 src/libs/engine/OSCEngineReceiver.h create mode 100644 src/libs/engine/OSCEngineReceiver.hpp delete mode 100644 src/libs/engine/OSCResponder.h create mode 100644 src/libs/engine/OSCResponder.hpp delete mode 100644 src/libs/engine/ObjectSender.h create mode 100644 src/libs/engine/ObjectSender.hpp delete mode 100644 src/libs/engine/ObjectStore.h create mode 100644 src/libs/engine/ObjectStore.hpp delete mode 100644 src/libs/engine/OutputPort.h create mode 100644 src/libs/engine/OutputPort.hpp delete mode 100644 src/libs/engine/Patch.h create mode 100644 src/libs/engine/Patch.hpp delete mode 100644 src/libs/engine/Plugin.h create mode 100644 src/libs/engine/Plugin.hpp delete mode 100644 src/libs/engine/Port.h create mode 100644 src/libs/engine/Port.hpp delete mode 100644 src/libs/engine/PostProcessor.h create mode 100644 src/libs/engine/PostProcessor.hpp delete mode 100644 src/libs/engine/QueuedEngineInterface.h create mode 100644 src/libs/engine/QueuedEngineInterface.hpp delete mode 100644 src/libs/engine/QueuedEvent.h create mode 100644 src/libs/engine/QueuedEvent.hpp delete mode 100644 src/libs/engine/QueuedEventSource.h create mode 100644 src/libs/engine/QueuedEventSource.hpp delete mode 100644 src/libs/engine/ThreadManager.h create mode 100644 src/libs/engine/ThreadManager.hpp delete mode 100644 src/libs/engine/TransportNode.h create mode 100644 src/libs/engine/TransportNode.hpp delete mode 100644 src/libs/engine/Tree.h create mode 100644 src/libs/engine/Tree.hpp delete mode 100644 src/libs/engine/TreeImplementation.h create mode 100644 src/libs/engine/TreeImplementation.hpp delete mode 100644 src/libs/engine/engine.h create mode 100644 src/libs/engine/engine.hpp delete mode 100644 src/libs/engine/events.h create mode 100644 src/libs/engine/events.hpp delete mode 100644 src/libs/engine/events/AddNodeEvent.h create mode 100644 src/libs/engine/events/AddNodeEvent.hpp delete mode 100644 src/libs/engine/events/AddPortEvent.h create mode 100644 src/libs/engine/events/AddPortEvent.hpp delete mode 100644 src/libs/engine/events/AllNotesOffEvent.h create mode 100644 src/libs/engine/events/AllNotesOffEvent.hpp delete mode 100644 src/libs/engine/events/ClearPatchEvent.h create mode 100644 src/libs/engine/events/ClearPatchEvent.hpp delete mode 100644 src/libs/engine/events/ConnectionEvent.h create mode 100644 src/libs/engine/events/ConnectionEvent.hpp delete mode 100644 src/libs/engine/events/CreatePatchEvent.h create mode 100644 src/libs/engine/events/CreatePatchEvent.hpp delete mode 100644 src/libs/engine/events/DSSIConfigureEvent.h create mode 100644 src/libs/engine/events/DSSIConfigureEvent.hpp delete mode 100644 src/libs/engine/events/DSSIControlEvent.h create mode 100644 src/libs/engine/events/DSSIControlEvent.hpp delete mode 100644 src/libs/engine/events/DSSIProgramEvent.h create mode 100644 src/libs/engine/events/DSSIProgramEvent.hpp delete mode 100644 src/libs/engine/events/DSSIUpdateEvent.h create mode 100644 src/libs/engine/events/DSSIUpdateEvent.hpp delete mode 100644 src/libs/engine/events/DeactivateEvent.h create mode 100644 src/libs/engine/events/DeactivateEvent.hpp delete mode 100644 src/libs/engine/events/DestroyEvent.h create mode 100644 src/libs/engine/events/DestroyEvent.hpp delete mode 100644 src/libs/engine/events/DisablePatchEvent.h create mode 100644 src/libs/engine/events/DisablePatchEvent.hpp delete mode 100644 src/libs/engine/events/DisconnectNodeEvent.h create mode 100644 src/libs/engine/events/DisconnectNodeEvent.hpp delete mode 100644 src/libs/engine/events/DisconnectPortEvent.h create mode 100644 src/libs/engine/events/DisconnectPortEvent.hpp delete mode 100644 src/libs/engine/events/DisconnectionEvent.h create mode 100644 src/libs/engine/events/DisconnectionEvent.hpp delete mode 100644 src/libs/engine/events/EnablePatchEvent.h create mode 100644 src/libs/engine/events/EnablePatchEvent.hpp delete mode 100644 src/libs/engine/events/LoadPluginsEvent.h create mode 100644 src/libs/engine/events/LoadPluginsEvent.hpp delete mode 100644 src/libs/engine/events/MidiLearnEvent.h create mode 100644 src/libs/engine/events/MidiLearnEvent.hpp delete mode 100644 src/libs/engine/events/NoteOffEvent.h create mode 100644 src/libs/engine/events/NoteOffEvent.hpp delete mode 100644 src/libs/engine/events/NoteOnEvent.h create mode 100644 src/libs/engine/events/NoteOnEvent.hpp delete mode 100644 src/libs/engine/events/PingQueuedEvent.h create mode 100644 src/libs/engine/events/PingQueuedEvent.hpp delete mode 100644 src/libs/engine/events/RegisterClientEvent.h create mode 100644 src/libs/engine/events/RegisterClientEvent.hpp delete mode 100644 src/libs/engine/events/RenameEvent.h create mode 100644 src/libs/engine/events/RenameEvent.hpp delete mode 100644 src/libs/engine/events/RequestAllObjectsEvent.h create mode 100644 src/libs/engine/events/RequestAllObjectsEvent.hpp delete mode 100644 src/libs/engine/events/RequestMetadataEvent.h create mode 100644 src/libs/engine/events/RequestMetadataEvent.hpp delete mode 100644 src/libs/engine/events/RequestObjectEvent.h create mode 100644 src/libs/engine/events/RequestObjectEvent.hpp delete mode 100644 src/libs/engine/events/RequestPluginEvent.h create mode 100644 src/libs/engine/events/RequestPluginEvent.hpp delete mode 100644 src/libs/engine/events/RequestPluginsEvent.h create mode 100644 src/libs/engine/events/RequestPluginsEvent.hpp delete mode 100644 src/libs/engine/events/RequestPortValueEvent.h create mode 100644 src/libs/engine/events/RequestPortValueEvent.hpp delete mode 100644 src/libs/engine/events/SetMetadataEvent.h create mode 100644 src/libs/engine/events/SetMetadataEvent.hpp delete mode 100644 src/libs/engine/events/SetPortValueEvent.h create mode 100644 src/libs/engine/events/SetPortValueEvent.hpp delete mode 100644 src/libs/engine/events/SetPortValueQueuedEvent.h create mode 100644 src/libs/engine/events/SetPortValueQueuedEvent.hpp delete mode 100644 src/libs/engine/events/UnregisterClientEvent.h create mode 100644 src/libs/engine/events/UnregisterClientEvent.hpp delete mode 100644 src/libs/engine/tuning.h create mode 100644 src/libs/engine/tuning.hpp delete mode 100644 src/libs/engine/types.h create mode 100644 src/libs/engine/types.hpp delete mode 100644 src/libs/engine/util.h create mode 100644 src/libs/engine/util.hpp (limited to 'src/libs/engine') diff --git a/src/libs/engine/AudioBuffer.cpp b/src/libs/engine/AudioBuffer.cpp index 1e865dbe..f05048ad 100644 --- a/src/libs/engine/AudioBuffer.cpp +++ b/src/libs/engine/AudioBuffer.cpp @@ -18,8 +18,9 @@ #include #include #include -#include "AudioBuffer.h" -using std::cerr; using std::endl; +#include "AudioBuffer.hpp" + +using namespace std; /* TODO: Be sure these functions are vectorized by GCC when it's vectorizer * stops sucking. Probably a good idea to inline them as well */ diff --git a/src/libs/engine/AudioBuffer.h b/src/libs/engine/AudioBuffer.h deleted file mode 100644 index eba25c83..00000000 --- a/src/libs/engine/AudioBuffer.h +++ /dev/null @@ -1,83 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AUDIOBUFFER_H -#define AUDIOBUFFER_H - -#include -#include -#include -#include "types.h" -#include "Buffer.h" - -namespace Ingen { - - -class AudioBuffer : public Buffer -{ -public: - AudioBuffer(size_t capacity); - - void clear(); - void set(Sample val, size_t start_sample); - void set(Sample val, size_t start_sample, size_t end_sample); - void scale(Sample val, size_t start_sample, size_t end_sample); - void copy(const AudioBuffer* src, size_t start_sample, size_t end_sample); - void accumulate(const AudioBuffer* src, size_t start_sample, size_t end_sample); - - bool join(Buffer* buf); - void unjoin(); - bool is_joined_to(Buffer* buf) const; - - /** For driver use only!! */ - void set_data(Sample* data); - - inline Sample* data() const - { return ((_joined_buf != NULL) ? _joined_buf->data() : _data); } - - inline Sample& value_at(size_t offset) const - { assert(offset < _size); return data()[offset]; } - - void prepare_read(SampleCount nframes); - void prepare_write(SampleCount nframes) {} - - void reset(SampleCount nframes) {} - void resize(size_t size); - - void filled_size(size_t size) { _filled_size = size; } - size_t filled_size() const { return _filled_size; } - size_t size() const { return _size; } - -private: - enum State { OK, HALF_SET_CYCLE_1, HALF_SET_CYCLE_2 }; - - void allocate(); - void deallocate(); - - Sample* _data; ///< Used data pointer (probably same as _local_data) - Sample* _local_data; ///< Locally allocated buffer (possibly unused if joined or set_data used) - AudioBuffer* _joined_buf; ///< Buffer to mirror, if joined - size_t _size; ///< Allocated buffer size - size_t _filled_size; ///< Usable buffer size (for MIDI ports etc) - State _state; ///< State of buffer for setting values next cycle - Sample _set_value; ///< Value set by @ref set (may need to be set next cycle) -}; - - -} // namespace Ingen - -#endif // AUDIOBUFFER_H diff --git a/src/libs/engine/AudioBuffer.hpp b/src/libs/engine/AudioBuffer.hpp new file mode 100644 index 00000000..ee277313 --- /dev/null +++ b/src/libs/engine/AudioBuffer.hpp @@ -0,0 +1,83 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AUDIOBUFFER_H +#define AUDIOBUFFER_H + +#include +#include +#include +#include "types.hpp" +#include "Buffer.hpp" + +namespace Ingen { + + +class AudioBuffer : public Buffer +{ +public: + AudioBuffer(size_t capacity); + + void clear(); + void set(Sample val, size_t start_sample); + void set(Sample val, size_t start_sample, size_t end_sample); + void scale(Sample val, size_t start_sample, size_t end_sample); + void copy(const AudioBuffer* src, size_t start_sample, size_t end_sample); + void accumulate(const AudioBuffer* src, size_t start_sample, size_t end_sample); + + bool join(Buffer* buf); + void unjoin(); + bool is_joined_to(Buffer* buf) const; + + /** For driver use only!! */ + void set_data(Sample* data); + + inline Sample* data() const + { return ((_joined_buf != NULL) ? _joined_buf->data() : _data); } + + inline Sample& value_at(size_t offset) const + { assert(offset < _size); return data()[offset]; } + + void prepare_read(SampleCount nframes); + void prepare_write(SampleCount nframes) {} + + void reset(SampleCount nframes) {} + void resize(size_t size); + + void filled_size(size_t size) { _filled_size = size; } + size_t filled_size() const { return _filled_size; } + size_t size() const { return _size; } + +private: + enum State { OK, HALF_SET_CYCLE_1, HALF_SET_CYCLE_2 }; + + void allocate(); + void deallocate(); + + Sample* _data; ///< Used data pointer (probably same as _local_data) + Sample* _local_data; ///< Locally allocated buffer (possibly unused if joined or set_data used) + AudioBuffer* _joined_buf; ///< Buffer to mirror, if joined + size_t _size; ///< Allocated buffer size + size_t _filled_size; ///< Usable buffer size (for MIDI ports etc) + State _state; ///< State of buffer for setting values next cycle + Sample _set_value; ///< Value set by @ref set (may need to be set next cycle) +}; + + +} // namespace Ingen + +#endif // AUDIOBUFFER_H diff --git a/src/libs/engine/AudioDriver.h b/src/libs/engine/AudioDriver.h deleted file mode 100644 index d9807939..00000000 --- a/src/libs/engine/AudioDriver.h +++ /dev/null @@ -1,57 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AUDIODRIVER_H -#define AUDIODRIVER_H - -#include -#include -#include "Driver.h" -#include "types.h" -#include "DataType.h" - -namespace Ingen { - -class Patch; -class AudioDriver; -class Port; - - -/** Audio driver abstract base class. - * - * \ingroup engine - */ -class AudioDriver : public Driver -{ -public: - AudioDriver() : Driver(DataType::FLOAT) {} - - virtual void set_root_patch(Patch* patch) = 0; - virtual Patch* root_patch() = 0; - - virtual void add_port(DriverPort* port) = 0; - virtual DriverPort* remove_port(const Raul::Path& path) = 0; - - virtual SampleCount buffer_size() const = 0; - virtual SampleCount sample_rate() const = 0; - virtual SampleCount frame_time() const = 0; -}; - - -} // namespace Ingen - -#endif // AUDIODRIVER_H diff --git a/src/libs/engine/AudioDriver.hpp b/src/libs/engine/AudioDriver.hpp new file mode 100644 index 00000000..bc7d1ee9 --- /dev/null +++ b/src/libs/engine/AudioDriver.hpp @@ -0,0 +1,57 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AUDIODRIVER_H +#define AUDIODRIVER_H + +#include +#include +#include "Driver.hpp" +#include "types.hpp" +#include "DataType.hpp" + +namespace Ingen { + +class Patch; +class AudioDriver; +class Port; + + +/** Audio driver abstract base class. + * + * \ingroup engine + */ +class AudioDriver : public Driver +{ +public: + AudioDriver() : Driver(DataType::FLOAT) {} + + virtual void set_root_patch(Patch* patch) = 0; + virtual Patch* root_patch() = 0; + + virtual void add_port(DriverPort* port) = 0; + virtual DriverPort* remove_port(const Raul::Path& path) = 0; + + virtual SampleCount buffer_size() const = 0; + virtual SampleCount sample_rate() const = 0; + virtual SampleCount frame_time() const = 0; +}; + + +} // namespace Ingen + +#endif // AUDIODRIVER_H diff --git a/src/libs/engine/Buffer.h b/src/libs/engine/Buffer.h deleted file mode 100644 index b27c3a86..00000000 --- a/src/libs/engine/Buffer.h +++ /dev/null @@ -1,66 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef BUFFER_H -#define BUFFER_H - -#include -#include -#include -#include "types.h" -#include "DataType.h" - -namespace Ingen { - - -class Buffer : public boost::noncopyable -{ -public: - Buffer(DataType type, size_t size) - : _type(type) - , _size(size) - {} - - virtual ~Buffer() {} - - /** Clear contents and reset state */ - virtual void clear() = 0; - - /** Reset state (ie reset read ptr), but leave contents */ - virtual void reset(SampleCount nframes) = 0; - - virtual void prepare_read(SampleCount nframes) = 0; - virtual void prepare_write(SampleCount nframes) = 0; - - virtual bool is_joined_to(Buffer* buf) const = 0; - virtual bool join(Buffer* buf) = 0; - virtual void unjoin() = 0; - - virtual void resize(size_t size) { _size = size; } - - DataType type() const { return _type; } - size_t size() const { return _size; } - -protected: - DataType _type; - size_t _size; -}; - - -} // namespace Ingen - -#endif // BUFFER_H diff --git a/src/libs/engine/Buffer.hpp b/src/libs/engine/Buffer.hpp new file mode 100644 index 00000000..d4b52465 --- /dev/null +++ b/src/libs/engine/Buffer.hpp @@ -0,0 +1,66 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef BUFFER_H +#define BUFFER_H + +#include +#include +#include +#include "types.hpp" +#include "DataType.hpp" + +namespace Ingen { + + +class Buffer : public boost::noncopyable +{ +public: + Buffer(DataType type, size_t size) + : _type(type) + , _size(size) + {} + + virtual ~Buffer() {} + + /** Clear contents and reset state */ + virtual void clear() = 0; + + /** Reset state (ie reset read ptr), but leave contents */ + virtual void reset(SampleCount nframes) = 0; + + virtual void prepare_read(SampleCount nframes) = 0; + virtual void prepare_write(SampleCount nframes) = 0; + + virtual bool is_joined_to(Buffer* buf) const = 0; + virtual bool join(Buffer* buf) = 0; + virtual void unjoin() = 0; + + virtual void resize(size_t size) { _size = size; } + + DataType type() const { return _type; } + size_t size() const { return _size; } + +protected: + DataType _type; + size_t _size; +}; + + +} // namespace Ingen + +#endif // BUFFER_H diff --git a/src/libs/engine/BufferFactory.cpp b/src/libs/engine/BufferFactory.cpp index 48db9261..8c84fb81 100644 --- a/src/libs/engine/BufferFactory.cpp +++ b/src/libs/engine/BufferFactory.cpp @@ -15,10 +15,10 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "BufferFactory.h" -#include "AudioBuffer.h" -#include "MidiBuffer.h" -#include "OSCBuffer.h" +#include "BufferFactory.hpp" +#include "AudioBuffer.hpp" +#include "MidiBuffer.hpp" +#include "OSCBuffer.hpp" namespace Ingen { namespace BufferFactory { diff --git a/src/libs/engine/BufferFactory.h b/src/libs/engine/BufferFactory.h deleted file mode 100644 index 1887c27c..00000000 --- a/src/libs/engine/BufferFactory.h +++ /dev/null @@ -1,35 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef BUFFERFACTORY_H -#define BUFFERFACTORY_H - -#include "Buffer.h" - -namespace Ingen { - - -namespace BufferFactory { - - Buffer* create(DataType type, size_t size); - -} - - -} // namespace Ingen - -#endif // BUFFERFACTORY_H diff --git a/src/libs/engine/BufferFactory.hpp b/src/libs/engine/BufferFactory.hpp new file mode 100644 index 00000000..bac49c46 --- /dev/null +++ b/src/libs/engine/BufferFactory.hpp @@ -0,0 +1,35 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef BUFFERFACTORY_H +#define BUFFERFACTORY_H + +#include "Buffer.hpp" + +namespace Ingen { + + +namespace BufferFactory { + + Buffer* create(DataType type, size_t size); + +} + + +} // namespace Ingen + +#endif // BUFFERFACTORY_H diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp index 25a289c8..311e8792 100644 --- a/src/libs/engine/ClientBroadcaster.cpp +++ b/src/libs/engine/ClientBroadcaster.cpp @@ -15,24 +15,25 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "ClientBroadcaster.h" #include #include #include -#include "ObjectStore.h" -#include "NodeFactory.h" -#include "util.h" -#include "Patch.h" -#include "Node.h" -#include "Plugin.h" -#include "Port.h" -#include "Connection.h" -#include "AudioDriver.h" -#include "ObjectSender.h" -#include "interface/ClientKey.h" -#include "interface/ClientInterface.h" -#include "OSCClientSender.h" -using std::cout; using std::cerr; using std::endl; +#include "interface/ClientKey.hpp" +#include "interface/ClientInterface.hpp" +#include "ClientBroadcaster.hpp" +#include "ObjectStore.hpp" +#include "NodeFactory.hpp" +#include "util.hpp" +#include "Patch.hpp" +#include "Node.hpp" +#include "Plugin.hpp" +#include "Port.hpp" +#include "Connection.hpp" +#include "AudioDriver.hpp" +#include "ObjectSender.hpp" +#include "OSCClientSender.hpp" + +using namespace std; using Ingen::Shared::ClientInterface; namespace Ingen { diff --git a/src/libs/engine/ClientBroadcaster.h b/src/libs/engine/ClientBroadcaster.h deleted file mode 100644 index cef7b397..00000000 --- a/src/libs/engine/ClientBroadcaster.h +++ /dev/null @@ -1,104 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef CLIENTBROADCASTER_H -#define CLIENTBROADCASTER_H - -#include -#include -#include -#include -#include -#include -#include -#include "interface/ClientInterface.h" -#include "types.h" - -using std::list; using std::string; using std::pair; - -namespace Ingen { - -class Node; -class Port; -class Plugin; -class Patch; -class Connection; -namespace Shared { class ClientKey; class Responder; } -using Shared::ClientKey; -using Shared::ClientInterface; - - -/** Broadcaster for all clients. - * - * This sends messages to all client simultaneously through the opaque - * ClientInterface. The clients may be OSC driver, in process, theoretically - * anything that implements ClientInterface. - * - * This also serves as the database of all registered clients. - * - * \ingroup engine - */ -class ClientBroadcaster -{ -public: - void register_client(const ClientKey key, SharedPtr client); - bool unregister_client(const ClientKey& key); - - SharedPtr client(const ClientKey& key); - - // Notification band: - - //void send_client_registration(const string& url, int client_id); - - // Error that isn't the direct result of a request - void send_error(const string& msg); - - - - //void send_node_creation_messages(const Node* const node); - - void send_plugins(const list& plugin_list); - void send_patch(const Patch* const p, bool recursive); - void send_node(const Node* const node, bool recursive); - void send_port(const Port* port); - void send_destroyed(const string& path); - void send_patch_cleared(const string& patch_path); - void send_connection(const Connection* const connection); - void send_disconnection(const string& src_port_path, const string& dst_port_path); - void send_rename(const string& old_path, const string& new_path); - void send_all_objects(); - void send_patch_enable(const string& patch_path); - void send_patch_disable(const string& patch_path); - void send_metadata_update(const string& node_path, const string& key, const Raul::Atom& value); - void send_control_change(const string& port_path, float value); - void send_program_add(const string& node_path, int bank, int program, const string& name); - void send_program_remove(const string& node_path, int bank, int program); - - void send_plugins_to(SharedPtr, const list& plugin_list); - -private: - typedef list > > ClientList; - //list > _clients; - ClientList _clients; -}; - - - -} // namespace Ingen - -#endif // CLIENTBROADCASTER_H - diff --git a/src/libs/engine/ClientBroadcaster.hpp b/src/libs/engine/ClientBroadcaster.hpp new file mode 100644 index 00000000..87e321bb --- /dev/null +++ b/src/libs/engine/ClientBroadcaster.hpp @@ -0,0 +1,104 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef CLIENTBROADCASTER_H +#define CLIENTBROADCASTER_H + +#include +#include +#include +#include +#include +#include +#include +#include "interface/ClientInterface.hpp" +#include "types.hpp" + +using std::list; using std::string; using std::pair; + +namespace Ingen { + +class Node; +class Port; +class Plugin; +class Patch; +class Connection; +namespace Shared { class ClientKey; class Responder; } +using Shared::ClientKey; +using Shared::ClientInterface; + + +/** Broadcaster for all clients. + * + * This sends messages to all client simultaneously through the opaque + * ClientInterface. The clients may be OSC driver, in process, theoretically + * anything that implements ClientInterface. + * + * This also serves as the database of all registered clients. + * + * \ingroup engine + */ +class ClientBroadcaster +{ +public: + void register_client(const ClientKey key, SharedPtr client); + bool unregister_client(const ClientKey& key); + + SharedPtr client(const ClientKey& key); + + // Notification band: + + //void send_client_registration(const string& url, int client_id); + + // Error that isn't the direct result of a request + void send_error(const string& msg); + + + + //void send_node_creation_messages(const Node* const node); + + void send_plugins(const list& plugin_list); + void send_patch(const Patch* const p, bool recursive); + void send_node(const Node* const node, bool recursive); + void send_port(const Port* port); + void send_destroyed(const string& path); + void send_patch_cleared(const string& patch_path); + void send_connection(const Connection* const connection); + void send_disconnection(const string& src_port_path, const string& dst_port_path); + void send_rename(const string& old_path, const string& new_path); + void send_all_objects(); + void send_patch_enable(const string& patch_path); + void send_patch_disable(const string& patch_path); + void send_metadata_update(const string& node_path, const string& key, const Raul::Atom& value); + void send_control_change(const string& port_path, float value); + void send_program_add(const string& node_path, int bank, int program, const string& name); + void send_program_remove(const string& node_path, int bank, int program); + + void send_plugins_to(SharedPtr, const list& plugin_list); + +private: + typedef list > > ClientList; + //list > _clients; + ClientList _clients; +}; + + + +} // namespace Ingen + +#endif // CLIENTBROADCASTER_H + diff --git a/src/libs/engine/Connection.cpp b/src/libs/engine/Connection.cpp index a4795ceb..9341b603 100644 --- a/src/libs/engine/Connection.cpp +++ b/src/libs/engine/Connection.cpp @@ -16,12 +16,12 @@ */ #include -#include "Connection.h" -#include "util.h" -#include "Node.h" -#include "Port.h" -#include "BufferFactory.h" -#include "AudioBuffer.h" +#include "util.hpp" +#include "Connection.hpp" +#include "Node.hpp" +#include "Port.hpp" +#include "BufferFactory.hpp" +#include "AudioBuffer.hpp" namespace Ingen { diff --git a/src/libs/engine/Connection.h b/src/libs/engine/Connection.h deleted file mode 100644 index 7d109d88..00000000 --- a/src/libs/engine/Connection.h +++ /dev/null @@ -1,94 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef CONNECTION_H -#define CONNECTION_H - -#include -#include -#include -#include "DataType.h" -#include "Port.h" -#include "types.h" - -namespace Ingen { - -class Port; -class Buffer; - - -/** Represents a single inbound connection for an InputPort. - * - * This can be a group of ports (ie coming from a polyphonic Node) or - * a single Port. This class exists basically as an abstraction of mixing - * down polyphonic inputs, so InputPort can just deal with mixing down - * multiple connections (oblivious to the polyphonic situation of the - * connection itself). - * - * \ingroup engine - */ -class Connection : public Raul::Deletable -{ -public: - Connection(Port* src_port, Port* dst_port); - virtual ~Connection(); - - Port* src_port() const { return _src_port; } - Port* dst_port() const { return _dst_port; } - - /** Used by some (recursive) events to prevent double disconnections */ - bool pending_disconnection() { return _pending_disconnection; } - void pending_disconnection(bool b) { _pending_disconnection = b; } - - void process(SampleCount nframes, FrameTime start, FrameTime end); - - /** Get the buffer for a particular voice. - * A Connection is smart - it knows the destination port requesting the - * buffer, and will return accordingly (ie the same buffer for every voice - * in a mono->poly connection). - */ - inline Buffer* buffer(size_t voice) const; - - void set_buffer_size(size_t size); - - DataType type() const { return _src_port->type(); } - -protected: - Port* const _src_port; - Port* const _dst_port; - Buffer* _local_buffer; - size_t _buffer_size; - bool _must_mix; - bool _pending_disconnection; -}; - - -inline Buffer* -Connection::buffer(size_t voice) const -{ - if (_must_mix) - return _local_buffer; - else if (_src_port->poly() == 1) - return _src_port->buffer(0); - else - return _src_port->buffer(voice); -} - - -} // namespace Ingen - -#endif // CONNECTION_H diff --git a/src/libs/engine/Connection.hpp b/src/libs/engine/Connection.hpp new file mode 100644 index 00000000..816efe6c --- /dev/null +++ b/src/libs/engine/Connection.hpp @@ -0,0 +1,94 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef CONNECTION_H +#define CONNECTION_H + +#include +#include +#include +#include "DataType.hpp" +#include "Port.hpp" +#include "types.hpp" + +namespace Ingen { + +class Port; +class Buffer; + + +/** Represents a single inbound connection for an InputPort. + * + * This can be a group of ports (ie coming from a polyphonic Node) or + * a single Port. This class exists basically as an abstraction of mixing + * down polyphonic inputs, so InputPort can just deal with mixing down + * multiple connections (oblivious to the polyphonic situation of the + * connection itself). + * + * \ingroup engine + */ +class Connection : public Raul::Deletable +{ +public: + Connection(Port* src_port, Port* dst_port); + virtual ~Connection(); + + Port* src_port() const { return _src_port; } + Port* dst_port() const { return _dst_port; } + + /** Used by some (recursive) events to prevent double disconnections */ + bool pending_disconnection() { return _pending_disconnection; } + void pending_disconnection(bool b) { _pending_disconnection = b; } + + void process(SampleCount nframes, FrameTime start, FrameTime end); + + /** Get the buffer for a particular voice. + * A Connection is smart - it knows the destination port requesting the + * buffer, and will return accordingly (ie the same buffer for every voice + * in a mono->poly connection). + */ + inline Buffer* buffer(size_t voice) const; + + void set_buffer_size(size_t size); + + DataType type() const { return _src_port->type(); } + +protected: + Port* const _src_port; + Port* const _dst_port; + Buffer* _local_buffer; + size_t _buffer_size; + bool _must_mix; + bool _pending_disconnection; +}; + + +inline Buffer* +Connection::buffer(size_t voice) const +{ + if (_must_mix) + return _local_buffer; + else if (_src_port->poly() == 1) + return _src_port->buffer(0); + else + return _src_port->buffer(voice); +} + + +} // namespace Ingen + +#endif // CONNECTION_H diff --git a/src/libs/engine/Controller.h b/src/libs/engine/Controller.h deleted file mode 100644 index 95f7cc44..00000000 --- a/src/libs/engine/Controller.h +++ /dev/null @@ -1,83 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef CONTROLLER_H -#define CONTROLLER_H - -namespace Ingen { - - -/** Public interface to engine library. - * - * This is an interface to all the audio-processing related functionality - * only. OSC communication, LASH session management, etc, are not part of - * this library. - */ -class Controller { -public: - void init(); - void quit(); - - void load_plugins(); - - void activate_engine(); - void deactivate_engine(); - - void create_patch(const char* path, unsigned int polyphony); - void clear_patch(const char* path); - void enable_patch(const char* path); - void disable_patch(const char* path); - void rename(const char* old_path, const char* new_path); - - void create_node(const char* path, - const char* type, - const char* library_name, - const char* library_label, - unsigned int polyphony); - - void destroy(const char* path); - - void connect(const char* src_port_path, const char* dst_port_path); - void disconnect(const char* src_port_path, const char* dst_port_path); - void disconnect_all(const char* path); - - void set_port_value(const char* path, float value); - void set_port_value_voice(const char* path, unsigned int voice); - void set_port_value_slow(const char* path, float value); - - void note_on(const char* node_path, - unsigned char note_num, - unsigned char velocity); - - void note_off(const char* node_path, - unsigned char note_num); - - void all_notes_off(const char* node_path); - void midi_learn(const char* node_path); - - void get_metadata(); - void set_metadata(); - void responder_plugins(); - void responder_all_objects(); - void responder_port_value(); -}; - - -} // namespace Ingen - -#endif // CONTROLLER_H - diff --git a/src/libs/engine/Controller.hpp b/src/libs/engine/Controller.hpp new file mode 100644 index 00000000..95f7cc44 --- /dev/null +++ b/src/libs/engine/Controller.hpp @@ -0,0 +1,83 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef CONTROLLER_H +#define CONTROLLER_H + +namespace Ingen { + + +/** Public interface to engine library. + * + * This is an interface to all the audio-processing related functionality + * only. OSC communication, LASH session management, etc, are not part of + * this library. + */ +class Controller { +public: + void init(); + void quit(); + + void load_plugins(); + + void activate_engine(); + void deactivate_engine(); + + void create_patch(const char* path, unsigned int polyphony); + void clear_patch(const char* path); + void enable_patch(const char* path); + void disable_patch(const char* path); + void rename(const char* old_path, const char* new_path); + + void create_node(const char* path, + const char* type, + const char* library_name, + const char* library_label, + unsigned int polyphony); + + void destroy(const char* path); + + void connect(const char* src_port_path, const char* dst_port_path); + void disconnect(const char* src_port_path, const char* dst_port_path); + void disconnect_all(const char* path); + + void set_port_value(const char* path, float value); + void set_port_value_voice(const char* path, unsigned int voice); + void set_port_value_slow(const char* path, float value); + + void note_on(const char* node_path, + unsigned char note_num, + unsigned char velocity); + + void note_off(const char* node_path, + unsigned char note_num); + + void all_notes_off(const char* node_path); + void midi_learn(const char* node_path); + + void get_metadata(); + void set_metadata(); + void responder_plugins(); + void responder_all_objects(); + void responder_port_value(); +}; + + +} // namespace Ingen + +#endif // CONTROLLER_H + diff --git a/src/libs/engine/DSSINode.cpp b/src/libs/engine/DSSINode.cpp index 53af15ef..69aff132 100644 --- a/src/libs/engine/DSSINode.cpp +++ b/src/libs/engine/DSSINode.cpp @@ -15,14 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DSSINode.h" +#include "DSSINode.hpp" #include #include -#include "ClientBroadcaster.h" -#include "interface/ClientInterface.h" -#include "InputPort.h" -#include "types.h" -#include "AudioBuffer.h" +#include "ClientBroadcaster.hpp" +#include "interface/ClientInterface.hpp" +#include "InputPort.hpp" +#include "types.hpp" +#include "AudioBuffer.hpp" using namespace std; diff --git a/src/libs/engine/DSSINode.h b/src/libs/engine/DSSINode.h deleted file mode 100644 index d569e720..00000000 --- a/src/libs/engine/DSSINode.h +++ /dev/null @@ -1,107 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DSSINODE_H -#define DSSINODE_H - -#include -#include -#include -#include "LADSPANode.h" -#include "MidiBuffer.h" - -namespace Ingen { - -class InputPort; -namespace Shared { - class ClientInterface; -} using Shared::ClientInterface; - - -/** An instance of a DSSI plugin. - */ -class DSSINode : public LADSPANode -{ -public: - - typedef std::map Bank; - - DSSINode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size); - ~DSSINode(); - - bool instantiate(); - - void activate(); - - void set_ui_url(const string& url); - void send_update(); - - void set_control(size_t port_num, Sample val); - void configure(const string& key, const string& val); - void program(int bank, int program); - - void process(SampleCount nframes, FrameTime start, FrameTime end); - - void set_port_buffer(size_t voice, size_t port_num, Buffer* buf); - - bool update_programs(bool send_events); - void set_default_program(); - const std::map& get_programs() const; - - const Plugin* plugin() const { return _plugin; } - void plugin(const Plugin* const pi) { _plugin = pi; } - -private: - bool has_midi_input() const; - - // DSSI GUI messages - void send_control(int port_num, float value); - void send_program(int bank, int value); - void send_configure(const std::string& key, const std::string& val); - void send_show(); - void send_hide(); - void send_quit(); - - // Conversion to ALSA MIDI events - void convert_events(SampleCount nframes); - - - DSSI_Descriptor* _dssi_descriptor; - - std::string _ui_url; - std::string _ui_base_path; - lo_address _ui_addr; - - // Current values - int _bank; - int _program; - std::map _configures; - std::map _banks; - - InputPort* _midi_in_port; - MidiBuffer* _midi_in_buffer; - snd_seq_event_t* _alsa_events; - unsigned long _encoded_events; - snd_midi_event_t* _alsa_encoder; -}; - - -} // namespace Ingen - - -#endif // DSSINODE_H - diff --git a/src/libs/engine/DSSINode.hpp b/src/libs/engine/DSSINode.hpp new file mode 100644 index 00000000..f54e75f8 --- /dev/null +++ b/src/libs/engine/DSSINode.hpp @@ -0,0 +1,107 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DSSINODE_H +#define DSSINODE_H + +#include +#include +#include +#include "LADSPANode.hpp" +#include "MidiBuffer.hpp" + +namespace Ingen { + +class InputPort; +namespace Shared { + class ClientInterface; +} using Shared::ClientInterface; + + +/** An instance of a DSSI plugin. + */ +class DSSINode : public LADSPANode +{ +public: + + typedef std::map Bank; + + DSSINode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size); + ~DSSINode(); + + bool instantiate(); + + void activate(); + + void set_ui_url(const string& url); + void send_update(); + + void set_control(size_t port_num, Sample val); + void configure(const string& key, const string& val); + void program(int bank, int program); + + void process(SampleCount nframes, FrameTime start, FrameTime end); + + void set_port_buffer(size_t voice, size_t port_num, Buffer* buf); + + bool update_programs(bool send_events); + void set_default_program(); + const std::map& get_programs() const; + + const Plugin* plugin() const { return _plugin; } + void plugin(const Plugin* const pi) { _plugin = pi; } + +private: + bool has_midi_input() const; + + // DSSI GUI messages + void send_control(int port_num, float value); + void send_program(int bank, int value); + void send_configure(const std::string& key, const std::string& val); + void send_show(); + void send_hide(); + void send_quit(); + + // Conversion to ALSA MIDI events + void convert_events(SampleCount nframes); + + + DSSI_Descriptor* _dssi_descriptor; + + std::string _ui_url; + std::string _ui_base_path; + lo_address _ui_addr; + + // Current values + int _bank; + int _program; + std::map _configures; + std::map _banks; + + InputPort* _midi_in_port; + MidiBuffer* _midi_in_buffer; + snd_seq_event_t* _alsa_events; + unsigned long _encoded_events; + snd_midi_event_t* _alsa_encoder; +}; + + +} // namespace Ingen + + +#endif // DSSINODE_H + diff --git a/src/libs/engine/DataType.h b/src/libs/engine/DataType.h deleted file mode 100644 index 1f431edd..00000000 --- a/src/libs/engine/DataType.h +++ /dev/null @@ -1,75 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DATATYPE_H -#define DATATYPE_H - -namespace Ingen -{ - - -/** A data type that can be stored in a Port. - * - * Eventually the goal is to be able to just have to create a new one of these - * to support a new data type. - */ -class DataType { -public: - - enum Symbol { - UNKNOWN = 0, - FLOAT = 1, - MIDI = 2, - OSC = 3 - }; - - DataType(const std::string& uri) - : _symbol(UNKNOWN) - { - if (uri == type_uris[FLOAT]) { - _symbol = FLOAT; - } else if (uri == type_uris[MIDI]) { - _symbol = MIDI; - } else if (uri == type_uris[OSC]) { - _symbol = OSC; - } - } - - DataType(Symbol symbol) - : _symbol(symbol) - {} - - const char* const uri() const { return type_uris[_symbol]; } - const Symbol& symbol() const { return _symbol; } - - inline bool operator==(const Symbol& symbol) const { return (_symbol == symbol); } - inline bool operator!=(const Symbol& symbol) const { return (_symbol != symbol); } - inline bool operator==(const DataType& type) const { return (_symbol == type._symbol); } - inline bool operator!=(const DataType& type) const { return (_symbol != type._symbol); } - -private: - Symbol _symbol; - - // Defined in Port.cpp for no good reason - static const char* const type_uris[4]; -}; - - - -} // namespace Ingen - -#endif // DATATYPE_H diff --git a/src/libs/engine/DataType.hpp b/src/libs/engine/DataType.hpp new file mode 100644 index 00000000..1f431edd --- /dev/null +++ b/src/libs/engine/DataType.hpp @@ -0,0 +1,75 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DATATYPE_H +#define DATATYPE_H + +namespace Ingen +{ + + +/** A data type that can be stored in a Port. + * + * Eventually the goal is to be able to just have to create a new one of these + * to support a new data type. + */ +class DataType { +public: + + enum Symbol { + UNKNOWN = 0, + FLOAT = 1, + MIDI = 2, + OSC = 3 + }; + + DataType(const std::string& uri) + : _symbol(UNKNOWN) + { + if (uri == type_uris[FLOAT]) { + _symbol = FLOAT; + } else if (uri == type_uris[MIDI]) { + _symbol = MIDI; + } else if (uri == type_uris[OSC]) { + _symbol = OSC; + } + } + + DataType(Symbol symbol) + : _symbol(symbol) + {} + + const char* const uri() const { return type_uris[_symbol]; } + const Symbol& symbol() const { return _symbol; } + + inline bool operator==(const Symbol& symbol) const { return (_symbol == symbol); } + inline bool operator!=(const Symbol& symbol) const { return (_symbol != symbol); } + inline bool operator==(const DataType& type) const { return (_symbol == type._symbol); } + inline bool operator!=(const DataType& type) const { return (_symbol != type._symbol); } + +private: + Symbol _symbol; + + // Defined in Port.cpp for no good reason + static const char* const type_uris[4]; +}; + + + +} // namespace Ingen + +#endif // DATATYPE_H diff --git a/src/libs/engine/DirectResponder.h b/src/libs/engine/DirectResponder.h deleted file mode 100644 index 1eceb80e..00000000 --- a/src/libs/engine/DirectResponder.h +++ /dev/null @@ -1,53 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DIRECTRESPONDER_H -#define DIRECTRESPONDER_H - -#include -#include "interface/ClientInterface.h" -#include "interface/Responder.h" - -namespace Ingen { - - -/** Responder for Direct clients (directly calls methods on a ClientInterface). - */ -class DirectResponder : public Shared::Responder -{ -public: - DirectResponder(SharedPtr client, int32_t id) - : _client(client), _id(id) - {} - - void set_id(int32_t id) { _id = id; } - - void respond_ok() { _client->response(_id, true, ""); } - void respond_error(const string& msg) { _client->response(_id, false, msg); } - - SharedPtr client() { return _client; } - -private: - SharedPtr _client; - int32_t _id; -}; - - -} // namespace Ingen - -#endif // DIRECTRESPONDER_H - diff --git a/src/libs/engine/DirectResponder.hpp b/src/libs/engine/DirectResponder.hpp new file mode 100644 index 00000000..739cd017 --- /dev/null +++ b/src/libs/engine/DirectResponder.hpp @@ -0,0 +1,53 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DIRECTRESPONDER_H +#define DIRECTRESPONDER_H + +#include +#include "interface/ClientInterface.hpp" +#include "interface/Responder.hpp" + +namespace Ingen { + + +/** Responder for Direct clients (directly calls methods on a ClientInterface). + */ +class DirectResponder : public Shared::Responder +{ +public: + DirectResponder(SharedPtr client, int32_t id) + : _client(client), _id(id) + {} + + void set_id(int32_t id) { _id = id; } + + void respond_ok() { _client->response(_id, true, ""); } + void respond_error(const string& msg) { _client->response(_id, false, msg); } + + SharedPtr client() { return _client; } + +private: + SharedPtr _client; + int32_t _id; +}; + + +} // namespace Ingen + +#endif // DIRECTRESPONDER_H + diff --git a/src/libs/engine/Driver.h b/src/libs/engine/Driver.h deleted file mode 100644 index bb65fe9b..00000000 --- a/src/libs/engine/Driver.h +++ /dev/null @@ -1,120 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DRIVER_H -#define DRIVER_H - -#include -#include -#include -#include "DataType.h" - -namespace Ingen { - -class DuplexPort; - - -/** Representation of a "system" (eg outside Ingen) port. - * - * This is the class through which the rest of the engine manages everything - * related to driver ports. Derived classes are expected to have a pointer to - * their driver (to be able to perform the operation necessary). - * - * \ingroup engine - */ -class DriverPort : boost::noncopyable { -public: - virtual ~DriverPort() {} - - /** Set the name of the system port */ - virtual void set_name(const std::string& name) = 0; - - bool is_input() { return _is_input; } - -protected: - /** is_input from the perspective outside of ingen */ - DriverPort(bool is_input) : _is_input(is_input) {} - - bool _is_input; -}; - - -/** Driver abstract base class. - * - * A Driver is, from the perspective of GraphObjects (nodes, patches, ports) an - * interface for managing system ports. An implementation of Driver basically - * needs to manage DriverPorts, and handle writing/reading data to/from them. - * - * \ingroup engine - */ -class Driver : boost::noncopyable -{ -public: - Driver(DataType type) - : _type(type) - {} - - virtual ~Driver() {} - - virtual void activate() = 0; - virtual void deactivate() = 0; - - virtual bool is_activated() const = 0; - - /** Create a port ready to be inserted with add_input (non realtime). - * - * May return NULL if the Driver can not drive the port for some reason. - */ - virtual DriverPort* create_port(DuplexPort* patch_port) = 0; - - virtual void add_port(DriverPort* port) = 0; - virtual DriverPort* remove_port(const Raul::Path& path) = 0; - -protected: - DataType _type; -}; - - -#if 0 -/** Dummy audio driver. - * - * Not abstract, all functions are dummies. One of these will be allocated and - * "used" if no working AUDIO driver is loaded. (Doing it this way as opposed to - * just making Driver have dummy functions makes sure any existing Driver - * derived class actually implements the required functions). - * - * \ingroup engine - */ -class DummyDriver : public Driver -{ -public: - ~DummyDriver() {} - - void activate() {} - void deactivate() {} - - void enable() {} - void disable() {} - - DriverPort* create_port(TypedPort* patch_port) { return NULL; } -}; -#endif - - -} // namespace Ingen - -#endif // DRIVER_H diff --git a/src/libs/engine/Driver.hpp b/src/libs/engine/Driver.hpp new file mode 100644 index 00000000..786b7775 --- /dev/null +++ b/src/libs/engine/Driver.hpp @@ -0,0 +1,120 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DRIVER_H +#define DRIVER_H + +#include +#include +#include +#include "DataType.hpp" + +namespace Ingen { + +class DuplexPort; + + +/** Representation of a "system" (eg outside Ingen) port. + * + * This is the class through which the rest of the engine manages everything + * related to driver ports. Derived classes are expected to have a pointer to + * their driver (to be able to perform the operation necessary). + * + * \ingroup engine + */ +class DriverPort : boost::noncopyable { +public: + virtual ~DriverPort() {} + + /** Set the name of the system port */ + virtual void set_name(const std::string& name) = 0; + + bool is_input() { return _is_input; } + +protected: + /** is_input from the perspective outside of ingen */ + DriverPort(bool is_input) : _is_input(is_input) {} + + bool _is_input; +}; + + +/** Driver abstract base class. + * + * A Driver is, from the perspective of GraphObjects (nodes, patches, ports) an + * interface for managing system ports. An implementation of Driver basically + * needs to manage DriverPorts, and handle writing/reading data to/from them. + * + * \ingroup engine + */ +class Driver : boost::noncopyable +{ +public: + Driver(DataType type) + : _type(type) + {} + + virtual ~Driver() {} + + virtual void activate() = 0; + virtual void deactivate() = 0; + + virtual bool is_activated() const = 0; + + /** Create a port ready to be inserted with add_input (non realtime). + * + * May return NULL if the Driver can not drive the port for some reason. + */ + virtual DriverPort* create_port(DuplexPort* patch_port) = 0; + + virtual void add_port(DriverPort* port) = 0; + virtual DriverPort* remove_port(const Raul::Path& path) = 0; + +protected: + DataType _type; +}; + + +#if 0 +/** Dummy audio driver. + * + * Not abstract, all functions are dummies. One of these will be allocated and + * "used" if no working AUDIO driver is loaded. (Doing it this way as opposed to + * just making Driver have dummy functions makes sure any existing Driver + * derived class actually implements the required functions). + * + * \ingroup engine + */ +class DummyDriver : public Driver +{ +public: + ~DummyDriver() {} + + void activate() {} + void deactivate() {} + + void enable() {} + void disable() {} + + DriverPort* create_port(TypedPort* patch_port) { return NULL; } +}; +#endif + + +} // namespace Ingen + +#endif // DRIVER_H diff --git a/src/libs/engine/DuplexPort.cpp b/src/libs/engine/DuplexPort.cpp index a71f18b8..6558c587 100644 --- a/src/libs/engine/DuplexPort.cpp +++ b/src/libs/engine/DuplexPort.cpp @@ -15,17 +15,16 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DuplexPort.h" #include #include #include -#include "Connection.h" -#include "OutputPort.h" -#include "Node.h" -#include "util.h" - -using std::cerr; using std::cout; using std::endl; +#include "util.hpp" +#include "DuplexPort.hpp" +#include "Connection.hpp" +#include "OutputPort.hpp" +#include "Node.hpp" +using namespace std; namespace Ingen { diff --git a/src/libs/engine/DuplexPort.h b/src/libs/engine/DuplexPort.h deleted file mode 100644 index 986c1862..00000000 --- a/src/libs/engine/DuplexPort.h +++ /dev/null @@ -1,61 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DUPLEXPORT_H -#define DUPLEXPORT_H - -#include -#include "types.h" -#include -#include "Buffer.h" -#include "InputPort.h" -#include "OutputPort.h" -using std::string; - -namespace Ingen { - -class Node; - - -/** A duplex port (which is both an InputPort and an OutputPort) - * - * This is used for Patch ports, since they need to appear as both an input - * and an output port based on context. Eg. a patch output appears as an - * input inside the patch, so nodes inside the patch can feed it data. - * - * \ingroup engine - */ -class DuplexPort : public InputPort, public OutputPort -{ -public: - DuplexPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size, bool is_output); - virtual ~DuplexPort() {} - - void pre_process(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(SampleCount nframes, FrameTime start, FrameTime end); - - bool is_input() const { return !_is_output; } - bool is_output() const { return _is_output; } - -protected: - bool _is_output; -}; - - -} // namespace Ingen - -#endif // DUPLEXPORT_H diff --git a/src/libs/engine/DuplexPort.hpp b/src/libs/engine/DuplexPort.hpp new file mode 100644 index 00000000..3abb4549 --- /dev/null +++ b/src/libs/engine/DuplexPort.hpp @@ -0,0 +1,60 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DUPLEXPORT_H +#define DUPLEXPORT_H + +#include +#include +#include "types.hpp" +#include "Buffer.hpp" +#include "InputPort.hpp" +#include "OutputPort.hpp" + +namespace Ingen { + +class Node; + + +/** A duplex port (which is both an InputPort and an OutputPort) + * + * This is used for Patch ports, since they need to appear as both an input + * and an output port based on context. Eg. a patch output appears as an + * input inside the patch, so nodes inside the patch can feed it data. + * + * \ingroup engine + */ +class DuplexPort : public InputPort, public OutputPort +{ +public: + DuplexPort(Node* parent, const std::string& name, size_t index, size_t poly, DataType type, size_t buffer_size, bool is_output); + virtual ~DuplexPort() {} + + void pre_process(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(SampleCount nframes, FrameTime start, FrameTime end); + + bool is_input() const { return !_is_output; } + bool is_output() const { return _is_output; } + +protected: + bool _is_output; +}; + + +} // namespace Ingen + +#endif // DUPLEXPORT_H diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp index a2bfc757..69f7ebe0 100644 --- a/src/libs/engine/Engine.cpp +++ b/src/libs/engine/Engine.cpp @@ -16,32 +16,32 @@ */ #include -#include "Engine.h" -#include "config.h" -#include "tuning.h" #include #include #include -#include -#include -#include "Event.h" -#include "JackAudioDriver.h" -#include "NodeFactory.h" -#include "ClientBroadcaster.h" -#include "Patch.h" -#include "ObjectStore.h" -#include "MidiDriver.h" -#include "OSCDriver.h" -#include "QueuedEventSource.h" -#include "PostProcessor.h" -#include "CreatePatchEvent.h" -#include "EnablePatchEvent.h" -#include "OSCEngineReceiver.h" +#include +#include +#include "Engine.hpp" +#include "../../../../config/config.h" +#include "tuning.hpp" +#include "Event.hpp" +#include "JackAudioDriver.hpp" +#include "NodeFactory.hpp" +#include "ClientBroadcaster.hpp" +#include "Patch.hpp" +#include "ObjectStore.hpp" +#include "MidiDriver.hpp" +#include "OSCDriver.hpp" +#include "QueuedEventSource.hpp" +#include "PostProcessor.hpp" +#include "CreatePatchEvent.hpp" +#include "EnablePatchEvent.hpp" +#include "OSCEngineReceiver.hpp" #ifdef HAVE_JACK_MIDI -#include "JackMidiDriver.h" +#include "JackMidiDriver.hpp" #endif /*#ifdef HAVE_LASH -#include "LashDriver.h" +#include "LashDriver.hpp" #endif*/ using namespace std; diff --git a/src/libs/engine/Engine.h b/src/libs/engine/Engine.h deleted file mode 100644 index 6fe61582..00000000 --- a/src/libs/engine/Engine.h +++ /dev/null @@ -1,113 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef ENGINE_H -#define ENGINE_H - -#include -#include -#include -#include "DataType.h" - -template class Queue; - -namespace Raul { class Maid; } - -namespace Ingen { - -class AudioDriver; -class MidiDriver; -class OSCDriver; -class NodeFactory; -class ClientBroadcaster; -class Patch; -class ObjectStore; -class EventSource; -class PostProcessor; -class Event; -class QueuedEvent; -class QueuedEngineInterface; -class LashDriver; -class Driver; - - -/** The main class for the Engine. - * - * This is a (GoF) facade for the engine. Pointers to all components are - * available for more advanced control than this facade allows. - * - * \ingroup engine - */ -class Engine : boost::noncopyable -{ -public: - Engine(); - virtual ~Engine(); - - virtual int main(); - virtual bool main_iteration(); - - /** Set the quit flag that should kill all threads and exit cleanly. - * Note that it will take some time. */ - virtual void quit() { _quit_flag = true; } - - virtual void start_jack_driver(); - virtual void start_osc_driver(int port); - - virtual SharedPtr new_queued_interface(); - - //virtual void set_event_source(SharedPtr); - - virtual bool activate(); - virtual void deactivate(); - - virtual bool activated() { return _activated; } - - Raul::Maid* maid() const { return _maid; } - EventSource* event_source() const { return _event_source.get(); } - AudioDriver* audio_driver() const { return _audio_driver.get(); } - MidiDriver* midi_driver() const { return _midi_driver; } - OSCDriver* osc_driver() const { return _osc_driver; } - PostProcessor* post_processor() const { return _post_processor; } - ClientBroadcaster* broadcaster() const { return _broadcaster; } - ObjectStore* object_store() const { return _object_store; } - NodeFactory* node_factory() const { return _node_factory; } - LashDriver* lash_driver() const { return _lash_driver; } - - /** Return the active driver for the given type */ - Driver* driver(DataType type); - -private: - SharedPtr _event_source; - SharedPtr _audio_driver; - MidiDriver* _midi_driver; - OSCDriver* _osc_driver; - Raul::Maid* _maid; - PostProcessor* _post_processor; - ClientBroadcaster* _broadcaster; - ObjectStore* _object_store; - NodeFactory* _node_factory; - LashDriver* _lash_driver; - - bool _quit_flag; - bool _activated; -}; - - -} // namespace Ingen - -#endif // ENGINE_H diff --git a/src/libs/engine/Engine.hpp b/src/libs/engine/Engine.hpp new file mode 100644 index 00000000..b9780501 --- /dev/null +++ b/src/libs/engine/Engine.hpp @@ -0,0 +1,113 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef ENGINE_H +#define ENGINE_H + +#include +#include +#include +#include "DataType.hpp" + +template class Queue; + +namespace Raul { class Maid; } + +namespace Ingen { + +class AudioDriver; +class MidiDriver; +class OSCDriver; +class NodeFactory; +class ClientBroadcaster; +class Patch; +class ObjectStore; +class EventSource; +class PostProcessor; +class Event; +class QueuedEvent; +class QueuedEngineInterface; +class LashDriver; +class Driver; + + +/** The main class for the Engine. + * + * This is a (GoF) facade for the engine. Pointers to all components are + * available for more advanced control than this facade allows. + * + * \ingroup engine + */ +class Engine : boost::noncopyable +{ +public: + Engine(); + virtual ~Engine(); + + virtual int main(); + virtual bool main_iteration(); + + /** Set the quit flag that should kill all threads and exit cleanly. + * Note that it will take some time. */ + virtual void quit() { _quit_flag = true; } + + virtual void start_jack_driver(); + virtual void start_osc_driver(int port); + + virtual SharedPtr new_queued_interface(); + + //virtual void set_event_source(SharedPtr); + + virtual bool activate(); + virtual void deactivate(); + + virtual bool activated() { return _activated; } + + Raul::Maid* maid() const { return _maid; } + EventSource* event_source() const { return _event_source.get(); } + AudioDriver* audio_driver() const { return _audio_driver.get(); } + MidiDriver* midi_driver() const { return _midi_driver; } + OSCDriver* osc_driver() const { return _osc_driver; } + PostProcessor* post_processor() const { return _post_processor; } + ClientBroadcaster* broadcaster() const { return _broadcaster; } + ObjectStore* object_store() const { return _object_store; } + NodeFactory* node_factory() const { return _node_factory; } + LashDriver* lash_driver() const { return _lash_driver; } + + /** Return the active driver for the given type */ + Driver* driver(DataType type); + +private: + SharedPtr _event_source; + SharedPtr _audio_driver; + MidiDriver* _midi_driver; + OSCDriver* _osc_driver; + Raul::Maid* _maid; + PostProcessor* _post_processor; + ClientBroadcaster* _broadcaster; + ObjectStore* _object_store; + NodeFactory* _node_factory; + LashDriver* _lash_driver; + + bool _quit_flag; + bool _activated; +}; + + +} // namespace Ingen + +#endif // ENGINE_H diff --git a/src/libs/engine/Event.h b/src/libs/engine/Event.h deleted file mode 100644 index 01b14abc..00000000 --- a/src/libs/engine/Event.h +++ /dev/null @@ -1,94 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef EVENT_H -#define EVENT_H - -#include -#include -#include -#include "interface/Responder.h" -#include "types.h" -#include "ThreadManager.h" - -namespace Raul { class Path; } -using Raul::Path; - -using Ingen::Shared::Responder; - -namespace Ingen { - -class Engine; - - -/** Base class for all events (both realtime and QueuedEvent). - * - * This is for time-critical events like note ons. There is no non-realtime - * pre-execute method as in QueuedEvent's, any lookups etc need to be done in the - * realtime execute() method. - * - * QueuedEvent extends this class with a pre_process() method for any work that needs - * to be done before processing in the realtime audio thread. - * - * \ingroup engine - */ -class Event : public Raul::Deletable -{ -public: - virtual ~Event() {} - - /** Execute this event in the audio thread (MUST be realtime safe). */ - virtual void execute(SampleCount nframes, FrameTime start, FrameTime end) - { - assert(ThreadManager::current_thread_id() == THREAD_PROCESS); - assert(!_executed); - assert(_time <= end); - - // Missed the event, jitter, damnit. - if (_time < start) - _time = start; - - _executed = true; - } - - /** Perform any actions after execution (ie send replies to commands) - * (no realtime requirements). */ - virtual void post_process() - { - assert(ThreadManager::current_thread_id() == THREAD_POST_PROCESS); - } - - inline SampleCount time() { return _time; } - -protected: - Event(Engine& engine, SharedPtr responder, FrameTime time) - : _engine(engine) - , _responder(responder) - , _time(time) - , _executed(false) - {} - - Engine& _engine; - SharedPtr _responder; - FrameTime _time; - bool _executed; -}; - - -} // namespace Ingen - -#endif // EVENT_H diff --git a/src/libs/engine/Event.hpp b/src/libs/engine/Event.hpp new file mode 100644 index 00000000..8814cbae --- /dev/null +++ b/src/libs/engine/Event.hpp @@ -0,0 +1,94 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef EVENT_H +#define EVENT_H + +#include +#include +#include +#include "interface/Responder.hpp" +#include "types.hpp" +#include "ThreadManager.hpp" + +namespace Raul { class Path; } +using Raul::Path; + +using Ingen::Shared::Responder; + +namespace Ingen { + +class Engine; + + +/** Base class for all events (both realtime and QueuedEvent). + * + * This is for time-critical events like note ons. There is no non-realtime + * pre-execute method as in QueuedEvent's, any lookups etc need to be done in the + * realtime execute() method. + * + * QueuedEvent extends this class with a pre_process() method for any work that needs + * to be done before processing in the realtime audio thread. + * + * \ingroup engine + */ +class Event : public Raul::Deletable +{ +public: + virtual ~Event() {} + + /** Execute this event in the audio thread (MUST be realtime safe). */ + virtual void execute(SampleCount nframes, FrameTime start, FrameTime end) + { + assert(ThreadManager::current_thread_id() == THREAD_PROCESS); + assert(!_executed); + assert(_time <= end); + + // Missed the event, jitter, damnit. + if (_time < start) + _time = start; + + _executed = true; + } + + /** Perform any actions after execution (ie send replies to commands) + * (no realtime requirements). */ + virtual void post_process() + { + assert(ThreadManager::current_thread_id() == THREAD_POST_PROCESS); + } + + inline SampleCount time() { return _time; } + +protected: + Event(Engine& engine, SharedPtr responder, FrameTime time) + : _engine(engine) + , _responder(responder) + , _time(time) + , _executed(false) + {} + + Engine& _engine; + SharedPtr _responder; + FrameTime _time; + bool _executed; +}; + + +} // namespace Ingen + +#endif // EVENT_H diff --git a/src/libs/engine/EventSource.h b/src/libs/engine/EventSource.h deleted file mode 100644 index 15b926e9..00000000 --- a/src/libs/engine/EventSource.h +++ /dev/null @@ -1,64 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef EVENTSOURCE_H -#define EVENTSOURCE_H - -#include "types.h" - -namespace Ingen { - -class Event; -class QueuedEvent; -class PostProcessor; - - -/** Source for events to run in the audio thread. - * - * The AudioDriver gets events from an EventSource in the process callback - * (realtime audio thread) and executes them, then they are sent to the - * PostProcessor and finalised (post-processing thread). - * - * There are two distinct classes of events - "queued" and "stamped". Queued - * events are events that require non-realtime pre-processing before being - * executed in the process thread. Stamped events are timestamped realtime - * events that require no pre-processing and can be executed immediately - * (with sample accuracy). - */ -class EventSource -{ -public: - - virtual ~EventSource() {} - - virtual void activate() = 0; - virtual void deactivate() = 0; - - virtual void process(PostProcessor& dest, - SampleCount nframes, - FrameTime cycle_start, - FrameTime cycle_end) = 0; - -protected: - EventSource() {} -}; - - -} // namespace Ingen - -#endif // EVENTSOURCE_H - diff --git a/src/libs/engine/EventSource.hpp b/src/libs/engine/EventSource.hpp new file mode 100644 index 00000000..2bf40527 --- /dev/null +++ b/src/libs/engine/EventSource.hpp @@ -0,0 +1,64 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef EVENTSOURCE_H +#define EVENTSOURCE_H + +#include "types.hpp" + +namespace Ingen { + +class Event; +class QueuedEvent; +class PostProcessor; + + +/** Source for events to run in the audio thread. + * + * The AudioDriver gets events from an EventSource in the process callback + * (realtime audio thread) and executes them, then they are sent to the + * PostProcessor and finalised (post-processing thread). + * + * There are two distinct classes of events - "queued" and "stamped". Queued + * events are events that require non-realtime pre-processing before being + * executed in the process thread. Stamped events are timestamped realtime + * events that require no pre-processing and can be executed immediately + * (with sample accuracy). + */ +class EventSource +{ +public: + + virtual ~EventSource() {} + + virtual void activate() = 0; + virtual void deactivate() = 0; + + virtual void process(PostProcessor& dest, + SampleCount nframes, + FrameTime cycle_start, + FrameTime cycle_end) = 0; + +protected: + EventSource() {} +}; + + +} // namespace Ingen + +#endif // EVENTSOURCE_H + diff --git a/src/libs/engine/GraphObject.cpp b/src/libs/engine/GraphObject.cpp index e8af813f..48a513bc 100644 --- a/src/libs/engine/GraphObject.cpp +++ b/src/libs/engine/GraphObject.cpp @@ -15,9 +15,9 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "GraphObject.h" -#include "Patch.h" -#include "ObjectStore.h" +#include "GraphObject.hpp" +#include "Patch.hpp" +#include "ObjectStore.hpp" namespace Ingen { diff --git a/src/libs/engine/GraphObject.h b/src/libs/engine/GraphObject.h deleted file mode 100644 index c5993595..00000000 --- a/src/libs/engine/GraphObject.h +++ /dev/null @@ -1,120 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef GRAPHOBJECT_H -#define GRAPHOBJECT_H - -#include -#include -#include -#include -#include -#include -#include -#include "types.h" - -using std::string; -using Raul::Atom; -using Raul::Path; - -namespace Ingen { - -class Patch; -class Node; -class Port; -class ObjectStore; - - -/** An object on the audio graph - Patch, Node, Port, etc. - * - * Each of these is a Raul::Deletable and so can be deleted in a realtime safe - * way from anywhere, and they all have a map of metadata for clients to store - * arbitrary values in (which the engine puts no significance to whatsoever). - * - * \ingroup engine - */ -class GraphObject : public Raul::Deletable -{ -public: - typedef std::map MetadataMap; - - GraphObject(GraphObject* parent, const string& name) - : _store(NULL), _parent(parent), _name(name) - { - assert(parent == NULL || _name.length() > 0); - assert(_name.find("/") == string::npos); - assert(path().find("//") == string::npos); - } - - virtual ~GraphObject() {} - - inline GraphObject* parent() const { return _parent; } - inline const string& name() const { return _name; } - - virtual void process(SampleCount nframes, FrameTime start, FrameTime end) = 0; - - /** Rename */ - virtual void set_path(const Path& new_path) { - assert(new_path.parent() == path().parent()); - _name = new_path.name(); - assert(_name.find("/") == string::npos); - } - - void set_metadata(const string& key, const Atom& value) - { _metadata[key] = value; } - - const Atom& get_metadata(const string& key) { - static Atom null_atom; - MetadataMap::iterator i = _metadata.find(key); - return (i != _metadata.end()) ? (*i).second : null_atom; - } - - const MetadataMap& metadata() const { return _metadata; } - - - /** Patch and Node override this to recursively add their children. */ - virtual void add_to_store(ObjectStore* store); - - /** Patch and Node override this to recursively remove their children. */ - virtual void remove_from_store(); - - /** The Patch this object is a child of. */ - virtual Patch* parent_patch() const; - - /** Path is dynamically generated from parent to ease renaming */ - inline const Path path() const { - if (_parent == NULL) - return Path(string("/").append(_name)); - else if (_parent->path() == "/") - return Path(string("/").append(_name)); - else - return Path(_parent->path() +"/"+ _name); - } - -protected: - ObjectStore* _store; - GraphObject* _parent; - string _name; - -private: - MetadataMap _metadata; -}; - - -} // namespace Ingen - -#endif // GRAPHOBJECT_H diff --git a/src/libs/engine/GraphObject.hpp b/src/libs/engine/GraphObject.hpp new file mode 100644 index 00000000..d5ffb4b8 --- /dev/null +++ b/src/libs/engine/GraphObject.hpp @@ -0,0 +1,120 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef GRAPHOBJECT_H +#define GRAPHOBJECT_H + +#include +#include +#include +#include +#include +#include +#include +#include "types.hpp" + +using std::string; +using Raul::Atom; +using Raul::Path; + +namespace Ingen { + +class Patch; +class Node; +class Port; +class ObjectStore; + + +/** An object on the audio graph - Patch, Node, Port, etc. + * + * Each of these is a Raul::Deletable and so can be deleted in a realtime safe + * way from anywhere, and they all have a map of metadata for clients to store + * arbitrary values in (which the engine puts no significance to whatsoever). + * + * \ingroup engine + */ +class GraphObject : public Raul::Deletable +{ +public: + typedef std::map MetadataMap; + + GraphObject(GraphObject* parent, const string& name) + : _store(NULL), _parent(parent), _name(name) + { + assert(parent == NULL || _name.length() > 0); + assert(_name.find("/") == string::npos); + assert(path().find("//") == string::npos); + } + + virtual ~GraphObject() {} + + inline GraphObject* parent() const { return _parent; } + inline const string& name() const { return _name; } + + virtual void process(SampleCount nframes, FrameTime start, FrameTime end) = 0; + + /** Rename */ + virtual void set_path(const Path& new_path) { + assert(new_path.parent() == path().parent()); + _name = new_path.name(); + assert(_name.find("/") == string::npos); + } + + void set_metadata(const string& key, const Atom& value) + { _metadata[key] = value; } + + const Atom& get_metadata(const string& key) { + static Atom null_atom; + MetadataMap::iterator i = _metadata.find(key); + return (i != _metadata.end()) ? (*i).second : null_atom; + } + + const MetadataMap& metadata() const { return _metadata; } + + + /** Patch and Node override this to recursively add their children. */ + virtual void add_to_store(ObjectStore* store); + + /** Patch and Node override this to recursively remove their children. */ + virtual void remove_from_store(); + + /** The Patch this object is a child of. */ + virtual Patch* parent_patch() const; + + /** Path is dynamically generated from parent to ease renaming */ + inline const Path path() const { + if (_parent == NULL) + return Path(string("/").append(_name)); + else if (_parent->path() == "/") + return Path(string("/").append(_name)); + else + return Path(_parent->path() +"/"+ _name); + } + +protected: + ObjectStore* _store; + GraphObject* _parent; + string _name; + +private: + MetadataMap _metadata; +}; + + +} // namespace Ingen + +#endif // GRAPHOBJECT_H diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp index 349175eb..743ef88c 100644 --- a/src/libs/engine/InputPort.cpp +++ b/src/libs/engine/InputPort.cpp @@ -15,15 +15,15 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "InputPort.h" +#include "InputPort.hpp" #include #include #include -#include "AudioBuffer.h" -#include "Connection.h" -#include "OutputPort.h" -#include "Node.h" -#include "util.h" +#include "AudioBuffer.hpp" +#include "Connection.hpp" +#include "OutputPort.hpp" +#include "Node.hpp" +#include "util.hpp" using std::cerr; using std::cout; using std::endl; diff --git a/src/libs/engine/InputPort.h b/src/libs/engine/InputPort.h deleted file mode 100644 index e0367025..00000000 --- a/src/libs/engine/InputPort.h +++ /dev/null @@ -1,77 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INPUTPORT_H -#define INPUTPORT_H - -#include -#include -#include -#include -#include "Port.h" -#include "MidiBuffer.h" -using std::string; - -namespace Ingen { - -class Connection; -class OutputPort; -class Node; - - -/** An input port on a Node or Patch. - * - * All ports have a Buffer, but the actual contents (data) of that buffer may be - * set directly to the incoming connection's buffer if there's only one inbound - * connection, to eliminate the need to copy/mix. - * - * If a port has multiple connections, they will be mixed down into the local - * buffer and it will be used. - * - * \ingroup engine - */ -class InputPort : virtual public Port -{ -public: - InputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size); - virtual ~InputPort() {} - - void add_connection(Raul::ListNode* c); - Raul::ListNode* remove_connection(const OutputPort* src_port); - - typedef Raul::List Connections; - const Connections& connections() { return _connections; } - - void pre_process(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(SampleCount nframes, FrameTime start, FrameTime end); - - bool is_connected() const { return (_connections.size() > 0); } - bool is_connected_to(const OutputPort* port) const; - - bool is_input() const { return true; } - bool is_output() const { return false; } - - virtual void set_buffer_size(size_t size); - -private: - Connections _connections; -}; - - -} // namespace Ingen - -#endif // INPUTPORT_H diff --git a/src/libs/engine/InputPort.hpp b/src/libs/engine/InputPort.hpp new file mode 100644 index 00000000..1305e239 --- /dev/null +++ b/src/libs/engine/InputPort.hpp @@ -0,0 +1,77 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef INPUTPORT_H +#define INPUTPORT_H + +#include +#include +#include +#include +#include "Port.hpp" +#include "MidiBuffer.hpp" +using std::string; + +namespace Ingen { + +class Connection; +class OutputPort; +class Node; + + +/** An input port on a Node or Patch. + * + * All ports have a Buffer, but the actual contents (data) of that buffer may be + * set directly to the incoming connection's buffer if there's only one inbound + * connection, to eliminate the need to copy/mix. + * + * If a port has multiple connections, they will be mixed down into the local + * buffer and it will be used. + * + * \ingroup engine + */ +class InputPort : virtual public Port +{ +public: + InputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size); + virtual ~InputPort() {} + + void add_connection(Raul::ListNode* c); + Raul::ListNode* remove_connection(const OutputPort* src_port); + + typedef Raul::List Connections; + const Connections& connections() { return _connections; } + + void pre_process(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(SampleCount nframes, FrameTime start, FrameTime end); + + bool is_connected() const { return (_connections.size() > 0); } + bool is_connected_to(const OutputPort* port) const; + + bool is_input() const { return true; } + bool is_output() const { return false; } + + virtual void set_buffer_size(size_t size); + +private: + Connections _connections; +}; + + +} // namespace Ingen + +#endif // INPUTPORT_H diff --git a/src/libs/engine/InternalNode.h b/src/libs/engine/InternalNode.h deleted file mode 100644 index 7f7d54fe..00000000 --- a/src/libs/engine/InternalNode.h +++ /dev/null @@ -1,52 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INTERNALNODE_H -#define INTERNALNODE_H - -#include -#include "NodeBase.h" -#include "Plugin.h" -#include "types.h" - -namespace Ingen { - -class Patch; - - -/** Base class for Internal (builtin) nodes - * - * \ingroup engine - */ -class InternalNode : public NodeBase -{ -public: - InternalNode(const Plugin* plugin, const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) - : NodeBase(plugin, path, poly, parent, srate, buffer_size) - { - } - - virtual ~InternalNode() {} - -protected: - Plugin* plugin() const { return const_cast(_plugin); } -}; - - -} // namespace Ingen - -#endif // INTERNALNODE_H diff --git a/src/libs/engine/InternalNode.hpp b/src/libs/engine/InternalNode.hpp new file mode 100644 index 00000000..b00cd8cb --- /dev/null +++ b/src/libs/engine/InternalNode.hpp @@ -0,0 +1,52 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef INTERNALNODE_H +#define INTERNALNODE_H + +#include +#include "NodeBase.hpp" +#include "Plugin.hpp" +#include "types.hpp" + +namespace Ingen { + +class Patch; + + +/** Base class for Internal (builtin) nodes + * + * \ingroup engine + */ +class InternalNode : public NodeBase +{ +public: + InternalNode(const Plugin* plugin, const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) + : NodeBase(plugin, path, poly, parent, srate, buffer_size) + { + } + + virtual ~InternalNode() {} + +protected: + Plugin* plugin() const { return const_cast(_plugin); } +}; + + +} // namespace Ingen + +#endif // INTERNALNODE_H diff --git a/src/libs/engine/JackAudioDriver.cpp b/src/libs/engine/JackAudioDriver.cpp index 3f6f58c0..25f8305d 100644 --- a/src/libs/engine/JackAudioDriver.cpp +++ b/src/libs/engine/JackAudioDriver.cpp @@ -15,28 +15,28 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "JackAudioDriver.h" -#include "config.h" -#include "tuning.h" +#include "JackAudioDriver.hpp" +#include "../../../../config/config.h" +#include "tuning.hpp" #include #include -#include -#include "Engine.h" -#include "util.h" -#include "Event.h" -#include "ThreadManager.h" -#include "QueuedEvent.h" -#include "EventSource.h" -#include "PostProcessor.h" -#include "Node.h" -#include "Patch.h" -#include "Port.h" -#include "MidiDriver.h" -#include "DuplexPort.h" -#include "EventSource.h" -#include "AudioBuffer.h" +#include +#include "Engine.hpp" +#include "util.hpp" +#include "Event.hpp" +#include "ThreadManager.hpp" +#include "QueuedEvent.hpp" +#include "EventSource.hpp" +#include "PostProcessor.hpp" +#include "Node.hpp" +#include "Patch.hpp" +#include "Port.hpp" +#include "MidiDriver.hpp" +#include "DuplexPort.hpp" +#include "EventSource.hpp" +#include "AudioBuffer.hpp" /*#ifdef HAVE_LASH -#include "LashDriver.h" +#include "LashDriver.hpp" #endif*/ using namespace std; diff --git a/src/libs/engine/JackAudioDriver.h b/src/libs/engine/JackAudioDriver.h deleted file mode 100644 index a54b4a88..00000000 --- a/src/libs/engine/JackAudioDriver.h +++ /dev/null @@ -1,179 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef JACKAUDIODRIVER_H -#define JACKAUDIODRIVER_H - -#include -#include -#include -#include -#include -#include "AudioDriver.h" -#include "Buffer.h" - -namespace Ingen { - -class Engine; -class Patch; -class Port; -class DuplexPort; -class JackAudioDriver; -typedef jack_default_audio_sample_t jack_sample_t; - - -/** Used internally by JackAudioDriver to represent a Jack port. - * - * A Jack port always has a one-to-one association with a Patch port. - */ -class JackAudioPort : public DriverPort, public Raul::ListNode -{ -public: - JackAudioPort(JackAudioDriver* driver, DuplexPort* patch_port); - ~JackAudioPort(); - - void set_name(const std::string& name) { jack_port_set_name(_jack_port, name.c_str()); }; - - void prepare_buffer(jack_nframes_t nframes); - - jack_port_t* jack_port() const { return _jack_port; } - DuplexPort* patch_port() const { return _patch_port; } - -private: - JackAudioDriver* _driver; - jack_port_t* _jack_port; - jack_sample_t* _jack_buffer; ///< Cached for output ports - DuplexPort* _patch_port; -}; - - - -/** The Jack AudioDriver. - * - * The process callback here drives the entire audio thread by "pulling" - * events from queues, processing them, running the patches, and passing - * events along to the PostProcessor. - * - * \ingroup engine - */ -class JackAudioDriver : public AudioDriver -{ -public: - JackAudioDriver(Engine& engine, - std::string server_name = "", - jack_client_t* jack_client = 0); - - ~JackAudioDriver(); - - void activate(); - void deactivate(); - void enable(); - void disable(); - - DriverPort* port(const Raul::Path& path); - DriverPort* create_port(DuplexPort* patch_port); - - void add_port(DriverPort* port); - DriverPort* remove_port(const Raul::Path& path); - - Patch* root_patch() { return _root_patch; } - void set_root_patch(Patch* patch) { _root_patch = patch; } - - /** Transport state for this frame. - * Intended to only be called from the audio thread. */ - inline const jack_position_t* position() { return &_position; } - inline const jack_transport_state_t transport_state() { return _transport_state; } - - bool is_realtime() { return jack_is_realtime(_client); } - - jack_client_t* jack_client() const { return _client; } - SampleCount buffer_size() const { return _buffer_size; } - SampleCount sample_rate() const { return _sample_rate; } - bool is_activated() const { return _is_activated; } - - inline SampleCount frame_time() const { return jack_frame_time(_client); } - -private: - friend class JackAudioPort; - - // These are the static versions of the callbacks, they call - // the non-static ones below - inline static void thread_init_cb(void* const jack_driver); - inline static void shutdown_cb(void* const jack_driver); - inline static int process_cb(jack_nframes_t nframes, void* const jack_driver); - inline static int buffer_size_cb(jack_nframes_t nframes, void* const jack_driver); - inline static int sample_rate_cb(jack_nframes_t nframes, void* const jack_driver); - - // Non static callbacks - void _thread_init_cb(); - void _shutdown_cb(); - int _process_cb(jack_nframes_t nframes); - int _buffer_size_cb(jack_nframes_t nframes); - int _sample_rate_cb(jack_nframes_t nframes); - - Engine& _engine; - Raul::Thread* _jack_thread; - jack_client_t* _client; - jack_nframes_t _buffer_size; - jack_nframes_t _sample_rate; - bool _is_activated; - bool _local_client; ///< Whether _client should be closed on destruction - jack_position_t _position; - jack_transport_state_t _transport_state; - - Raul::List _ports; - - Patch* _root_patch; -}; - - -inline int JackAudioDriver::process_cb(jack_nframes_t nframes, void* jack_driver) -{ - assert(jack_driver); - return ((JackAudioDriver*)jack_driver)->_process_cb(nframes); -} - -inline void JackAudioDriver::thread_init_cb(void* jack_driver) -{ - assert(jack_driver); - return ((JackAudioDriver*)jack_driver)->_thread_init_cb(); -} - -inline void JackAudioDriver::shutdown_cb(void* jack_driver) -{ - assert(jack_driver); - return ((JackAudioDriver*)jack_driver)->_shutdown_cb(); -} - - -inline int JackAudioDriver::buffer_size_cb(jack_nframes_t nframes, void* jack_driver) -{ - assert(jack_driver); - return ((JackAudioDriver*)jack_driver)->_buffer_size_cb(nframes); -} - - -inline int JackAudioDriver::sample_rate_cb(jack_nframes_t nframes, void* jack_driver) -{ - assert(jack_driver); - return ((JackAudioDriver*)jack_driver)->_sample_rate_cb(nframes); -} - - -} // namespace Ingen - -#endif // JACKAUDIODRIVER_H diff --git a/src/libs/engine/JackAudioDriver.hpp b/src/libs/engine/JackAudioDriver.hpp new file mode 100644 index 00000000..583d2c62 --- /dev/null +++ b/src/libs/engine/JackAudioDriver.hpp @@ -0,0 +1,179 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef JACKAUDIODRIVER_H +#define JACKAUDIODRIVER_H + +#include +#include +#include +#include +#include +#include "AudioDriver.hpp" +#include "Buffer.hpp" + +namespace Ingen { + +class Engine; +class Patch; +class Port; +class DuplexPort; +class JackAudioDriver; +typedef jack_default_audio_sample_t jack_sample_t; + + +/** Used internally by JackAudioDriver to represent a Jack port. + * + * A Jack port always has a one-to-one association with a Patch port. + */ +class JackAudioPort : public DriverPort, public Raul::ListNode +{ +public: + JackAudioPort(JackAudioDriver* driver, DuplexPort* patch_port); + ~JackAudioPort(); + + void set_name(const std::string& name) { jack_port_set_name(_jack_port, name.c_str()); }; + + void prepare_buffer(jack_nframes_t nframes); + + jack_port_t* jack_port() const { return _jack_port; } + DuplexPort* patch_port() const { return _patch_port; } + +private: + JackAudioDriver* _driver; + jack_port_t* _jack_port; + jack_sample_t* _jack_buffer; ///< Cached for output ports + DuplexPort* _patch_port; +}; + + + +/** The Jack AudioDriver. + * + * The process callback here drives the entire audio thread by "pulling" + * events from queues, processing them, running the patches, and passing + * events along to the PostProcessor. + * + * \ingroup engine + */ +class JackAudioDriver : public AudioDriver +{ +public: + JackAudioDriver(Engine& engine, + std::string server_name = "", + jack_client_t* jack_client = 0); + + ~JackAudioDriver(); + + void activate(); + void deactivate(); + void enable(); + void disable(); + + DriverPort* port(const Raul::Path& path); + DriverPort* create_port(DuplexPort* patch_port); + + void add_port(DriverPort* port); + DriverPort* remove_port(const Raul::Path& path); + + Patch* root_patch() { return _root_patch; } + void set_root_patch(Patch* patch) { _root_patch = patch; } + + /** Transport state for this frame. + * Intended to only be called from the audio thread. */ + inline const jack_position_t* position() { return &_position; } + inline const jack_transport_state_t transport_state() { return _transport_state; } + + bool is_realtime() { return jack_is_realtime(_client); } + + jack_client_t* jack_client() const { return _client; } + SampleCount buffer_size() const { return _buffer_size; } + SampleCount sample_rate() const { return _sample_rate; } + bool is_activated() const { return _is_activated; } + + inline SampleCount frame_time() const { return jack_frame_time(_client); } + +private: + friend class JackAudioPort; + + // These are the static versions of the callbacks, they call + // the non-static ones below + inline static void thread_init_cb(void* const jack_driver); + inline static void shutdown_cb(void* const jack_driver); + inline static int process_cb(jack_nframes_t nframes, void* const jack_driver); + inline static int buffer_size_cb(jack_nframes_t nframes, void* const jack_driver); + inline static int sample_rate_cb(jack_nframes_t nframes, void* const jack_driver); + + // Non static callbacks + void _thread_init_cb(); + void _shutdown_cb(); + int _process_cb(jack_nframes_t nframes); + int _buffer_size_cb(jack_nframes_t nframes); + int _sample_rate_cb(jack_nframes_t nframes); + + Engine& _engine; + Raul::Thread* _jack_thread; + jack_client_t* _client; + jack_nframes_t _buffer_size; + jack_nframes_t _sample_rate; + bool _is_activated; + bool _local_client; ///< Whether _client should be closed on destruction + jack_position_t _position; + jack_transport_state_t _transport_state; + + Raul::List _ports; + + Patch* _root_patch; +}; + + +inline int JackAudioDriver::process_cb(jack_nframes_t nframes, void* jack_driver) +{ + assert(jack_driver); + return ((JackAudioDriver*)jack_driver)->_process_cb(nframes); +} + +inline void JackAudioDriver::thread_init_cb(void* jack_driver) +{ + assert(jack_driver); + return ((JackAudioDriver*)jack_driver)->_thread_init_cb(); +} + +inline void JackAudioDriver::shutdown_cb(void* jack_driver) +{ + assert(jack_driver); + return ((JackAudioDriver*)jack_driver)->_shutdown_cb(); +} + + +inline int JackAudioDriver::buffer_size_cb(jack_nframes_t nframes, void* jack_driver) +{ + assert(jack_driver); + return ((JackAudioDriver*)jack_driver)->_buffer_size_cb(nframes); +} + + +inline int JackAudioDriver::sample_rate_cb(jack_nframes_t nframes, void* jack_driver) +{ + assert(jack_driver); + return ((JackAudioDriver*)jack_driver)->_sample_rate_cb(nframes); +} + + +} // namespace Ingen + +#endif // JACKAUDIODRIVER_H diff --git a/src/libs/engine/JackMidiDriver.cpp b/src/libs/engine/JackMidiDriver.cpp index f8ed3064..8c328844 100644 --- a/src/libs/engine/JackMidiDriver.cpp +++ b/src/libs/engine/JackMidiDriver.cpp @@ -18,17 +18,17 @@ #include #include #include -#include +#include #include -#include "types.h" -#include "JackMidiDriver.h" -#include "ThreadManager.h" -#include "AudioDriver.h" -#include "MidiBuffer.h" -#include "DuplexPort.h" +#include "types.hpp" +#include "JackMidiDriver.hpp" +#include "ThreadManager.hpp" +#include "AudioDriver.hpp" +#include "MidiBuffer.hpp" +#include "DuplexPort.hpp" #include "jack_compat.h" /*#ifdef HAVE_LASH -#include "LashDriver.h" +#include "LashDriver.hpp" #endif*/ using namespace std; diff --git a/src/libs/engine/JackMidiDriver.h b/src/libs/engine/JackMidiDriver.h deleted file mode 100644 index 535a1f22..00000000 --- a/src/libs/engine/JackMidiDriver.h +++ /dev/null @@ -1,112 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef JACKMIDIDRIVER_H -#define JACKMIDIDRIVER_H - -#include -#include -#include -#include "config.h" -#include "MidiDriver.h" - -namespace Ingen { - -class Node; -class SetPortValueEvent; -class JackMidiDriver; -class DuplexPort; - - -/** Representation of an JACK MIDI port. - * - * \ingroup engine - */ -class JackMidiPort : public DriverPort, public Raul::ListNode -{ -public: - JackMidiPort(JackMidiDriver* driver, DuplexPort* port); - virtual ~JackMidiPort(); - - void prepare_block(const SampleCount block_start, const SampleCount block_end); - - void set_name(const std::string& name) { jack_port_set_name(_jack_port, name.c_str()); }; - - DuplexPort* patch_port() const { return _patch_port; } - -private: - JackMidiDriver* _driver; - jack_port_t* _jack_port; - DuplexPort* _patch_port; -}; - - -/** Jack MIDI driver. - * - * This driver reads Jack MIDI events and dispatches them to the appropriate - * JackMidiPort for processing. - * - * \ingroup engine - */ -class JackMidiDriver : public MidiDriver -{ -public: - JackMidiDriver(jack_client_t* client); - ~JackMidiDriver(); - - void activate(); - void deactivate(); - void enable() { _is_enabled = true; } - void disable() { _is_enabled = false; } - - bool is_activated() const { return _is_activated; } - bool is_enabled() const { return _is_enabled; } - - void prepare_block(const SampleCount block_start, const SampleCount block_end); - - JackMidiPort* create_port(DuplexPort* patch_port) - { return new JackMidiPort(this, patch_port); } - - void add_port(DriverPort* port); - DriverPort* remove_port(const Raul::Path& path); - - jack_client_t* jack_client() { return _client; } - -private: - Raul::List _in_ports; - Raul::List _out_ports; - - friend class JackMidiPort; - - void add_output(Raul::ListNode* port); - Raul::ListNode* remove_output(JackMidiPort* port); - - // MIDI thread - static void* process_midi_in(void* me); - - jack_client_t* _client; - pthread_t _process_thread; - bool _is_activated; - bool _is_enabled; - static bool _midi_thread_exit_flag; -}; - - -} // namespace Ingen - - -#endif // JACKMIDIDRIVER_H diff --git a/src/libs/engine/JackMidiDriver.hpp b/src/libs/engine/JackMidiDriver.hpp new file mode 100644 index 00000000..631f0d28 --- /dev/null +++ b/src/libs/engine/JackMidiDriver.hpp @@ -0,0 +1,112 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef JACKMIDIDRIVER_H +#define JACKMIDIDRIVER_H + +#include +#include +#include +#include "../../../../config/config.h" +#include "MidiDriver.hpp" + +namespace Ingen { + +class Node; +class SetPortValueEvent; +class JackMidiDriver; +class DuplexPort; + + +/** Representation of an JACK MIDI port. + * + * \ingroup engine + */ +class JackMidiPort : public DriverPort, public Raul::ListNode +{ +public: + JackMidiPort(JackMidiDriver* driver, DuplexPort* port); + virtual ~JackMidiPort(); + + void prepare_block(const SampleCount block_start, const SampleCount block_end); + + void set_name(const std::string& name) { jack_port_set_name(_jack_port, name.c_str()); }; + + DuplexPort* patch_port() const { return _patch_port; } + +private: + JackMidiDriver* _driver; + jack_port_t* _jack_port; + DuplexPort* _patch_port; +}; + + +/** Jack MIDI driver. + * + * This driver reads Jack MIDI events and dispatches them to the appropriate + * JackMidiPort for processing. + * + * \ingroup engine + */ +class JackMidiDriver : public MidiDriver +{ +public: + JackMidiDriver(jack_client_t* client); + ~JackMidiDriver(); + + void activate(); + void deactivate(); + void enable() { _is_enabled = true; } + void disable() { _is_enabled = false; } + + bool is_activated() const { return _is_activated; } + bool is_enabled() const { return _is_enabled; } + + void prepare_block(const SampleCount block_start, const SampleCount block_end); + + JackMidiPort* create_port(DuplexPort* patch_port) + { return new JackMidiPort(this, patch_port); } + + void add_port(DriverPort* port); + DriverPort* remove_port(const Raul::Path& path); + + jack_client_t* jack_client() { return _client; } + +private: + Raul::List _in_ports; + Raul::List _out_ports; + + friend class JackMidiPort; + + void add_output(Raul::ListNode* port); + Raul::ListNode* remove_output(JackMidiPort* port); + + // MIDI thread + static void* process_midi_in(void* me); + + jack_client_t* _client; + pthread_t _process_thread; + bool _is_activated; + bool _is_enabled; + static bool _midi_thread_exit_flag; +}; + + +} // namespace Ingen + + +#endif // JACKMIDIDRIVER_H diff --git a/src/libs/engine/LADSPANode.cpp b/src/libs/engine/LADSPANode.cpp index 957c49dd..9f030aee 100644 --- a/src/libs/engine/LADSPANode.cpp +++ b/src/libs/engine/LADSPANode.cpp @@ -15,15 +15,15 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "LADSPANode.h" +#include "LADSPANode.hpp" #include #include #include #include -#include "AudioBuffer.h" -#include "InputPort.h" -#include "OutputPort.h" -#include "Plugin.h" +#include "AudioBuffer.hpp" +#include "InputPort.hpp" +#include "OutputPort.hpp" +#include "Plugin.hpp" namespace Ingen { diff --git a/src/libs/engine/LADSPANode.h b/src/libs/engine/LADSPANode.h deleted file mode 100644 index ff813f4c..00000000 --- a/src/libs/engine/LADSPANode.h +++ /dev/null @@ -1,63 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef LADSPANODE_H -#define LADSPANODE_H - -#include -#include -#include "types.h" -#include "NodeBase.h" -#include "Plugin.h" - -namespace Ingen { - - -/** An instance of a LADSPA plugin. - * - * \ingroup engine - */ -class LADSPANode : public NodeBase -{ -public: - LADSPANode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size); - virtual ~LADSPANode(); - - virtual bool instantiate(); - - void activate(); - void deactivate(); - - void process(SampleCount nframes, FrameTime start, FrameTime end); - - void set_port_buffer(size_t voice, size_t port_num, Buffer* buf); - - const Plugin* plugin() const { return _plugin; } - void plugin(const Plugin* const pi) { _plugin = pi; } - -protected: - //void get_port_vals(ulong port_index, PortInfo* info); - void get_port_limits(unsigned long port_index, Sample& default_value, Sample& lower_bound, Sample& upper_bound); - - const LADSPA_Descriptor* _descriptor; - LADSPA_Handle* _instances; -}; - - -} // namespace Ingen - -#endif // LADSPANODE_H diff --git a/src/libs/engine/LADSPANode.hpp b/src/libs/engine/LADSPANode.hpp new file mode 100644 index 00000000..c71e68fb --- /dev/null +++ b/src/libs/engine/LADSPANode.hpp @@ -0,0 +1,63 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LADSPANODE_H +#define LADSPANODE_H + +#include +#include +#include "types.hpp" +#include "NodeBase.hpp" +#include "Plugin.hpp" + +namespace Ingen { + + +/** An instance of a LADSPA plugin. + * + * \ingroup engine + */ +class LADSPANode : public NodeBase +{ +public: + LADSPANode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size); + virtual ~LADSPANode(); + + virtual bool instantiate(); + + void activate(); + void deactivate(); + + void process(SampleCount nframes, FrameTime start, FrameTime end); + + void set_port_buffer(size_t voice, size_t port_num, Buffer* buf); + + const Plugin* plugin() const { return _plugin; } + void plugin(const Plugin* const pi) { _plugin = pi; } + +protected: + //void get_port_vals(ulong port_index, PortInfo* info); + void get_port_limits(unsigned long port_index, Sample& default_value, Sample& lower_bound, Sample& upper_bound); + + const LADSPA_Descriptor* _descriptor; + LADSPA_Handle* _instances; +}; + + +} // namespace Ingen + +#endif // LADSPANODE_H diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp index 888366136..8c3ea933 100644 --- a/src/libs/engine/LV2Node.cpp +++ b/src/libs/engine/LV2Node.cpp @@ -15,18 +15,18 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "LV2Node.h" +#include "LV2Node.hpp" #include #include -#include "float.h" +#include #include #include -#include "InputPort.h" -#include "OutputPort.h" -#include "Plugin.h" -#include "AudioBuffer.h" -#include "MidiBuffer.h" -#include "OSCBuffer.h" +#include "InputPort.hpp" +#include "OutputPort.hpp" +#include "Plugin.hpp" +#include "AudioBuffer.hpp" +#include "MidiBuffer.hpp" +#include "OSCBuffer.hpp" namespace Ingen { diff --git a/src/libs/engine/LV2Node.h b/src/libs/engine/LV2Node.h deleted file mode 100644 index 39b06939..00000000 --- a/src/libs/engine/LV2Node.h +++ /dev/null @@ -1,66 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef LV2NODE_H -#define LV2NODE_H - -#include -#include -#include "types.h" -#include "NodeBase.h" -#include "Plugin.h" - -namespace Ingen { - - -/** An instance of a LV2 plugin. - * - * \ingroup engine - */ -class LV2Node : public NodeBase -{ -public: - LV2Node(const Plugin* plugin, - const string& name, - size_t poly, - Patch* parent, - SampleRate srate, - size_t buffer_size); - - virtual ~LV2Node(); - - virtual bool instantiate(); - - void activate(); - void deactivate(); - - void process(SampleCount nframes, FrameTime start, FrameTime end); - - void set_port_buffer(size_t voice, size_t port_num, Buffer* buf); - -protected: - //void get_port_vals(ulong port_index, PortInfo* info); - - SLV2Plugin _lv2_plugin; - SLV2Instance* _instances; -}; - - -} // namespace Ingen - -#endif // LV2NODE_H - diff --git a/src/libs/engine/LV2Node.hpp b/src/libs/engine/LV2Node.hpp new file mode 100644 index 00000000..361df02e --- /dev/null +++ b/src/libs/engine/LV2Node.hpp @@ -0,0 +1,66 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LV2NODE_H +#define LV2NODE_H + +#include +#include +#include "types.hpp" +#include "NodeBase.hpp" +#include "Plugin.hpp" + +namespace Ingen { + + +/** An instance of a LV2 plugin. + * + * \ingroup engine + */ +class LV2Node : public NodeBase +{ +public: + LV2Node(const Plugin* plugin, + const string& name, + size_t poly, + Patch* parent, + SampleRate srate, + size_t buffer_size); + + virtual ~LV2Node(); + + virtual bool instantiate(); + + void activate(); + void deactivate(); + + void process(SampleCount nframes, FrameTime start, FrameTime end); + + void set_port_buffer(size_t voice, size_t port_num, Buffer* buf); + +protected: + //void get_port_vals(ulong port_index, PortInfo* info); + + SLV2Plugin _lv2_plugin; + SLV2Instance* _instances; +}; + + +} // namespace Ingen + +#endif // LV2NODE_H + diff --git a/src/libs/engine/LashDriver.cpp b/src/libs/engine/LashDriver.cpp index 452af1f0..f4f37abb 100644 --- a/src/libs/engine/LashDriver.cpp +++ b/src/libs/engine/LashDriver.cpp @@ -18,9 +18,9 @@ #include #include #include -#include "config/config.h" -#include "LashDriver.h" -#include "App.h" +#include "../../../../config/config.h" +#include "LashDriver.hpp" +#include "App.hpp" using namespace std; diff --git a/src/libs/engine/LashDriver.h b/src/libs/engine/LashDriver.h deleted file mode 100644 index 4b93749c..00000000 --- a/src/libs/engine/LashDriver.h +++ /dev/null @@ -1,58 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef LASHDRIVER_H -#define LASHDRIVER_H - -#include -#include -#include -using std::string; - -namespace Ingen { - -class Ingen; - - -/** Handles all support for LASH session management. - */ -class LashDriver -{ -public: - LashDriver(Ingen* app, lash_args_t* args); - - bool enabled() { return (_client != NULL && lash_enabled(_client)); } - void process_events(); - void set_jack_client_name(const char* name); - void set_alsa_client_id(int id); - void restore_finished(); - -private: - Ingen* _app; - lash_client_t* _client; - - int _alsa_client_id; - string _jack_client_name; - - void handle_event(lash_event_t* conf); - void handle_config(lash_config_t* conf); -}; - - -} // namespace Ingen - -#endif // LASHDRIVER_H diff --git a/src/libs/engine/LashDriver.hpp b/src/libs/engine/LashDriver.hpp new file mode 100644 index 00000000..4b93749c --- /dev/null +++ b/src/libs/engine/LashDriver.hpp @@ -0,0 +1,58 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LASHDRIVER_H +#define LASHDRIVER_H + +#include +#include +#include +using std::string; + +namespace Ingen { + +class Ingen; + + +/** Handles all support for LASH session management. + */ +class LashDriver +{ +public: + LashDriver(Ingen* app, lash_args_t* args); + + bool enabled() { return (_client != NULL && lash_enabled(_client)); } + void process_events(); + void set_jack_client_name(const char* name); + void set_alsa_client_id(int id); + void restore_finished(); + +private: + Ingen* _app; + lash_client_t* _client; + + int _alsa_client_id; + string _jack_client_name; + + void handle_event(lash_event_t* conf); + void handle_config(lash_config_t* conf); +}; + + +} // namespace Ingen + +#endif // LASHDRIVER_H diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index 0d4921de..aafb18b6 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -19,194 +19,180 @@ libingen_engine_la_LIBADD = @RAUL_LIBS@ @JACK_LIBS@ @LIBLO_LIBS@ @ALSA_LIBS@ @LA AM_CFLAGS=-std=c99 libingen_engine_la_SOURCES = \ - engine.h \ - engine.cpp \ - util.h \ - tuning.h \ - events.h \ - ThreadManager.h \ - DataType.h \ - Node.h \ - NodeBase.h \ - NodeBase.cpp \ - InternalNode.h \ - Patch.h \ - Patch.cpp \ - NodeFactory.h \ - NodeFactory.cpp \ - Engine.h \ + ../../../../lv2/extensions/osc/lv2_osc.c \ + ../../../../lv2/extensions/osc/lv2_osc_print.c \ + AudioBuffer.cpp \ + AudioBuffer.hpp \ + AudioDriver.hpp \ + Buffer.hpp \ + BufferFactory.cpp \ + BufferFactory.hpp \ + ClientBroadcaster.cpp \ + ClientBroadcaster.hpp \ + Connection.cpp \ + Connection.hpp \ + DataType.hpp \ + DirectResponder.hpp \ + Driver.hpp \ + DuplexPort.cpp \ + DuplexPort.hpp \ Engine.cpp \ - JackAudioDriver.h \ + Engine.hpp \ + Event.hpp \ + EventSource.hpp \ + GraphObject.cpp \ + GraphObject.hpp \ + InputPort.cpp \ + InputPort.hpp \ + InternalNode.hpp \ JackAudioDriver.cpp \ - JackMidiDriver.h \ + JackAudioDriver.hpp \ JackMidiDriver.cpp \ - jack_compat.h \ - OSCEngineReceiver.h \ + JackMidiDriver.hpp \ + MidiBuffer.cpp \ + MidiBuffer.hpp \ + MidiControlNode.cpp \ + MidiControlNode.hpp \ + MidiDriver.hpp \ + MidiNoteNode.cpp \ + MidiNoteNode.hpp \ + MidiTriggerNode.cpp \ + MidiTriggerNode.hpp \ + Node.hpp \ + NodeBase.cpp \ + NodeBase.hpp \ + NodeFactory.cpp \ + NodeFactory.hpp \ + OSCBuffer.cpp \ + OSCBuffer.hpp \ + OSCClientSender.cpp \ + OSCClientSender.hpp \ + OSCDriver.hpp \ OSCEngineReceiver.cpp \ - DirectResponder.h \ - OSCResponder.h \ + OSCEngineReceiver.hpp \ OSCResponder.cpp \ - ClientBroadcaster.h \ - ClientBroadcaster.cpp \ - ObjectSender.h \ + OSCResponder.hpp \ ObjectSender.cpp \ - OSCClientSender.h \ - OSCClientSender.cpp \ - Buffer.h \ - AudioBuffer.h \ - AudioBuffer.cpp \ - MidiBuffer.h \ - MidiBuffer.cpp \ - OSCBuffer.h \ - OSCBuffer.cpp \ - ../../../../lv2/extensions/osc/lv2_osc.c \ - ../../../../lv2/extensions/osc/lv2_osc_print.c \ - BufferFactory.h \ - BufferFactory.cpp \ - Port.h \ - Port.cpp \ - InputPort.h \ - InputPort.cpp \ - OutputPort.h \ + ObjectSender.hpp \ + ObjectStore.cpp \ + ObjectStore.hpp \ OutputPort.cpp \ - DuplexPort.h \ - DuplexPort.cpp \ - MidiNoteNode.h \ - MidiNoteNode.cpp \ - MidiTriggerNode.h \ - MidiTriggerNode.cpp \ - MidiControlNode.h \ - MidiControlNode.cpp \ - Event.h \ - QueuedEvent.h \ - EventSource.h \ - QueuedEventSource.h \ - QueuedEventSource.cpp \ - QueuedEngineInterface.h \ - QueuedEngineInterface.cpp \ - GraphObject.h \ - GraphObject.cpp \ - Tree.h \ - TreeImplementation.h \ - Plugin.h \ + OutputPort.hpp \ + Patch.cpp \ + Patch.hpp \ Plugin.cpp \ - PostProcessor.h \ + Plugin.hpp \ + Port.cpp \ + Port.hpp \ PostProcessor.cpp \ - Connection.h \ - Connection.cpp \ - ObjectStore.h \ - ObjectStore.cpp \ - TransportNode.h \ + PostProcessor.hpp \ + QueuedEngineInterface.cpp \ + QueuedEngineInterface.hpp \ + QueuedEvent.hpp \ + QueuedEventSource.cpp \ + QueuedEventSource.hpp \ + ThreadManager.hpp \ TransportNode.cpp \ - Driver.h \ - AudioDriver.h \ - MidiDriver.h \ - OSCDriver.h \ - instantiations.cpp \ - events/RegisterClientEvent.h \ - events/RegisterClientEvent.cpp \ - events/UnregisterClientEvent.h \ - events/UnregisterClientEvent.cpp \ - events/PingQueuedEvent.h \ - events/DeactivateEvent.h \ - events/DeactivateEvent.cpp \ - events/SetPortValueEvent.h \ - events/SetPortValueEvent.cpp \ - events/SetPortValueQueuedEvent.h \ - events/SetPortValueQueuedEvent.cpp \ - events/NoteOnEvent.h \ - events/NoteOnEvent.cpp \ - events/NoteOffEvent.h \ - events/NoteOffEvent.cpp \ - events/AllNotesOffEvent.h \ + TransportNode.hpp \ + Tree.hpp \ + TreeImplementation.hpp \ + engine.cpp \ + engine.hpp \ + events.hpp \ + events/AddNodeEvent.cpp \ + events/AddNodeEvent.hpp \ + events/AddPortEvent.cpp \ + events/AddPortEvent.hpp \ events/AllNotesOffEvent.cpp \ - events/ConnectionEvent.h \ + events/AllNotesOffEvent.hpp \ + events/ClearPatchEvent.cpp \ + events/ClearPatchEvent.hpp \ events/ConnectionEvent.cpp \ - events/DisconnectionEvent.h \ - events/DisconnectionEvent.cpp \ - events/DisconnectNodeEvent.h \ + events/ConnectionEvent.hpp \ + events/CreatePatchEvent.cpp \ + events/CreatePatchEvent.hpp \ + events/DeactivateEvent.cpp \ + events/DeactivateEvent.hpp \ + events/DestroyEvent.cpp \ + events/DestroyEvent.hpp \ + events/DisablePatchEvent.cpp \ + events/DisablePatchEvent.hpp \ events/DisconnectNodeEvent.cpp \ - events/DisconnectPortEvent.h \ + events/DisconnectNodeEvent.hpp \ events/DisconnectPortEvent.cpp \ - events/DestroyEvent.h \ - events/DestroyEvent.cpp \ - events/AddPortEvent.h \ - events/AddPortEvent.cpp \ - events/AddNodeEvent.h \ - events/AddNodeEvent.cpp \ - events/SetMetadataEvent.h \ - events/SetMetadataEvent.cpp \ - events/RequestMetadataEvent.h \ + events/DisconnectPortEvent.hpp \ + events/DisconnectionEvent.cpp \ + events/DisconnectionEvent.hpp \ + events/EnablePatchEvent.cpp \ + events/EnablePatchEvent.hpp \ + events/LoadPluginsEvent.cpp \ + events/LoadPluginsEvent.hpp \ + events/MidiLearnEvent.cpp \ + events/MidiLearnEvent.hpp \ + events/NoteOffEvent.cpp \ + events/NoteOffEvent.hpp \ + events/NoteOnEvent.cpp \ + events/NoteOnEvent.hpp \ + events/PingQueuedEvent.hpp \ + events/RegisterClientEvent.cpp \ + events/RegisterClientEvent.hpp \ + events/RenameEvent.cpp \ + events/RenameEvent.hpp \ + events/RequestAllObjectsEvent.cpp \ + events/RequestAllObjectsEvent.hpp \ events/RequestMetadataEvent.cpp \ - events/RequestPluginEvent.h \ - events/RequestPluginEvent.cpp \ - events/RequestObjectEvent.h \ + events/RequestMetadataEvent.hpp \ events/RequestObjectEvent.cpp \ - events/RequestPortValueEvent.h \ - events/RequestPortValueEvent.cpp \ - events/RequestAllObjectsEvent.h \ - events/RequestAllObjectsEvent.cpp \ - events/RequestPluginsEvent.h \ + events/RequestObjectEvent.hpp \ + events/RequestPluginEvent.cpp \ + events/RequestPluginEvent.hpp \ events/RequestPluginsEvent.cpp \ - events/CreatePatchEvent.h \ - events/CreatePatchEvent.cpp \ - events/LoadPluginsEvent.h \ - events/LoadPluginsEvent.cpp \ - events/EnablePatchEvent.h \ - events/EnablePatchEvent.cpp \ - events/DisablePatchEvent.h \ - events/DisablePatchEvent.cpp \ - events/ClearPatchEvent.h \ - events/ClearPatchEvent.cpp \ - events/RenameEvent.h \ - events/RenameEvent.cpp \ - events/MidiLearnEvent.h \ - events/MidiLearnEvent.cpp \ - types.h -# BridgeNode.h -# BridgeNode.cpp -# ControlInputNode.h -# ControlInputNode.cpp -# ControlOutputNode.h -# ControlOutputNode.cpp -# AudioInputNode.h -# AudioInputNode.cpp -# AudioOutputNode.h -# AudioOutputNode.cpp -# MidiInputNode.h -# MidiInputNode.cpp -# MidiOutputNode.h -# MidiOutputNode.cpp + events/RequestPluginsEvent.hpp \ + events/RequestPortValueEvent.cpp \ + events/RequestPortValueEvent.hpp \ + events/SetMetadataEvent.cpp \ + events/SetMetadataEvent.hpp \ + events/SetPortValueEvent.cpp \ + events/SetPortValueEvent.hpp \ + events/SetPortValueQueuedEvent.cpp \ + events/SetPortValueQueuedEvent.hpp \ + events/UnregisterClientEvent.cpp \ + events/UnregisterClientEvent.hpp \ + instantiations.cpp \ + jack_compat.hpp \ + tuning.hpp \ + types.hpp \ + util.hpp if WITH_LADSPA libingen_engine_la_SOURCES += \ - LADSPANode.h \ + LADSPANode.hpp \ LADSPANode.cpp endif if WITH_DSSI libingen_engine_la_SOURCES += \ - DSSINode.h \ + DSSINode.hpp \ DSSINode.cpp \ events/DSSIConfigureEvent.cpp \ - events/DSSIConfigureEvent.h \ + events/DSSIConfigureEvent.hpp \ events/DSSIControlEvent.cpp \ - events/DSSIControlEvent.h \ + events/DSSIControlEvent.hpp \ events/DSSIProgramEvent.cpp \ - events/DSSIProgramEvent.h \ + events/DSSIProgramEvent.hpp \ events/DSSIUpdateEvent.cpp \ - events/DSSIUpdateEvent.h + events/DSSIUpdateEvent.hpp endif if WITH_LV2 libingen_engine_la_SOURCES += \ - LV2Node.h \ + LV2Node.hpp \ LV2Node.cpp endif #if WITH_LASH #libingen_engine_la_SOURCES += \ -# LashDriver.h \ +# LashDriver.hpp \ # LashDriver.cpp #endif diff --git a/src/libs/engine/MidiBuffer.cpp b/src/libs/engine/MidiBuffer.cpp index 41feb3df..f2741dfb 100644 --- a/src/libs/engine/MidiBuffer.cpp +++ b/src/libs/engine/MidiBuffer.cpp @@ -16,7 +16,7 @@ */ #include -#include "MidiBuffer.h" +#include "MidiBuffer.hpp" using namespace std; diff --git a/src/libs/engine/MidiBuffer.h b/src/libs/engine/MidiBuffer.h deleted file mode 100644 index 54a245df..00000000 --- a/src/libs/engine/MidiBuffer.h +++ /dev/null @@ -1,77 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MIDIBUFFER_H -#define MIDIBUFFER_H - -#include -#include "Buffer.h" -#include "DataType.h" - -namespace Ingen { - - -class MidiBuffer : public Buffer { -public: - MidiBuffer(size_t capacity); - - ~MidiBuffer() { lv2midi_free(_local_state.midi); } - - void prepare_read(SampleCount nframes); - void prepare_write(SampleCount nframes); - - bool is_joined_to(Buffer* buf) const; - bool join(Buffer* buf); - void unjoin(); - - uint32_t this_nframes() const { return _this_nframes; } - - inline LV2_MIDI* data() - { return ((_joined_buf != NULL) ? _joined_buf->data() : _state->midi); } - - inline const LV2_MIDI* data() const - { return ((_joined_buf != NULL) ? _joined_buf->data() : _state->midi); } - - inline void clear() - { assert(_state); assert(_state->midi); lv2midi_reset_buffer(_state->midi); _state->position = 0; } - - inline void reset(SampleCount nframes) - { assert(_state); assert(_state->midi); lv2midi_reset_state(_state, _state->midi, nframes); _this_nframes = nframes; } - - inline double increment() - { assert(_state); assert(_state->midi); return lv2midi_step(_state); } - - inline double get_event(double* timestamp, uint32_t* size, unsigned char** data) - { assert(_state); assert(_state->midi); return lv2midi_get_event(_state, timestamp, size, data); } - - inline int put_event(double timestamp, uint32_t size, const unsigned char* data) - { assert(_state); assert(_state->midi); return lv2midi_put_event(_state, timestamp, size, data); } - -private: - LV2_MIDIState _local_state; - LV2_MIDIState* _state; - LV2_MIDI* const _buf; - - MidiBuffer* _joined_buf; ///< Buffer to mirror, if joined - - uint32_t _this_nframes; -}; - - -} // namespace Ingen - -#endif // MIDIBUFFER_H diff --git a/src/libs/engine/MidiBuffer.hpp b/src/libs/engine/MidiBuffer.hpp new file mode 100644 index 00000000..bf1eacac --- /dev/null +++ b/src/libs/engine/MidiBuffer.hpp @@ -0,0 +1,77 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MIDIBUFFER_H +#define MIDIBUFFER_H + +#include +#include "Buffer.hpp" +#include "DataType.hpp" + +namespace Ingen { + + +class MidiBuffer : public Buffer { +public: + MidiBuffer(size_t capacity); + + ~MidiBuffer() { lv2midi_free(_local_state.midi); } + + void prepare_read(SampleCount nframes); + void prepare_write(SampleCount nframes); + + bool is_joined_to(Buffer* buf) const; + bool join(Buffer* buf); + void unjoin(); + + uint32_t this_nframes() const { return _this_nframes; } + + inline LV2_MIDI* data() + { return ((_joined_buf != NULL) ? _joined_buf->data() : _state->midi); } + + inline const LV2_MIDI* data() const + { return ((_joined_buf != NULL) ? _joined_buf->data() : _state->midi); } + + inline void clear() + { assert(_state); assert(_state->midi); lv2midi_reset_buffer(_state->midi); _state->position = 0; } + + inline void reset(SampleCount nframes) + { assert(_state); assert(_state->midi); lv2midi_reset_state(_state, _state->midi, nframes); _this_nframes = nframes; } + + inline double increment() + { assert(_state); assert(_state->midi); return lv2midi_step(_state); } + + inline double get_event(double* timestamp, uint32_t* size, unsigned char** data) + { assert(_state); assert(_state->midi); return lv2midi_get_event(_state, timestamp, size, data); } + + inline int put_event(double timestamp, uint32_t size, const unsigned char* data) + { assert(_state); assert(_state->midi); return lv2midi_put_event(_state, timestamp, size, data); } + +private: + LV2_MIDIState _local_state; + LV2_MIDIState* _state; + LV2_MIDI* const _buf; + + MidiBuffer* _joined_buf; ///< Buffer to mirror, if joined + + uint32_t _this_nframes; +}; + + +} // namespace Ingen + +#endif // MIDIBUFFER_H diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp index dcd32768..01b17743 100644 --- a/src/libs/engine/MidiControlNode.cpp +++ b/src/libs/engine/MidiControlNode.cpp @@ -15,16 +15,16 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "MidiControlNode.h" +#include "MidiControlNode.hpp" #include #include -#include "PostProcessor.h" -#include "MidiLearnEvent.h" -#include "InputPort.h" -#include "OutputPort.h" -#include "Plugin.h" -#include "util.h" -#include "AudioBuffer.h" +#include "PostProcessor.hpp" +#include "MidiLearnEvent.hpp" +#include "InputPort.hpp" +#include "OutputPort.hpp" +#include "Plugin.hpp" +#include "util.hpp" +#include "AudioBuffer.hpp" namespace Ingen { diff --git a/src/libs/engine/MidiControlNode.h b/src/libs/engine/MidiControlNode.h deleted file mode 100644 index 41d02dfb..00000000 --- a/src/libs/engine/MidiControlNode.h +++ /dev/null @@ -1,68 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MIDICONTROLNODE_H -#define MIDICONTROLNODE_H - -#include -#include "NodeBase.h" -#include "InternalNode.h" -#include "MidiBuffer.h" - -namespace Ingen { - -class MidiLearnResponseEvent; -class InputPort; -class OutputPort; - - -/** MIDI control input node. - * - * Creating one of these nodes is how a user makes "MIDI Bindings". Note that - * this node will always be monophonic, the poly parameter is ignored. - * - * \ingroup engine - */ -class MidiControlNode : public InternalNode -{ -public: - MidiControlNode(const std::string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); - - void process(SampleCount nframes, FrameTime start, FrameTime end); - - void control(uchar control_num, uchar val, SampleCount offset); - - void learn(MidiLearnResponseEvent* ev) { _learning = true; _learn_event = ev; } - -private: - bool _learning; - - InputPort* _midi_in_port; - InputPort* _param_port; - InputPort* _log_port; - InputPort* _min_port; - InputPort* _max_port; - OutputPort* _control_port; - OutputPort* _audio_port; - - MidiLearnResponseEvent* _learn_event; -}; - - -} // namespace Ingen - -#endif // MIDICONTROLNODE_H diff --git a/src/libs/engine/MidiControlNode.hpp b/src/libs/engine/MidiControlNode.hpp new file mode 100644 index 00000000..2065b3c3 --- /dev/null +++ b/src/libs/engine/MidiControlNode.hpp @@ -0,0 +1,68 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MIDICONTROLNODE_H +#define MIDICONTROLNODE_H + +#include +#include "NodeBase.hpp" +#include "InternalNode.hpp" +#include "MidiBuffer.hpp" + +namespace Ingen { + +class MidiLearnResponseEvent; +class InputPort; +class OutputPort; + + +/** MIDI control input node. + * + * Creating one of these nodes is how a user makes "MIDI Bindings". Note that + * this node will always be monophonic, the poly parameter is ignored. + * + * \ingroup engine + */ +class MidiControlNode : public InternalNode +{ +public: + MidiControlNode(const std::string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + + void process(SampleCount nframes, FrameTime start, FrameTime end); + + void control(uchar control_num, uchar val, SampleCount offset); + + void learn(MidiLearnResponseEvent* ev) { _learning = true; _learn_event = ev; } + +private: + bool _learning; + + InputPort* _midi_in_port; + InputPort* _param_port; + InputPort* _log_port; + InputPort* _min_port; + InputPort* _max_port; + OutputPort* _control_port; + OutputPort* _audio_port; + + MidiLearnResponseEvent* _learn_event; +}; + + +} // namespace Ingen + +#endif // MIDICONTROLNODE_H diff --git a/src/libs/engine/MidiDriver.h b/src/libs/engine/MidiDriver.h deleted file mode 100644 index ebee458c..00000000 --- a/src/libs/engine/MidiDriver.h +++ /dev/null @@ -1,83 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MIDIDRIVER_H -#define MIDIDRIVER_H - -#include "types.h" -#include "Driver.h" -#include -#include "MidiBuffer.h" - -namespace Ingen { - - -/** Midi driver abstract base class. - * - * \ingroup engine - */ -class MidiDriver : public Driver -{ -public: - MidiDriver() : Driver(DataType::MIDI) {} - - /** Prepare events (however neccessary) for the specified block (realtime safe) */ - virtual void prepare_block(const SampleCount block_start, const SampleCount block_end) = 0; -}; - - - -/** Dummy MIDIDriver. - * - * Not abstract, all functions are dummies. One of these will be allocated and - * "used" if no working MIDI driver is loaded. (Doing it this way as opposed to - * just making MidiDriver have dummy functions makes sure any existing MidiDriver - * derived class actually implements the required functions). - * - * \ingroup engine - */ -class DummyMidiDriver : public MidiDriver -{ -public: - DummyMidiDriver() { - std::cout << "[DummyMidiDriver] Started Dummy MIDI driver." << std::endl; - } - - ~DummyMidiDriver() {} - - void activate() {} - void deactivate() {} - - bool is_activated() const { return false; } - bool is_enabled() const { return false; } - - void enable() {} - void disable() {} - - DriverPort* create_port(DuplexPort* patch_port) { return NULL; } - - void add_port(DriverPort* port) {} - DriverPort* remove_port(const Raul::Path& path) { return NULL; } - - void prepare_block(const SampleCount block_start, const SampleCount block_end) {} -}; - - - -} // namespace Ingen - -#endif // MIDIDRIVER_H diff --git a/src/libs/engine/MidiDriver.hpp b/src/libs/engine/MidiDriver.hpp new file mode 100644 index 00000000..acf88a3e --- /dev/null +++ b/src/libs/engine/MidiDriver.hpp @@ -0,0 +1,83 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MIDIDRIVER_H +#define MIDIDRIVER_H + +#include "types.hpp" +#include "Driver.hpp" +#include +#include "MidiBuffer.hpp" + +namespace Ingen { + + +/** Midi driver abstract base class. + * + * \ingroup engine + */ +class MidiDriver : public Driver +{ +public: + MidiDriver() : Driver(DataType::MIDI) {} + + /** Prepare events (however neccessary) for the specified block (realtime safe) */ + virtual void prepare_block(const SampleCount block_start, const SampleCount block_end) = 0; +}; + + + +/** Dummy MIDIDriver. + * + * Not abstract, all functions are dummies. One of these will be allocated and + * "used" if no working MIDI driver is loaded. (Doing it this way as opposed to + * just making MidiDriver have dummy functions makes sure any existing MidiDriver + * derived class actually implements the required functions). + * + * \ingroup engine + */ +class DummyMidiDriver : public MidiDriver +{ +public: + DummyMidiDriver() { + std::cout << "[DummyMidiDriver] Started Dummy MIDI driver." << std::endl; + } + + ~DummyMidiDriver() {} + + void activate() {} + void deactivate() {} + + bool is_activated() const { return false; } + bool is_enabled() const { return false; } + + void enable() {} + void disable() {} + + DriverPort* create_port(DuplexPort* patch_port) { return NULL; } + + void add_port(DriverPort* port) {} + DriverPort* remove_port(const Raul::Path& path) { return NULL; } + + void prepare_block(const SampleCount block_start, const SampleCount block_end) {} +}; + + + +} // namespace Ingen + +#endif // MIDIDRIVER_H diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp index 2eec62a4..37f34202 100644 --- a/src/libs/engine/MidiNoteNode.cpp +++ b/src/libs/engine/MidiNoteNode.cpp @@ -15,18 +15,18 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "MidiNoteNode.h" +#include "MidiNoteNode.hpp" #include #include -#include +#include #include -#include "MidiBuffer.h" -#include "AudioBuffer.h" -#include "InputPort.h" -#include "OutputPort.h" -#include "Plugin.h" -#include "AudioDriver.h" -#include "util.h" +#include "MidiBuffer.hpp" +#include "AudioBuffer.hpp" +#include "InputPort.hpp" +#include "OutputPort.hpp" +#include "Plugin.hpp" +#include "AudioDriver.hpp" +#include "util.hpp" using std::cerr; using std::cout; using std::endl; diff --git a/src/libs/engine/MidiNoteNode.h b/src/libs/engine/MidiNoteNode.h deleted file mode 100644 index 5be62995..00000000 --- a/src/libs/engine/MidiNoteNode.h +++ /dev/null @@ -1,87 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MIDINOTENODE_H -#define MIDINOTENODE_H - -#include -#include "InternalNode.h" -#include "types.h" -#include "MidiBuffer.h" - -using std::string; - -namespace Ingen { - -class InputPort; -class OutputPort; - - -/** MIDI note input node. - * - * For pitched instruments like keyboard, etc. - * - * \ingroup engine - */ -class MidiNoteNode : public InternalNode -{ -public: - MidiNoteNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); - ~MidiNoteNode(); - - void process(SampleCount nframes, FrameTime start, FrameTime end); - - void note_on(uchar note_num, uchar velocity, FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); - void note_off(uchar note_num, FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); - void all_notes_off(FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); - - void sustain_on(FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); - void sustain_off(FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); - -private: - /** Key, one for each key on the keyboard */ - struct Key { - enum State { OFF, ON_ASSIGNED, ON_UNASSIGNED }; - Key() : state(OFF), voice(0), time(0) {} - State state; size_t voice; SampleCount time; - }; - - /** Voice, one of these always exists for each voice */ - struct Voice { - enum State { FREE, ACTIVE, HOLDING }; - Voice() : state(FREE), note(0) {} - State state; uchar note; SampleCount time; - }; - - float note_to_freq(int num); - void free_voice(size_t voice, FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); - - Voice* _voices; - Key _keys[128]; - bool _sustain; ///< Whether or not hold pedal is depressed - - InputPort* _midi_in_port; - OutputPort* _freq_port; - OutputPort* _vel_port; - OutputPort* _gate_port; - OutputPort* _trig_port; -}; - - -} // namespace Ingen - -#endif // MIDINOTENODE_H diff --git a/src/libs/engine/MidiNoteNode.hpp b/src/libs/engine/MidiNoteNode.hpp new file mode 100644 index 00000000..88421ecb --- /dev/null +++ b/src/libs/engine/MidiNoteNode.hpp @@ -0,0 +1,87 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MIDINOTENODE_H +#define MIDINOTENODE_H + +#include +#include "InternalNode.hpp" +#include "types.hpp" +#include "MidiBuffer.hpp" + +using std::string; + +namespace Ingen { + +class InputPort; +class OutputPort; + + +/** MIDI note input node. + * + * For pitched instruments like keyboard, etc. + * + * \ingroup engine + */ +class MidiNoteNode : public InternalNode +{ +public: + MidiNoteNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + ~MidiNoteNode(); + + void process(SampleCount nframes, FrameTime start, FrameTime end); + + void note_on(uchar note_num, uchar velocity, FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); + void note_off(uchar note_num, FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); + void all_notes_off(FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); + + void sustain_on(FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); + void sustain_off(FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); + +private: + /** Key, one for each key on the keyboard */ + struct Key { + enum State { OFF, ON_ASSIGNED, ON_UNASSIGNED }; + Key() : state(OFF), voice(0), time(0) {} + State state; size_t voice; SampleCount time; + }; + + /** Voice, one of these always exists for each voice */ + struct Voice { + enum State { FREE, ACTIVE, HOLDING }; + Voice() : state(FREE), note(0) {} + State state; uchar note; SampleCount time; + }; + + float note_to_freq(int num); + void free_voice(size_t voice, FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); + + Voice* _voices; + Key _keys[128]; + bool _sustain; ///< Whether or not hold pedal is depressed + + InputPort* _midi_in_port; + OutputPort* _freq_port; + OutputPort* _vel_port; + OutputPort* _gate_port; + OutputPort* _trig_port; +}; + + +} // namespace Ingen + +#endif // MIDINOTENODE_H diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp index 610f3ef9..e397033f 100644 --- a/src/libs/engine/MidiTriggerNode.cpp +++ b/src/libs/engine/MidiTriggerNode.cpp @@ -17,12 +17,12 @@ #include #include -#include "MidiTriggerNode.h" -#include "AudioBuffer.h" -#include "InputPort.h" -#include "OutputPort.h" -#include "Plugin.h" -#include "util.h" +#include "MidiTriggerNode.hpp" +#include "AudioBuffer.hpp" +#include "InputPort.hpp" +#include "OutputPort.hpp" +#include "Plugin.hpp" +#include "util.hpp" namespace Ingen { diff --git a/src/libs/engine/MidiTriggerNode.h b/src/libs/engine/MidiTriggerNode.h deleted file mode 100644 index f46e6dee..00000000 --- a/src/libs/engine/MidiTriggerNode.h +++ /dev/null @@ -1,64 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MIDITRIGGERNODE_H -#define MIDITRIGGERNODE_H - -#include -#include "InternalNode.h" -#include "MidiBuffer.h" - -using std::string; - -namespace Ingen { - -class InputPort; -class OutputPort; - - -/** MIDI trigger input node. - * - * Just has a gate, for drums etc. A control port is used to select - * which note number is responded to. - * - * Note that this node is always monophonic, the poly parameter is ignored. - * (Should that change?) - * - * \ingroup engine - */ -class MidiTriggerNode : public InternalNode -{ -public: - MidiTriggerNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); - - void process(SampleCount nframes, FrameTime start, FrameTime end); - - void note_on(uchar note_num, uchar velocity, FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); - void note_off(uchar note_num, FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); - -private: - InputPort* _midi_in_port; - InputPort* _note_port; - OutputPort* _gate_port; - OutputPort* _trig_port; - OutputPort* _vel_port; -}; - - -} // namespace Ingen - -#endif // MIDITRIGGERNODE_H diff --git a/src/libs/engine/MidiTriggerNode.hpp b/src/libs/engine/MidiTriggerNode.hpp new file mode 100644 index 00000000..6c2dadfa --- /dev/null +++ b/src/libs/engine/MidiTriggerNode.hpp @@ -0,0 +1,64 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MIDITRIGGERNODE_H +#define MIDITRIGGERNODE_H + +#include +#include "InternalNode.hpp" +#include "MidiBuffer.hpp" + +using std::string; + +namespace Ingen { + +class InputPort; +class OutputPort; + + +/** MIDI trigger input node. + * + * Just has a gate, for drums etc. A control port is used to select + * which note number is responded to. + * + * Note that this node is always monophonic, the poly parameter is ignored. + * (Should that change?) + * + * \ingroup engine + */ +class MidiTriggerNode : public InternalNode +{ +public: + MidiTriggerNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + + void process(SampleCount nframes, FrameTime start, FrameTime end); + + void note_on(uchar note_num, uchar velocity, FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); + void note_off(uchar note_num, FrameTime time, SampleCount nframes, FrameTime start, FrameTime end); + +private: + InputPort* _midi_in_port; + InputPort* _note_port; + OutputPort* _gate_port; + OutputPort* _trig_port; + OutputPort* _vel_port; +}; + + +} // namespace Ingen + +#endif // MIDITRIGGERNODE_H diff --git a/src/libs/engine/Node.h b/src/libs/engine/Node.h deleted file mode 100644 index 93f032a8..00000000 --- a/src/libs/engine/Node.h +++ /dev/null @@ -1,113 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef NODE_H -#define NODE_H - -#include -#include -#include "types.h" -#include "GraphObject.h" - - -using std::string; - -namespace Raul { template class List; } - -namespace Ingen { - -class Buffer; -class Plugin; -class Patch; -class Port; -class OutputPort; -namespace Shared { class ClientInterface; } - - -/** A Node (or "module") in a Patch (which is also a Node). - * - * A Node is a unit with input/output ports, a process() method, and some other - * things. - * - * This is a pure abstract base class for any Node, it contains no - * implementation details/data whatsoever. This is the interface you need to - * implement to add a new Node type. - * - * \ingroup engine - */ -class Node : public GraphObject -{ -public: - Node(GraphObject* parent, const string& name) : GraphObject(parent, name) {} - virtual ~Node() {} - - /** Activate this Node. - * - * This function will be called in a non-realtime thread before it is - * inserted in to a patch. Any non-realtime actions that need to be - * done before the Node is ready for use should be done here. - */ - virtual void activate() = 0; - virtual void deactivate() = 0; - virtual bool activated() = 0; - - /** Run the node for @a nframes input/output. - * - * @a start and @a end are transport times: end is not redundant in the case - * of varispeed, where end-start != nframes. - */ - virtual void process(SampleCount nframes, FrameTime start, FrameTime end) = 0; - - virtual void set_port_buffer(size_t voice, size_t port_num, Buffer* buf) = 0; - - // FIXME: Only used by client senders. Remove? - virtual const Raul::Array& ports() const = 0; - - virtual size_t num_ports() const = 0; - virtual size_t poly() const = 0; - - /** Used by the process order finding algorithm (ie during connections) */ - virtual bool traversed() const = 0; - virtual void traversed(bool b) = 0; - - /** Nodes that are connected to this Node's inputs. - * (This Node depends on them) - */ - virtual Raul::List* providers() = 0; - virtual void providers(Raul::List* l) = 0; - - /** Nodes are are connected to this Node's outputs. - * (They depend on this Node) - */ - virtual Raul::List* dependants() = 0; - virtual void dependants(Raul::List* l) = 0; - - /** The Patch this Node belongs to. */ - virtual Patch* parent_patch() const = 0; - - /** Information about the Plugin this Node is an instance of. - * Not the best name - not all nodes come from plugins (ie Patch) - */ - virtual const Plugin* plugin() const = 0; - - virtual void set_buffer_size(size_t size) = 0; -}; - - -} // namespace Ingen - -#endif // NODE_H diff --git a/src/libs/engine/Node.hpp b/src/libs/engine/Node.hpp new file mode 100644 index 00000000..35edd201 --- /dev/null +++ b/src/libs/engine/Node.hpp @@ -0,0 +1,110 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef NODE_H +#define NODE_H + +#include +#include +#include "types.hpp" +#include "GraphObject.hpp" + +namespace Raul { template class List; } + +namespace Ingen { + +class Buffer; +class Plugin; +class Patch; +class Port; +class OutputPort; +namespace Shared { class ClientInterface; } + + +/** A Node (or "module") in a Patch (which is also a Node). + * + * A Node is a unit with input/output ports, a process() method, and some other + * things. + * + * This is a pure abstract base class for any Node, it contains no + * implementation details/data whatsoever. This is the interface you need to + * implement to add a new Node type. + * + * \ingroup engine + */ +class Node : public GraphObject +{ +public: + Node(GraphObject* parent, const std::string& name) : GraphObject(parent, name) {} + virtual ~Node() {} + + /** Activate this Node. + * + * This function will be called in a non-realtime thread before it is + * inserted in to a patch. Any non-realtime actions that need to be + * done before the Node is ready for use should be done here. + */ + virtual void activate() = 0; + virtual void deactivate() = 0; + virtual bool activated() = 0; + + /** Run the node for @a nframes input/output. + * + * @a start and @a end are transport times: end is not redundant in the case + * of varispeed, where end-start != nframes. + */ + virtual void process(SampleCount nframes, FrameTime start, FrameTime end) = 0; + + virtual void set_port_buffer(size_t voice, size_t port_num, Buffer* buf) = 0; + + // FIXME: Only used by client senders. Remove? + virtual const Raul::Array& ports() const = 0; + + virtual size_t num_ports() const = 0; + virtual size_t poly() const = 0; + + /** Used by the process order finding algorithm (ie during connections) */ + virtual bool traversed() const = 0; + virtual void traversed(bool b) = 0; + + /** Nodes that are connected to this Node's inputs. + * (This Node depends on them) + */ + virtual Raul::List* providers() = 0; + virtual void providers(Raul::List* l) = 0; + + /** Nodes are are connected to this Node's outputs. + * (They depend on this Node) + */ + virtual Raul::List* dependants() = 0; + virtual void dependants(Raul::List* l) = 0; + + /** The Patch this Node belongs to. */ + virtual Patch* parent_patch() const = 0; + + /** Information about the Plugin this Node is an instance of. + * Not the best name - not all nodes come from plugins (ie Patch) + */ + virtual const Plugin* plugin() const = 0; + + virtual void set_buffer_size(size_t size) = 0; +}; + + +} // namespace Ingen + +#endif // NODE_H diff --git a/src/libs/engine/NodeBase.cpp b/src/libs/engine/NodeBase.cpp index ffd509c4..04afe3b6 100644 --- a/src/libs/engine/NodeBase.cpp +++ b/src/libs/engine/NodeBase.cpp @@ -15,18 +15,18 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "NodeBase.h" +#include "NodeBase.hpp" #include #include #include -#include -#include -#include "util.h" -#include "Plugin.h" -#include "ClientBroadcaster.h" -#include "Port.h" -#include "Patch.h" -#include "ObjectStore.h" +#include +#include +#include "util.hpp" +#include "Plugin.hpp" +#include "ClientBroadcaster.hpp" +#include "Port.hpp" +#include "Patch.hpp" +#include "ObjectStore.hpp" using std::cout; using std::cerr; using std::endl; diff --git a/src/libs/engine/NodeBase.h b/src/libs/engine/NodeBase.h deleted file mode 100644 index a1372f19..00000000 --- a/src/libs/engine/NodeBase.h +++ /dev/null @@ -1,108 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef NODEBASE_H -#define NODEBASE_H - -#include "types.h" -#include -#include -#include "Node.h" - -using std::string; - -namespace Ingen { - -class Plugin; -class Patch; -class ObjectStore; - -namespace Shared { - class ClientInterface; -} using Shared::ClientInterface; - - -/** Common implementation stuff for Node. - * - * Pretty much just attributes and getters/setters are here. - * - * \ingroup engine - */ -class NodeBase : public Node -{ -public: - NodeBase(const Plugin* plugin, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); - - virtual ~NodeBase(); - - virtual void activate(); - virtual void deactivate(); - bool activated() { return _activated; } - - virtual void post_process(SampleCount nframes, FrameTime start, FrameTime end); - virtual void process(SampleCount nframes, FrameTime start, FrameTime end) = 0; - virtual void pre_process(SampleCount nframes, FrameTime start, FrameTime end); - - virtual void set_port_buffer(size_t voice, size_t port_num, Buffer* buf) {} - - virtual void set_buffer_size(size_t size); - - void add_to_store(ObjectStore* store); - void remove_from_store(); - - SampleRate sample_rate() const { return _srate; } - size_t buffer_size() const { return _buffer_size; } - size_t num_ports() const { return _ports ? _ports->size() : 0; } - size_t poly() const { return _poly; } - bool traversed() const { return _traversed; } - void traversed(bool b) { _traversed = b; } - - const Raul::Array& ports() const { return *_ports; } - - virtual Raul::List* providers() { return _providers; } - virtual void providers(Raul::List* l) { _providers = l; } - - virtual Raul::List* dependants() { return _dependants; } - virtual void dependants(Raul::List* l) { _dependants = l; } - - virtual const Plugin* plugin() const { return _plugin; } - - virtual void set_path(const Path& new_path); - - /** A node's parent is always a patch, so static cast should be safe */ - Patch* parent_patch() const { return (Patch*)_parent; } - -protected: - const Plugin* _plugin; - - size_t _poly; - - SampleRate _srate; - size_t _buffer_size; - bool _activated; - - Raul::Array* _ports; ///< Access in audio thread only - - bool _traversed; ///< Flag for process order algorithm - Raul::List* _providers; ///< Nodes connected to this one's input ports - Raul::List* _dependants; ///< Nodes this one's output ports are connected to -}; - - -} // namespace Ingen - -#endif // NODEBASE_H diff --git a/src/libs/engine/NodeBase.hpp b/src/libs/engine/NodeBase.hpp new file mode 100644 index 00000000..46c004df --- /dev/null +++ b/src/libs/engine/NodeBase.hpp @@ -0,0 +1,108 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef NODEBASE_H +#define NODEBASE_H + +#include "types.hpp" +#include +#include +#include "Node.hpp" + +using std::string; + +namespace Ingen { + +class Plugin; +class Patch; +class ObjectStore; + +namespace Shared { + class ClientInterface; +} using Shared::ClientInterface; + + +/** Common implementation stuff for Node. + * + * Pretty much just attributes and getters/setters are here. + * + * \ingroup engine + */ +class NodeBase : public Node +{ +public: + NodeBase(const Plugin* plugin, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + + virtual ~NodeBase(); + + virtual void activate(); + virtual void deactivate(); + bool activated() { return _activated; } + + virtual void post_process(SampleCount nframes, FrameTime start, FrameTime end); + virtual void process(SampleCount nframes, FrameTime start, FrameTime end) = 0; + virtual void pre_process(SampleCount nframes, FrameTime start, FrameTime end); + + virtual void set_port_buffer(size_t voice, size_t port_num, Buffer* buf) {} + + virtual void set_buffer_size(size_t size); + + void add_to_store(ObjectStore* store); + void remove_from_store(); + + SampleRate sample_rate() const { return _srate; } + size_t buffer_size() const { return _buffer_size; } + size_t num_ports() const { return _ports ? _ports->size() : 0; } + size_t poly() const { return _poly; } + bool traversed() const { return _traversed; } + void traversed(bool b) { _traversed = b; } + + const Raul::Array& ports() const { return *_ports; } + + virtual Raul::List* providers() { return _providers; } + virtual void providers(Raul::List* l) { _providers = l; } + + virtual Raul::List* dependants() { return _dependants; } + virtual void dependants(Raul::List* l) { _dependants = l; } + + virtual const Plugin* plugin() const { return _plugin; } + + virtual void set_path(const Path& new_path); + + /** A node's parent is always a patch, so static cast should be safe */ + Patch* parent_patch() const { return (Patch*)_parent; } + +protected: + const Plugin* _plugin; + + size_t _poly; + + SampleRate _srate; + size_t _buffer_size; + bool _activated; + + Raul::Array* _ports; ///< Access in audio thread only + + bool _traversed; ///< Flag for process order algorithm + Raul::List* _providers; ///< Nodes connected to this one's input ports + Raul::List* _dependants; ///< Nodes this one's output ports are connected to +}; + + +} // namespace Ingen + +#endif // NODEBASE_H diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp index 4e91ed02..24221dd7 100644 --- a/src/libs/engine/NodeFactory.cpp +++ b/src/libs/engine/NodeFactory.cpp @@ -15,30 +15,30 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "NodeFactory.h" -#include "config.h" +#include "NodeFactory.hpp" +#include "../../../../config/config.h" #include #include #include #include #include -#include "ThreadManager.h" -#include "MidiNoteNode.h" -#include "MidiTriggerNode.h" -#include "MidiControlNode.h" -#include "TransportNode.h" -#include "Plugin.h" -#include "Patch.h" +#include "ThreadManager.hpp" +#include "MidiNoteNode.hpp" +#include "MidiTriggerNode.hpp" +#include "MidiControlNode.hpp" +#include "TransportNode.hpp" +#include "Plugin.hpp" +#include "Patch.hpp" #ifdef HAVE_SLV2 -#include "LV2Node.h" +#include "LV2Node.hpp" #include #include // old slv2 compat #endif #ifdef HAVE_LADSPA -#include "LADSPANode.h" +#include "LADSPANode.hpp" #endif #ifdef HAVE_DSSI -#include "DSSINode.h" +#include "DSSINode.hpp" #endif using std::string; diff --git a/src/libs/engine/NodeFactory.h b/src/libs/engine/NodeFactory.h deleted file mode 100644 index bc41de23..00000000 --- a/src/libs/engine/NodeFactory.h +++ /dev/null @@ -1,96 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -#ifndef NODEFACTORY_H -#define NODEFACTORY_H - -#include "config.h" -#include "types.h" -#include -#include -#include -#include -#include -#ifdef HAVE_SLV2 -#include -#endif - -using std::string; using std::list; - -namespace Ingen { - -class Node; -class Patch; -class Plugin; - - -/** Loads plugins and creates Nodes from them. - * - * NodeFactory's responsibility is to get enough information to allow the - * loading of a plugin possible (ie finding/opening shared libraries etc) - * - * The constructor of various Node types (ie LADSPANode) are responsible - * for actually creating a Node instance of the plugin. - * - * \ingroup engine - */ -class NodeFactory -{ -public: - NodeFactory(); - ~NodeFactory(); - - void load_plugins(); - Node* load_plugin(const Plugin* info, const string& name, size_t poly, Patch* parent); - - const list& plugins() { return _plugins; } - - const Plugin* plugin(const string& uri); - const Plugin* plugin(const string& type, const string& lib, const string& label); // DEPRECATED - -private: -#ifdef HAVE_LADSPA - void load_ladspa_plugins(); - Node* load_ladspa_plugin(const string& plugin_uri, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); -#endif - -#ifdef HAVE_SLV2 - void load_lv2_plugins(); - Node* load_lv2_plugin(const string& plugin_uri, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); - - SLV2World _world; -#endif - -#ifdef HAVE_DSSI - void load_dssi_plugins(); - Node* load_dssi_plugin(const string& plugin_uri, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); -#endif - - Node* load_internal_plugin(const string& plug_label, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); - - list _libraries; - list _internal_plugins; - list _plugins; // FIXME: make a map - - bool _has_loaded; -}; - - -} // namespace Ingen - -#endif // NODEFACTORY_H diff --git a/src/libs/engine/NodeFactory.hpp b/src/libs/engine/NodeFactory.hpp new file mode 100644 index 00000000..3b8eb711 --- /dev/null +++ b/src/libs/engine/NodeFactory.hpp @@ -0,0 +1,96 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef NODEFACTORY_H +#define NODEFACTORY_H + +#include "../../../../config/config.h" + +#include +#include +#include +#include +#include +#ifdef HAVE_SLV2 +#include +#endif +#include "types.hpp" + +using std::string; using std::list; + +namespace Ingen { + +class Node; +class Patch; +class Plugin; + + +/** Loads plugins and creates Nodes from them. + * + * NodeFactory's responsibility is to get enough information to allow the + * loading of a plugin possible (ie finding/opening shared libraries etc) + * + * The constructor of various Node types (ie LADSPANode) are responsible + * for actually creating a Node instance of the plugin. + * + * \ingroup engine + */ +class NodeFactory +{ +public: + NodeFactory(); + ~NodeFactory(); + + void load_plugins(); + Node* load_plugin(const Plugin* info, const string& name, size_t poly, Patch* parent); + + const list& plugins() { return _plugins; } + + const Plugin* plugin(const string& uri); + const Plugin* plugin(const string& type, const string& lib, const string& label); // DEPRECATED + +private: +#ifdef HAVE_LADSPA + void load_ladspa_plugins(); + Node* load_ladspa_plugin(const string& plugin_uri, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); +#endif + +#ifdef HAVE_SLV2 + void load_lv2_plugins(); + Node* load_lv2_plugin(const string& plugin_uri, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + + SLV2World _world; +#endif + +#ifdef HAVE_DSSI + void load_dssi_plugins(); + Node* load_dssi_plugin(const string& plugin_uri, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); +#endif + + Node* load_internal_plugin(const string& plug_label, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + + list _libraries; + list _internal_plugins; + list _plugins; // FIXME: make a map + + bool _has_loaded; +}; + + +} // namespace Ingen + +#endif // NODEFACTORY_H diff --git a/src/libs/engine/OSCBuffer.cpp b/src/libs/engine/OSCBuffer.cpp index ff23a281..b4452c13 100644 --- a/src/libs/engine/OSCBuffer.cpp +++ b/src/libs/engine/OSCBuffer.cpp @@ -16,7 +16,7 @@ */ #include -#include "OSCBuffer.h" +#include "OSCBuffer.hpp" using namespace std; diff --git a/src/libs/engine/OSCBuffer.h b/src/libs/engine/OSCBuffer.h deleted file mode 100644 index 53e3b2d5..00000000 --- a/src/libs/engine/OSCBuffer.h +++ /dev/null @@ -1,63 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef OSCBUFFER_H -#define OSCBUFFER_H - -#include "Buffer.h" -#include "DataType.h" -#include "../../../../lv2/extensions/osc/lv2_osc.h" - -namespace Ingen { - - -class OSCBuffer : public Buffer { -public: - OSCBuffer(size_t capacity); - - ~OSCBuffer() { } - - void clear() { lv2_osc_buffer_clear(_buf); } - void reset(SampleCount nframs) {} - - void prepare_read(SampleCount nframes); - void prepare_write(SampleCount nframes); - - bool is_joined_to(Buffer* buf) const; - bool join(Buffer* buf); - void unjoin(); - - uint32_t this_nframes() const { return _this_nframes; } - - inline LV2OSCBuffer* data() - { return ((_joined_buf != NULL) ? _joined_buf->data() : _buf); } - - inline const LV2OSCBuffer* data() const - { return ((_joined_buf != NULL) ? _joined_buf->data() : _buf); } - -private: - LV2OSCBuffer* const _buf; - - OSCBuffer* _joined_buf; ///< Buffer to mirror, if joined - - uint32_t _this_nframes; -}; - - -} // namespace Ingen - -#endif // OSCBUFFER_H diff --git a/src/libs/engine/OSCBuffer.hpp b/src/libs/engine/OSCBuffer.hpp new file mode 100644 index 00000000..1e7e048a --- /dev/null +++ b/src/libs/engine/OSCBuffer.hpp @@ -0,0 +1,63 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef OSCBUFFER_H +#define OSCBUFFER_H + +#include "Buffer.hpp" +#include "DataType.hpp" +#include "../../../../lv2/extensions/osc/lv2_osc.h" + +namespace Ingen { + + +class OSCBuffer : public Buffer { +public: + OSCBuffer(size_t capacity); + + ~OSCBuffer() { } + + void clear() { lv2_osc_buffer_clear(_buf); } + void reset(SampleCount nframs) {} + + void prepare_read(SampleCount nframes); + void prepare_write(SampleCount nframes); + + bool is_joined_to(Buffer* buf) const; + bool join(Buffer* buf); + void unjoin(); + + uint32_t this_nframes() const { return _this_nframes; } + + inline LV2OSCBuffer* data() + { return ((_joined_buf != NULL) ? _joined_buf->data() : _buf); } + + inline const LV2OSCBuffer* data() const + { return ((_joined_buf != NULL) ? _joined_buf->data() : _buf); } + +private: + LV2OSCBuffer* const _buf; + + OSCBuffer* _joined_buf; ///< Buffer to mirror, if joined + + uint32_t _this_nframes; +}; + + +} // namespace Ingen + +#endif // OSCBUFFER_H diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp index c3f0f330..23144978 100644 --- a/src/libs/engine/OSCClientSender.cpp +++ b/src/libs/engine/OSCClientSender.cpp @@ -15,22 +15,22 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "OSCClientSender.h" +#include "OSCClientSender.hpp" #include #include #include -#include -#include "ObjectStore.h" -#include "NodeFactory.h" -#include "util.h" -#include "Patch.h" -#include "Node.h" -#include "Plugin.h" -#include "Port.h" -#include "Connection.h" -#include "AudioDriver.h" -#include "interface/ClientInterface.h" -#include "interface/Responder.h" +#include +#include "ObjectStore.hpp" +#include "NodeFactory.hpp" +#include "util.hpp" +#include "Patch.hpp" +#include "Node.hpp" +#include "Plugin.hpp" +#include "Port.hpp" +#include "Connection.hpp" +#include "AudioDriver.hpp" +#include "interface/ClientInterface.hpp" +#include "interface/Responder.hpp" using std::cout; using std::cerr; using std::endl; namespace Ingen { diff --git a/src/libs/engine/OSCClientSender.h b/src/libs/engine/OSCClientSender.h deleted file mode 100644 index 7def53ba..00000000 --- a/src/libs/engine/OSCClientSender.h +++ /dev/null @@ -1,141 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef OSCCLIENTSENDER_H -#define OSCCLIENTSENDER_H - -#include -#include -#include -#include -#include -#include -#include "types.h" -#include "interface/ClientInterface.h" - -using std::list; using std::string; -using std::cerr; - -namespace Ingen { - - -/** Implements ClientInterface for OSC clients (sends OSC messages). - * - * \ingroup engine - */ -class OSCClientSender : public Shared::ClientInterface -{ -public: - OSCClientSender(const string& url) - : _url(url), - _address(lo_address_new_from_url(url.c_str())), - _transfer(NULL), - _enabled(true) - {} - - virtual ~OSCClientSender() - { lo_address_free(_address); } - - const string& url() const { return _url; } - const lo_address address() const { return _address; } - - //void plugins(); // FIXME remove - - - - /* *** ClientInterface Implementation Below *** */ - - - //void client_registration(string url, int client_id); - - void enable() { _enabled = true; } - void disable() { _enabled = false; } - - void bundle_begin(); - void bundle_end(); - - void transfer_begin(); - void transfer_end(); - - void response(int32_t id, bool success, string msg); - - void num_plugins(uint32_t num); - - void error(string msg); - - virtual void new_plugin(string uri, - string type_uri, - string name); - - virtual void new_patch(string path, uint32_t poly); - - virtual void new_node(string plugin_uri, - string node_path, - bool is_polyphonic, - uint32_t num_ports); - - virtual void new_port(string path, - string data_type, - bool is_output); - - virtual void patch_enabled(string path); - - virtual void patch_disabled(string path); - - virtual void patch_cleared(string path); - - virtual void object_destroyed(string path); - - virtual void object_renamed(string old_path, - string new_path); - - virtual void connection(string src_port_path, - string dst_port_path); - - virtual void disconnection(string src_port_path, - string dst_port_path); - - virtual void metadata_update(string subject_path, - string predicate, - Raul::Atom value); - - virtual void control_change(string port_path, - float value); - - virtual void program_add(string node_path, - uint32_t bank, - uint32_t program, - string program_name); - - virtual void program_remove(string node_path, - uint32_t bank, - uint32_t program); - -private: - string _url; - lo_address _address; - - lo_bundle _transfer; - - bool _enabled; -}; - - -} // namespace Ingen - -#endif // OSCCLIENTSENDER_H - diff --git a/src/libs/engine/OSCClientSender.hpp b/src/libs/engine/OSCClientSender.hpp new file mode 100644 index 00000000..769bb0b9 --- /dev/null +++ b/src/libs/engine/OSCClientSender.hpp @@ -0,0 +1,141 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef OSCCLIENTSENDER_H +#define OSCCLIENTSENDER_H + +#include +#include +#include +#include +#include +#include +#include "types.hpp" +#include "interface/ClientInterface.hpp" + +using std::list; using std::string; +using std::cerr; + +namespace Ingen { + + +/** Implements ClientInterface for OSC clients (sends OSC messages). + * + * \ingroup engine + */ +class OSCClientSender : public Shared::ClientInterface +{ +public: + OSCClientSender(const string& url) + : _url(url), + _address(lo_address_new_from_url(url.c_str())), + _transfer(NULL), + _enabled(true) + {} + + virtual ~OSCClientSender() + { lo_address_free(_address); } + + const string& url() const { return _url; } + const lo_address address() const { return _address; } + + //void plugins(); // FIXME remove + + + + /* *** ClientInterface Implementation Below *** */ + + + //void client_registration(string url, int client_id); + + void enable() { _enabled = true; } + void disable() { _enabled = false; } + + void bundle_begin(); + void bundle_end(); + + void transfer_begin(); + void transfer_end(); + + void response(int32_t id, bool success, string msg); + + void num_plugins(uint32_t num); + + void error(string msg); + + virtual void new_plugin(string uri, + string type_uri, + string name); + + virtual void new_patch(string path, uint32_t poly); + + virtual void new_node(string plugin_uri, + string node_path, + bool is_polyphonic, + uint32_t num_ports); + + virtual void new_port(string path, + string data_type, + bool is_output); + + virtual void patch_enabled(string path); + + virtual void patch_disabled(string path); + + virtual void patch_cleared(string path); + + virtual void object_destroyed(string path); + + virtual void object_renamed(string old_path, + string new_path); + + virtual void connection(string src_port_path, + string dst_port_path); + + virtual void disconnection(string src_port_path, + string dst_port_path); + + virtual void metadata_update(string subject_path, + string predicate, + Raul::Atom value); + + virtual void control_change(string port_path, + float value); + + virtual void program_add(string node_path, + uint32_t bank, + uint32_t program, + string program_name); + + virtual void program_remove(string node_path, + uint32_t bank, + uint32_t program); + +private: + string _url; + lo_address _address; + + lo_bundle _transfer; + + bool _enabled; +}; + + +} // namespace Ingen + +#endif // OSCCLIENTSENDER_H + diff --git a/src/libs/engine/OSCDriver.h b/src/libs/engine/OSCDriver.h deleted file mode 100644 index 08294783..00000000 --- a/src/libs/engine/OSCDriver.h +++ /dev/null @@ -1,83 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef OSCDRIVER_H -#define OSCDRIVER_H - -#include "types.h" -#include "Driver.h" -#include -#include "OSCBuffer.h" - -namespace Ingen { - - -/** OSC driver abstract base class. - * - * \ingroup engine - */ -class OSCDriver : public Driver -{ -public: - OSCDriver() : Driver(DataType::OSC) {} - - /** Prepare events (however neccessary) for the specified block (realtime safe) */ - virtual void prepare_block(const SampleCount block_start, const SampleCount block_end) = 0; -}; - - - -/** Dummy OSCDriver. - * - * Not abstract, all functions are dummies. One of these will be allocated and - * "used" if no working OSC driver is loaded. (Doing it this way as opposed to - * just making OSCDriver have dummy functions makes sure any existing OSCDriver - * derived class actually implements the required functions). - * - * \ingroup engine - */ -class DummyOSCDriver : public OSCDriver -{ -public: - DummyOSCDriver() { - std::cout << "[DummyOSCDriver] Started Dummy OSC driver." << std::endl; - } - - ~DummyOSCDriver() {} - - void activate() {} - void deactivate() {} - - bool is_activated() const { return false; } - bool is_enabled() const { return false; } - - void enable() {} - void disable() {} - - DriverPort* create_port(DuplexPort* patch_port) { return NULL; } - - void add_port(DriverPort* port) {} - DriverPort* remove_port(const Raul::Path& path) { return NULL; } - - void prepare_block(const SampleCount block_start, const SampleCount block_end) {} -}; - - - -} // namespace Ingen - -#endif // OSCDRIVER_H diff --git a/src/libs/engine/OSCDriver.hpp b/src/libs/engine/OSCDriver.hpp new file mode 100644 index 00000000..a8e5402d --- /dev/null +++ b/src/libs/engine/OSCDriver.hpp @@ -0,0 +1,83 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef OSCDRIVER_H +#define OSCDRIVER_H + +#include "types.hpp" +#include "Driver.hpp" +#include +#include "OSCBuffer.hpp" + +namespace Ingen { + + +/** OSC driver abstract base class. + * + * \ingroup engine + */ +class OSCDriver : public Driver +{ +public: + OSCDriver() : Driver(DataType::OSC) {} + + /** Prepare events (however neccessary) for the specified block (realtime safe) */ + virtual void prepare_block(const SampleCount block_start, const SampleCount block_end) = 0; +}; + + + +/** Dummy OSCDriver. + * + * Not abstract, all functions are dummies. One of these will be allocated and + * "used" if no working OSC driver is loaded. (Doing it this way as opposed to + * just making OSCDriver have dummy functions makes sure any existing OSCDriver + * derived class actually implements the required functions). + * + * \ingroup engine + */ +class DummyOSCDriver : public OSCDriver +{ +public: + DummyOSCDriver() { + std::cout << "[DummyOSCDriver] Started Dummy OSC driver." << std::endl; + } + + ~DummyOSCDriver() {} + + void activate() {} + void deactivate() {} + + bool is_activated() const { return false; } + bool is_enabled() const { return false; } + + void enable() {} + void disable() {} + + DriverPort* create_port(DuplexPort* patch_port) { return NULL; } + + void add_port(DriverPort* port) {} + DriverPort* remove_port(const Raul::Path& path) { return NULL; } + + void prepare_block(const SampleCount block_start, const SampleCount block_end) {} +}; + + + +} // namespace Ingen + +#endif // OSCDRIVER_H diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp index 7bc336c2..d3d1b666 100644 --- a/src/libs/engine/OSCEngineReceiver.cpp +++ b/src/libs/engine/OSCEngineReceiver.cpp @@ -19,16 +19,16 @@ #include #include #include -#include "types.h" -#include -#include -#include "interface/ClientKey.h" -#include "interface/ClientInterface.h" -#include "OSCEngineReceiver.h" -#include "QueuedEventSource.h" -#include "OSCClientSender.h" -#include "OSCResponder.h" -#include "ClientBroadcaster.h" +#include "types.hpp" +#include +#include +#include "interface/ClientKey.hpp" +#include "interface/ClientInterface.hpp" +#include "OSCEngineReceiver.hpp" +#include "QueuedEventSource.hpp" +#include "OSCClientSender.hpp" +#include "OSCResponder.hpp" +#include "ClientBroadcaster.hpp" using std::cerr; using std::cout; using std::endl; diff --git a/src/libs/engine/OSCEngineReceiver.h b/src/libs/engine/OSCEngineReceiver.h deleted file mode 100644 index ba9d2544..00000000 --- a/src/libs/engine/OSCEngineReceiver.h +++ /dev/null @@ -1,127 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef OSCENGINERECEIVER_H -#define OSCENGINERECEIVER_H - -#include "config.h" -#include -#include -#include -#include -#include "QueuedEngineInterface.h" -#include "OSCResponder.h" -using std::string; - -namespace Ingen { - -class JackDriver; -class NodeFactory; -class Patch; - - -/* Some boilerplate killing macros... */ -#define LO_HANDLER_ARGS const char* path, const char* types, lo_arg** argv, int argc, lo_message msg - -/* Defines a static handler to be passed to lo_add_method, which is a trivial - * wrapper around a non-static method that does the real work. Makes a whoole - * lot of ugly boiler plate go away */ -#define LO_HANDLER(name) \ -int _##name##_cb (LO_HANDLER_ARGS);\ -inline static int name##_cb(LO_HANDLER_ARGS, void* myself)\ -{ return ((OSCEngineReceiver*)myself)->_##name##_cb(path, types, argv, argc, msg); } - - -/* FIXME: Make this receive and preprocess in the same thread? */ - - -/** Receives OSC messages from liblo. - * - * This inherits from QueuedEngineInterface and calls it's own functions - * via OSC. It's not actually a directly callable EngineInterface (it's - * callable via OSC...) so it should be implemented-as-a (privately inherit) - * QueuedEngineInterface, but it needs to be public so it's an EventSource - * the Driver can use. This probably should be fixed somehow.. - * - * \ingroup engine - */ -class OSCEngineReceiver : public QueuedEngineInterface -{ -public: - OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t port); - ~OSCEngineReceiver(); - - void activate(); - void deactivate(); - -private: - virtual void _run(); - - static void error_cb(int num, const char* msg, const char* path); - static int set_response_address_cb(LO_HANDLER_ARGS, void* myself); - static int generic_cb(LO_HANDLER_ARGS, void* myself); - static int unknown_cb(LO_HANDLER_ARGS, void* myself); - - LO_HANDLER(quit); - LO_HANDLER(ping); - LO_HANDLER(ping_slow); - LO_HANDLER(register_client); - LO_HANDLER(unregister_client); - LO_HANDLER(load_plugins); - LO_HANDLER(engine_activate); - LO_HANDLER(engine_deactivate); - LO_HANDLER(create_patch); - LO_HANDLER(rename); - LO_HANDLER(create_port); - LO_HANDLER(create_node); - LO_HANDLER(create_node_by_uri); - LO_HANDLER(enable_patch); - LO_HANDLER(disable_patch); - LO_HANDLER(clear_patch); - LO_HANDLER(destroy); - LO_HANDLER(connect); - LO_HANDLER(disconnect); - LO_HANDLER(disconnect_all); - LO_HANDLER(set_port_value); - LO_HANDLER(set_port_value_voice); - LO_HANDLER(set_port_value_slow); - LO_HANDLER(note_on); - LO_HANDLER(note_off); - LO_HANDLER(all_notes_off); - LO_HANDLER(midi_learn); - LO_HANDLER(metadata_get); - LO_HANDLER(metadata_set); - LO_HANDLER(request_plugin); - LO_HANDLER(request_object); - LO_HANDLER(request_port_value); - LO_HANDLER(request_plugins); - LO_HANDLER(request_all_objects); - -#ifdef HAVE_DSSI - LO_HANDLER(dssi); -#endif - - lo_server _server; - - /** Cached OSC responder (for most recent incoming message) */ - SharedPtr _osc_responder; -}; - - -} // namespace Ingen - -#endif // OSCENGINERECEIVER_H diff --git a/src/libs/engine/OSCEngineReceiver.hpp b/src/libs/engine/OSCEngineReceiver.hpp new file mode 100644 index 00000000..40a3801b --- /dev/null +++ b/src/libs/engine/OSCEngineReceiver.hpp @@ -0,0 +1,127 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef OSCENGINERECEIVER_H +#define OSCENGINERECEIVER_H + +#include "../../../../config/config.h" +#include +#include +#include +#include +#include "QueuedEngineInterface.hpp" +#include "OSCResponder.hpp" +using std::string; + +namespace Ingen { + +class JackDriver; +class NodeFactory; +class Patch; + + +/* Some boilerplate killing macros... */ +#define LO_HANDLER_ARGS const char* path, const char* types, lo_arg** argv, int argc, lo_message msg + +/* Defines a static handler to be passed to lo_add_method, which is a trivial + * wrapper around a non-static method that does the real work. Makes a whoole + * lot of ugly boiler plate go away */ +#define LO_HANDLER(name) \ +int _##name##_cb (LO_HANDLER_ARGS);\ +inline static int name##_cb(LO_HANDLER_ARGS, void* myself)\ +{ return ((OSCEngineReceiver*)myself)->_##name##_cb(path, types, argv, argc, msg); } + + +/* FIXME: Make this receive and preprocess in the same thread? */ + + +/** Receives OSC messages from liblo. + * + * This inherits from QueuedEngineInterface and calls it's own functions + * via OSC. It's not actually a directly callable EngineInterface (it's + * callable via OSC...) so it should be implemented-as-a (privately inherit) + * QueuedEngineInterface, but it needs to be public so it's an EventSource + * the Driver can use. This probably should be fixed somehow.. + * + * \ingroup engine + */ +class OSCEngineReceiver : public QueuedEngineInterface +{ +public: + OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t port); + ~OSCEngineReceiver(); + + void activate(); + void deactivate(); + +private: + virtual void _run(); + + static void error_cb(int num, const char* msg, const char* path); + static int set_response_address_cb(LO_HANDLER_ARGS, void* myself); + static int generic_cb(LO_HANDLER_ARGS, void* myself); + static int unknown_cb(LO_HANDLER_ARGS, void* myself); + + LO_HANDLER(quit); + LO_HANDLER(ping); + LO_HANDLER(ping_slow); + LO_HANDLER(register_client); + LO_HANDLER(unregister_client); + LO_HANDLER(load_plugins); + LO_HANDLER(engine_activate); + LO_HANDLER(engine_deactivate); + LO_HANDLER(create_patch); + LO_HANDLER(rename); + LO_HANDLER(create_port); + LO_HANDLER(create_node); + LO_HANDLER(create_node_by_uri); + LO_HANDLER(enable_patch); + LO_HANDLER(disable_patch); + LO_HANDLER(clear_patch); + LO_HANDLER(destroy); + LO_HANDLER(connect); + LO_HANDLER(disconnect); + LO_HANDLER(disconnect_all); + LO_HANDLER(set_port_value); + LO_HANDLER(set_port_value_voice); + LO_HANDLER(set_port_value_slow); + LO_HANDLER(note_on); + LO_HANDLER(note_off); + LO_HANDLER(all_notes_off); + LO_HANDLER(midi_learn); + LO_HANDLER(metadata_get); + LO_HANDLER(metadata_set); + LO_HANDLER(request_plugin); + LO_HANDLER(request_object); + LO_HANDLER(request_port_value); + LO_HANDLER(request_plugins); + LO_HANDLER(request_all_objects); + +#ifdef HAVE_DSSI + LO_HANDLER(dssi); +#endif + + lo_server _server; + + /** Cached OSC responder (for most recent incoming message) */ + SharedPtr _osc_responder; +}; + + +} // namespace Ingen + +#endif // OSCENGINERECEIVER_H diff --git a/src/libs/engine/OSCResponder.cpp b/src/libs/engine/OSCResponder.cpp index dcec4641..71104be4 100644 --- a/src/libs/engine/OSCResponder.cpp +++ b/src/libs/engine/OSCResponder.cpp @@ -15,9 +15,9 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "OSCResponder.h" -#include "ClientBroadcaster.h" -#include "interface/ClientKey.h" +#include "OSCResponder.hpp" +#include "ClientBroadcaster.hpp" +#include "interface/ClientKey.hpp" #include #include #include diff --git a/src/libs/engine/OSCResponder.h b/src/libs/engine/OSCResponder.h deleted file mode 100644 index 41158c14..00000000 --- a/src/libs/engine/OSCResponder.h +++ /dev/null @@ -1,70 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef OSCRESPONDER_H -#define OSCRESPONDER_H - -#include -#include -#include -#include "interface/Responder.h" - -namespace Ingen { - -class ClientBroadcaster; - - -/** Responder for (liblo) OSC clients. - * - * OSC Clients use request IDs to be able to associate replies with sent - * events. If the ID is -1, a response will not be sent (and the overhead - * of searching for the client's record will be skipped). Any other integer - * is a valid response ID and will be responded to. - * - * Creation of the lo_address is deferred until needed to avoid bogging down - * the receiving thread as much as possible. - */ -class OSCResponder : public Shared::Responder -{ -public: - OSCResponder(ClientBroadcaster* broadcaster, int32_t id, char* url); - ~OSCResponder(); - - void set_id(int32_t id) { _id = id; } - - void respond_ok(); - void respond_error(const string& msg); - - const char* url() const { return _url; } - - Shared::ClientKey client_key() - { return Shared::ClientKey(Shared::ClientKey::OSC_URL, _url); } - - SharedPtr client(); - -private: - ClientBroadcaster* _broadcaster; - int32_t _id; - char* const _url; - lo_address _addr; -}; - - -} // namespace Ingen - -#endif // OSCRESPONDER_H - diff --git a/src/libs/engine/OSCResponder.hpp b/src/libs/engine/OSCResponder.hpp new file mode 100644 index 00000000..a7b0968d --- /dev/null +++ b/src/libs/engine/OSCResponder.hpp @@ -0,0 +1,70 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef OSCRESPONDER_H +#define OSCRESPONDER_H + +#include +#include +#include +#include "interface/Responder.hpp" + +namespace Ingen { + +class ClientBroadcaster; + + +/** Responder for (liblo) OSC clients. + * + * OSC Clients use request IDs to be able to associate replies with sent + * events. If the ID is -1, a response will not be sent (and the overhead + * of searching for the client's record will be skipped). Any other integer + * is a valid response ID and will be responded to. + * + * Creation of the lo_address is deferred until needed to avoid bogging down + * the receiving thread as much as possible. + */ +class OSCResponder : public Shared::Responder +{ +public: + OSCResponder(ClientBroadcaster* broadcaster, int32_t id, char* url); + ~OSCResponder(); + + void set_id(int32_t id) { _id = id; } + + void respond_ok(); + void respond_error(const std::string& msg); + + const char* url() const { return _url; } + + Shared::ClientKey client_key() + { return Shared::ClientKey(Shared::ClientKey::OSC_URL, _url); } + + SharedPtr client(); + +private: + ClientBroadcaster* _broadcaster; + int32_t _id; + char* const _url; + lo_address _addr; +}; + + +} // namespace Ingen + +#endif // OSCRESPONDER_H + diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index 592f4735..216adf86 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -15,17 +15,17 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "ObjectSender.h" -#include "interface/ClientInterface.h" -#include "ObjectStore.h" -#include "Patch.h" -#include "Node.h" -#include "Port.h" -#include "Port.h" -#include "Connection.h" -#include "NodeFactory.h" -#include "DataType.h" -#include "AudioBuffer.h" +#include "ObjectSender.hpp" +#include "interface/ClientInterface.hpp" +#include "ObjectStore.hpp" +#include "Patch.hpp" +#include "Node.hpp" +#include "Port.hpp" +#include "Port.hpp" +#include "Connection.hpp" +#include "NodeFactory.hpp" +#include "DataType.hpp" +#include "AudioBuffer.hpp" namespace Ingen { diff --git a/src/libs/engine/ObjectSender.h b/src/libs/engine/ObjectSender.h deleted file mode 100644 index 51ecb34c..00000000 --- a/src/libs/engine/ObjectSender.h +++ /dev/null @@ -1,58 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef OBJECTSENDER_H -#define OBJECTSENDER_H - -#include - -namespace Ingen { - -namespace Shared { - class ClientInterface; -} using Shared::ClientInterface; - -class Patch; -class Node; -class Port; -class Plugin; - - -/** Utility class for sending GraphObjects to clients through ClientInterface. - * - * While ClientInterface is the direct low level message-based interface - * (protocol), this is used from the engine to easily send proper Objects - * with these messages (which is done in a few different parts of the code). - * - * Basically a serializer, except to calls on ClientInterface rather than - * eg a byte stream. - */ -class ObjectSender { -public: - - // FIXME: Make all object parameters const - - static void send_patch(ClientInterface* client, const Patch* patch, bool recursive); - static void send_node(ClientInterface* client, const Node* node, bool recursive); - static void send_port(ClientInterface* client, const Port* port); - static void send_plugins(ClientInterface* client, const std::list& plugs); -}; - -} // namespace Ingen - -#endif // OBJECTSENDER_H - diff --git a/src/libs/engine/ObjectSender.hpp b/src/libs/engine/ObjectSender.hpp new file mode 100644 index 00000000..51ecb34c --- /dev/null +++ b/src/libs/engine/ObjectSender.hpp @@ -0,0 +1,58 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef OBJECTSENDER_H +#define OBJECTSENDER_H + +#include + +namespace Ingen { + +namespace Shared { + class ClientInterface; +} using Shared::ClientInterface; + +class Patch; +class Node; +class Port; +class Plugin; + + +/** Utility class for sending GraphObjects to clients through ClientInterface. + * + * While ClientInterface is the direct low level message-based interface + * (protocol), this is used from the engine to easily send proper Objects + * with these messages (which is done in a few different parts of the code). + * + * Basically a serializer, except to calls on ClientInterface rather than + * eg a byte stream. + */ +class ObjectSender { +public: + + // FIXME: Make all object parameters const + + static void send_patch(ClientInterface* client, const Patch* patch, bool recursive); + static void send_node(ClientInterface* client, const Node* node, bool recursive); + static void send_port(ClientInterface* client, const Port* port); + static void send_plugins(ClientInterface* client, const std::list& plugs); +}; + +} // namespace Ingen + +#endif // OBJECTSENDER_H + diff --git a/src/libs/engine/ObjectStore.cpp b/src/libs/engine/ObjectStore.cpp index 709e3823..293adbef 100644 --- a/src/libs/engine/ObjectStore.cpp +++ b/src/libs/engine/ObjectStore.cpp @@ -15,13 +15,13 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include -#include "ObjectStore.h" -#include "Patch.h" -#include "Node.h" -#include "Port.h" -#include "Tree.h" +#include +#include +#include "ObjectStore.hpp" +#include "Patch.hpp" +#include "Node.hpp" +#include "Port.hpp" +#include "Tree.hpp" namespace Ingen { diff --git a/src/libs/engine/ObjectStore.h b/src/libs/engine/ObjectStore.h deleted file mode 100644 index 4c0a621a..00000000 --- a/src/libs/engine/ObjectStore.h +++ /dev/null @@ -1,64 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -#ifndef OBJECTSTORE_H -#define OBJECTSTORE_H - -#include -#include -#include "Tree.h" - -using std::string; -using Raul::Path; - -namespace Ingen { - -class Patch; -class Node; -class Port; -class GraphObject; - - -/** Storage for all GraphObjects (tree of GraphObject's sorted by path). - * - * All looking up in pre_process() methods (and anything else that isn't in-band - * with the audio thread) should use this (to read and modify the GraphObject - * tree). - */ -class ObjectStore -{ -public: - Patch* find_patch(const Path& path); - Node* find_node(const Path& path); - Port* find_port(const Path& path); - GraphObject* find(const Path& path); - - void add(GraphObject* o); - void add(TreeNode* o); - TreeNode* remove(const string& key); - - const Tree& objects() { return _objects; } - -private: - Tree _objects; -}; - - -} // namespace Ingen - -#endif // OBJECTSTORE diff --git a/src/libs/engine/ObjectStore.hpp b/src/libs/engine/ObjectStore.hpp new file mode 100644 index 00000000..8a5b61c6 --- /dev/null +++ b/src/libs/engine/ObjectStore.hpp @@ -0,0 +1,63 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef OBJECTSTORE_H +#define OBJECTSTORE_H + +#include +#include +#include "Tree.hpp" + +using std::string; +using Raul::Path; + +namespace Ingen { + +class Patch; +class Node; +class Port; +class GraphObject; + + +/** Storage for all GraphObjects (tree of GraphObject's sorted by path). + * + * All looking up in pre_process() methods (and anything else that isn't in-band + * with the audio thread) should use this (to read and modify the GraphObject + * tree). + */ +class ObjectStore +{ +public: + Patch* find_patch(const Path& path); + Node* find_node(const Path& path); + Port* find_port(const Path& path); + GraphObject* find(const Path& path); + + void add(GraphObject* o); + void add(TreeNode* o); + TreeNode* remove(const string& key); + + const Tree& objects() { return _objects; } + +private: + Tree _objects; +}; + + +} // namespace Ingen + +#endif // OBJECTSTORE diff --git a/src/libs/engine/OmInProcess.cpp b/src/libs/engine/OmInProcess.cpp index 6893ebe2..cf821441 100644 --- a/src/libs/engine/OmInProcess.cpp +++ b/src/libs/engine/OmInProcess.cpp @@ -19,11 +19,11 @@ #include #include #include -#include "Engine.h" -#include "OSCReceiver.h" -#include "JackAudioDriver.h" +#include "Engine.hpp" +#include "OSCReceiver.hpp" +#include "JackAudioDriver.hpp" /*#ifdef HAVE_LASH -#include "LashDriver.h" +#include "LashDriver.hpp" #endif*/ extern "C" diff --git a/src/libs/engine/OutputPort.cpp b/src/libs/engine/OutputPort.cpp index ea723963..0e688818 100644 --- a/src/libs/engine/OutputPort.cpp +++ b/src/libs/engine/OutputPort.cpp @@ -15,8 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "OutputPort.h" -#include "Buffer.h" +#include "OutputPort.hpp" +#include "Buffer.hpp" namespace Ingen { diff --git a/src/libs/engine/OutputPort.h b/src/libs/engine/OutputPort.h deleted file mode 100644 index 0e94be9f..00000000 --- a/src/libs/engine/OutputPort.h +++ /dev/null @@ -1,64 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef OUTPUTPORT_H -#define OUTPUTPORT_H - -#include -#include -#include "Port.h" -#include "types.h" - -namespace Ingen { - - -/** An output port. - * - * Output ports always have a locally allocated buffer, and buffer() will - * always return that buffer. (This is very different from InputPort) - * - * This class actually adds no functionality to Port whatsoever right now, - * it will in the future when more advanced port types exist, and it makes - * things clearer throughout the engine. - * - * \ingroup engine - */ -class OutputPort : virtual public Port -{ -public: - OutputPort(Node* parent, - const string& name, - size_t index, - size_t poly, - DataType type, - size_t buffer_size) - : Port(parent, name, index, poly, type, buffer_size) - {} - - void pre_process(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(SampleCount nframes, FrameTime start, FrameTime end); - - virtual ~OutputPort() {} - - bool is_input() const { return false; } - bool is_output() const { return true; } -}; - - -} // namespace Ingen - -#endif // OUTPUTPORT_H diff --git a/src/libs/engine/OutputPort.hpp b/src/libs/engine/OutputPort.hpp new file mode 100644 index 00000000..dbeb30a9 --- /dev/null +++ b/src/libs/engine/OutputPort.hpp @@ -0,0 +1,64 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef OUTPUTPORT_H +#define OUTPUTPORT_H + +#include +#include +#include "Port.hpp" +#include "types.hpp" + +namespace Ingen { + + +/** An output port. + * + * Output ports always have a locally allocated buffer, and buffer() will + * always return that buffer. (This is very different from InputPort) + * + * This class actually adds no functionality to Port whatsoever right now, + * it will in the future when more advanced port types exist, and it makes + * things clearer throughout the engine. + * + * \ingroup engine + */ +class OutputPort : virtual public Port +{ +public: + OutputPort(Node* parent, + const string& name, + size_t index, + size_t poly, + DataType type, + size_t buffer_size) + : Port(parent, name, index, poly, type, buffer_size) + {} + + void pre_process(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(SampleCount nframes, FrameTime start, FrameTime end); + + virtual ~OutputPort() {} + + bool is_input() const { return false; } + bool is_output() const { return true; } +}; + + +} // namespace Ingen + +#endif // OUTPUTPORT_H diff --git a/src/libs/engine/Patch.cpp b/src/libs/engine/Patch.cpp index dad3431b..16d2365f 100644 --- a/src/libs/engine/Patch.cpp +++ b/src/libs/engine/Patch.cpp @@ -18,13 +18,13 @@ #include #include #include -#include "ThreadManager.h" -#include "Node.h" -#include "Patch.h" -#include "Plugin.h" -#include "Port.h" -#include "Connection.h" -#include "DuplexPort.h" +#include "ThreadManager.hpp" +#include "Node.hpp" +#include "Patch.hpp" +#include "Plugin.hpp" +#include "Port.hpp" +#include "Connection.hpp" +#include "DuplexPort.hpp" using std::cerr; using std::cout; using std::endl; diff --git a/src/libs/engine/Patch.h b/src/libs/engine/Patch.h deleted file mode 100644 index ba74d1af..00000000 --- a/src/libs/engine/Patch.h +++ /dev/null @@ -1,136 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PATCH_H -#define PATCH_H - -#include -#include -#include -#include "NodeBase.h" -#include "Plugin.h" -#include "DataType.h" - -using std::string; - -template class Array; - -namespace Ingen { - -class Connection; -class InternalNode; -namespace Shared { - class ClientInterface; -} using Shared::ClientInterface; - - -/** A group of nodes in a graph, possibly polyphonic. - * - * Note that this is also a Node, just one which contains Nodes. - * Therefore infinite subpatching is possible, of polyphonic - * patches of polyphonic nodes etc. etc. - * - * \ingroup engine - */ -class Patch : public NodeBase -{ -public: - Patch(const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size, size_t local_poly); - virtual ~Patch(); - - void activate(); - void deactivate(); - - void process(SampleCount nframes, FrameTime start, FrameTime end); - - void set_buffer_size(size_t size); - - void add_to_store(ObjectStore* store); - void remove_from_store(); - - void set_path(const Path& new_path); - - // Patch specific stuff not inherited from Node - - void add_node(Raul::ListNode* tn); - Raul::ListNode* remove_node(const string& name); - - Raul::List& nodes() { return _nodes; } - Raul::List& connections() { return _connections; } - - const Raul::List& nodes() const { return _nodes; } - const Raul::List& connections() const { return _connections; } - - size_t num_ports() const; - - Port* create_port(const string& name, DataType type, size_t buffer_size, bool is_output); - void add_input(Raul::ListNode* port) { _input_ports.push_back(port); } ///< Preprocesser thread - void add_output(Raul::ListNode* port) { _output_ports.push_back(port); } ///< Preprocessor thread - Raul::ListNode* remove_port(const string& name); - - void add_connection(Raul::ListNode* c) { _connections.push_back(c); } - Raul::ListNode* remove_connection(const Port* src_port, const Port* dst_port); - - Raul::Array* process_order() { return _process_order; } - void process_order(Raul::Array* po) { _process_order = po; } - - Raul::Array* external_ports() { return _ports; } - void external_ports(Raul::Array* pa) { _ports = pa; } - - Raul::Array* build_process_order() const; - Raul::Array* build_ports_array() const; - - /** Whether to run this patch's DSP bits in the audio thread */ - bool enabled() const { return _process; } - void enable() { _process = true; } - void disable(); - - size_t internal_poly() const { return _internal_poly; } - -private: - inline void build_process_order_recursive(Node* n, Raul::Array* order) const; - - size_t _internal_poly; - Raul::Array* _process_order; ///< Accessed in audio thread only - Raul::List _connections; ///< Accessed in audio thread only - Raul::List _input_ports; ///< Accessed in preprocessing thread only - Raul::List _output_ports; ///< Accessed in preprocessing thread only - Raul::List _nodes; ///< Accessed in preprocessing thread only - bool _process; -}; - - - -/** Private helper for build_process_order */ -inline void -Patch::build_process_order_recursive(Node* n, Raul::Array* order) const -{ - if (n == NULL || n->traversed()) return; - n->traversed(true); - assert(order != NULL); - - for (Raul::List::iterator i = n->providers()->begin(); i != n->providers()->end(); ++i) - if ( ! (*i)->traversed() ) - build_process_order_recursive((*i), order); - - order->push_back(n); -} - - -} // namespace Ingen - -#endif // PATCH_H diff --git a/src/libs/engine/Patch.hpp b/src/libs/engine/Patch.hpp new file mode 100644 index 00000000..7422f551 --- /dev/null +++ b/src/libs/engine/Patch.hpp @@ -0,0 +1,136 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PATCH_H +#define PATCH_H + +#include +#include +#include +#include "NodeBase.hpp" +#include "Plugin.hpp" +#include "DataType.hpp" + +using std::string; + +template class Array; + +namespace Ingen { + +class Connection; +class InternalNode; +namespace Shared { + class ClientInterface; +} using Shared::ClientInterface; + + +/** A group of nodes in a graph, possibly polyphonic. + * + * Note that this is also a Node, just one which contains Nodes. + * Therefore infinite subpatching is possible, of polyphonic + * patches of polyphonic nodes etc. etc. + * + * \ingroup engine + */ +class Patch : public NodeBase +{ +public: + Patch(const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size, size_t local_poly); + virtual ~Patch(); + + void activate(); + void deactivate(); + + void process(SampleCount nframes, FrameTime start, FrameTime end); + + void set_buffer_size(size_t size); + + void add_to_store(ObjectStore* store); + void remove_from_store(); + + void set_path(const Path& new_path); + + // Patch specific stuff not inherited from Node + + void add_node(Raul::ListNode* tn); + Raul::ListNode* remove_node(const string& name); + + Raul::List& nodes() { return _nodes; } + Raul::List& connections() { return _connections; } + + const Raul::List& nodes() const { return _nodes; } + const Raul::List& connections() const { return _connections; } + + size_t num_ports() const; + + Port* create_port(const string& name, DataType type, size_t buffer_size, bool is_output); + void add_input(Raul::ListNode* port) { _input_ports.push_back(port); } ///< Preprocesser thread + void add_output(Raul::ListNode* port) { _output_ports.push_back(port); } ///< Preprocessor thread + Raul::ListNode* remove_port(const string& name); + + void add_connection(Raul::ListNode* c) { _connections.push_back(c); } + Raul::ListNode* remove_connection(const Port* src_port, const Port* dst_port); + + Raul::Array* process_order() { return _process_order; } + void process_order(Raul::Array* po) { _process_order = po; } + + Raul::Array* external_ports() { return _ports; } + void external_ports(Raul::Array* pa) { _ports = pa; } + + Raul::Array* build_process_order() const; + Raul::Array* build_ports_array() const; + + /** Whether to run this patch's DSP bits in the audio thread */ + bool enabled() const { return _process; } + void enable() { _process = true; } + void disable(); + + size_t internal_poly() const { return _internal_poly; } + +private: + inline void build_process_order_recursive(Node* n, Raul::Array* order) const; + + size_t _internal_poly; + Raul::Array* _process_order; ///< Accessed in audio thread only + Raul::List _connections; ///< Accessed in audio thread only + Raul::List _input_ports; ///< Accessed in preprocessing thread only + Raul::List _output_ports; ///< Accessed in preprocessing thread only + Raul::List _nodes; ///< Accessed in preprocessing thread only + bool _process; +}; + + + +/** Private helper for build_process_order */ +inline void +Patch::build_process_order_recursive(Node* n, Raul::Array* order) const +{ + if (n == NULL || n->traversed()) return; + n->traversed(true); + assert(order != NULL); + + for (Raul::List::iterator i = n->providers()->begin(); i != n->providers()->end(); ++i) + if ( ! (*i)->traversed() ) + build_process_order_recursive((*i), order); + + order->push_back(n); +} + + +} // namespace Ingen + +#endif // PATCH_H diff --git a/src/libs/engine/Plugin.cpp b/src/libs/engine/Plugin.cpp index afd0f43a..a0f423e0 100644 --- a/src/libs/engine/Plugin.cpp +++ b/src/libs/engine/Plugin.cpp @@ -15,11 +15,11 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "Plugin.h" -#include "MidiNoteNode.h" -#include "MidiTriggerNode.h" -#include "MidiControlNode.h" -#include "TransportNode.h" +#include "Plugin.hpp" +#include "MidiNoteNode.hpp" +#include "MidiTriggerNode.hpp" +#include "MidiControlNode.hpp" +#include "TransportNode.hpp" namespace Ingen { diff --git a/src/libs/engine/Plugin.h b/src/libs/engine/Plugin.h deleted file mode 100644 index 1a43e6fc..00000000 --- a/src/libs/engine/Plugin.h +++ /dev/null @@ -1,156 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PLUGIN_H -#define PLUGIN_H - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#ifdef HAVE_SLV2 -#include -#endif -#include "types.h" -using std::string; -using std::cerr; using std::endl; - -namespace Ingen { - -class Patch; -class Node; - - -/** Representation of a plugin (of various types). - * - * A Node is an instance of this, conceptually. - * FIXME: This whole thing is a filthy mess and needs a rewrite. Probably - * with derived classes for each plugin type. - */ -class Plugin : boost::noncopyable -{ -public: - enum Type { LV2, LADSPA, DSSI, Internal, Patch }; - - Plugin(Type type, const string& uri) - : _type(type) - , _uri(uri) - , _id(0) - , _module(NULL) -#ifdef HAVE_SLV2 - , _slv2_plugin(NULL) -#endif - {} - -#if 0 - // FIXME: remove - Plugin() : _type(Internal), _lib_path("/Ingen"), - _id(0), _library(NULL) - { -#ifdef HAVE_SLV2 - _slv2_plugin = NULL; -#endif - } -#endif - - Plugin(const Plugin* const copy) { - // Copying only allowed for Internal plugins. Bit of a hack, but - // allows the PluginInfo to be defined in the Node class which keeps - // things localized and convenient (FIXME?) - if (copy->_type != Internal) - exit(EXIT_FAILURE); - _type = copy->_type; - _uri = copy->_uri; - _lib_path = copy->_lib_path; - _lib_name = copy->_lib_name; - _plug_label = copy->_plug_label; - _name = copy->_name; - _id = _id; - _module = copy->_module; - } - - Type type() const { return _type; } - void type(Type t) { _type = t; } - const string& lib_path() const { return _lib_path; } - void lib_path(const string& s) { _lib_path = s; _lib_name = _lib_path.substr(_lib_path.find_last_of("/")+1); } - string lib_name() const { return _lib_name; } - void lib_name(const string& s) { _lib_name = s; } - const string& plug_label() const { return _plug_label; } - void plug_label(const string& s) { _plug_label = s; } - const string& name() const { return _name; } - void name(const string& s) { _name = s; } - unsigned long id() const { return _id; } - void id(unsigned long i) { _id = i; } - const string uri() const { return _uri; } - void uri(const string& s) { _uri = s; } - Glib::Module* module() const { return _module; } - void module(Glib::Module* module) { _module = module; } - - const char* type_string() const { - if (_type == LADSPA) return "LADSPA"; - else if (_type == LV2) return "LV2"; - else if (_type == DSSI) return "DSSI"; - else if (_type == Internal) return "Internal"; - else if (_type == Patch) return "Patch"; - else return ""; - } - - string type_uri() const { - return string("ingen:") + type_string(); - } - - void set_type(const string& type_string) { - if (type_string == "LADSPA") _type = LADSPA; - else if (type_string == "LV2") _type = LV2; - else if (type_string == "DSSI") _type = DSSI; - else if (type_string == "Internal") _type = Internal; - else if (type_string == "Patch") _type = Patch; - } - - // FIXME: ew -#ifdef HAVE_SLV2 - SLV2Plugin slv2_plugin() const { return _slv2_plugin; } - void slv2_plugin(SLV2Plugin p) { _slv2_plugin = p; } -#endif - - Node* instantiate(const string& name, size_t poly, Ingen::Patch* parent, SampleRate srate, size_t buffer_size); - -private: - Type _type; - string _uri; ///< LV2 only - string _lib_path; ///< LADSPA/DSSI only - string _lib_name; ///< LADSPA/DSSI only - string _plug_label; ///< LADSPA/DSSI only - string _name; ///< LADSPA/DSSI only - unsigned long _id; ///< LADSPA/DSSI only - - Glib::Module* _module; - -#ifdef HAVE_SLV2 - SLV2Plugin _slv2_plugin; -#endif -}; - - -} // namespace Ingen - -#endif // PLUGIN_H - diff --git a/src/libs/engine/Plugin.hpp b/src/libs/engine/Plugin.hpp new file mode 100644 index 00000000..10689145 --- /dev/null +++ b/src/libs/engine/Plugin.hpp @@ -0,0 +1,156 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PLUGIN_H +#define PLUGIN_H + +#include "../../../../config/config.h" + +#include +#include +#include +#include +#include +#include +#ifdef HAVE_SLV2 +#include +#endif +#include "types.hpp" +using std::string; +using std::cerr; using std::endl; + +namespace Ingen { + +class Patch; +class Node; + + +/** Representation of a plugin (of various types). + * + * A Node is an instance of this, conceptually. + * FIXME: This whole thing is a filthy mess and needs a rewrite. Probably + * with derived classes for each plugin type. + */ +class Plugin : boost::noncopyable +{ +public: + enum Type { LV2, LADSPA, DSSI, Internal, Patch }; + + Plugin(Type type, const string& uri) + : _type(type) + , _uri(uri) + , _id(0) + , _module(NULL) +#ifdef HAVE_SLV2 + , _slv2_plugin(NULL) +#endif + {} + +#if 0 + // FIXME: remove + Plugin() : _type(Internal), _lib_path("/Ingen"), + _id(0), _library(NULL) + { +#ifdef HAVE_SLV2 + _slv2_plugin = NULL; +#endif + } +#endif + + Plugin(const Plugin* const copy) { + // Copying only allowed for Internal plugins. Bit of a hack, but + // allows the PluginInfo to be defined in the Node class which keeps + // things localized and convenient (FIXME?) + if (copy->_type != Internal) + exit(EXIT_FAILURE); + _type = copy->_type; + _uri = copy->_uri; + _lib_path = copy->_lib_path; + _lib_name = copy->_lib_name; + _plug_label = copy->_plug_label; + _name = copy->_name; + _id = _id; + _module = copy->_module; + } + + Type type() const { return _type; } + void type(Type t) { _type = t; } + const string& lib_path() const { return _lib_path; } + void lib_path(const string& s) { _lib_path = s; _lib_name = _lib_path.substr(_lib_path.find_last_of("/")+1); } + string lib_name() const { return _lib_name; } + void lib_name(const string& s) { _lib_name = s; } + const string& plug_label() const { return _plug_label; } + void plug_label(const string& s) { _plug_label = s; } + const string& name() const { return _name; } + void name(const string& s) { _name = s; } + unsigned long id() const { return _id; } + void id(unsigned long i) { _id = i; } + const string uri() const { return _uri; } + void uri(const string& s) { _uri = s; } + Glib::Module* module() const { return _module; } + void module(Glib::Module* module) { _module = module; } + + const char* type_string() const { + if (_type == LADSPA) return "LADSPA"; + else if (_type == LV2) return "LV2"; + else if (_type == DSSI) return "DSSI"; + else if (_type == Internal) return "Internal"; + else if (_type == Patch) return "Patch"; + else return ""; + } + + string type_uri() const { + return string("ingen:") + type_string(); + } + + void set_type(const string& type_string) { + if (type_string == "LADSPA") _type = LADSPA; + else if (type_string == "LV2") _type = LV2; + else if (type_string == "DSSI") _type = DSSI; + else if (type_string == "Internal") _type = Internal; + else if (type_string == "Patch") _type = Patch; + } + + // FIXME: ew +#ifdef HAVE_SLV2 + SLV2Plugin slv2_plugin() const { return _slv2_plugin; } + void slv2_plugin(SLV2Plugin p) { _slv2_plugin = p; } +#endif + + Node* instantiate(const string& name, size_t poly, Ingen::Patch* parent, SampleRate srate, size_t buffer_size); + +private: + Type _type; + string _uri; ///< LV2 only + string _lib_path; ///< LADSPA/DSSI only + string _lib_name; ///< LADSPA/DSSI only + string _plug_label; ///< LADSPA/DSSI only + string _name; ///< LADSPA/DSSI only + unsigned long _id; ///< LADSPA/DSSI only + + Glib::Module* _module; + +#ifdef HAVE_SLV2 + SLV2Plugin _slv2_plugin; +#endif +}; + + +} // namespace Ingen + +#endif // PLUGIN_H + diff --git a/src/libs/engine/Port.cpp b/src/libs/engine/Port.cpp index f82da743..873e4c85 100644 --- a/src/libs/engine/Port.cpp +++ b/src/libs/engine/Port.cpp @@ -15,11 +15,11 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "Port.h" -#include "Node.h" -#include "DataType.h" -#include "Buffer.h" -#include "BufferFactory.h" +#include "Port.hpp" +#include "Node.hpp" +#include "DataType.hpp" +#include "Buffer.hpp" +#include "BufferFactory.hpp" namespace Ingen { diff --git a/src/libs/engine/Port.h b/src/libs/engine/Port.h deleted file mode 100644 index 6b3c20e8..00000000 --- a/src/libs/engine/Port.h +++ /dev/null @@ -1,93 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PORT_H -#define PORT_H - -#include -#include -#include -#include "types.h" -#include "GraphObject.h" -#include "DataType.h" - -using std::string; - -namespace Ingen { - -class Node; -class Buffer; - - -/** A port on a Node. - * - * This is a non-template abstract base class, which basically exists so - * things can pass around Port pointers and not have to worry about type, - * templates, etc. - * - * \ingroup engine - */ -class Port : public GraphObject -{ -public: - virtual ~Port(); - - /** A port's parent is always a node, so static cast should be safe */ - Node* parent_node() const { return (Node*)_parent; } - - Buffer* buffer(size_t voice) const { return _buffers.at(voice); } - - /** Called once per process cycle */ - virtual void pre_process(SampleCount nframes, FrameTime start, FrameTime end) = 0; - virtual void process(SampleCount nframes, FrameTime start, FrameTime end) {} - virtual void post_process(SampleCount nframes, FrameTime start, FrameTime end) {}; - - /** Empty buffer contents completely (ie silence) */ - virtual void clear_buffers(); - - virtual bool is_input() const = 0; - virtual bool is_output() const = 0; - - size_t num() const { return _index; } - size_t poly() const { return _poly; } - DataType type() const { return _type; } - size_t buffer_size() const { return _buffer_size; } - - virtual void set_buffer_size(size_t size); - - void fixed_buffers(bool b) { _fixed_buffers = b; } - bool fixed_buffers() { return _fixed_buffers; } - -protected: - Port(Node* const node, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size); - - virtual void allocate_buffers(); - virtual void connect_buffers(); - - size_t _index; - size_t _poly; - DataType _type; - size_t _buffer_size; - bool _fixed_buffers; - - Raul::Array _buffers; -}; - - -} // namespace Ingen - -#endif // PORT_H diff --git a/src/libs/engine/Port.hpp b/src/libs/engine/Port.hpp new file mode 100644 index 00000000..2414e86d --- /dev/null +++ b/src/libs/engine/Port.hpp @@ -0,0 +1,91 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PORT_H +#define PORT_H + +#include +#include +#include +#include "types.hpp" +#include "GraphObject.hpp" +#include "DataType.hpp" + +namespace Ingen { + +class Node; +class Buffer; + + +/** A port on a Node. + * + * This is a non-template abstract base class, which basically exists so + * things can pass around Port pointers and not have to worry about type, + * templates, etc. + * + * \ingroup engine + */ +class Port : public GraphObject +{ +public: + virtual ~Port(); + + /** A port's parent is always a node, so static cast should be safe */ + Node* parent_node() const { return (Node*)_parent; } + + Buffer* buffer(size_t voice) const { return _buffers.at(voice); } + + /** Called once per process cycle */ + virtual void pre_process(SampleCount nframes, FrameTime start, FrameTime end) = 0; + virtual void process(SampleCount nframes, FrameTime start, FrameTime end) {} + virtual void post_process(SampleCount nframes, FrameTime start, FrameTime end) {}; + + /** Empty buffer contents completely (ie silence) */ + virtual void clear_buffers(); + + virtual bool is_input() const = 0; + virtual bool is_output() const = 0; + + size_t num() const { return _index; } + size_t poly() const { return _poly; } + DataType type() const { return _type; } + size_t buffer_size() const { return _buffer_size; } + + virtual void set_buffer_size(size_t size); + + void fixed_buffers(bool b) { _fixed_buffers = b; } + bool fixed_buffers() { return _fixed_buffers; } + +protected: + Port(Node* const node, const std::string& name, size_t index, size_t poly, DataType type, size_t buffer_size); + + virtual void allocate_buffers(); + virtual void connect_buffers(); + + size_t _index; + size_t _poly; + DataType _type; + size_t _buffer_size; + bool _fixed_buffers; + + Raul::Array _buffers; +}; + + +} // namespace Ingen + +#endif // PORT_H diff --git a/src/libs/engine/PostProcessor.cpp b/src/libs/engine/PostProcessor.cpp index 7f74ee82..64c106d8 100644 --- a/src/libs/engine/PostProcessor.cpp +++ b/src/libs/engine/PostProcessor.cpp @@ -18,10 +18,10 @@ #include #include #include -#include -#include -#include "Event.h" -#include "PostProcessor.h" +#include +#include +#include "Event.hpp" +#include "PostProcessor.hpp" using std::cerr; using std::cout; using std::endl; diff --git a/src/libs/engine/PostProcessor.h b/src/libs/engine/PostProcessor.h deleted file mode 100644 index 4e3d91a1..00000000 --- a/src/libs/engine/PostProcessor.h +++ /dev/null @@ -1,58 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef POSTPROCESSOR_H -#define POSTPROCESSOR_H - -#include -#include "types.h" -#include -#include - -namespace Raul { class Maid; } - -namespace Ingen { - -class Event; - - -/** Processor for Events after leaving the audio thread. - * - * The audio thread pushes events to this when it is done with them (which - * is realtime-safe), which signals the processing thread through a semaphore - * to handle the event and pass it on to the Maid. - * - * \ingroup engine - */ -class PostProcessor : public Raul::Slave -{ -public: - PostProcessor(Raul::Maid& maid, size_t queue_size); - - /** Push an event on to the process queue, realtime-safe, not thread-safe. */ - inline void push(Event* const ev) { _events.push(ev); } - -private: - Raul::Maid& _maid; - Raul::SRSWQueue _events; - virtual void _whipped(); -}; - - -} // namespace Ingen - -#endif // POSTPROCESSOR_H diff --git a/src/libs/engine/PostProcessor.hpp b/src/libs/engine/PostProcessor.hpp new file mode 100644 index 00000000..b77bda6e --- /dev/null +++ b/src/libs/engine/PostProcessor.hpp @@ -0,0 +1,58 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef POSTPROCESSOR_H +#define POSTPROCESSOR_H + +#include +#include "types.hpp" +#include +#include + +namespace Raul { class Maid; } + +namespace Ingen { + +class Event; + + +/** Processor for Events after leaving the audio thread. + * + * The audio thread pushes events to this when it is done with them (which + * is realtime-safe), which signals the processing thread through a semaphore + * to handle the event and pass it on to the Maid. + * + * \ingroup engine + */ +class PostProcessor : public Raul::Slave +{ +public: + PostProcessor(Raul::Maid& maid, size_t queue_size); + + /** Push an event on to the process queue, realtime-safe, not thread-safe. */ + inline void push(Event* const ev) { _events.push(ev); } + +private: + Raul::Maid& _maid; + Raul::SRSWQueue _events; + virtual void _whipped(); +}; + + +} // namespace Ingen + +#endif // POSTPROCESSOR_H diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp index 4641f108..2abb5a1c 100644 --- a/src/libs/engine/QueuedEngineInterface.cpp +++ b/src/libs/engine/QueuedEngineInterface.cpp @@ -15,12 +15,12 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "QueuedEngineInterface.h" -#include "config.h" -#include "QueuedEventSource.h" -#include "events.h" -#include "Engine.h" -#include "AudioDriver.h" +#include "QueuedEngineInterface.hpp" +#include "../../../../config/config.h" +#include "QueuedEventSource.hpp" +#include "events.hpp" +#include "Engine.hpp" +#include "AudioDriver.hpp" namespace Ingen { diff --git a/src/libs/engine/QueuedEngineInterface.h b/src/libs/engine/QueuedEngineInterface.h deleted file mode 100644 index 0d2ba5d9..00000000 --- a/src/libs/engine/QueuedEngineInterface.h +++ /dev/null @@ -1,171 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef QUEUEDENGINEINTERFACE_H -#define QUEUEDENGINEINTERFACE_H - -#include -#include -#include -#include -#include "interface/EngineInterface.h" -#include "interface/ClientInterface.h" -#include "interface/ClientKey.h" -#include "interface/Responder.h" -#include "QueuedEventSource.h" -#include "Engine.h" -using std::string; - -namespace Ingen { - -using Shared::ClientKey; -using Shared::ClientInterface; -using Shared::EngineInterface; -class Engine; - - -/** A queued (preprocessed) event source / interface. - * - * This is the bridge between the EngineInterface presented to the client, and - * the EventSource that needs to be presented to the AudioDriver. - * - * This is sort of a state machine, \ref set_responder sets the Responder that - * will be used to send the response from all future function calls. Stateless - * protocols like UDP/OSC can use this to set a different response address for - * each event (eg incoming UDP port), but engine/client interfaces that don't - * need to change an 'address' constantly can just set it once on initialisation. - * Blocking control interfaces can be made by setting a Responder which signals - * the caller when the 'response' is 'sent'. - * - * If you do not register a responder, you have no way of knowing if your calls - * are successful. - * - * FIXME: this isn't really "queued" entirely, since some events aren't queued - * events and get pushed directly into the realtime event queue. Should that - * be separated into a different interface/client? - */ -class QueuedEngineInterface : public QueuedEventSource, public EngineInterface -{ -public: - QueuedEngineInterface(Engine& engine, size_t queued_size, size_t stamped_size); - virtual ~QueuedEngineInterface() {} - - void set_next_response_id(int32_t id); - - virtual void set_responder(SharedPtr responder); - virtual void disable_responses(); - - // Client registration - virtual void register_client(ClientKey key, SharedPtr client); - virtual void unregister_client(ClientKey key); - - - // Engine commands - virtual void load_plugins(); - virtual void activate(); - virtual void deactivate(); - virtual void quit(); - - // Object commands - - virtual void create_patch(const string& path, - uint32_t poly); - - virtual void create_port(const string& path, - const string& data_type, - bool direction); - - virtual void create_node(const string& path, - const string& plugin_uri, - bool polyphonic); - - /** FIXME: DEPRECATED, REMOVE */ - virtual void create_node(const string& path, - const string& plugin_type, - const string& lib_path, - const string& plug_label, - bool polyphonic); - - virtual void rename(const string& old_path, - const string& new_name); - - virtual void destroy(const string& path); - - virtual void clear_patch(const string& patch_path); - - virtual void enable_patch(const string& patch_path); - - virtual void disable_patch(const string& patch_path); - - virtual void connect(const string& src_port_path, - const string& dst_port_path); - - virtual void disconnect(const string& src_port_path, - const string& dst_port_path); - - virtual void disconnect_all(const string& node_path); - - virtual void set_port_value(const string& port_path, - float val); - - virtual void set_port_value(const string& port_path, - uint32_t voice, - float val); - - virtual void set_port_value_queued(const string& port_path, - float val); - - virtual void set_program(const string& node_path, - uint32_t bank, - uint32_t program); - - virtual void midi_learn(const string& node_path); - - virtual void set_metadata(const string& path, - const string& predicate, - const Raul::Atom& value); - - // Requests // - - virtual void ping(); - - virtual void request_plugin(const string& uri); - - virtual void request_object(const string& path); - - virtual void request_port_value(const string& port_path); - - virtual void request_plugins(); - - virtual void request_all_objects(); - -protected: - - /** Where responses to current messages will go. */ - SharedPtr _responder; - - Engine& _engine; - -private: - SampleCount now() const; -}; - - -} // namespace Ingen - -#endif // QUEUEDENGINEINTERFACE_H - diff --git a/src/libs/engine/QueuedEngineInterface.hpp b/src/libs/engine/QueuedEngineInterface.hpp new file mode 100644 index 00000000..204338bf --- /dev/null +++ b/src/libs/engine/QueuedEngineInterface.hpp @@ -0,0 +1,171 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef QUEUEDENGINEINTERFACE_H +#define QUEUEDENGINEINTERFACE_H + +#include +#include +#include +#include +#include "interface/EngineInterface.hpp" +#include "interface/ClientInterface.hpp" +#include "interface/ClientKey.hpp" +#include "interface/Responder.hpp" +#include "QueuedEventSource.hpp" +#include "Engine.hpp" +using std::string; + +namespace Ingen { + +using Shared::ClientKey; +using Shared::ClientInterface; +using Shared::EngineInterface; +class Engine; + + +/** A queued (preprocessed) event source / interface. + * + * This is the bridge between the EngineInterface presented to the client, and + * the EventSource that needs to be presented to the AudioDriver. + * + * This is sort of a state machine, \ref set_responder sets the Responder that + * will be used to send the response from all future function calls. Stateless + * protocols like UDP/OSC can use this to set a different response address for + * each event (eg incoming UDP port), but engine/client interfaces that don't + * need to change an 'address' constantly can just set it once on initialisation. + * Blocking control interfaces can be made by setting a Responder which signals + * the caller when the 'response' is 'sent'. + * + * If you do not register a responder, you have no way of knowing if your calls + * are successful. + * + * FIXME: this isn't really "queued" entirely, since some events aren't queued + * events and get pushed directly into the realtime event queue. Should that + * be separated into a different interface/client? + */ +class QueuedEngineInterface : public QueuedEventSource, public EngineInterface +{ +public: + QueuedEngineInterface(Engine& engine, size_t queued_size, size_t stamped_size); + virtual ~QueuedEngineInterface() {} + + void set_next_response_id(int32_t id); + + virtual void set_responder(SharedPtr responder); + virtual void disable_responses(); + + // Client registration + virtual void register_client(ClientKey key, SharedPtr client); + virtual void unregister_client(ClientKey key); + + + // Engine commands + virtual void load_plugins(); + virtual void activate(); + virtual void deactivate(); + virtual void quit(); + + // Object commands + + virtual void create_patch(const string& path, + uint32_t poly); + + virtual void create_port(const string& path, + const string& data_type, + bool direction); + + virtual void create_node(const string& path, + const string& plugin_uri, + bool polyphonic); + + /** FIXME: DEPRECATED, REMOVE */ + virtual void create_node(const string& path, + const string& plugin_type, + const string& lib_path, + const string& plug_label, + bool polyphonic); + + virtual void rename(const string& old_path, + const string& new_name); + + virtual void destroy(const string& path); + + virtual void clear_patch(const string& patch_path); + + virtual void enable_patch(const string& patch_path); + + virtual void disable_patch(const string& patch_path); + + virtual void connect(const string& src_port_path, + const string& dst_port_path); + + virtual void disconnect(const string& src_port_path, + const string& dst_port_path); + + virtual void disconnect_all(const string& node_path); + + virtual void set_port_value(const string& port_path, + float val); + + virtual void set_port_value(const string& port_path, + uint32_t voice, + float val); + + virtual void set_port_value_queued(const string& port_path, + float val); + + virtual void set_program(const string& node_path, + uint32_t bank, + uint32_t program); + + virtual void midi_learn(const string& node_path); + + virtual void set_metadata(const string& path, + const string& predicate, + const Raul::Atom& value); + + // Requests // + + virtual void ping(); + + virtual void request_plugin(const string& uri); + + virtual void request_object(const string& path); + + virtual void request_port_value(const string& port_path); + + virtual void request_plugins(); + + virtual void request_all_objects(); + +protected: + + /** Where responses to current messages will go. */ + SharedPtr _responder; + + Engine& _engine; + +private: + SampleCount now() const; +}; + + +} // namespace Ingen + +#endif // QUEUEDENGINEINTERFACE_H + diff --git a/src/libs/engine/QueuedEvent.h b/src/libs/engine/QueuedEvent.h deleted file mode 100644 index f1b82735..00000000 --- a/src/libs/engine/QueuedEvent.h +++ /dev/null @@ -1,99 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef QUEUEDEVENT_H -#define QUEUEDEVENT_H - -#include "Event.h" - -namespace Ingen { - -class QueuedEventSource; - - -/** An Event with a not-time-critical preprocessing stage. - * - * These events are events that aren't able to be executed immediately by the - * Jack thread (because they allocate memory or whatever). They are pushed - * on to the QueuedEventQueue where they are preprocessed then pushed on - * to the realtime Event Queue when they are ready. - * - * Lookups for these events should go in the pre_process() method, since they are - * not time critical and shouldn't waste time in the audio thread doing - * lookups they can do beforehand. (This applies for any expensive operation that - * could be done before the execute() method). - * - * \ingroup engine - */ -class QueuedEvent : public Event -{ -public: - /** Process this event into a realtime-suitable event. - */ - virtual void pre_process() { - assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); - assert(_pre_processed == false); - _pre_processed = true; - } - - virtual void execute(SampleCount nframes, FrameTime start, FrameTime end) { - assert(_pre_processed); - assert(_time <= end); - - // Didn't prepare in time. QueuedEvents aren't (necessarily) sample accurate - // so just run at the beginning of this cycle - if (_time <= start) - _time = start; - - Event::execute(nframes, start, end); - } - - virtual void post_process() {} - - /** If this event blocks the prepare phase of other slow events */ - bool is_blocking() { return _blocking; } - - bool is_prepared() { return _pre_processed; } - -protected: - QueuedEvent(Engine& engine, - SharedPtr responder, - FrameTime time, - bool blocking = false, - QueuedEventSource* source = NULL) - : Event(engine, responder, time) - , _pre_processed(false), _blocking(blocking), _source(source) - { - if (blocking) - assert(_source); - } - - // NULL event base (for internal events only!) - QueuedEvent(Engine& engine) - : Event(engine, SharedPtr(), 0) - , _pre_processed(false), _blocking(false), _source(NULL) - {} - - bool _pre_processed; - bool _blocking; - QueuedEventSource* _source; -}; - - -} // namespace Ingen - -#endif // QUEUEDEVENT_H diff --git a/src/libs/engine/QueuedEvent.hpp b/src/libs/engine/QueuedEvent.hpp new file mode 100644 index 00000000..4afe509d --- /dev/null +++ b/src/libs/engine/QueuedEvent.hpp @@ -0,0 +1,99 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef QUEUEDEVENT_H +#define QUEUEDEVENT_H + +#include "Event.hpp" + +namespace Ingen { + +class QueuedEventSource; + + +/** An Event with a not-time-critical preprocessing stage. + * + * These events are events that aren't able to be executed immediately by the + * Jack thread (because they allocate memory or whatever). They are pushed + * on to the QueuedEventQueue where they are preprocessed then pushed on + * to the realtime Event Queue when they are ready. + * + * Lookups for these events should go in the pre_process() method, since they are + * not time critical and shouldn't waste time in the audio thread doing + * lookups they can do beforehand. (This applies for any expensive operation that + * could be done before the execute() method). + * + * \ingroup engine + */ +class QueuedEvent : public Event +{ +public: + /** Process this event into a realtime-suitable event. + */ + virtual void pre_process() { + assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); + assert(_pre_processed == false); + _pre_processed = true; + } + + virtual void execute(SampleCount nframes, FrameTime start, FrameTime end) { + assert(_pre_processed); + assert(_time <= end); + + // Didn't prepare in time. QueuedEvents aren't (necessarily) sample accurate + // so just run at the beginning of this cycle + if (_time <= start) + _time = start; + + Event::execute(nframes, start, end); + } + + virtual void post_process() {} + + /** If this event blocks the prepare phase of other slow events */ + bool is_blocking() { return _blocking; } + + bool is_prepared() { return _pre_processed; } + +protected: + QueuedEvent(Engine& engine, + SharedPtr responder, + FrameTime time, + bool blocking = false, + QueuedEventSource* source = NULL) + : Event(engine, responder, time) + , _pre_processed(false), _blocking(blocking), _source(source) + { + if (blocking) + assert(_source); + } + + // NULL event base (for internal events only!) + QueuedEvent(Engine& engine) + : Event(engine, SharedPtr(), 0) + , _pre_processed(false), _blocking(false), _source(NULL) + {} + + bool _pre_processed; + bool _blocking; + QueuedEventSource* _source; +}; + + +} // namespace Ingen + +#endif // QUEUEDEVENT_H diff --git a/src/libs/engine/QueuedEventSource.cpp b/src/libs/engine/QueuedEventSource.cpp index 830b0103..6414a6e9 100644 --- a/src/libs/engine/QueuedEventSource.cpp +++ b/src/libs/engine/QueuedEventSource.cpp @@ -15,10 +15,10 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "QueuedEventSource.h" -#include "QueuedEvent.h" -#include "PostProcessor.h" -#include "ThreadManager.h" +#include "QueuedEventSource.hpp" +#include "QueuedEvent.hpp" +#include "PostProcessor.hpp" +#include "ThreadManager.hpp" #include #include using std::cout; using std::cerr; using std::endl; diff --git a/src/libs/engine/QueuedEventSource.h b/src/libs/engine/QueuedEventSource.h deleted file mode 100644 index d0c17c0b..00000000 --- a/src/libs/engine/QueuedEventSource.h +++ /dev/null @@ -1,110 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef QUEUEDEVENTSOURCE_H -#define QUEUEDEVENTSOURCE_H - -#include -#include -#include "types.h" -#include -#include -#include -#include "Event.h" -#include "EventSource.h" - -namespace Ingen { - -class QueuedEvent; -class PostProcessor; - - -/** Queue of events that need processing before reaching the audio thread. - * - * Implemented as a deque (ringbuffer) in a circular array. Pushing and - * popping are threadsafe, as long as a single thread pushes and a single - * thread pops (ie this data structure is threadsafe, but the push and pop - * methods themselves are not). Creating an instance of this class spawns - * a pre-processing thread to prepare queued events. - * - * This class is it's own slave. :) - */ -class QueuedEventSource : public EventSource, protected Raul::Slave -{ -public: - QueuedEventSource(size_t queued_size, size_t stamped_size); - ~QueuedEventSource(); - - void activate() { Slave::start(); } - void deactivate() { Slave::stop(); } - - void process(PostProcessor& dest, SampleCount nframes, FrameTime cycle_start, FrameTime cycle_end); - - void unblock(); - -protected: - void push_queued(QueuedEvent* const ev); - inline void push_stamped(Event* const ev) { _stamped_queue.push(ev); } - - Event* pop_earliest_queued_before(const SampleCount time); - inline Event* pop_earliest_stamped_before(const SampleCount time); - - bool unprepared_events() { return (_prepared_back != _back); } - - virtual void _whipped(); ///< Prepare 1 event - -private: - // Note that it's crucially important which functions access which of these - // variables, to maintain threadsafeness. - - //(FIXME: make this a separate class?) - // 2-part queue for events that require pre-processing: - size_t _front; ///< Front of queue - size_t _back; ///< Back of entire queue (1 past index of back element) - size_t _prepared_back; ///< Back of prepared section (1 past index of back prepared element) - const size_t _size; - QueuedEvent** _events; - Raul::Semaphore _blocking_semaphore; - - /** Queue for timestamped events (no pre-processing). */ - Raul::SRSWQueue _stamped_queue; -}; - - -/** Pops the realtime (timestamped, not preprocessed) event off the realtime queue. - * - * Engine will use the sample timestamps of returned events directly and execute the - * event with sample accuracy. Timestamps in the past will be bumped forward to - * the beginning of the cycle (offset 0), when eg. skipped cycles occur. - */ -inline Event* -QueuedEventSource::pop_earliest_stamped_before(const SampleCount time) -{ - Event* ret = NULL; - - if (!_stamped_queue.empty() && _stamped_queue.front()->time() < time) { - ret = _stamped_queue.front(); - _stamped_queue.pop(); - } - - return ret; -} - - -} // namespace Ingen - -#endif // QUEUEDEVENTSOURCE_H diff --git a/src/libs/engine/QueuedEventSource.hpp b/src/libs/engine/QueuedEventSource.hpp new file mode 100644 index 00000000..df1a4824 --- /dev/null +++ b/src/libs/engine/QueuedEventSource.hpp @@ -0,0 +1,110 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef QUEUEDEVENTSOURCE_H +#define QUEUEDEVENTSOURCE_H + +#include +#include +#include "types.hpp" +#include +#include +#include +#include "Event.hpp" +#include "EventSource.hpp" + +namespace Ingen { + +class QueuedEvent; +class PostProcessor; + + +/** Queue of events that need processing before reaching the audio thread. + * + * Implemented as a deque (ringbuffer) in a circular array. Pushing and + * popping are threadsafe, as long as a single thread pushes and a single + * thread pops (ie this data structure is threadsafe, but the push and pop + * methods themselves are not). Creating an instance of this class spawns + * a pre-processing thread to prepare queued events. + * + * This class is it's own slave. :) + */ +class QueuedEventSource : public EventSource, protected Raul::Slave +{ +public: + QueuedEventSource(size_t queued_size, size_t stamped_size); + ~QueuedEventSource(); + + void activate() { Slave::start(); } + void deactivate() { Slave::stop(); } + + void process(PostProcessor& dest, SampleCount nframes, FrameTime cycle_start, FrameTime cycle_end); + + void unblock(); + +protected: + void push_queued(QueuedEvent* const ev); + inline void push_stamped(Event* const ev) { _stamped_queue.push(ev); } + + Event* pop_earliest_queued_before(const SampleCount time); + inline Event* pop_earliest_stamped_before(const SampleCount time); + + bool unprepared_events() { return (_prepared_back != _back); } + + virtual void _whipped(); ///< Prepare 1 event + +private: + // Note that it's crucially important which functions access which of these + // variables, to maintain threadsafeness. + + //(FIXME: make this a separate class?) + // 2-part queue for events that require pre-processing: + size_t _front; ///< Front of queue + size_t _back; ///< Back of entire queue (1 past index of back element) + size_t _prepared_back; ///< Back of prepared section (1 past index of back prepared element) + const size_t _size; + QueuedEvent** _events; + Raul::Semaphore _blocking_semaphore; + + /** Queue for timestamped events (no pre-processing). */ + Raul::SRSWQueue _stamped_queue; +}; + + +/** Pops the realtime (timestamped, not preprocessed) event off the realtime queue. + * + * Engine will use the sample timestamps of returned events directly and execute the + * event with sample accuracy. Timestamps in the past will be bumped forward to + * the beginning of the cycle (offset 0), when eg. skipped cycles occur. + */ +inline Event* +QueuedEventSource::pop_earliest_stamped_before(const SampleCount time) +{ + Event* ret = NULL; + + if (!_stamped_queue.empty() && _stamped_queue.front()->time() < time) { + ret = _stamped_queue.front(); + _stamped_queue.pop(); + } + + return ret; +} + + +} // namespace Ingen + +#endif // QUEUEDEVENTSOURCE_H diff --git a/src/libs/engine/ThreadManager.h b/src/libs/engine/ThreadManager.h deleted file mode 100644 index dc415526..00000000 --- a/src/libs/engine/ThreadManager.h +++ /dev/null @@ -1,43 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef THREADMANAGER_H -#define THREADMANAGER_H - -#include - -using Raul::Thread; - -namespace Ingen { - - -enum ThreadID { - THREAD_PRE_PROCESS, - THREAD_PROCESS, - THREAD_POST_PROCESS -}; - - -class ThreadManager { -public: - inline static ThreadID current_thread_id() { return (ThreadID)Thread::get().context(); } -}; - - -} // namespace Ingen - -#endif // THREADMANAGER_H diff --git a/src/libs/engine/ThreadManager.hpp b/src/libs/engine/ThreadManager.hpp new file mode 100644 index 00000000..12f27000 --- /dev/null +++ b/src/libs/engine/ThreadManager.hpp @@ -0,0 +1,43 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef THREADMANAGER_H +#define THREADMANAGER_H + +#include + +using Raul::Thread; + +namespace Ingen { + + +enum ThreadID { + THREAD_PRE_PROCESS, + THREAD_PROCESS, + THREAD_POST_PROCESS +}; + + +class ThreadManager { +public: + inline static ThreadID current_thread_id() { return (ThreadID)Thread::get().context(); } +}; + + +} // namespace Ingen + +#endif // THREADMANAGER_H diff --git a/src/libs/engine/TransportNode.cpp b/src/libs/engine/TransportNode.cpp index d8895d72..5b4c6b05 100644 --- a/src/libs/engine/TransportNode.cpp +++ b/src/libs/engine/TransportNode.cpp @@ -15,14 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "TransportNode.h" +#include "TransportNode.hpp" #include -#include "OutputPort.h" -#include "Plugin.h" -#include "JackAudioDriver.h" -#include "Port.h" -#include "util.h" -//#include "Engine.h" +#include "OutputPort.hpp" +#include "Plugin.hpp" +#include "JackAudioDriver.hpp" +#include "Port.hpp" +#include "util.hpp" +//#include "Engine.hpp" namespace Ingen { diff --git a/src/libs/engine/TransportNode.h b/src/libs/engine/TransportNode.h deleted file mode 100644 index 4dd1c84b..00000000 --- a/src/libs/engine/TransportNode.h +++ /dev/null @@ -1,49 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -#ifndef TRANSPORTNODE_H -#define TRANSPORTNODE_H - - -#include -#include -#include "InternalNode.h" - -namespace Ingen { - -using std::string; - - -/** Transport Node, brings timing information into patches. - * - * This node uses the Jack transport API to get information about BPM, time - * signature, etc.. all sample accurate. Using this you can do - * tempo-synced effects or even synthesis, etc. - */ -class TransportNode : public InternalNode -{ -public: - TransportNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); - - virtual void process(SampleCount nframes, FrameTime start, FrameTime end); -}; - - -} // namespace Ingen - -#endif // TRANSPORTNODE_H diff --git a/src/libs/engine/TransportNode.hpp b/src/libs/engine/TransportNode.hpp new file mode 100644 index 00000000..96810223 --- /dev/null +++ b/src/libs/engine/TransportNode.hpp @@ -0,0 +1,49 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef TRANSPORTNODE_H +#define TRANSPORTNODE_H + + +#include +#include +#include "InternalNode.hpp" + +namespace Ingen { + +using std::string; + + +/** Transport Node, brings timing information into patches. + * + * This node uses the Jack transport API to get information about BPM, time + * signature, etc.. all sample accurate. Using this you can do + * tempo-synced effects or even synthesis, etc. + */ +class TransportNode : public InternalNode +{ +public: + TransportNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); + + virtual void process(SampleCount nframes, FrameTime start, FrameTime end); +}; + + +} // namespace Ingen + +#endif // TRANSPORTNODE_H diff --git a/src/libs/engine/Tree.h b/src/libs/engine/Tree.h deleted file mode 100644 index cba23776..00000000 --- a/src/libs/engine/Tree.h +++ /dev/null @@ -1,141 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef TREE_H -#define TREE_H - -#include -#include -#include -#include -using std::string; - -template class Tree; - - -/** A node in a Tree. - */ -template -class TreeNode : public Raul::Deletable -{ -public: - TreeNode(const string& key) - : _parent(NULL), _left_child(NULL), _right_child(NULL), - _key(key), _node(NULL) {} - - TreeNode(const string& key, T n) - : _parent(NULL), _left_child(NULL), _right_child(NULL), - _key(key), _node(n) {} - - ~TreeNode() { - assert(_parent == NULL || _parent->left_child() != this); - assert(_parent == NULL || _parent->right_child() != this); - assert(_left_child == NULL || _left_child->parent() != this); - assert(_right_child == NULL || _right_child->parent() != this); - _parent = _left_child = _right_child = NULL; - } - - string key() const { return _key; } - void key(const string& key) { _key = key; } - TreeNode* parent() const { return _parent; } - void parent(TreeNode* n) { _parent = n; } - TreeNode* left_child() const { return _left_child; } - void left_child(TreeNode* n) { _left_child = n; } - TreeNode* right_child() const { return _right_child; } - void right_child(TreeNode* n) { _right_child = n; } - - bool is_leaf() { return (_left_child == NULL && _right_child == NULL); } - bool is_left_child() { return (_parent != NULL && _parent->left_child() == this); } - bool is_right_child() { return (_parent != NULL && _parent->right_child() == this); } - - T node() { return _node; } - - friend class Tree; - -protected: - TreeNode* _parent; - TreeNode* _left_child; - TreeNode* _right_child; - string _key; - T _node; -}; - - -/** The tree all objects are stored in. - * - * Textbook naive (unbalanced) Binary Search Tree. Slightly different - * from a usual BST implementation in that the "Node" classes (TreeNode) are - * exposed to the user. This is so QueuedEvent's can create the TreeNode in - * another thread, and the realtime jack thread can insert them (without having - * to allocating a TreeNode which is a no-no). - * - * It's also a more annoying implementation because there's no leaf type (since - * a leaf object would have to be deleted on insert). - * - * Tree::iterator is not realtime safe, but the insert/remove/find methods - * of Tree do not use them. - */ -template -class Tree : boost::noncopyable -{ -public: - Tree() : _root(0), _size(0) {} - ~Tree(); - - void insert(TreeNode* const n); - TreeNode* remove(const string& key); - T find(const string& key) const; - TreeNode* find_treenode(const string& key) const; - - size_t size() const { return _size; } - - /** NON realtime safe iterator for a Tree. */ - class iterator - { - public: - iterator(const Tree* tree, size_t size); - ~iterator(); - - T operator*() const; - iterator& operator++(); - bool operator!=(const iterator& iter) const; - - friend class Tree; - - iterator(const iterator& copy); - iterator& operator=(const iterator& copy); - - private: - int _depth; - size_t _size; - TreeNode** _stack; - const Tree* _tree; - }; - - iterator begin() const; - iterator end() const; - -private: - TreeNode* _find_smallest(TreeNode* root); - TreeNode* _find_largest(TreeNode* root); - - TreeNode* _root; - size_t _size; -}; - - -#endif // TREE_H diff --git a/src/libs/engine/Tree.hpp b/src/libs/engine/Tree.hpp new file mode 100644 index 00000000..c6e36926 --- /dev/null +++ b/src/libs/engine/Tree.hpp @@ -0,0 +1,141 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef TREE_H +#define TREE_H + +#include +#include +#include +#include +using std::string; + +template class Tree; + + +/** A node in a Tree. + */ +template +class TreeNode : public Raul::Deletable +{ +public: + TreeNode(const string& key) + : _parent(NULL), _left_child(NULL), _right_child(NULL), + _key(key), _node(NULL) {} + + TreeNode(const string& key, T n) + : _parent(NULL), _left_child(NULL), _right_child(NULL), + _key(key), _node(n) {} + + ~TreeNode() { + assert(_parent == NULL || _parent->left_child() != this); + assert(_parent == NULL || _parent->right_child() != this); + assert(_left_child == NULL || _left_child->parent() != this); + assert(_right_child == NULL || _right_child->parent() != this); + _parent = _left_child = _right_child = NULL; + } + + string key() const { return _key; } + void key(const string& key) { _key = key; } + TreeNode* parent() const { return _parent; } + void parent(TreeNode* n) { _parent = n; } + TreeNode* left_child() const { return _left_child; } + void left_child(TreeNode* n) { _left_child = n; } + TreeNode* right_child() const { return _right_child; } + void right_child(TreeNode* n) { _right_child = n; } + + bool is_leaf() { return (_left_child == NULL && _right_child == NULL); } + bool is_left_child() { return (_parent != NULL && _parent->left_child() == this); } + bool is_right_child() { return (_parent != NULL && _parent->right_child() == this); } + + T node() { return _node; } + + friend class Tree; + +protected: + TreeNode* _parent; + TreeNode* _left_child; + TreeNode* _right_child; + string _key; + T _node; +}; + + +/** The tree all objects are stored in. + * + * Textbook naive (unbalanced) Binary Search Tree. Slightly different + * from a usual BST implementation in that the "Node" classes (TreeNode) are + * exposed to the user. This is so QueuedEvent's can create the TreeNode in + * another thread, and the realtime jack thread can insert them (without having + * to allocating a TreeNode which is a no-no). + * + * It's also a more annoying implementation because there's no leaf type (since + * a leaf object would have to be deleted on insert). + * + * Tree::iterator is not realtime safe, but the insert/remove/find methods + * of Tree do not use them. + */ +template +class Tree : boost::noncopyable +{ +public: + Tree() : _root(0), _size(0) {} + ~Tree(); + + void insert(TreeNode* const n); + TreeNode* remove(const string& key); + T find(const string& key) const; + TreeNode* find_treenode(const string& key) const; + + size_t size() const { return _size; } + + /** NON realtime safe iterator for a Tree. */ + class iterator + { + public: + iterator(const Tree* tree, size_t size); + ~iterator(); + + T operator*() const; + iterator& operator++(); + bool operator!=(const iterator& iter) const; + + friend class Tree; + + iterator(const iterator& copy); + iterator& operator=(const iterator& copy); + + private: + int _depth; + size_t _size; + TreeNode** _stack; + const Tree* _tree; + }; + + iterator begin() const; + iterator end() const; + +private: + TreeNode* _find_smallest(TreeNode* root); + TreeNode* _find_largest(TreeNode* root); + + TreeNode* _root; + size_t _size; +}; + + +#endif // TREE_H diff --git a/src/libs/engine/TreeImplementation.h b/src/libs/engine/TreeImplementation.h deleted file mode 100644 index 418264bc..00000000 --- a/src/libs/engine/TreeImplementation.h +++ /dev/null @@ -1,395 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "Tree.h" -#include -#include -#include -using std::cerr; using std::endl; - - -/* FIXME: this is all in horrible need of a rewrite. */ - - -/** Destroy the tree. - * - * Note that this does not delete any TreeNodes still inside the tree, - * that is the user's responsibility. - */ -template -Tree::~Tree() -{ -} - - -/** Insert a node into the tree. Realtime safe. - * - * @a n will be inserted using the key() field for searches. - * n->key() must not be the empty string. - */ -template -void -Tree::insert(TreeNode* const n) -{ - assert(n != NULL); - assert(n->left_child() == NULL); - assert(n->right_child() == NULL); - assert(n->parent() == NULL); - assert(n->key().length() > 0); - assert(find_treenode(n->key()) == NULL); - - if (_root == NULL) { - _root = n; - } else { - bool left = false; // which child to insert at - bool right = false; - TreeNode* i = _root; - while (true) { - assert(i != NULL); - if (n->key() <= i->key()) { - if (i->left_child() == NULL) { - left = true; - break; - } else { - i = i->left_child(); - } - } else { - if (i->right_child() == NULL) { - right = true; - break; - } else { - i = i->right_child(); - } - } - } - - assert(i != NULL); - assert(left || right); - assert( ! (left && right) ); - - if (left) { - assert(i->left_child() == NULL); - i->left_child(n); - } else if (right) { - assert(i->right_child() == NULL); - i->right_child(n); - } - n->parent(i); - } - ++_size; -} - - -/** Remove a node from the tree. - * - * Realtime safe, caller is responsible to delete returned value. - * - * @return NULL if object with @a key is not in tree. - */ -template -TreeNode* -Tree::remove(const string& key) -{ - TreeNode* node = find_treenode(key); - TreeNode* n = node; - TreeNode* swap = NULL; - T temp_node; - string temp_key; - - if (node == NULL) - return NULL; - - // Node is not even in tree - if (node->parent() == NULL && _root != node) - return NULL; - // FIXME: What if the node is in a different tree? Check for this? - -#ifndef NDEBUG - const T& remove_node = node->node(); // for error checking -#endif // NDEBUG - - // n has two children - if (n->left_child() != NULL && n->right_child() != NULL) { - if (rand()%2) - swap = _find_largest(n->left_child()); - else - swap = _find_smallest(n->right_child()); - - // Swap node's elements - temp_node = swap->_node; - swap->_node = n->_node; - n->_node = temp_node; - - // Swap node's keys - temp_key = swap->_key; - swap->_key = n->_key; - n->_key = temp_key; - - n = swap; - assert(n != NULL); - } - - // be sure we swapped correctly (ie right node is getting removed) - assert(n->node() == remove_node); - - // n now has at most one child - assert(n->left_child() == NULL || n->right_child() == NULL); - - if (n->is_leaf()) { - if (n->is_left_child()) - n->parent()->left_child(NULL); - else if (n->is_right_child()) - n->parent()->right_child(NULL); - - if (_root == n) _root = NULL; - } else { // has a single child - TreeNode* child = NULL; - if (n->left_child() != NULL) - child = n->left_child(); - else if (n->right_child() != NULL) - child = n->right_child(); - else - exit(EXIT_FAILURE); - - assert(child != n); - assert(child != NULL); - assert(n->parent() != n); - - if (n->is_left_child()) { - assert(n->parent() != child); - n->parent()->left_child(child); - child->parent(n->parent()); - } else if (n->is_right_child()) { - assert(n->parent() != child); - n->parent()->right_child(child); - child->parent(n->parent()); - } else { - child->parent(NULL); - } - if (_root == n) _root = child; - } - - // Be sure node is cut off completely - assert(n != NULL); - assert(n->parent() == NULL || n->parent()->left_child() != n); - assert(n->parent() == NULL || n->parent()->right_child() != n); - assert(n->left_child() == NULL || n->left_child()->parent() != n); - assert(n->right_child() == NULL || n->right_child()->parent() != n); - assert(_root != n); - - n->parent(NULL); - n->left_child(NULL); - n->right_child(NULL); - - --_size; - - if (_size == 0) _root = NULL; - - // Be sure right node is being removed - assert(n->node() == remove_node); - - return n; -} - - -template -T -Tree::find(const string& name) const -{ - TreeNode* tn = find_treenode(name); - - return (tn == NULL) ? NULL : tn->node(); -} - - -template -TreeNode* -Tree::find_treenode(const string& name) const -{ - TreeNode* i = _root; - int cmp = 0; - - while (i != NULL) { - cmp = name.compare(i->key()); - if (cmp < 0) - i = i->left_child(); - else if (cmp > 0) - i = i->right_child(); - else - break; - } - - return i; -} - - -/** Finds the smallest (key) node in the subtree rooted at "root" - */ -template -TreeNode* -Tree::_find_smallest(TreeNode* root) -{ - TreeNode* r = root; - - while (r->left_child() != NULL) - r = r->left_child(); - - return r; -} - - -/** Finds the largest (key) node in the subtree rooted at "root". - */ -template -TreeNode* -Tree::_find_largest(TreeNode* root) -{ - TreeNode* r = root; - - while (r->right_child() != NULL) - r = r->right_child(); - - return r; - -} - - - -//// Iterator Stuff //// - - - -template -Tree::iterator::iterator(const Tree *tree, size_t size) -: _depth(-1), - _size(size), - _stack(NULL), - _tree(tree) -{ - if (size > 0) - _stack = new TreeNode*[size]; -} - - -template -Tree::iterator::~iterator() -{ - delete[] _stack; -} - - -/* FIXME: Make these next two not memcpy (possibly have to force a single - * iterator existing at any given time) for speed. - */ - -// Copy constructor (for the typical for loop usage) -template -Tree::iterator::iterator(const Tree::iterator& copy) -: _depth(copy._depth), - _size(copy._size), - _tree(copy._tree) -{ - if (_size > 0) { - _stack = new TreeNode*[_size]; - memcpy(_stack, copy._stack, _size * sizeof(TreeNode*)); - } -} - - -// Assignment operator -template -typename Tree::iterator& -Tree::iterator::operator=(const Tree::iterator& copy) { - _depth = copy._depth; - _size = copy._size; - _tree = copy._tree; - - if (_size > 0) { - _stack = new TreeNode*[_size]; - memcpy(_stack, copy._stack, _size * sizeof(TreeNode*)); - } - return *this; -} - - -template -T -Tree::iterator::operator*() const -{ - assert(_depth >= 0); - return _stack[_depth]->node(); -} - - -template -typename Tree::iterator& -Tree::iterator::operator++() -{ - assert(_depth >= 0); - - TreeNode* tn = _stack[_depth]; - --_depth; - - tn = tn->right_child(); - while (tn != NULL) { - ++_depth; - _stack[_depth] = tn; - tn = tn->left_child(); - } - - return *this; -} - - -template -bool -Tree::iterator::operator!=(const Tree::iterator& iter) const -{ - // (DeMorgan's Law) - return (_tree != iter._tree || _depth != iter._depth); -} - - -template -typename Tree::iterator -Tree::begin() const -{ - typename Tree::iterator iter(this, _size); - iter._depth = -1; - - TreeNode *ptr = _root; - while (ptr != NULL) { - iter._depth++; - iter._stack[iter._depth] = ptr; - ptr = ptr->left_child(); - } - - return iter; -} - - -template -typename Tree::iterator -Tree::end() const -{ - typename Tree::iterator iter(this, 0); - iter._depth = -1; - - return iter; -} - - diff --git a/src/libs/engine/TreeImplementation.hpp b/src/libs/engine/TreeImplementation.hpp new file mode 100644 index 00000000..681079ac --- /dev/null +++ b/src/libs/engine/TreeImplementation.hpp @@ -0,0 +1,395 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "Tree.hpp" +#include +#include +#include +using std::cerr; using std::endl; + + +/* FIXME: this is all in horrible need of a rewrite. */ + + +/** Destroy the tree. + * + * Note that this does not delete any TreeNodes still inside the tree, + * that is the user's responsibility. + */ +template +Tree::~Tree() +{ +} + + +/** Insert a node into the tree. Realtime safe. + * + * @a n will be inserted using the key() field for searches. + * n->key() must not be the empty string. + */ +template +void +Tree::insert(TreeNode* const n) +{ + assert(n != NULL); + assert(n->left_child() == NULL); + assert(n->right_child() == NULL); + assert(n->parent() == NULL); + assert(n->key().length() > 0); + assert(find_treenode(n->key()) == NULL); + + if (_root == NULL) { + _root = n; + } else { + bool left = false; // which child to insert at + bool right = false; + TreeNode* i = _root; + while (true) { + assert(i != NULL); + if (n->key() <= i->key()) { + if (i->left_child() == NULL) { + left = true; + break; + } else { + i = i->left_child(); + } + } else { + if (i->right_child() == NULL) { + right = true; + break; + } else { + i = i->right_child(); + } + } + } + + assert(i != NULL); + assert(left || right); + assert( ! (left && right) ); + + if (left) { + assert(i->left_child() == NULL); + i->left_child(n); + } else if (right) { + assert(i->right_child() == NULL); + i->right_child(n); + } + n->parent(i); + } + ++_size; +} + + +/** Remove a node from the tree. + * + * Realtime safe, caller is responsible to delete returned value. + * + * @return NULL if object with @a key is not in tree. + */ +template +TreeNode* +Tree::remove(const string& key) +{ + TreeNode* node = find_treenode(key); + TreeNode* n = node; + TreeNode* swap = NULL; + T temp_node; + string temp_key; + + if (node == NULL) + return NULL; + + // Node is not even in tree + if (node->parent() == NULL && _root != node) + return NULL; + // FIXME: What if the node is in a different tree? Check for this? + +#ifndef NDEBUG + const T& remove_node = node->node(); // for error checking +#endif // NDEBUG + + // n has two children + if (n->left_child() != NULL && n->right_child() != NULL) { + if (rand()%2) + swap = _find_largest(n->left_child()); + else + swap = _find_smallest(n->right_child()); + + // Swap node's elements + temp_node = swap->_node; + swap->_node = n->_node; + n->_node = temp_node; + + // Swap node's keys + temp_key = swap->_key; + swap->_key = n->_key; + n->_key = temp_key; + + n = swap; + assert(n != NULL); + } + + // be sure we swapped correctly (ie right node is getting removed) + assert(n->node() == remove_node); + + // n now has at most one child + assert(n->left_child() == NULL || n->right_child() == NULL); + + if (n->is_leaf()) { + if (n->is_left_child()) + n->parent()->left_child(NULL); + else if (n->is_right_child()) + n->parent()->right_child(NULL); + + if (_root == n) _root = NULL; + } else { // has a single child + TreeNode* child = NULL; + if (n->left_child() != NULL) + child = n->left_child(); + else if (n->right_child() != NULL) + child = n->right_child(); + else + exit(EXIT_FAILURE); + + assert(child != n); + assert(child != NULL); + assert(n->parent() != n); + + if (n->is_left_child()) { + assert(n->parent() != child); + n->parent()->left_child(child); + child->parent(n->parent()); + } else if (n->is_right_child()) { + assert(n->parent() != child); + n->parent()->right_child(child); + child->parent(n->parent()); + } else { + child->parent(NULL); + } + if (_root == n) _root = child; + } + + // Be sure node is cut off completely + assert(n != NULL); + assert(n->parent() == NULL || n->parent()->left_child() != n); + assert(n->parent() == NULL || n->parent()->right_child() != n); + assert(n->left_child() == NULL || n->left_child()->parent() != n); + assert(n->right_child() == NULL || n->right_child()->parent() != n); + assert(_root != n); + + n->parent(NULL); + n->left_child(NULL); + n->right_child(NULL); + + --_size; + + if (_size == 0) _root = NULL; + + // Be sure right node is being removed + assert(n->node() == remove_node); + + return n; +} + + +template +T +Tree::find(const string& name) const +{ + TreeNode* tn = find_treenode(name); + + return (tn == NULL) ? NULL : tn->node(); +} + + +template +TreeNode* +Tree::find_treenode(const string& name) const +{ + TreeNode* i = _root; + int cmp = 0; + + while (i != NULL) { + cmp = name.compare(i->key()); + if (cmp < 0) + i = i->left_child(); + else if (cmp > 0) + i = i->right_child(); + else + break; + } + + return i; +} + + +/** Finds the smallest (key) node in the subtree rooted at "root" + */ +template +TreeNode* +Tree::_find_smallest(TreeNode* root) +{ + TreeNode* r = root; + + while (r->left_child() != NULL) + r = r->left_child(); + + return r; +} + + +/** Finds the largest (key) node in the subtree rooted at "root". + */ +template +TreeNode* +Tree::_find_largest(TreeNode* root) +{ + TreeNode* r = root; + + while (r->right_child() != NULL) + r = r->right_child(); + + return r; + +} + + + +//// Iterator Stuff //// + + + +template +Tree::iterator::iterator(const Tree *tree, size_t size) +: _depth(-1), + _size(size), + _stack(NULL), + _tree(tree) +{ + if (size > 0) + _stack = new TreeNode*[size]; +} + + +template +Tree::iterator::~iterator() +{ + delete[] _stack; +} + + +/* FIXME: Make these next two not memcpy (possibly have to force a single + * iterator existing at any given time) for speed. + */ + +// Copy constructor (for the typical for loop usage) +template +Tree::iterator::iterator(const Tree::iterator& copy) +: _depth(copy._depth), + _size(copy._size), + _tree(copy._tree) +{ + if (_size > 0) { + _stack = new TreeNode*[_size]; + memcpy(_stack, copy._stack, _size * sizeof(TreeNode*)); + } +} + + +// Assignment operator +template +typename Tree::iterator& +Tree::iterator::operator=(const Tree::iterator& copy) { + _depth = copy._depth; + _size = copy._size; + _tree = copy._tree; + + if (_size > 0) { + _stack = new TreeNode*[_size]; + memcpy(_stack, copy._stack, _size * sizeof(TreeNode*)); + } + return *this; +} + + +template +T +Tree::iterator::operator*() const +{ + assert(_depth >= 0); + return _stack[_depth]->node(); +} + + +template +typename Tree::iterator& +Tree::iterator::operator++() +{ + assert(_depth >= 0); + + TreeNode* tn = _stack[_depth]; + --_depth; + + tn = tn->right_child(); + while (tn != NULL) { + ++_depth; + _stack[_depth] = tn; + tn = tn->left_child(); + } + + return *this; +} + + +template +bool +Tree::iterator::operator!=(const Tree::iterator& iter) const +{ + // (DeMorgan's Law) + return (_tree != iter._tree || _depth != iter._depth); +} + + +template +typename Tree::iterator +Tree::begin() const +{ + typename Tree::iterator iter(this, _size); + iter._depth = -1; + + TreeNode *ptr = _root; + while (ptr != NULL) { + iter._depth++; + iter._stack[iter._depth] = ptr; + ptr = ptr->left_child(); + } + + return iter; +} + + +template +typename Tree::iterator +Tree::end() const +{ + typename Tree::iterator iter(this, 0); + iter._depth = -1; + + return iter; +} + + diff --git a/src/libs/engine/engine.cpp b/src/libs/engine/engine.cpp index d07efda8..bc272663 100644 --- a/src/libs/engine/engine.cpp +++ b/src/libs/engine/engine.cpp @@ -15,12 +15,12 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include "engine.h" -#include "Engine.h" -#include "QueuedEngineInterface.h" -#include "tuning.h" -#include "util.h" +#include +#include "engine.hpp" +#include "Engine.hpp" +#include "QueuedEngineInterface.hpp" +#include "tuning.hpp" +#include "util.hpp" namespace Ingen { diff --git a/src/libs/engine/engine.h b/src/libs/engine/engine.h deleted file mode 100644 index 04bf7b1f..00000000 --- a/src/libs/engine/engine.h +++ /dev/null @@ -1,46 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_ENGINE_H -#define INGEN_ENGINE_H - -#include - -namespace Ingen { - -class Engine; -namespace Shared { class EngineInterface; } - - -extern "C" { - - //void run(int argc, char** argv); - - /** Create a new engine in this process */ - Engine* new_engine(); - - /** Launch an OSC engine as a completely separate process - * \return true if successful - */ - bool launch_osc_engine(int port); -} - - -} // namespace Ingen - -#endif // INGEN_ENGINE_H - diff --git a/src/libs/engine/engine.hpp b/src/libs/engine/engine.hpp new file mode 100644 index 00000000..940db440 --- /dev/null +++ b/src/libs/engine/engine.hpp @@ -0,0 +1,46 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef INGEN_ENGINE_H +#define INGEN_ENGINE_H + +#include + +namespace Ingen { + +class Engine; +namespace Shared { class EngineInterface; } + + +extern "C" { + + //void run(int argc, char** argv); + + /** Create a new engine in this process */ + Engine* new_engine(); + + /** Launch an OSC engine as a completely separate process + * \return true if successful + */ + bool launch_osc_engine(int port); +} + + +} // namespace Ingen + +#endif // INGEN_ENGINE_H + diff --git a/src/libs/engine/events.h b/src/libs/engine/events.h deleted file mode 100644 index 05b1a148..00000000 --- a/src/libs/engine/events.h +++ /dev/null @@ -1,61 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef EVENTS_H -#define EVENTS_H - -#include "config.h" - -#include "DeactivateEvent.h" -#include "EnablePatchEvent.h" -#include "DisablePatchEvent.h" -#include "ClearPatchEvent.h" -#include "SetPortValueEvent.h" -#include "SetPortValueQueuedEvent.h" -#include "ConnectionEvent.h" -#include "DisconnectionEvent.h" -#include "AddPortEvent.h" -#include "AddNodeEvent.h" -#include "CreatePatchEvent.h" -#include "DestroyEvent.h" -#include "SetMetadataEvent.h" -#include "RequestMetadataEvent.h" -#include "RequestObjectEvent.h" -#include "RequestPluginEvent.h" -#include "RequestPortValueEvent.h" -#include "RequestAllObjectsEvent.h" -#include "RequestPluginsEvent.h" -#include "LoadPluginsEvent.h" -#include "NoteOnEvent.h" -#include "NoteOffEvent.h" -#include "AllNotesOffEvent.h" -#include "DisconnectNodeEvent.h" -#include "RegisterClientEvent.h" -#include "UnregisterClientEvent.h" -#include "RenameEvent.h" -#include "PingQueuedEvent.h" -#include "MidiLearnEvent.h" - -#ifdef HAVE_DSSI -#include "DSSIUpdateEvent.h" -#include "DSSIControlEvent.h" -#include "DSSIConfigureEvent.h" -#include "DSSIProgramEvent.h" -#endif - -#endif // EVENTS_H - diff --git a/src/libs/engine/events.hpp b/src/libs/engine/events.hpp new file mode 100644 index 00000000..0cfbbc86 --- /dev/null +++ b/src/libs/engine/events.hpp @@ -0,0 +1,61 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef EVENTS_H +#define EVENTS_H + +#include "../../../../config/config.h" + +#include "DeactivateEvent.hpp" +#include "EnablePatchEvent.hpp" +#include "DisablePatchEvent.hpp" +#include "ClearPatchEvent.hpp" +#include "SetPortValueEvent.hpp" +#include "SetPortValueQueuedEvent.hpp" +#include "ConnectionEvent.hpp" +#include "DisconnectionEvent.hpp" +#include "AddPortEvent.hpp" +#include "AddNodeEvent.hpp" +#include "CreatePatchEvent.hpp" +#include "DestroyEvent.hpp" +#include "SetMetadataEvent.hpp" +#include "RequestMetadataEvent.hpp" +#include "RequestObjectEvent.hpp" +#include "RequestPluginEvent.hpp" +#include "RequestPortValueEvent.hpp" +#include "RequestAllObjectsEvent.hpp" +#include "RequestPluginsEvent.hpp" +#include "LoadPluginsEvent.hpp" +#include "NoteOnEvent.hpp" +#include "NoteOffEvent.hpp" +#include "AllNotesOffEvent.hpp" +#include "DisconnectNodeEvent.hpp" +#include "RegisterClientEvent.hpp" +#include "UnregisterClientEvent.hpp" +#include "RenameEvent.hpp" +#include "PingQueuedEvent.hpp" +#include "MidiLearnEvent.hpp" + +#ifdef HAVE_DSSI +#include "DSSIUpdateEvent.hpp" +#include "DSSIControlEvent.hpp" +#include "DSSIConfigureEvent.hpp" +#include "DSSIProgramEvent.hpp" +#endif + +#endif // EVENTS_H + diff --git a/src/libs/engine/events/AddNodeEvent.cpp b/src/libs/engine/events/AddNodeEvent.cpp index 1ea2b596..fd95e838 100644 --- a/src/libs/engine/events/AddNodeEvent.cpp +++ b/src/libs/engine/events/AddNodeEvent.cpp @@ -15,21 +15,21 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "AddNodeEvent.h" -#include "interface/Responder.h" -#include "Patch.h" -#include "Node.h" -#include "Tree.h" -#include "Plugin.h" -#include "Engine.h" -#include "Patch.h" -#include "NodeFactory.h" -#include "ClientBroadcaster.h" -#include -#include -#include "ObjectStore.h" -#include -#include "Port.h" +#include "AddNodeEvent.hpp" +#include "interface/Responder.hpp" +#include "Patch.hpp" +#include "Node.hpp" +#include "Tree.hpp" +#include "Plugin.hpp" +#include "Engine.hpp" +#include "Patch.hpp" +#include "NodeFactory.hpp" +#include "ClientBroadcaster.hpp" +#include +#include +#include "ObjectStore.hpp" +#include +#include "Port.hpp" namespace Ingen { diff --git a/src/libs/engine/events/AddNodeEvent.h b/src/libs/engine/events/AddNodeEvent.h deleted file mode 100644 index 68d518ae..00000000 --- a/src/libs/engine/events/AddNodeEvent.h +++ /dev/null @@ -1,81 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef ADDNODEEVENT_H -#define ADDNODEEVENT_H - -#include "QueuedEvent.h" -#include -#include -using std::string; - -namespace Raul { template class Array; } -template class TreeNode; - -namespace Ingen { - -class Patch; -class Node; -class Plugin; - - -/** An event to load a Node and insert it into a Patch. - * - * \ingroup engine - */ -class AddNodeEvent : public QueuedEvent -{ -public: - AddNodeEvent(Engine& engine, - SharedPtr responder, - SampleCount timestamp, - const string& node_path, - const string& plugin_uri, - bool poly); - - // DEPRECATED - AddNodeEvent(Engine& engine, - SharedPtr responder, - SampleCount timestamp, - const string& node_path, - const string& plugin_type, - const string& lib_name, - const string& plugin_label, - bool poly); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - string _patch_name; - Path _path; - string _plugin_uri; ///< If nonempty then type, library, label, are ignored - string _plugin_type; - string _plugin_lib; - string _plugin_label; - bool _poly; - Patch* _patch; - Node* _node; - Raul::Array* _process_order; ///< Patch's new process order - bool _node_already_exists; -}; - - -} // namespace Ingen - -#endif // ADDNODEEVENT_H diff --git a/src/libs/engine/events/AddNodeEvent.hpp b/src/libs/engine/events/AddNodeEvent.hpp new file mode 100644 index 00000000..0a64c93a --- /dev/null +++ b/src/libs/engine/events/AddNodeEvent.hpp @@ -0,0 +1,81 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef ADDNODEEVENT_H +#define ADDNODEEVENT_H + +#include "QueuedEvent.hpp" +#include +#include +using std::string; + +namespace Raul { template class Array; } +template class TreeNode; + +namespace Ingen { + +class Patch; +class Node; +class Plugin; + + +/** An event to load a Node and insert it into a Patch. + * + * \ingroup engine + */ +class AddNodeEvent : public QueuedEvent +{ +public: + AddNodeEvent(Engine& engine, + SharedPtr responder, + SampleCount timestamp, + const string& node_path, + const string& plugin_uri, + bool poly); + + // DEPRECATED + AddNodeEvent(Engine& engine, + SharedPtr responder, + SampleCount timestamp, + const string& node_path, + const string& plugin_type, + const string& lib_name, + const string& plugin_label, + bool poly); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + string _patch_name; + Path _path; + string _plugin_uri; ///< If nonempty then type, library, label, are ignored + string _plugin_type; + string _plugin_lib; + string _plugin_label; + bool _poly; + Patch* _patch; + Node* _node; + Raul::Array* _process_order; ///< Patch's new process order + bool _node_already_exists; +}; + + +} // namespace Ingen + +#endif // ADDNODEEVENT_H diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp index c2ec9326..c4e7a26c 100644 --- a/src/libs/engine/events/AddPortEvent.cpp +++ b/src/libs/engine/events/AddPortEvent.cpp @@ -15,25 +15,25 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include -#include -#include -#include "interface/Responder.h" -#include "AddPortEvent.h" -#include "Patch.h" -#include "Tree.h" -#include "Plugin.h" -#include "Engine.h" -#include "Patch.h" -#include "QueuedEventSource.h" -#include "ObjectStore.h" -#include "ClientBroadcaster.h" -#include "Port.h" -#include "AudioDriver.h" -#include "MidiDriver.h" -#include "OSCDriver.h" -#include "DuplexPort.h" +#include +#include +#include +#include +#include "interface/Responder.hpp" +#include "AddPortEvent.hpp" +#include "Patch.hpp" +#include "Tree.hpp" +#include "Plugin.hpp" +#include "Engine.hpp" +#include "Patch.hpp" +#include "QueuedEventSource.hpp" +#include "ObjectStore.hpp" +#include "ClientBroadcaster.hpp" +#include "Port.hpp" +#include "AudioDriver.hpp" +#include "MidiDriver.hpp" +#include "OSCDriver.hpp" +#include "DuplexPort.hpp" namespace Ingen { diff --git a/src/libs/engine/events/AddPortEvent.h b/src/libs/engine/events/AddPortEvent.h deleted file mode 100644 index ed382286..00000000 --- a/src/libs/engine/events/AddPortEvent.h +++ /dev/null @@ -1,66 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef ADDPORTEVENT_H -#define ADDPORTEVENT_H - -#include "QueuedEvent.h" -#include -#include -#include "DataType.h" -#include -using std::string; - -template class Array; - -namespace Ingen { - -class Patch; -class Port; -class Plugin; -class DriverPort; - - -/** An event to add a Port to a Patch. - * - * \ingroup engine - */ -class AddPortEvent : public QueuedEvent -{ -public: - AddPortEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& type, bool is_output, QueuedEventSource* source); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - Path _path; - string _type; - bool _is_output; - DataType _data_type; - Patch* _patch; - Port* _patch_port; - Raul::Array* _ports_array; ///< New (external) ports array for Patch - DriverPort* _driver_port; ///< Driver (eg Jack) port if this is a toplevel port - bool _succeeded; -}; - - -} // namespace Ingen - -#endif // ADDPORTEVENT_H diff --git a/src/libs/engine/events/AddPortEvent.hpp b/src/libs/engine/events/AddPortEvent.hpp new file mode 100644 index 00000000..803e0910 --- /dev/null +++ b/src/libs/engine/events/AddPortEvent.hpp @@ -0,0 +1,66 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef ADDPORTEVENT_H +#define ADDPORTEVENT_H + +#include "QueuedEvent.hpp" +#include +#include +#include "DataType.hpp" +#include +using std::string; + +template class Array; + +namespace Ingen { + +class Patch; +class Port; +class Plugin; +class DriverPort; + + +/** An event to add a Port to a Patch. + * + * \ingroup engine + */ +class AddPortEvent : public QueuedEvent +{ +public: + AddPortEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& type, bool is_output, QueuedEventSource* source); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + Path _path; + string _type; + bool _is_output; + DataType _data_type; + Patch* _patch; + Port* _patch_port; + Raul::Array* _ports_array; ///< New (external) ports array for Patch + DriverPort* _driver_port; ///< Driver (eg Jack) port if this is a toplevel port + bool _succeeded; +}; + + +} // namespace Ingen + +#endif // ADDPORTEVENT_H diff --git a/src/libs/engine/events/AllNotesOffEvent.cpp b/src/libs/engine/events/AllNotesOffEvent.cpp index 1b7a40e1..6be698c6 100644 --- a/src/libs/engine/events/AllNotesOffEvent.cpp +++ b/src/libs/engine/events/AllNotesOffEvent.cpp @@ -15,10 +15,10 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "AllNotesOffEvent.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "ObjectStore.h" +#include "AllNotesOffEvent.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "ObjectStore.hpp" namespace Ingen { diff --git a/src/libs/engine/events/AllNotesOffEvent.h b/src/libs/engine/events/AllNotesOffEvent.h deleted file mode 100644 index 299e9760..00000000 --- a/src/libs/engine/events/AllNotesOffEvent.h +++ /dev/null @@ -1,51 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef ALLNOTESOFFEVENT_H -#define ALLNOTESOFFEVENT_H - -#include "Event.h" -#include -using std::string; - -namespace Ingen { - -class Patch; - - -/** A note off event for all active voices. - * - * \ingroup engine - */ -class AllNotesOffEvent : public Event -{ -public: - AllNotesOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Patch* patch); - AllNotesOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path); - - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - Patch* _patch; - string _patch_path; -}; - - -} // namespace Ingen - -#endif // ALLNOTESOFFEVENT_H diff --git a/src/libs/engine/events/AllNotesOffEvent.hpp b/src/libs/engine/events/AllNotesOffEvent.hpp new file mode 100644 index 00000000..5e29f780 --- /dev/null +++ b/src/libs/engine/events/AllNotesOffEvent.hpp @@ -0,0 +1,51 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef ALLNOTESOFFEVENT_H +#define ALLNOTESOFFEVENT_H + +#include "Event.hpp" +#include +using std::string; + +namespace Ingen { + +class Patch; + + +/** A note off event for all active voices. + * + * \ingroup engine + */ +class AllNotesOffEvent : public Event +{ +public: + AllNotesOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Patch* patch); + AllNotesOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path); + + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + Patch* _patch; + string _patch_path; +}; + + +} // namespace Ingen + +#endif // ALLNOTESOFFEVENT_H diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp index 44a23267..8ac8c23d 100644 --- a/src/libs/engine/events/ClearPatchEvent.cpp +++ b/src/libs/engine/events/ClearPatchEvent.cpp @@ -15,18 +15,18 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "ClearPatchEvent.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "Patch.h" -#include "ClientBroadcaster.h" -#include "util.h" -#include "ObjectStore.h" -#include "Port.h" -#include -#include "Node.h" -#include "Connection.h" -#include "QueuedEventSource.h" +#include "ClearPatchEvent.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "Patch.hpp" +#include "ClientBroadcaster.hpp" +#include "util.hpp" +#include "ObjectStore.hpp" +#include "Port.hpp" +#include +#include "Node.hpp" +#include "Connection.hpp" +#include "QueuedEventSource.hpp" namespace Ingen { diff --git a/src/libs/engine/events/ClearPatchEvent.h b/src/libs/engine/events/ClearPatchEvent.h deleted file mode 100644 index 21b227ca..00000000 --- a/src/libs/engine/events/ClearPatchEvent.h +++ /dev/null @@ -1,55 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef CLEARPATCHEVENT_H -#define CLEARPATCHEVENT_H - -#include -#include -#include "QueuedEvent.h" - -using std::string; - -namespace Ingen { - -class Patch; - - -/** Delete all nodes from a patch. - * - * \ingroup engine - */ -class ClearPatchEvent : public QueuedEvent -{ -public: - ClearPatchEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, const string& patch_path); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - string _patch_path; - Patch* _patch; - bool _process; -}; - - -} // namespace Ingen - - -#endif // CLEARPATCHEVENT_H diff --git a/src/libs/engine/events/ClearPatchEvent.hpp b/src/libs/engine/events/ClearPatchEvent.hpp new file mode 100644 index 00000000..4d631f07 --- /dev/null +++ b/src/libs/engine/events/ClearPatchEvent.hpp @@ -0,0 +1,55 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef CLEARPATCHEVENT_H +#define CLEARPATCHEVENT_H + +#include +#include +#include "QueuedEvent.hpp" + +using std::string; + +namespace Ingen { + +class Patch; + + +/** Delete all nodes from a patch. + * + * \ingroup engine + */ +class ClearPatchEvent : public QueuedEvent +{ +public: + ClearPatchEvent(Engine& engine, SharedPtr responder, FrameTime time, QueuedEventSource* source, const string& patch_path); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + string _patch_path; + Patch* _patch; + bool _process; +}; + + +} // namespace Ingen + + +#endif // CLEARPATCHEVENT_H diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp index 8952e281..c1fd3180 100644 --- a/src/libs/engine/events/ConnectionEvent.cpp +++ b/src/libs/engine/events/ConnectionEvent.cpp @@ -15,20 +15,20 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "ConnectionEvent.h" +#include "ConnectionEvent.hpp" #include -#include -#include -#include "interface/Responder.h" -#include "types.h" -#include "Engine.h" -#include "Connection.h" -#include "InputPort.h" -#include "OutputPort.h" -#include "Patch.h" -#include "ClientBroadcaster.h" -#include "Port.h" -#include "ObjectStore.h" +#include +#include +#include "interface/Responder.hpp" +#include "types.hpp" +#include "Engine.hpp" +#include "Connection.hpp" +#include "InputPort.hpp" +#include "OutputPort.hpp" +#include "Patch.hpp" +#include "ClientBroadcaster.hpp" +#include "Port.hpp" +#include "ObjectStore.hpp" using std::string; namespace Ingen { diff --git a/src/libs/engine/events/ConnectionEvent.h b/src/libs/engine/events/ConnectionEvent.h deleted file mode 100644 index d294657b..00000000 --- a/src/libs/engine/events/ConnectionEvent.h +++ /dev/null @@ -1,90 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef CONNECTIONEVENT_H -#define CONNECTIONEVENT_H - -#include -#include "QueuedEvent.h" -#include -#include "types.h" -using std::string; - -namespace Raul { - template class ListNode; - template class Array; -} - -namespace Ingen { - -class Patch; -class Node; -class Connection; -class MidiMessage; -class Port; -class Connection; -class InputPort; -class OutputPort; - - -/** Make a Connection between two Ports. - * - * \ingroup engine - */ -class ConnectionEvent : public QueuedEvent -{ -public: - ConnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - - enum ErrorType { - NO_ERROR, - PARENT_PATCH_DIFFERENT, - PORT_NOT_FOUND, - TYPE_MISMATCH, - DIRECTION_MISMATCH, - ALREADY_CONNECTED, - PARENTS_NOT_FOUND - }; - - Raul::Path _src_port_path; - Raul::Path _dst_port_path; - - Patch* _patch; - Port* _src_port; - Port* _dst_port; - OutputPort* _src_output_port; - InputPort* _dst_input_port; - - Raul::Array* _process_order; ///< New process order for Patch - - Connection* _connection; - Raul::ListNode* _patch_listnode; - Raul::ListNode* _port_listnode; - - ErrorType _error; -}; - - -} // namespace Ingen - -#endif // CONNECTIONEVENT_H diff --git a/src/libs/engine/events/ConnectionEvent.hpp b/src/libs/engine/events/ConnectionEvent.hpp new file mode 100644 index 00000000..f2903b94 --- /dev/null +++ b/src/libs/engine/events/ConnectionEvent.hpp @@ -0,0 +1,90 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef CONNECTIONEVENT_H +#define CONNECTIONEVENT_H + +#include +#include "QueuedEvent.hpp" +#include +#include "types.hpp" +using std::string; + +namespace Raul { + template class ListNode; + template class Array; +} + +namespace Ingen { + +class Patch; +class Node; +class Connection; +class MidiMessage; +class Port; +class Connection; +class InputPort; +class OutputPort; + + +/** Make a Connection between two Ports. + * + * \ingroup engine + */ +class ConnectionEvent : public QueuedEvent +{ +public: + ConnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + + enum ErrorType { + NO_ERROR, + PARENT_PATCH_DIFFERENT, + PORT_NOT_FOUND, + TYPE_MISMATCH, + DIRECTION_MISMATCH, + ALREADY_CONNECTED, + PARENTS_NOT_FOUND + }; + + Raul::Path _src_port_path; + Raul::Path _dst_port_path; + + Patch* _patch; + Port* _src_port; + Port* _dst_port; + OutputPort* _src_output_port; + InputPort* _dst_input_port; + + Raul::Array* _process_order; ///< New process order for Patch + + Connection* _connection; + Raul::ListNode* _patch_listnode; + Raul::ListNode* _port_listnode; + + ErrorType _error; +}; + + +} // namespace Ingen + +#endif // CONNECTIONEVENT_H diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp index f42b895e..866420d7 100644 --- a/src/libs/engine/events/CreatePatchEvent.cpp +++ b/src/libs/engine/events/CreatePatchEvent.cpp @@ -15,18 +15,18 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "CreatePatchEvent.h" -#include "interface/Responder.h" -#include "Patch.h" -#include "Node.h" -#include "Tree.h" -#include "Plugin.h" -#include "Engine.h" -#include -#include "ClientBroadcaster.h" -#include "AudioDriver.h" -#include -#include "ObjectStore.h" +#include "CreatePatchEvent.hpp" +#include "interface/Responder.hpp" +#include "Patch.hpp" +#include "Node.hpp" +#include "Tree.hpp" +#include "Plugin.hpp" +#include "Engine.hpp" +#include +#include "ClientBroadcaster.hpp" +#include "AudioDriver.hpp" +#include +#include "ObjectStore.hpp" namespace Ingen { diff --git a/src/libs/engine/events/CreatePatchEvent.h b/src/libs/engine/events/CreatePatchEvent.h deleted file mode 100644 index c63fd566..00000000 --- a/src/libs/engine/events/CreatePatchEvent.h +++ /dev/null @@ -1,66 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef CREATEPATCHEVENT_H -#define CREATEPATCHEVENT_H - -#include -#include -#include "QueuedEvent.h" - -using std::string; - -namespace Raul { template class Array; } -template class TreeNode; - -namespace Ingen { - -class Patch; -class Node; -class Plugin; - - -/** Creates a new Patch. - * - * \ingroup engine - */ -class CreatePatchEvent : public QueuedEvent -{ -public: - CreatePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, int poly); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - enum ErrorType { NO_ERROR, OBJECT_EXISTS, PARENT_NOT_FOUND, INVALID_POLY }; - - Path _path; - Patch* _patch; - Patch* _parent; - Raul::Array* _process_order; - TreeNode* _patch_treenode; - int _poly; - ErrorType _error; -}; - - -} // namespace Ingen - - -#endif // CREATEPATCHEVENT_H diff --git a/src/libs/engine/events/CreatePatchEvent.hpp b/src/libs/engine/events/CreatePatchEvent.hpp new file mode 100644 index 00000000..977abbaa --- /dev/null +++ b/src/libs/engine/events/CreatePatchEvent.hpp @@ -0,0 +1,66 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef CREATEPATCHEVENT_H +#define CREATEPATCHEVENT_H + +#include +#include +#include "QueuedEvent.hpp" + +using std::string; + +namespace Raul { template class Array; } +template class TreeNode; + +namespace Ingen { + +class Patch; +class Node; +class Plugin; + + +/** Creates a new Patch. + * + * \ingroup engine + */ +class CreatePatchEvent : public QueuedEvent +{ +public: + CreatePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, int poly); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + enum ErrorType { NO_ERROR, OBJECT_EXISTS, PARENT_NOT_FOUND, INVALID_POLY }; + + Path _path; + Patch* _patch; + Patch* _parent; + Raul::Array* _process_order; + TreeNode* _patch_treenode; + int _poly; + ErrorType _error; +}; + + +} // namespace Ingen + + +#endif // CREATEPATCHEVENT_H diff --git a/src/libs/engine/events/DSSIConfigureEvent.cpp b/src/libs/engine/events/DSSIConfigureEvent.cpp index 4f388558..9a0142c8 100644 --- a/src/libs/engine/events/DSSIConfigureEvent.cpp +++ b/src/libs/engine/events/DSSIConfigureEvent.cpp @@ -15,12 +15,12 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DSSIConfigureEvent.h" -#include "Engine.h" -#include "Node.h" -#include "ClientBroadcaster.h" -#include "Plugin.h" -#include "ObjectStore.h" +#include "DSSIConfigureEvent.hpp" +#include "Engine.hpp" +#include "Node.hpp" +#include "ClientBroadcaster.hpp" +#include "Plugin.hpp" +#include "ObjectStore.hpp" namespace Ingen { diff --git a/src/libs/engine/events/DSSIConfigureEvent.h b/src/libs/engine/events/DSSIConfigureEvent.h deleted file mode 100644 index 944f6239..00000000 --- a/src/libs/engine/events/DSSIConfigureEvent.h +++ /dev/null @@ -1,50 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DSSICONFIGUREEVENT_H -#define DSSICONFIGUREEVENT_H - -#include "QueuedEvent.h" -#include "DSSINode.h" - -namespace Ingen { - - -/** Change of a 'configure' key/value pair for a DSSI plugin. - * - * \ingroup engine - */ -class DSSIConfigureEvent : public QueuedEvent -{ -public: - DSSIConfigureEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, const string& key, const string& val); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - string _node_path; - string _key; - string _val; - DSSINode* _node; -}; - - -} // namespace Ingen - -#endif // DSSICONFIGUREEVENT_H diff --git a/src/libs/engine/events/DSSIConfigureEvent.hpp b/src/libs/engine/events/DSSIConfigureEvent.hpp new file mode 100644 index 00000000..ef37c5cd --- /dev/null +++ b/src/libs/engine/events/DSSIConfigureEvent.hpp @@ -0,0 +1,50 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DSSICONFIGUREEVENT_H +#define DSSICONFIGUREEVENT_H + +#include "QueuedEvent.hpp" +#include "DSSINode.hpp" + +namespace Ingen { + + +/** Change of a 'configure' key/value pair for a DSSI plugin. + * + * \ingroup engine + */ +class DSSIConfigureEvent : public QueuedEvent +{ +public: + DSSIConfigureEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, const string& key, const string& val); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + string _node_path; + string _key; + string _val; + DSSINode* _node; +}; + + +} // namespace Ingen + +#endif // DSSICONFIGUREEVENT_H diff --git a/src/libs/engine/events/DSSIControlEvent.cpp b/src/libs/engine/events/DSSIControlEvent.cpp index 94f504a7..eef5054b 100644 --- a/src/libs/engine/events/DSSIControlEvent.cpp +++ b/src/libs/engine/events/DSSIControlEvent.cpp @@ -15,11 +15,11 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DSSIControlEvent.h" -#include "Engine.h" -#include "Node.h" -#include "Plugin.h" -#include "ObjectStore.h" +#include "DSSIControlEvent.hpp" +#include "Engine.hpp" +#include "Node.hpp" +#include "Plugin.hpp" +#include "ObjectStore.hpp" namespace Ingen { diff --git a/src/libs/engine/events/DSSIControlEvent.h b/src/libs/engine/events/DSSIControlEvent.h deleted file mode 100644 index e6800bb2..00000000 --- a/src/libs/engine/events/DSSIControlEvent.h +++ /dev/null @@ -1,52 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DSSICONTROLEVENT_H -#define DSSICONTROLEVENT_H - -#include "QueuedEvent.h" -#include "DSSINode.h" - -namespace Ingen { - - -/** A control change event for a DSSI plugin. - * - * This does essentially the same thing as a SetPortValueEvent. - * - * \ingroup engine - */ -class DSSIControlEvent : public QueuedEvent -{ -public: - DSSIControlEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, int port_num, Sample val); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - string _node_path; - int _port_num; - float _val; - DSSINode* _node; -}; - - -} // namespace Ingen - -#endif // DSSICONTROLEVENT_H diff --git a/src/libs/engine/events/DSSIControlEvent.hpp b/src/libs/engine/events/DSSIControlEvent.hpp new file mode 100644 index 00000000..ab48607a --- /dev/null +++ b/src/libs/engine/events/DSSIControlEvent.hpp @@ -0,0 +1,52 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DSSICONTROLEVENT_H +#define DSSICONTROLEVENT_H + +#include "QueuedEvent.hpp" +#include "DSSINode.hpp" + +namespace Ingen { + + +/** A control change event for a DSSI plugin. + * + * This does essentially the same thing as a SetPortValueEvent. + * + * \ingroup engine + */ +class DSSIControlEvent : public QueuedEvent +{ +public: + DSSIControlEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, int port_num, Sample val); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + string _node_path; + int _port_num; + float _val; + DSSINode* _node; +}; + + +} // namespace Ingen + +#endif // DSSICONTROLEVENT_H diff --git a/src/libs/engine/events/DSSIProgramEvent.cpp b/src/libs/engine/events/DSSIProgramEvent.cpp index 436ab2c6..66ad9c1f 100644 --- a/src/libs/engine/events/DSSIProgramEvent.cpp +++ b/src/libs/engine/events/DSSIProgramEvent.cpp @@ -15,14 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DSSIProgramEvent.h" +#include "DSSIProgramEvent.hpp" #include #include -#include "Engine.h" -#include "Node.h" -#include "ClientBroadcaster.h" -#include "Plugin.h" -#include "ObjectStore.h" +#include "Engine.hpp" +#include "Node.hpp" +#include "ClientBroadcaster.hpp" +#include "Plugin.hpp" +#include "ObjectStore.hpp" using std::cout; using std::cerr; using std::endl; diff --git a/src/libs/engine/events/DSSIProgramEvent.h b/src/libs/engine/events/DSSIProgramEvent.h deleted file mode 100644 index 8acdea81..00000000 --- a/src/libs/engine/events/DSSIProgramEvent.h +++ /dev/null @@ -1,50 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DSSIPROGRAMEVENT_H -#define DSSIPROGRAMEVENT_H - -#include "QueuedEvent.h" -#include "DSSINode.h" - -namespace Ingen { - - -/** A program change for a DSSI plugin. - * - * \ingroup engine - */ -class DSSIProgramEvent : public QueuedEvent -{ -public: - DSSIProgramEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, int bank, int program); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - string _node_path; - int _bank; - int _program; - DSSINode* _node; -}; - - -} // namespace Ingen - -#endif // DSSIPROGRAMEVENT_H diff --git a/src/libs/engine/events/DSSIProgramEvent.hpp b/src/libs/engine/events/DSSIProgramEvent.hpp new file mode 100644 index 00000000..2f853961 --- /dev/null +++ b/src/libs/engine/events/DSSIProgramEvent.hpp @@ -0,0 +1,50 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DSSIPROGRAMEVENT_H +#define DSSIPROGRAMEVENT_H + +#include "QueuedEvent.hpp" +#include "DSSINode.hpp" + +namespace Ingen { + + +/** A program change for a DSSI plugin. + * + * \ingroup engine + */ +class DSSIProgramEvent : public QueuedEvent +{ +public: + DSSIProgramEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, int bank, int program); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + string _node_path; + int _bank; + int _program; + DSSINode* _node; +}; + + +} // namespace Ingen + +#endif // DSSIPROGRAMEVENT_H diff --git a/src/libs/engine/events/DSSIUpdateEvent.cpp b/src/libs/engine/events/DSSIUpdateEvent.cpp index 5851e065..055be90c 100644 --- a/src/libs/engine/events/DSSIUpdateEvent.cpp +++ b/src/libs/engine/events/DSSIUpdateEvent.cpp @@ -15,13 +15,13 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DSSIUpdateEvent.h" +#include "DSSIUpdateEvent.hpp" #include -#include "Node.h" -#include "ObjectStore.h" -#include "Engine.h" -#include "DSSINode.h" -#include "Plugin.h" +#include "Node.hpp" +#include "ObjectStore.hpp" +#include "Engine.hpp" +#include "DSSINode.hpp" +#include "Plugin.hpp" using std::cerr; using std::endl; diff --git a/src/libs/engine/events/DSSIUpdateEvent.h b/src/libs/engine/events/DSSIUpdateEvent.h deleted file mode 100644 index 8274bb71..00000000 --- a/src/libs/engine/events/DSSIUpdateEvent.h +++ /dev/null @@ -1,55 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DSSIUPDATEEVENT_H -#define DSSIUPDATEEVENT_H - -#include "QueuedEvent.h" -#include - -using std::string; - -namespace Ingen { - -class DSSINode; - - -/** A DSSI "update" responder for a DSSI plugin/node. - * - * This sends all information about the plugin to the UI (over OSC). - * - * \ingroup engine - */ -class DSSIUpdateEvent : public QueuedEvent -{ -public: - DSSIUpdateEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& url); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - string _path; - string _url; - DSSINode* _node; -}; - - -} // namespace Ingen - -#endif // DSSIUPDATEEVENT_H diff --git a/src/libs/engine/events/DSSIUpdateEvent.hpp b/src/libs/engine/events/DSSIUpdateEvent.hpp new file mode 100644 index 00000000..699df4c2 --- /dev/null +++ b/src/libs/engine/events/DSSIUpdateEvent.hpp @@ -0,0 +1,55 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DSSIUPDATEEVENT_H +#define DSSIUPDATEEVENT_H + +#include "QueuedEvent.hpp" +#include + +using std::string; + +namespace Ingen { + +class DSSINode; + + +/** A DSSI "update" responder for a DSSI plugin/node. + * + * This sends all information about the plugin to the UI (over OSC). + * + * \ingroup engine + */ +class DSSIUpdateEvent : public QueuedEvent +{ +public: + DSSIUpdateEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& url); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + string _path; + string _url; + DSSINode* _node; +}; + + +} // namespace Ingen + +#endif // DSSIUPDATEEVENT_H diff --git a/src/libs/engine/events/DeactivateEvent.cpp b/src/libs/engine/events/DeactivateEvent.cpp index e6440570..311cf287 100644 --- a/src/libs/engine/events/DeactivateEvent.cpp +++ b/src/libs/engine/events/DeactivateEvent.cpp @@ -15,9 +15,9 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DeactivateEvent.h" -#include "interface/Responder.h" -#include "Engine.h" +#include "DeactivateEvent.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" namespace Ingen { diff --git a/src/libs/engine/events/DeactivateEvent.h b/src/libs/engine/events/DeactivateEvent.h deleted file mode 100644 index 92276918..00000000 --- a/src/libs/engine/events/DeactivateEvent.h +++ /dev/null @@ -1,43 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DEACTIVATEEVENT_H -#define DEACTIVATEEVENT_H - -#include "QueuedEvent.h" - -namespace Ingen { - - -/** Deactivates the engine. - * - * \ingroup engine - */ -class DeactivateEvent : public QueuedEvent -{ -public: - DeactivateEvent(Engine& engine, SharedPtr responder, SampleCount timestamp); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); -}; - - -} // namespace Ingen - -#endif // DEACTIVATEEVENT_H diff --git a/src/libs/engine/events/DeactivateEvent.hpp b/src/libs/engine/events/DeactivateEvent.hpp new file mode 100644 index 00000000..1f87e271 --- /dev/null +++ b/src/libs/engine/events/DeactivateEvent.hpp @@ -0,0 +1,43 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DEACTIVATEEVENT_H +#define DEACTIVATEEVENT_H + +#include "QueuedEvent.hpp" + +namespace Ingen { + + +/** Deactivates the engine. + * + * \ingroup engine + */ +class DeactivateEvent : public QueuedEvent +{ +public: + DeactivateEvent(Engine& engine, SharedPtr responder, SampleCount timestamp); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); +}; + + +} // namespace Ingen + +#endif // DEACTIVATEEVENT_H diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp index ecccaa8a..dde2e86b 100644 --- a/src/libs/engine/events/DestroyEvent.cpp +++ b/src/libs/engine/events/DestroyEvent.cpp @@ -15,24 +15,24 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DestroyEvent.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "Patch.h" -#include "Tree.h" -#include "Node.h" -#include "Plugin.h" -#include "AudioDriver.h" -#include "MidiDriver.h" -#include "InternalNode.h" -#include "DisconnectNodeEvent.h" -#include "DisconnectPortEvent.h" -#include "ClientBroadcaster.h" -#include -#include "ObjectStore.h" -#include -#include "QueuedEventSource.h" -#include "Port.h" +#include "DestroyEvent.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "Patch.hpp" +#include "Tree.hpp" +#include "Node.hpp" +#include "Plugin.hpp" +#include "AudioDriver.hpp" +#include "MidiDriver.hpp" +#include "InternalNode.hpp" +#include "DisconnectNodeEvent.hpp" +#include "DisconnectPortEvent.hpp" +#include "ClientBroadcaster.hpp" +#include +#include "ObjectStore.hpp" +#include +#include "QueuedEventSource.hpp" +#include "Port.hpp" namespace Ingen { diff --git a/src/libs/engine/events/DestroyEvent.h b/src/libs/engine/events/DestroyEvent.h deleted file mode 100644 index 421a2dcd..00000000 --- a/src/libs/engine/events/DestroyEvent.h +++ /dev/null @@ -1,79 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DESTROYEVENT_H -#define DESTROYEVENT_H - -#include -#include -#include "QueuedEvent.h" - - -using std::string; - -namespace Raul { - template class Array; - template class ListNode; -} -template class TreeNode; - -namespace Ingen { - -class GraphObject; -class Patch; -class Node; -class Port; -class DriverPort; -class Plugin; -class DisconnectNodeEvent; -class DisconnectPortEvent; - - -/** An event to remove and delete a Node. - * - * \ingroup engine - */ -class DestroyEvent : public QueuedEvent -{ -public: - DestroyEvent(Engine& engine, SharedPtr responder, FrameTime timestamp, QueuedEventSource* source, const string& path, bool block = true); - DestroyEvent(Engine& engine, SharedPtr responder, FrameTime timestamp, QueuedEventSource* source, Node* node, bool block = true); - ~DestroyEvent(); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - Path _path; - GraphObject* _object; - Node* _node; ///< Same as _object if it is a Node, otherwise NULL - Port* _port; ///< Same as _object if it is a Port, otherwise NULL - DriverPort* _driver_port; - Raul::ListNode* _patch_node_listnode; - Raul::ListNode* _patch_port_listnode; - TreeNode* _store_treenode; - Raul::Array* _ports_array; ///< New (external) ports array for Patch - Raul::Array* _process_order; ///< Patch's new process order - DisconnectNodeEvent* _disconnect_node_event; - DisconnectPortEvent* _disconnect_port_event; -}; - - -} // namespace Ingen - -#endif // DESTROYEVENT_H diff --git a/src/libs/engine/events/DestroyEvent.hpp b/src/libs/engine/events/DestroyEvent.hpp new file mode 100644 index 00000000..6495258e --- /dev/null +++ b/src/libs/engine/events/DestroyEvent.hpp @@ -0,0 +1,79 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DESTROYEVENT_H +#define DESTROYEVENT_H + +#include +#include +#include "QueuedEvent.hpp" + + +using std::string; + +namespace Raul { + template class Array; + template class ListNode; +} +template class TreeNode; + +namespace Ingen { + +class GraphObject; +class Patch; +class Node; +class Port; +class DriverPort; +class Plugin; +class DisconnectNodeEvent; +class DisconnectPortEvent; + + +/** An event to remove and delete a Node. + * + * \ingroup engine + */ +class DestroyEvent : public QueuedEvent +{ +public: + DestroyEvent(Engine& engine, SharedPtr responder, FrameTime timestamp, QueuedEventSource* source, const string& path, bool block = true); + DestroyEvent(Engine& engine, SharedPtr responder, FrameTime timestamp, QueuedEventSource* source, Node* node, bool block = true); + ~DestroyEvent(); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + Path _path; + GraphObject* _object; + Node* _node; ///< Same as _object if it is a Node, otherwise NULL + Port* _port; ///< Same as _object if it is a Port, otherwise NULL + DriverPort* _driver_port; + Raul::ListNode* _patch_node_listnode; + Raul::ListNode* _patch_port_listnode; + TreeNode* _store_treenode; + Raul::Array* _ports_array; ///< New (external) ports array for Patch + Raul::Array* _process_order; ///< Patch's new process order + DisconnectNodeEvent* _disconnect_node_event; + DisconnectPortEvent* _disconnect_port_event; +}; + + +} // namespace Ingen + +#endif // DESTROYEVENT_H diff --git a/src/libs/engine/events/DisablePatchEvent.cpp b/src/libs/engine/events/DisablePatchEvent.cpp index ce78cf7e..80ea96fa 100644 --- a/src/libs/engine/events/DisablePatchEvent.cpp +++ b/src/libs/engine/events/DisablePatchEvent.cpp @@ -15,14 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DisablePatchEvent.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "Patch.h" -#include "ClientBroadcaster.h" -#include "util.h" -#include "ObjectStore.h" -#include "Port.h" +#include "DisablePatchEvent.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "Patch.hpp" +#include "ClientBroadcaster.hpp" +#include "util.hpp" +#include "ObjectStore.hpp" +#include "Port.hpp" namespace Ingen { diff --git a/src/libs/engine/events/DisablePatchEvent.h b/src/libs/engine/events/DisablePatchEvent.h deleted file mode 100644 index 1999ece0..00000000 --- a/src/libs/engine/events/DisablePatchEvent.h +++ /dev/null @@ -1,53 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DISABLEPATCHEVENT_H -#define DISABLEPATCHEVENT_H - -#include -#include "QueuedEvent.h" - -using std::string; - -namespace Ingen { - -class Patch; - - -/** Disables a Patch's DSP processing. - * - * \ingroup engine - */ -class DisablePatchEvent : public QueuedEvent -{ -public: - DisablePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - string _patch_path; - Patch* _patch; -}; - - -} // namespace Ingen - - -#endif // DISABLEPATCHEVENT_H diff --git a/src/libs/engine/events/DisablePatchEvent.hpp b/src/libs/engine/events/DisablePatchEvent.hpp new file mode 100644 index 00000000..1552fffe --- /dev/null +++ b/src/libs/engine/events/DisablePatchEvent.hpp @@ -0,0 +1,53 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DISABLEPATCHEVENT_H +#define DISABLEPATCHEVENT_H + +#include +#include "QueuedEvent.hpp" + +using std::string; + +namespace Ingen { + +class Patch; + + +/** Disables a Patch's DSP processing. + * + * \ingroup engine + */ +class DisablePatchEvent : public QueuedEvent +{ +public: + DisablePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + string _patch_path; + Patch* _patch; +}; + + +} // namespace Ingen + + +#endif // DISABLEPATCHEVENT_H diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp index bc97dff4..abdad386 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.cpp +++ b/src/libs/engine/events/DisconnectNodeEvent.cpp @@ -15,24 +15,24 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DisconnectNodeEvent.h" +#include "DisconnectNodeEvent.hpp" #include -#include -#include -#include -#include "interface/Responder.h" -#include "Engine.h" -#include "Node.h" -#include "Connection.h" -#include "DisconnectionEvent.h" -#include "Port.h" -#include "InputPort.h" -#include "OutputPort.h" -#include "Patch.h" -#include "ClientBroadcaster.h" -#include "util.h" -#include "ObjectStore.h" -#include +#include +#include +#include +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "Node.hpp" +#include "Connection.hpp" +#include "DisconnectionEvent.hpp" +#include "Port.hpp" +#include "InputPort.hpp" +#include "OutputPort.hpp" +#include "Patch.hpp" +#include "ClientBroadcaster.hpp" +#include "util.hpp" +#include "ObjectStore.hpp" +#include using std::cerr; using std::endl; diff --git a/src/libs/engine/events/DisconnectNodeEvent.h b/src/libs/engine/events/DisconnectNodeEvent.h deleted file mode 100644 index a70f9e8c..00000000 --- a/src/libs/engine/events/DisconnectNodeEvent.h +++ /dev/null @@ -1,69 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DISCONNECTNODEEVENT_H -#define DISCONNECTNODEEVENT_H - -#include -#include -#include -#include "QueuedEvent.h" - -using std::string; - -namespace Ingen { - -class DisconnectionEvent; -class Patch; -class Node; -class Connection; -class Port; -class InputPort; -class OutputPort; - - -/** An event to disconnect all connections to a Node. - * - * \ingroup engine - */ -class DisconnectNodeEvent : public QueuedEvent -{ -public: - DisconnectNodeEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path); - DisconnectNodeEvent(Engine& engine, Node* node); - ~DisconnectNodeEvent(); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - Path _node_path; - Patch* _patch; - Node* _node; - Raul::List _disconnection_events; - - bool _succeeded; - bool _lookup; - bool _disconnect_parent; -}; - - -} // namespace Ingen - - -#endif // DISCONNECTNODEEVENT_H diff --git a/src/libs/engine/events/DisconnectNodeEvent.hpp b/src/libs/engine/events/DisconnectNodeEvent.hpp new file mode 100644 index 00000000..e14f87fa --- /dev/null +++ b/src/libs/engine/events/DisconnectNodeEvent.hpp @@ -0,0 +1,69 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DISCONNECTNODEEVENT_H +#define DISCONNECTNODEEVENT_H + +#include +#include +#include +#include "QueuedEvent.hpp" + +using std::string; + +namespace Ingen { + +class DisconnectionEvent; +class Patch; +class Node; +class Connection; +class Port; +class InputPort; +class OutputPort; + + +/** An event to disconnect all connections to a Node. + * + * \ingroup engine + */ +class DisconnectNodeEvent : public QueuedEvent +{ +public: + DisconnectNodeEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path); + DisconnectNodeEvent(Engine& engine, Node* node); + ~DisconnectNodeEvent(); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + Path _node_path; + Patch* _patch; + Node* _node; + Raul::List _disconnection_events; + + bool _succeeded; + bool _lookup; + bool _disconnect_parent; +}; + + +} // namespace Ingen + + +#endif // DISCONNECTNODEEVENT_H diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp index 1373d9b8..0956ca8f 100644 --- a/src/libs/engine/events/DisconnectPortEvent.cpp +++ b/src/libs/engine/events/DisconnectPortEvent.cpp @@ -16,23 +16,23 @@ */ #include -#include -#include -#include -#include -#include "interface/Responder.h" -#include "Engine.h" -#include "Node.h" -#include "Connection.h" -#include "DisconnectionEvent.h" -#include "Port.h" -#include "InputPort.h" -#include "OutputPort.h" -#include "Patch.h" -#include "ClientBroadcaster.h" -#include "util.h" -#include "ObjectStore.h" -#include "DisconnectPortEvent.h" +#include +#include +#include +#include +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "Node.hpp" +#include "Connection.hpp" +#include "DisconnectionEvent.hpp" +#include "Port.hpp" +#include "InputPort.hpp" +#include "OutputPort.hpp" +#include "Patch.hpp" +#include "ClientBroadcaster.hpp" +#include "util.hpp" +#include "ObjectStore.hpp" +#include "DisconnectPortEvent.hpp" using std::cerr; using std::endl; diff --git a/src/libs/engine/events/DisconnectPortEvent.h b/src/libs/engine/events/DisconnectPortEvent.h deleted file mode 100644 index 647ee1da..00000000 --- a/src/libs/engine/events/DisconnectPortEvent.h +++ /dev/null @@ -1,71 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DISCONNECTPORTEVENT_H -#define DISCONNECTPORTEVENT_H - -#include -#include -#include "QueuedEvent.h" -#include - -namespace Raul { template class Array; } - -namespace Ingen { - - -class Patch; -class Node; -class Connection; -class Port; -class DisconnectionEvent; - -using std::string; - - -/** An event to disconnect all connections to a Port. - * - * \ingroup engine - */ -class DisconnectPortEvent : public QueuedEvent -{ -public: - DisconnectPortEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path); - DisconnectPortEvent(Engine& engine, Port* port); - ~DisconnectPortEvent(); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - Path _port_path; - Patch* _patch; - Port* _port; - Raul::List _disconnection_events; - - Raul::Array* _process_order; // Patch's new process order - - bool _succeeded; - bool _lookup; -}; - - -} // namespace Ingen - - -#endif // DISCONNECTPORTEVENT_H diff --git a/src/libs/engine/events/DisconnectPortEvent.hpp b/src/libs/engine/events/DisconnectPortEvent.hpp new file mode 100644 index 00000000..95644098 --- /dev/null +++ b/src/libs/engine/events/DisconnectPortEvent.hpp @@ -0,0 +1,71 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DISCONNECTPORTEVENT_H +#define DISCONNECTPORTEVENT_H + +#include +#include +#include "QueuedEvent.hpp" +#include + +namespace Raul { template class Array; } + +namespace Ingen { + + +class Patch; +class Node; +class Connection; +class Port; +class DisconnectionEvent; + +using std::string; + + +/** An event to disconnect all connections to a Port. + * + * \ingroup engine + */ +class DisconnectPortEvent : public QueuedEvent +{ +public: + DisconnectPortEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path); + DisconnectPortEvent(Engine& engine, Port* port); + ~DisconnectPortEvent(); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + Path _port_path; + Patch* _patch; + Port* _port; + Raul::List _disconnection_events; + + Raul::Array* _process_order; // Patch's new process order + + bool _succeeded; + bool _lookup; +}; + + +} // namespace Ingen + + +#endif // DISCONNECTPORTEVENT_H diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp index 2fafb98e..ba35f84e 100644 --- a/src/libs/engine/events/DisconnectionEvent.cpp +++ b/src/libs/engine/events/DisconnectionEvent.cpp @@ -15,19 +15,19 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DisconnectionEvent.h" +#include "DisconnectionEvent.hpp" #include -#include -#include -#include "interface/Responder.h" -#include "Engine.h" -#include "Connection.h" -#include "InputPort.h" -#include "OutputPort.h" -#include "Patch.h" -#include "ClientBroadcaster.h" -#include "Port.h" -#include "ObjectStore.h" +#include +#include +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "Connection.hpp" +#include "InputPort.hpp" +#include "OutputPort.hpp" +#include "Patch.hpp" +#include "ClientBroadcaster.hpp" +#include "Port.hpp" +#include "ObjectStore.hpp" using std::string; namespace Ingen { diff --git a/src/libs/engine/events/DisconnectionEvent.h b/src/libs/engine/events/DisconnectionEvent.h deleted file mode 100644 index 23f1526e..00000000 --- a/src/libs/engine/events/DisconnectionEvent.h +++ /dev/null @@ -1,89 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef DISCONNECTIONEVENT_H -#define DISCONNECTIONEVENT_H - -#include -#include -#include "QueuedEvent.h" -#include "types.h" -using std::string; - -namespace Raul { - template class ListNode; - template class Array; -} - -namespace Ingen { - -class Patch; -class Node; -class Connection; -class MidiMessage; -class Port; -class Connection; -class InputPort; -class OutputPort; - - -/** Make a Connection between two Ports. - * - * \ingroup engine - */ -class DisconnectionEvent : public QueuedEvent -{ -public: - DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path); - DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Port* const src_port, Port* const dst_port); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - - enum ErrorType { - NO_ERROR, - PARENT_PATCH_DIFFERENT, - PORT_NOT_FOUND, - TYPE_MISMATCH, - NOT_CONNECTED, - PARENTS_NOT_FOUND, - CONNECTION_NOT_FOUND - }; - - Path _src_port_path; - Path _dst_port_path; - - Patch* _patch; - Port* _src_port; - Port* _dst_port; - OutputPort* _src_output_port; - InputPort* _dst_input_port; - - bool _lookup; - - Raul::Array* _process_order; ///< New process order for Patch - - ErrorType _error; -}; - - -} // namespace Ingen - -#endif // DISCONNECTIONEVENT_H diff --git a/src/libs/engine/events/DisconnectionEvent.hpp b/src/libs/engine/events/DisconnectionEvent.hpp new file mode 100644 index 00000000..9c5b7490 --- /dev/null +++ b/src/libs/engine/events/DisconnectionEvent.hpp @@ -0,0 +1,89 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DISCONNECTIONEVENT_H +#define DISCONNECTIONEVENT_H + +#include +#include +#include "QueuedEvent.hpp" +#include "types.hpp" +using std::string; + +namespace Raul { + template class ListNode; + template class Array; +} + +namespace Ingen { + +class Patch; +class Node; +class Connection; +class MidiMessage; +class Port; +class Connection; +class InputPort; +class OutputPort; + + +/** Make a Connection between two Ports. + * + * \ingroup engine + */ +class DisconnectionEvent : public QueuedEvent +{ +public: + DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path); + DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Port* const src_port, Port* const dst_port); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + + enum ErrorType { + NO_ERROR, + PARENT_PATCH_DIFFERENT, + PORT_NOT_FOUND, + TYPE_MISMATCH, + NOT_CONNECTED, + PARENTS_NOT_FOUND, + CONNECTION_NOT_FOUND + }; + + Path _src_port_path; + Path _dst_port_path; + + Patch* _patch; + Port* _src_port; + Port* _dst_port; + OutputPort* _src_output_port; + InputPort* _dst_input_port; + + bool _lookup; + + Raul::Array* _process_order; ///< New process order for Patch + + ErrorType _error; +}; + + +} // namespace Ingen + +#endif // DISCONNECTIONEVENT_H diff --git a/src/libs/engine/events/EnablePatchEvent.cpp b/src/libs/engine/events/EnablePatchEvent.cpp index 74d4a52b..1921b301 100644 --- a/src/libs/engine/events/EnablePatchEvent.cpp +++ b/src/libs/engine/events/EnablePatchEvent.cpp @@ -15,13 +15,13 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "EnablePatchEvent.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "Patch.h" -#include "util.h" -#include "ClientBroadcaster.h" -#include "ObjectStore.h" +#include "EnablePatchEvent.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "Patch.hpp" +#include "util.hpp" +#include "ClientBroadcaster.hpp" +#include "ObjectStore.hpp" namespace Ingen { diff --git a/src/libs/engine/events/EnablePatchEvent.h b/src/libs/engine/events/EnablePatchEvent.h deleted file mode 100644 index c63c9db3..00000000 --- a/src/libs/engine/events/EnablePatchEvent.h +++ /dev/null @@ -1,57 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef ENABLEPATCHEVENT_H -#define ENABLEPATCHEVENT_H - -#include -#include "QueuedEvent.h" - -using std::string; - -namespace Raul { template class Array; } - -namespace Ingen { - -class Patch; -class Node; - - -/** Enables a patch's DSP processing. - * - * \ingroup engine - */ -class EnablePatchEvent : public QueuedEvent -{ -public: - EnablePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - string _patch_path; - Patch* _patch; - Raul::Array* _process_order; // Patch's new process order -}; - - -} // namespace Ingen - - -#endif // ENABLEPATCHEVENT_H diff --git a/src/libs/engine/events/EnablePatchEvent.hpp b/src/libs/engine/events/EnablePatchEvent.hpp new file mode 100644 index 00000000..0a74c082 --- /dev/null +++ b/src/libs/engine/events/EnablePatchEvent.hpp @@ -0,0 +1,57 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef ENABLEPATCHEVENT_H +#define ENABLEPATCHEVENT_H + +#include +#include "QueuedEvent.hpp" + +using std::string; + +namespace Raul { template class Array; } + +namespace Ingen { + +class Patch; +class Node; + + +/** Enables a patch's DSP processing. + * + * \ingroup engine + */ +class EnablePatchEvent : public QueuedEvent +{ +public: + EnablePatchEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& patch_path); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + string _patch_path; + Patch* _patch; + Raul::Array* _process_order; // Patch's new process order +}; + + +} // namespace Ingen + + +#endif // ENABLEPATCHEVENT_H diff --git a/src/libs/engine/events/LoadPluginsEvent.cpp b/src/libs/engine/events/LoadPluginsEvent.cpp index b06d1817..04db153c 100644 --- a/src/libs/engine/events/LoadPluginsEvent.cpp +++ b/src/libs/engine/events/LoadPluginsEvent.cpp @@ -15,12 +15,12 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "LoadPluginsEvent.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "NodeFactory.h" -#include "ClientBroadcaster.h" -#include "QueuedEventSource.h" +#include "LoadPluginsEvent.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "NodeFactory.hpp" +#include "ClientBroadcaster.hpp" +#include "QueuedEventSource.hpp" #include using std::cerr; diff --git a/src/libs/engine/events/LoadPluginsEvent.h b/src/libs/engine/events/LoadPluginsEvent.h deleted file mode 100644 index e56de796..00000000 --- a/src/libs/engine/events/LoadPluginsEvent.h +++ /dev/null @@ -1,48 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef LOADPLUGINSEVENT_H -#define LOADPLUGINSEVENT_H - -#include -#include "QueuedEvent.h" - -namespace Ingen { - -class Plugin; - - -/** Loads all plugins into the internal plugin database (in NodeFactory). - * - * \ingroup engine - */ -class LoadPluginsEvent : public QueuedEvent -{ -public: - LoadPluginsEvent(Engine& engine, - SharedPtr responder, - SampleCount timestamp, - QueuedEventSource* source); - - void pre_process(); - void post_process(); -}; - - -} // namespace Ingen - -#endif // LOADPLUGINSEVENT_H diff --git a/src/libs/engine/events/LoadPluginsEvent.hpp b/src/libs/engine/events/LoadPluginsEvent.hpp new file mode 100644 index 00000000..c6f886f7 --- /dev/null +++ b/src/libs/engine/events/LoadPluginsEvent.hpp @@ -0,0 +1,48 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LOADPLUGINSEVENT_H +#define LOADPLUGINSEVENT_H + +#include +#include "QueuedEvent.hpp" + +namespace Ingen { + +class Plugin; + + +/** Loads all plugins into the internal plugin database (in NodeFactory). + * + * \ingroup engine + */ +class LoadPluginsEvent : public QueuedEvent +{ +public: + LoadPluginsEvent(Engine& engine, + SharedPtr responder, + SampleCount timestamp, + QueuedEventSource* source); + + void pre_process(); + void post_process(); +}; + + +} // namespace Ingen + +#endif // LOADPLUGINSEVENT_H diff --git a/src/libs/engine/events/Makefile.am b/src/libs/engine/events/Makefile.am index e54c527a..bc698678 100644 --- a/src/libs/engine/events/Makefile.am +++ b/src/libs/engine/events/Makefile.am @@ -1,69 +1,69 @@ MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST = \ - RegisterClientEvent.h \ - RegisterClientEvent.cpp \ - UnregisterClientEvent.h \ - UnregisterClientEvent.cpp \ - PingQueuedEvent.h \ - DeactivateEvent.h \ - DeactivateEvent.cpp \ - SetPortValueEvent.h \ - SetPortValueEvent.cpp \ - SetPortValueQueuedEvent.h \ - SetPortValueQueuedEvent.cpp \ - NoteOnEvent.h \ - NoteOnEvent.cpp \ - NoteOffEvent.h \ - NoteOffEvent.cpp \ - AllNotesOffEvent.h \ + AddNodeEvent.cpp \ + AddNodeEvent.hpp \ AllNotesOffEvent.cpp \ - ConnectionEvent.h \ + AllNotesOffEvent.hpp \ + ClearPatchEvent.cpp \ + ClearPatchEvent.hpp \ ConnectionEvent.cpp \ - DisconnectionEvent.h \ - DisconnectionEvent.cpp \ - DisconnectNodeEvent.h \ - DisconnectNodeEvent.cpp \ - DisconnectPortEvent.h \ - DisconnectPortEvent.cpp \ - DestroyEvent.h \ - DestroyEvent.cpp \ - AddNodeEvent.h \ - AddNodeEvent.cpp \ - SetMetadataEvent.h \ - SetMetadataEvent.cpp \ - RequestMetadataEvent.h \ - RequestMetadataEvent.cpp \ - RequestPluginEvent.h \ - RequestPluginEvent.cpp \ - RequestObjectEvent.h \ - RequestObjectEvent.cpp \ - RequestPortValueEvent.h \ - RequestPortValueEvent.cpp \ - RequestAllObjectsEvent.h \ - RequestAllObjectsEvent.cpp \ - RequestPluginsEvent.h \ - RequestPluginsEvent.cpp \ - CreatePatchEvent.h \ + ConnectionEvent.hpp \ CreatePatchEvent.cpp \ - LoadPluginsEvent.h \ - LoadPluginsEvent.cpp \ - EnablePatchEvent.h \ - EnablePatchEvent.cpp \ - DisablePatchEvent.h \ - DisablePatchEvent.cpp \ - ClearPatchEvent.h \ - ClearPatchEvent.cpp \ - RenameEvent.h \ - RenameEvent.cpp \ - MidiLearnEvent.h \ - MidiLearnEvent.cpp \ + CreatePatchEvent.hpp \ DSSIConfigureEvent.cpp \ - DSSIConfigureEvent.h \ + DSSIConfigureEvent.hpp \ DSSIControlEvent.cpp \ - DSSIControlEvent.h \ + DSSIControlEvent.hpp \ DSSIProgramEvent.cpp \ - DSSIProgramEvent.h \ + DSSIProgramEvent.hpp \ DSSIUpdateEvent.cpp \ - DSSIUpdateEvent.h + DSSIUpdateEvent.hpp \ + DeactivateEvent.cpp \ + DeactivateEvent.hpp \ + DestroyEvent.cpp \ + DestroyEvent.hpp \ + DisablePatchEvent.cpp \ + DisablePatchEvent.hpp \ + DisconnectNodeEvent.cpp \ + DisconnectNodeEvent.hpp \ + DisconnectPortEvent.cpp \ + DisconnectPortEvent.hpp \ + DisconnectionEvent.cpp \ + DisconnectionEvent.hpp \ + EnablePatchEvent.cpp \ + EnablePatchEvent.hpp \ + LoadPluginsEvent.cpp \ + LoadPluginsEvent.hpp \ + MidiLearnEvent.cpp \ + MidiLearnEvent.hpp \ + NoteOffEvent.cpp \ + NoteOffEvent.hpp \ + NoteOnEvent.cpp \ + NoteOnEvent.hpp \ + PingQueuedEvent.hpp \ + RegisterClientEvent.cpp \ + RegisterClientEvent.hpp \ + RenameEvent.cpp \ + RenameEvent.hpp \ + RequestAllObjectsEvent.cpp \ + RequestAllObjectsEvent.hpp \ + RequestMetadataEvent.cpp \ + RequestMetadataEvent.hpp \ + RequestObjectEvent.cpp \ + RequestObjectEvent.hpp \ + RequestPluginEvent.cpp \ + RequestPluginEvent.hpp \ + RequestPluginsEvent.cpp \ + RequestPluginsEvent.hpp \ + RequestPortValueEvent.cpp \ + RequestPortValueEvent.hpp \ + SetMetadataEvent.cpp \ + SetMetadataEvent.hpp \ + SetPortValueEvent.cpp \ + SetPortValueEvent.hpp \ + SetPortValueQueuedEvent.cpp \ + SetPortValueQueuedEvent.hpp \ + UnregisterClientEvent.cpp \ + UnregisterClientEvent.hpp diff --git a/src/libs/engine/events/MidiLearnEvent.cpp b/src/libs/engine/events/MidiLearnEvent.cpp index 6204ed4a..8bc05b4f 100644 --- a/src/libs/engine/events/MidiLearnEvent.cpp +++ b/src/libs/engine/events/MidiLearnEvent.cpp @@ -15,13 +15,13 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "MidiLearnEvent.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "ObjectStore.h" -#include "Node.h" -#include "MidiControlNode.h" -#include "ClientBroadcaster.h" +#include "MidiLearnEvent.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "ObjectStore.hpp" +#include "Node.hpp" +#include "MidiControlNode.hpp" +#include "ClientBroadcaster.hpp" namespace Ingen { diff --git a/src/libs/engine/events/MidiLearnEvent.h b/src/libs/engine/events/MidiLearnEvent.h deleted file mode 100644 index d28413c7..00000000 --- a/src/libs/engine/events/MidiLearnEvent.h +++ /dev/null @@ -1,85 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MIDILEARNEVENT_H -#define MIDILEARNEVENT_H - -#include "QueuedEvent.h" -#include "MidiControlNode.h" -#include "types.h" -#include -using std::string; - -namespace Ingen { - -class Node; -class ControlChangeEvent; - - -/** Response event for a MIDI learn. - * - * This is a trivial event that sends a control change in it's post_process - * method (used by MidiLearnEvent to notify clients when the learn happens) - */ -class MidiLearnResponseEvent : public Event -{ -public: - MidiLearnResponseEvent(Engine& engine, const string& port_path, SampleCount timestamp) - : Event(engine, SharedPtr(), timestamp), - _port_path(port_path), - _value(0.0f) - {} - - void set_value(Sample val) { _value = val; } - void post_process(); - -private: - string _port_path; - Sample _value; -}; - - - -/** A MIDI learn event. - * - * This creates a MidiLearnResponseEvent and passes it to the learning node, which - * will push it to the post-processor once the learn happens in order to reply - * to the client with the new port (learned controller) value. - * - * \ingroup engine - */ -class MidiLearnEvent : public QueuedEvent -{ -public: - MidiLearnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - string _node_path; - Node* _node; - - /// Event to respond with when learned - MidiLearnResponseEvent* _response_event; -}; - - -} // namespace Ingen - -#endif // MIDILEARNEVENT_H diff --git a/src/libs/engine/events/MidiLearnEvent.hpp b/src/libs/engine/events/MidiLearnEvent.hpp new file mode 100644 index 00000000..c5a0902f --- /dev/null +++ b/src/libs/engine/events/MidiLearnEvent.hpp @@ -0,0 +1,85 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MIDILEARNEVENT_H +#define MIDILEARNEVENT_H + +#include "QueuedEvent.hpp" +#include "MidiControlNode.hpp" +#include "types.hpp" +#include +using std::string; + +namespace Ingen { + +class Node; +class ControlChangeEvent; + + +/** Response event for a MIDI learn. + * + * This is a trivial event that sends a control change in it's post_process + * method (used by MidiLearnEvent to notify clients when the learn happens) + */ +class MidiLearnResponseEvent : public Event +{ +public: + MidiLearnResponseEvent(Engine& engine, const string& port_path, SampleCount timestamp) + : Event(engine, SharedPtr(), timestamp), + _port_path(port_path), + _value(0.0f) + {} + + void set_value(Sample val) { _value = val; } + void post_process(); + +private: + string _port_path; + Sample _value; +}; + + + +/** A MIDI learn event. + * + * This creates a MidiLearnResponseEvent and passes it to the learning node, which + * will push it to the post-processor once the learn happens in order to reply + * to the client with the new port (learned controller) value. + * + * \ingroup engine + */ +class MidiLearnEvent : public QueuedEvent +{ +public: + MidiLearnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + string _node_path; + Node* _node; + + /// Event to respond with when learned + MidiLearnResponseEvent* _response_event; +}; + + +} // namespace Ingen + +#endif // MIDILEARNEVENT_H diff --git a/src/libs/engine/events/NoteOffEvent.cpp b/src/libs/engine/events/NoteOffEvent.cpp index cb081534..a8da7669 100644 --- a/src/libs/engine/events/NoteOffEvent.cpp +++ b/src/libs/engine/events/NoteOffEvent.cpp @@ -15,13 +15,13 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "NoteOffEvent.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "ObjectStore.h" -#include "Node.h" -#include "MidiNoteNode.h" -#include "MidiTriggerNode.h" +#include "NoteOffEvent.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "ObjectStore.hpp" +#include "Node.hpp" +#include "MidiNoteNode.hpp" +#include "MidiTriggerNode.hpp" namespace Ingen { diff --git a/src/libs/engine/events/NoteOffEvent.h b/src/libs/engine/events/NoteOffEvent.h deleted file mode 100644 index 423ddcdc..00000000 --- a/src/libs/engine/events/NoteOffEvent.h +++ /dev/null @@ -1,53 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef NOTEOFFEVENT_H -#define NOTEOFFEVENT_H - -#include "Event.h" -#include "types.h" -#include -using std::string; - -namespace Ingen { - -class Node; - - -/** A note off event. - * - * \ingroup engine - */ -class NoteOffEvent : public Event -{ -public: - NoteOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* node, uchar note_num); - NoteOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, uchar note_num); - - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - Node* _node; - string _node_path; - uchar _note_num; -}; - - -} // namespace Ingen - -#endif // NOTEOFFEVENT_H diff --git a/src/libs/engine/events/NoteOffEvent.hpp b/src/libs/engine/events/NoteOffEvent.hpp new file mode 100644 index 00000000..4186cbed --- /dev/null +++ b/src/libs/engine/events/NoteOffEvent.hpp @@ -0,0 +1,53 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef NOTEOFFEVENT_H +#define NOTEOFFEVENT_H + +#include "Event.hpp" +#include "types.hpp" +#include +using std::string; + +namespace Ingen { + +class Node; + + +/** A note off event. + * + * \ingroup engine + */ +class NoteOffEvent : public Event +{ +public: + NoteOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* node, uchar note_num); + NoteOffEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, uchar note_num); + + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + Node* _node; + string _node_path; + uchar _note_num; +}; + + +} // namespace Ingen + +#endif // NOTEOFFEVENT_H diff --git a/src/libs/engine/events/NoteOnEvent.cpp b/src/libs/engine/events/NoteOnEvent.cpp index 313dbccd..5bd57d93 100644 --- a/src/libs/engine/events/NoteOnEvent.cpp +++ b/src/libs/engine/events/NoteOnEvent.cpp @@ -15,14 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "NoteOnEvent.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "ObjectStore.h" -#include "Node.h" -#include "MidiNoteNode.h" -#include "MidiTriggerNode.h" -#include "Plugin.h" +#include "NoteOnEvent.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "ObjectStore.hpp" +#include "Node.hpp" +#include "MidiNoteNode.hpp" +#include "MidiTriggerNode.hpp" +#include "Plugin.hpp" namespace Ingen { diff --git a/src/libs/engine/events/NoteOnEvent.h b/src/libs/engine/events/NoteOnEvent.h deleted file mode 100644 index a3ee4210..00000000 --- a/src/libs/engine/events/NoteOnEvent.h +++ /dev/null @@ -1,55 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef NOTEONEVENT_H -#define NOTEONEVENT_H - -#include "Event.h" -#include "types.h" -#include -using std::string; - -namespace Ingen { - -class Node; - - -/** A note on event. - * - * \ingroup engine - */ -class NoteOnEvent : public Event -{ -public: - NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity); - NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity); - - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - Node* _node; - string _node_path; - uchar _note_num; - uchar _velocity; - bool _is_osc_triggered; -}; - - -} // namespace Ingen - -#endif // NOTEONEVENT_H diff --git a/src/libs/engine/events/NoteOnEvent.hpp b/src/libs/engine/events/NoteOnEvent.hpp new file mode 100644 index 00000000..3a641a55 --- /dev/null +++ b/src/libs/engine/events/NoteOnEvent.hpp @@ -0,0 +1,55 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef NOTEONEVENT_H +#define NOTEONEVENT_H + +#include "Event.hpp" +#include "types.hpp" +#include +using std::string; + +namespace Ingen { + +class Node; + + +/** A note on event. + * + * \ingroup engine + */ +class NoteOnEvent : public Event +{ +public: + NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity); + NoteOnEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity); + + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + Node* _node; + string _node_path; + uchar _note_num; + uchar _velocity; + bool _is_osc_triggered; +}; + + +} // namespace Ingen + +#endif // NOTEONEVENT_H diff --git a/src/libs/engine/events/PingQueuedEvent.h b/src/libs/engine/events/PingQueuedEvent.h deleted file mode 100644 index 3d331ccf..00000000 --- a/src/libs/engine/events/PingQueuedEvent.h +++ /dev/null @@ -1,48 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PINGQUEUEDEVENT_H -#define PINGQUEUEDEVENT_H - -#include "QueuedEvent.h" -#include "types.h" -#include "interface/Responder.h" - -namespace Ingen { - -class Port; - - -/** A ping that travels through the pre-processed event queue before responding - * (useful for the order guarantee). - * - * \ingroup engine - */ -class PingQueuedEvent : public QueuedEvent -{ -public: - PingQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp) - : QueuedEvent(engine, responder, timestamp) - {} - - void post_process() { _responder->respond_ok(); } -}; - - -} // namespace Ingen - -#endif // PINGQUEUEDEVENT_H diff --git a/src/libs/engine/events/PingQueuedEvent.hpp b/src/libs/engine/events/PingQueuedEvent.hpp new file mode 100644 index 00000000..9712a904 --- /dev/null +++ b/src/libs/engine/events/PingQueuedEvent.hpp @@ -0,0 +1,48 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PINGQUEUEDEVENT_H +#define PINGQUEUEDEVENT_H + +#include "QueuedEvent.hpp" +#include "types.hpp" +#include "interface/Responder.hpp" + +namespace Ingen { + +class Port; + + +/** A ping that travels through the pre-processed event queue before responding + * (useful for the order guarantee). + * + * \ingroup engine + */ +class PingQueuedEvent : public QueuedEvent +{ +public: + PingQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp) + : QueuedEvent(engine, responder, timestamp) + {} + + void post_process() { _responder->respond_ok(); } +}; + + +} // namespace Ingen + +#endif // PINGQUEUEDEVENT_H diff --git a/src/libs/engine/events/RegisterClientEvent.cpp b/src/libs/engine/events/RegisterClientEvent.cpp index 3ba36cc7..ace2b3e0 100644 --- a/src/libs/engine/events/RegisterClientEvent.cpp +++ b/src/libs/engine/events/RegisterClientEvent.cpp @@ -15,10 +15,10 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "interface/Responder.h" -#include "RegisterClientEvent.h" -#include "Engine.h" -#include "ClientBroadcaster.h" +#include "interface/Responder.hpp" +#include "RegisterClientEvent.hpp" +#include "Engine.hpp" +#include "ClientBroadcaster.hpp" namespace Ingen { diff --git a/src/libs/engine/events/RegisterClientEvent.h b/src/libs/engine/events/RegisterClientEvent.h deleted file mode 100644 index f32093a4..00000000 --- a/src/libs/engine/events/RegisterClientEvent.h +++ /dev/null @@ -1,57 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef REGISTERCLIENTEVENT_H -#define REGISTERCLIENTEVENT_H - -#include "QueuedEvent.h" -#include "interface/ClientKey.h" -#include "interface/ClientInterface.h" -#include -using std::string; -using Ingen::Shared::ClientInterface; -using Ingen::Shared::ClientKey; -using Ingen::Shared::Responder; - -namespace Ingen { - - -/** Registers a new client with the OSC system, so it can receive updates. - * - * \ingroup engine - */ -class RegisterClientEvent : public QueuedEvent -{ -public: - RegisterClientEvent(Engine& engine, - SharedPtr responder, - SampleCount timestamp, - ClientKey key, - SharedPtr client); - - void pre_process(); - void post_process(); - -private: - ClientKey _key; - SharedPtr _client; -}; - - -} // namespace Ingen - -#endif // REGISTERCLIENTEVENT_H diff --git a/src/libs/engine/events/RegisterClientEvent.hpp b/src/libs/engine/events/RegisterClientEvent.hpp new file mode 100644 index 00000000..be02fd41 --- /dev/null +++ b/src/libs/engine/events/RegisterClientEvent.hpp @@ -0,0 +1,57 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef REGISTERCLIENTEVENT_H +#define REGISTERCLIENTEVENT_H + +#include "QueuedEvent.hpp" +#include "interface/ClientKey.hpp" +#include "interface/ClientInterface.hpp" +#include +using std::string; +using Ingen::Shared::ClientInterface; +using Ingen::Shared::ClientKey; +using Ingen::Shared::Responder; + +namespace Ingen { + + +/** Registers a new client with the OSC system, so it can receive updates. + * + * \ingroup engine + */ +class RegisterClientEvent : public QueuedEvent +{ +public: + RegisterClientEvent(Engine& engine, + SharedPtr responder, + SampleCount timestamp, + ClientKey key, + SharedPtr client); + + void pre_process(); + void post_process(); + +private: + ClientKey _key; + SharedPtr _client; +}; + + +} // namespace Ingen + +#endif // REGISTERCLIENTEVENT_H diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp index ac9082e6..035bd005 100644 --- a/src/libs/engine/events/RenameEvent.cpp +++ b/src/libs/engine/events/RenameEvent.cpp @@ -15,15 +15,15 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "RenameEvent.h" -#include "interface/Responder.h" -#include "Patch.h" -#include "Node.h" -#include "Tree.h" -#include "Engine.h" -#include "ClientBroadcaster.h" -#include -#include "ObjectStore.h" +#include "RenameEvent.hpp" +#include "interface/Responder.hpp" +#include "Patch.hpp" +#include "Node.hpp" +#include "Tree.hpp" +#include "Engine.hpp" +#include "ClientBroadcaster.hpp" +#include +#include "ObjectStore.hpp" namespace Ingen { diff --git a/src/libs/engine/events/RenameEvent.h b/src/libs/engine/events/RenameEvent.h deleted file mode 100644 index c0d1e538..00000000 --- a/src/libs/engine/events/RenameEvent.h +++ /dev/null @@ -1,68 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef RENAMEEVENT_H -#define RENAMEEVENT_H - -#include -#include "QueuedEvent.h" -#include - -using std::string; - -template class TreeNode; -template class ListNode; - -namespace Ingen { - -class GraphObject; -class Patch; -class Node; -class Plugin; -class DisconnectNodeEvent; -class DisconnectPortEvent; - - -/** An event to change the name of an GraphObject. - * - * \ingroup engine - */ -class RenameEvent : public QueuedEvent -{ -public: - RenameEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& name); - ~RenameEvent(); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - enum ErrorType { NO_ERROR, OBJECT_NOT_FOUND, OBJECT_EXISTS, OBJECT_NOT_RENAMABLE, INVALID_NAME }; - - Path _old_path; - string _name; - Path _new_path; - Patch* _parent_patch; - TreeNode* _store_treenode; - ErrorType _error; -}; - - -} // namespace Ingen - -#endif // RENAMEEVENT_H diff --git a/src/libs/engine/events/RenameEvent.hpp b/src/libs/engine/events/RenameEvent.hpp new file mode 100644 index 00000000..f50efcc7 --- /dev/null +++ b/src/libs/engine/events/RenameEvent.hpp @@ -0,0 +1,68 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RENAMEEVENT_H +#define RENAMEEVENT_H + +#include +#include "QueuedEvent.hpp" +#include + +using std::string; + +template class TreeNode; +template class ListNode; + +namespace Ingen { + +class GraphObject; +class Patch; +class Node; +class Plugin; +class DisconnectNodeEvent; +class DisconnectPortEvent; + + +/** An event to change the name of an GraphObject. + * + * \ingroup engine + */ +class RenameEvent : public QueuedEvent +{ +public: + RenameEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& name); + ~RenameEvent(); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + enum ErrorType { NO_ERROR, OBJECT_NOT_FOUND, OBJECT_EXISTS, OBJECT_NOT_RENAMABLE, INVALID_NAME }; + + Path _old_path; + string _name; + Path _new_path; + Patch* _parent_patch; + TreeNode* _store_treenode; + ErrorType _error; +}; + + +} // namespace Ingen + +#endif // RENAMEEVENT_H diff --git a/src/libs/engine/events/RequestAllObjectsEvent.cpp b/src/libs/engine/events/RequestAllObjectsEvent.cpp index ccf5a6a1..a6940442 100644 --- a/src/libs/engine/events/RequestAllObjectsEvent.cpp +++ b/src/libs/engine/events/RequestAllObjectsEvent.cpp @@ -15,12 +15,12 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "RequestAllObjectsEvent.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "ObjectSender.h" -#include "ClientBroadcaster.h" -#include "ObjectStore.h" +#include "RequestAllObjectsEvent.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "ObjectSender.hpp" +#include "ClientBroadcaster.hpp" +#include "ObjectStore.hpp" namespace Ingen { diff --git a/src/libs/engine/events/RequestAllObjectsEvent.h b/src/libs/engine/events/RequestAllObjectsEvent.h deleted file mode 100644 index a0d10c49..00000000 --- a/src/libs/engine/events/RequestAllObjectsEvent.h +++ /dev/null @@ -1,51 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef REQUESTALLOBJECTSEVENT_H -#define REQUESTALLOBJECTSEVENT_H - -#include -#include "QueuedEvent.h" -using std::string; - -namespace Ingen { - -namespace Shared { - class ClientInterface; -} using Shared::ClientInterface; - - -/** A request from a client to send notification of all objects (ie refresh). - * - * \ingroup engine - */ -class RequestAllObjectsEvent : public QueuedEvent -{ -public: - RequestAllObjectsEvent(Engine& engine, SharedPtr responder, SampleCount timestamp); - - void pre_process(); - void post_process(); - -private: - SharedPtr _client; -}; - - -} // namespace Ingen - -#endif // REQUESTALLOBJECTSEVENT_H diff --git a/src/libs/engine/events/RequestAllObjectsEvent.hpp b/src/libs/engine/events/RequestAllObjectsEvent.hpp new file mode 100644 index 00000000..91dfefc3 --- /dev/null +++ b/src/libs/engine/events/RequestAllObjectsEvent.hpp @@ -0,0 +1,51 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef REQUESTALLOBJECTSEVENT_H +#define REQUESTALLOBJECTSEVENT_H + +#include +#include "QueuedEvent.hpp" +using std::string; + +namespace Ingen { + +namespace Shared { + class ClientInterface; +} using Shared::ClientInterface; + + +/** A request from a client to send notification of all objects (ie refresh). + * + * \ingroup engine + */ +class RequestAllObjectsEvent : public QueuedEvent +{ +public: + RequestAllObjectsEvent(Engine& engine, SharedPtr responder, SampleCount timestamp); + + void pre_process(); + void post_process(); + +private: + SharedPtr _client; +}; + + +} // namespace Ingen + +#endif // REQUESTALLOBJECTSEVENT_H diff --git a/src/libs/engine/events/RequestMetadataEvent.cpp b/src/libs/engine/events/RequestMetadataEvent.cpp index b2f189f6..5000256f 100644 --- a/src/libs/engine/events/RequestMetadataEvent.cpp +++ b/src/libs/engine/events/RequestMetadataEvent.cpp @@ -15,14 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "RequestMetadataEvent.h" +#include "RequestMetadataEvent.hpp" #include -#include "interface/Responder.h" -#include "Engine.h" -#include "GraphObject.h" -#include "ObjectStore.h" -#include "interface/ClientInterface.h" -#include "ClientBroadcaster.h" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "GraphObject.hpp" +#include "ObjectStore.hpp" +#include "interface/ClientInterface.hpp" +#include "ClientBroadcaster.hpp" using std::string; namespace Ingen { diff --git a/src/libs/engine/events/RequestMetadataEvent.h b/src/libs/engine/events/RequestMetadataEvent.h deleted file mode 100644 index 45592e88..00000000 --- a/src/libs/engine/events/RequestMetadataEvent.h +++ /dev/null @@ -1,57 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef REQUESTMETADATAEVENT_H -#define REQUESTMETADATAEVENT_H - -#include -#include "QueuedEvent.h" -#include -using std::string; - -namespace Ingen { - -class GraphObject; -namespace Shared { - class ClientInterface; -} using Shared::ClientInterface; - - -/** A request from a client for a piece of metadata. - * - * \ingroup engine - */ -class RequestMetadataEvent : public QueuedEvent -{ -public: - RequestMetadataEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& key); - - void pre_process(); - void post_process(); - -private: - string _path; - string _key; - Raul::Atom _value; - GraphObject* _object; - SharedPtr _client; -}; - - -} // namespace Ingen - -#endif // REQUESTMETADATAEVENT_H diff --git a/src/libs/engine/events/RequestMetadataEvent.hpp b/src/libs/engine/events/RequestMetadataEvent.hpp new file mode 100644 index 00000000..ed33e4af --- /dev/null +++ b/src/libs/engine/events/RequestMetadataEvent.hpp @@ -0,0 +1,57 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef REQUESTMETADATAEVENT_H +#define REQUESTMETADATAEVENT_H + +#include +#include "QueuedEvent.hpp" +#include +using std::string; + +namespace Ingen { + +class GraphObject; +namespace Shared { + class ClientInterface; +} using Shared::ClientInterface; + + +/** A request from a client for a piece of metadata. + * + * \ingroup engine + */ +class RequestMetadataEvent : public QueuedEvent +{ +public: + RequestMetadataEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& key); + + void pre_process(); + void post_process(); + +private: + string _path; + string _key; + Raul::Atom _value; + GraphObject* _object; + SharedPtr _client; +}; + + +} // namespace Ingen + +#endif // REQUESTMETADATAEVENT_H diff --git a/src/libs/engine/events/RequestObjectEvent.cpp b/src/libs/engine/events/RequestObjectEvent.cpp index 30ef6f85..25f95d00 100644 --- a/src/libs/engine/events/RequestObjectEvent.cpp +++ b/src/libs/engine/events/RequestObjectEvent.cpp @@ -15,17 +15,17 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "RequestObjectEvent.h" +#include "RequestObjectEvent.hpp" #include -#include "interface/ClientInterface.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "ObjectStore.h" -#include "ClientBroadcaster.h" -#include "Patch.h" -#include "Node.h" -#include "Port.h" -#include "ObjectSender.h" +#include "interface/ClientInterface.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "ObjectStore.hpp" +#include "ClientBroadcaster.hpp" +#include "Patch.hpp" +#include "Node.hpp" +#include "Port.hpp" +#include "ObjectSender.hpp" using std::string; diff --git a/src/libs/engine/events/RequestObjectEvent.h b/src/libs/engine/events/RequestObjectEvent.h deleted file mode 100644 index b769aee3..00000000 --- a/src/libs/engine/events/RequestObjectEvent.h +++ /dev/null @@ -1,56 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef REQUESTOBJECTEVENT_H -#define REQUESTOBJECTEVENT_H - -#include -#include "QueuedEvent.h" -#include "types.h" - -using std::string; - -namespace Ingen { - -class GraphObject; -namespace Shared { class ClientInterface; } -using Shared::ClientInterface; - - -/** A request from a client to send the value of a port. - * - * \ingroup engine - */ -class RequestObjectEvent : public QueuedEvent -{ -public: - RequestObjectEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - string _path; - GraphObject* _object; - SharedPtr _client; -}; - - -} // namespace Ingen - -#endif // REQUESTOBJECTEVENT_H diff --git a/src/libs/engine/events/RequestObjectEvent.hpp b/src/libs/engine/events/RequestObjectEvent.hpp new file mode 100644 index 00000000..6731182a --- /dev/null +++ b/src/libs/engine/events/RequestObjectEvent.hpp @@ -0,0 +1,56 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef REQUESTOBJECTEVENT_H +#define REQUESTOBJECTEVENT_H + +#include +#include "QueuedEvent.hpp" +#include "types.hpp" + +using std::string; + +namespace Ingen { + +class GraphObject; +namespace Shared { class ClientInterface; } +using Shared::ClientInterface; + + +/** A request from a client to send the value of a port. + * + * \ingroup engine + */ +class RequestObjectEvent : public QueuedEvent +{ +public: + RequestObjectEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + string _path; + GraphObject* _object; + SharedPtr _client; +}; + + +} // namespace Ingen + +#endif // REQUESTOBJECTEVENT_H diff --git a/src/libs/engine/events/RequestPluginEvent.cpp b/src/libs/engine/events/RequestPluginEvent.cpp index da70cd8c..4e1a1660 100644 --- a/src/libs/engine/events/RequestPluginEvent.cpp +++ b/src/libs/engine/events/RequestPluginEvent.cpp @@ -15,16 +15,16 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "RequestPluginEvent.h" +#include "RequestPluginEvent.hpp" #include -#include "interface/ClientInterface.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "Port.h" -#include "ObjectStore.h" -#include "ClientBroadcaster.h" -#include "NodeFactory.h" -#include "Plugin.h" +#include "interface/ClientInterface.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "Port.hpp" +#include "ObjectStore.hpp" +#include "ClientBroadcaster.hpp" +#include "NodeFactory.hpp" +#include "Plugin.hpp" using std::string; diff --git a/src/libs/engine/events/RequestPluginEvent.h b/src/libs/engine/events/RequestPluginEvent.h deleted file mode 100644 index 7047e2fa..00000000 --- a/src/libs/engine/events/RequestPluginEvent.h +++ /dev/null @@ -1,56 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef REQUESTPLUGINEVENT_H -#define REQUESTPLUGINEVENT_H - -#include -#include "QueuedEvent.h" -#include "types.h" - -using std::string; - -namespace Ingen { - -class Plugin; -namespace Shared { class ClientInterface; } -using Shared::ClientInterface; - - -/** A request from a client to send the value of a port. - * - * \ingroup engine - */ -class RequestPluginEvent : public QueuedEvent -{ -public: - RequestPluginEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& uri); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - string _uri; - const Plugin* _plugin; - SharedPtr _client; -}; - - -} // namespace Ingen - -#endif // REQUESTPLUGINEVENT_H diff --git a/src/libs/engine/events/RequestPluginEvent.hpp b/src/libs/engine/events/RequestPluginEvent.hpp new file mode 100644 index 00000000..26e5a8fa --- /dev/null +++ b/src/libs/engine/events/RequestPluginEvent.hpp @@ -0,0 +1,56 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef REQUESTPLUGINEVENT_H +#define REQUESTPLUGINEVENT_H + +#include +#include "QueuedEvent.hpp" +#include "types.hpp" + +using std::string; + +namespace Ingen { + +class Plugin; +namespace Shared { class ClientInterface; } +using Shared::ClientInterface; + + +/** A request from a client to send the value of a port. + * + * \ingroup engine + */ +class RequestPluginEvent : public QueuedEvent +{ +public: + RequestPluginEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& uri); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + string _uri; + const Plugin* _plugin; + SharedPtr _client; +}; + + +} // namespace Ingen + +#endif // REQUESTPLUGINEVENT_H diff --git a/src/libs/engine/events/RequestPluginsEvent.cpp b/src/libs/engine/events/RequestPluginsEvent.cpp index 1d71b6fa..3976dd08 100644 --- a/src/libs/engine/events/RequestPluginsEvent.cpp +++ b/src/libs/engine/events/RequestPluginsEvent.cpp @@ -15,11 +15,11 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "RequestPluginsEvent.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "ClientBroadcaster.h" -#include "NodeFactory.h" +#include "RequestPluginsEvent.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "ClientBroadcaster.hpp" +#include "NodeFactory.hpp" namespace Ingen { diff --git a/src/libs/engine/events/RequestPluginsEvent.h b/src/libs/engine/events/RequestPluginsEvent.h deleted file mode 100644 index 3d795081..00000000 --- a/src/libs/engine/events/RequestPluginsEvent.h +++ /dev/null @@ -1,55 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef REQUESTPLUGINSEVENT_H -#define REQUESTPLUGINSEVENT_H - -#include -#include -#include "QueuedEvent.h" -using std::string; - -namespace Ingen { - -class Plugin; -class Shared::Responder; -namespace Shared { - class ClientInterface; -} using Shared::ClientInterface; - - -/** A request from a client to send notification of all objects (ie refresh). - * - * \ingroup engine - */ -class RequestPluginsEvent : public QueuedEvent -{ -public: - RequestPluginsEvent(Engine& engine, SharedPtr responder, SampleCount timestamp); - - void pre_process(); - void post_process(); - -private: - SharedPtr _client; - std::list _plugins; -}; - - -} // namespace Ingen - -#endif // REQUESTPLUGINSEVENT_H diff --git a/src/libs/engine/events/RequestPluginsEvent.hpp b/src/libs/engine/events/RequestPluginsEvent.hpp new file mode 100644 index 00000000..fae8bf94 --- /dev/null +++ b/src/libs/engine/events/RequestPluginsEvent.hpp @@ -0,0 +1,55 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef REQUESTPLUGINSEVENT_H +#define REQUESTPLUGINSEVENT_H + +#include +#include +#include "QueuedEvent.hpp" +using std::string; + +namespace Ingen { + +class Plugin; +class Shared::Responder; +namespace Shared { + class ClientInterface; +} using Shared::ClientInterface; + + +/** A request from a client to send notification of all objects (ie refresh). + * + * \ingroup engine + */ +class RequestPluginsEvent : public QueuedEvent +{ +public: + RequestPluginsEvent(Engine& engine, SharedPtr responder, SampleCount timestamp); + + void pre_process(); + void post_process(); + +private: + SharedPtr _client; + std::list _plugins; +}; + + +} // namespace Ingen + +#endif // REQUESTPLUGINSEVENT_H diff --git a/src/libs/engine/events/RequestPortValueEvent.cpp b/src/libs/engine/events/RequestPortValueEvent.cpp index 79a7093a..7444068e 100644 --- a/src/libs/engine/events/RequestPortValueEvent.cpp +++ b/src/libs/engine/events/RequestPortValueEvent.cpp @@ -15,15 +15,15 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "RequestPortValueEvent.h" +#include "RequestPortValueEvent.hpp" #include -#include "interface/ClientInterface.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "Port.h" -#include "ObjectStore.h" -#include "ClientBroadcaster.h" -#include "AudioBuffer.h" +#include "interface/ClientInterface.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "Port.hpp" +#include "ObjectStore.hpp" +#include "ClientBroadcaster.hpp" +#include "AudioBuffer.hpp" using std::string; diff --git a/src/libs/engine/events/RequestPortValueEvent.h b/src/libs/engine/events/RequestPortValueEvent.h deleted file mode 100644 index 87a6373c..00000000 --- a/src/libs/engine/events/RequestPortValueEvent.h +++ /dev/null @@ -1,57 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef REQUESTPORTVALUEEVENT_H -#define REQUESTPORTVALUEEVENT_H - -#include -#include "QueuedEvent.h" -#include "types.h" - -using std::string; - -namespace Ingen { - -class Port; -namespace Shared { class ClientInterface; } -using Shared::ClientInterface; - - -/** A request from a client to send the value of a port. - * - * \ingroup engine - */ -class RequestPortValueEvent : public QueuedEvent -{ -public: - RequestPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - string _port_path; - Port* _port; - Sample _value; - SharedPtr _client; -}; - - -} // namespace Ingen - -#endif // REQUESTPORTVALUEEVENT_H diff --git a/src/libs/engine/events/RequestPortValueEvent.hpp b/src/libs/engine/events/RequestPortValueEvent.hpp new file mode 100644 index 00000000..1a20b90f --- /dev/null +++ b/src/libs/engine/events/RequestPortValueEvent.hpp @@ -0,0 +1,57 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef REQUESTPORTVALUEEVENT_H +#define REQUESTPORTVALUEEVENT_H + +#include +#include "QueuedEvent.hpp" +#include "types.hpp" + +using std::string; + +namespace Ingen { + +class Port; +namespace Shared { class ClientInterface; } +using Shared::ClientInterface; + + +/** A request from a client to send the value of a port. + * + * \ingroup engine + */ +class RequestPortValueEvent : public QueuedEvent +{ +public: + RequestPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + string _port_path; + Port* _port; + Sample _value; + SharedPtr _client; +}; + + +} // namespace Ingen + +#endif // REQUESTPORTVALUEEVENT_H diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp index 6d303915..caa1b449 100644 --- a/src/libs/engine/events/SetMetadataEvent.cpp +++ b/src/libs/engine/events/SetMetadataEvent.cpp @@ -15,13 +15,13 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "SetMetadataEvent.h" +#include "SetMetadataEvent.hpp" #include -#include "interface/Responder.h" -#include "Engine.h" -#include "ClientBroadcaster.h" -#include "GraphObject.h" -#include "ObjectStore.h" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "ClientBroadcaster.hpp" +#include "GraphObject.hpp" +#include "ObjectStore.hpp" using std::string; diff --git a/src/libs/engine/events/SetMetadataEvent.h b/src/libs/engine/events/SetMetadataEvent.h deleted file mode 100644 index 63a73a6d..00000000 --- a/src/libs/engine/events/SetMetadataEvent.h +++ /dev/null @@ -1,55 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef SETMETADATAEVENT_H -#define SETMETADATAEVENT_H - -#include -#include "QueuedEvent.h" -#include - -using std::string; - -namespace Ingen { - -class GraphObject; - - -/** An event to set a piece of metadata for an GraphObject. - * - * \ingroup engine - */ -class SetMetadataEvent : public QueuedEvent -{ -public: - SetMetadataEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& key, const Raul::Atom& value); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - string _path; - string _key; - Raul::Atom _value; - GraphObject* _object; -}; - - -} // namespace Ingen - -#endif // SETMETADATAEVENT_H diff --git a/src/libs/engine/events/SetMetadataEvent.hpp b/src/libs/engine/events/SetMetadataEvent.hpp new file mode 100644 index 00000000..c5476eed --- /dev/null +++ b/src/libs/engine/events/SetMetadataEvent.hpp @@ -0,0 +1,55 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SETMETADATAEVENT_H +#define SETMETADATAEVENT_H + +#include +#include "QueuedEvent.hpp" +#include + +using std::string; + +namespace Ingen { + +class GraphObject; + + +/** An event to set a piece of metadata for an GraphObject. + * + * \ingroup engine + */ +class SetMetadataEvent : public QueuedEvent +{ +public: + SetMetadataEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& key, const Raul::Atom& value); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + string _path; + string _key; + Raul::Atom _value; + GraphObject* _object; +}; + + +} // namespace Ingen + +#endif // SETMETADATAEVENT_H diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp index f78dca7f..5de9dfff 100644 --- a/src/libs/engine/events/SetPortValueEvent.cpp +++ b/src/libs/engine/events/SetPortValueEvent.cpp @@ -15,14 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "interface/Responder.h" -#include "SetPortValueEvent.h" -#include "Engine.h" -#include "Port.h" -#include "ClientBroadcaster.h" -#include "Node.h" -#include "ObjectStore.h" -#include "AudioBuffer.h" +#include "interface/Responder.hpp" +#include "SetPortValueEvent.hpp" +#include "Engine.hpp" +#include "Port.hpp" +#include "ClientBroadcaster.hpp" +#include "Node.hpp" +#include "ObjectStore.hpp" +#include "AudioBuffer.hpp" namespace Ingen { diff --git a/src/libs/engine/events/SetPortValueEvent.h b/src/libs/engine/events/SetPortValueEvent.h deleted file mode 100644 index d5f5735f..00000000 --- a/src/libs/engine/events/SetPortValueEvent.h +++ /dev/null @@ -1,57 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef SETPORTVALUEEVENT_H -#define SETPORTVALUEEVENT_H - -#include -#include "Event.h" -#include "types.h" -using std::string; - -namespace Ingen { - -class Port; - - -/** An event to change the value of a port. - * - * \ingroup engine - */ -class SetPortValueEvent : public Event -{ -public: - SetPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path, Sample val); - SetPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val); - - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - enum ErrorType { NO_ERROR, PORT_NOT_FOUND, TYPE_MISMATCH }; - - int _voice_num; - string _port_path; - float _val; - Port* _port; - ErrorType _error; -}; - - -} // namespace Ingen - -#endif // SETPORTVALUEEVENT_H diff --git a/src/libs/engine/events/SetPortValueEvent.hpp b/src/libs/engine/events/SetPortValueEvent.hpp new file mode 100644 index 00000000..2f2f35e7 --- /dev/null +++ b/src/libs/engine/events/SetPortValueEvent.hpp @@ -0,0 +1,57 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SETPORTVALUEEVENT_H +#define SETPORTVALUEEVENT_H + +#include +#include "Event.hpp" +#include "types.hpp" +using std::string; + +namespace Ingen { + +class Port; + + +/** An event to change the value of a port. + * + * \ingroup engine + */ +class SetPortValueEvent : public Event +{ +public: + SetPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path, Sample val); + SetPortValueEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val); + + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + enum ErrorType { NO_ERROR, PORT_NOT_FOUND, TYPE_MISMATCH }; + + int _voice_num; + string _port_path; + float _val; + Port* _port; + ErrorType _error; +}; + + +} // namespace Ingen + +#endif // SETPORTVALUEEVENT_H diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.cpp b/src/libs/engine/events/SetPortValueQueuedEvent.cpp index d713ae8a..33178e55 100644 --- a/src/libs/engine/events/SetPortValueQueuedEvent.cpp +++ b/src/libs/engine/events/SetPortValueQueuedEvent.cpp @@ -15,15 +15,15 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "SetPortValueQueuedEvent.h" -#include "interface/Responder.h" -#include "Engine.h" -#include "Port.h" -#include "ClientBroadcaster.h" -#include "Plugin.h" -#include "Node.h" -#include "ObjectStore.h" -#include "AudioBuffer.h" +#include "SetPortValueQueuedEvent.hpp" +#include "interface/Responder.hpp" +#include "Engine.hpp" +#include "Port.hpp" +#include "ClientBroadcaster.hpp" +#include "Plugin.hpp" +#include "Node.hpp" +#include "ObjectStore.hpp" +#include "AudioBuffer.hpp" namespace Ingen { diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.h b/src/libs/engine/events/SetPortValueQueuedEvent.h deleted file mode 100644 index 4cbebe0e..00000000 --- a/src/libs/engine/events/SetPortValueQueuedEvent.h +++ /dev/null @@ -1,58 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef SETPORTVALUEQUEUEDEVENT_H -#define SETPORTVALUEQUEUEDEVENT_H - -#include "QueuedEvent.h" -#include "types.h" -#include -using std::string; - -namespace Ingen { - -class Port; - - -/** An event to change the value of a port. - * - * \ingroup engine - */ -class SetPortValueQueuedEvent : public QueuedEvent -{ -public: - SetPortValueQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path, Sample val); - SetPortValueQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val); - - void pre_process(); - void execute(SampleCount nframes, FrameTime start, FrameTime end); - void post_process(); - -private: - enum ErrorType { NO_ERROR, PORT_NOT_FOUND, TYPE_MISMATCH }; - - int _voice_num; - string _port_path; - float _val; - Port* _port; - ErrorType _error; -}; - - -} // namespace Ingen - -#endif // SETPORTVALUEQUEUEDEVENT_H diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.hpp b/src/libs/engine/events/SetPortValueQueuedEvent.hpp new file mode 100644 index 00000000..a0e01910 --- /dev/null +++ b/src/libs/engine/events/SetPortValueQueuedEvent.hpp @@ -0,0 +1,58 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SETPORTVALUEQUEUEDEVENT_H +#define SETPORTVALUEQUEUEDEVENT_H + +#include "QueuedEvent.hpp" +#include "types.hpp" +#include +using std::string; + +namespace Ingen { + +class Port; + + +/** An event to change the value of a port. + * + * \ingroup engine + */ +class SetPortValueQueuedEvent : public QueuedEvent +{ +public: + SetPortValueQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& port_path, Sample val); + SetPortValueQueuedEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val); + + void pre_process(); + void execute(SampleCount nframes, FrameTime start, FrameTime end); + void post_process(); + +private: + enum ErrorType { NO_ERROR, PORT_NOT_FOUND, TYPE_MISMATCH }; + + int _voice_num; + string _port_path; + float _val; + Port* _port; + ErrorType _error; +}; + + +} // namespace Ingen + +#endif // SETPORTVALUEQUEUEDEVENT_H diff --git a/src/libs/engine/events/UnregisterClientEvent.cpp b/src/libs/engine/events/UnregisterClientEvent.cpp index 4248fdcb..be03f151 100644 --- a/src/libs/engine/events/UnregisterClientEvent.cpp +++ b/src/libs/engine/events/UnregisterClientEvent.cpp @@ -15,11 +15,11 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "interface/ClientInterface.h" -#include "interface/Responder.h" -#include "UnregisterClientEvent.h" -#include "Engine.h" -#include "ClientBroadcaster.h" +#include "interface/ClientInterface.hpp" +#include "interface/Responder.hpp" +#include "UnregisterClientEvent.hpp" +#include "Engine.hpp" +#include "ClientBroadcaster.hpp" namespace Ingen { diff --git a/src/libs/engine/events/UnregisterClientEvent.h b/src/libs/engine/events/UnregisterClientEvent.h deleted file mode 100644 index 159bd160..00000000 --- a/src/libs/engine/events/UnregisterClientEvent.h +++ /dev/null @@ -1,57 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef UNREGISTERCLIENTEVENT_H -#define UNREGISTERCLIENTEVENT_H - -#include "QueuedEvent.h" -#include "interface/ClientKey.h" -#include -using std::string; - -namespace Ingen { - -namespace Shared { - class ClientInterface; - class ClientKey; -} -using Shared::ClientInterface; -using Shared::ClientKey; - - -/** Unregisters an OSC client so it no longer receives notifications. - * - * \ingroup engine - */ -class UnregisterClientEvent : public QueuedEvent -{ -public: - UnregisterClientEvent(Engine& engine, - SharedPtr responder, - SampleCount timestamp, - ClientKey key); - - void post_process(); - -private: - ClientKey _key; -}; - - -} // namespace Ingen - -#endif // UNREGISTERCLIENTEVENT_H diff --git a/src/libs/engine/events/UnregisterClientEvent.hpp b/src/libs/engine/events/UnregisterClientEvent.hpp new file mode 100644 index 00000000..17d85b93 --- /dev/null +++ b/src/libs/engine/events/UnregisterClientEvent.hpp @@ -0,0 +1,57 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef UNREGISTERCLIENTEVENT_H +#define UNREGISTERCLIENTEVENT_H + +#include "QueuedEvent.hpp" +#include "interface/ClientKey.hpp" +#include +using std::string; + +namespace Ingen { + +namespace Shared { + class ClientInterface; + class ClientKey; +} +using Shared::ClientInterface; +using Shared::ClientKey; + + +/** Unregisters an OSC client so it no longer receives notifications. + * + * \ingroup engine + */ +class UnregisterClientEvent : public QueuedEvent +{ +public: + UnregisterClientEvent(Engine& engine, + SharedPtr responder, + SampleCount timestamp, + ClientKey key); + + void post_process(); + +private: + ClientKey _key; +}; + + +} // namespace Ingen + +#endif // UNREGISTERCLIENTEVENT_H diff --git a/src/libs/engine/instantiations.cpp b/src/libs/engine/instantiations.cpp index f4c81722..6dd80445 100644 --- a/src/libs/engine/instantiations.cpp +++ b/src/libs/engine/instantiations.cpp @@ -22,9 +22,9 @@ * instantiate templates (at least not well/completely). */ -#include "Tree.h" -#include "TreeImplementation.h" -#include "GraphObject.h" +#include "Tree.hpp" +#include "TreeImplementation.hpp" +#include "GraphObject.hpp" template class Tree; diff --git a/src/libs/engine/tuning.h b/src/libs/engine/tuning.h deleted file mode 100644 index 25aa9eb0..00000000 --- a/src/libs/engine/tuning.h +++ /dev/null @@ -1,40 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef TUNING_H -#define TUNING_H - -#include -#include - -namespace Ingen { - -// FIXME: put this in a Config class - -static const size_t event_queue_size = 1024; -static const size_t pre_processor_queue_size = 1024; -static const size_t post_processor_queue_size = 1024; -static const size_t maid_queue_size = 1024; - -// This controls both the LASH event processing rate and the Maid cleanup rate -// (both of which are driven from the main thread) -static const timespec main_rate = { 0, 500000000 }; // 1/2 second - - -} // namespace Ingen - -#endif // TUNING_H diff --git a/src/libs/engine/tuning.hpp b/src/libs/engine/tuning.hpp new file mode 100644 index 00000000..25aa9eb0 --- /dev/null +++ b/src/libs/engine/tuning.hpp @@ -0,0 +1,40 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef TUNING_H +#define TUNING_H + +#include +#include + +namespace Ingen { + +// FIXME: put this in a Config class + +static const size_t event_queue_size = 1024; +static const size_t pre_processor_queue_size = 1024; +static const size_t post_processor_queue_size = 1024; +static const size_t maid_queue_size = 1024; + +// This controls both the LASH event processing rate and the Maid cleanup rate +// (both of which are driven from the main thread) +static const timespec main_rate = { 0, 500000000 }; // 1/2 second + + +} // namespace Ingen + +#endif // TUNING_H diff --git a/src/libs/engine/types.h b/src/libs/engine/types.h deleted file mode 100644 index 9aea18e8..00000000 --- a/src/libs/engine/types.h +++ /dev/null @@ -1,33 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef TYPES_H -#define TYPES_H - -#include // for NULL, size_t, etc -#include - -typedef unsigned char uchar; -typedef unsigned int uint; -typedef unsigned long ulong; - -typedef jack_default_audio_sample_t Sample; -typedef jack_nframes_t SampleCount; -typedef jack_nframes_t SampleRate; -typedef jack_nframes_t FrameTime; - -#endif // TYPES_H diff --git a/src/libs/engine/types.hpp b/src/libs/engine/types.hpp new file mode 100644 index 00000000..d242e61d --- /dev/null +++ b/src/libs/engine/types.hpp @@ -0,0 +1,33 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef TYPES_HPP +#define TYPES_HPP + +#include // for NULL, size_t, etc +#include + +typedef unsigned char uchar; +typedef unsigned int uint; +typedef unsigned long ulong; + +typedef jack_default_audio_sample_t Sample; +typedef jack_nframes_t SampleCount; +typedef jack_nframes_t SampleRate; +typedef jack_nframes_t FrameTime; + +#endif // TYPES_HPP diff --git a/src/libs/engine/util.h b/src/libs/engine/util.h deleted file mode 100644 index ce943673..00000000 --- a/src/libs/engine/util.h +++ /dev/null @@ -1,74 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef UTIL_H -#define UTIL_H - -#include -#include - -#include -#ifdef __SSE__ -#include -#endif - -using std::cerr; using std::endl; - -namespace Ingen { - -/** Set flags to disable denormal processing. - */ -inline void -set_denormal_flags() -{ -#ifdef __SSE__ - unsigned long a, b, c, d; - - asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (1)); - if (d & 1<<25) { /* It has SSE support */ - _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); - - asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (0)); - if (b == 0x756e6547) { /* It's an Intel */ - int stepping, model, family, extfamily; - - family = (a >> 8) & 0xf; - extfamily = (a >> 20) & 0xff; - model = (a >> 4) & 0xf; - stepping = a & 0xf; - if (family == 15 && extfamily == 0 && model == 0 && stepping < 7) { - return; - } - } - asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (1)); - if (d & 1<<26) { /* bit 26, SSE2 support */ - _mm_setcsr(_mm_getcsr() | 0x40); - //cerr << "Set SSE denormal fix flag." << endl; - } - } else { - cerr << "This code has been built with SSE support, but your processor does" - << " not support the SSE instruction set." << endl << "Exiting." << endl; - exit(EXIT_FAILURE); - } -#endif - // Set 387 control register via standard C99 interface - fesetround(FE_TOWARDZERO); -} - -} // namespace Ingen - -#endif // UTIL_H diff --git a/src/libs/engine/util.hpp b/src/libs/engine/util.hpp new file mode 100644 index 00000000..ce943673 --- /dev/null +++ b/src/libs/engine/util.hpp @@ -0,0 +1,74 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef UTIL_H +#define UTIL_H + +#include +#include + +#include +#ifdef __SSE__ +#include +#endif + +using std::cerr; using std::endl; + +namespace Ingen { + +/** Set flags to disable denormal processing. + */ +inline void +set_denormal_flags() +{ +#ifdef __SSE__ + unsigned long a, b, c, d; + + asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (1)); + if (d & 1<<25) { /* It has SSE support */ + _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); + + asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (0)); + if (b == 0x756e6547) { /* It's an Intel */ + int stepping, model, family, extfamily; + + family = (a >> 8) & 0xf; + extfamily = (a >> 20) & 0xff; + model = (a >> 4) & 0xf; + stepping = a & 0xf; + if (family == 15 && extfamily == 0 && model == 0 && stepping < 7) { + return; + } + } + asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (1)); + if (d & 1<<26) { /* bit 26, SSE2 support */ + _mm_setcsr(_mm_getcsr() | 0x40); + //cerr << "Set SSE denormal fix flag." << endl; + } + } else { + cerr << "This code has been built with SSE support, but your processor does" + << " not support the SSE instruction set." << endl << "Exiting." << endl; + exit(EXIT_FAILURE); + } +#endif + // Set 387 control register via standard C99 interface + fesetround(FE_TOWARDZERO); +} + +} // namespace Ingen + +#endif // UTIL_H -- cgit v1.2.1