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/common/interface/ClientInterface.h | 124 ------- src/common/interface/ClientInterface.hpp | 123 +++++++ src/common/interface/ClientKey.h | 86 ----- src/common/interface/ClientKey.hpp | 86 +++++ src/common/interface/EngineInterface.h | 142 -------- src/common/interface/EngineInterface.hpp | 142 ++++++++ src/common/interface/Makefile.am | 8 +- src/common/interface/Responder.h | 75 ---- src/common/interface/Responder.hpp | 74 ++++ src/libs/client/ConnectionModel.cpp | 6 +- src/libs/client/ConnectionModel.h | 77 ---- src/libs/client/ConnectionModel.hpp | 77 ++++ src/libs/client/ControlModel.h | 56 --- src/libs/client/ControlModel.hpp | 56 +++ src/libs/client/DeprecatedLoader.cpp | 18 +- src/libs/client/DeprecatedLoader.h | 92 ----- src/libs/client/DeprecatedLoader.hpp | 92 +++++ src/libs/client/DirectSigClientInterface.h | 115 ------ src/libs/client/DirectSigClientInterface.hpp | 115 ++++++ src/libs/client/Makefile.am | 52 +-- src/libs/client/NodeModel.cpp | 4 +- src/libs/client/NodeModel.h | 98 ----- src/libs/client/NodeModel.hpp | 98 +++++ src/libs/client/OSCClientReceiver.cpp | 6 +- src/libs/client/OSCClientReceiver.h | 111 ------ src/libs/client/OSCClientReceiver.hpp | 111 ++++++ src/libs/client/OSCEngineSender.cpp | 6 +- src/libs/client/OSCEngineSender.h | 160 --------- src/libs/client/OSCEngineSender.hpp | 160 +++++++++ src/libs/client/ObjectModel.cpp | 2 +- src/libs/client/ObjectModel.h | 96 ----- src/libs/client/ObjectModel.hpp | 96 +++++ src/libs/client/PatchModel.cpp | 6 +- src/libs/client/PatchModel.h | 106 ------ src/libs/client/PatchModel.hpp | 106 ++++++ src/libs/client/PluginModel.cpp | 6 +- src/libs/client/PluginModel.h | 131 ------- src/libs/client/PluginModel.hpp | 131 +++++++ src/libs/client/PortModel.cpp | 2 +- src/libs/client/PortModel.h | 105 ------ src/libs/client/PortModel.hpp | 105 ++++++ src/libs/client/PresetModel.h | 69 ---- src/libs/client/PresetModel.hpp | 69 ++++ src/libs/client/Serializer.cpp | 28 +- src/libs/client/Serializer.h | 86 ----- src/libs/client/Serializer.hpp | 86 +++++ src/libs/client/SigClientInterface.h | 142 -------- src/libs/client/SigClientInterface.hpp | 142 ++++++++ src/libs/client/Store.cpp | 16 +- src/libs/client/Store.h | 132 ------- src/libs/client/Store.hpp | 132 +++++++ src/libs/client/ThreadedSigClientInterface.cpp | 2 +- src/libs/client/ThreadedSigClientInterface.h | 171 --------- src/libs/client/ThreadedSigClientInterface.hpp | 171 +++++++++ src/libs/client/client.cpp | 4 +- src/libs/client/client.h | 43 --- src/libs/client/client.hpp | 43 +++ 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 ++++ src/libs/gui/App.cpp | 40 +-- src/libs/gui/App.h | 143 -------- src/libs/gui/App.hpp | 143 ++++++++ src/libs/gui/BreadCrumb.h | 81 ----- src/libs/gui/BreadCrumb.hpp | 81 +++++ src/libs/gui/BreadCrumbBox.cpp | 4 +- src/libs/gui/BreadCrumbBox.h | 70 ---- src/libs/gui/BreadCrumbBox.hpp | 70 ++++ src/libs/gui/ConfigWindow.cpp | 4 +- src/libs/gui/ConfigWindow.h | 65 ---- src/libs/gui/ConfigWindow.hpp | 65 ++++ src/libs/gui/Configuration.cpp | 12 +- src/libs/gui/Configuration.h | 80 ----- src/libs/gui/Configuration.hpp | 80 +++++ src/libs/gui/ConnectWindow.cpp | 32 +- src/libs/gui/ConnectWindow.h | 92 ----- src/libs/gui/ConnectWindow.hpp | 92 +++++ src/libs/gui/Connection.h | 60 ---- src/libs/gui/Connection.hpp | 60 ++++ src/libs/gui/ControlGroups.cpp | 18 +- src/libs/gui/ControlGroups.h | 163 --------- src/libs/gui/ControlGroups.hpp | 163 +++++++++ src/libs/gui/ControlPanel.cpp | 18 +- src/libs/gui/ControlPanel.h | 94 ----- src/libs/gui/ControlPanel.hpp | 94 +++++ src/libs/gui/DSSIController.cpp | 10 +- src/libs/gui/DSSIController.h | 77 ---- src/libs/gui/DSSIController.hpp | 77 ++++ src/libs/gui/DSSIModule.cpp | 4 +- src/libs/gui/DSSIModule.h | 46 --- src/libs/gui/DSSIModule.hpp | 46 +++ src/libs/gui/GladeFactory.cpp | 2 +- src/libs/gui/GladeFactory.h | 51 --- src/libs/gui/GladeFactory.hpp | 51 +++ src/libs/gui/LashController.cpp | 8 +- src/libs/gui/LashController.h | 56 --- src/libs/gui/LashController.hpp | 56 +++ src/libs/gui/LoadPatchWindow.cpp | 12 +- src/libs/gui/LoadPatchWindow.h | 81 ----- src/libs/gui/LoadPatchWindow.hpp | 81 +++++ src/libs/gui/LoadPluginWindow.cpp | 18 +- src/libs/gui/LoadPluginWindow.h | 151 -------- src/libs/gui/LoadPluginWindow.hpp | 151 ++++++++ src/libs/gui/LoadRemotePatchWindow.cpp | 14 +- src/libs/gui/LoadRemotePatchWindow.h | 93 ----- src/libs/gui/LoadRemotePatchWindow.hpp | 93 +++++ src/libs/gui/LoadSubpatchWindow.cpp | 16 +- src/libs/gui/LoadSubpatchWindow.h | 79 ----- src/libs/gui/LoadSubpatchWindow.hpp | 79 +++++ src/libs/gui/MessagesWindow.cpp | 2 +- src/libs/gui/MessagesWindow.h | 58 --- src/libs/gui/MessagesWindow.hpp | 58 +++ src/libs/gui/NewSubpatchWindow.cpp | 12 +- src/libs/gui/NewSubpatchWindow.h | 67 ---- src/libs/gui/NewSubpatchWindow.hpp | 67 ++++ src/libs/gui/NodeControlWindow.cpp | 16 +- src/libs/gui/NodeControlWindow.h | 76 ---- src/libs/gui/NodeControlWindow.hpp | 76 ++++ src/libs/gui/NodeMenu.cpp | 10 +- src/libs/gui/NodeMenu.h | 78 ---- src/libs/gui/NodeMenu.hpp | 78 ++++ src/libs/gui/NodeModule.cpp | 28 +- src/libs/gui/NodeModule.h | 90 ----- src/libs/gui/NodeModule.hpp | 90 +++++ src/libs/gui/NodePropertiesWindow.cpp | 6 +- src/libs/gui/NodePropertiesWindow.h | 58 --- src/libs/gui/NodePropertiesWindow.hpp | 58 +++ src/libs/gui/PatchCanvas.cpp | 43 +-- src/libs/gui/PatchCanvas.h | 131 ------- src/libs/gui/PatchCanvas.hpp | 131 +++++++ src/libs/gui/PatchPortModule.cpp | 20 +- src/libs/gui/PatchPortModule.h | 79 ----- src/libs/gui/PatchPortModule.hpp | 79 +++++ src/libs/gui/PatchPropertiesWindow.cpp | 4 +- src/libs/gui/PatchPropertiesWindow.h | 64 ---- src/libs/gui/PatchPropertiesWindow.hpp | 64 ++++ src/libs/gui/PatchTreeWindow.cpp | 18 +- src/libs/gui/PatchTreeWindow.h | 112 ------ src/libs/gui/PatchTreeWindow.hpp | 112 ++++++ src/libs/gui/PatchView.cpp | 24 +- src/libs/gui/PatchView.h | 102 ------ src/libs/gui/PatchView.hpp | 102 ++++++ src/libs/gui/PatchWindow.cpp | 40 +-- src/libs/gui/PatchWindow.h | 150 -------- src/libs/gui/PatchWindow.hpp | 150 ++++++++ src/libs/gui/Port.cpp | 14 +- src/libs/gui/Port.h | 57 --- src/libs/gui/Port.hpp | 57 +++ src/libs/gui/PortPropertiesWindow.cpp | 12 +- src/libs/gui/PortPropertiesWindow.h | 70 ---- src/libs/gui/PortPropertiesWindow.hpp | 70 ++++ src/libs/gui/RenameWindow.cpp | 10 +- src/libs/gui/RenameWindow.h | 60 ---- src/libs/gui/RenameWindow.hpp | 60 ++++ src/libs/gui/SubpatchModule.cpp | 20 +- src/libs/gui/SubpatchModule.h | 71 ---- src/libs/gui/SubpatchModule.hpp | 71 ++++ src/libs/gui/ThreadedLoader.cpp | 8 +- src/libs/gui/ThreadedLoader.h | 98 ----- src/libs/gui/ThreadedLoader.hpp | 98 +++++ src/libs/gui/UploadPatchWindow.cpp | 16 +- src/libs/gui/UploadPatchWindow.h | 105 ------ src/libs/gui/UploadPatchWindow.hpp | 105 ++++++ src/libs/gui/WindowFactory.cpp | 28 +- src/libs/gui/WindowFactory.h | 105 ------ src/libs/gui/WindowFactory.hpp | 105 ++++++ src/libs/gui/gui.cpp | 8 +- src/libs/gui/gui.h | 45 --- src/libs/gui/gui.hpp | 45 +++ src/libs/module/Makefile.am | 2 +- src/libs/module/Module.cpp | 2 +- src/libs/module/Module.h | 35 -- src/libs/module/Module.hpp | 35 ++ src/libs/serialisation/Loader.cpp | 8 +- src/libs/serialisation/Loader.h | 56 --- src/libs/serialisation/Loader.hpp | 56 +++ src/libs/serialisation/Makefile.am | 4 +- src/libs/serialisation/serialisation.cpp | 4 +- src/libs/serialisation/serialisation.h | 38 -- src/libs/serialisation/serialisation.hpp | 38 ++ src/progs/ingen/main.cpp | 17 +- 428 files changed, 13673 insertions(+), 13693 deletions(-) delete mode 100644 src/common/interface/ClientInterface.h create mode 100644 src/common/interface/ClientInterface.hpp delete mode 100644 src/common/interface/ClientKey.h create mode 100644 src/common/interface/ClientKey.hpp delete mode 100644 src/common/interface/EngineInterface.h create mode 100644 src/common/interface/EngineInterface.hpp delete mode 100644 src/common/interface/Responder.h create mode 100644 src/common/interface/Responder.hpp delete mode 100644 src/libs/client/ConnectionModel.h create mode 100644 src/libs/client/ConnectionModel.hpp delete mode 100644 src/libs/client/ControlModel.h create mode 100644 src/libs/client/ControlModel.hpp delete mode 100644 src/libs/client/DeprecatedLoader.h create mode 100644 src/libs/client/DeprecatedLoader.hpp delete mode 100644 src/libs/client/DirectSigClientInterface.h create mode 100644 src/libs/client/DirectSigClientInterface.hpp delete mode 100644 src/libs/client/NodeModel.h create mode 100644 src/libs/client/NodeModel.hpp delete mode 100644 src/libs/client/OSCClientReceiver.h create mode 100644 src/libs/client/OSCClientReceiver.hpp delete mode 100644 src/libs/client/OSCEngineSender.h create mode 100644 src/libs/client/OSCEngineSender.hpp delete mode 100644 src/libs/client/ObjectModel.h create mode 100644 src/libs/client/ObjectModel.hpp delete mode 100644 src/libs/client/PatchModel.h create mode 100644 src/libs/client/PatchModel.hpp delete mode 100644 src/libs/client/PluginModel.h create mode 100644 src/libs/client/PluginModel.hpp delete mode 100644 src/libs/client/PortModel.h create mode 100644 src/libs/client/PortModel.hpp delete mode 100644 src/libs/client/PresetModel.h create mode 100644 src/libs/client/PresetModel.hpp delete mode 100644 src/libs/client/Serializer.h create mode 100644 src/libs/client/Serializer.hpp delete mode 100644 src/libs/client/SigClientInterface.h create mode 100644 src/libs/client/SigClientInterface.hpp delete mode 100644 src/libs/client/Store.h create mode 100644 src/libs/client/Store.hpp delete mode 100644 src/libs/client/ThreadedSigClientInterface.h create mode 100644 src/libs/client/ThreadedSigClientInterface.hpp delete mode 100644 src/libs/client/client.h create mode 100644 src/libs/client/client.hpp 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 delete mode 100644 src/libs/gui/App.h create mode 100644 src/libs/gui/App.hpp delete mode 100644 src/libs/gui/BreadCrumb.h create mode 100644 src/libs/gui/BreadCrumb.hpp delete mode 100644 src/libs/gui/BreadCrumbBox.h create mode 100644 src/libs/gui/BreadCrumbBox.hpp delete mode 100644 src/libs/gui/ConfigWindow.h create mode 100644 src/libs/gui/ConfigWindow.hpp delete mode 100644 src/libs/gui/Configuration.h create mode 100644 src/libs/gui/Configuration.hpp delete mode 100644 src/libs/gui/ConnectWindow.h create mode 100644 src/libs/gui/ConnectWindow.hpp delete mode 100644 src/libs/gui/Connection.h create mode 100644 src/libs/gui/Connection.hpp delete mode 100644 src/libs/gui/ControlGroups.h create mode 100644 src/libs/gui/ControlGroups.hpp delete mode 100644 src/libs/gui/ControlPanel.h create mode 100644 src/libs/gui/ControlPanel.hpp delete mode 100644 src/libs/gui/DSSIController.h create mode 100644 src/libs/gui/DSSIController.hpp delete mode 100644 src/libs/gui/DSSIModule.h create mode 100644 src/libs/gui/DSSIModule.hpp delete mode 100644 src/libs/gui/GladeFactory.h create mode 100644 src/libs/gui/GladeFactory.hpp delete mode 100644 src/libs/gui/LashController.h create mode 100644 src/libs/gui/LashController.hpp delete mode 100644 src/libs/gui/LoadPatchWindow.h create mode 100644 src/libs/gui/LoadPatchWindow.hpp delete mode 100644 src/libs/gui/LoadPluginWindow.h create mode 100644 src/libs/gui/LoadPluginWindow.hpp delete mode 100644 src/libs/gui/LoadRemotePatchWindow.h create mode 100644 src/libs/gui/LoadRemotePatchWindow.hpp delete mode 100644 src/libs/gui/LoadSubpatchWindow.h create mode 100644 src/libs/gui/LoadSubpatchWindow.hpp delete mode 100644 src/libs/gui/MessagesWindow.h create mode 100644 src/libs/gui/MessagesWindow.hpp delete mode 100644 src/libs/gui/NewSubpatchWindow.h create mode 100644 src/libs/gui/NewSubpatchWindow.hpp delete mode 100644 src/libs/gui/NodeControlWindow.h create mode 100644 src/libs/gui/NodeControlWindow.hpp delete mode 100644 src/libs/gui/NodeMenu.h create mode 100644 src/libs/gui/NodeMenu.hpp delete mode 100644 src/libs/gui/NodeModule.h create mode 100644 src/libs/gui/NodeModule.hpp delete mode 100644 src/libs/gui/NodePropertiesWindow.h create mode 100644 src/libs/gui/NodePropertiesWindow.hpp delete mode 100644 src/libs/gui/PatchCanvas.h create mode 100644 src/libs/gui/PatchCanvas.hpp delete mode 100644 src/libs/gui/PatchPortModule.h create mode 100644 src/libs/gui/PatchPortModule.hpp delete mode 100644 src/libs/gui/PatchPropertiesWindow.h create mode 100644 src/libs/gui/PatchPropertiesWindow.hpp delete mode 100644 src/libs/gui/PatchTreeWindow.h create mode 100644 src/libs/gui/PatchTreeWindow.hpp delete mode 100644 src/libs/gui/PatchView.h create mode 100644 src/libs/gui/PatchView.hpp delete mode 100644 src/libs/gui/PatchWindow.h create mode 100644 src/libs/gui/PatchWindow.hpp delete mode 100644 src/libs/gui/Port.h create mode 100644 src/libs/gui/Port.hpp delete mode 100644 src/libs/gui/PortPropertiesWindow.h create mode 100644 src/libs/gui/PortPropertiesWindow.hpp delete mode 100644 src/libs/gui/RenameWindow.h create mode 100644 src/libs/gui/RenameWindow.hpp delete mode 100644 src/libs/gui/SubpatchModule.h create mode 100644 src/libs/gui/SubpatchModule.hpp delete mode 100644 src/libs/gui/ThreadedLoader.h create mode 100644 src/libs/gui/ThreadedLoader.hpp delete mode 100644 src/libs/gui/UploadPatchWindow.h create mode 100644 src/libs/gui/UploadPatchWindow.hpp delete mode 100644 src/libs/gui/WindowFactory.h create mode 100644 src/libs/gui/WindowFactory.hpp delete mode 100644 src/libs/gui/gui.h create mode 100644 src/libs/gui/gui.hpp delete mode 100644 src/libs/module/Module.h create mode 100644 src/libs/module/Module.hpp delete mode 100644 src/libs/serialisation/Loader.h create mode 100644 src/libs/serialisation/Loader.hpp delete mode 100644 src/libs/serialisation/serialisation.h create mode 100644 src/libs/serialisation/serialisation.hpp diff --git a/src/common/interface/ClientInterface.h b/src/common/interface/ClientInterface.h deleted file mode 100644 index 68dcaac3..00000000 --- a/src/common/interface/ClientInterface.h +++ /dev/null @@ -1,124 +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 CLIENTINTERFACE_H -#define CLIENTINTERFACE_H - -#include -#include -#include -using std::string; - -namespace Ingen { -namespace Shared { - - -/** The (only) interface the engine uses to communicate with clients. - * - * Purely virtual (except for the destructor). - */ -class ClientInterface -{ -public: - - virtual ~ClientInterface() {} - - virtual void response(int32_t id, bool success, string msg) = 0; - - virtual void enable() = 0; - - /** Signifies the client does not wish to receive any messages until - * enable is called. Useful for performance and avoiding feedback. - */ - virtual void disable() = 0; - - /** Bundles are a group of messages that are guaranteed to be in an - * atomic unit with guaranteed order (eg a packet). For datagram - * protocols (like UDP) there is likely an upper limit on bundle size. - */ - virtual void bundle_begin() = 0; - virtual void bundle_end() = 0; - - /** Transfers are 'weak' bundles. These are used to break a large group - * of similar/related messages into larger chunks (solely for communication - * efficiency). A bunch of messages in a transfer will arrive as 1 or more - * bundles (so a transfer can exceep the maximum bundle (packet) size). - */ - virtual void transfer_begin() = 0; - virtual void transfer_end() = 0; - - virtual void error(string msg) = 0; - - virtual void num_plugins(uint32_t num_plugins) = 0; - - virtual void new_plugin(string uri, - string type_uri, - string name) = 0; - - virtual void new_patch(string path, uint32_t poly) = 0; - - virtual void new_node(string plugin_uri, - string node_path, - bool is_polyphonic, - uint32_t num_ports) = 0; - - virtual void new_port(string path, - string data_type, - bool is_output) = 0; - - virtual void patch_enabled(string path) = 0; - - virtual void patch_disabled(string path) = 0; - - virtual void patch_cleared(string path) = 0; - - virtual void object_renamed(string old_path, - string new_path) = 0; - - virtual void object_destroyed(string path) = 0; - - virtual void connection(string src_port_path, - string dst_port_path) = 0; - - virtual void disconnection(string src_port_path, - string dst_port_path) = 0; - - virtual void metadata_update(string subject_path, - string predicate, - Raul::Atom value) = 0; - - virtual void control_change(string port_path, - float value) = 0; - - virtual void program_add(string node_path, - uint32_t bank, - uint32_t program, - string program_name) = 0; - - virtual void program_remove(string node_path, - uint32_t bank, - uint32_t program) = 0; - -protected: - ClientInterface() {} -}; - - -} // namespace Shared -} // namespace Ingen - -#endif diff --git a/src/common/interface/ClientInterface.hpp b/src/common/interface/ClientInterface.hpp new file mode 100644 index 00000000..06114101 --- /dev/null +++ b/src/common/interface/ClientInterface.hpp @@ -0,0 +1,123 @@ +/* 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 CLIENTINTERFACE_H +#define CLIENTINTERFACE_H + +#include +#include +#include + +namespace Ingen { +namespace Shared { + + +/** The (only) interface the engine uses to communicate with clients. + * + * Purely virtual (except for the destructor). + */ +class ClientInterface +{ +public: + + virtual ~ClientInterface() {} + + virtual void response(int32_t id, bool success, std::string msg) = 0; + + virtual void enable() = 0; + + /** Signifies the client does not wish to receive any messages until + * enable is called. Useful for performance and avoiding feedback. + */ + virtual void disable() = 0; + + /** Bundles are a group of messages that are guaranteed to be in an + * atomic unit with guaranteed order (eg a packet). For datagram + * protocols (like UDP) there is likely an upper limit on bundle size. + */ + virtual void bundle_begin() = 0; + virtual void bundle_end() = 0; + + /** Transfers are 'weak' bundles. These are used to break a large group + * of similar/related messages into larger chunks (solely for communication + * efficiency). A bunch of messages in a transfer will arrive as 1 or more + * bundles (so a transfer can exceep the maximum bundle (packet) size). + */ + virtual void transfer_begin() = 0; + virtual void transfer_end() = 0; + + virtual void error(std::string msg) = 0; + + virtual void num_plugins(uint32_t num_plugins) = 0; + + virtual void new_plugin(std::string uri, + std::string type_uri, + std::string name) = 0; + + virtual void new_patch(std::string path, uint32_t poly) = 0; + + virtual void new_node(std::string plugin_uri, + std::string node_path, + bool is_polyphonic, + uint32_t num_ports) = 0; + + virtual void new_port(std::string path, + std::string data_type, + bool is_output) = 0; + + virtual void patch_enabled(std::string path) = 0; + + virtual void patch_disabled(std::string path) = 0; + + virtual void patch_cleared(std::string path) = 0; + + virtual void object_renamed(std::string old_path, + std::string new_path) = 0; + + virtual void object_destroyed(std::string path) = 0; + + virtual void connection(std::string src_port_path, + std::string dst_port_path) = 0; + + virtual void disconnection(std::string src_port_path, + std::string dst_port_path) = 0; + + virtual void metadata_update(std::string subject_path, + std::string predicate, + Raul::Atom value) = 0; + + virtual void control_change(std::string port_path, + float value) = 0; + + virtual void program_add(std::string node_path, + uint32_t bank, + uint32_t program, + std::string program_name) = 0; + + virtual void program_remove(std::string node_path, + uint32_t bank, + uint32_t program) = 0; + +protected: + ClientInterface() {} +}; + + +} // namespace Shared +} // namespace Ingen + +#endif diff --git a/src/common/interface/ClientKey.h b/src/common/interface/ClientKey.h deleted file mode 100644 index b007a647..00000000 --- a/src/common/interface/ClientKey.h +++ /dev/null @@ -1,86 +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 CLIENTKEY_H -#define CLIENTKEY_H - -#include - -namespace Ingen { -namespace Shared { - - -/** Key for looking up clients. - * - * This might actually be a lookup key (as in OSC clients) or a direct handle - * of some kind (eg pointer) (for in-process or shared memory clients). - * - * This is shared code, nothing client or server code specific should be here. - */ -class ClientKey -{ -public: - /** A key to identify a particular ClientInterface. - * - * There are two different OSC key types because one is for server side, - * and one is for client side. A client can not identify it's own URL to - * the host (for NAT traversal, etc) so it can only know the outgoing UDP - * port it's sending on. The server however identifies that client by the - * full incoming URL. - */ - enum Type { - NIL, ///< A NULL key (represents no client) - OSC_URL, ///< An OSC URL (remote host/client) - OSC_PORT, ///< A local OSC port - DIRECT ///< A direct in-process function call client - }; - - ClientKey() - : _type(NIL), - _uri("") - {} - - ClientKey(Type type, const std::string& uri) - : _type(type) - , _uri(uri) - {} - - /*ClientKey(Type type, int port) - : _type(OSC_PORT) - , _port(port) - {}*/ - - inline bool - operator==(const ClientKey& key) const - { - return (_type == key._type && _uri == key._uri); - } - - inline Type type() const { return _type; } - inline const std::string& uri() const { return _uri; } - -protected: - Type _type; - const std::string _uri; ///< URL for OSC_URL, (string) port number for OSC_PORT -}; - - -} // namespace Shared -} // namespace Ingen - -#endif // CLIENTKEY_H - diff --git a/src/common/interface/ClientKey.hpp b/src/common/interface/ClientKey.hpp new file mode 100644 index 00000000..b007a647 --- /dev/null +++ b/src/common/interface/ClientKey.hpp @@ -0,0 +1,86 @@ +/* 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 CLIENTKEY_H +#define CLIENTKEY_H + +#include + +namespace Ingen { +namespace Shared { + + +/** Key for looking up clients. + * + * This might actually be a lookup key (as in OSC clients) or a direct handle + * of some kind (eg pointer) (for in-process or shared memory clients). + * + * This is shared code, nothing client or server code specific should be here. + */ +class ClientKey +{ +public: + /** A key to identify a particular ClientInterface. + * + * There are two different OSC key types because one is for server side, + * and one is for client side. A client can not identify it's own URL to + * the host (for NAT traversal, etc) so it can only know the outgoing UDP + * port it's sending on. The server however identifies that client by the + * full incoming URL. + */ + enum Type { + NIL, ///< A NULL key (represents no client) + OSC_URL, ///< An OSC URL (remote host/client) + OSC_PORT, ///< A local OSC port + DIRECT ///< A direct in-process function call client + }; + + ClientKey() + : _type(NIL), + _uri("") + {} + + ClientKey(Type type, const std::string& uri) + : _type(type) + , _uri(uri) + {} + + /*ClientKey(Type type, int port) + : _type(OSC_PORT) + , _port(port) + {}*/ + + inline bool + operator==(const ClientKey& key) const + { + return (_type == key._type && _uri == key._uri); + } + + inline Type type() const { return _type; } + inline const std::string& uri() const { return _uri; } + +protected: + Type _type; + const std::string _uri; ///< URL for OSC_URL, (string) port number for OSC_PORT +}; + + +} // namespace Shared +} // namespace Ingen + +#endif // CLIENTKEY_H + diff --git a/src/common/interface/EngineInterface.h b/src/common/interface/EngineInterface.h deleted file mode 100644 index 1701a78e..00000000 --- a/src/common/interface/EngineInterface.h +++ /dev/null @@ -1,142 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * Ingen is free software = 0; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation = 0; 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 = 0; 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 = 0; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef ENGINEINTERFACE_H -#define ENGINEINTERFACE_H - -#include -#include -#include -#include "interface/ClientInterface.h" -using std::string; - -namespace Ingen { -/** Shared code used on both client side and engine side (abstract interfaces). */ -namespace Shared { - -class ClientKey; -class Responder; - - -/** The (only) interface clients use to communicate with the engine. - * - * Purely virtual (except for the destructor). - */ -class EngineInterface -{ -public: - virtual ~EngineInterface() {} - - // Responses - virtual void set_responder(SharedPtr responder) = 0; - virtual void set_next_response_id(int32_t id) = 0; - virtual void disable_responses() = 0; - - // Client registration - virtual void register_client(ClientKey key, SharedPtr client) = 0; - virtual void unregister_client(ClientKey key) = 0; - - - // Engine commands - virtual void load_plugins() = 0; - virtual void activate() = 0; - virtual void deactivate() = 0; - virtual void quit() = 0; - - // Object commands - - virtual void create_patch(const string& path, - uint32_t poly) = 0; - - virtual void create_port(const string& path, - const string& data_type, - bool direction) = 0; - - virtual void create_node(const string& path, - const string& plugin_uri, - bool polyphonic) = 0; - - /** DEPRECATED */ - virtual void create_node(const string& path, - const string& plugin_type, - const string& library_name, - const string& plugin_label, - bool polyphonic) = 0; - - virtual void rename(const string& old_path, - const string& new_name) = 0; - - virtual void destroy(const string& path) = 0; - - virtual void clear_patch(const string& patch_path) = 0; - - virtual void enable_patch(const string& patch_path) = 0; - - virtual void disable_patch(const string& patch_path) = 0; - - virtual void connect(const string& src_port_path, - const string& dst_port_path) = 0; - - virtual void disconnect(const string& src_port_path, - const string& dst_port_path) = 0; - - virtual void disconnect_all(const string& node_path) = 0; - - virtual void set_port_value(const string& port_path, - float val) = 0; - - virtual void set_port_value(const string& port_path, - uint32_t voice, - float val) = 0; - - virtual void set_port_value_queued(const string& port_path, - float val) = 0; - - virtual void set_program(const string& node_path, - uint32_t bank, - uint32_t program) = 0; - - virtual void midi_learn(const string& node_path) = 0; - - virtual void set_metadata(const string& path, - const string& predicate, - const Raul::Atom& value) = 0; - - // Requests // - - virtual void ping() = 0; - - virtual void request_plugin(const string& uri) = 0; - - virtual void request_object(const string& path) = 0; - - virtual void request_port_value(const string& port_path) = 0; - - virtual void request_plugins() = 0; - - virtual void request_all_objects() = 0; - -protected: - EngineInterface() {} -}; - - -} // namespace Shared -} // namespace Ingen - -#endif // ENGINEINTERFACE_H - diff --git a/src/common/interface/EngineInterface.hpp b/src/common/interface/EngineInterface.hpp new file mode 100644 index 00000000..af662f82 --- /dev/null +++ b/src/common/interface/EngineInterface.hpp @@ -0,0 +1,142 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * Ingen is free software = 0; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation = 0; 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 = 0; 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 = 0; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef ENGINEINTERFACE_H +#define ENGINEINTERFACE_H + +#include +#include +#include +#include "interface/ClientInterface.hpp" +using std::string; + +namespace Ingen { +/** Shared code used on both client side and engine side (abstract interfaces). */ +namespace Shared { + +class ClientKey; +class Responder; + + +/** The (only) interface clients use to communicate with the engine. + * + * Purely virtual (except for the destructor). + */ +class EngineInterface +{ +public: + virtual ~EngineInterface() {} + + // Responses + virtual void set_responder(SharedPtr responder) = 0; + virtual void set_next_response_id(int32_t id) = 0; + virtual void disable_responses() = 0; + + // Client registration + virtual void register_client(ClientKey key, SharedPtr client) = 0; + virtual void unregister_client(ClientKey key) = 0; + + + // Engine commands + virtual void load_plugins() = 0; + virtual void activate() = 0; + virtual void deactivate() = 0; + virtual void quit() = 0; + + // Object commands + + virtual void create_patch(const string& path, + uint32_t poly) = 0; + + virtual void create_port(const string& path, + const string& data_type, + bool direction) = 0; + + virtual void create_node(const string& path, + const string& plugin_uri, + bool polyphonic) = 0; + + /** DEPRECATED */ + virtual void create_node(const string& path, + const string& plugin_type, + const string& library_name, + const string& plugin_label, + bool polyphonic) = 0; + + virtual void rename(const string& old_path, + const string& new_name) = 0; + + virtual void destroy(const string& path) = 0; + + virtual void clear_patch(const string& patch_path) = 0; + + virtual void enable_patch(const string& patch_path) = 0; + + virtual void disable_patch(const string& patch_path) = 0; + + virtual void connect(const string& src_port_path, + const string& dst_port_path) = 0; + + virtual void disconnect(const string& src_port_path, + const string& dst_port_path) = 0; + + virtual void disconnect_all(const string& node_path) = 0; + + virtual void set_port_value(const string& port_path, + float val) = 0; + + virtual void set_port_value(const string& port_path, + uint32_t voice, + float val) = 0; + + virtual void set_port_value_queued(const string& port_path, + float val) = 0; + + virtual void set_program(const string& node_path, + uint32_t bank, + uint32_t program) = 0; + + virtual void midi_learn(const string& node_path) = 0; + + virtual void set_metadata(const string& path, + const string& predicate, + const Raul::Atom& value) = 0; + + // Requests // + + virtual void ping() = 0; + + virtual void request_plugin(const string& uri) = 0; + + virtual void request_object(const string& path) = 0; + + virtual void request_port_value(const string& port_path) = 0; + + virtual void request_plugins() = 0; + + virtual void request_all_objects() = 0; + +protected: + EngineInterface() {} +}; + + +} // namespace Shared +} // namespace Ingen + +#endif // ENGINEINTERFACE_H + diff --git a/src/common/interface/Makefile.am b/src/common/interface/Makefile.am index 347e8186..7a8f641d 100644 --- a/src/common/interface/Makefile.am +++ b/src/common/interface/Makefile.am @@ -1,6 +1,6 @@ EXTRA_DIST = \ README \ - ClientInterface.h \ - ClientKey.h \ - Responder.h \ - EngineInterface.h + ClientInterface.hpp \ + ClientKey.hpp \ + Responder.hpp \ + EngineInterface.hpp diff --git a/src/common/interface/Responder.h b/src/common/interface/Responder.h deleted file mode 100644 index 6e809e1a..00000000 --- a/src/common/interface/Responder.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 RESPONDER_H -#define RESPONDER_H - -#include -#include -#include -#include "interface/ClientKey.h" -#include "interface/ClientInterface.h" -using std::string; - -namespace Ingen { -namespace Shared { - -using Shared::ClientKey; -using Shared::ClientInterface; - - -/** Class to handle responding to clients. - * - * This is an abstract base class to fully abstract the details of client - * communication from the internals of the engine. - * - * Note that this class only handles sending responses to commands from - * clients, (ie OK or an error), not notifications (ie new node, - * disconnection) - that's what ClientInterface is for. If a command is - * a request, the ClientKey of the Responder can be used to find the - * ClientInterface which should receive the response. - * - * ClientInterface and Responder are seperate because responding might not - * actually get exposed to the client interface (eg in simulated blocking - * interfaces that wait for responses before returning). - * - * Note for messages that have a "response" and some broadcasted effect - * (eg setting a port value) the "response" MUST be sent first since Responder - * is responsible for controlling whether the client wishes to receive the - * notification. - */ -class Responder -{ -public: - Responder() {} - virtual ~Responder() {} - - virtual ClientKey client_key() { return ClientKey(); } - virtual SharedPtr client() { return SharedPtr(); } - - virtual void set_id(int32_t id) {} - - virtual void respond_ok() {} - virtual void respond_error(const string& msg) {} -}; - - -} // namespace Shared -} // namespace Ingen - -#endif // RESPONDER_H - diff --git a/src/common/interface/Responder.hpp b/src/common/interface/Responder.hpp new file mode 100644 index 00000000..fc8cdcf7 --- /dev/null +++ b/src/common/interface/Responder.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 RESPONDER_H +#define RESPONDER_H + +#include +#include +#include +#include "interface/ClientKey.hpp" +#include "interface/ClientInterface.hpp" + +namespace Ingen { +namespace Shared { + +using Shared::ClientKey; +using Shared::ClientInterface; + + +/** Class to handle responding to clients. + * + * This is an abstract base class to fully abstract the details of client + * communication from the internals of the engine. + * + * Note that this class only handles sending responses to commands from + * clients, (ie OK or an error), not notifications (ie new node, + * disconnection) - that's what ClientInterface is for. If a command is + * a request, the ClientKey of the Responder can be used to find the + * ClientInterface which should receive the response. + * + * ClientInterface and Responder are seperate because responding might not + * actually get exposed to the client interface (eg in simulated blocking + * interfaces that wait for responses before returning). + * + * Note for messages that have a "response" and some broadcasted effect + * (eg setting a port value) the "response" MUST be sent first since Responder + * is responsible for controlling whether the client wishes to receive the + * notification. + */ +class Responder +{ +public: + Responder() {} + virtual ~Responder() {} + + virtual ClientKey client_key() { return ClientKey(); } + virtual SharedPtr client() { return SharedPtr(); } + + virtual void set_id(int32_t id) {} + + virtual void respond_ok() {} + virtual void respond_error(const std::string& msg) {} +}; + + +} // namespace Shared +} // namespace Ingen + +#endif // RESPONDER_H + diff --git a/src/libs/client/ConnectionModel.cpp b/src/libs/client/ConnectionModel.cpp index 4860a7db..a40da9e4 100644 --- a/src/libs/client/ConnectionModel.cpp +++ b/src/libs/client/ConnectionModel.cpp @@ -16,9 +16,9 @@ */ #include -#include "ConnectionModel.h" -#include "PortModel.h" -#include "PatchModel.h" +#include "ConnectionModel.hpp" +#include "PortModel.hpp" +#include "PatchModel.hpp" namespace Ingen { namespace Client { diff --git a/src/libs/client/ConnectionModel.h b/src/libs/client/ConnectionModel.h deleted file mode 100644 index 9e62d5b4..00000000 --- a/src/libs/client/ConnectionModel.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 CONNECTIONMODEL_H -#define CONNECTIONMODEL_H - -#include -#include -#include -#include "PortModel.h" -#include -using std::string; - -namespace Ingen { -namespace Client { - -class Store; - - -/** Class to represent a port->port connection in the engine. - * - * This can either have pointers to the connection ports' models, or just - * paths as strings. The engine passes just strings (by necessity), but - * clients can set the pointers then they don't have to worry about port - * renaming, as the connections will always return the port's path, even - * if it changes. - * - * \ingroup IngenClient - */ -class ConnectionModel -{ -public: - SharedPtr src_port() const { return _src_port; } - SharedPtr dst_port() const { return _dst_port; } - - const Path& src_port_path() const; - const Path& dst_port_path() const; - -private: - friend class Store; - - ConnectionModel(const Path& src_port, const Path& dst_port); - ConnectionModel(SharedPtr src, SharedPtr dst); - - void set_src_port(SharedPtr port) { _src_port = port; _src_port_path = port->path(); } - void set_dst_port(SharedPtr port) { _dst_port = port; _dst_port_path = port->path(); } - - void src_port_path(const string& s) { _src_port_path = s; } - void dst_port_path(const string& s) { _dst_port_path = s; } - - Path _src_port_path; ///< Only used if _src_port == NULL - Path _dst_port_path; ///< Only used if _dst_port == NULL - SharedPtr _src_port; - SharedPtr _dst_port; -}; - -typedef list > ConnectionList; - - -} // namespace Client -} // namespace Ingen - -#endif // CONNECTIONMODEL_H diff --git a/src/libs/client/ConnectionModel.hpp b/src/libs/client/ConnectionModel.hpp new file mode 100644 index 00000000..59dacae7 --- /dev/null +++ b/src/libs/client/ConnectionModel.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 CONNECTIONMODEL_H +#define CONNECTIONMODEL_H + +#include +#include +#include +#include "PortModel.hpp" +#include +using std::string; + +namespace Ingen { +namespace Client { + +class Store; + + +/** Class to represent a port->port connection in the engine. + * + * This can either have pointers to the connection ports' models, or just + * paths as strings. The engine passes just strings (by necessity), but + * clients can set the pointers then they don't have to worry about port + * renaming, as the connections will always return the port's path, even + * if it changes. + * + * \ingroup IngenClient + */ +class ConnectionModel +{ +public: + SharedPtr src_port() const { return _src_port; } + SharedPtr dst_port() const { return _dst_port; } + + const Path& src_port_path() const; + const Path& dst_port_path() const; + +private: + friend class Store; + + ConnectionModel(const Path& src_port, const Path& dst_port); + ConnectionModel(SharedPtr src, SharedPtr dst); + + void set_src_port(SharedPtr port) { _src_port = port; _src_port_path = port->path(); } + void set_dst_port(SharedPtr port) { _dst_port = port; _dst_port_path = port->path(); } + + void src_port_path(const string& s) { _src_port_path = s; } + void dst_port_path(const string& s) { _dst_port_path = s; } + + Path _src_port_path; ///< Only used if _src_port == NULL + Path _dst_port_path; ///< Only used if _dst_port == NULL + SharedPtr _src_port; + SharedPtr _dst_port; +}; + +typedef list > ConnectionList; + + +} // namespace Client +} // namespace Ingen + +#endif // CONNECTIONMODEL_H diff --git a/src/libs/client/ControlModel.h b/src/libs/client/ControlModel.h deleted file mode 100644 index 5729faec..00000000 --- a/src/libs/client/ControlModel.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 alongCont - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef CONTROLMODEL_H -#define CONTROLMODEL_H - -#include -#include - -namespace Ingen { -namespace Client { - - -/** A single port's control setting (in a preset). - * - * \ingroup IngenClient - */ -class ControlModel -{ -public: - ControlModel(const Path& port_path, float value) - : _port_path(port_path), - _value(value) - { - assert(_port_path.find("//") == string::npos); - } - - const Path& port_path() const { return _port_path; } - void port_path(const string& p) { _port_path = p; } - float value() const { return _value; } - void value(float v) { _value = v; } - -private: - Path _port_path; - float _value; -}; - - -} // namespace Client -} // namespace Ingen - -#endif // CONTROLMODEL diff --git a/src/libs/client/ControlModel.hpp b/src/libs/client/ControlModel.hpp new file mode 100644 index 00000000..db0e156b --- /dev/null +++ b/src/libs/client/ControlModel.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 alongCont + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef CONTROLMODEL_H +#define CONTROLMODEL_H + +#include +#include + +namespace Ingen { +namespace Client { + + +/** A single port's control setting (in a preset). + * + * \ingroup IngenClient + */ +class ControlModel +{ +public: + ControlModel(const Path& port_path, float value) + : _port_path(port_path), + _value(value) + { + assert(_port_path.find("//") == string::npos); + } + + const Path& port_path() const { return _port_path; } + void port_path(const string& p) { _port_path = p; } + float value() const { return _value; } + void value(float v) { _value = v; } + +private: + Path _port_path; + float _value; +}; + + +} // namespace Client +} // namespace Ingen + +#endif // CONTROLMODEL diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp index 3c95d9ac..c5354c5a 100644 --- a/src/libs/client/DeprecatedLoader.cpp +++ b/src/libs/client/DeprecatedLoader.cpp @@ -29,15 +29,15 @@ #include #include #include -#include -#include "interface/EngineInterface.h" -#include "PatchModel.h" -#include "NodeModel.h" -#include "ConnectionModel.h" -#include "PortModel.h" -#include "PresetModel.h" -#include "PluginModel.h" -#include "DeprecatedLoader.h" +#include +#include "interface/EngineInterface.hpp" +#include "PatchModel.hpp" +#include "NodeModel.hpp" +#include "ConnectionModel.hpp" +#include "PortModel.hpp" +#include "PresetModel.hpp" +#include "PluginModel.hpp" +#include "DeprecatedLoader.hpp" using std::string; using std::vector; using std::pair; using std::cerr; using std::cout; using std::endl; diff --git a/src/libs/client/DeprecatedLoader.h b/src/libs/client/DeprecatedLoader.h deleted file mode 100644 index 1bf81c9d..00000000 --- a/src/libs/client/DeprecatedLoader.h +++ /dev/null @@ -1,92 +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 PATCHLIBRARIAN_H -#define PATCHLIBRARIAN_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "interface/EngineInterface.h" -#include "ObjectModel.h" - -using std::string; -using Ingen::Shared::EngineInterface; - -namespace Ingen { -namespace Client { - -class PatchModel; -class NodeModel; -class ConnectionModel; -class PresetModel; - - -/** Loads deprecated (XML) patch files (from the Om days). - * - * \ingroup IngenClient - */ -class DeprecatedLoader -{ -public: - DeprecatedLoader(SharedPtr engine) - : /*_patch_search_path(".")*/ _engine(engine) - { - assert(_engine); - } - - /*void path(const string& path) { _patch_search_path = path; } - const string& path() { return _patch_search_path; }*/ - - string find_file(const string& filename, const string& additional_path = ""); - - string load_patch(const Glib::ustring& filename, - boost::optional parent_path, - string name, - size_t poly, - MetadataMap initial_data, - bool existing = false); - -private: - void add_metadata(MetadataMap& data, string key, string value); - - string nameify_if_invalid(const string& name); - string translate_load_path(const string& path); - - //string _patch_search_path; - SharedPtr _engine; - - /// Translations of paths from the loading file to actual paths (for deprecated patches) - std::map _load_path_translations; - - bool load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); - bool load_connection(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); - bool load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); - bool load_subpatch(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); -}; - - -} // namespace Client -} // namespace Ingen - -#endif // PATCHLIBRARIAN_H diff --git a/src/libs/client/DeprecatedLoader.hpp b/src/libs/client/DeprecatedLoader.hpp new file mode 100644 index 00000000..593cfb33 --- /dev/null +++ b/src/libs/client/DeprecatedLoader.hpp @@ -0,0 +1,92 @@ +/* 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 PATCHLIBRARIAN_H +#define PATCHLIBRARIAN_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "interface/EngineInterface.hpp" +#include "ObjectModel.hpp" + +using std::string; +using Ingen::Shared::EngineInterface; + +namespace Ingen { +namespace Client { + +class PatchModel; +class NodeModel; +class ConnectionModel; +class PresetModel; + + +/** Loads deprecated (XML) patch files (from the Om days). + * + * \ingroup IngenClient + */ +class DeprecatedLoader +{ +public: + DeprecatedLoader(SharedPtr engine) + : /*_patch_search_path(".")*/ _engine(engine) + { + assert(_engine); + } + + /*void path(const string& path) { _patch_search_path = path; } + const string& path() { return _patch_search_path; }*/ + + string find_file(const string& filename, const string& additional_path = ""); + + string load_patch(const Glib::ustring& filename, + boost::optional parent_path, + string name, + size_t poly, + MetadataMap initial_data, + bool existing = false); + +private: + void add_metadata(MetadataMap& data, string key, string value); + + string nameify_if_invalid(const string& name); + string translate_load_path(const string& path); + + //string _patch_search_path; + SharedPtr _engine; + + /// Translations of paths from the loading file to actual paths (for deprecated patches) + std::map _load_path_translations; + + bool load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); + bool load_connection(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); + bool load_preset(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); + bool load_subpatch(const Path& parent, xmlDocPtr doc, const xmlNodePtr cur); +}; + + +} // namespace Client +} // namespace Ingen + +#endif // PATCHLIBRARIAN_H diff --git a/src/libs/client/DirectSigClientInterface.h b/src/libs/client/DirectSigClientInterface.h deleted file mode 100644 index 18b1247b..00000000 --- a/src/libs/client/DirectSigClientInterface.h +++ /dev/null @@ -1,115 +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 DIRECTSIGCLIENTINTERFACE_H -#define DIRECTSIGCLIENTINTERFACE_H - -#include -#include -#include -#include "SigClientInterface.h" -using std::string; - -namespace Ingen { -namespace Client { - - -/** A direct (nonthreaded) LibSigC++ signal emitting interface for clients to use. - * - * The signals from SigClientInterface will be emitted in the same thread as the - * ClientInterface functions are called. You can not set this directly as an - * in-engine client interface and connect the signals to GTK. - * - * For maximum performance of a monolithic single-client GUI app, it would be - * nice if the post processing thread in the engine could actually be the GTK - * thread, then you could use this directly and minimize queueing of events and - * thread/scheduling overhead. - * - * sed would have the copyright to this code if it was a legal person. - */ -class DirectSigClientInterface : virtual public SigClientInterface -{ -public: - DirectSigClientInterface(); - -private: - - // ClientInterface function implementations to drive SigClientInterface signals - - virtual void bundle_begin() - { bundle_begin_sig.emit(); } - - virtual void bundle_end() - { bundle_end_sig.emit(); } - - virtual void error(const string& msg) - { error_sig.emit(msg); } - - virtual void num_plugins(uint32_t num) - { num_plugins_sig.emit(num); } - - virtual void new_plugin(const string& type, const string& uri, const string& name) - { new_plugin_sig.emit(type, uri, name); } - - virtual void new_patch(const string& path, uint32_t poly) - { new_patch_sig.emit(path, poly); } - - virtual void new_node(const string& plugin_type, const string& plugin_uri, const string& node_path, bool is_polyphonic, uint32_t num_ports) - { new_node_sig.emit(plugin_type, plugin_uri, node_path, is_polyphonic, num_ports); } - - virtual void new_port(const string& path, const string& data_type, bool is_output) - { new_port_sig.emit(path, data_type, is_output); } - - virtual void patch_enabled(const string& path) - { patch_enabled_sig.emit(path); } - - virtual void patch_disabled(const string& path) - { patch_disabled_sig.emit(path); } - - virtual void patch_cleared(const string& path) - { patch_cleared_sig.emit(path); } - - virtual void object_renamed(const string& old_path, const string& new_path) - { object_renamed_sig.emit(old_path, new_path); } - - virtual void object_destroyed(const string& path) - { object_destroyed_sig.emit(path); } - - virtual void connection(const string& src_port_path, const string& dst_port_path) - { connection_sig.emit(src_port_path, dst_port_path); } - - virtual void disconnection(const string& src_port_path, const string& dst_port_path) - { disconnection_sig.emit(src_port_path, dst_port_path); } - - virtual void metadata_update(const string& subject_path, const string& predicate, const string& value) - { metadata_update_sig.emit(subject_path, predicate, value); } - - virtual void control_change(const string& port_path, float value) - { control_change_sig.emit(port_path, value); } - - virtual void program_add(const string& node_path, uint32_t bank, uint32_t program, const string& program_name) - { program_add_sig.emit(node_path, bank, program, program_name); } - - virtual void program_remove(const string& node_path, uint32_t bank, uint32_t program) - { program_remove_sig.emit(node_path, bank, program); } -}; - - -} // namespace Client -} // namespace Ingen - -#endif diff --git a/src/libs/client/DirectSigClientInterface.hpp b/src/libs/client/DirectSigClientInterface.hpp new file mode 100644 index 00000000..43877992 --- /dev/null +++ b/src/libs/client/DirectSigClientInterface.hpp @@ -0,0 +1,115 @@ +/* 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 DIRECTSIGCLIENTINTERFACE_H +#define DIRECTSIGCLIENTINTERFACE_H + +#include +#include +#include +#include "SigClientInterface.hpp" +using std::string; + +namespace Ingen { +namespace Client { + + +/** A direct (nonthreaded) LibSigC++ signal emitting interface for clients to use. + * + * The signals from SigClientInterface will be emitted in the same thread as the + * ClientInterface functions are called. You can not set this directly as an + * in-engine client interface and connect the signals to GTK. + * + * For maximum performance of a monolithic single-client GUI app, it would be + * nice if the post processing thread in the engine could actually be the GTK + * thread, then you could use this directly and minimize queueing of events and + * thread/scheduling overhead. + * + * sed would have the copyright to this code if it was a legal person. + */ +class DirectSigClientInterface : virtual public SigClientInterface +{ +public: + DirectSigClientInterface(); + +private: + + // ClientInterface function implementations to drive SigClientInterface signals + + virtual void bundle_begin() + { bundle_begin_sig.emit(); } + + virtual void bundle_end() + { bundle_end_sig.emit(); } + + virtual void error(const string& msg) + { error_sig.emit(msg); } + + virtual void num_plugins(uint32_t num) + { num_plugins_sig.emit(num); } + + virtual void new_plugin(const string& type, const string& uri, const string& name) + { new_plugin_sig.emit(type, uri, name); } + + virtual void new_patch(const string& path, uint32_t poly) + { new_patch_sig.emit(path, poly); } + + virtual void new_node(const string& plugin_type, const string& plugin_uri, const string& node_path, bool is_polyphonic, uint32_t num_ports) + { new_node_sig.emit(plugin_type, plugin_uri, node_path, is_polyphonic, num_ports); } + + virtual void new_port(const string& path, const string& data_type, bool is_output) + { new_port_sig.emit(path, data_type, is_output); } + + virtual void patch_enabled(const string& path) + { patch_enabled_sig.emit(path); } + + virtual void patch_disabled(const string& path) + { patch_disabled_sig.emit(path); } + + virtual void patch_cleared(const string& path) + { patch_cleared_sig.emit(path); } + + virtual void object_renamed(const string& old_path, const string& new_path) + { object_renamed_sig.emit(old_path, new_path); } + + virtual void object_destroyed(const string& path) + { object_destroyed_sig.emit(path); } + + virtual void connection(const string& src_port_path, const string& dst_port_path) + { connection_sig.emit(src_port_path, dst_port_path); } + + virtual void disconnection(const string& src_port_path, const string& dst_port_path) + { disconnection_sig.emit(src_port_path, dst_port_path); } + + virtual void metadata_update(const string& subject_path, const string& predicate, const string& value) + { metadata_update_sig.emit(subject_path, predicate, value); } + + virtual void control_change(const string& port_path, float value) + { control_change_sig.emit(port_path, value); } + + virtual void program_add(const string& node_path, uint32_t bank, uint32_t program, const string& program_name) + { program_add_sig.emit(node_path, bank, program, program_name); } + + virtual void program_remove(const string& node_path, uint32_t bank, uint32_t program) + { program_remove_sig.emit(node_path, bank, program); } +}; + + +} // namespace Client +} // namespace Ingen + +#endif diff --git a/src/libs/client/Makefile.am b/src/libs/client/Makefile.am index 1c009868..45ec0bea 100644 --- a/src/libs/client/Makefile.am +++ b/src/libs/client/Makefile.am @@ -20,38 +20,38 @@ libingen_client_la_LIBADD = \ @LSIGCPP_LIBS@ @GLIBMM_LIBS@ libingen_client_la_SOURCES = \ - client.h \ - client.cpp \ - OSCEngineSender.h \ - OSCEngineSender.cpp \ - OSCClientReceiver.h \ + $(top_srcdir)/ingen/src/common/interface/ClientInterface.hpp \ + $(top_srcdir)/ingen/src/common/interface/EngineInterface.hpp \ + ConnectionModel.cpp \ + ConnectionModel.hpp \ + ControlModel.hpp \ + DeprecatedLoader.cpp \ + DeprecatedLoader.hpp \ + DirectSigClientInterface.hpp \ + NodeModel.cpp \ + NodeModel.hpp \ OSCClientReceiver.cpp \ - SigClientInterface.h \ - DirectSigClientInterface.h \ - ThreadedSigClientInterface.h \ - ThreadedSigClientInterface.cpp \ - PresetModel.h \ - ControlModel.h \ - ObjectModel.h \ + OSCClientReceiver.hpp \ + OSCEngineSender.cpp \ + OSCEngineSender.hpp \ ObjectModel.cpp \ - NodeModel.h \ - NodeModel.cpp \ - PortModel.h \ - PortModel.cpp \ - PatchModel.h \ + ObjectModel.hpp \ PatchModel.cpp \ - PluginModel.h \ + PatchModel.hpp \ PluginModel.cpp \ - Serializer.h \ + PluginModel.hpp \ + PortModel.cpp \ + PortModel.hpp \ + PresetModel.hpp \ Serializer.cpp \ - DeprecatedLoader.h \ - DeprecatedLoader.cpp \ - ConnectionModel.h \ - ConnectionModel.cpp \ - Store.h \ + Serializer.hpp \ + SigClientInterface.hpp \ Store.cpp \ - $(top_srcdir)/ingen/src/common/interface/ClientInterface.h \ - $(top_srcdir)/ingen/src/common/interface/EngineInterface.h + Store.hpp \ + ThreadedSigClientInterface.cpp \ + ThreadedSigClientInterface.hpp \ + client.cpp \ + client.hpp endif # BUILD_CLIENT_LIB diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp index c3414c79..39c31c82 100644 --- a/src/libs/client/NodeModel.cpp +++ b/src/libs/client/NodeModel.cpp @@ -15,8 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "NodeModel.h" -#include "PatchModel.h" +#include "NodeModel.hpp" +#include "PatchModel.hpp" #include namespace Ingen { diff --git a/src/libs/client/NodeModel.h b/src/libs/client/NodeModel.h deleted file mode 100644 index f8866f15..00000000 --- a/src/libs/client/NodeModel.h +++ /dev/null @@ -1,98 +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 NODEMODEL_H -#define NODEMODEL_H - -#include -#include -#include -#include -#include -#include "ObjectModel.h" -#include "PortModel.h" -#include -#include -#include "PluginModel.h" - -using std::string; using std::map; using std::find; -using std::cout; using std::cerr; using std::endl; - -namespace Ingen { -namespace Client { - -class PluginModel; -class Store; - - -/** Node model class, used by the client to store engine's state. - * - * \ingroup IngenClient - */ -class NodeModel : public ObjectModel -{ -public: - virtual ~NodeModel(); - - SharedPtr get_port(const string& port_name) const; - - const map >& get_programs() const { return _banks; } - const string& plugin_uri() const { return _plugin_uri; } - SharedPtr plugin() const { return _plugin; } - int num_ports() const { return _ports.size(); } - const PortModelList& ports() const { return _ports; } - virtual bool polyphonic() const { return _polyphonic; } - - // Signals - sigc::signal > new_port_sig; - sigc::signal > removed_port_sig; - -protected: - friend class Store; - - NodeModel(const string& plugin_uri, const Path& path, bool polyphonic); - NodeModel(SharedPtr plugin, const Path& path, bool polyphonic); - - NodeModel(const Path& path); - void add_child(SharedPtr c); - void remove_child(SharedPtr c); - void add_port(SharedPtr pm); - void remove_port(SharedPtr pm); - void remove_port(const Path& port_path); - void add_program(int bank, int program, const string& name); - void remove_program(int bank, int program); - - virtual void clear(); - - friend class PatchModel; - void set_path(const Path& p); - - bool _polyphonic; - PortModelList _ports; ///< List of ports (not a map to preserve order) - string _plugin_uri; ///< Plugin URI (if PluginModel is unknown) - SharedPtr _plugin; ///< The plugin this node is an instance of - map > _banks; ///< DSSI banks -}; - - -typedef map > NodeModelMap; - - -} // namespace Client -} // namespace Ingen - -#endif // NODEMODEL_H diff --git a/src/libs/client/NodeModel.hpp b/src/libs/client/NodeModel.hpp new file mode 100644 index 00000000..68027526 --- /dev/null +++ b/src/libs/client/NodeModel.hpp @@ -0,0 +1,98 @@ +/* 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 NODEMODEL_H +#define NODEMODEL_H + +#include +#include +#include +#include +#include +#include "ObjectModel.hpp" +#include "PortModel.hpp" +#include +#include +#include "PluginModel.hpp" + +using std::string; using std::map; using std::find; +using std::cout; using std::cerr; using std::endl; + +namespace Ingen { +namespace Client { + +class PluginModel; +class Store; + + +/** Node model class, used by the client to store engine's state. + * + * \ingroup IngenClient + */ +class NodeModel : public ObjectModel +{ +public: + virtual ~NodeModel(); + + SharedPtr get_port(const string& port_name) const; + + const map >& get_programs() const { return _banks; } + const string& plugin_uri() const { return _plugin_uri; } + SharedPtr plugin() const { return _plugin; } + int num_ports() const { return _ports.size(); } + const PortModelList& ports() const { return _ports; } + virtual bool polyphonic() const { return _polyphonic; } + + // Signals + sigc::signal > new_port_sig; + sigc::signal > removed_port_sig; + +protected: + friend class Store; + + NodeModel(const string& plugin_uri, const Path& path, bool polyphonic); + NodeModel(SharedPtr plugin, const Path& path, bool polyphonic); + + NodeModel(const Path& path); + void add_child(SharedPtr c); + void remove_child(SharedPtr c); + void add_port(SharedPtr pm); + void remove_port(SharedPtr pm); + void remove_port(const Path& port_path); + void add_program(int bank, int program, const string& name); + void remove_program(int bank, int program); + + virtual void clear(); + + friend class PatchModel; + void set_path(const Path& p); + + bool _polyphonic; + PortModelList _ports; ///< List of ports (not a map to preserve order) + string _plugin_uri; ///< Plugin URI (if PluginModel is unknown) + SharedPtr _plugin; ///< The plugin this node is an instance of + map > _banks; ///< DSSI banks +}; + + +typedef map > NodeModelMap; + + +} // namespace Client +} // namespace Ingen + +#endif // NODEMODEL_H diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp index d56b8f2e..96533db2 100644 --- a/src/libs/client/OSCClientReceiver.cpp +++ b/src/libs/client/OSCClientReceiver.cpp @@ -15,8 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "OSCClientReceiver.h" -#include +#include "OSCClientReceiver.hpp" +#include #include #include #include @@ -132,7 +132,7 @@ OSCClientReceiver::error_cb(int num, const char* msg, const char* path) int OSCClientReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data) { - string msg = "Received unknown OSC message: "; + std::string msg = "Received unknown OSC message: "; msg += path; cerr << msg << endl; diff --git a/src/libs/client/OSCClientReceiver.h b/src/libs/client/OSCClientReceiver.h deleted file mode 100644 index 91bd3d09..00000000 --- a/src/libs/client/OSCClientReceiver.h +++ /dev/null @@ -1,111 +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 OSCCLIENTRECEIVER_H -#define OSCCLIENTRECEIVER_H - -#include -#include -#include -#include "interface/ClientInterface.h" - -namespace Ingen { - -/** Client library */ -namespace Client { - -//class NodeModel; -//class PresetModel; - -/* 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* osc_listener)\ -{ return ((OSCClientReceiver*)osc_listener)->_##name##_cb(path, types, argv, argc, msg); } - - -/** Callbacks for "notification band" OSC messages. - * - * Receives all notification of engine state, but not replies on the "control - * band". See OSC namespace documentation for details. - * - * Right now this class and Comm share the same lo_server_thread and the barrier - * between them is a bit odd, but eventually this class will be able to listen - * on a completely different port (ie have it's own lo_server_thread) to allow - * things like listening to the notification band over TCP while sending commands - * on the control band over UDP. - * - * \ingroup IngenClient - */ -class OSCClientReceiver : boost::noncopyable, virtual public Ingen::Shared::ClientInterface -{ -public: - OSCClientReceiver(int listen_port); - ~OSCClientReceiver(); - - // Engine side only - //void enable() {} - //void disable() {} - - void start(); - void stop(); - - int listen_port() { return _listen_port; } - string listen_url() { return lo_server_thread_get_url(_st); } - -private: - void setup_callbacks(); - - static void error_cb(int num, const char* msg, const char* path); - static int generic_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data); - static int unknown_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* osc_receiver); - - int _listen_port; - lo_server_thread _st; - - LO_HANDLER(error); - LO_HANDLER(response); - LO_HANDLER(num_plugins); - LO_HANDLER(plugin); - LO_HANDLER(plugin_list_end); - LO_HANDLER(new_patch); - LO_HANDLER(destroyed); - LO_HANDLER(patch_enabled); - LO_HANDLER(patch_disabled); - LO_HANDLER(patch_cleared); - LO_HANDLER(object_renamed); - LO_HANDLER(connection); - LO_HANDLER(disconnection); - LO_HANDLER(new_node); - LO_HANDLER(new_port); - LO_HANDLER(metadata_update); - LO_HANDLER(control_change); - LO_HANDLER(program_add); - LO_HANDLER(program_remove); -}; - - -} // namespace Client - -} // namespace Ingen - -#endif // OSCCLIENTRECEIVER_H diff --git a/src/libs/client/OSCClientReceiver.hpp b/src/libs/client/OSCClientReceiver.hpp new file mode 100644 index 00000000..b27e7f78 --- /dev/null +++ b/src/libs/client/OSCClientReceiver.hpp @@ -0,0 +1,111 @@ +/* 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 OSCCLIENTRECEIVER_H +#define OSCCLIENTRECEIVER_H + +#include +#include +#include +#include "interface/ClientInterface.hpp" + +namespace Ingen { + +/** Client library */ +namespace Client { + +//class NodeModel; +//class PresetModel; + +/* 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* osc_listener)\ +{ return ((OSCClientReceiver*)osc_listener)->_##name##_cb(path, types, argv, argc, msg); } + + +/** Callbacks for "notification band" OSC messages. + * + * Receives all notification of engine state, but not replies on the "control + * band". See OSC namespace documentation for details. + * + * Right now this class and Comm share the same lo_server_thread and the barrier + * between them is a bit odd, but eventually this class will be able to listen + * on a completely different port (ie have it's own lo_server_thread) to allow + * things like listening to the notification band over TCP while sending commands + * on the control band over UDP. + * + * \ingroup IngenClient + */ +class OSCClientReceiver : boost::noncopyable, virtual public Ingen::Shared::ClientInterface +{ +public: + OSCClientReceiver(int listen_port); + ~OSCClientReceiver(); + + // Engine side only + //void enable() {} + //void disable() {} + + void start(); + void stop(); + + int listen_port() { return _listen_port; } + std::string listen_url() { return lo_server_thread_get_url(_st); } + +private: + void setup_callbacks(); + + static void error_cb(int num, const char* msg, const char* path); + static int generic_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data); + static int unknown_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* osc_receiver); + + int _listen_port; + lo_server_thread _st; + + LO_HANDLER(error); + LO_HANDLER(response); + LO_HANDLER(num_plugins); + LO_HANDLER(plugin); + LO_HANDLER(plugin_list_end); + LO_HANDLER(new_patch); + LO_HANDLER(destroyed); + LO_HANDLER(patch_enabled); + LO_HANDLER(patch_disabled); + LO_HANDLER(patch_cleared); + LO_HANDLER(object_renamed); + LO_HANDLER(connection); + LO_HANDLER(disconnection); + LO_HANDLER(new_node); + LO_HANDLER(new_port); + LO_HANDLER(metadata_update); + LO_HANDLER(control_change); + LO_HANDLER(program_add); + LO_HANDLER(program_remove); +}; + + +} // namespace Client + +} // namespace Ingen + +#endif // OSCCLIENTRECEIVER_H diff --git a/src/libs/client/OSCEngineSender.cpp b/src/libs/client/OSCEngineSender.cpp index 6ebf8df0..2e49eac3 100644 --- a/src/libs/client/OSCEngineSender.cpp +++ b/src/libs/client/OSCEngineSender.cpp @@ -16,9 +16,9 @@ */ #include -#include "OSCEngineSender.h" -#include "interface/ClientKey.h" -#include +#include "OSCEngineSender.hpp" +#include "interface/ClientKey.hpp" +#include using std::cout; using std::cerr; using std::endl; namespace Ingen { diff --git a/src/libs/client/OSCEngineSender.h b/src/libs/client/OSCEngineSender.h deleted file mode 100644 index 68163ec6..00000000 --- a/src/libs/client/OSCEngineSender.h +++ /dev/null @@ -1,160 +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 OSCENGINESENDER_H -#define OSCENGINESENDER_H - -#include -#include -#include -#include "interface/EngineInterface.h" -#include "interface/Responder.h" -using std::string; -using Ingen::Shared::EngineInterface; -using Ingen::Shared::ClientInterface; -using Ingen::Shared::ClientKey; -using Ingen::Shared::Responder; - -namespace Ingen { -namespace Client { - - -/* OSC (via liblo) interface to the engine. - * - * Clients can use this opaquely as an EngineInterface* to control the engine - * over OSC (whether over a network or not, etc). - * - * \ingroup IngenClient - */ -class OSCEngineSender : public EngineInterface -{ -public: - OSCEngineSender(const string& engine_url); - - ~OSCEngineSender(); - - string engine_url() { return _engine_url; } - - inline size_t next_id() - { int32_t ret = (_id == -1) ? -1 : _id++; return ret; } - - void set_responder(SharedPtr responder) { throw; } - void set_next_response_id(int32_t id) { _id = id; } - void disable_responses() { _id = -1; } - - void attach(int32_t ping_id, bool block); - - - /* *** EngineInterface implementation below here *** */ - - // Client registration - void register_client(ClientKey key, SharedPtr client); - void unregister_client(ClientKey key); - - - // Engine commands - void load_plugins(); - void activate(); - void deactivate(); - void quit(); - - - // Object commands - - void create_patch(const string& path, - uint32_t poly); - - void create_port(const string& path, - const string& data_type, - bool is_output); - - void create_node(const string& path, - const string& plugin_uri, - bool polyphonic); - - void create_node(const string& path, - const string& plugin_type, - const string& library_name, - const string& plugin_label, - bool polyphonic); - - void rename(const string& old_path, - const string& new_name); - - void destroy(const string& path); - - void clear_patch(const string& patch_path); - - void enable_patch(const string& patch_path); - - void disable_patch(const string& patch_path); - - void connect(const string& src_port_path, - const string& dst_port_path); - - void disconnect(const string& src_port_path, - const string& dst_port_path); - - void disconnect_all(const string& node_path); - - void set_port_value(const string& port_path, - float val); - - void set_port_value(const string& port_path, - uint32_t voice, - float val); - - void set_port_value_queued(const string& port_path, - float val); - - void set_program(const string& node_path, - uint32_t bank, - uint32_t program); - - void midi_learn(const string& node_path); - - void set_metadata(const string& obj_path, - const string& predicate, - const Raul::Atom& value); - - // Requests // - - void ping(); - - void request_plugin(const string& uri); - - void request_object(const string& path); - - void request_port_value(const string& port_path); - - void request_plugins(); - - void request_all_objects(); - -protected: - string _engine_url; - lo_address _engine_addr; - int _client_port; - int32_t _id; -}; - - -} // namespace Client -} // namespace Ingen - -#endif // OSCENGINESENDER_H - diff --git a/src/libs/client/OSCEngineSender.hpp b/src/libs/client/OSCEngineSender.hpp new file mode 100644 index 00000000..c9b37ec8 --- /dev/null +++ b/src/libs/client/OSCEngineSender.hpp @@ -0,0 +1,160 @@ +/* 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 OSCENGINESENDER_H +#define OSCENGINESENDER_H + +#include +#include +#include +#include "interface/EngineInterface.hpp" +#include "interface/Responder.hpp" +using std::string; +using Ingen::Shared::EngineInterface; +using Ingen::Shared::ClientInterface; +using Ingen::Shared::ClientKey; +using Ingen::Shared::Responder; + +namespace Ingen { +namespace Client { + + +/* OSC (via liblo) interface to the engine. + * + * Clients can use this opaquely as an EngineInterface* to control the engine + * over OSC (whether over a network or not, etc). + * + * \ingroup IngenClient + */ +class OSCEngineSender : public EngineInterface +{ +public: + OSCEngineSender(const string& engine_url); + + ~OSCEngineSender(); + + string engine_url() { return _engine_url; } + + inline size_t next_id() + { int32_t ret = (_id == -1) ? -1 : _id++; return ret; } + + void set_responder(SharedPtr responder) { throw; } + void set_next_response_id(int32_t id) { _id = id; } + void disable_responses() { _id = -1; } + + void attach(int32_t ping_id, bool block); + + + /* *** EngineInterface implementation below here *** */ + + // Client registration + void register_client(ClientKey key, SharedPtr client); + void unregister_client(ClientKey key); + + + // Engine commands + void load_plugins(); + void activate(); + void deactivate(); + void quit(); + + + // Object commands + + void create_patch(const string& path, + uint32_t poly); + + void create_port(const string& path, + const string& data_type, + bool is_output); + + void create_node(const string& path, + const string& plugin_uri, + bool polyphonic); + + void create_node(const string& path, + const string& plugin_type, + const string& library_name, + const string& plugin_label, + bool polyphonic); + + void rename(const string& old_path, + const string& new_name); + + void destroy(const string& path); + + void clear_patch(const string& patch_path); + + void enable_patch(const string& patch_path); + + void disable_patch(const string& patch_path); + + void connect(const string& src_port_path, + const string& dst_port_path); + + void disconnect(const string& src_port_path, + const string& dst_port_path); + + void disconnect_all(const string& node_path); + + void set_port_value(const string& port_path, + float val); + + void set_port_value(const string& port_path, + uint32_t voice, + float val); + + void set_port_value_queued(const string& port_path, + float val); + + void set_program(const string& node_path, + uint32_t bank, + uint32_t program); + + void midi_learn(const string& node_path); + + void set_metadata(const string& obj_path, + const string& predicate, + const Raul::Atom& value); + + // Requests // + + void ping(); + + void request_plugin(const string& uri); + + void request_object(const string& path); + + void request_port_value(const string& port_path); + + void request_plugins(); + + void request_all_objects(); + +protected: + string _engine_url; + lo_address _engine_addr; + int _client_port; + int32_t _id; +}; + + +} // namespace Client +} // namespace Ingen + +#endif // OSCENGINESENDER_H + diff --git a/src/libs/client/ObjectModel.cpp b/src/libs/client/ObjectModel.cpp index 7adc1edc..699d1ce7 100644 --- a/src/libs/client/ObjectModel.cpp +++ b/src/libs/client/ObjectModel.cpp @@ -15,7 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "ObjectModel.h" +#include "ObjectModel.hpp" namespace Ingen { namespace Client { diff --git a/src/libs/client/ObjectModel.h b/src/libs/client/ObjectModel.h deleted file mode 100644 index d388475a..00000000 --- a/src/libs/client/ObjectModel.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 OBJECTMODEL_H -#define OBJECTMODEL_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using std::string; using std::map; using std::find; -using std::cout; using std::cerr; using std::endl; -using Raul::Atom; -using Raul::Path; - -namespace Ingen { -namespace Client { - -typedef map MetadataMap; - - -/** Base class for all GraphObject models (NodeModel, PatchModel, PortModel). - * - * There are no non-const public methods intentionally, models are not allowed - * to be manipulated directly by anything (but the Store) because of the - * asynchronous nature of engine control. To change something, use the - * controller (which the model probably shouldn't have a reference to but oh - * well, it reduces Collection Hell) and wait for the result (as a signal - * from this Model). - * - * \ingroup IngenClient - */ -class ObjectModel : boost::noncopyable -{ -public: - virtual ~ObjectModel(); - - const Atom& get_metadata(const string& key) const; - void set_metadata(const string& key, const Atom& value) - { _metadata[key] = value; metadata_update_sig.emit(key, value); } - - const MetadataMap& metadata() const { return _metadata; } - inline const Path& path() const { return _path; } - SharedPtr parent() const { return _parent; } - - // Signals - sigc::signal metadata_update_sig; - sigc::signal destroyed_sig; - -protected: - friend class Store; - - ObjectModel(const Path& path); - - virtual void set_path(const Path& p) { _path = p; } - virtual void set_parent(SharedPtr p) { assert(p); _parent = p; } - virtual void add_child(SharedPtr c) = 0; - virtual void remove_child(SharedPtr c) = 0; - - void add_metadata(const MetadataMap& data); - - void set(SharedPtr model); - - Path _path; - SharedPtr _parent; - - MetadataMap _metadata; -}; - - -} // namespace Client -} // namespace Ingen - -#endif // OBJECTMODEL_H diff --git a/src/libs/client/ObjectModel.hpp b/src/libs/client/ObjectModel.hpp new file mode 100644 index 00000000..03abafba --- /dev/null +++ b/src/libs/client/ObjectModel.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 OBJECTMODEL_H +#define OBJECTMODEL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using std::string; using std::map; using std::find; +using std::cout; using std::cerr; using std::endl; +using Raul::Atom; +using Raul::Path; + +namespace Ingen { +namespace Client { + +typedef map MetadataMap; + + +/** Base class for all GraphObject models (NodeModel, PatchModel, PortModel). + * + * There are no non-const public methods intentionally, models are not allowed + * to be manipulated directly by anything (but the Store) because of the + * asynchronous nature of engine control. To change something, use the + * controller (which the model probably shouldn't have a reference to but oh + * well, it reduces Collection Hell) and wait for the result (as a signal + * from this Model). + * + * \ingroup IngenClient + */ +class ObjectModel : boost::noncopyable +{ +public: + virtual ~ObjectModel(); + + const Atom& get_metadata(const string& key) const; + void set_metadata(const string& key, const Atom& value) + { _metadata[key] = value; metadata_update_sig.emit(key, value); } + + const MetadataMap& metadata() const { return _metadata; } + inline const Path& path() const { return _path; } + SharedPtr parent() const { return _parent; } + + // Signals + sigc::signal metadata_update_sig; + sigc::signal destroyed_sig; + +protected: + friend class Store; + + ObjectModel(const Path& path); + + virtual void set_path(const Path& p) { _path = p; } + virtual void set_parent(SharedPtr p) { assert(p); _parent = p; } + virtual void add_child(SharedPtr c) = 0; + virtual void remove_child(SharedPtr c) = 0; + + void add_metadata(const MetadataMap& data); + + void set(SharedPtr model); + + Path _path; + SharedPtr _parent; + + MetadataMap _metadata; +}; + + +} // namespace Client +} // namespace Ingen + +#endif // OBJECTMODEL_H diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp index 406dcbe9..85cf3dc7 100644 --- a/src/libs/client/PatchModel.cpp +++ b/src/libs/client/PatchModel.cpp @@ -15,9 +15,9 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "PatchModel.h" -#include "NodeModel.h" -#include "ConnectionModel.h" +#include "PatchModel.hpp" +#include "NodeModel.hpp" +#include "ConnectionModel.hpp" #include #include diff --git a/src/libs/client/PatchModel.h b/src/libs/client/PatchModel.h deleted file mode 100644 index faceef72..00000000 --- a/src/libs/client/PatchModel.h +++ /dev/null @@ -1,106 +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 PATCHMODEL_H -#define PATCHMODEL_H - -#include -#include -#include -#include -#include -#include "NodeModel.h" -#include -#include "ConnectionModel.h" - -using std::list; using std::string; using std::map; - -namespace Ingen { -namespace Client { - -class Store; - - -/** Client's model of a patch. - * - * \ingroup IngenClient - */ -class PatchModel : public NodeModel -{ -public: - const NodeModelMap& nodes() const { return _nodes; } - const ConnectionList& connections() const { return _connections; } - - SharedPtr get_connection(const string& src_port_path, const string& dst_port_path) const; - SharedPtr get_node(const string& node_name) const; - - void set_filename(const string& filename) { _filename = filename; } - - size_t poly() const { return _poly; } - const string& filename() const { return _filename; } - bool enabled() const { return _enabled; } - bool polyphonic() const; - - // Signals - sigc::signal > new_node_sig; - sigc::signal > removed_node_sig; - sigc::signal > new_connection_sig; - sigc::signal > removed_connection_sig; - sigc::signal enabled_sig; - sigc::signal disabled_sig; - -private: - friend class Store; - - PatchModel(const Path& patch_path, size_t internal_poly) - : NodeModel("ingen:patch", patch_path, false), // FIXME - _enabled(false), - _poly(internal_poly) - { - } - - void filename(const string& f) { _filename = f; } - void poly(size_t p) { _poly = p; } - void enable(); - void disable(); - void clear(); - void set_path(const Path& path); - void add_node(SharedPtr nm); - void remove_node(SharedPtr nm); - void add_child(SharedPtr c); - void remove_child(SharedPtr c); - - void add_connection(SharedPtr cm); - void remove_connection(const string& src_port_path, const string& dst_port_path); - - void rename_node(const Path& old_path, const Path& new_path); - void rename_node_port(const Path& old_path, const Path& new_path); - - NodeModelMap _nodes; - ConnectionList _connections; - string _filename; - bool _enabled; - size_t _poly; -}; - -typedef map > PatchModelMap; - - -} // namespace Client -} // namespace Ingen - -#endif // PATCHMODEL_H diff --git a/src/libs/client/PatchModel.hpp b/src/libs/client/PatchModel.hpp new file mode 100644 index 00000000..55040858 --- /dev/null +++ b/src/libs/client/PatchModel.hpp @@ -0,0 +1,106 @@ +/* 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 PATCHMODEL_H +#define PATCHMODEL_H + +#include +#include +#include +#include +#include +#include "NodeModel.hpp" +#include +#include "ConnectionModel.hpp" + +using std::list; using std::string; using std::map; + +namespace Ingen { +namespace Client { + +class Store; + + +/** Client's model of a patch. + * + * \ingroup IngenClient + */ +class PatchModel : public NodeModel +{ +public: + const NodeModelMap& nodes() const { return _nodes; } + const ConnectionList& connections() const { return _connections; } + + SharedPtr get_connection(const string& src_port_path, const string& dst_port_path) const; + SharedPtr get_node(const string& node_name) const; + + void set_filename(const string& filename) { _filename = filename; } + + size_t poly() const { return _poly; } + const string& filename() const { return _filename; } + bool enabled() const { return _enabled; } + bool polyphonic() const; + + // Signals + sigc::signal > new_node_sig; + sigc::signal > removed_node_sig; + sigc::signal > new_connection_sig; + sigc::signal > removed_connection_sig; + sigc::signal enabled_sig; + sigc::signal disabled_sig; + +private: + friend class Store; + + PatchModel(const Path& patch_path, size_t internal_poly) + : NodeModel("ingen:patch", patch_path, false), // FIXME + _enabled(false), + _poly(internal_poly) + { + } + + void filename(const string& f) { _filename = f; } + void poly(size_t p) { _poly = p; } + void enable(); + void disable(); + void clear(); + void set_path(const Path& path); + void add_node(SharedPtr nm); + void remove_node(SharedPtr nm); + void add_child(SharedPtr c); + void remove_child(SharedPtr c); + + void add_connection(SharedPtr cm); + void remove_connection(const string& src_port_path, const string& dst_port_path); + + void rename_node(const Path& old_path, const Path& new_path); + void rename_node_port(const Path& old_path, const Path& new_path); + + NodeModelMap _nodes; + ConnectionList _connections; + string _filename; + bool _enabled; + size_t _poly; +}; + +typedef map > PatchModelMap; + + +} // namespace Client +} // namespace Ingen + +#endif // PATCHMODEL_H diff --git a/src/libs/client/PluginModel.cpp b/src/libs/client/PluginModel.cpp index c8d44837..886a2fa6 100644 --- a/src/libs/client/PluginModel.cpp +++ b/src/libs/client/PluginModel.cpp @@ -16,9 +16,9 @@ */ #include -#include -#include "PluginModel.h" -#include "PatchModel.h" +#include +#include "PluginModel.hpp" +#include "PatchModel.hpp" namespace Ingen { diff --git a/src/libs/client/PluginModel.h b/src/libs/client/PluginModel.h deleted file mode 100644 index 6da388d6..00000000 --- a/src/libs/client/PluginModel.h +++ /dev/null @@ -1,131 +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 PLUGINMODEL_H -#define PLUGINMODEL_H - -#include "../../../../config/config.h" -#include -#include -#include -#include -#ifdef HAVE_SLV2 -#include -#endif -using std::string; using std::cerr; using std::endl; - -namespace Ingen { -namespace Client { - -class PatchModel; - - -/** Model for a plugin available for loading. - * - * \ingroup IngenClient - */ -class PluginModel -{ -public: - enum Type { Internal=0, LV2, DSSI, LADSPA, Patch }; - - PluginModel(const string& uri, const string& type_uri, const string& name) - : _uri(uri) - , _name(name) - { - set_type_from_uri(type_uri); -#ifdef HAVE_SLV2 - _slv2_plugin = slv2_plugins_get_by_uri(_slv2_plugins, uri.c_str()); -#endif - } - - Type type() const { return _type; } - void type(Type t) { _type = t; } - const string& uri() const { return _uri; } - void uri(const string& s) { _uri = s; } - const string& name() const { return _name; } - void name(const string& s) { _name = s; } - - /*const char* const type_string() const { - if (_type == LV2) return "LV2"; - else if (_type == LADSPA) return "LADSPA"; - else if (_type == DSSI) return "DSSI"; - else if (_type == Internal) return "Internal"; - else if (_type == Patch) return "Patch"; - else return ""; - }*/ - - const char* const type_uri() const { - if (_type == LV2) return "ingen:LV2"; - else if (_type == LADSPA) return "ingen:LADSPA"; - else if (_type == DSSI) return "ingen:DSSI"; - else if (_type == Internal) return "ingen:Internal"; - else if (_type == Patch) return "ingen:Patch"; - else return ""; - } - - /** DEPRECATED */ - void set_type(const string& type_string) { - if (type_string == "LV2") _type = LV2; - else if (type_string == "LADSPA") _type = LADSPA; - else if (type_string == "DSSI") _type = DSSI; - else if (type_string == "Internal") _type = Internal; - else if (type_string == "Patch") _type = Patch; - } - - void set_type_from_uri(const string& type_uri) { - if (type_uri.substr(0, 6) != "ingen:") { - cerr << "INVALID TYPE STRING!" << endl; - } else { - set_type(type_uri.substr(6)); - } - } - - string default_node_name(SharedPtr parent); - -#ifdef HAVE_SLV2 - SLV2Plugin slv2_plugin() { return _slv2_plugin; } - static SLV2World slv2_world() { return _slv2_world; } - - static void set_slv2_world(SLV2World world) { - _slv2_world = world; - slv2_world_load_all(_slv2_world); - _slv2_plugins = slv2_world_get_all_plugins(_slv2_world); - } - - void* gui(); -#endif - -private: - Type _type; - string _uri; - string _name; - -#ifdef HAVE_SLV2 - static SLV2World _slv2_world; - static SLV2Plugins _slv2_plugins; - - SLV2Plugin _slv2_plugin; -#endif -}; - - -} // namespace Client -} // namespace Ingen - -#endif // PLUGINMODEL_H - diff --git a/src/libs/client/PluginModel.hpp b/src/libs/client/PluginModel.hpp new file mode 100644 index 00000000..f02528d1 --- /dev/null +++ b/src/libs/client/PluginModel.hpp @@ -0,0 +1,131 @@ +/* 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 PLUGINMODEL_H +#define PLUGINMODEL_H + +#include "../../../../config/config.h" +#include +#include +#include +#include +#ifdef HAVE_SLV2 +#include +#endif +using std::string; using std::cerr; using std::endl; + +namespace Ingen { +namespace Client { + +class PatchModel; + + +/** Model for a plugin available for loading. + * + * \ingroup IngenClient + */ +class PluginModel +{ +public: + enum Type { Internal=0, LV2, DSSI, LADSPA, Patch }; + + PluginModel(const string& uri, const string& type_uri, const string& name) + : _uri(uri) + , _name(name) + { + set_type_from_uri(type_uri); +#ifdef HAVE_SLV2 + _slv2_plugin = slv2_plugins_get_by_uri(_slv2_plugins, uri.c_str()); +#endif + } + + Type type() const { return _type; } + void type(Type t) { _type = t; } + const string& uri() const { return _uri; } + void uri(const string& s) { _uri = s; } + const string& name() const { return _name; } + void name(const string& s) { _name = s; } + + /*const char* const type_string() const { + if (_type == LV2) return "LV2"; + else if (_type == LADSPA) return "LADSPA"; + else if (_type == DSSI) return "DSSI"; + else if (_type == Internal) return "Internal"; + else if (_type == Patch) return "Patch"; + else return ""; + }*/ + + const char* const type_uri() const { + if (_type == LV2) return "ingen:LV2"; + else if (_type == LADSPA) return "ingen:LADSPA"; + else if (_type == DSSI) return "ingen:DSSI"; + else if (_type == Internal) return "ingen:Internal"; + else if (_type == Patch) return "ingen:Patch"; + else return ""; + } + + /** DEPRECATED */ + void set_type(const string& type_string) { + if (type_string == "LV2") _type = LV2; + else if (type_string == "LADSPA") _type = LADSPA; + else if (type_string == "DSSI") _type = DSSI; + else if (type_string == "Internal") _type = Internal; + else if (type_string == "Patch") _type = Patch; + } + + void set_type_from_uri(const string& type_uri) { + if (type_uri.substr(0, 6) != "ingen:") { + cerr << "INVALID TYPE STRING!" << endl; + } else { + set_type(type_uri.substr(6)); + } + } + + string default_node_name(SharedPtr parent); + +#ifdef HAVE_SLV2 + SLV2Plugin slv2_plugin() { return _slv2_plugin; } + static SLV2World slv2_world() { return _slv2_world; } + + static void set_slv2_world(SLV2World world) { + _slv2_world = world; + slv2_world_load_all(_slv2_world); + _slv2_plugins = slv2_world_get_all_plugins(_slv2_world); + } + + void* gui(); +#endif + +private: + Type _type; + string _uri; + string _name; + +#ifdef HAVE_SLV2 + static SLV2World _slv2_world; + static SLV2Plugins _slv2_plugins; + + SLV2Plugin _slv2_plugin; +#endif +}; + + +} // namespace Client +} // namespace Ingen + +#endif // PLUGINMODEL_H + diff --git a/src/libs/client/PortModel.cpp b/src/libs/client/PortModel.cpp index 9be019ed..af80e250 100644 --- a/src/libs/client/PortModel.cpp +++ b/src/libs/client/PortModel.cpp @@ -15,7 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "PortModel.h" +#include "PortModel.hpp" namespace Ingen { namespace Client { diff --git a/src/libs/client/PortModel.h b/src/libs/client/PortModel.h deleted file mode 100644 index c19db582..00000000 --- a/src/libs/client/PortModel.h +++ /dev/null @@ -1,105 +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 PORTMODEL_H -#define PORTMODEL_H - -#include -#include -#include -#include -#include -#include "ObjectModel.h" -#include -#include -using std::string; using std::list; using std::cerr; using std::endl; - -namespace Ingen { -namespace Client { - - -/** Model of a port. - * - * \ingroup IngenClient - */ -class PortModel : public ObjectModel -{ -public: - enum Direction { INPUT, OUTPUT }; - - inline string type() const { return _type; } - inline float value() const { return _current_val; } - inline bool connected() const { return (_connections > 0); } - inline bool is_input() const { return (_direction == INPUT); } - inline bool is_output() const { return (_direction == OUTPUT); } - inline bool is_audio() const { return (_type == "ingen:audio"); } - inline bool is_control() const { return (_type == "ingen:control"); } - inline bool is_midi() const { return (_type == "ingen:midi"); } - inline bool is_osc() const { return (_type == "ingen:osc"); } - - bool is_logarithmic() const; - bool is_integer() const; - bool is_toggle() const; - - inline bool operator==(const PortModel& pm) const { return (_path == pm._path); } - - inline void value(float val) - { - if (val != _current_val) { - _current_val = val; - control_change_sig.emit(val); - } - } - - // Signals - sigc::signal control_change_sig; ///< "Control" ports only - sigc::signal > connection_sig; - sigc::signal > disconnection_sig; - -private: - friend class Store; - - PortModel(const Path& path, const string& type, Direction dir) - : ObjectModel(path), - _type(type), - _direction(dir), - _current_val(0.0f), - _connections(0) - { - if (!is_audio() && !is_control() && !is_input()) - cerr << "[PortModel] Warning: Unknown port type" << endl; - } - - void add_child(SharedPtr c) { throw; } - void remove_child(SharedPtr c) { throw; } - - void connected_to(SharedPtr p) { ++_connections; connection_sig.emit(p); } - void disconnected_from(SharedPtr p) { --_connections; disconnection_sig.emit(p); } - - string _type; - Direction _direction; - float _current_val; - size_t _connections; -}; - -typedef list > PortModelList; - - -} // namespace Client -} // namespace Ingen - -#endif // PORTMODEL_H diff --git a/src/libs/client/PortModel.hpp b/src/libs/client/PortModel.hpp new file mode 100644 index 00000000..25573226 --- /dev/null +++ b/src/libs/client/PortModel.hpp @@ -0,0 +1,105 @@ +/* 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 PORTMODEL_H +#define PORTMODEL_H + +#include +#include +#include +#include +#include +#include "ObjectModel.hpp" +#include +#include +using std::string; using std::list; using std::cerr; using std::endl; + +namespace Ingen { +namespace Client { + + +/** Model of a port. + * + * \ingroup IngenClient + */ +class PortModel : public ObjectModel +{ +public: + enum Direction { INPUT, OUTPUT }; + + inline string type() const { return _type; } + inline float value() const { return _current_val; } + inline bool connected() const { return (_connections > 0); } + inline bool is_input() const { return (_direction == INPUT); } + inline bool is_output() const { return (_direction == OUTPUT); } + inline bool is_audio() const { return (_type == "ingen:audio"); } + inline bool is_control() const { return (_type == "ingen:control"); } + inline bool is_midi() const { return (_type == "ingen:midi"); } + inline bool is_osc() const { return (_type == "ingen:osc"); } + + bool is_logarithmic() const; + bool is_integer() const; + bool is_toggle() const; + + inline bool operator==(const PortModel& pm) const { return (_path == pm._path); } + + inline void value(float val) + { + if (val != _current_val) { + _current_val = val; + control_change_sig.emit(val); + } + } + + // Signals + sigc::signal control_change_sig; ///< "Control" ports only + sigc::signal > connection_sig; + sigc::signal > disconnection_sig; + +private: + friend class Store; + + PortModel(const Path& path, const string& type, Direction dir) + : ObjectModel(path), + _type(type), + _direction(dir), + _current_val(0.0f), + _connections(0) + { + if (!is_audio() && !is_control() && !is_input()) + cerr << "[PortModel] Warning: Unknown port type" << endl; + } + + void add_child(SharedPtr c) { throw; } + void remove_child(SharedPtr c) { throw; } + + void connected_to(SharedPtr p) { ++_connections; connection_sig.emit(p); } + void disconnected_from(SharedPtr p) { --_connections; disconnection_sig.emit(p); } + + string _type; + Direction _direction; + float _current_val; + size_t _connections; +}; + +typedef list > PortModelList; + + +} // namespace Client +} // namespace Ingen + +#endif // PORTMODEL_H diff --git a/src/libs/client/PresetModel.h b/src/libs/client/PresetModel.h deleted file mode 100644 index 69c42ed7..00000000 --- a/src/libs/client/PresetModel.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 alongCont - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef PRESETMODEL_H -#define PRESETMODEL_H - -#include -#include -#include "ControlModel.h" - -using std::string; using std::list; - -namespace Ingen { -namespace Client { - - -/** Model of a preset (a collection of control settings). - * - * \ingroup IngenClient - */ -class PresetModel -{ -public: - PresetModel(const string& base_path) - : _base_path(base_path) - {} - - /** Add a control value to this preset. An empty string for a node_name - * means the port is on the patch itself (not a node in the patch). - */ - void add_control(const string& node_name, - const string& port_name, float value) - { - if (node_name != "") - _controls.push_back(ControlModel(_base_path + node_name +"/"+ port_name, value)); - else - _controls.push_back(ControlModel(_base_path + port_name, value)); - } - - const string& name() const { return _name; } - void name(const string& n) { _name = n; } - - const list& controls() const { return _controls; } - -private: - string _name; - string _base_path; - list _controls; -}; - - -} // namespace Client -} // namespace Ingen - -#endif // PRESETMODEL diff --git a/src/libs/client/PresetModel.hpp b/src/libs/client/PresetModel.hpp new file mode 100644 index 00000000..6cc557a5 --- /dev/null +++ b/src/libs/client/PresetModel.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 alongCont + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PRESETMODEL_H +#define PRESETMODEL_H + +#include +#include +#include "ControlModel.hpp" + +using std::string; using std::list; + +namespace Ingen { +namespace Client { + + +/** Model of a preset (a collection of control settings). + * + * \ingroup IngenClient + */ +class PresetModel +{ +public: + PresetModel(const string& base_path) + : _base_path(base_path) + {} + + /** Add a control value to this preset. An empty string for a node_name + * means the port is on the patch itself (not a node in the patch). + */ + void add_control(const string& node_name, + const string& port_name, float value) + { + if (node_name != "") + _controls.push_back(ControlModel(_base_path + node_name +"/"+ port_name, value)); + else + _controls.push_back(ControlModel(_base_path + port_name, value)); + } + + const string& name() const { return _name; } + void name(const string& n) { _name = n; } + + const list& controls() const { return _controls; } + +private: + string _name; + string _base_path; + list _controls; +}; + + +} // namespace Client +} // namespace Ingen + +#endif // PRESETMODEL diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp index a59ec6cf..f0920be5 100644 --- a/src/libs/client/Serializer.cpp +++ b/src/libs/client/Serializer.cpp @@ -28,20 +28,20 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include "interface/EngineInterface.h" -#include "Serializer.h" -#include "PatchModel.h" -#include "NodeModel.h" -#include "ConnectionModel.h" -#include "PortModel.h" -#include "PresetModel.h" -#include "PluginModel.h" +#include +#include +#include +#include +#include +#include +#include "interface/EngineInterface.hpp" +#include "Serializer.hpp" +#include "PatchModel.hpp" +#include "NodeModel.hpp" +#include "ConnectionModel.hpp" +#include "PortModel.hpp" +#include "PresetModel.hpp" +#include "PluginModel.hpp" using namespace std; using namespace Raul; diff --git a/src/libs/client/Serializer.h b/src/libs/client/Serializer.h deleted file mode 100644 index 6095cb25..00000000 --- a/src/libs/client/Serializer.h +++ /dev/null @@ -1,86 +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 SERIALIZER_H -#define SERIALIZER_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ObjectModel.h" - -namespace Ingen { -namespace Client { - -class PluginModel; -class PatchModel; -class NodeModel; -class PortModel; -class ConnectionModel; -class PresetModel; - - -/** Serializes Ingen objects (patches, nodes, etc) to RDF. - * - * \ingroup IngenClient - */ -class Serializer -{ -public: - Serializer(Raul::RDF::World& world); - - void start_to_filename(const string& filename); - void start_to_string(); - - void serialize(SharedPtr object) throw (std::logic_error); - void serialize_connection(SharedPtr c) throw (std::logic_error); - - string finish(); - -private: - enum Mode { TO_FILE, TO_STRING }; - - void setup_prefixes(); - - void serialize_plugin(SharedPtr p); - - void serialize_patch(SharedPtr p, const Raul::RDF::Node& id); - void serialize_node(SharedPtr n, const Raul::RDF::Node& id); - void serialize_port(SharedPtr p, const Raul::RDF::Node& id); - - Raul::RDF::Node path_to_node_id(const Path& path); - - typedef std::map NodeMap; - Mode _mode; - NodeMap _node_map; - string _base_uri; - Raul::RDF::World& _world; - Raul::RDF::Model* _model; -}; - - -} // namespace Client -} // namespace Ingen - -#endif // SERIALIZER_H diff --git a/src/libs/client/Serializer.hpp b/src/libs/client/Serializer.hpp new file mode 100644 index 00000000..a42d99fa --- /dev/null +++ b/src/libs/client/Serializer.hpp @@ -0,0 +1,86 @@ +/* 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 SERIALIZER_H +#define SERIALIZER_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ObjectModel.hpp" + +namespace Ingen { +namespace Client { + +class PluginModel; +class PatchModel; +class NodeModel; +class PortModel; +class ConnectionModel; +class PresetModel; + + +/** Serializes Ingen objects (patches, nodes, etc) to RDF. + * + * \ingroup IngenClient + */ +class Serializer +{ +public: + Serializer(Raul::RDF::World& world); + + void start_to_filename(const string& filename); + void start_to_string(); + + void serialize(SharedPtr object) throw (std::logic_error); + void serialize_connection(SharedPtr c) throw (std::logic_error); + + string finish(); + +private: + enum Mode { TO_FILE, TO_STRING }; + + void setup_prefixes(); + + void serialize_plugin(SharedPtr p); + + void serialize_patch(SharedPtr p, const Raul::RDF::Node& id); + void serialize_node(SharedPtr n, const Raul::RDF::Node& id); + void serialize_port(SharedPtr p, const Raul::RDF::Node& id); + + Raul::RDF::Node path_to_node_id(const Path& path); + + typedef std::map NodeMap; + Mode _mode; + NodeMap _node_map; + string _base_uri; + Raul::RDF::World& _world; + Raul::RDF::Model* _model; +}; + + +} // namespace Client +} // namespace Ingen + +#endif // SERIALIZER_H diff --git a/src/libs/client/SigClientInterface.h b/src/libs/client/SigClientInterface.h deleted file mode 100644 index a7f7761b..00000000 --- a/src/libs/client/SigClientInterface.h +++ /dev/null @@ -1,142 +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 SIGCLIENTINTERFACE_H -#define SIGCLIENTINTERFACE_H - -#include -#include -#include -#include "interface/ClientInterface.h" -using std::string; - -namespace Ingen { -namespace Client { - - -/** A LibSigC++ signal emitting interface for clients to use. - * - * This simply emits an sigc signal for every event (eg OSC message) coming from - * the engine. Use Store (which extends this) if you want a nice client-side - * model of the engine. - * - * The signals here match the calls to ClientInterface exactly. See the - * documentation for ClientInterface for meanings of signal parameters. - */ -class SigClientInterface : virtual public Ingen::Shared::ClientInterface, public sigc::trackable -{ -public: - - // Signal parameters math up directly with ClientInterface calls - - sigc::signal response_sig; - sigc::signal bundle_begin_sig; - sigc::signal bundle_end_sig; - sigc::signal error_sig; - sigc::signal num_plugins_sig; - sigc::signal new_plugin_sig; - sigc::signal new_patch_sig; - sigc::signal new_node_sig; - sigc::signal new_port_sig; - sigc::signal patch_enabled_sig; - sigc::signal patch_disabled_sig; - sigc::signal patch_cleared_sig; - sigc::signal object_renamed_sig; - sigc::signal object_destroyed_sig; - sigc::signal connection_sig; - sigc::signal disconnection_sig; - sigc::signal metadata_update_sig; - sigc::signal control_change_sig; - sigc::signal program_add_sig; - sigc::signal program_remove_sig; - -protected: - - // ClientInterface hooks that fire the above signals - - // FIXME: implement for this (is implemented for ThreadedSigClientInterface) - void enable() { } - void disable() { } - - void bundle_begin() {} - void bundle_end() {} - - void transfer_begin() {} - void transfer_end() {} - - void num_plugins(uint32_t num) { num_plugins_sig.emit(num); } - - void response(int32_t id, bool success, string msg) - { response_sig.emit(id, success, msg); } - - void error(string msg) - { error_sig.emit(msg); } - - void new_plugin(string uri, string type_uri, string name) - { new_plugin_sig.emit(uri, type_uri, name); } - - void new_patch(string path, uint32_t poly) - { new_patch_sig.emit(path, poly); } - - void new_node(string plugin_uri, string node_path, bool is_polyphonic, uint32_t num_ports) - { new_node_sig.emit(plugin_uri, node_path, is_polyphonic, num_ports); } - - void new_port(string path, string data_type, bool is_output) - { new_port_sig.emit(path, data_type, is_output); } - - void connection(string src_port_path, string dst_port_path) - { connection_sig.emit(src_port_path, dst_port_path); } - - void object_destroyed(string path) - { object_destroyed_sig.emit(path); } - - void patch_enabled(string path) - { patch_enabled_sig.emit(path); } - - void patch_disabled(string path) - { patch_disabled_sig.emit(path); } - - void patch_cleared(string path) - { patch_cleared_sig.emit(path); } - - void object_renamed(string old_path, string new_path) - { object_renamed_sig.emit(old_path, new_path); } - - void disconnection(string src_port_path, string dst_port_path) - { disconnection_sig.emit(src_port_path, dst_port_path); } - - void metadata_update(string path, string key, Raul::Atom value) - { metadata_update_sig.emit(path, key, value); } - - void control_change(string port_path, float value) - { control_change_sig.emit(port_path, value); } - - void program_add(string path, uint32_t bank, uint32_t program, string name) - { program_add_sig.emit(path, bank, program, name); } - - void program_remove(string path, uint32_t bank, uint32_t program) - { program_remove_sig.emit(path, bank, program); } - -protected: - SigClientInterface() {} -}; - - -} // namespace Client -} // namespace Ingen - -#endif diff --git a/src/libs/client/SigClientInterface.hpp b/src/libs/client/SigClientInterface.hpp new file mode 100644 index 00000000..f19f4a5e --- /dev/null +++ b/src/libs/client/SigClientInterface.hpp @@ -0,0 +1,142 @@ +/* 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 SIGCLIENTINTERFACE_H +#define SIGCLIENTINTERFACE_H + +#include +#include +#include +#include "interface/ClientInterface.hpp" +using std::string; + +namespace Ingen { +namespace Client { + + +/** A LibSigC++ signal emitting interface for clients to use. + * + * This simply emits an sigc signal for every event (eg OSC message) coming from + * the engine. Use Store (which extends this) if you want a nice client-side + * model of the engine. + * + * The signals here match the calls to ClientInterface exactly. See the + * documentation for ClientInterface for meanings of signal parameters. + */ +class SigClientInterface : virtual public Ingen::Shared::ClientInterface, public sigc::trackable +{ +public: + + // Signal parameters math up directly with ClientInterface calls + + sigc::signal response_sig; + sigc::signal bundle_begin_sig; + sigc::signal bundle_end_sig; + sigc::signal error_sig; + sigc::signal num_plugins_sig; + sigc::signal new_plugin_sig; + sigc::signal new_patch_sig; + sigc::signal new_node_sig; + sigc::signal new_port_sig; + sigc::signal patch_enabled_sig; + sigc::signal patch_disabled_sig; + sigc::signal patch_cleared_sig; + sigc::signal object_renamed_sig; + sigc::signal object_destroyed_sig; + sigc::signal connection_sig; + sigc::signal disconnection_sig; + sigc::signal metadata_update_sig; + sigc::signal control_change_sig; + sigc::signal program_add_sig; + sigc::signal program_remove_sig; + +protected: + + // ClientInterface hooks that fire the above signals + + // FIXME: implement for this (is implemented for ThreadedSigClientInterface) + void enable() { } + void disable() { } + + void bundle_begin() {} + void bundle_end() {} + + void transfer_begin() {} + void transfer_end() {} + + void num_plugins(uint32_t num) { num_plugins_sig.emit(num); } + + void response(int32_t id, bool success, string msg) + { response_sig.emit(id, success, msg); } + + void error(string msg) + { error_sig.emit(msg); } + + void new_plugin(string uri, string type_uri, string name) + { new_plugin_sig.emit(uri, type_uri, name); } + + void new_patch(string path, uint32_t poly) + { new_patch_sig.emit(path, poly); } + + void new_node(string plugin_uri, string node_path, bool is_polyphonic, uint32_t num_ports) + { new_node_sig.emit(plugin_uri, node_path, is_polyphonic, num_ports); } + + void new_port(string path, string data_type, bool is_output) + { new_port_sig.emit(path, data_type, is_output); } + + void connection(string src_port_path, string dst_port_path) + { connection_sig.emit(src_port_path, dst_port_path); } + + void object_destroyed(string path) + { object_destroyed_sig.emit(path); } + + void patch_enabled(string path) + { patch_enabled_sig.emit(path); } + + void patch_disabled(string path) + { patch_disabled_sig.emit(path); } + + void patch_cleared(string path) + { patch_cleared_sig.emit(path); } + + void object_renamed(string old_path, string new_path) + { object_renamed_sig.emit(old_path, new_path); } + + void disconnection(string src_port_path, string dst_port_path) + { disconnection_sig.emit(src_port_path, dst_port_path); } + + void metadata_update(string path, string key, Raul::Atom value) + { metadata_update_sig.emit(path, key, value); } + + void control_change(string port_path, float value) + { control_change_sig.emit(port_path, value); } + + void program_add(string path, uint32_t bank, uint32_t program, string name) + { program_add_sig.emit(path, bank, program, name); } + + void program_remove(string path, uint32_t bank, uint32_t program) + { program_remove_sig.emit(path, bank, program); } + +protected: + SigClientInterface() {} +}; + + +} // namespace Client +} // namespace Ingen + +#endif diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index 5a989c3c..61c02698 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -15,14 +15,14 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "Store.h" -#include "ObjectModel.h" -#include "PatchModel.h" -#include "NodeModel.h" -#include "PortModel.h" -#include "PluginModel.h" -#include "PatchModel.h" -#include "SigClientInterface.h" +#include "Store.hpp" +#include "ObjectModel.hpp" +#include "PatchModel.hpp" +#include "NodeModel.hpp" +#include "PortModel.hpp" +#include "PluginModel.hpp" +#include "PatchModel.hpp" +#include "SigClientInterface.hpp" namespace Ingen { namespace Client { diff --git a/src/libs/client/Store.h b/src/libs/client/Store.h deleted file mode 100644 index e481fc2d..00000000 --- a/src/libs/client/Store.h +++ /dev/null @@ -1,132 +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 STORE_H -#define STORE_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include "interface/EngineInterface.h" -using std::string; using std::map; using std::list; -using Ingen::Shared::EngineInterface; -using Raul::Path; -using Raul::Atom; - -namespace Ingen { -namespace Client { - -class SigClientInterface; -class ObjectModel; -class PluginModel; -class PatchModel; -class NodeModel; -class PortModel; -class ConnectionModel; - - -/** Automatically manages models of objects in the engine. - * - * \ingroup IngenClient - */ -class Store : public sigc::trackable { // FIXME: is trackable necessary? -public: - Store(SharedPtr engine, SharedPtr emitter); - - SharedPtr plugin(const string& uri); - SharedPtr object(const Path& path); - - void clear(); - - size_t num_object() { return _objects.size(); } - - typedef map > Plugins; - const Plugins& plugins() const { return _plugins; } - - typedef map > Objects; - const Objects& objects() const { return _objects; } - - sigc::signal > new_object_sig; -private: - - void add_object(SharedPtr object); - SharedPtr remove_object(const Path& path); - - void add_plugin(SharedPtr plugin); - - SharedPtr connection_patch(const Path& src_port_path, const Path& dst_port_path); - - // It would be nice to integrate these somehow.. - - void add_orphan(SharedPtr orphan); - void resolve_orphans(SharedPtr parent); - - void add_connection_orphan(SharedPtr orphan); - void resolve_connection_orphans(SharedPtr port); - - void add_plugin_orphan(SharedPtr orphan); - void resolve_plugin_orphans(SharedPtr plugin); - - void add_metadata_orphan(const Path& subject, const string& predicate, const Atom& value); - void resolve_metadata_orphans(SharedPtr subject); - - // Slots for SigClientInterface signals - void destruction_event(const Path& path); - void new_plugin_event(const string& uri, const string& type_uri, const string& name); - void new_patch_event(const Path& path, uint32_t poly); - void new_node_event(const string& plugin_uri, const Path& node_path, bool is_polyphonic, uint32_t num_ports); - void new_port_event(const Path& path, const string& data_type, bool is_output); - void patch_enabled_event(const Path& path); - void patch_disabled_event(const Path& path); - void patch_cleared_event(const Path& path); - void metadata_update_event(const Path& subject_path, const string& predicate, const Atom& value); - void control_change_event(const Path& port_path, float value); - void connection_event(const Path& src_port_path, const Path& dst_port_path); - void disconnection_event(const Path& src_port_path, const Path& dst_port_path); - - SharedPtr _engine; - SharedPtr _emitter; - - - Objects _objects; ///< Map, keyed by Ingen path - Plugins _plugins; ///< Map, keyed by plugin URI - - /** Objects we've received, but depend on the existance of another unknown object. - * Keyed by the path of the depended-on object (for tolerance of orderless comms) */ - map > > _orphans; - - /** Same idea, except with plugins instead of parents. - * It's unfortunate everything doesn't just have a URI and this was the same.. ahem.. */ - map > > _plugin_orphans; - - /** Not orphans OF metadata like the above, but orphans which are metadata */ - map > > _metadata_orphans; - - /** Ditto */ - list > _connection_orphans; -}; - - -} // namespace Client -} // namespace Ingen - -#endif // STORE_H diff --git a/src/libs/client/Store.hpp b/src/libs/client/Store.hpp new file mode 100644 index 00000000..38814200 --- /dev/null +++ b/src/libs/client/Store.hpp @@ -0,0 +1,132 @@ +/* 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 STORE_H +#define STORE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include "interface/EngineInterface.hpp" +using std::string; using std::map; using std::list; +using Ingen::Shared::EngineInterface; +using Raul::Path; +using Raul::Atom; + +namespace Ingen { +namespace Client { + +class SigClientInterface; +class ObjectModel; +class PluginModel; +class PatchModel; +class NodeModel; +class PortModel; +class ConnectionModel; + + +/** Automatically manages models of objects in the engine. + * + * \ingroup IngenClient + */ +class Store : public sigc::trackable { // FIXME: is trackable necessary? +public: + Store(SharedPtr engine, SharedPtr emitter); + + SharedPtr plugin(const string& uri); + SharedPtr object(const Path& path); + + void clear(); + + size_t num_object() { return _objects.size(); } + + typedef map > Plugins; + const Plugins& plugins() const { return _plugins; } + + typedef map > Objects; + const Objects& objects() const { return _objects; } + + sigc::signal > new_object_sig; +private: + + void add_object(SharedPtr object); + SharedPtr remove_object(const Path& path); + + void add_plugin(SharedPtr plugin); + + SharedPtr connection_patch(const Path& src_port_path, const Path& dst_port_path); + + // It would be nice to integrate these somehow.. + + void add_orphan(SharedPtr orphan); + void resolve_orphans(SharedPtr parent); + + void add_connection_orphan(SharedPtr orphan); + void resolve_connection_orphans(SharedPtr port); + + void add_plugin_orphan(SharedPtr orphan); + void resolve_plugin_orphans(SharedPtr plugin); + + void add_metadata_orphan(const Path& subject, const string& predicate, const Atom& value); + void resolve_metadata_orphans(SharedPtr subject); + + // Slots for SigClientInterface signals + void destruction_event(const Path& path); + void new_plugin_event(const string& uri, const string& type_uri, const string& name); + void new_patch_event(const Path& path, uint32_t poly); + void new_node_event(const string& plugin_uri, const Path& node_path, bool is_polyphonic, uint32_t num_ports); + void new_port_event(const Path& path, const string& data_type, bool is_output); + void patch_enabled_event(const Path& path); + void patch_disabled_event(const Path& path); + void patch_cleared_event(const Path& path); + void metadata_update_event(const Path& subject_path, const string& predicate, const Atom& value); + void control_change_event(const Path& port_path, float value); + void connection_event(const Path& src_port_path, const Path& dst_port_path); + void disconnection_event(const Path& src_port_path, const Path& dst_port_path); + + SharedPtr _engine; + SharedPtr _emitter; + + + Objects _objects; ///< Map, keyed by Ingen path + Plugins _plugins; ///< Map, keyed by plugin URI + + /** Objects we've received, but depend on the existance of another unknown object. + * Keyed by the path of the depended-on object (for tolerance of orderless comms) */ + map > > _orphans; + + /** Same idea, except with plugins instead of parents. + * It's unfortunate everything doesn't just have a URI and this was the same.. ahem.. */ + map > > _plugin_orphans; + + /** Not orphans OF metadata like the above, but orphans which are metadata */ + map > > _metadata_orphans; + + /** Ditto */ + list > _connection_orphans; +}; + + +} // namespace Client +} // namespace Ingen + +#endif // STORE_H diff --git a/src/libs/client/ThreadedSigClientInterface.cpp b/src/libs/client/ThreadedSigClientInterface.cpp index 6d4ac074..3b7af80c 100644 --- a/src/libs/client/ThreadedSigClientInterface.cpp +++ b/src/libs/client/ThreadedSigClientInterface.cpp @@ -15,7 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "ThreadedSigClientInterface.h" +#include "ThreadedSigClientInterface.hpp" #include using std::cerr; using std::endl; diff --git a/src/libs/client/ThreadedSigClientInterface.h b/src/libs/client/ThreadedSigClientInterface.h deleted file mode 100644 index d0cb4e89..00000000 --- a/src/libs/client/ThreadedSigClientInterface.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 THREADEDSIGCLIENTINTERFACE_H -#define THREADEDSIGCLIENTINTERFACE_H - -#include -#include -#include -#include "interface/ClientInterface.h" -#include "SigClientInterface.h" -#include -#include -using std::string; - -/** Returns nothing and takes no parameters (because they have all been bound) */ -typedef sigc::slot Closure; - -namespace Ingen { -namespace Client { - - -/** A LibSigC++ signal emitting interface for clients to use. - * - * This emits signals (possibly) in a different thread than the ClientInterface - * functions are called. It must be explicitly driven with the emit_signals() - * function, which fires all enqueued signals up until the present. You can - * use this in a GTK idle callback for receiving thread safe engine signals. - */ -class ThreadedSigClientInterface : public SigClientInterface -{ -public: - ThreadedSigClientInterface(uint32_t queue_size) - : _enabled(true) - , _sigs(queue_size) - , response_slot(response_sig.make_slot()) - , error_slot(error_sig.make_slot()) - , new_plugin_slot(new_plugin_sig.make_slot()) - , new_patch_slot(new_patch_sig.make_slot()) - , new_node_slot(new_node_sig.make_slot()) - , new_port_slot(new_port_sig.make_slot()) - , connection_slot(connection_sig.make_slot()) - , patch_enabled_slot(patch_enabled_sig.make_slot()) - , patch_disabled_slot(patch_disabled_sig.make_slot()) - , patch_cleared_slot(patch_cleared_sig.make_slot()) - , object_destroyed_slot(object_destroyed_sig.make_slot()) - , object_renamed_slot(object_renamed_sig.make_slot()) - , disconnection_slot(disconnection_sig.make_slot()) - , metadata_update_slot(metadata_update_sig.make_slot()) - , control_change_slot(control_change_sig.make_slot()) - , program_add_slot(program_add_sig.make_slot()) - , program_remove_slot(program_remove_sig.make_slot()) - {} - - void enable() { _enabled = true; } - void disable() { _enabled = false ; } - - // FIXME: make this insert bundle-boundary-events, where the GTK thread - // process all events between start and finish in one cycle, guaranteed - // (no more node jumping) - void bundle_begin() {} - void bundle_end() {} - - void transfer_begin() {} - void transfer_end() {} - - void num_plugins(uint32_t num) { _num_plugins = num; } - - void response(int32_t id, bool success, string msg) - { push_sig(sigc::bind(response_slot, id, success, msg)); } - - void error(string msg) - { push_sig(sigc::bind(error_slot, msg)); } - - void new_plugin(string uri, string type_uri, string name) - { push_sig(sigc::bind(new_plugin_slot, uri, type_uri, name)); } - - void new_patch(string path, uint32_t poly) - { push_sig(sigc::bind(new_patch_slot, path, poly)); } - - void new_node(string plugin_uri, string node_path, bool is_polyphonic, uint32_t num_ports) - { push_sig(sigc::bind(new_node_slot, plugin_uri, node_path, is_polyphonic, num_ports)); } - - void new_port(string path, string data_type, bool is_output) - { push_sig(sigc::bind(new_port_slot, path, data_type, is_output)); } - - void connection(string src_port_path, string dst_port_path) - { push_sig(sigc::bind(connection_slot, src_port_path, dst_port_path)); } - - void object_destroyed(string path) - { push_sig(sigc::bind(object_destroyed_slot, path)); } - - void patch_enabled(string path) - { push_sig(sigc::bind(patch_enabled_slot, path)); } - - void patch_disabled(string path) - { push_sig(sigc::bind(patch_disabled_slot, path)); } - - void patch_cleared(string path) - { push_sig(sigc::bind(patch_cleared_slot, path)); } - - void object_renamed(string old_path, string new_path) - { push_sig(sigc::bind(object_renamed_slot, old_path, new_path)); } - - void disconnection(string src_port_path, string dst_port_path) - { push_sig(sigc::bind(disconnection_slot, src_port_path, dst_port_path)); } - - void metadata_update(string path, string key, Raul::Atom value) - { push_sig(sigc::bind(metadata_update_slot, path, key, value)); } - - void control_change(string port_path, float value) - { push_sig(sigc::bind(control_change_slot, port_path, value)); } - - void program_add(string path, uint32_t bank, uint32_t program, string name) - { push_sig(sigc::bind(program_add_slot, path, bank, program, name)); } - - void program_remove(string path, uint32_t bank, uint32_t program) - { push_sig(sigc::bind(program_remove_slot, path, bank, program)); } - - /** Process all queued events - Called from GTK thread to emit signals. */ - bool emit_signals(); - -private: - void push_sig(Closure ev); - - bool _enabled; - - Raul::SRSWQueue _sigs; - uint32_t _num_plugins; - - sigc::slot bundle_begin_slot; - sigc::slot bundle_end_slot; - sigc::slot num_plugins_slot; - sigc::slot response_slot; - sigc::slot error_slot; - sigc::slot new_plugin_slot; - sigc::slot new_patch_slot; - sigc::slot new_node_slot; - sigc::slot new_port_slot; - sigc::slot connection_slot; - sigc::slot patch_enabled_slot; - sigc::slot patch_disabled_slot; - sigc::slot patch_cleared_slot; - sigc::slot object_destroyed_slot; - sigc::slot object_renamed_slot; - sigc::slot disconnection_slot; - sigc::slot metadata_update_slot; - sigc::slot control_change_slot; - sigc::slot program_add_slot; - sigc::slot program_remove_slot; -}; - - -} // namespace Client -} // namespace Ingen - -#endif diff --git a/src/libs/client/ThreadedSigClientInterface.hpp b/src/libs/client/ThreadedSigClientInterface.hpp new file mode 100644 index 00000000..b6908a1c --- /dev/null +++ b/src/libs/client/ThreadedSigClientInterface.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 THREADEDSIGCLIENTINTERFACE_H +#define THREADEDSIGCLIENTINTERFACE_H + +#include +#include +#include +#include "interface/ClientInterface.hpp" +#include "SigClientInterface.hpp" +#include +#include +using std::string; + +/** Returns nothing and takes no parameters (because they have all been bound) */ +typedef sigc::slot Closure; + +namespace Ingen { +namespace Client { + + +/** A LibSigC++ signal emitting interface for clients to use. + * + * This emits signals (possibly) in a different thread than the ClientInterface + * functions are called. It must be explicitly driven with the emit_signals() + * function, which fires all enqueued signals up until the present. You can + * use this in a GTK idle callback for receiving thread safe engine signals. + */ +class ThreadedSigClientInterface : public SigClientInterface +{ +public: + ThreadedSigClientInterface(uint32_t queue_size) + : _enabled(true) + , _sigs(queue_size) + , response_slot(response_sig.make_slot()) + , error_slot(error_sig.make_slot()) + , new_plugin_slot(new_plugin_sig.make_slot()) + , new_patch_slot(new_patch_sig.make_slot()) + , new_node_slot(new_node_sig.make_slot()) + , new_port_slot(new_port_sig.make_slot()) + , connection_slot(connection_sig.make_slot()) + , patch_enabled_slot(patch_enabled_sig.make_slot()) + , patch_disabled_slot(patch_disabled_sig.make_slot()) + , patch_cleared_slot(patch_cleared_sig.make_slot()) + , object_destroyed_slot(object_destroyed_sig.make_slot()) + , object_renamed_slot(object_renamed_sig.make_slot()) + , disconnection_slot(disconnection_sig.make_slot()) + , metadata_update_slot(metadata_update_sig.make_slot()) + , control_change_slot(control_change_sig.make_slot()) + , program_add_slot(program_add_sig.make_slot()) + , program_remove_slot(program_remove_sig.make_slot()) + {} + + void enable() { _enabled = true; } + void disable() { _enabled = false ; } + + // FIXME: make this insert bundle-boundary-events, where the GTK thread + // process all events between start and finish in one cycle, guaranteed + // (no more node jumping) + void bundle_begin() {} + void bundle_end() {} + + void transfer_begin() {} + void transfer_end() {} + + void num_plugins(uint32_t num) { _num_plugins = num; } + + void response(int32_t id, bool success, string msg) + { push_sig(sigc::bind(response_slot, id, success, msg)); } + + void error(string msg) + { push_sig(sigc::bind(error_slot, msg)); } + + void new_plugin(string uri, string type_uri, string name) + { push_sig(sigc::bind(new_plugin_slot, uri, type_uri, name)); } + + void new_patch(string path, uint32_t poly) + { push_sig(sigc::bind(new_patch_slot, path, poly)); } + + void new_node(string plugin_uri, string node_path, bool is_polyphonic, uint32_t num_ports) + { push_sig(sigc::bind(new_node_slot, plugin_uri, node_path, is_polyphonic, num_ports)); } + + void new_port(string path, string data_type, bool is_output) + { push_sig(sigc::bind(new_port_slot, path, data_type, is_output)); } + + void connection(string src_port_path, string dst_port_path) + { push_sig(sigc::bind(connection_slot, src_port_path, dst_port_path)); } + + void object_destroyed(string path) + { push_sig(sigc::bind(object_destroyed_slot, path)); } + + void patch_enabled(string path) + { push_sig(sigc::bind(patch_enabled_slot, path)); } + + void patch_disabled(string path) + { push_sig(sigc::bind(patch_disabled_slot, path)); } + + void patch_cleared(string path) + { push_sig(sigc::bind(patch_cleared_slot, path)); } + + void object_renamed(string old_path, string new_path) + { push_sig(sigc::bind(object_renamed_slot, old_path, new_path)); } + + void disconnection(string src_port_path, string dst_port_path) + { push_sig(sigc::bind(disconnection_slot, src_port_path, dst_port_path)); } + + void metadata_update(string path, string key, Raul::Atom value) + { push_sig(sigc::bind(metadata_update_slot, path, key, value)); } + + void control_change(string port_path, float value) + { push_sig(sigc::bind(control_change_slot, port_path, value)); } + + void program_add(string path, uint32_t bank, uint32_t program, string name) + { push_sig(sigc::bind(program_add_slot, path, bank, program, name)); } + + void program_remove(string path, uint32_t bank, uint32_t program) + { push_sig(sigc::bind(program_remove_slot, path, bank, program)); } + + /** Process all queued events - Called from GTK thread to emit signals. */ + bool emit_signals(); + +private: + void push_sig(Closure ev); + + bool _enabled; + + Raul::SRSWQueue _sigs; + uint32_t _num_plugins; + + sigc::slot bundle_begin_slot; + sigc::slot bundle_end_slot; + sigc::slot num_plugins_slot; + sigc::slot response_slot; + sigc::slot error_slot; + sigc::slot new_plugin_slot; + sigc::slot new_patch_slot; + sigc::slot new_node_slot; + sigc::slot new_port_slot; + sigc::slot connection_slot; + sigc::slot patch_enabled_slot; + sigc::slot patch_disabled_slot; + sigc::slot patch_cleared_slot; + sigc::slot object_destroyed_slot; + sigc::slot object_renamed_slot; + sigc::slot disconnection_slot; + sigc::slot metadata_update_slot; + sigc::slot control_change_slot; + sigc::slot program_add_slot; + sigc::slot program_remove_slot; +}; + + +} // namespace Client +} // namespace Ingen + +#endif diff --git a/src/libs/client/client.cpp b/src/libs/client/client.cpp index da28a342..8b86e958 100644 --- a/src/libs/client/client.cpp +++ b/src/libs/client/client.cpp @@ -15,8 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "client.h" -#include "OSCEngineSender.h" +#include "client.hpp" +#include "OSCEngineSender.hpp" namespace Ingen { namespace Client { diff --git a/src/libs/client/client.h b/src/libs/client/client.h deleted file mode 100644 index fa4ad6c9..00000000 --- a/src/libs/client/client.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 INGEN_CLIENT_H -#define INGEN_CLIENT_H - -#include - -namespace Ingen { - -class Engine; - -namespace Shared { class EngineInterface; } - -namespace Client { - -extern "C" { - - SharedPtr new_osc_interface(const std::string& url); - SharedPtr new_queued_interface(SharedPtr engine); - -} - - -} // namespace Client -} // namespace Ingen - -#endif // INGEN_CLIENT_H - diff --git a/src/libs/client/client.hpp b/src/libs/client/client.hpp new file mode 100644 index 00000000..931e4c45 --- /dev/null +++ b/src/libs/client/client.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 INGEN_CLIENT_H +#define INGEN_CLIENT_H + +#include + +namespace Ingen { + +class Engine; + +namespace Shared { class EngineInterface; } + +namespace Client { + +extern "C" { + + SharedPtr new_osc_interface(const std::string& url); + SharedPtr new_queued_interface(SharedPtr engine); + +} + + +} // namespace Client +} // namespace Ingen + +#endif // INGEN_CLIENT_H + 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 diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp index 7b815db2..acebf04e 100644 --- a/src/libs/gui/App.cpp +++ b/src/libs/gui/App.cpp @@ -16,33 +16,33 @@ */ #include "../../../config/config.h" -#include "App.h" +#include "App.hpp" #include #include #include #include #include #include -#include -#include "interface/EngineInterface.h" -#include "client/ObjectModel.h" -#include "client/PatchModel.h" -#include "client/Store.h" -#include "NodeModule.h" -#include "ControlPanel.h" -#include "SubpatchModule.h" -#include "LoadPluginWindow.h" -#include "PatchWindow.h" -#include "MessagesWindow.h" -#include "ConfigWindow.h" -#include "GladeFactory.h" -#include "PatchTreeWindow.h" -#include "Configuration.h" -#include "ConnectWindow.h" -#include "ThreadedLoader.h" -#include "WindowFactory.h" +#include +#include "interface/EngineInterface.hpp" +#include "client/ObjectModel.hpp" +#include "client/PatchModel.hpp" +#include "client/Store.hpp" +#include "NodeModule.hpp" +#include "ControlPanel.hpp" +#include "SubpatchModule.hpp" +#include "LoadPluginWindow.hpp" +#include "PatchWindow.hpp" +#include "MessagesWindow.hpp" +#include "ConfigWindow.hpp" +#include "GladeFactory.hpp" +#include "PatchTreeWindow.hpp" +#include "Configuration.hpp" +#include "ConnectWindow.hpp" +#include "ThreadedLoader.hpp" +#include "WindowFactory.hpp" /*#ifdef HAVE_LASH -#include "LashController.h" +#include "LashController.hpp" #endif*/ using std::cerr; using std::cout; using std::endl; using std::string; diff --git a/src/libs/gui/App.h b/src/libs/gui/App.h deleted file mode 100644 index 9173a786..00000000 --- a/src/libs/gui/App.h +++ /dev/null @@ -1,143 +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 APP_H -#define APP_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -using std::string; using std::map; using std::list; -using std::cerr; using std::endl; - -namespace Ingen { - class Engine; - namespace Shared { - class EngineInterface; - } - namespace Client { - class PatchModel; - class PluginModel; - class Store; - class SigClientInterface; - } -} -using namespace Ingen::Client; -using Ingen::Shared::EngineInterface; - -/** \defgroup GUI GTK GUI - */ - -namespace Ingen { -namespace GUI { - -class MessagesWindow; -class ConfigWindow; -class PatchCanvas; -class PatchTreeView; -class PatchTreeWindow; -class ConnectWindow; -class Configuration; -class ThreadedLoader; -class WindowFactory; - - -/** Singleton master class most everything is contained within. - * - * This is a horrible god-object, but it's shrinking in size as things are - * moved out. Hopefully it will go away entirely some day.. - * - * \ingroup GUI - */ -class App -{ -public: - ~App(); - - void error_message(const string& msg); - - void attach(const SharedPtr& engine, - const SharedPtr& client); - - void detach(); - - void quit(); - - ConnectWindow* connect_window() const { return _connect_window; } - Gtk::Dialog* about_dialog() const { return _about_dialog; } - ConfigWindow* configuration_dialog() const { return _config_window; } - MessagesWindow* messages_dialog() const { return _messages_window; } - PatchTreeWindow* patch_tree() const { return _patch_tree_window; } - Configuration* configuration() const { return _configuration; } - WindowFactory* window_factory() const { return _window_factory; } - - Raul::RDF::World* rdf_world() { return &_rdf_world; } - - const SharedPtr& engine() const { return _engine; } - const SharedPtr& client() const { return _client; } - const SharedPtr& store() const { return _store; } - const SharedPtr& loader() const { return _loader; } - - static inline App& instance() { assert(_instance); return *_instance; } - - static void run(int argc, char** argv, - SharedPtr engine, - SharedPtr interface); - -protected: - App(); - static App* _instance; - - static void instantiate(int argc, char** argv); - - SharedPtr _engine; - SharedPtr _client; - SharedPtr _store; - SharedPtr _loader; - - Configuration* _configuration; - - ConnectWindow* _connect_window; - MessagesWindow* _messages_window; - PatchTreeWindow* _patch_tree_window; - ConfigWindow* _config_window; - Gtk::Dialog* _about_dialog; - WindowFactory* _window_factory; - - Raul::RDF::World _rdf_world; - - /** Used to avoid feedback loops with (eg) process checkbutton - * FIXME: Maybe this should be globally implemented at the Controller level, - * disable all command sending while handling events to avoid feedback - * issues with widget event callbacks? This same pattern is duplicated - * too much... */ - bool _enable_signal; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // APP_H - diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp new file mode 100644 index 00000000..97bbb661 --- /dev/null +++ b/src/libs/gui/App.hpp @@ -0,0 +1,143 @@ +/* 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 APP_H +#define APP_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using std::string; using std::map; using std::list; +using std::cerr; using std::endl; + +namespace Ingen { + class Engine; + namespace Shared { + class EngineInterface; + } + namespace Client { + class PatchModel; + class PluginModel; + class Store; + class SigClientInterface; + } +} +using namespace Ingen::Client; +using Ingen::Shared::EngineInterface; + +/** \defgroup GUI GTK GUI + */ + +namespace Ingen { +namespace GUI { + +class MessagesWindow; +class ConfigWindow; +class PatchCanvas; +class PatchTreeView; +class PatchTreeWindow; +class ConnectWindow; +class Configuration; +class ThreadedLoader; +class WindowFactory; + + +/** Singleton master class most everything is contained within. + * + * This is a horrible god-object, but it's shrinking in size as things are + * moved out. Hopefully it will go away entirely some day.. + * + * \ingroup GUI + */ +class App +{ +public: + ~App(); + + void error_message(const string& msg); + + void attach(const SharedPtr& engine, + const SharedPtr& client); + + void detach(); + + void quit(); + + ConnectWindow* connect_window() const { return _connect_window; } + Gtk::Dialog* about_dialog() const { return _about_dialog; } + ConfigWindow* configuration_dialog() const { return _config_window; } + MessagesWindow* messages_dialog() const { return _messages_window; } + PatchTreeWindow* patch_tree() const { return _patch_tree_window; } + Configuration* configuration() const { return _configuration; } + WindowFactory* window_factory() const { return _window_factory; } + + Raul::RDF::World* rdf_world() { return &_rdf_world; } + + const SharedPtr& engine() const { return _engine; } + const SharedPtr& client() const { return _client; } + const SharedPtr& store() const { return _store; } + const SharedPtr& loader() const { return _loader; } + + static inline App& instance() { assert(_instance); return *_instance; } + + static void run(int argc, char** argv, + SharedPtr engine, + SharedPtr interface); + +protected: + App(); + static App* _instance; + + static void instantiate(int argc, char** argv); + + SharedPtr _engine; + SharedPtr _client; + SharedPtr _store; + SharedPtr _loader; + + Configuration* _configuration; + + ConnectWindow* _connect_window; + MessagesWindow* _messages_window; + PatchTreeWindow* _patch_tree_window; + ConfigWindow* _config_window; + Gtk::Dialog* _about_dialog; + WindowFactory* _window_factory; + + Raul::RDF::World _rdf_world; + + /** Used to avoid feedback loops with (eg) process checkbutton + * FIXME: Maybe this should be globally implemented at the Controller level, + * disable all command sending while handling events to avoid feedback + * issues with widget event callbacks? This same pattern is duplicated + * too much... */ + bool _enable_signal; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // APP_H + diff --git a/src/libs/gui/BreadCrumb.h b/src/libs/gui/BreadCrumb.h deleted file mode 100644 index 96464b50..00000000 --- a/src/libs/gui/BreadCrumb.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 BREADCRUMB_H -#define BREADCRUMB_H - -#include -#include -#include -#include "PatchView.h" - -namespace Ingen { -namespace GUI { - - -/** Breadcrumb button in a PatchWindow. - * - * Each Breadcrumb stores a reference to a PatchView for quick switching. - * So, the amount of allocated PatchViews at a given time is equal to the - * number of visible breadcrumbs (which is the perfect cache for GUI - * responsiveness balanced with mem consumption). - * - * \ingroup GUI - */ -class BreadCrumb : public Gtk::ToggleButton -{ -public: - BreadCrumb(const Path& path, SharedPtr view = SharedPtr()) - : _path(path) - , _view(view) - { - assert( !view || view->patch()->path() == path); - set_border_width(0); - set_path(path); - show_all(); - } - - void set_view(SharedPtr view) { - assert( !view || view->patch()->path() == _path); - _view = view; - } - - const Path& path() const { return _path; } - SharedPtr view() const { return _view; } - - void set_path(const Path& path) - { - remove(); - const string text = (path == "/") ? "/" : path.name(); - Gtk::Label* lab = manage(new Gtk::Label(text)); - lab->set_padding(0, 0); - lab->show(); - add(*lab); - - if (_view && _view->patch()->path() != path) - _view.reset(); - } - -private: - Path _path; - SharedPtr _view; -}; - -} // namespace GUI -} // namespace Ingen - -#endif // BREADCRUMB_H diff --git a/src/libs/gui/BreadCrumb.hpp b/src/libs/gui/BreadCrumb.hpp new file mode 100644 index 00000000..7f4f9f89 --- /dev/null +++ b/src/libs/gui/BreadCrumb.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 BREADCRUMB_H +#define BREADCRUMB_H + +#include +#include +#include +#include "PatchView.hpp" + +namespace Ingen { +namespace GUI { + + +/** Breadcrumb button in a PatchWindow. + * + * Each Breadcrumb stores a reference to a PatchView for quick switching. + * So, the amount of allocated PatchViews at a given time is equal to the + * number of visible breadcrumbs (which is the perfect cache for GUI + * responsiveness balanced with mem consumption). + * + * \ingroup GUI + */ +class BreadCrumb : public Gtk::ToggleButton +{ +public: + BreadCrumb(const Path& path, SharedPtr view = SharedPtr()) + : _path(path) + , _view(view) + { + assert( !view || view->patch()->path() == path); + set_border_width(0); + set_path(path); + show_all(); + } + + void set_view(SharedPtr view) { + assert( !view || view->patch()->path() == _path); + _view = view; + } + + const Path& path() const { return _path; } + SharedPtr view() const { return _view; } + + void set_path(const Path& path) + { + remove(); + const string text = (path == "/") ? "/" : path.name(); + Gtk::Label* lab = manage(new Gtk::Label(text)); + lab->set_padding(0, 0); + lab->show(); + add(*lab); + + if (_view && _view->patch()->path() != path) + _view.reset(); + } + +private: + Path _path; + SharedPtr _view; +}; + +} // namespace GUI +} // namespace Ingen + +#endif // BREADCRUMB_H diff --git a/src/libs/gui/BreadCrumbBox.cpp b/src/libs/gui/BreadCrumbBox.cpp index 79a0bf69..d8ff4519 100644 --- a/src/libs/gui/BreadCrumbBox.cpp +++ b/src/libs/gui/BreadCrumbBox.cpp @@ -15,8 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "BreadCrumbBox.h" -#include "BreadCrumb.h" +#include "BreadCrumbBox.hpp" +#include "BreadCrumb.hpp" namespace Ingen { namespace GUI { diff --git a/src/libs/gui/BreadCrumbBox.h b/src/libs/gui/BreadCrumbBox.h deleted file mode 100644 index 8b806f5a..00000000 --- a/src/libs/gui/BreadCrumbBox.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 BREADCRUMBBOX_H -#define BREADCRUMBBOX_H - -#include -#include -#include -#include -#include -#include -#include "PatchView.h" - -namespace Ingen { -namespace GUI { - -class BreadCrumb; - - -/** Collection of breadcrumb buttons forming a path. - * - * This doubles as a cache for PatchViews. - * - * \ingroup GUI - */ -class BreadCrumbBox : public Gtk::HBox -{ -public: - BreadCrumbBox(); - - SharedPtr view(const Path& path); - - void build(Path path, SharedPtr view); - - sigc::signal > signal_patch_selected; - -private: - BreadCrumb* create_crumb(const Path& path, - SharedPtr view = SharedPtr()); - - void breadcrumb_clicked(BreadCrumb* crumb); - - void object_removed(const Path& path); - void object_renamed(const Path& old_path, const Path& new_path); - - Path _active_path; - Path _full_path; - bool _enable_signal; - std::list _breadcrumbs; -}; - -} // namespace GUI -} // namespace Ingen - -#endif // BREADCRUMBBOX_H diff --git a/src/libs/gui/BreadCrumbBox.hpp b/src/libs/gui/BreadCrumbBox.hpp new file mode 100644 index 00000000..5e90806b --- /dev/null +++ b/src/libs/gui/BreadCrumbBox.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 BREADCRUMBBOX_H +#define BREADCRUMBBOX_H + +#include +#include +#include +#include +#include +#include +#include "PatchView.hpp" + +namespace Ingen { +namespace GUI { + +class BreadCrumb; + + +/** Collection of breadcrumb buttons forming a path. + * + * This doubles as a cache for PatchViews. + * + * \ingroup GUI + */ +class BreadCrumbBox : public Gtk::HBox +{ +public: + BreadCrumbBox(); + + SharedPtr view(const Path& path); + + void build(Path path, SharedPtr view); + + sigc::signal > signal_patch_selected; + +private: + BreadCrumb* create_crumb(const Path& path, + SharedPtr view = SharedPtr()); + + void breadcrumb_clicked(BreadCrumb* crumb); + + void object_removed(const Path& path); + void object_renamed(const Path& old_path, const Path& new_path); + + Path _active_path; + Path _full_path; + bool _enable_signal; + std::list _breadcrumbs; +}; + +} // namespace GUI +} // namespace Ingen + +#endif // BREADCRUMBBOX_H diff --git a/src/libs/gui/ConfigWindow.cpp b/src/libs/gui/ConfigWindow.cpp index c8b29f1a..3fb44626 100644 --- a/src/libs/gui/ConfigWindow.cpp +++ b/src/libs/gui/ConfigWindow.cpp @@ -19,8 +19,8 @@ #include #include #include -#include "client/NodeModel.h" -#include "ConfigWindow.h" +#include "client/NodeModel.hpp" +#include "ConfigWindow.hpp" using namespace std; diff --git a/src/libs/gui/ConfigWindow.h b/src/libs/gui/ConfigWindow.h deleted file mode 100644 index d1a2cff6..00000000 --- a/src/libs/gui/ConfigWindow.h +++ /dev/null @@ -1,65 +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 CONFIGWINDOW_H -#define CONFIGWINDOW_H - -#include -#include -#include -#include -#include "client/PluginModel.h" -#include "Configuration.h" - -using std::list; -using Ingen::Client::PluginModel; - -namespace Ingen { -namespace GUI { - - -/** 'Configuration' window. - * - * Loaded by glade as a derived object. - * - * \ingroup GUI - */ -class ConfigWindow : public Gtk::Window -{ -public: - ConfigWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void configuration(Configuration* sm); - -private: - void save_clicked(); - void cancel_clicked(); - void ok_clicked(); - - Configuration* _configuration; - - Gtk::Entry* _path_entry; - Gtk::Button* _save_button; - Gtk::Button* _cancel_button; - Gtk::Button* _ok_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // CONFIGWINDOW_H diff --git a/src/libs/gui/ConfigWindow.hpp b/src/libs/gui/ConfigWindow.hpp new file mode 100644 index 00000000..dce40218 --- /dev/null +++ b/src/libs/gui/ConfigWindow.hpp @@ -0,0 +1,65 @@ +/* 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 CONFIGWINDOW_H +#define CONFIGWINDOW_H + +#include +#include +#include +#include +#include "client/PluginModel.hpp" +#include "Configuration.hpp" + +using std::list; +using Ingen::Client::PluginModel; + +namespace Ingen { +namespace GUI { + + +/** 'Configuration' window. + * + * Loaded by glade as a derived object. + * + * \ingroup GUI + */ +class ConfigWindow : public Gtk::Window +{ +public: + ConfigWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); + + void configuration(Configuration* sm); + +private: + void save_clicked(); + void cancel_clicked(); + void ok_clicked(); + + Configuration* _configuration; + + Gtk::Entry* _path_entry; + Gtk::Button* _save_button; + Gtk::Button* _cancel_button; + Gtk::Button* _ok_button; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // CONFIGWINDOW_H diff --git a/src/libs/gui/Configuration.cpp b/src/libs/gui/Configuration.cpp index 72ea5cb5..afeba77e 100644 --- a/src/libs/gui/Configuration.cpp +++ b/src/libs/gui/Configuration.cpp @@ -15,17 +15,17 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "Configuration.h" +#include "Configuration.hpp" #include #include #include #include #include -#include "client/PortModel.h" -#include "client/PluginModel.h" -#include "client/PatchModel.h" -#include "serialisation/Loader.h" -#include "App.h" +#include "client/PortModel.hpp" +#include "client/PluginModel.hpp" +#include "client/PatchModel.hpp" +#include "serialisation/Loader.hpp" +#include "App.hpp" using std::cerr; using std::cout; using std::endl; using std::map; using std::string; diff --git a/src/libs/gui/Configuration.h b/src/libs/gui/Configuration.h deleted file mode 100644 index 9f7cbb08..00000000 --- a/src/libs/gui/Configuration.h +++ /dev/null @@ -1,80 +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 CONFIG_H -#define CONFIG_H - -#include - -namespace Ingen { namespace Client { class PortModel; } } -using Ingen::Client::PortModel; -using std::string; - -struct Coord { double x; double y; }; - -namespace Ingen { -namespace GUI { - -class Controller; - - -/** Singleton state manager for the entire app. - * - * Stores settings like color preferences, search paths, etc. - * (ie any user-defined preferences to be stoed in the rc file). - * - * \ingroup GUI - */ -class Configuration -{ -public: - Configuration(); - ~Configuration(); - - void load_settings(string filename = ""); - void save_settings(string filename = ""); - - void apply_settings(); - - string patch_path() { return _patch_path; } - void patch_path(const string& path) { _patch_path = path; } - - const string& patch_folder() { return _patch_folder; } - void set_patch_folder(const string& f) { _patch_folder = f; } - - uint32_t get_port_color(const PortModel* pi); - -private: - /** Search path for patch files. Colon delimited, as usual. */ - string _patch_path; - - /** Most recent patch folder shown in open dialog */ - string _patch_folder; - - uint32_t _audio_port_color; - uint32_t _control_port_color; - uint32_t _midi_port_color; - uint32_t _osc_port_color; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // CONFIG_H - - diff --git a/src/libs/gui/Configuration.hpp b/src/libs/gui/Configuration.hpp new file mode 100644 index 00000000..9f7cbb08 --- /dev/null +++ b/src/libs/gui/Configuration.hpp @@ -0,0 +1,80 @@ +/* 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 CONFIG_H +#define CONFIG_H + +#include + +namespace Ingen { namespace Client { class PortModel; } } +using Ingen::Client::PortModel; +using std::string; + +struct Coord { double x; double y; }; + +namespace Ingen { +namespace GUI { + +class Controller; + + +/** Singleton state manager for the entire app. + * + * Stores settings like color preferences, search paths, etc. + * (ie any user-defined preferences to be stoed in the rc file). + * + * \ingroup GUI + */ +class Configuration +{ +public: + Configuration(); + ~Configuration(); + + void load_settings(string filename = ""); + void save_settings(string filename = ""); + + void apply_settings(); + + string patch_path() { return _patch_path; } + void patch_path(const string& path) { _patch_path = path; } + + const string& patch_folder() { return _patch_folder; } + void set_patch_folder(const string& f) { _patch_folder = f; } + + uint32_t get_port_color(const PortModel* pi); + +private: + /** Search path for patch files. Colon delimited, as usual. */ + string _patch_path; + + /** Most recent patch folder shown in open dialog */ + string _patch_folder; + + uint32_t _audio_port_color; + uint32_t _control_port_color; + uint32_t _midi_port_color; + uint32_t _osc_port_color; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // CONFIG_H + + diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp index ae787c99..f643b059 100644 --- a/src/libs/gui/ConnectWindow.cpp +++ b/src/libs/gui/ConnectWindow.cpp @@ -21,23 +21,23 @@ #include #include #include -#include +#include #include "../../../../config/config.h" -#include "interface/ClientKey.h" -#include "interface/EngineInterface.h" -#include "engine/tuning.h" -#include "engine/Engine.h" -#include "engine/DirectResponder.h" -#include "engine/QueuedEngineInterface.h" -#include "client/OSCClientReceiver.h" -#include "client/OSCEngineSender.h" -#include "client/ThreadedSigClientInterface.h" -#include "client/Store.h" -#include "client/PatchModel.h" -#include "module/Module.h" -#include "App.h" -#include "WindowFactory.h" -#include "ConnectWindow.h" +#include "interface/ClientKey.hpp" +#include "interface/EngineInterface.hpp" +#include "engine/tuning.hpp" +#include "engine/Engine.hpp" +#include "engine/DirectResponder.hpp" +#include "engine/QueuedEngineInterface.hpp" +#include "client/OSCClientReceiver.hpp" +#include "client/OSCEngineSender.hpp" +#include "client/ThreadedSigClientInterface.hpp" +#include "client/Store.hpp" +#include "client/PatchModel.hpp" +#include "module/Module.hpp" +#include "App.hpp" +#include "WindowFactory.hpp" +#include "ConnectWindow.hpp" using Ingen::QueuedEngineInterface; using Ingen::Client::ThreadedSigClientInterface; diff --git a/src/libs/gui/ConnectWindow.h b/src/libs/gui/ConnectWindow.h deleted file mode 100644 index a52bbea2..00000000 --- a/src/libs/gui/ConnectWindow.h +++ /dev/null @@ -1,92 +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 CONNECT_WINDOW_H -#define CONNECT_WINDOW_H - -#include -#include -#include -#include -#include "client/ThreadedSigClientInterface.h" -using Ingen::Client::SigClientInterface; - -namespace Ingen { class Engine; class QueuedEngineInterface; } - -namespace Ingen { -namespace GUI { - -class App; -class Controller; - - -/** The initially visible "Connect to engine" window. - * - * This handles actually connecting to the engine and making sure everything - * is ready before really launching the app (eg wait for the root patch). - * - * \ingroup GUI - */ -class ConnectWindow : public Gtk::Dialog -{ -public: - ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void set_connected_to(SharedPtr e=SharedPtr()); - void start(SharedPtr engine, SharedPtr interface); - void response_received(int32_t id, bool, string) { if ((id) == _ping_id) _attached = true; } - -private: - enum Mode { CONNECT_REMOTE, LAUNCH_REMOTE, INTERNAL }; - - void server_toggled(); - void launch_toggled(); - void internal_toggled(); - - void disconnect(); - void connect(); - void quit(); - - bool gtk_callback(); - - Mode _mode; - int32_t _ping_id; - bool _attached; - - int _connect_stage; - - SharedPtr _engine_module; - Ingen::Engine* (*_new_engine)(); - - Gtk::Image* _icon; - Gtk::ProgressBar* _progress_bar; - Gtk::Label* _progress_label; - Gtk::Entry* _url_entry; - Gtk::RadioButton* _server_radio; - Gtk::SpinButton* _port_spinbutton; - Gtk::RadioButton* _launch_radio; - Gtk::RadioButton* _internal_radio; - Gtk::Button* _disconnect_button; - Gtk::Button* _connect_button; - Gtk::Button* _quit_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // CONNECT_WINDOW_H diff --git a/src/libs/gui/ConnectWindow.hpp b/src/libs/gui/ConnectWindow.hpp new file mode 100644 index 00000000..5a0e67ad --- /dev/null +++ b/src/libs/gui/ConnectWindow.hpp @@ -0,0 +1,92 @@ +/* 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 CONNECT_WINDOW_H +#define CONNECT_WINDOW_H + +#include +#include +#include +#include +#include "client/ThreadedSigClientInterface.hpp" +using Ingen::Client::SigClientInterface; + +namespace Ingen { class Engine; class QueuedEngineInterface; } + +namespace Ingen { +namespace GUI { + +class App; +class Controller; + + +/** The initially visible "Connect to engine" window. + * + * This handles actually connecting to the engine and making sure everything + * is ready before really launching the app (eg wait for the root patch). + * + * \ingroup GUI + */ +class ConnectWindow : public Gtk::Dialog +{ +public: + ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); + + void set_connected_to(SharedPtr e=SharedPtr()); + void start(SharedPtr engine, SharedPtr interface); + void response_received(int32_t id, bool, string) { if ((id) == _ping_id) _attached = true; } + +private: + enum Mode { CONNECT_REMOTE, LAUNCH_REMOTE, INTERNAL }; + + void server_toggled(); + void launch_toggled(); + void internal_toggled(); + + void disconnect(); + void connect(); + void quit(); + + bool gtk_callback(); + + Mode _mode; + int32_t _ping_id; + bool _attached; + + int _connect_stage; + + SharedPtr _engine_module; + Ingen::Engine* (*_new_engine)(); + + Gtk::Image* _icon; + Gtk::ProgressBar* _progress_bar; + Gtk::Label* _progress_label; + Gtk::Entry* _url_entry; + Gtk::RadioButton* _server_radio; + Gtk::SpinButton* _port_spinbutton; + Gtk::RadioButton* _launch_radio; + Gtk::RadioButton* _internal_radio; + Gtk::Button* _disconnect_button; + Gtk::Button* _connect_button; + Gtk::Button* _quit_button; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // CONNECT_WINDOW_H diff --git a/src/libs/gui/Connection.h b/src/libs/gui/Connection.h deleted file mode 100644 index 75c988ac..00000000 --- a/src/libs/gui/Connection.h +++ /dev/null @@ -1,60 +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 -#include "client/ConnectionModel.h" -using Ingen::Client::ConnectionModel; - -namespace Ingen { -namespace GUI { - - -/** A Connection in a Patch. - * - * \ingroup GUI - */ -class Connection : public FlowCanvas::Connection -{ -public: - Connection(boost::shared_ptr canvas, - boost::shared_ptr model, - boost::shared_ptr src, - boost::shared_ptr dst, - uint32_t color) - : FlowCanvas::Connection(canvas, src, dst, color) - , _connection_model(model) - {} - - virtual ~Connection() {} - - SharedPtr model() const { return _connection_model; } - -private: - SharedPtr _connection_model; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // CONNECTION_H diff --git a/src/libs/gui/Connection.hpp b/src/libs/gui/Connection.hpp new file mode 100644 index 00000000..b6ad070c --- /dev/null +++ b/src/libs/gui/Connection.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 CONNECTION_H +#define CONNECTION_H + +#include +#include +#include +#include +#include "client/ConnectionModel.hpp" +using Ingen::Client::ConnectionModel; + +namespace Ingen { +namespace GUI { + + +/** A Connection in a Patch. + * + * \ingroup GUI + */ +class Connection : public FlowCanvas::Connection +{ +public: + Connection(boost::shared_ptr canvas, + boost::shared_ptr model, + boost::shared_ptr src, + boost::shared_ptr dst, + uint32_t color) + : FlowCanvas::Connection(canvas, src, dst, color) + , _connection_model(model) + {} + + virtual ~Connection() {} + + SharedPtr model() const { return _connection_model; } + +private: + SharedPtr _connection_model; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // CONNECTION_H diff --git a/src/libs/gui/ControlGroups.cpp b/src/libs/gui/ControlGroups.cpp index 5098c3f8..d410f201 100644 --- a/src/libs/gui/ControlGroups.cpp +++ b/src/libs/gui/ControlGroups.cpp @@ -18,15 +18,15 @@ #include #include #include -#include "interface/EngineInterface.h" -#include "client/PluginModel.h" -#include "client/NodeModel.h" -#include "client/PortModel.h" -#include "ControlGroups.h" -#include "ControlPanel.h" -#include "PortPropertiesWindow.h" -#include "GladeFactory.h" -#include "App.h" +#include "interface/EngineInterface.hpp" +#include "client/PluginModel.hpp" +#include "client/NodeModel.hpp" +#include "client/PortModel.hpp" +#include "ControlGroups.hpp" +#include "ControlPanel.hpp" +#include "PortPropertiesWindow.hpp" +#include "GladeFactory.hpp" +#include "App.hpp" using namespace std; using namespace Ingen::Client; diff --git a/src/libs/gui/ControlGroups.h b/src/libs/gui/ControlGroups.h deleted file mode 100644 index 4c5c6f11..00000000 --- a/src/libs/gui/ControlGroups.h +++ /dev/null @@ -1,163 +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 CONTROLGROUPS_H -#define CONTROLGROUPS_H - -#include -#include -#include -#include -#include "client/PortModel.h" -#include - -namespace Ingen { namespace Client { class PortModel; } } -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - -class ControlPanel; -class PortPropertiesWindow; - - -/** A group of controls (for a single Port) in a NodeControlWindow. - * - * \ingroup GUI - */ -class ControlGroup : public Gtk::VBox -{ -public: - ControlGroup(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); - virtual ~ControlGroup(); - - void init(ControlPanel* panel, SharedPtr pm); - - inline const SharedPtr port_model() const { return _port_model; } - -protected: - friend class PortPropertiesWindow; - - virtual void set_value(float value) = 0; - virtual void set_range(float min, float max) {} - - ControlPanel* _control_panel; - SharedPtr _port_model; - sigc::connection _control_connection; - bool _enable_signal; -}; - - -/** A slider for a continuous control. - * - * \ingroup GUI - */ -class SliderControlGroup : public ControlGroup -{ -public: - SliderControlGroup(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); - void init(ControlPanel* panel, SharedPtr pm); - - void enable(); - void disable(); - - void set_min(float val); - void set_max(float val); - -private: - void set_name(const string& name); - - bool clicked(GdkEventButton* ev); - - void set_value(float value); - void set_range(float min, float max); - - void update_range(); - void update_value_from_slider(); - void update_value_from_spinner(); - - void menu_properties(); - - bool slider_pressed(GdkEvent* ev); - - bool _enabled; - - Gtk::Label* _name_label; - Gtk::SpinButton* _value_spinner; - Gtk::HScale* _slider; - - Gtk::Menu* _menu; - Gtk::MenuItem* _menu_properties; -}; - - -#if 0 - -/** A spinbutton for integer controls. - * - * \ingroup GUI - */ -class IntegerControlGroup : public ControlGroup -{ -public: - IntegerControlGroup(ControlPanel* panel, SharedPtr pm); - - void enable(); - void disable(); - -private: - void set_name(const string& name); - void set_value(float val); - - void update_value(); - - bool _enable_signal; - Gtk::Alignment _alignment; - Gtk::Label _name_label; - Gtk::SpinButton _spinner; -}; - - -/** A radio button for toggle controls. - * - * \ingroup GUI - */ -class ToggleControlGroup : public ControlGroup -{ -public: - ToggleControlGroup(ControlPanel* panel, SharedPtr pm); - - void enable(); - void disable(); - -private: - void set_name(const string& name); - void set_value(float val); - - void update_value(); - - bool _enable_signal; - Gtk::Alignment _alignment; - Gtk::Label _name_label; - Gtk::CheckButton _checkbutton; -}; -#endif - -} // namespace GUI -} // namespace Ingen - -#endif // CONTROLGROUPS_H diff --git a/src/libs/gui/ControlGroups.hpp b/src/libs/gui/ControlGroups.hpp new file mode 100644 index 00000000..232b1b56 --- /dev/null +++ b/src/libs/gui/ControlGroups.hpp @@ -0,0 +1,163 @@ +/* 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 CONTROLGROUPS_H +#define CONTROLGROUPS_H + +#include +#include +#include +#include +#include "client/PortModel.hpp" +#include + +namespace Ingen { namespace Client { class PortModel; } } +using namespace Ingen::Client; + +namespace Ingen { +namespace GUI { + +class ControlPanel; +class PortPropertiesWindow; + + +/** A group of controls (for a single Port) in a NodeControlWindow. + * + * \ingroup GUI + */ +class ControlGroup : public Gtk::VBox +{ +public: + ControlGroup(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); + virtual ~ControlGroup(); + + void init(ControlPanel* panel, SharedPtr pm); + + inline const SharedPtr port_model() const { return _port_model; } + +protected: + friend class PortPropertiesWindow; + + virtual void set_value(float value) = 0; + virtual void set_range(float min, float max) {} + + ControlPanel* _control_panel; + SharedPtr _port_model; + sigc::connection _control_connection; + bool _enable_signal; +}; + + +/** A slider for a continuous control. + * + * \ingroup GUI + */ +class SliderControlGroup : public ControlGroup +{ +public: + SliderControlGroup(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); + void init(ControlPanel* panel, SharedPtr pm); + + void enable(); + void disable(); + + void set_min(float val); + void set_max(float val); + +private: + void set_name(const string& name); + + bool clicked(GdkEventButton* ev); + + void set_value(float value); + void set_range(float min, float max); + + void update_range(); + void update_value_from_slider(); + void update_value_from_spinner(); + + void menu_properties(); + + bool slider_pressed(GdkEvent* ev); + + bool _enabled; + + Gtk::Label* _name_label; + Gtk::SpinButton* _value_spinner; + Gtk::HScale* _slider; + + Gtk::Menu* _menu; + Gtk::MenuItem* _menu_properties; +}; + + +#if 0 + +/** A spinbutton for integer controls. + * + * \ingroup GUI + */ +class IntegerControlGroup : public ControlGroup +{ +public: + IntegerControlGroup(ControlPanel* panel, SharedPtr pm); + + void enable(); + void disable(); + +private: + void set_name(const string& name); + void set_value(float val); + + void update_value(); + + bool _enable_signal; + Gtk::Alignment _alignment; + Gtk::Label _name_label; + Gtk::SpinButton _spinner; +}; + + +/** A radio button for toggle controls. + * + * \ingroup GUI + */ +class ToggleControlGroup : public ControlGroup +{ +public: + ToggleControlGroup(ControlPanel* panel, SharedPtr pm); + + void enable(); + void disable(); + +private: + void set_name(const string& name); + void set_value(float val); + + void update_value(); + + bool _enable_signal; + Gtk::Alignment _alignment; + Gtk::Label _name_label; + Gtk::CheckButton _checkbutton; +}; +#endif + +} // namespace GUI +} // namespace Ingen + +#endif // CONTROLGROUPS_H diff --git a/src/libs/gui/ControlPanel.cpp b/src/libs/gui/ControlPanel.cpp index 70ab273e..0fb3dfb8 100644 --- a/src/libs/gui/ControlPanel.cpp +++ b/src/libs/gui/ControlPanel.cpp @@ -15,15 +15,15 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "interface/EngineInterface.h" -#include "client/PatchModel.h" -#include "client/NodeModel.h" -#include "client/PortModel.h" -#include "client/PluginModel.h" -#include "App.h" -#include "ControlPanel.h" -#include "ControlGroups.h" -#include "GladeFactory.h" +#include "interface/EngineInterface.hpp" +#include "client/PatchModel.hpp" +#include "client/NodeModel.hpp" +#include "client/PortModel.hpp" +#include "client/PluginModel.hpp" +#include "App.hpp" +#include "ControlPanel.hpp" +#include "ControlGroups.hpp" +#include "GladeFactory.hpp" namespace Ingen { namespace GUI { diff --git a/src/libs/gui/ControlPanel.h b/src/libs/gui/ControlPanel.h deleted file mode 100644 index 230b9b65..00000000 --- a/src/libs/gui/ControlPanel.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 CONTROLPANEL_H -#define CONTROLPANEL_H - -#include -#include -#include -#include // for pair<> -#include -#include -#include -#include -#include -#include "ControlGroups.h" - - -using std::vector; using std::string; using std::pair; -using std::cerr; using std::cout; using std::endl; - -namespace Ingen { namespace Client { - class PortModel; - class NodeModel; -} } -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - - -/** A group of controls for a node (or patch). - * - * Used by both NodeControlWindow and the main window (for patch controls). - * - * \ingroup GUI - */ -class ControlPanel : public Gtk::HBox { -public: - ControlPanel(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); - virtual ~ControlPanel(); - - void init(SharedPtr node, size_t poly); - - ControlGroup* find_port(const Path& path) const; - - void add_port(SharedPtr port); - void remove_port(const Path& path); - - void enable_port(const Path& path); - void disable_port(const Path& path); - - size_t num_controls() const { return _controls.size(); } - pair ideal_size() const { return _ideal_size; } - - // Callback for ControlGroup - void value_changed(SharedPtr port_path, float val); - -private: - void all_voices_selected(); - void specific_voice_selected(); - void voice_selected(); - - bool _callback_enabled; - - pair _ideal_size; - - vector _controls; - Gtk::VBox* _control_box; - Gtk::Box* _voice_control_box; - Gtk::RadioButton* _all_voices_radio; - Gtk::RadioButton* _specific_voice_radio; - Gtk::SpinButton* _voice_spinbutton; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // CONTROLPANEL_H diff --git a/src/libs/gui/ControlPanel.hpp b/src/libs/gui/ControlPanel.hpp new file mode 100644 index 00000000..70ae4e95 --- /dev/null +++ b/src/libs/gui/ControlPanel.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 CONTROLPANEL_H +#define CONTROLPANEL_H + +#include +#include +#include +#include // for pair<> +#include +#include +#include +#include +#include +#include "ControlGroups.hpp" + + +using std::vector; using std::string; using std::pair; +using std::cerr; using std::cout; using std::endl; + +namespace Ingen { namespace Client { + class PortModel; + class NodeModel; +} } +using namespace Ingen::Client; + +namespace Ingen { +namespace GUI { + + +/** A group of controls for a node (or patch). + * + * Used by both NodeControlWindow and the main window (for patch controls). + * + * \ingroup GUI + */ +class ControlPanel : public Gtk::HBox { +public: + ControlPanel(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); + virtual ~ControlPanel(); + + void init(SharedPtr node, size_t poly); + + ControlGroup* find_port(const Path& path) const; + + void add_port(SharedPtr port); + void remove_port(const Path& path); + + void enable_port(const Path& path); + void disable_port(const Path& path); + + size_t num_controls() const { return _controls.size(); } + pair ideal_size() const { return _ideal_size; } + + // Callback for ControlGroup + void value_changed(SharedPtr port_path, float val); + +private: + void all_voices_selected(); + void specific_voice_selected(); + void voice_selected(); + + bool _callback_enabled; + + pair _ideal_size; + + vector _controls; + Gtk::VBox* _control_box; + Gtk::Box* _voice_control_box; + Gtk::RadioButton* _all_voices_radio; + Gtk::RadioButton* _specific_voice_radio; + Gtk::SpinButton* _voice_spinbutton; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // CONTROLPANEL_H diff --git a/src/libs/gui/DSSIController.cpp b/src/libs/gui/DSSIController.cpp index f245d61f..b5537f82 100644 --- a/src/libs/gui/DSSIController.cpp +++ b/src/libs/gui/DSSIController.cpp @@ -15,16 +15,16 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DSSIController.h" +#include "DSSIController.hpp" #include #include #include #include #include -#include "interface/EngineInterface.h" -#include "client/NodeModel.h" -#include "App.h" -#include "DSSIModule.h" +#include "interface/EngineInterface.hpp" +#include "client/NodeModel.hpp" +#include "App.hpp" +#include "DSSIModule.hpp" namespace Ingen { namespace GUI { diff --git a/src/libs/gui/DSSIController.h b/src/libs/gui/DSSIController.h deleted file mode 100644 index fdb0c1c0..00000000 --- a/src/libs/gui/DSSIController.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 DSSICONTROLLER_H -#define DSSICONTROLLER_H - -#include -#include -#include -#include "client/NodeModel.h" - -using std::string; -using namespace Ingen::Client; - -namespace Ingen { namespace Client { - class MetadataModel; - class NodeModel; - class PortModel; -} } - -namespace Ingen { -namespace GUI { - -class NodeControlWindow; -class NodePropertiesWindow; - -/* Controller for a DSSI node. - * - * FIXME: legacy cruft. move this code to the appropriate places and nuke - * this class. - * - * \ingroup GUI - */ -class DSSIController -{ -public: - DSSIController(SharedPtr model); - - virtual ~DSSIController() {} - - void show_gui(); - bool attempt_to_show_gui(); - void program_add(int bank, int program, const string& name); - void program_remove(int bank, int program); - - void send_program_change(int bank, int program); - - void show_menu(GdkEventButton* event); - -private: - void update_program_menu(); - - Gtk::Menu _program_menu; - Glib::RefPtr _program_menu_item; - - bool _banks_dirty; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // DSSICONTROLLER_H diff --git a/src/libs/gui/DSSIController.hpp b/src/libs/gui/DSSIController.hpp new file mode 100644 index 00000000..0d7073ea --- /dev/null +++ b/src/libs/gui/DSSIController.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 DSSICONTROLLER_H +#define DSSICONTROLLER_H + +#include +#include +#include +#include "client/NodeModel.hpp" + +using std::string; +using namespace Ingen::Client; + +namespace Ingen { namespace Client { + class MetadataModel; + class NodeModel; + class PortModel; +} } + +namespace Ingen { +namespace GUI { + +class NodeControlWindow; +class NodePropertiesWindow; + +/* Controller for a DSSI node. + * + * FIXME: legacy cruft. move this code to the appropriate places and nuke + * this class. + * + * \ingroup GUI + */ +class DSSIController +{ +public: + DSSIController(SharedPtr model); + + virtual ~DSSIController() {} + + void show_gui(); + bool attempt_to_show_gui(); + void program_add(int bank, int program, const string& name); + void program_remove(int bank, int program); + + void send_program_change(int bank, int program); + + void show_menu(GdkEventButton* event); + +private: + void update_program_menu(); + + Gtk::Menu _program_menu; + Glib::RefPtr _program_menu_item; + + bool _banks_dirty; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // DSSICONTROLLER_H diff --git a/src/libs/gui/DSSIModule.cpp b/src/libs/gui/DSSIModule.cpp index 57cbd03f..84058100 100644 --- a/src/libs/gui/DSSIModule.cpp +++ b/src/libs/gui/DSSIModule.cpp @@ -15,8 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DSSIModule.h" -#include "DSSIController.h" +#include "DSSIModule.hpp" +#include "DSSIController.hpp" namespace Ingen { namespace GUI { diff --git a/src/libs/gui/DSSIModule.h b/src/libs/gui/DSSIModule.h deleted file mode 100644 index 1c041900..00000000 --- a/src/libs/gui/DSSIModule.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 DSSIMODULE_H -#define DSSIMODULE_H - -#include "NodeModule.h" - -namespace Ingen { -namespace GUI { - -class DSSIController; - -/* Module for a DSSI node. - * - * \ingroup GUI - */ -class DSSIModule : public NodeModule -{ -public: - DSSIModule(boost::shared_ptr canvas, SharedPtr node); - virtual ~DSSIModule() {} - - void on_double_click(GdkEventButton* ev); -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // DSSIMODULE_H - diff --git a/src/libs/gui/DSSIModule.hpp b/src/libs/gui/DSSIModule.hpp new file mode 100644 index 00000000..76824bdc --- /dev/null +++ b/src/libs/gui/DSSIModule.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 DSSIMODULE_H +#define DSSIMODULE_H + +#include "NodeModule.hpp" + +namespace Ingen { +namespace GUI { + +class DSSIController; + +/* Module for a DSSI node. + * + * \ingroup GUI + */ +class DSSIModule : public NodeModule +{ +public: + DSSIModule(boost::shared_ptr canvas, SharedPtr node); + virtual ~DSSIModule() {} + + void on_double_click(GdkEventButton* ev); +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // DSSIMODULE_H + diff --git a/src/libs/gui/GladeFactory.cpp b/src/libs/gui/GladeFactory.cpp index 8b1f1e1f..de23a0b7 100644 --- a/src/libs/gui/GladeFactory.cpp +++ b/src/libs/gui/GladeFactory.cpp @@ -15,7 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "GladeFactory.h" +#include "GladeFactory.hpp" #include #include using std::cout; using std::cerr; using std::endl; diff --git a/src/libs/gui/GladeFactory.h b/src/libs/gui/GladeFactory.h deleted file mode 100644 index 0a2e88fc..00000000 --- a/src/libs/gui/GladeFactory.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 GLADEFACTORY_H -#define GLADEFACTORY_H - -#include -#include - -using std::string; - -namespace Ingen { -namespace GUI { - - -/** Creates glade references, so various objects can create widgets. - * Purely static. - * - * \ingroup GUI - */ -class GladeFactory { -public: - static Glib::RefPtr - new_glade_reference(const string& toplevel_widget = ""); - -private: - GladeFactory() {} - - static void find_glade_file(); - static Glib::ustring glade_filename; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // GLADEFACTORY_H diff --git a/src/libs/gui/GladeFactory.hpp b/src/libs/gui/GladeFactory.hpp new file mode 100644 index 00000000..0a2e88fc --- /dev/null +++ b/src/libs/gui/GladeFactory.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 GLADEFACTORY_H +#define GLADEFACTORY_H + +#include +#include + +using std::string; + +namespace Ingen { +namespace GUI { + + +/** Creates glade references, so various objects can create widgets. + * Purely static. + * + * \ingroup GUI + */ +class GladeFactory { +public: + static Glib::RefPtr + new_glade_reference(const string& toplevel_widget = ""); + +private: + GladeFactory() {} + + static void find_glade_file(); + static Glib::ustring glade_filename; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // GLADEFACTORY_H diff --git a/src/libs/gui/LashController.cpp b/src/libs/gui/LashController.cpp index b62ec818..8f288766 100644 --- a/src/libs/gui/LashController.cpp +++ b/src/libs/gui/LashController.cpp @@ -15,15 +15,15 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "LashController.h" -#include "config.h" +#include "LashController.hpp" +#include "../../../../config/config.hpp" #include #include #include #include #include -#include "App.h" -#include "PatchModel.h" +#include "App.hpp" +#include "PatchModel.hpp" using std::cerr; using std::cout; using std::endl; using std::string; diff --git a/src/libs/gui/LashController.h b/src/libs/gui/LashController.h deleted file mode 100644 index f47eb5e9..00000000 --- a/src/libs/gui/LashController.h +++ /dev/null @@ -1,56 +0,0 @@ -/* This file is part of IngenGtk. - * 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 LASHCONTROLLER_H -#define LASHCONTROLLER_H - -#include -#include -using std::string; - -namespace Ingen { -namespace GUI { - -class App; - -/* Old and unused LASH controller. - * - * \ingroup GUI - */ -class LashController -{ -public: - LashController(lash_args_t* args); - ~LashController(); - - bool enabled() { return lash_enabled(_client); } - void process_events(); - -private: - void save(const string& dir); - - lash_client_t* _client; - - void handle_event(lash_event_t* conf); - void handle_config(lash_config_t* conf); -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // LASHCONTROLLER_H diff --git a/src/libs/gui/LashController.hpp b/src/libs/gui/LashController.hpp new file mode 100644 index 00000000..f47eb5e9 --- /dev/null +++ b/src/libs/gui/LashController.hpp @@ -0,0 +1,56 @@ +/* This file is part of IngenGtk. + * 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 LASHCONTROLLER_H +#define LASHCONTROLLER_H + +#include +#include +using std::string; + +namespace Ingen { +namespace GUI { + +class App; + +/* Old and unused LASH controller. + * + * \ingroup GUI + */ +class LashController +{ +public: + LashController(lash_args_t* args); + ~LashController(); + + bool enabled() { return lash_enabled(_client); } + void process_events(); + +private: + void save(const string& dir); + + lash_client_t* _client; + + void handle_event(lash_event_t* conf); + void handle_config(lash_config_t* conf); +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // LASHCONTROLLER_H diff --git a/src/libs/gui/LoadPatchWindow.cpp b/src/libs/gui/LoadPatchWindow.cpp index faaa519a..d849c256 100644 --- a/src/libs/gui/LoadPatchWindow.cpp +++ b/src/libs/gui/LoadPatchWindow.cpp @@ -15,15 +15,15 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "LoadPatchWindow.h" +#include "LoadPatchWindow.hpp" #include #include #include -#include "interface/EngineInterface.h" -#include "client/PatchModel.h" -#include "App.h" -#include "Configuration.h" -#include "ThreadedLoader.h" +#include "interface/EngineInterface.hpp" +#include "client/PatchModel.hpp" +#include "App.hpp" +#include "Configuration.hpp" +#include "ThreadedLoader.hpp" using namespace Ingen::Serialisation; using boost::optional; diff --git a/src/libs/gui/LoadPatchWindow.h b/src/libs/gui/LoadPatchWindow.h deleted file mode 100644 index 47f0bc8f..00000000 --- a/src/libs/gui/LoadPatchWindow.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 LOADPATCHWINDOW_H -#define LOADPATCHWINDOW_H - -#include -#include -#include -#include "client/PluginModel.h" -#include "client/PatchModel.h" -using Ingen::Client::PatchModel; -using Ingen::Client::MetadataMap; - -namespace Ingen { -namespace GUI { - - -/** 'Load Patch' window. - * - * Loaded by glade as a derived object. Used for both "Import" and "Load" - * (e.g. Replace, clear-then-import) operations (the radio button state - * should be changed with the provided methods before presenting). - * - * This is not for loading subpatches. See @a LoadSubpatchWindow for that. - * - * \ingroup GUI - */ -class LoadPatchWindow : public Gtk::FileChooserDialog -{ -public: - LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void set_patch(SharedPtr patch); - - void set_replace() { _replace = true; } - void set_merge() { _replace = false; } - - void present(SharedPtr patch, MetadataMap data); - -protected: - void on_show(); - -private: - void poly_from_file_selected(); - void poly_from_user_selected(); - void ok_clicked(); - void cancel_clicked(); - - MetadataMap _initial_data; - - SharedPtr _patch; - bool _replace; - - Gtk::RadioButton* _poly_from_current_radio; - Gtk::RadioButton* _poly_from_file_radio; - Gtk::RadioButton* _poly_from_user_radio; - Gtk::SpinButton* _poly_spinbutton; - Gtk::Button* _ok_button; - Gtk::Button* _cancel_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // LOADPATCHWINDOW_H diff --git a/src/libs/gui/LoadPatchWindow.hpp b/src/libs/gui/LoadPatchWindow.hpp new file mode 100644 index 00000000..3524ce16 --- /dev/null +++ b/src/libs/gui/LoadPatchWindow.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 LOADPATCHWINDOW_H +#define LOADPATCHWINDOW_H + +#include +#include +#include +#include "client/PluginModel.hpp" +#include "client/PatchModel.hpp" +using Ingen::Client::PatchModel; +using Ingen::Client::MetadataMap; + +namespace Ingen { +namespace GUI { + + +/** 'Load Patch' window. + * + * Loaded by glade as a derived object. Used for both "Import" and "Load" + * (e.g. Replace, clear-then-import) operations (the radio button state + * should be changed with the provided methods before presenting). + * + * This is not for loading subpatches. See @a LoadSubpatchWindow for that. + * + * \ingroup GUI + */ +class LoadPatchWindow : public Gtk::FileChooserDialog +{ +public: + LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); + + void set_patch(SharedPtr patch); + + void set_replace() { _replace = true; } + void set_merge() { _replace = false; } + + void present(SharedPtr patch, MetadataMap data); + +protected: + void on_show(); + +private: + void poly_from_file_selected(); + void poly_from_user_selected(); + void ok_clicked(); + void cancel_clicked(); + + MetadataMap _initial_data; + + SharedPtr _patch; + bool _replace; + + Gtk::RadioButton* _poly_from_current_radio; + Gtk::RadioButton* _poly_from_file_radio; + Gtk::RadioButton* _poly_from_user_radio; + Gtk::SpinButton* _poly_spinbutton; + Gtk::Button* _ok_button; + Gtk::Button* _cancel_button; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // LOADPATCHWINDOW_H diff --git a/src/libs/gui/LoadPluginWindow.cpp b/src/libs/gui/LoadPluginWindow.cpp index a4b24e5f..cc7c7e71 100644 --- a/src/libs/gui/LoadPluginWindow.cpp +++ b/src/libs/gui/LoadPluginWindow.cpp @@ -19,15 +19,15 @@ #include #include #include -#include "interface/EngineInterface.h" -#include "client/NodeModel.h" -#include "client/PatchModel.h" -#include "client/Store.h" -#include "App.h" -#include "LoadPluginWindow.h" -#include "PatchWindow.h" -#include "PatchView.h" -#include "PatchCanvas.h" +#include "interface/EngineInterface.hpp" +#include "client/NodeModel.hpp" +#include "client/PatchModel.hpp" +#include "client/Store.hpp" +#include "App.hpp" +#include "LoadPluginWindow.hpp" +#include "PatchWindow.hpp" +#include "PatchView.hpp" +#include "PatchCanvas.hpp" using std::cout; using std::cerr; using std::endl; diff --git a/src/libs/gui/LoadPluginWindow.h b/src/libs/gui/LoadPluginWindow.h deleted file mode 100644 index 1b39d314..00000000 --- a/src/libs/gui/LoadPluginWindow.h +++ /dev/null @@ -1,151 +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 LOADPLUGINWINDOW_H -#define LOADPLUGINWINDOW_H - -#include -#include -#include -#include -#include -#include "client/PatchModel.h" -#include "client/PluginModel.h" -using Ingen::Client::PluginModel; -using Ingen::Client::PatchModel; -using Ingen::Client::MetadataMap; - -namespace Ingen { -namespace GUI { - - -// Gtkmm _really_ needs to add some helper to abstract away this stupid nonsense - -/** Columns for the plugin list in the load plugin window. - * - * \ingroup GUI - */ -class ModelColumns : public Gtk::TreeModel::ColumnRecord -{ -public: - ModelColumns() { - add(_col_name); - add(_col_type); - add(_col_uri); - add(_col_label); - //add(_col_library); - //add(_col_label); - add(_col_plugin_model); - } - - Gtk::TreeModelColumn _col_name; - Gtk::TreeModelColumn _col_type; - Gtk::TreeModelColumn _col_uri; - - // Not displayed: - Gtk::TreeModelColumn _col_label; - Gtk::TreeModelColumn > _col_plugin_model; -}; - - -/** Column for the criteria combo box in the load plugin window. - * - * \ingroup GUI - */ -class CriteriaColumns : public Gtk::TreeModel::ColumnRecord -{ -public: - enum Criteria { NAME, TYPE, URI, }; - - CriteriaColumns() { add(_col_label); add(_col_criteria); } - - Gtk::TreeModelColumn _col_label; - Gtk::TreeModelColumn _col_criteria; -}; - - -/** 'Load Plugin' window. - * - * Loaded by glade as a derived object. - * - * \ingroup GUI - */ -class LoadPluginWindow : public Gtk::Window -{ -public: - LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void set_patch(SharedPtr patch); - void set_plugin_list(const std::map >& m); - - void add_plugin(SharedPtr plugin); - bool has_shown() const { return _has_shown; } - - void present(SharedPtr patch, MetadataMap data); - -protected: - void on_show(); - bool on_key_press_event(GdkEventKey* event); - -private: - void add_clicked(); - //void close_clicked(); - //void ok_clicked(); - void filter_changed(); - void clear_clicked(); - void name_changed(); - - int plugin_compare(const Gtk::TreeModel::iterator& a, - const Gtk::TreeModel::iterator& b); - - void plugin_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col); - void plugin_selection_changed(); - string generate_module_name(int offset = 0); - - MetadataMap _initial_data; - - SharedPtr _patch; - - bool _has_shown; // plugin list only populated on show to speed patch window creation - - Glib::RefPtr _plugins_liststore; - ModelColumns _plugins_columns; - - Glib::RefPtr _criteria_liststore; - CriteriaColumns _criteria_columns; - - Glib::RefPtr _selection; - - int _plugin_name_offset; // see comments for generate_plugin_name - - Gtk::TreeView* _plugins_treeview; - Gtk::CheckButton* _polyphonic_checkbutton; - Gtk::Entry* _node_name_entry; - Gtk::Button* _clear_button; - Gtk::Button* _add_button; - //Gtk::Button* _close_button; - //Gtk::Button* _ok_button; - Gtk::ComboBox* _filter_combo; - Gtk::Entry* _search_entry; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // LOADPLUGINWINDOW_H diff --git a/src/libs/gui/LoadPluginWindow.hpp b/src/libs/gui/LoadPluginWindow.hpp new file mode 100644 index 00000000..ce8a331b --- /dev/null +++ b/src/libs/gui/LoadPluginWindow.hpp @@ -0,0 +1,151 @@ +/* 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 LOADPLUGINWINDOW_H +#define LOADPLUGINWINDOW_H + +#include +#include +#include +#include +#include +#include "client/PatchModel.hpp" +#include "client/PluginModel.hpp" +using Ingen::Client::PluginModel; +using Ingen::Client::PatchModel; +using Ingen::Client::MetadataMap; + +namespace Ingen { +namespace GUI { + + +// Gtkmm _really_ needs to add some helper to abstract away this stupid nonsense + +/** Columns for the plugin list in the load plugin window. + * + * \ingroup GUI + */ +class ModelColumns : public Gtk::TreeModel::ColumnRecord +{ +public: + ModelColumns() { + add(_col_name); + add(_col_type); + add(_col_uri); + add(_col_label); + //add(_col_library); + //add(_col_label); + add(_col_plugin_model); + } + + Gtk::TreeModelColumn _col_name; + Gtk::TreeModelColumn _col_type; + Gtk::TreeModelColumn _col_uri; + + // Not displayed: + Gtk::TreeModelColumn _col_label; + Gtk::TreeModelColumn > _col_plugin_model; +}; + + +/** Column for the criteria combo box in the load plugin window. + * + * \ingroup GUI + */ +class CriteriaColumns : public Gtk::TreeModel::ColumnRecord +{ +public: + enum Criteria { NAME, TYPE, URI, }; + + CriteriaColumns() { add(_col_label); add(_col_criteria); } + + Gtk::TreeModelColumn _col_label; + Gtk::TreeModelColumn _col_criteria; +}; + + +/** 'Load Plugin' window. + * + * Loaded by glade as a derived object. + * + * \ingroup GUI + */ +class LoadPluginWindow : public Gtk::Window +{ +public: + LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); + + void set_patch(SharedPtr patch); + void set_plugin_list(const std::map >& m); + + void add_plugin(SharedPtr plugin); + bool has_shown() const { return _has_shown; } + + void present(SharedPtr patch, MetadataMap data); + +protected: + void on_show(); + bool on_key_press_event(GdkEventKey* event); + +private: + void add_clicked(); + //void close_clicked(); + //void ok_clicked(); + void filter_changed(); + void clear_clicked(); + void name_changed(); + + int plugin_compare(const Gtk::TreeModel::iterator& a, + const Gtk::TreeModel::iterator& b); + + void plugin_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col); + void plugin_selection_changed(); + string generate_module_name(int offset = 0); + + MetadataMap _initial_data; + + SharedPtr _patch; + + bool _has_shown; // plugin list only populated on show to speed patch window creation + + Glib::RefPtr _plugins_liststore; + ModelColumns _plugins_columns; + + Glib::RefPtr _criteria_liststore; + CriteriaColumns _criteria_columns; + + Glib::RefPtr _selection; + + int _plugin_name_offset; // see comments for generate_plugin_name + + Gtk::TreeView* _plugins_treeview; + Gtk::CheckButton* _polyphonic_checkbutton; + Gtk::Entry* _node_name_entry; + Gtk::Button* _clear_button; + Gtk::Button* _add_button; + //Gtk::Button* _close_button; + //Gtk::Button* _ok_button; + Gtk::ComboBox* _filter_combo; + Gtk::Entry* _search_entry; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // LOADPLUGINWINDOW_H diff --git a/src/libs/gui/LoadRemotePatchWindow.cpp b/src/libs/gui/LoadRemotePatchWindow.cpp index 534a6949..096f6d61 100644 --- a/src/libs/gui/LoadRemotePatchWindow.cpp +++ b/src/libs/gui/LoadRemotePatchWindow.cpp @@ -15,16 +15,16 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "LoadRemotePatchWindow.h" +#include "LoadRemotePatchWindow.hpp" #include #include #include -#include -#include "interface/EngineInterface.h" -#include "client/PatchModel.h" -#include "App.h" -#include "Configuration.h" -#include "ThreadedLoader.h" +#include +#include "interface/EngineInterface.hpp" +#include "client/PatchModel.hpp" +#include "App.hpp" +#include "Configuration.hpp" +#include "ThreadedLoader.hpp" using boost::optional; using namespace Raul; diff --git a/src/libs/gui/LoadRemotePatchWindow.h b/src/libs/gui/LoadRemotePatchWindow.h deleted file mode 100644 index bbb3d93e..00000000 --- a/src/libs/gui/LoadRemotePatchWindow.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 LOADREMOTEPATCHWINDOW_H -#define LOADREMOTEPATCHWINDOW_H - -#include -#include -#include -#include "client/PatchModel.h" -#include "client/PluginModel.h" -using Ingen::Client::PatchModel; -using Ingen::Client::MetadataMap; - -namespace Ingen { -namespace GUI { - - -/** Columns for the remote patch list. - * - * \ingroup GUI - */ -class PatchColumns : public Gtk::TreeModel::ColumnRecord -{ -public: - PatchColumns() { - add(_col_name); - add(_col_uri); - } - - Gtk::TreeModelColumn _col_name; - Gtk::TreeModelColumn _col_uri; -}; - - - -/* Load remote patch ("import location") dialog. - * - * \ingroup GUI - */ -class LoadRemotePatchWindow : public Gtk::Dialog -{ -public: - LoadRemotePatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void set_patch(SharedPtr patch); - - void set_replace() { _replace = true; } - void set_merge() { _replace = false; } - - void present(SharedPtr patch, MetadataMap data); - -private: - void patch_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col); - void patch_selected(); - void uri_changed(); - void open_clicked(); - void cancel_clicked(); - - MetadataMap _initial_data; - - SharedPtr _patch; - bool _replace; - - Glib::RefPtr _selection; - Glib::RefPtr _liststore; - PatchColumns _columns; - - Gtk::TreeView* _treeview; - Gtk::Entry* _uri_entry; - Gtk::Button* _open_button; - Gtk::Button* _cancel_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // LOADREMOTEPATCHWINDOW_H diff --git a/src/libs/gui/LoadRemotePatchWindow.hpp b/src/libs/gui/LoadRemotePatchWindow.hpp new file mode 100644 index 00000000..2afef975 --- /dev/null +++ b/src/libs/gui/LoadRemotePatchWindow.hpp @@ -0,0 +1,93 @@ +/* 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 LOADREMOTEPATCHWINDOW_H +#define LOADREMOTEPATCHWINDOW_H + +#include +#include +#include +#include "client/PatchModel.hpp" +#include "client/PluginModel.hpp" +using Ingen::Client::PatchModel; +using Ingen::Client::MetadataMap; + +namespace Ingen { +namespace GUI { + + +/** Columns for the remote patch list. + * + * \ingroup GUI + */ +class PatchColumns : public Gtk::TreeModel::ColumnRecord +{ +public: + PatchColumns() { + add(_col_name); + add(_col_uri); + } + + Gtk::TreeModelColumn _col_name; + Gtk::TreeModelColumn _col_uri; +}; + + + +/* Load remote patch ("import location") dialog. + * + * \ingroup GUI + */ +class LoadRemotePatchWindow : public Gtk::Dialog +{ +public: + LoadRemotePatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); + + void set_patch(SharedPtr patch); + + void set_replace() { _replace = true; } + void set_merge() { _replace = false; } + + void present(SharedPtr patch, MetadataMap data); + +private: + void patch_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col); + void patch_selected(); + void uri_changed(); + void open_clicked(); + void cancel_clicked(); + + MetadataMap _initial_data; + + SharedPtr _patch; + bool _replace; + + Glib::RefPtr _selection; + Glib::RefPtr _liststore; + PatchColumns _columns; + + Gtk::TreeView* _treeview; + Gtk::Entry* _uri_entry; + Gtk::Button* _open_button; + Gtk::Button* _cancel_button; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // LOADREMOTEPATCHWINDOW_H diff --git a/src/libs/gui/LoadSubpatchWindow.cpp b/src/libs/gui/LoadSubpatchWindow.cpp index 57fa9adc..a2591b86 100644 --- a/src/libs/gui/LoadSubpatchWindow.cpp +++ b/src/libs/gui/LoadSubpatchWindow.cpp @@ -19,14 +19,14 @@ #include #include #include -#include "interface/EngineInterface.h" -#include "client/NodeModel.h" -#include "client/PatchModel.h" -#include "App.h" -#include "LoadSubpatchWindow.h" -#include "PatchView.h" -#include "Configuration.h" -#include "ThreadedLoader.h" +#include "interface/EngineInterface.hpp" +#include "client/NodeModel.hpp" +#include "client/PatchModel.hpp" +#include "App.hpp" +#include "LoadSubpatchWindow.hpp" +#include "PatchView.hpp" +#include "Configuration.hpp" +#include "ThreadedLoader.hpp" using boost::optional; namespace Ingen { diff --git a/src/libs/gui/LoadSubpatchWindow.h b/src/libs/gui/LoadSubpatchWindow.h deleted file mode 100644 index 08a6f7db..00000000 --- a/src/libs/gui/LoadSubpatchWindow.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 LOADSUBPATCHWINDOW_H -#define LOADSUBPATCHWINDOW_H - -#include -#include -#include -#include "client/PatchModel.h" -#include "client/PluginModel.h" -using Ingen::Client::PatchModel; -using Ingen::Client::MetadataMap; - -namespace Ingen { -namespace GUI { - - -/** 'Add Subpatch' window. - * - * Loaded by glade as a derived object. - * - * \ingroup GUI - */ -class LoadSubpatchWindow : public Gtk::FileChooserDialog -{ -public: - LoadSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void set_patch(SharedPtr patch); - - void present(SharedPtr patch, MetadataMap data); - -protected: - void on_show(); - -private: - void disable_name_entry(); - void enable_name_entry(); - void disable_poly_spinner(); - void enable_poly_spinner(); - - void ok_clicked(); - void cancel_clicked(); - - MetadataMap _initial_data; - - SharedPtr _patch; - - Gtk::RadioButton* _name_from_file_radio; - Gtk::RadioButton* _name_from_user_radio; - Gtk::Entry* _name_entry; - Gtk::RadioButton* _poly_from_file_radio; - Gtk::RadioButton* _poly_from_parent_radio; - Gtk::RadioButton* _poly_from_user_radio; - Gtk::SpinButton* _poly_spinbutton; - Gtk::Button* _ok_button; - Gtk::Button* _cancel_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // LOADSUBPATCHWINDOW_H diff --git a/src/libs/gui/LoadSubpatchWindow.hpp b/src/libs/gui/LoadSubpatchWindow.hpp new file mode 100644 index 00000000..01047a3e --- /dev/null +++ b/src/libs/gui/LoadSubpatchWindow.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 LOADSUBPATCHWINDOW_H +#define LOADSUBPATCHWINDOW_H + +#include +#include +#include +#include "client/PatchModel.hpp" +#include "client/PluginModel.hpp" +using Ingen::Client::PatchModel; +using Ingen::Client::MetadataMap; + +namespace Ingen { +namespace GUI { + + +/** 'Add Subpatch' window. + * + * Loaded by glade as a derived object. + * + * \ingroup GUI + */ +class LoadSubpatchWindow : public Gtk::FileChooserDialog +{ +public: + LoadSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); + + void set_patch(SharedPtr patch); + + void present(SharedPtr patch, MetadataMap data); + +protected: + void on_show(); + +private: + void disable_name_entry(); + void enable_name_entry(); + void disable_poly_spinner(); + void enable_poly_spinner(); + + void ok_clicked(); + void cancel_clicked(); + + MetadataMap _initial_data; + + SharedPtr _patch; + + Gtk::RadioButton* _name_from_file_radio; + Gtk::RadioButton* _name_from_user_radio; + Gtk::Entry* _name_entry; + Gtk::RadioButton* _poly_from_file_radio; + Gtk::RadioButton* _poly_from_parent_radio; + Gtk::RadioButton* _poly_from_user_radio; + Gtk::SpinButton* _poly_spinbutton; + Gtk::Button* _ok_button; + Gtk::Button* _cancel_button; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // LOADSUBPATCHWINDOW_H diff --git a/src/libs/gui/MessagesWindow.cpp b/src/libs/gui/MessagesWindow.cpp index b8a83c20..3da810f6 100644 --- a/src/libs/gui/MessagesWindow.cpp +++ b/src/libs/gui/MessagesWindow.cpp @@ -15,7 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "MessagesWindow.h" +#include "MessagesWindow.hpp" #include namespace Ingen { diff --git a/src/libs/gui/MessagesWindow.h b/src/libs/gui/MessagesWindow.h deleted file mode 100644 index dea0fdd4..00000000 --- a/src/libs/gui/MessagesWindow.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 MESSAGESWINDOW_H -#define MESSAGESWINDOW_H - -#include -#include -#include -using std::string; - - -namespace Ingen { -namespace GUI { - - -/** Messages Window. - * - * Loaded by libglade as a derived object. - * This is shown when errors occur (ie during patch loading). - * - * \ingroup GUI - */ -class MessagesWindow : public Gtk::Window -{ -public: - MessagesWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); - - void post(const string& str); - -private: - void clear_clicked(); - void close_clicked(); - - Gtk::TextView* _textview; - Gtk::Button* _clear_button; - Gtk::Button* _close_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // MESSAGESWINDOW_H diff --git a/src/libs/gui/MessagesWindow.hpp b/src/libs/gui/MessagesWindow.hpp new file mode 100644 index 00000000..dea0fdd4 --- /dev/null +++ b/src/libs/gui/MessagesWindow.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 MESSAGESWINDOW_H +#define MESSAGESWINDOW_H + +#include +#include +#include +using std::string; + + +namespace Ingen { +namespace GUI { + + +/** Messages Window. + * + * Loaded by libglade as a derived object. + * This is shown when errors occur (ie during patch loading). + * + * \ingroup GUI + */ +class MessagesWindow : public Gtk::Window +{ +public: + MessagesWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); + + void post(const string& str); + +private: + void clear_clicked(); + void close_clicked(); + + Gtk::TextView* _textview; + Gtk::Button* _clear_button; + Gtk::Button* _close_button; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // MESSAGESWINDOW_H diff --git a/src/libs/gui/NewSubpatchWindow.cpp b/src/libs/gui/NewSubpatchWindow.cpp index f0bc7caa..8b66b6c2 100644 --- a/src/libs/gui/NewSubpatchWindow.cpp +++ b/src/libs/gui/NewSubpatchWindow.cpp @@ -15,12 +15,12 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "App.h" -#include "interface/EngineInterface.h" -#include "client/NodeModel.h" -#include "client/PatchModel.h" -#include "NewSubpatchWindow.h" -#include "PatchView.h" +#include "App.hpp" +#include "interface/EngineInterface.hpp" +#include "client/NodeModel.hpp" +#include "client/PatchModel.hpp" +#include "NewSubpatchWindow.hpp" +#include "PatchView.hpp" namespace Ingen { namespace GUI { diff --git a/src/libs/gui/NewSubpatchWindow.h b/src/libs/gui/NewSubpatchWindow.h deleted file mode 100644 index e70b7f91..00000000 --- a/src/libs/gui/NewSubpatchWindow.h +++ /dev/null @@ -1,67 +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 NEWSUBPATCHWINDOW_H -#define NEWSUBPATCHWINDOW_H - -#include -#include -#include -#include "client/PatchModel.h" -#include "client/PluginModel.h" -using Ingen::Client::PatchModel; -using Ingen::Client::MetadataMap; - -namespace Ingen { -namespace GUI { - - -/** 'New Subpatch' window. - * - * Loaded by glade as a derived object. - * - * \ingroup GUI - */ -class NewSubpatchWindow : public Gtk::Window -{ -public: - NewSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void set_patch(SharedPtr patch); - - void present(SharedPtr patch, MetadataMap data); - -private: - void name_changed(); - void ok_clicked(); - void cancel_clicked(); - - MetadataMap _initial_data; - SharedPtr _patch; - - Gtk::Entry* _name_entry; - Gtk::Label* _message_label; - Gtk::SpinButton* _poly_spinbutton; - Gtk::Button* _ok_button; - Gtk::Button* _cancel_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // NEWSUBPATCHWINDOW_H diff --git a/src/libs/gui/NewSubpatchWindow.hpp b/src/libs/gui/NewSubpatchWindow.hpp new file mode 100644 index 00000000..d6ce65d7 --- /dev/null +++ b/src/libs/gui/NewSubpatchWindow.hpp @@ -0,0 +1,67 @@ +/* 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 NEWSUBPATCHWINDOW_H +#define NEWSUBPATCHWINDOW_H + +#include +#include +#include +#include "client/PatchModel.hpp" +#include "client/PluginModel.hpp" +using Ingen::Client::PatchModel; +using Ingen::Client::MetadataMap; + +namespace Ingen { +namespace GUI { + + +/** 'New Subpatch' window. + * + * Loaded by glade as a derived object. + * + * \ingroup GUI + */ +class NewSubpatchWindow : public Gtk::Window +{ +public: + NewSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); + + void set_patch(SharedPtr patch); + + void present(SharedPtr patch, MetadataMap data); + +private: + void name_changed(); + void ok_clicked(); + void cancel_clicked(); + + MetadataMap _initial_data; + SharedPtr _patch; + + Gtk::Entry* _name_entry; + Gtk::Label* _message_label; + Gtk::SpinButton* _poly_spinbutton; + Gtk::Button* _ok_button; + Gtk::Button* _cancel_button; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // NEWSUBPATCHWINDOW_H diff --git a/src/libs/gui/NodeControlWindow.cpp b/src/libs/gui/NodeControlWindow.cpp index 26108833..e5f25a1e 100644 --- a/src/libs/gui/NodeControlWindow.cpp +++ b/src/libs/gui/NodeControlWindow.cpp @@ -17,14 +17,14 @@ #include #include -#include "interface/EngineInterface.h" -#include "client/NodeModel.h" -#include "App.h" -#include "NodeControlWindow.h" -#include "GladeFactory.h" -#include "ControlGroups.h" -#include "ControlPanel.h" -#include "PatchWindow.h" +#include "interface/EngineInterface.hpp" +#include "client/NodeModel.hpp" +#include "App.hpp" +#include "NodeControlWindow.hpp" +#include "GladeFactory.hpp" +#include "ControlGroups.hpp" +#include "ControlPanel.hpp" +#include "PatchWindow.hpp" using namespace std; diff --git a/src/libs/gui/NodeControlWindow.h b/src/libs/gui/NodeControlWindow.h deleted file mode 100644 index bd6f9fc9..00000000 --- a/src/libs/gui/NodeControlWindow.h +++ /dev/null @@ -1,76 +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 NODECONTROLWINDOW_H -#define NODECONTROLWINDOW_H - -#include -#include -#include -#include -#include -#include -using std::string; using std::vector; - -namespace Ingen { namespace Client { - class NodeModel; -} } -using Ingen::Client::NodeModel; - -namespace Ingen { -namespace GUI { - -class ControlGroup; -class ControlPanel; - - -/** Window with controls (sliders) for all control-rate ports on a Node. - * - * \ingroup GUI - */ -class NodeControlWindow : public Gtk::Window -{ -public: - NodeControlWindow(SharedPtr node, size_t poly); - NodeControlWindow(SharedPtr node, ControlPanel* panel); - virtual ~NodeControlWindow(); - - SharedPtr node() { return _node; } - - ControlPanel* control_panel() const { return _control_panel; } - - void resize(); - -protected: - void on_show(); - void on_hide(); - -private: - SharedPtr _node; - ControlPanel* _control_panel; - bool _callback_enabled; - - bool _position_stored; - int _x; - int _y; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // NODECONTROLWINDOW_H diff --git a/src/libs/gui/NodeControlWindow.hpp b/src/libs/gui/NodeControlWindow.hpp new file mode 100644 index 00000000..b639474a --- /dev/null +++ b/src/libs/gui/NodeControlWindow.hpp @@ -0,0 +1,76 @@ +/* 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 NODECONTROLWINDOW_H +#define NODECONTROLWINDOW_H + +#include +#include +#include +#include +#include +#include +using std::string; using std::vector; + +namespace Ingen { namespace Client { + class NodeModel; +} } +using Ingen::Client::NodeModel; + +namespace Ingen { +namespace GUI { + +class ControlGroup; +class ControlPanel; + + +/** Window with controls (sliders) for all control-rate ports on a Node. + * + * \ingroup GUI + */ +class NodeControlWindow : public Gtk::Window +{ +public: + NodeControlWindow(SharedPtr node, size_t poly); + NodeControlWindow(SharedPtr node, ControlPanel* panel); + virtual ~NodeControlWindow(); + + SharedPtr node() { return _node; } + + ControlPanel* control_panel() const { return _control_panel; } + + void resize(); + +protected: + void on_show(); + void on_hide(); + +private: + SharedPtr _node; + ControlPanel* _control_panel; + bool _callback_enabled; + + bool _position_stored; + int _x; + int _y; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // NODECONTROLWINDOW_H diff --git a/src/libs/gui/NodeMenu.cpp b/src/libs/gui/NodeMenu.cpp index cf71989c..f65eb512 100644 --- a/src/libs/gui/NodeMenu.cpp +++ b/src/libs/gui/NodeMenu.cpp @@ -17,11 +17,11 @@ #include #include -#include "interface/EngineInterface.h" -#include "client/NodeModel.h" -#include "App.h" -#include "NodeMenu.h" -#include "WindowFactory.h" +#include "interface/EngineInterface.hpp" +#include "client/NodeModel.hpp" +#include "App.hpp" +#include "NodeMenu.hpp" +#include "WindowFactory.hpp" using std::cerr; using std::endl; diff --git a/src/libs/gui/NodeMenu.h b/src/libs/gui/NodeMenu.h deleted file mode 100644 index 65044608..00000000 --- a/src/libs/gui/NodeMenu.h +++ /dev/null @@ -1,78 +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 NODEMENU_H -#define NODEMENU_H - -#include -#include -#include -#include -#include "client/NodeModel.h" -using Ingen::Client::NodeModel; - -using std::string; - -namespace Ingen { -namespace GUI { - -class Controller; -class NodeControlWindow; -class NodePropertiesWindow; -class PatchCanvas; - -/** Controller for a Node. - * - * \ingroup GUI - */ -class NodeMenu : public Gtk::Menu -{ -public: - NodeMenu(SharedPtr node); - - void set_path(const Path& new_path); - - virtual void program_add(int bank, int program, const string& name) {} - virtual void program_remove(int bank, int program) {} - - bool has_control_inputs(); - - //virtual void show_menu(GdkEventButton* event) - //{ _menu.popup(event->button, event->time); } - -protected: - - virtual void enable_controls_menuitem(); - virtual void disable_controls_menuitem(); - - //virtual void add_port(SharedPtr pm); - - void on_menu_destroy(); - void on_menu_clone(); - void on_menu_learn(); - void on_menu_disconnect_all(); - - //Gtk::Menu _menu; - SharedPtr _node; - Glib::RefPtr _controls_menuitem; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // NODEMENU_H diff --git a/src/libs/gui/NodeMenu.hpp b/src/libs/gui/NodeMenu.hpp new file mode 100644 index 00000000..0290d861 --- /dev/null +++ b/src/libs/gui/NodeMenu.hpp @@ -0,0 +1,78 @@ +/* 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 NODEMENU_H +#define NODEMENU_H + +#include +#include +#include +#include +#include "client/NodeModel.hpp" +using Ingen::Client::NodeModel; + +using std::string; + +namespace Ingen { +namespace GUI { + +class Controller; +class NodeControlWindow; +class NodePropertiesWindow; +class PatchCanvas; + +/** Controller for a Node. + * + * \ingroup GUI + */ +class NodeMenu : public Gtk::Menu +{ +public: + NodeMenu(SharedPtr node); + + void set_path(const Path& new_path); + + virtual void program_add(int bank, int program, const string& name) {} + virtual void program_remove(int bank, int program) {} + + bool has_control_inputs(); + + //virtual void show_menu(GdkEventButton* event) + //{ _menu.popup(event->button, event->time); } + +protected: + + virtual void enable_controls_menuitem(); + virtual void disable_controls_menuitem(); + + //virtual void add_port(SharedPtr pm); + + void on_menu_destroy(); + void on_menu_clone(); + void on_menu_learn(); + void on_menu_disconnect_all(); + + //Gtk::Menu _menu; + SharedPtr _node; + Glib::RefPtr _controls_menuitem; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // NODEMENU_H diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp index 61c937a8..b7126dd7 100644 --- a/src/libs/gui/NodeModule.cpp +++ b/src/libs/gui/NodeModule.cpp @@ -16,20 +16,20 @@ */ #include -#include -#include "interface/EngineInterface.h" -#include "client/PatchModel.h" -#include "client/NodeModel.h" -#include "App.h" -#include "NodeModule.h" -#include "PatchCanvas.h" -#include "Port.h" -#include "GladeFactory.h" -#include "RenameWindow.h" -#include "PatchWindow.h" -#include "WindowFactory.h" -#include "SubpatchModule.h" -#include "NodeControlWindow.h" +#include +#include "interface/EngineInterface.hpp" +#include "client/PatchModel.hpp" +#include "client/NodeModel.hpp" +#include "App.hpp" +#include "NodeModule.hpp" +#include "PatchCanvas.hpp" +#include "Port.hpp" +#include "GladeFactory.hpp" +#include "RenameWindow.hpp" +#include "PatchWindow.hpp" +#include "WindowFactory.hpp" +#include "SubpatchModule.hpp" +#include "NodeControlWindow.hpp" namespace Ingen { namespace GUI { diff --git a/src/libs/gui/NodeModule.h b/src/libs/gui/NodeModule.h deleted file mode 100644 index 66a46503..00000000 --- a/src/libs/gui/NodeModule.h +++ /dev/null @@ -1,90 +0,0 @@ -/* This file is part of In* 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 NODEMODULE_H -#define NODEMODULE_H - -#include -#include -#include -#include -#include "Port.h" -#include "NodeMenu.h" -using std::string; - -class Atom; - -namespace Ingen { namespace Client { - class PortModel; - class NodeModel; - class ControlModel; -} } -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - -class PatchCanvas; -class Port; - - -/** A module in a patch. - * - * This base class is extended for various types of modules - SubpatchModule, - * DSSIModule, etc. - * - * \ingroup GUI - */ -class NodeModule : public FlowCanvas::Module -{ -public: - static boost::shared_ptr create (boost::shared_ptr canvas, SharedPtr node); - - virtual ~NodeModule(); - - boost::shared_ptr port(const string& port_name) { - return boost::dynamic_pointer_cast( - Module::get_port(port_name)); - } - - virtual void store_location(); - - void on_click(GdkEventButton* event); - - void show_control_window(); - - SharedPtr node() const { return _node; } - -protected: - NodeModule(boost::shared_ptr canvas, SharedPtr node); - - virtual void on_double_click(GdkEventButton* ev) { show_control_window(); } - virtual void on_middle_click(GdkEventButton* ev) { show_control_window(); } - - void metadata_update(const string& key, const Atom& value); - - void add_port(SharedPtr port, bool resize=true); - void remove_port(SharedPtr port); - - SharedPtr _node; - NodeMenu _menu; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // NODEMODULE_H diff --git a/src/libs/gui/NodeModule.hpp b/src/libs/gui/NodeModule.hpp new file mode 100644 index 00000000..b68d1143 --- /dev/null +++ b/src/libs/gui/NodeModule.hpp @@ -0,0 +1,90 @@ +/* This file is part of In* 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 NODEMODULE_H +#define NODEMODULE_H + +#include +#include +#include +#include +#include "Port.hpp" +#include "NodeMenu.hpp" +using std::string; + +class Atom; + +namespace Ingen { namespace Client { + class PortModel; + class NodeModel; + class ControlModel; +} } +using namespace Ingen::Client; + +namespace Ingen { +namespace GUI { + +class PatchCanvas; +class Port; + + +/** A module in a patch. + * + * This base class is extended for various types of modules - SubpatchModule, + * DSSIModule, etc. + * + * \ingroup GUI + */ +class NodeModule : public FlowCanvas::Module +{ +public: + static boost::shared_ptr create (boost::shared_ptr canvas, SharedPtr node); + + virtual ~NodeModule(); + + boost::shared_ptr port(const string& port_name) { + return boost::dynamic_pointer_cast( + Module::get_port(port_name)); + } + + virtual void store_location(); + + void on_click(GdkEventButton* event); + + void show_control_window(); + + SharedPtr node() const { return _node; } + +protected: + NodeModule(boost::shared_ptr canvas, SharedPtr node); + + virtual void on_double_click(GdkEventButton* ev) { show_control_window(); } + virtual void on_middle_click(GdkEventButton* ev) { show_control_window(); } + + void metadata_update(const string& key, const Atom& value); + + void add_port(SharedPtr port, bool resize=true); + void remove_port(SharedPtr port); + + SharedPtr _node; + NodeMenu _menu; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // NODEMODULE_H diff --git a/src/libs/gui/NodePropertiesWindow.cpp b/src/libs/gui/NodePropertiesWindow.cpp index 0cd59e80..a6fb46ee 100644 --- a/src/libs/gui/NodePropertiesWindow.cpp +++ b/src/libs/gui/NodePropertiesWindow.cpp @@ -17,9 +17,9 @@ #include #include -#include "client/NodeModel.h" -#include "client/PluginModel.h" -#include "NodePropertiesWindow.h" +#include "client/NodeModel.hpp" +#include "client/PluginModel.hpp" +#include "NodePropertiesWindow.hpp" namespace Ingen { namespace GUI { diff --git a/src/libs/gui/NodePropertiesWindow.h b/src/libs/gui/NodePropertiesWindow.h deleted file mode 100644 index 057de4ec..00000000 --- a/src/libs/gui/NodePropertiesWindow.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 NODEPROPERTIESWINDOW_H -#define NODEPROPERTIESWINDOW_H - -#include -#include -#include -#include "client/NodeModel.h" -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - - -/** Node properties window. - * - * Loaded by libglade as a derived object. - * - * \ingroup GUI - */ -class NodePropertiesWindow : public Gtk::Window -{ -public: - NodePropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); - - void present(SharedPtr node_model) { set_node(node_model); Gtk::Window::present(); } - void set_node(SharedPtr node_model); - -private: - - SharedPtr _node_model; - Gtk::Label* _node_path_label; - Gtk::CheckButton* _node_polyphonic_toggle; - Gtk::Label* _plugin_type_label; - Gtk::Label* _plugin_uri_label; - Gtk::Label* _plugin_name_label; -}; - -} // namespace GUI -} // namespace Ingen - -#endif // NODEPROPERTIESWINDOW_H diff --git a/src/libs/gui/NodePropertiesWindow.hpp b/src/libs/gui/NodePropertiesWindow.hpp new file mode 100644 index 00000000..248c8b42 --- /dev/null +++ b/src/libs/gui/NodePropertiesWindow.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 NODEPROPERTIESWINDOW_H +#define NODEPROPERTIESWINDOW_H + +#include +#include +#include +#include "client/NodeModel.hpp" +using namespace Ingen::Client; + +namespace Ingen { +namespace GUI { + + +/** Node properties window. + * + * Loaded by libglade as a derived object. + * + * \ingroup GUI + */ +class NodePropertiesWindow : public Gtk::Window +{ +public: + NodePropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); + + void present(SharedPtr node_model) { set_node(node_model); Gtk::Window::present(); } + void set_node(SharedPtr node_model); + +private: + + SharedPtr _node_model; + Gtk::Label* _node_path_label; + Gtk::CheckButton* _node_polyphonic_toggle; + Gtk::Label* _plugin_type_label; + Gtk::Label* _plugin_uri_label; + Gtk::Label* _plugin_name_label; +}; + +} // namespace GUI +} // namespace Ingen + +#endif // NODEPROPERTIESWINDOW_H diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index d08b7b86..ba7a58ce 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -15,28 +15,29 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "../../../../config/config.h" + #include -#include -#include "interface/EngineInterface.h" -#include "client/PluginModel.h" -#include "client/PatchModel.h" -#include "client/NodeModel.h" -#include "client/Store.h" -#include "client/Serializer.h" -#include "App.h" -#include "PatchCanvas.h" -#include "PatchWindow.h" -#include "PatchPortModule.h" -#include "LoadPluginWindow.h" -#include "LoadSubpatchWindow.h" -#include "NewSubpatchWindow.h" -#include "Port.h" -#include "Connection.h" -#include "NodeModule.h" -#include "SubpatchModule.h" -#include "GladeFactory.h" -#include "WindowFactory.h" -#include "config.h" +#include +#include "interface/EngineInterface.hpp" +#include "client/PluginModel.hpp" +#include "client/PatchModel.hpp" +#include "client/NodeModel.hpp" +#include "client/Store.hpp" +#include "client/Serializer.hpp" +#include "App.hpp" +#include "PatchCanvas.hpp" +#include "PatchWindow.hpp" +#include "PatchPortModule.hpp" +#include "LoadPluginWindow.hpp" +#include "LoadSubpatchWindow.hpp" +#include "NewSubpatchWindow.hpp" +#include "Port.hpp" +#include "Connection.hpp" +#include "NodeModule.hpp" +#include "SubpatchModule.hpp" +#include "GladeFactory.hpp" +#include "WindowFactory.hpp" using Ingen::Client::Store; using Ingen::Client::Serializer; using Ingen::Client::PluginModel; diff --git a/src/libs/gui/PatchCanvas.h b/src/libs/gui/PatchCanvas.h deleted file mode 100644 index 1cf9f410..00000000 --- a/src/libs/gui/PatchCanvas.h +++ /dev/null @@ -1,131 +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 PATCHCANVAS_H -#define PATCHCANVAS_H - -#include -#include -#include -#include -#include -#include -#include -#include "client/ConnectionModel.h" -#include "client/PatchModel.h" -#include "NodeModule.h" - -using std::string; -using namespace FlowCanvas; - -using FlowCanvas::Port; -using Ingen::Client::ConnectionModel; -using Ingen::Client::PatchModel; -using Ingen::Client::NodeModel; -using Ingen::Client::PortModel; -using Ingen::Client::MetadataMap; - -namespace Ingen { -namespace GUI { - -class NodeModule; - - -/** Patch canvas widget. - * - * \ingroup GUI - */ -class PatchCanvas : public FlowCanvas::Canvas -{ -public: - PatchCanvas(SharedPtr patch, int width, int height); - - virtual ~PatchCanvas() {} - - /*boost::shared_ptr find_module(const string& name) { - return boost::dynamic_pointer_cast( - Canvas::get_item(name)); - }*/ - - void build(); - void arrange(); - - void add_node(SharedPtr nm); - void remove_node(SharedPtr nm); - void add_port(SharedPtr pm); - void remove_port(SharedPtr pm); - void connection(SharedPtr cm); - void disconnection(SharedPtr cm); - - void get_new_module_location(double& x, double& y); - - void destroy_selection(); - void copy_selection(); - - void show_menu(GdkEvent* event) - { _menu->popup(event->button.button, event->button.time); } - -private: - string generate_port_name(const string& base); - void menu_add_port(const string& name, const string& type, bool is_output); - void menu_load_plugin(); - void menu_new_patch(); - void menu_load_patch(); - void load_plugin(SharedPtr plugin); - void build_plugin_menu(); - size_t build_plugin_class_menu(Gtk::Menu* menu, - SLV2PluginClass plugin_class, SLV2PluginClasses classes); - - MetadataMap get_initial_data(); - - bool canvas_event(GdkEvent* event); - - SharedPtr get_port_view(SharedPtr port); - - void connect(boost::shared_ptr src, - boost::shared_ptr dst); - - void disconnect(boost::shared_ptr src, - boost::shared_ptr dst); - - SharedPtr _patch; - - typedef std::map, SharedPtr > Views; - Views _views; - - int _last_click_x; - int _last_click_y; - - Gtk::Menu* _menu; - Gtk::MenuItem* _menu_add_audio_input; - Gtk::MenuItem* _menu_add_audio_output; - Gtk::MenuItem* _menu_add_control_input; - Gtk::MenuItem* _menu_add_control_output; - Gtk::MenuItem* _menu_add_midi_input; - Gtk::MenuItem* _menu_add_midi_output; - Gtk::MenuItem* _menu_add_osc_input; - Gtk::MenuItem* _menu_add_osc_output; - Gtk::MenuItem* _menu_load_plugin; - Gtk::MenuItem* _menu_load_patch; - Gtk::MenuItem* _menu_new_patch; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // PATCHCANVAS_H diff --git a/src/libs/gui/PatchCanvas.hpp b/src/libs/gui/PatchCanvas.hpp new file mode 100644 index 00000000..06126334 --- /dev/null +++ b/src/libs/gui/PatchCanvas.hpp @@ -0,0 +1,131 @@ +/* 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 PATCHCANVAS_H +#define PATCHCANVAS_H + +#include +#include +#include +#include +#include +#include +#include +#include "client/ConnectionModel.hpp" +#include "client/PatchModel.hpp" +#include "NodeModule.hpp" + +using std::string; +using namespace FlowCanvas; + +using FlowCanvas::Port; +using Ingen::Client::ConnectionModel; +using Ingen::Client::PatchModel; +using Ingen::Client::NodeModel; +using Ingen::Client::PortModel; +using Ingen::Client::MetadataMap; + +namespace Ingen { +namespace GUI { + +class NodeModule; + + +/** Patch canvas widget. + * + * \ingroup GUI + */ +class PatchCanvas : public FlowCanvas::Canvas +{ +public: + PatchCanvas(SharedPtr patch, int width, int height); + + virtual ~PatchCanvas() {} + + /*boost::shared_ptr find_module(const string& name) { + return boost::dynamic_pointer_cast( + Canvas::get_item(name)); + }*/ + + void build(); + void arrange(); + + void add_node(SharedPtr nm); + void remove_node(SharedPtr nm); + void add_port(SharedPtr pm); + void remove_port(SharedPtr pm); + void connection(SharedPtr cm); + void disconnection(SharedPtr cm); + + void get_new_module_location(double& x, double& y); + + void destroy_selection(); + void copy_selection(); + + void show_menu(GdkEvent* event) + { _menu->popup(event->button.button, event->button.time); } + +private: + string generate_port_name(const string& base); + void menu_add_port(const string& name, const string& type, bool is_output); + void menu_load_plugin(); + void menu_new_patch(); + void menu_load_patch(); + void load_plugin(SharedPtr plugin); + void build_plugin_menu(); + size_t build_plugin_class_menu(Gtk::Menu* menu, + SLV2PluginClass plugin_class, SLV2PluginClasses classes); + + MetadataMap get_initial_data(); + + bool canvas_event(GdkEvent* event); + + SharedPtr get_port_view(SharedPtr port); + + void connect(boost::shared_ptr src, + boost::shared_ptr dst); + + void disconnect(boost::shared_ptr src, + boost::shared_ptr dst); + + SharedPtr _patch; + + typedef std::map, SharedPtr > Views; + Views _views; + + int _last_click_x; + int _last_click_y; + + Gtk::Menu* _menu; + Gtk::MenuItem* _menu_add_audio_input; + Gtk::MenuItem* _menu_add_audio_output; + Gtk::MenuItem* _menu_add_control_input; + Gtk::MenuItem* _menu_add_control_output; + Gtk::MenuItem* _menu_add_midi_input; + Gtk::MenuItem* _menu_add_midi_output; + Gtk::MenuItem* _menu_add_osc_input; + Gtk::MenuItem* _menu_add_osc_output; + Gtk::MenuItem* _menu_load_plugin; + Gtk::MenuItem* _menu_load_patch; + Gtk::MenuItem* _menu_new_patch; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // PATCHCANVAS_H diff --git a/src/libs/gui/PatchPortModule.cpp b/src/libs/gui/PatchPortModule.cpp index 6f309324..1d566741 100644 --- a/src/libs/gui/PatchPortModule.cpp +++ b/src/libs/gui/PatchPortModule.cpp @@ -15,17 +15,17 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "PatchPortModule.h" +#include "PatchPortModule.hpp" #include -#include "interface/EngineInterface.h" -#include "client/PatchModel.h" -#include "client/NodeModel.h" -#include "App.h" -#include "PatchCanvas.h" -#include "Port.h" -#include "GladeFactory.h" -#include "RenameWindow.h" -#include "PatchWindow.h" +#include "interface/EngineInterface.hpp" +#include "client/PatchModel.hpp" +#include "client/NodeModel.hpp" +#include "App.hpp" +#include "PatchCanvas.hpp" +#include "Port.hpp" +#include "GladeFactory.hpp" +#include "RenameWindow.hpp" +#include "PatchWindow.hpp" namespace Ingen { namespace GUI { diff --git a/src/libs/gui/PatchPortModule.h b/src/libs/gui/PatchPortModule.h deleted file mode 100644 index 81bc7b53..00000000 --- a/src/libs/gui/PatchPortModule.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 PATCHPORTMODULE_H -#define PATCHPORTMODULE_H - -#include -#include -#include -#include -#include -#include "Port.h" -using std::string; - -namespace Ingen { namespace Client { - class PortModel; - class NodeModel; - class ControlModel; -} } -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - -class PatchCanvas; -class Port; - - -/** A "module" to represent a patch's port on it's own canvas. - * - * Translation: This is the nameless single port pseudo module thingy. - * - * \ingroup GUI - */ -class PatchPortModule : public FlowCanvas::Module -{ -public: - static boost::shared_ptr create(boost::shared_ptr canvas, - SharedPtr port); - - virtual ~PatchPortModule() {} - - virtual void store_location(); - - //void on_right_click(GdkEventButton* event) { _port->show_menu(event); } - - SharedPtr port() const { return _port; } - -protected: - PatchPortModule(boost::shared_ptr canvas, SharedPtr port); - - //virtual void on_double_click(GdkEventButton* ev) { show_control_window(); } - //virtual void on_middle_click(GdkEventButton* ev) { show_control_window(); } - - void metadata_update(const string& key, const Raul::Atom& value); - - SharedPtr _port; - boost::shared_ptr _patch_port; ///< Port on this 'anonymous' module -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // PATCHPORTMODULE_H diff --git a/src/libs/gui/PatchPortModule.hpp b/src/libs/gui/PatchPortModule.hpp new file mode 100644 index 00000000..ceac4954 --- /dev/null +++ b/src/libs/gui/PatchPortModule.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 PATCHPORTMODULE_H +#define PATCHPORTMODULE_H + +#include +#include +#include +#include +#include +#include "Port.hpp" +using std::string; + +namespace Ingen { namespace Client { + class PortModel; + class NodeModel; + class ControlModel; +} } +using namespace Ingen::Client; + +namespace Ingen { +namespace GUI { + +class PatchCanvas; +class Port; + + +/** A "module" to represent a patch's port on it's own canvas. + * + * Translation: This is the nameless single port pseudo module thingy. + * + * \ingroup GUI + */ +class PatchPortModule : public FlowCanvas::Module +{ +public: + static boost::shared_ptr create(boost::shared_ptr canvas, + SharedPtr port); + + virtual ~PatchPortModule() {} + + virtual void store_location(); + + //void on_right_click(GdkEventButton* event) { _port->show_menu(event); } + + SharedPtr port() const { return _port; } + +protected: + PatchPortModule(boost::shared_ptr canvas, SharedPtr port); + + //virtual void on_double_click(GdkEventButton* ev) { show_control_window(); } + //virtual void on_middle_click(GdkEventButton* ev) { show_control_window(); } + + void metadata_update(const string& key, const Raul::Atom& value); + + SharedPtr _port; + boost::shared_ptr _patch_port; ///< Port on this 'anonymous' module +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // PATCHPORTMODULE_H diff --git a/src/libs/gui/PatchPropertiesWindow.cpp b/src/libs/gui/PatchPropertiesWindow.cpp index 1e310f0b..eb5120c4 100644 --- a/src/libs/gui/PatchPropertiesWindow.cpp +++ b/src/libs/gui/PatchPropertiesWindow.cpp @@ -16,8 +16,8 @@ */ #include -#include "client/PatchModel.h" -#include "PatchPropertiesWindow.h" +#include "client/PatchModel.hpp" +#include "PatchPropertiesWindow.hpp" namespace Ingen { namespace GUI { diff --git a/src/libs/gui/PatchPropertiesWindow.h b/src/libs/gui/PatchPropertiesWindow.h deleted file mode 100644 index 0640a198..00000000 --- a/src/libs/gui/PatchPropertiesWindow.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 PATCHPROPERTIESWINDOW_H -#define PATCHPROPERTIESWINDOW_H - -#include -#include -#include -#include -using std::string; - -namespace Ingen { namespace Client { class PatchModel; } } -using Ingen::Client::PatchModel; - -namespace Ingen { -namespace GUI { - - -/** Patch Properties Window. - * - * Loaded by libglade as a derived object. - * - * \ingroup GUI - */ -class PatchPropertiesWindow : public Gtk::Window -{ -public: - PatchPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); - - void present(SharedPtr patch_model) { set_patch(patch_model); Gtk::Window::present(); } - void set_patch(SharedPtr patch_model); - - void cancel_clicked(); - void ok_clicked(); - -private: - SharedPtr _patch_model; - - Gtk::Entry* _author_entry; - Gtk::TextView* _textview; - Gtk::Button* _cancel_button; - Gtk::Button* _ok_button; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // PATCHPROPERTIESWINDOW_H diff --git a/src/libs/gui/PatchPropertiesWindow.hpp b/src/libs/gui/PatchPropertiesWindow.hpp new file mode 100644 index 00000000..0f60b147 --- /dev/null +++ b/src/libs/gui/PatchPropertiesWindow.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 PATCHPROPERTIESWINDOW_H +#define PATCHPROPERTIESWINDOW_H + +#include +#include +#include +#include +using std::string; + +namespace Ingen { namespace Client { class PatchModel; } } +using Ingen::Client::PatchModel; + +namespace Ingen { +namespace GUI { + + +/** Patch Properties Window. + * + * Loaded by libglade as a derived object. + * + * \ingroup GUI + */ +class PatchPropertiesWindow : public Gtk::Window +{ +public: + PatchPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); + + void present(SharedPtr patch_model) { set_patch(patch_model); Gtk::Window::present(); } + void set_patch(SharedPtr patch_model); + + void cancel_clicked(); + void ok_clicked(); + +private: + SharedPtr _patch_model; + + Gtk::Entry* _author_entry; + Gtk::TextView* _textview; + Gtk::Button* _cancel_button; + Gtk::Button* _ok_button; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // PATCHPROPERTIESWINDOW_H diff --git a/src/libs/gui/PatchTreeWindow.cpp b/src/libs/gui/PatchTreeWindow.cpp index b77508c1..bdd293ac 100644 --- a/src/libs/gui/PatchTreeWindow.cpp +++ b/src/libs/gui/PatchTreeWindow.cpp @@ -15,15 +15,15 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include "interface/EngineInterface.h" -#include "client/OSCEngineSender.h" -#include "client/Store.h" -#include "client/PatchModel.h" -#include "App.h" -#include "PatchTreeWindow.h" -#include "SubpatchModule.h" -#include "WindowFactory.h" +#include +#include "interface/EngineInterface.hpp" +#include "client/OSCEngineSender.hpp" +#include "client/Store.hpp" +#include "client/PatchModel.hpp" +#include "App.hpp" +#include "PatchTreeWindow.hpp" +#include "SubpatchModule.hpp" +#include "WindowFactory.hpp" namespace Ingen { namespace GUI { diff --git a/src/libs/gui/PatchTreeWindow.h b/src/libs/gui/PatchTreeWindow.h deleted file mode 100644 index 9868d363..00000000 --- a/src/libs/gui/PatchTreeWindow.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 PATCHTREEWINDOW_H -#define PATCHTREEWINDOW_H - -#include -#include -#include - -namespace Ingen { namespace Client { - class Store; -} } -using Ingen::Client::Store; - -namespace Ingen { -namespace GUI { - -class PatchWindow; -class PatchTreeView; - - -/** Window with a TreeView of all loaded patches. - * - * \ingroup GUI - */ -class PatchTreeWindow : public Gtk::Window -{ -public: - PatchTreeWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); - - void init(Store& store); - - void new_object(SharedPtr object); - - void patch_enabled(const Path& path); - void patch_disabled(const Path& path); - void patch_renamed(const Path& old_path, const Path& new_path); - - void add_patch(SharedPtr pm); - void remove_patch(const Path& path); - void show_patch_menu(GdkEventButton* ev); - -protected: - //void event_patch_selected(); - void event_patch_activated(const Gtk::TreeModel::Path& path, Gtk::TreeView::Column* col); - void event_patch_enabled_toggled(const Glib::ustring& path_str); - - Gtk::TreeModel::iterator find_patch(Gtk::TreeModel::Children root, const Path& path); - - PatchTreeView* _patches_treeview; - - struct PatchTreeModelColumns : public Gtk::TreeModel::ColumnRecord - { - PatchTreeModelColumns() - { add(name_col); add(enabled_col); add(patch_model_col); } - - Gtk::TreeModelColumn name_col; - Gtk::TreeModelColumn enabled_col; - Gtk::TreeModelColumn > patch_model_col; - }; - - bool _enable_signal; - PatchTreeModelColumns _patch_tree_columns; - Glib::RefPtr _patch_treestore; - Glib::RefPtr _patch_tree_selection; -}; - - -/** Derived TreeView class to support context menus for patches */ -class PatchTreeView : public Gtk::TreeView -{ -public: - PatchTreeView(BaseObjectType* cobject, const Glib::RefPtr& xml) - : Gtk::TreeView(cobject) - {} - - void set_window(PatchTreeWindow* win) { _window = win; } - - bool on_button_press_event(GdkEventButton* ev) { - bool ret = Gtk::TreeView::on_button_press_event(ev); - - if ((ev->type == GDK_BUTTON_PRESS) && (ev->button == 3)) - _window->show_patch_menu(ev); - - return ret; - } - -private: - PatchTreeWindow* _window; - -}; // struct PatchTreeView - - -} // namespace GUI -} // namespace Ingen - -#endif // PATCHTREEWINDOW_H diff --git a/src/libs/gui/PatchTreeWindow.hpp b/src/libs/gui/PatchTreeWindow.hpp new file mode 100644 index 00000000..534f4607 --- /dev/null +++ b/src/libs/gui/PatchTreeWindow.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 PATCHTREEWINDOW_H +#define PATCHTREEWINDOW_H + +#include +#include +#include + +namespace Ingen { namespace Client { + class Store; +} } +using Ingen::Client::Store; + +namespace Ingen { +namespace GUI { + +class PatchWindow; +class PatchTreeView; + + +/** Window with a TreeView of all loaded patches. + * + * \ingroup GUI + */ +class PatchTreeWindow : public Gtk::Window +{ +public: + PatchTreeWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); + + void init(Store& store); + + void new_object(SharedPtr object); + + void patch_enabled(const Path& path); + void patch_disabled(const Path& path); + void patch_renamed(const Path& old_path, const Path& new_path); + + void add_patch(SharedPtr pm); + void remove_patch(const Path& path); + void show_patch_menu(GdkEventButton* ev); + +protected: + //void event_patch_selected(); + void event_patch_activated(const Gtk::TreeModel::Path& path, Gtk::TreeView::Column* col); + void event_patch_enabled_toggled(const Glib::ustring& path_str); + + Gtk::TreeModel::iterator find_patch(Gtk::TreeModel::Children root, const Path& path); + + PatchTreeView* _patches_treeview; + + struct PatchTreeModelColumns : public Gtk::TreeModel::ColumnRecord + { + PatchTreeModelColumns() + { add(name_col); add(enabled_col); add(patch_model_col); } + + Gtk::TreeModelColumn name_col; + Gtk::TreeModelColumn enabled_col; + Gtk::TreeModelColumn > patch_model_col; + }; + + bool _enable_signal; + PatchTreeModelColumns _patch_tree_columns; + Glib::RefPtr _patch_treestore; + Glib::RefPtr _patch_tree_selection; +}; + + +/** Derived TreeView class to support context menus for patches */ +class PatchTreeView : public Gtk::TreeView +{ +public: + PatchTreeView(BaseObjectType* cobject, const Glib::RefPtr& xml) + : Gtk::TreeView(cobject) + {} + + void set_window(PatchTreeWindow* win) { _window = win; } + + bool on_button_press_event(GdkEventButton* ev) { + bool ret = Gtk::TreeView::on_button_press_event(ev); + + if ((ev->type == GDK_BUTTON_PRESS) && (ev->button == 3)) + _window->show_patch_menu(ev); + + return ret; + } + +private: + PatchTreeWindow* _window; + +}; // struct PatchTreeView + + +} // namespace GUI +} // namespace Ingen + +#endif // PATCHTREEWINDOW_H diff --git a/src/libs/gui/PatchView.cpp b/src/libs/gui/PatchView.cpp index fa0d01a0..0246b98c 100644 --- a/src/libs/gui/PatchView.cpp +++ b/src/libs/gui/PatchView.cpp @@ -18,18 +18,18 @@ #include #include #include -#include "interface/EngineInterface.h" -#include "client/PatchModel.h" -#include "App.h" -#include "PatchView.h" -#include "PatchCanvas.h" -#include "LoadPluginWindow.h" -#include "NewSubpatchWindow.h" -#include "LoadSubpatchWindow.h" -#include "NodeControlWindow.h" -#include "PatchPropertiesWindow.h" -#include "PatchTreeWindow.h" -#include "GladeFactory.h" +#include "interface/EngineInterface.hpp" +#include "client/PatchModel.hpp" +#include "App.hpp" +#include "PatchView.hpp" +#include "PatchCanvas.hpp" +#include "LoadPluginWindow.hpp" +#include "NewSubpatchWindow.hpp" +#include "LoadSubpatchWindow.hpp" +#include "NodeControlWindow.hpp" +#include "PatchPropertiesWindow.hpp" +#include "PatchTreeWindow.hpp" +#include "GladeFactory.hpp" namespace Ingen { namespace GUI { diff --git a/src/libs/gui/PatchView.h b/src/libs/gui/PatchView.h deleted file mode 100644 index 72d773fa..00000000 --- a/src/libs/gui/PatchView.h +++ /dev/null @@ -1,102 +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 PATCHVIEW_H -#define PATCHVIEW_H - -#include -#include -#include -#include -#include -#include "client/PatchModel.h" - -using std::string; - -namespace Ingen { namespace Client { - class PortModel; - class ControlModel; - class MetadataModel; -} } -using namespace Ingen::Client; - - -namespace Ingen { -namespace GUI { - -class PatchCanvas; -class LoadPluginWindow; -class NewSubpatchWindow; -class LoadSubpatchWindow; -class NewSubpatchWindow; -class NodeControlWindow; -class PatchDescriptionWindow; -class SubpatchModule; -class OmPort; - - -/** The patch specific contents of a PatchWindow (ie the canvas and whatever else). - * - * \ingroup GUI - */ -class PatchView : public Gtk::Box -{ -public: - PatchView(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); - ~PatchView(); - - SharedPtr canvas() const { return _canvas; } - SharedPtr patch() const { return _patch; } - Gtk::Viewport* breadcrumb_container() const { return _breadcrumb_container; } - - static SharedPtr create(SharedPtr patch); - -private: - void set_patch(SharedPtr patch); - - void process_toggled(); - void clear_clicked(); - void refresh_clicked(); - - void enable(); - void disable(); - - void zoom_full(); - - SharedPtr _patch; - SharedPtr _canvas; - - Gtk::ScrolledWindow* _canvas_scrolledwindow; - - Gtk::ToggleToolButton* _process_but; - Gtk::SpinButton* _poly_spin; - Gtk::ToolButton* _clear_but; - Gtk::ToolButton* _destroy_but; - Gtk::ToolButton* _refresh_but; - Gtk::ToolButton* _save_but; - Gtk::ToolButton* _zoom_normal_but; - Gtk::ToolButton* _zoom_full_but; - Gtk::Viewport* _breadcrumb_container; - - bool _enable_signal; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // PATCHVIEW_H diff --git a/src/libs/gui/PatchView.hpp b/src/libs/gui/PatchView.hpp new file mode 100644 index 00000000..c3d0fc8a --- /dev/null +++ b/src/libs/gui/PatchView.hpp @@ -0,0 +1,102 @@ +/* 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 PATCHVIEW_H +#define PATCHVIEW_H + +#include +#include +#include +#include +#include +#include "client/PatchModel.hpp" + +using std::string; + +namespace Ingen { namespace Client { + class PortModel; + class ControlModel; + class MetadataModel; +} } +using namespace Ingen::Client; + + +namespace Ingen { +namespace GUI { + +class PatchCanvas; +class LoadPluginWindow; +class NewSubpatchWindow; +class LoadSubpatchWindow; +class NewSubpatchWindow; +class NodeControlWindow; +class PatchDescriptionWindow; +class SubpatchModule; +class OmPort; + + +/** The patch specific contents of a PatchWindow (ie the canvas and whatever else). + * + * \ingroup GUI + */ +class PatchView : public Gtk::Box +{ +public: + PatchView(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); + ~PatchView(); + + SharedPtr canvas() const { return _canvas; } + SharedPtr patch() const { return _patch; } + Gtk::Viewport* breadcrumb_container() const { return _breadcrumb_container; } + + static SharedPtr create(SharedPtr patch); + +private: + void set_patch(SharedPtr patch); + + void process_toggled(); + void clear_clicked(); + void refresh_clicked(); + + void enable(); + void disable(); + + void zoom_full(); + + SharedPtr _patch; + SharedPtr _canvas; + + Gtk::ScrolledWindow* _canvas_scrolledwindow; + + Gtk::ToggleToolButton* _process_but; + Gtk::SpinButton* _poly_spin; + Gtk::ToolButton* _clear_but; + Gtk::ToolButton* _destroy_but; + Gtk::ToolButton* _refresh_but; + Gtk::ToolButton* _save_but; + Gtk::ToolButton* _zoom_normal_but; + Gtk::ToolButton* _zoom_full_but; + Gtk::Viewport* _breadcrumb_container; + + bool _enable_signal; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // PATCHVIEW_H diff --git a/src/libs/gui/PatchWindow.cpp b/src/libs/gui/PatchWindow.cpp index 048416df..b0b87c5e 100644 --- a/src/libs/gui/PatchWindow.cpp +++ b/src/libs/gui/PatchWindow.cpp @@ -15,29 +15,29 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "PatchWindow.h" +#include "PatchWindow.hpp" #include #include #include -#include "interface/EngineInterface.h" -#include "client/PatchModel.h" -#include "client/Store.h" -#include "App.h" -#include "PatchCanvas.h" -#include "LoadPluginWindow.h" -#include "NewSubpatchWindow.h" -#include "LoadPatchWindow.h" -#include "LoadSubpatchWindow.h" -#include "NodeControlWindow.h" -#include "PatchPropertiesWindow.h" -#include "ConfigWindow.h" -#include "MessagesWindow.h" -#include "PatchTreeWindow.h" -#include "BreadCrumbBox.h" -#include "ConnectWindow.h" -#include "ThreadedLoader.h" -#include "WindowFactory.h" -#include "PatchView.h" +#include "interface/EngineInterface.hpp" +#include "client/PatchModel.hpp" +#include "client/Store.hpp" +#include "App.hpp" +#include "PatchCanvas.hpp" +#include "LoadPluginWindow.hpp" +#include "NewSubpatchWindow.hpp" +#include "LoadPatchWindow.hpp" +#include "LoadSubpatchWindow.hpp" +#include "NodeControlWindow.hpp" +#include "PatchPropertiesWindow.hpp" +#include "ConfigWindow.hpp" +#include "MessagesWindow.hpp" +#include "PatchTreeWindow.hpp" +#include "BreadCrumbBox.hpp" +#include "ConnectWindow.hpp" +#include "ThreadedLoader.hpp" +#include "WindowFactory.hpp" +#include "PatchView.hpp" namespace Ingen { namespace GUI { diff --git a/src/libs/gui/PatchWindow.h b/src/libs/gui/PatchWindow.h deleted file mode 100644 index daa4af08..00000000 --- a/src/libs/gui/PatchWindow.h +++ /dev/null @@ -1,150 +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 PATCHWINDOW_H -#define PATCHWINDOW_H - -#include -#include -#include -#include -#include -#include -#include -#include "client/PatchModel.h" -#include "PatchView.h" -using Ingen::Client::PatchModel; - -using std::string; using std::list; - - -namespace Ingen { namespace Client { - class PatchModel; - class PortModel; - class ControlModel; - class MetadataModel; -} } -using namespace Ingen::Client; - - -namespace Ingen { -namespace GUI { - -class LoadPluginWindow; -class LoadPatchWindow; -class NewSubpatchWindow; -class LoadSubpatchWindow; -class NewSubpatchWindow; -class NodeControlWindow; -class PatchDescriptionWindow; -class SubpatchModule; -class OmPort; -class BreadCrumbBox; - - -/** A window for a patch. - * - * \ingroup GUI - */ -class PatchWindow : public Gtk::Window -{ -public: - PatchWindow(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); - ~PatchWindow(); - - void set_patch_from_path(const Path& path, SharedPtr view); - void set_patch(SharedPtr pc, SharedPtr view); - - SharedPtr patch() const { return _patch; } - - Gtk::MenuItem* menu_view_control_window() { return _menu_view_control_window; } - -protected: - void on_show(); - void on_hide(); - bool on_key_press_event(GdkEventKey* event); - -private: - - void patch_port_added(SharedPtr port); - void patch_port_removed(SharedPtr port); - - void event_import(); - void event_import_location(); - void event_save(); - void event_save_as(); - void event_upload(); - void event_copy(); - void event_delete(); - void event_quit(); - void event_destroy(); - void event_clear(); - void event_fullscreen_toggled(); - void event_arrange(); - void event_show_properties(); - void event_show_controls(); - void event_show_engine(); - - SharedPtr _patch; - SharedPtr _view; - - sigc::connection new_port_connection; - sigc::connection removed_port_connection; - - bool _enable_signal; - bool _position_stored; - int _x; - int _y; - - Gtk::MenuItem* _menu_import; - Gtk::MenuItem* _menu_import_location; - Gtk::MenuItem* _menu_save; - Gtk::MenuItem* _menu_save_as; - Gtk::MenuItem* _menu_upload; - Gtk::MenuItem* _menu_cut; - Gtk::MenuItem* _menu_copy; - Gtk::MenuItem* _menu_paste; - Gtk::MenuItem* _menu_delete; - Gtk::MenuItem* _menu_configuration; - Gtk::MenuItem* _menu_close; - Gtk::MenuItem* _menu_quit; - Gtk::MenuItem* _menu_fullscreen; - Gtk::MenuItem* _menu_clear; - Gtk::MenuItem* _menu_destroy_patch; - Gtk::MenuItem* _menu_arrange; - Gtk::MenuItem* _menu_view_engine_window; - Gtk::MenuItem* _menu_view_control_window; - Gtk::MenuItem* _menu_view_patch_properties; - Gtk::MenuItem* _menu_view_messages_window; - Gtk::MenuItem* _menu_view_patch_tree_window; - Gtk::MenuItem* _menu_help_about; - - Gtk::VBox* _vbox; - Gtk::Viewport* _viewport; - BreadCrumbBox* _breadcrumb_box; - - //Gtk::Statusbar* _status_bar; - - /** Invisible bin used to store breadcrumbs when not shown by a view */ - Gtk::Alignment _breadcrumb_bin; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // PATCHWINDOW_H diff --git a/src/libs/gui/PatchWindow.hpp b/src/libs/gui/PatchWindow.hpp new file mode 100644 index 00000000..08048bd3 --- /dev/null +++ b/src/libs/gui/PatchWindow.hpp @@ -0,0 +1,150 @@ +/* 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 PATCHWINDOW_H +#define PATCHWINDOW_H + +#include +#include +#include +#include +#include +#include +#include +#include "client/PatchModel.hpp" +#include "PatchView.hpp" +using Ingen::Client::PatchModel; + +using std::string; using std::list; + + +namespace Ingen { namespace Client { + class PatchModel; + class PortModel; + class ControlModel; + class MetadataModel; +} } +using namespace Ingen::Client; + + +namespace Ingen { +namespace GUI { + +class LoadPluginWindow; +class LoadPatchWindow; +class NewSubpatchWindow; +class LoadSubpatchWindow; +class NewSubpatchWindow; +class NodeControlWindow; +class PatchDescriptionWindow; +class SubpatchModule; +class OmPort; +class BreadCrumbBox; + + +/** A window for a patch. + * + * \ingroup GUI + */ +class PatchWindow : public Gtk::Window +{ +public: + PatchWindow(BaseObjectType* cobject, const Glib::RefPtr& glade_xml); + ~PatchWindow(); + + void set_patch_from_path(const Path& path, SharedPtr view); + void set_patch(SharedPtr pc, SharedPtr view); + + SharedPtr patch() const { return _patch; } + + Gtk::MenuItem* menu_view_control_window() { return _menu_view_control_window; } + +protected: + void on_show(); + void on_hide(); + bool on_key_press_event(GdkEventKey* event); + +private: + + void patch_port_added(SharedPtr port); + void patch_port_removed(SharedPtr port); + + void event_import(); + void event_import_location(); + void event_save(); + void event_save_as(); + void event_upload(); + void event_copy(); + void event_delete(); + void event_quit(); + void event_destroy(); + void event_clear(); + void event_fullscreen_toggled(); + void event_arrange(); + void event_show_properties(); + void event_show_controls(); + void event_show_engine(); + + SharedPtr _patch; + SharedPtr _view; + + sigc::connection new_port_connection; + sigc::connection removed_port_connection; + + bool _enable_signal; + bool _position_stored; + int _x; + int _y; + + Gtk::MenuItem* _menu_import; + Gtk::MenuItem* _menu_import_location; + Gtk::MenuItem* _menu_save; + Gtk::MenuItem* _menu_save_as; + Gtk::MenuItem* _menu_upload; + Gtk::MenuItem* _menu_cut; + Gtk::MenuItem* _menu_copy; + Gtk::MenuItem* _menu_paste; + Gtk::MenuItem* _menu_delete; + Gtk::MenuItem* _menu_configuration; + Gtk::MenuItem* _menu_close; + Gtk::MenuItem* _menu_quit; + Gtk::MenuItem* _menu_fullscreen; + Gtk::MenuItem* _menu_clear; + Gtk::MenuItem* _menu_destroy_patch; + Gtk::MenuItem* _menu_arrange; + Gtk::MenuItem* _menu_view_engine_window; + Gtk::MenuItem* _menu_view_control_window; + Gtk::MenuItem* _menu_view_patch_properties; + Gtk::MenuItem* _menu_view_messages_window; + Gtk::MenuItem* _menu_view_patch_tree_window; + Gtk::MenuItem* _menu_help_about; + + Gtk::VBox* _vbox; + Gtk::Viewport* _viewport; + BreadCrumbBox* _breadcrumb_box; + + //Gtk::Statusbar* _status_bar; + + /** Invisible bin used to store breadcrumbs when not shown by a view */ + Gtk::Alignment _breadcrumb_bin; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // PATCHWINDOW_H diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp index a03a60d4..4b824f15 100644 --- a/src/libs/gui/Port.cpp +++ b/src/libs/gui/Port.cpp @@ -17,13 +17,13 @@ #include #include -#include "interface/EngineInterface.h" -#include "client/PatchModel.h" -#include "client/PortModel.h" -#include "client/ControlModel.h" -#include "Configuration.h" -#include "App.h" -#include "Port.h" +#include "interface/EngineInterface.hpp" +#include "client/PatchModel.hpp" +#include "client/PortModel.hpp" +#include "client/ControlModel.hpp" +#include "Configuration.hpp" +#include "App.hpp" +#include "Port.hpp" using std::cerr; using std::endl; using namespace Ingen::Client; diff --git a/src/libs/gui/Port.h b/src/libs/gui/Port.h deleted file mode 100644 index 507ced21..00000000 --- a/src/libs/gui/Port.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 PORT_H -#define PORT_H - -#include -#include -#include -#include - -namespace Ingen { namespace Client { class PortModel; } } -using Ingen::Client::PortModel; - -namespace Ingen { -namespace GUI { - - -/** A Port on an Module. - * - * \ingroup GUI - */ -class Port : public FlowCanvas::Port -{ -public: - Port(boost::shared_ptr module, SharedPtr pm, bool flip = false, bool destroyable = false); - - virtual ~Port() {} - - SharedPtr model() const { return _port_model; } - -private: - - void on_menu_destroy(); - - SharedPtr _port_model; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // PORT_H diff --git a/src/libs/gui/Port.hpp b/src/libs/gui/Port.hpp new file mode 100644 index 00000000..84a1643c --- /dev/null +++ b/src/libs/gui/Port.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 PORT_H +#define PORT_H + +#include +#include +#include +#include + +namespace Ingen { namespace Client { class PortModel; } } +using Ingen::Client::PortModel; + +namespace Ingen { +namespace GUI { + + +/** A Port on an Module. + * + * \ingroup GUI + */ +class Port : public FlowCanvas::Port +{ +public: + Port(boost::shared_ptr module, SharedPtr pm, bool flip = false, bool destroyable = false); + + virtual ~Port() {} + + SharedPtr model() const { return _port_model; } + +private: + + void on_menu_destroy(); + + SharedPtr _port_model; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // PORT_H diff --git a/src/libs/gui/PortPropertiesWindow.cpp b/src/libs/gui/PortPropertiesWindow.cpp index 92df6ce5..e3afad5b 100644 --- a/src/libs/gui/PortPropertiesWindow.cpp +++ b/src/libs/gui/PortPropertiesWindow.cpp @@ -17,12 +17,12 @@ #include #include -#include "interface/EngineInterface.h" -#include "client/NodeModel.h" -#include "client/PluginModel.h" -#include "App.h" -#include "ControlGroups.h" -#include "PortPropertiesWindow.h" +#include "interface/EngineInterface.hpp" +#include "client/NodeModel.hpp" +#include "client/PluginModel.hpp" +#include "App.hpp" +#include "ControlGroups.hpp" +#include "PortPropertiesWindow.hpp" using std::string; diff --git a/src/libs/gui/PortPropertiesWindow.h b/src/libs/gui/PortPropertiesWindow.h deleted file mode 100644 index b7900bc6..00000000 --- a/src/libs/gui/PortPropertiesWindow.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 PORTPROPERTIESWINDOW_H -#define PORTPROPERTIESWINDOW_H - -#include -#include -#include -#include "client/PortModel.h" -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - -class ControlGroup; - - -/** Port properties window. - * - * Loaded by libglade as a derived object. - * - * \ingroup GUI - */ -class PortPropertiesWindow : public Gtk::Dialog -{ -public: - PortPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); - - void init(ControlGroup* control, SharedPtr port_model); - -private: - void metadata_update(const string& key, const Atom& value); - void min_changed(); - void max_changed(); - - void ok(); - void cancel(); - - bool _enable_signal; - - float _initial_min; - float _initial_max; - - ControlGroup* _control; - SharedPtr _port_model; - Gtk::SpinButton* _min_spinner; - Gtk::SpinButton* _max_spinner; - Gtk::Button* _cancel_button; - Gtk::Button* _ok_button; -}; - -} // namespace GUI -} // namespace Ingen - -#endif // PORTPROPERTIESWINDOW_H diff --git a/src/libs/gui/PortPropertiesWindow.hpp b/src/libs/gui/PortPropertiesWindow.hpp new file mode 100644 index 00000000..8c8f1c96 --- /dev/null +++ b/src/libs/gui/PortPropertiesWindow.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 PORTPROPERTIESWINDOW_H +#define PORTPROPERTIESWINDOW_H + +#include +#include +#include +#include "client/PortModel.hpp" +using namespace Ingen::Client; + +namespace Ingen { +namespace GUI { + +class ControlGroup; + + +/** Port properties window. + * + * Loaded by libglade as a derived object. + * + * \ingroup GUI + */ +class PortPropertiesWindow : public Gtk::Dialog +{ +public: + PortPropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); + + void init(ControlGroup* control, SharedPtr port_model); + +private: + void metadata_update(const string& key, const Atom& value); + void min_changed(); + void max_changed(); + + void ok(); + void cancel(); + + bool _enable_signal; + + float _initial_min; + float _initial_max; + + ControlGroup* _control; + SharedPtr _port_model; + Gtk::SpinButton* _min_spinner; + Gtk::SpinButton* _max_spinner; + Gtk::Button* _cancel_button; + Gtk::Button* _ok_button; +}; + +} // namespace GUI +} // namespace Ingen + +#endif // PORTPROPERTIESWINDOW_H diff --git a/src/libs/gui/RenameWindow.cpp b/src/libs/gui/RenameWindow.cpp index d9c474a8..04ffdd9f 100644 --- a/src/libs/gui/RenameWindow.cpp +++ b/src/libs/gui/RenameWindow.cpp @@ -17,11 +17,11 @@ #include #include -#include "interface/EngineInterface.h" -#include "client/ObjectModel.h" -#include "client/Store.h" -#include "App.h" -#include "RenameWindow.h" +#include "interface/EngineInterface.hpp" +#include "client/ObjectModel.hpp" +#include "client/Store.hpp" +#include "App.hpp" +#include "RenameWindow.hpp" using std::string; diff --git a/src/libs/gui/RenameWindow.h b/src/libs/gui/RenameWindow.h deleted file mode 100644 index 56ee3d5a..00000000 --- a/src/libs/gui/RenameWindow.h +++ /dev/null @@ -1,60 +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 RENAMEWINDOW_H -#define RENAMEWINDOW_H - -#include -#include -#include -#include "client/ObjectModel.h" -using Ingen::Client::ObjectModel; - -namespace Ingen { -namespace GUI { - - -/** Rename window. Handles renaming of any (Ingen) object. - * - * \ingroup GUI - */ -class RenameWindow : public Gtk::Window -{ -public: - RenameWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); - - void present(SharedPtr object) { set_object(object); Gtk::Window::present(); } - -private: - void set_object(SharedPtr object); - - void name_changed(); - void cancel_clicked(); - void ok_clicked(); - - SharedPtr _object; - - Gtk::Entry* _name_entry; - Gtk::Label* _message_label; - Gtk::Button* _cancel_button; - Gtk::Button* _ok_button; -}; - -} // namespace GUI -} // namespace Ingen - -#endif // RENAMEWINDOW_H diff --git a/src/libs/gui/RenameWindow.hpp b/src/libs/gui/RenameWindow.hpp new file mode 100644 index 00000000..3cf37f7c --- /dev/null +++ b/src/libs/gui/RenameWindow.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 RENAMEWINDOW_H +#define RENAMEWINDOW_H + +#include +#include +#include +#include "client/ObjectModel.hpp" +using Ingen::Client::ObjectModel; + +namespace Ingen { +namespace GUI { + + +/** Rename window. Handles renaming of any (Ingen) object. + * + * \ingroup GUI + */ +class RenameWindow : public Gtk::Window +{ +public: + RenameWindow(BaseObjectType* cobject, const Glib::RefPtr& refGlade); + + void present(SharedPtr object) { set_object(object); Gtk::Window::present(); } + +private: + void set_object(SharedPtr object); + + void name_changed(); + void cancel_clicked(); + void ok_clicked(); + + SharedPtr _object; + + Gtk::Entry* _name_entry; + Gtk::Label* _message_label; + Gtk::Button* _cancel_button; + Gtk::Button* _ok_button; +}; + +} // namespace GUI +} // namespace Ingen + +#endif // RENAMEWINDOW_H diff --git a/src/libs/gui/SubpatchModule.cpp b/src/libs/gui/SubpatchModule.cpp index 475774bc..b2a4d43f 100644 --- a/src/libs/gui/SubpatchModule.cpp +++ b/src/libs/gui/SubpatchModule.cpp @@ -15,18 +15,18 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "SubpatchModule.h" +#include "SubpatchModule.hpp" #include #include -#include "interface/EngineInterface.h" -#include "client/PatchModel.h" -#include "App.h" -#include "NodeModule.h" -#include "NodeControlWindow.h" -#include "PatchWindow.h" -#include "PatchCanvas.h" -#include "Port.h" -#include "WindowFactory.h" +#include "interface/EngineInterface.hpp" +#include "client/PatchModel.hpp" +#include "App.hpp" +#include "NodeModule.hpp" +#include "NodeControlWindow.hpp" +#include "PatchWindow.hpp" +#include "PatchCanvas.hpp" +#include "Port.hpp" +#include "WindowFactory.hpp" using std::cerr; using std::cout; using std::endl; namespace Ingen { diff --git a/src/libs/gui/SubpatchModule.h b/src/libs/gui/SubpatchModule.h deleted file mode 100644 index 4dc17e8b..00000000 --- a/src/libs/gui/SubpatchModule.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 SUBPATCHMODULE_H -#define SUBPATCHMODULE_H - -#include -#include -#include -#include "client/PatchModel.h" -#include "PatchPortModule.h" -#include "NodeModule.h" -using std::string; using std::list; - -namespace Ingen { namespace Client { - class PatchModel; - class NodeModel; - class PortModel; - class PatchWindow; -} } -using namespace Ingen::Client; - -namespace Ingen { -namespace GUI { - -class PatchCanvas; -class NodeControlWindow; - - -/** A module to represent a subpatch - * - * \ingroup GUI - */ -class SubpatchModule : public NodeModule -{ -public: - SubpatchModule(boost::shared_ptr canvas, SharedPtr controller); - virtual ~SubpatchModule() {} - - void on_double_click(GdkEventButton* ev); - - void show_dialog(); - void browse_to_patch(); - void menu_remove(); - - SharedPtr patch() { return _patch; } - -protected: - SharedPtr _patch; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // SUBPATCHMODULE_H diff --git a/src/libs/gui/SubpatchModule.hpp b/src/libs/gui/SubpatchModule.hpp new file mode 100644 index 00000000..44e37e62 --- /dev/null +++ b/src/libs/gui/SubpatchModule.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 SUBPATCHMODULE_H +#define SUBPATCHMODULE_H + +#include +#include +#include +#include "client/PatchModel.hpp" +#include "PatchPortModule.hpp" +#include "NodeModule.hpp" +using std::string; using std::list; + +namespace Ingen { namespace Client { + class PatchModel; + class NodeModel; + class PortModel; + class PatchWindow; +} } +using namespace Ingen::Client; + +namespace Ingen { +namespace GUI { + +class PatchCanvas; +class NodeControlWindow; + + +/** A module to represent a subpatch + * + * \ingroup GUI + */ +class SubpatchModule : public NodeModule +{ +public: + SubpatchModule(boost::shared_ptr canvas, SharedPtr controller); + virtual ~SubpatchModule() {} + + void on_double_click(GdkEventButton* ev); + + void show_dialog(); + void browse_to_patch(); + void menu_remove(); + + SharedPtr patch() { return _patch; } + +protected: + SharedPtr _patch; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // SUBPATCHMODULE_H diff --git a/src/libs/gui/ThreadedLoader.cpp b/src/libs/gui/ThreadedLoader.cpp index 75850a5f..653f18b0 100644 --- a/src/libs/gui/ThreadedLoader.cpp +++ b/src/libs/gui/ThreadedLoader.cpp @@ -18,10 +18,10 @@ #include #include #include -#include "client/PatchModel.h" -#include "module/Module.h" -#include "App.h" -#include "ThreadedLoader.h" +#include "client/PatchModel.hpp" +#include "module/Module.hpp" +#include "App.hpp" +#include "ThreadedLoader.hpp" using std::cout; using std::endl; namespace Ingen { diff --git a/src/libs/gui/ThreadedLoader.h b/src/libs/gui/ThreadedLoader.h deleted file mode 100644 index 1494a9fb..00000000 --- a/src/libs/gui/ThreadedLoader.h +++ /dev/null @@ -1,98 +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 THREADEDLOADER_H -#define THREADEDLOADER_H - -#include -#include -#include -#include -#include -#include -#include -#include "interface/EngineInterface.h" -#include "client/PatchModel.h" -#include "client/Serializer.h" -#include "client/DeprecatedLoader.h" -#include "serialisation/Loader.h" -using std::string; -using std::list; -using boost::optional; - -using namespace Ingen::Client; -using namespace Ingen::Serialisation; - -namespace Ingen { -namespace GUI { - - -/** Thread for loading patch files. - * - * This is a seperate thread so it can send all the loading message without - * blocking everything else, so the app can respond to the incoming events - * caused as a result of the patch loading, while the patch loads. - * - * Implemented as a slave with a list of closures (events) which processes - * all events in the (mutex protected) list each time it's whipped. - * - * \ingroup GUI - */ -class ThreadedLoader : public Raul::Slave -{ -public: - ThreadedLoader(SharedPtr engine); - ~ThreadedLoader(); - - // FIXME: there's a pattern here.... - // (same core interface as Loader/Serializer) - - void load_patch(bool merge, - const string& data_base_uri, - const Path& data_path, - MetadataMap engine_data, - optional engine_parent, - optional engine_name = optional(), - optional engine_poly = optional()); - - void save_patch(SharedPtr model, const string& filename, bool recursive); - -private: - - void save_patch_event(SharedPtr model, const string& filename, bool recursive); - - /** Returns nothing and takes no parameters (because they have all been bound) */ - typedef sigc::slot Closure; - - void _whipped(); - - SharedPtr _serialisation_module; - - SharedPtr _engine; - SharedPtr _loader; - - DeprecatedLoader _deprecated_loader; - Serializer _serializer; - Glib::Mutex _mutex; - list _events; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // LOADERRTHREAD_H diff --git a/src/libs/gui/ThreadedLoader.hpp b/src/libs/gui/ThreadedLoader.hpp new file mode 100644 index 00000000..e8574f6f --- /dev/null +++ b/src/libs/gui/ThreadedLoader.hpp @@ -0,0 +1,98 @@ +/* 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 THREADEDLOADER_H +#define THREADEDLOADER_H + +#include +#include +#include +#include +#include +#include +#include +#include "interface/EngineInterface.hpp" +#include "client/PatchModel.hpp" +#include "client/Serializer.hpp" +#include "client/DeprecatedLoader.hpp" +#include "serialisation/Loader.hpp" +using std::string; +using std::list; +using boost::optional; + +using namespace Ingen::Client; +using namespace Ingen::Serialisation; + +namespace Ingen { +namespace GUI { + + +/** Thread for loading patch files. + * + * This is a seperate thread so it can send all the loading message without + * blocking everything else, so the app can respond to the incoming events + * caused as a result of the patch loading, while the patch loads. + * + * Implemented as a slave with a list of closures (events) which processes + * all events in the (mutex protected) list each time it's whipped. + * + * \ingroup GUI + */ +class ThreadedLoader : public Raul::Slave +{ +public: + ThreadedLoader(SharedPtr engine); + ~ThreadedLoader(); + + // FIXME: there's a pattern here.... + // (same core interface as Loader/Serializer) + + void load_patch(bool merge, + const string& data_base_uri, + const Path& data_path, + MetadataMap engine_data, + optional engine_parent, + optional engine_name = optional(), + optional engine_poly = optional()); + + void save_patch(SharedPtr model, const string& filename, bool recursive); + +private: + + void save_patch_event(SharedPtr model, const string& filename, bool recursive); + + /** Returns nothing and takes no parameters (because they have all been bound) */ + typedef sigc::slot Closure; + + void _whipped(); + + SharedPtr _serialisation_module; + + SharedPtr _engine; + SharedPtr _loader; + + DeprecatedLoader _deprecated_loader; + Serializer _serializer; + Glib::Mutex _mutex; + list _events; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // LOADERRTHREAD_H diff --git a/src/libs/gui/UploadPatchWindow.cpp b/src/libs/gui/UploadPatchWindow.cpp index 7def01a0..46be0987 100644 --- a/src/libs/gui/UploadPatchWindow.cpp +++ b/src/libs/gui/UploadPatchWindow.cpp @@ -21,14 +21,14 @@ #include #include #include -#include -#include "interface/EngineInterface.h" -#include "client/Serializer.h" -#include "client/PatchModel.h" -#include "UploadPatchWindow.h" -#include "App.h" -#include "Configuration.h" -#include "ThreadedLoader.h" +#include +#include "interface/EngineInterface.hpp" +#include "client/Serializer.hpp" +#include "client/PatchModel.hpp" +#include "UploadPatchWindow.hpp" +#include "App.hpp" +#include "Configuration.hpp" +#include "ThreadedLoader.hpp" using boost::optional; using namespace Raul; diff --git a/src/libs/gui/UploadPatchWindow.h b/src/libs/gui/UploadPatchWindow.h deleted file mode 100644 index 13272215..00000000 --- a/src/libs/gui/UploadPatchWindow.h +++ /dev/null @@ -1,105 +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 UPLOADPATCHWINDOW_H -#define UPLOADPATCHWINDOW_H - -#include -#include -#include -#include -#include -#include -#include -#include "client/PatchModel.h" -#include "client/PluginModel.h" -using Ingen::Client::PatchModel; -using Ingen::Client::MetadataMap; - -namespace Ingen { -namespace GUI { - -class UploadPatchWindow; - - -class UploadThread : public Raul::Thread { -public: - UploadThread(UploadPatchWindow* win, - const string& str, - const string& url); - -private: - static size_t curl_read_cb(void* ptr, size_t size, size_t nmemb, void *stream); - static int curl_progress_cb(void* thread, double dltotal, double dlnow, double ultotal, double ulnow); - - void _run(); - - CURL* _curl; - curl_slist* _headers; - UploadPatchWindow* _win; - size_t _length; - std::istringstream _stream; - std::string _url; -}; - - -/* Upload patch dialog. - * - * \ingroup GUI - */ -class UploadPatchWindow : public Gtk::Dialog -{ -public: - UploadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); - - void present(SharedPtr patch); - - Gtk::ProgressBar* progress_bar() { return _upload_progress; } - - void set_response(int response) { _response = response; } - void set_progress(int pct) { _progress_pct = pct; } - -private: - bool is_symbol(const Glib::ustring& str); - void symbol_changed(); - void short_name_changed(); - void cancel_clicked(); - void upload_clicked(); - void on_show(); - void on_hide(); - bool progress_callback(); - - UploadThread* _thread; - - SharedPtr _patch; - - Raul::AtomicInt _progress_pct; - Raul::AtomicInt _response; - - Gtk::Entry* _symbol_entry; - Gtk::Entry* _short_name_entry; - Gtk::ProgressBar* _upload_progress; - Gtk::Button* _cancel_button; - Gtk::Button* _upload_button; - -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // UPLOADPATCHWINDOW_H diff --git a/src/libs/gui/UploadPatchWindow.hpp b/src/libs/gui/UploadPatchWindow.hpp new file mode 100644 index 00000000..c3de55fa --- /dev/null +++ b/src/libs/gui/UploadPatchWindow.hpp @@ -0,0 +1,105 @@ +/* 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 UPLOADPATCHWINDOW_H +#define UPLOADPATCHWINDOW_H + +#include +#include +#include +#include +#include +#include +#include +#include "client/PatchModel.hpp" +#include "client/PluginModel.hpp" +using Ingen::Client::PatchModel; +using Ingen::Client::MetadataMap; + +namespace Ingen { +namespace GUI { + +class UploadPatchWindow; + + +class UploadThread : public Raul::Thread { +public: + UploadThread(UploadPatchWindow* win, + const string& str, + const string& url); + +private: + static size_t curl_read_cb(void* ptr, size_t size, size_t nmemb, void *stream); + static int curl_progress_cb(void* thread, double dltotal, double dlnow, double ultotal, double ulnow); + + void _run(); + + CURL* _curl; + curl_slist* _headers; + UploadPatchWindow* _win; + size_t _length; + std::istringstream _stream; + std::string _url; +}; + + +/* Upload patch dialog. + * + * \ingroup GUI + */ +class UploadPatchWindow : public Gtk::Dialog +{ +public: + UploadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); + + void present(SharedPtr patch); + + Gtk::ProgressBar* progress_bar() { return _upload_progress; } + + void set_response(int response) { _response = response; } + void set_progress(int pct) { _progress_pct = pct; } + +private: + bool is_symbol(const Glib::ustring& str); + void symbol_changed(); + void short_name_changed(); + void cancel_clicked(); + void upload_clicked(); + void on_show(); + void on_hide(); + bool progress_callback(); + + UploadThread* _thread; + + SharedPtr _patch; + + Raul::AtomicInt _progress_pct; + Raul::AtomicInt _response; + + Gtk::Entry* _symbol_entry; + Gtk::Entry* _short_name_entry; + Gtk::ProgressBar* _upload_progress; + Gtk::Button* _cancel_button; + Gtk::Button* _upload_button; + +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // UPLOADPATCHWINDOW_H diff --git a/src/libs/gui/WindowFactory.cpp b/src/libs/gui/WindowFactory.cpp index 7c2e3eaa..9f128e8e 100644 --- a/src/libs/gui/WindowFactory.cpp +++ b/src/libs/gui/WindowFactory.cpp @@ -15,20 +15,20 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "WindowFactory.h" -#include "App.h" -#include "PatchWindow.h" -#include "GladeFactory.h" -#include "NodePropertiesWindow.h" -#include "PatchPropertiesWindow.h" -#include "NodeControlWindow.h" -#include "LoadPluginWindow.h" -#include "LoadPatchWindow.h" -#include "LoadRemotePatchWindow.h" -#include "UploadPatchWindow.h" -#include "LoadSubpatchWindow.h" -#include "RenameWindow.h" -#include "NewSubpatchWindow.h" +#include "WindowFactory.hpp" +#include "App.hpp" +#include "PatchWindow.hpp" +#include "GladeFactory.hpp" +#include "NodePropertiesWindow.hpp" +#include "PatchPropertiesWindow.hpp" +#include "NodeControlWindow.hpp" +#include "LoadPluginWindow.hpp" +#include "LoadPatchWindow.hpp" +#include "LoadRemotePatchWindow.hpp" +#include "UploadPatchWindow.hpp" +#include "LoadSubpatchWindow.hpp" +#include "RenameWindow.hpp" +#include "NewSubpatchWindow.hpp" namespace Ingen { namespace GUI { diff --git a/src/libs/gui/WindowFactory.h b/src/libs/gui/WindowFactory.h deleted file mode 100644 index c3170dce..00000000 --- a/src/libs/gui/WindowFactory.h +++ /dev/null @@ -1,105 +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 WINDOW_FACTORY_H -#define WINDOW_FACTORY_H - -#include -#include -#include -#include "client/PatchModel.h" -#include "PatchView.h" - -using Ingen::Client::PatchModel; - -namespace Ingen { -namespace GUI { - -class PatchWindow; -class NodeControlWindow; -class NodePropertiesWindow; -class PatchPropertiesWindow; -class LoadPatchWindow; -class LoadRemotePatchWindow; -class UploadPatchWindow; -class RenameWindow; - - -/** Manager/Factory for all windows. - * - * This serves as a nice centralized spot for all window management issues, - * as well as an enumeration of all windows (the goal being to reduce that - * number as much as possible). - */ -class WindowFactory { -public: - WindowFactory(); - ~WindowFactory(); - - size_t num_open_patch_windows(); - - PatchWindow* patch_window(SharedPtr patch); - NodeControlWindow* control_window(SharedPtr node); - - void present_patch(SharedPtr patch, - PatchWindow* preferred = NULL, - SharedPtr patch = SharedPtr()); - - void present_controls(SharedPtr node); - - void present_load_plugin(SharedPtr patch, MetadataMap data = MetadataMap()); - void present_load_patch(SharedPtr patch, MetadataMap data = MetadataMap()); - void present_load_remote_patch(SharedPtr patch, MetadataMap data = MetadataMap()); - void present_upload_patch(SharedPtr patch); - void present_new_subpatch(SharedPtr patch, MetadataMap data = MetadataMap()); - void present_load_subpatch(SharedPtr patch, MetadataMap data = MetadataMap()); - void present_rename(SharedPtr object); - void present_properties(SharedPtr node); - - bool remove_patch_window(PatchWindow* win, GdkEventAny* ignored = NULL); - - void clear(); - -private: - typedef std::map PatchWindowMap; - typedef std::map ControlWindowMap; - - PatchWindow* new_patch_window(SharedPtr patch, SharedPtr view); - - - NodeControlWindow* new_control_window(SharedPtr node); - bool remove_control_window(NodeControlWindow* win, GdkEventAny* ignored); - - PatchWindowMap _patch_windows; - ControlWindowMap _control_windows; - - LoadPluginWindow* _load_plugin_win; - LoadPatchWindow* _load_patch_win; - LoadRemotePatchWindow* _load_remote_patch_win; - UploadPatchWindow* _upload_patch_win; - NewSubpatchWindow* _new_subpatch_win; - LoadSubpatchWindow* _load_subpatch_win; - NodePropertiesWindow* _node_properties_win; - PatchPropertiesWindow* _patch_properties_win; - RenameWindow* _rename_win; -}; - - -} // namespace GUI -} // namespace Ingen - -#endif // WINDOW_FACTORY_H diff --git a/src/libs/gui/WindowFactory.hpp b/src/libs/gui/WindowFactory.hpp new file mode 100644 index 00000000..0227f728 --- /dev/null +++ b/src/libs/gui/WindowFactory.hpp @@ -0,0 +1,105 @@ +/* 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 WINDOW_FACTORY_H +#define WINDOW_FACTORY_H + +#include +#include +#include +#include "client/PatchModel.hpp" +#include "PatchView.hpp" + +using Ingen::Client::PatchModel; + +namespace Ingen { +namespace GUI { + +class PatchWindow; +class NodeControlWindow; +class NodePropertiesWindow; +class PatchPropertiesWindow; +class LoadPatchWindow; +class LoadRemotePatchWindow; +class UploadPatchWindow; +class RenameWindow; + + +/** Manager/Factory for all windows. + * + * This serves as a nice centralized spot for all window management issues, + * as well as an enumeration of all windows (the goal being to reduce that + * number as much as possible). + */ +class WindowFactory { +public: + WindowFactory(); + ~WindowFactory(); + + size_t num_open_patch_windows(); + + PatchWindow* patch_window(SharedPtr patch); + NodeControlWindow* control_window(SharedPtr node); + + void present_patch(SharedPtr patch, + PatchWindow* preferred = NULL, + SharedPtr patch = SharedPtr()); + + void present_controls(SharedPtr node); + + void present_load_plugin(SharedPtr patch, MetadataMap data = MetadataMap()); + void present_load_patch(SharedPtr patch, MetadataMap data = MetadataMap()); + void present_load_remote_patch(SharedPtr patch, MetadataMap data = MetadataMap()); + void present_upload_patch(SharedPtr patch); + void present_new_subpatch(SharedPtr patch, MetadataMap data = MetadataMap()); + void present_load_subpatch(SharedPtr patch, MetadataMap data = MetadataMap()); + void present_rename(SharedPtr object); + void present_properties(SharedPtr node); + + bool remove_patch_window(PatchWindow* win, GdkEventAny* ignored = NULL); + + void clear(); + +private: + typedef std::map PatchWindowMap; + typedef std::map ControlWindowMap; + + PatchWindow* new_patch_window(SharedPtr patch, SharedPtr view); + + + NodeControlWindow* new_control_window(SharedPtr node); + bool remove_control_window(NodeControlWindow* win, GdkEventAny* ignored); + + PatchWindowMap _patch_windows; + ControlWindowMap _control_windows; + + LoadPluginWindow* _load_plugin_win; + LoadPatchWindow* _load_patch_win; + LoadRemotePatchWindow* _load_remote_patch_win; + UploadPatchWindow* _upload_patch_win; + NewSubpatchWindow* _new_subpatch_win; + LoadSubpatchWindow* _load_subpatch_win; + NodePropertiesWindow* _node_properties_win; + PatchPropertiesWindow* _patch_properties_win; + RenameWindow* _rename_win; +}; + + +} // namespace GUI +} // namespace Ingen + +#endif // WINDOW_FACTORY_H diff --git a/src/libs/gui/gui.cpp b/src/libs/gui/gui.cpp index bd73ac91..689adf62 100644 --- a/src/libs/gui/gui.cpp +++ b/src/libs/gui/gui.cpp @@ -15,10 +15,10 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "gui.h" -#include "ConnectWindow.h" -#include "App.h" -#include "Configuration.h" +#include "gui.hpp" +#include "ConnectWindow.hpp" +#include "App.hpp" +#include "Configuration.hpp" namespace Ingen { namespace GUI { diff --git a/src/libs/gui/gui.h b/src/libs/gui/gui.h deleted file mode 100644 index 2c229109..00000000 --- a/src/libs/gui/gui.h +++ /dev/null @@ -1,45 +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_GUI_H -#define INGEN_GUI_H - -#include - -namespace Ingen { - -class Engine; - -namespace Shared { class EngineInterface; } - -namespace GUI { - - -extern "C" { - - void run(int argc, char** argv, - SharedPtr engine, - SharedPtr interface); - -} - - -} // namesace GUI -} // namespace Ingen - -#endif // INGEN_GUI_H - diff --git a/src/libs/gui/gui.hpp b/src/libs/gui/gui.hpp new file mode 100644 index 00000000..992aa9d4 --- /dev/null +++ b/src/libs/gui/gui.hpp @@ -0,0 +1,45 @@ +/* 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_GUI_H +#define INGEN_GUI_H + +#include + +namespace Ingen { + +class Engine; + +namespace Shared { class EngineInterface; } + +namespace GUI { + + +extern "C" { + + void run(int argc, char** argv, + SharedPtr engine, + SharedPtr interface); + +} + + +} // namesace GUI +} // namespace Ingen + +#endif // INGEN_GUI_H + diff --git a/src/libs/module/Makefile.am b/src/libs/module/Makefile.am index 4d296f44..bcd2ea4f 100644 --- a/src/libs/module/Makefile.am +++ b/src/libs/module/Makefile.am @@ -5,5 +5,5 @@ libingen_module_la_CXXFLAGS = -I$(top_srcdir)/raul -DINGEN_MODULE_DIR=\"$(libdir libingen_module_la_LIBADD = @RAUL_LIBS@ @GLIBMM_LIBS@ libingen_module_la_SOURCES = \ - Module.h \ + Module.hpp \ Module.cpp diff --git a/src/libs/module/Module.cpp b/src/libs/module/Module.cpp index 073e612d..9aacd0cc 100644 --- a/src/libs/module/Module.cpp +++ b/src/libs/module/Module.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #ifndef INGEN_MODULE_DIR #error This file expects INGEN_MODULE_DIR to be defined. diff --git a/src/libs/module/Module.h b/src/libs/module/Module.h deleted file mode 100644 index 58ed014f..00000000 --- a/src/libs/module/Module.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 - */ - -#include -#include -#include - -namespace Ingen { -namespace Shared { - - -/** Load a dynamic module from the default path. - * - * \param name The base name of the module, e.g. "ingen_serialisation" - */ -SharedPtr load_module(const std::string& name); - - -} // namespace Shared -} // namespace Ingen - diff --git a/src/libs/module/Module.hpp b/src/libs/module/Module.hpp new file mode 100644 index 00000000..2d9ba382 --- /dev/null +++ b/src/libs/module/Module.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 + */ + +#include +#include +#include + +namespace Ingen { +namespace Shared { + + +/** Load a dynamic module from the default path. + * + * \param name The base name of the module, e.g. "ingen_serialisation" + */ +SharedPtr load_module(const std::string& name); + + +} // namespace Shared +} // namespace Ingen + diff --git a/src/libs/serialisation/Loader.cpp b/src/libs/serialisation/Loader.cpp index f4c84f25..c14c8a1f 100644 --- a/src/libs/serialisation/Loader.cpp +++ b/src/libs/serialisation/Loader.cpp @@ -18,10 +18,10 @@ #include #include #include -#include -#include -#include "interface/EngineInterface.h" -#include "Loader.h" +#include +#include +#include "interface/EngineInterface.hpp" +#include "Loader.hpp" using namespace std; using namespace Raul; diff --git a/src/libs/serialisation/Loader.h b/src/libs/serialisation/Loader.h deleted file mode 100644 index a02e5cdb..00000000 --- a/src/libs/serialisation/Loader.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 LOADER_H -#define LOADER_H - -#include -#include -#include -#include -#include -#include -#include - -namespace Raul { class Atom; namespace RDF { class World; } } -namespace Ingen { namespace Shared { class EngineInterface; } } - -namespace Ingen { -namespace Serialisation { - - -class Loader { -public: - virtual ~Loader() {} - - typedef std::map Metadata; - - virtual bool - load(SharedPtr engine, - Raul::RDF::World* world, - const Glib::ustring& uri, - boost::optional parent, - std::string patch_name, - Glib::ustring patch_uri = "", - Metadata data = Metadata()); -}; - - -} // namespace Serialisation -} // namespace Ingen - -#endif // LOADER_H diff --git a/src/libs/serialisation/Loader.hpp b/src/libs/serialisation/Loader.hpp new file mode 100644 index 00000000..b729e71d --- /dev/null +++ b/src/libs/serialisation/Loader.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 LOADER_H +#define LOADER_H + +#include +#include +#include +#include +#include +#include +#include + +namespace Raul { class Atom; namespace RDF { class World; } } +namespace Ingen { namespace Shared { class EngineInterface; } } + +namespace Ingen { +namespace Serialisation { + + +class Loader { +public: + virtual ~Loader() {} + + typedef std::map Metadata; + + virtual bool + load(SharedPtr engine, + Raul::RDF::World* world, + const Glib::ustring& uri, + boost::optional parent, + std::string patch_name, + Glib::ustring patch_uri = "", + Metadata data = Metadata()); +}; + + +} // namespace Serialisation +} // namespace Ingen + +#endif // LOADER_H diff --git a/src/libs/serialisation/Makefile.am b/src/libs/serialisation/Makefile.am index 4dbacc5f..556ab653 100644 --- a/src/libs/serialisation/Makefile.am +++ b/src/libs/serialisation/Makefile.am @@ -9,8 +9,8 @@ libingen_serialisation_la_LDFLAGS = -no-undefined -module -avoid-version libingen_serialisation_la_LIBADD = @RAUL_LIBS@ @GLIBMM_LIBS@ libingen_serialisation_la_SOURCES = \ - serialisation.h \ + serialisation.hpp \ serialisation.cpp \ - Loader.h \ + Loader.hpp \ Loader.cpp diff --git a/src/libs/serialisation/serialisation.cpp b/src/libs/serialisation/serialisation.cpp index e0764fc1..969cf9f2 100644 --- a/src/libs/serialisation/serialisation.cpp +++ b/src/libs/serialisation/serialisation.cpp @@ -15,8 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "serialisation.h" -#include "Loader.h" +#include "serialisation.hpp" +#include "Loader.hpp" namespace Ingen { namespace Serialisation { diff --git a/src/libs/serialisation/serialisation.h b/src/libs/serialisation/serialisation.h deleted file mode 100644 index f65b9c2e..00000000 --- a/src/libs/serialisation/serialisation.h +++ /dev/null @@ -1,38 +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_SERIALISATION_H -#define INGEN_SERIALISATION_H - -namespace Ingen { -namespace Serialisation { - -class Loader; - - -extern "C" { - - extern Loader* new_loader(); - -} - - -} // namespace Serialisation -} // namespace Ingen - -#endif // INGEN_SERIALISATION_H - diff --git a/src/libs/serialisation/serialisation.hpp b/src/libs/serialisation/serialisation.hpp new file mode 100644 index 00000000..f65b9c2e --- /dev/null +++ b/src/libs/serialisation/serialisation.hpp @@ -0,0 +1,38 @@ +/* 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_SERIALISATION_H +#define INGEN_SERIALISATION_H + +namespace Ingen { +namespace Serialisation { + +class Loader; + + +extern "C" { + + extern Loader* new_loader(); + +} + + +} // namespace Serialisation +} // namespace Ingen + +#endif // INGEN_SERIALISATION_H + diff --git a/src/progs/ingen/main.cpp b/src/progs/ingen/main.cpp index 30fabe8c..68c0abdc 100644 --- a/src/progs/ingen/main.cpp +++ b/src/progs/ingen/main.cpp @@ -15,6 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "../../../../config/config.h" + #include #include #include @@ -22,14 +24,13 @@ #include #include #include -#include -#include -#include -#include "config.h" -#include "module/Module.h" -#include "engine/Engine.h" -#include "engine/QueuedEngineInterface.h" -#include "serialisation/Loader.h" +#include +#include +#include +#include "module/Module.hpp" +#include "engine/Engine.hpp" +#include "engine/QueuedEngineInterface.hpp" +#include "serialisation/Loader.hpp" #include "cmdline.h" using namespace std; -- cgit v1.2.1