diff options
author | David Robillard <d@drobilla.net> | 2007-02-11 01:26:07 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-02-11 01:26:07 +0000 |
commit | a5fc27d5d781b3b0e53f23c566c02522e910507c (patch) | |
tree | b63a9d8358b64078c68e025f977d77c121fdc7c7 | |
parent | 2f652fcefc7e7bfe3b9c3b56172a2d69ee604cbf (diff) | |
download | ingen-a5fc27d5d781b3b0e53f23c566c02522e910507c.tar.gz ingen-a5fc27d5d781b3b0e53f23c566c02522e910507c.tar.bz2 ingen-a5fc27d5d781b3b0e53f23c566c02522e910507c.zip |
Moved Maid from Ingen to Raul.
Working machina MIDI learn, fixes, etc, etc.
git-svn-id: http://svn.drobilla.net/lad/ingen@302 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/libs/engine/AlsaMidiDriver.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/Engine.cpp | 6 | ||||
-rw-r--r-- | src/libs/engine/Engine.h | 7 | ||||
-rw-r--r-- | src/libs/engine/JackMidiDriver.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/Maid.cpp | 48 | ||||
-rw-r--r-- | src/libs/engine/Maid.h | 63 | ||||
-rw-r--r-- | src/libs/engine/Makefile.am | 2 | ||||
-rw-r--r-- | src/libs/engine/PostProcessor.cpp | 9 | ||||
-rw-r--r-- | src/libs/engine/PostProcessor.h | 6 | ||||
-rw-r--r-- | src/libs/engine/events/AddNodeEvent.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/AddPortEvent.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/ClearPatchEvent.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/ConnectionEvent.cpp | 4 | ||||
-rw-r--r-- | src/libs/engine/events/CreatePatchEvent.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/DestroyEvent.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/DisconnectNodeEvent.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/DisconnectPortEvent.cpp | 10 | ||||
-rw-r--r-- | src/libs/engine/events/DisconnectionEvent.cpp | 4 |
18 files changed, 31 insertions, 144 deletions
diff --git a/src/libs/engine/AlsaMidiDriver.cpp b/src/libs/engine/AlsaMidiDriver.cpp index 81f9ccc5..93d9d803 100644 --- a/src/libs/engine/AlsaMidiDriver.cpp +++ b/src/libs/engine/AlsaMidiDriver.cpp @@ -20,7 +20,7 @@ #include <cstdlib> #include <pthread.h> #include "types.h" -#include "Maid.h" +#include <raul/Maid.h> #include "ThreadManager.h" #include "AudioDriver.h" #include "MidiMessage.h" diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp index bf880c11..387714f8 100644 --- a/src/libs/engine/Engine.cpp +++ b/src/libs/engine/Engine.cpp @@ -22,14 +22,14 @@ #include <sys/mman.h> #include <iostream> #include <unistd.h> +#include <raul/Deletable.h> +#include <raul/Maid.h> #include "Event.h" #include "JackAudioDriver.h" #include "NodeFactory.h" #include "ClientBroadcaster.h" #include "Patch.h" #include "ObjectStore.h" -#include <raul/Deletable.h> -#include "Maid.h" #include "MidiDriver.h" #include "QueuedEventSource.h" #include "PostProcessor.h" @@ -51,7 +51,7 @@ namespace Ingen { Engine::Engine() : _midi_driver(NULL), - _maid(new Maid(maid_queue_size)), + _maid(new Raul::Maid(maid_queue_size)), _post_processor(new PostProcessor(*_maid, post_processor_queue_size)), _broadcaster(new ClientBroadcaster()), _object_store(new ObjectStore()), diff --git a/src/libs/engine/Engine.h b/src/libs/engine/Engine.h index 08a96ab0..163adf68 100644 --- a/src/libs/engine/Engine.h +++ b/src/libs/engine/Engine.h @@ -23,7 +23,8 @@ #include <raul/SharedPtr.h> template<typename T> class Queue; -class Maid; + +namespace Raul { class Maid; } namespace Ingen { @@ -66,10 +67,10 @@ public: 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; } - Maid* maid() const { return _maid; } PostProcessor* post_processor() const { return _post_processor; } ClientBroadcaster* broadcaster() const { return _broadcaster; } ObjectStore* object_store() const { return _object_store; } @@ -83,7 +84,7 @@ private: SharedPtr<EventSource> _event_source; SharedPtr<AudioDriver> _audio_driver; MidiDriver* _midi_driver; - Maid* _maid; + Raul::Maid* _maid; PostProcessor* _post_processor; ClientBroadcaster* _broadcaster; ObjectStore* _object_store; diff --git a/src/libs/engine/JackMidiDriver.cpp b/src/libs/engine/JackMidiDriver.cpp index 304e2474..937cce98 100644 --- a/src/libs/engine/JackMidiDriver.cpp +++ b/src/libs/engine/JackMidiDriver.cpp @@ -22,7 +22,7 @@ #include "types.h" #include "midi.h" #include "ThreadManager.h" -#include "Maid.h" +#include <raul/Maid.h> #include "AudioDriver.h" #include "MidiMessage.h" #include "DuplexPort.h" diff --git a/src/libs/engine/Maid.cpp b/src/libs/engine/Maid.cpp deleted file mode 100644 index d745e587..00000000 --- a/src/libs/engine/Maid.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public 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 "Maid.h" -#include <raul/Deletable.h> - - -Maid::Maid(size_t size) -: _objects(size) -{ -} - - -Maid::~Maid() -{ - cleanup(); -} - - -/** Free all the objects in the queue (passed by push()). - */ -void -Maid::cleanup() -{ - Raul::Deletable* obj = NULL; - - while (!_objects.empty()) { - obj = _objects.front(); - _objects.pop(); - delete obj; - } -} - - diff --git a/src/libs/engine/Maid.h b/src/libs/engine/Maid.h deleted file mode 100644 index 038c0a5e..00000000 --- a/src/libs/engine/Maid.h +++ /dev/null @@ -1,63 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard <http://drobilla.net> - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef MAID_H -#define MAID_H - -#include <boost/utility.hpp> -#include "raul/SRSWQueue.h" -#include <raul/Deletable.h> - - -/** Explicitly driven garbage collector. - * - * This is how realtime parts of the code can schedule the deletion of - * objects - push() is realtime safe. - * - * cleanup() is meant to be called periodically to free memory, often - * enough to prevent the queue from overflowing. This is done by the - * main thread (in Ingen.cpp) since it has nothing better to do. - * - * \ingroup engine - */ -class Maid : boost::noncopyable -{ -public: - Maid(size_t size); - ~Maid(); - - inline void push(Raul::Deletable* obj); - - void cleanup(); - -private: - Raul::SRSWQueue<Raul::Deletable*> _objects; -}; - - -/** Push an event to be deleted. Realtime safe. - */ -inline void -Maid::push(Raul::Deletable* obj) -{ - if (obj != NULL) - _objects.push(obj); -} - - -#endif // MAID_H - diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index c2a6edf4..11a9a23d 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -64,8 +64,6 @@ libingen_la_SOURCES = \ QueuedEngineInterface.cpp \ GraphObject.h \ GraphObject.cpp \ - Maid.h \ - Maid.cpp \ Tree.h \ TreeImplementation.h \ PluginLibrary.h \ diff --git a/src/libs/engine/PostProcessor.cpp b/src/libs/engine/PostProcessor.cpp index 7261cea9..7f74ee82 100644 --- a/src/libs/engine/PostProcessor.cpp +++ b/src/libs/engine/PostProcessor.cpp @@ -15,21 +15,20 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "PostProcessor.h" #include <cassert> #include <iostream> #include <pthread.h> +#include <raul/SRSWQueue.h> +#include <raul/Maid.h> #include "Event.h" -#include "raul/SRSWQueue.h" -#include "Maid.h" - +#include "PostProcessor.h" using std::cerr; using std::cout; using std::endl; namespace Ingen { -PostProcessor::PostProcessor(Maid& maid, size_t queue_size) +PostProcessor::PostProcessor(Raul::Maid& maid, size_t queue_size) : _maid(maid), _events(queue_size) { diff --git a/src/libs/engine/PostProcessor.h b/src/libs/engine/PostProcessor.h index ac32ca0e..4ab4ae2f 100644 --- a/src/libs/engine/PostProcessor.h +++ b/src/libs/engine/PostProcessor.h @@ -23,7 +23,7 @@ #include "raul/SRSWQueue.h" #include "raul/Slave.h" -class Maid; +namespace Raul { class Maid; } namespace Ingen { @@ -41,13 +41,13 @@ class Event; class PostProcessor : public Raul::Slave { public: - PostProcessor(Maid& maid, size_t queue_size); + 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: - Maid& _maid; + Raul::Maid& _maid; Raul::SRSWQueue<Event*> _events; virtual void _whipped(); }; diff --git a/src/libs/engine/events/AddNodeEvent.cpp b/src/libs/engine/events/AddNodeEvent.cpp index 146ca3b6..0e3fa56d 100644 --- a/src/libs/engine/events/AddNodeEvent.cpp +++ b/src/libs/engine/events/AddNodeEvent.cpp @@ -25,7 +25,7 @@ #include "Patch.h" #include "NodeFactory.h" #include "ClientBroadcaster.h" -#include "Maid.h" +#include <raul/Maid.h> #include "raul/Path.h" #include "ObjectStore.h" #include "raul/Path.h" diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp index c775fe04..8ca2f85f 100644 --- a/src/libs/engine/events/AddPortEvent.cpp +++ b/src/libs/engine/events/AddPortEvent.cpp @@ -22,7 +22,7 @@ #include "Plugin.h" #include "Engine.h" #include "Patch.h" -#include "Maid.h" +#include <raul/Maid.h> #include "raul/Path.h" #include "QueuedEventSource.h" #include "ObjectStore.h" diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp index d776df8b..e07ceb5c 100644 --- a/src/libs/engine/events/ClearPatchEvent.cpp +++ b/src/libs/engine/events/ClearPatchEvent.cpp @@ -23,7 +23,7 @@ #include "util.h" #include "ObjectStore.h" #include "Port.h" -#include "Maid.h" +#include <raul/Maid.h> #include "Node.h" #include "Connection.h" #include "QueuedEventSource.h" diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp index c0dcc18c..da723a8c 100644 --- a/src/libs/engine/events/ConnectionEvent.cpp +++ b/src/libs/engine/events/ConnectionEvent.cpp @@ -17,6 +17,8 @@ #include "ConnectionEvent.h" #include <string> +#include <raul/Maid.h> +#include <raul/Path.h> #include "Responder.h" #include "types.h" #include "Engine.h" @@ -26,9 +28,7 @@ #include "Patch.h" #include "ClientBroadcaster.h" #include "Port.h" -#include "Maid.h" #include "ObjectStore.h" -#include "raul/Path.h" using std::string; namespace Ingen { diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp index 96d9c8e3..344dbbe9 100644 --- a/src/libs/engine/events/CreatePatchEvent.cpp +++ b/src/libs/engine/events/CreatePatchEvent.cpp @@ -22,7 +22,7 @@ #include "Tree.h" #include "Plugin.h" #include "Engine.h" -#include "Maid.h" +#include <raul/Maid.h> #include "ClientBroadcaster.h" #include "AudioDriver.h" #include "raul/Path.h" diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp index 9114c4bd..14e6702c 100644 --- a/src/libs/engine/events/DestroyEvent.cpp +++ b/src/libs/engine/events/DestroyEvent.cpp @@ -28,7 +28,7 @@ #include "DisconnectNodeEvent.h" #include "DisconnectPortEvent.h" #include "ClientBroadcaster.h" -#include "Maid.h" +#include <raul/Maid.h> #include "ObjectStore.h" #include "raul/Path.h" #include "QueuedEventSource.h" diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp index 1dc5121f..916c1045 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.cpp +++ b/src/libs/engine/events/DisconnectNodeEvent.cpp @@ -19,9 +19,9 @@ #include <iostream> #include <raul/List.h> #include <raul/Array.h> +#include <raul/Maid.h> #include "Responder.h" #include "Engine.h" -#include "Maid.h" #include "Node.h" #include "TypedConnection.h" #include "DisconnectionEvent.h" diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp index 76c95ef9..08266de6 100644 --- a/src/libs/engine/events/DisconnectPortEvent.cpp +++ b/src/libs/engine/events/DisconnectPortEvent.cpp @@ -15,24 +15,24 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "DisconnectPortEvent.h" #include <iostream> +#include <raul/Maid.h> +#include <raul/List.h> +#include <raul/Path.h> +#include <raul/Array.h> #include "Responder.h" #include "Engine.h" -#include "Maid.h" -#include <raul/List.h> #include "Node.h" #include "Connection.h" #include "DisconnectionEvent.h" #include "Port.h" -#include <raul/Array.h> #include "InputPort.h" #include "OutputPort.h" #include "Patch.h" #include "ClientBroadcaster.h" #include "util.h" #include "ObjectStore.h" -#include "raul/Path.h" +#include "DisconnectPortEvent.h" using std::cerr; using std::endl; diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp index ccb156e5..d5e788ef 100644 --- a/src/libs/engine/events/DisconnectionEvent.cpp +++ b/src/libs/engine/events/DisconnectionEvent.cpp @@ -17,6 +17,8 @@ #include "DisconnectionEvent.h" #include <string> +#include <raul/Maid.h> +#include <raul/Path.h> #include "Responder.h" #include "Engine.h" #include "TypedConnection.h" @@ -25,9 +27,7 @@ #include "Patch.h" #include "ClientBroadcaster.h" #include "Port.h" -#include "Maid.h" #include "ObjectStore.h" -#include "raul/Path.h" using std::string; namespace Ingen { |