From b5b6dba0480b3dcec4b130ea606d63f4a3854920 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 20 Jul 2006 04:15:03 +0000 Subject: Renamed Engine class to "Engine" (from "Ingen") to avoid confusion with namespace Ingen git-svn-id: http://svn.drobilla.net/lad/ingen@99 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/AlsaMidiDriver.cpp | 10 +- src/libs/engine/ClientBroadcaster.cpp | 8 +- src/libs/engine/DSSINode.cpp | 6 +- src/libs/engine/Engine.cpp | 208 +++++++++++++++++++++ src/libs/engine/Engine.h | 105 +++++++++++ src/libs/engine/Ingen.cpp | 208 --------------------- src/libs/engine/Ingen.h | 107 ----------- src/libs/engine/JackAudioDriver.cpp | 22 +-- src/libs/engine/Makefile.am | 4 +- src/libs/engine/MidiControlNode.cpp | 6 +- src/libs/engine/MidiNoteNode.cpp | 4 +- src/libs/engine/NodeBase.cpp | 26 +-- src/libs/engine/NodeFactory.cpp | 28 +-- src/libs/engine/OSCClient.cpp | 10 +- src/libs/engine/OSCResponder.cpp | 4 +- src/libs/engine/ObjectSender.cpp | 14 +- src/libs/engine/OmInProcess.cpp | 8 +- src/libs/engine/PostProcessor.cpp | 4 +- src/libs/engine/QueuedEngineInterface.cpp | 6 +- src/libs/engine/TransportNode.cpp | 6 +- src/libs/engine/events/ActivateEvent.cpp | 4 +- src/libs/engine/events/AddNodeEvent.cpp | 16 +- src/libs/engine/events/AddPortEvent.cpp | 18 +- src/libs/engine/events/AllNotesOffEvent.cpp | 4 +- src/libs/engine/events/ClearPatchEvent.cpp | 8 +- src/libs/engine/events/ConnectionEvent.cpp | 12 +- src/libs/engine/events/CreatePatchEvent.cpp | 16 +- src/libs/engine/events/DSSIConfigureEvent.cpp | 6 +- src/libs/engine/events/DSSIControlEvent.cpp | 4 +- src/libs/engine/events/DSSIProgramEvent.cpp | 6 +- src/libs/engine/events/DSSIUpdateEvent.cpp | 4 +- src/libs/engine/events/DeactivateEvent.cpp | 4 +- src/libs/engine/events/DestroyEvent.cpp | 12 +- src/libs/engine/events/DisablePatchEvent.cpp | 6 +- src/libs/engine/events/DisconnectNodeEvent.cpp | 6 +- src/libs/engine/events/DisconnectPortEvent.cpp | 6 +- src/libs/engine/events/DisconnectionEvent.cpp | 18 +- src/libs/engine/events/EnablePatchEvent.cpp | 6 +- src/libs/engine/events/LoadPluginsEvent.cpp | 4 +- src/libs/engine/events/MidiLearnEvent.cpp | 6 +- src/libs/engine/events/NoteOffEvent.cpp | 4 +- src/libs/engine/events/NoteOnEvent.cpp | 4 +- src/libs/engine/events/RegisterClientEvent.cpp | 4 +- src/libs/engine/events/RenameEvent.cpp | 8 +- src/libs/engine/events/RequestAllObjectsEvent.cpp | 2 +- src/libs/engine/events/RequestMetadataEvent.cpp | 4 +- src/libs/engine/events/RequestPluginsEvent.cpp | 4 +- src/libs/engine/events/RequestPortValueEvent.cpp | 4 +- src/libs/engine/events/SetMetadataEvent.cpp | 6 +- src/libs/engine/events/SetPortValueEvent.cpp | 8 +- src/libs/engine/events/SetPortValueQueuedEvent.cpp | 8 +- src/libs/engine/events/UnregisterClientEvent.cpp | 4 +- src/progs/server/main.cpp | 8 +- 53 files changed, 513 insertions(+), 515 deletions(-) create mode 100644 src/libs/engine/Engine.cpp create mode 100644 src/libs/engine/Engine.h delete mode 100644 src/libs/engine/Ingen.cpp delete mode 100644 src/libs/engine/Ingen.h diff --git a/src/libs/engine/AlsaMidiDriver.cpp b/src/libs/engine/AlsaMidiDriver.cpp index 76d11ddb..f609ac52 100644 --- a/src/libs/engine/AlsaMidiDriver.cpp +++ b/src/libs/engine/AlsaMidiDriver.cpp @@ -18,9 +18,9 @@ #include #include #include -#include "Ingen.h" +#include "Engine.h" #include "types.h" -#include "Ingen.h" +#include "Engine.h" #include "Maid.h" #include "AudioDriver.h" #include "MidiMessage.h" @@ -119,7 +119,7 @@ void AlsaMidiPort::event(snd_seq_event_t* const ev) { // Abuse the tick field to hold the timestamp - ev->time.tick = Ingen::instance().audio_driver()->time_stamp(); + ev->time.tick = Engine::instance().audio_driver()->time_stamp(); // Fix noteons with velocity 0 (required for DSSI spec) if (ev->type == SND_SEQ_EVENT_NOTEON && ev->data.note.velocity == 0) @@ -232,7 +232,7 @@ AlsaMidiDriver::activate() bool success = false; m_midi_thread_exit_flag = false; - //if (Ingen::instance().audio_driver()->is_realtime()) { + //if (Engine::instance().audio_driver()->is_realtime()) { pthread_attr_t attr; pthread_attr_init(&attr); @@ -267,7 +267,7 @@ AlsaMidiDriver::activate() } #ifdef HAVE_LASH - Ingen::instance().lash_driver()->set_alsa_client_id(snd_seq_client_id(m_seq_handle)); + Engine::instance().lash_driver()->set_alsa_client_id(snd_seq_client_id(m_seq_handle)); #endif m_is_activated = true; diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp index b6caf962..4dc992db 100644 --- a/src/libs/engine/ClientBroadcaster.cpp +++ b/src/libs/engine/ClientBroadcaster.cpp @@ -18,7 +18,7 @@ #include #include #include -#include "Ingen.h" +#include "Engine.h" #include "ObjectStore.h" #include "NodeFactory.h" #include "util.h" @@ -133,9 +133,9 @@ ClientBroadcaster::send_error(const string& msg) void ClientBroadcaster::send_plugins_to(ClientInterface* client) { - Ingen::instance().node_factory()->lock_plugin_list(); + Engine::instance().node_factory()->lock_plugin_list(); - const list& plugs = Ingen::instance().node_factory()->plugins(); + const list& plugs = Engine::instance().node_factory()->plugins(); const Plugin* plugin; lo_timetag tt; @@ -175,7 +175,7 @@ ClientBroadcaster::send_plugins_to(ClientInterface* client) for (list::const_iterator i = msgs.begin(); i != msgs.end(); ++i) lo_message_free(*i); - Ingen::instance().node_factory()->unlock_plugin_list(); + Engine::instance().node_factory()->unlock_plugin_list(); } diff --git a/src/libs/engine/DSSINode.cpp b/src/libs/engine/DSSINode.cpp index 9c866915..c78c8d02 100644 --- a/src/libs/engine/DSSINode.cpp +++ b/src/libs/engine/DSSINode.cpp @@ -17,7 +17,7 @@ #include "DSSINode.h" #include #include -#include "Ingen.h" +#include "Engine.h" #include "ClientBroadcaster.h" #include "interface/ClientInterface.h" #include "InputPort.h" @@ -275,7 +275,7 @@ DSSINode::update_programs(bool send_events) iter->second.find(descriptor->Program)->second != descriptor->Name) { _banks[descriptor->Bank][descriptor->Program] = descriptor->Name; if (send_events) { - Ingen::instance().client_broadcaster()->send_program_add(path(), descriptor->Bank, + Engine::instance().client_broadcaster()->send_program_add(path(), descriptor->Bank, descriptor->Program, descriptor->Name); } @@ -290,7 +290,7 @@ DSSINode::update_programs(bool send_events) set_iter != to_be_deleted.end(); ++set_iter) { _banks[set_iter->first].erase(set_iter->second); if (send_events) - Ingen::instance().client_broadcaster()->send_program_remove(path(), set_iter->first, set_iter->second); + Engine::instance().client_broadcaster()->send_program_remove(path(), set_iter->first, set_iter->second); if (_banks[set_iter->first].size() == 0) _banks.erase(set_iter->first); } diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp new file mode 100644 index 00000000..75c544ac --- /dev/null +++ b/src/libs/engine/Engine.cpp @@ -0,0 +1,208 @@ +/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public 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 "Engine.h" +#include "config.h" +#include "tuning.h" +#include +#include +#include +#include "Event.h" +#include "util/Queue.h" +#include "JackAudioDriver.h" +#include "NodeFactory.h" +#include "OSCReceiver.h" +#include "ClientBroadcaster.h" +#include "Patch.h" +#include "ObjectStore.h" +#include "MaidObject.h" +#include "Maid.h" +#include "MidiDriver.h" +#include "QueuedEventSource.h" +#include "PostProcessor.h" +#include "CreatePatchEvent.h" +#include "EnablePatchEvent.h" +#ifdef HAVE_JACK_MIDI +#include "JackMidiDriver.h" +#endif +#ifdef HAVE_ALSA_MIDI +#include "AlsaMidiDriver.h" +#endif +#ifdef HAVE_LASH +#include "LashDriver.h" +#endif +using std::cout; using std::cerr; using std::endl; + +namespace Ingen { + + +Engine* Engine::m_instance = NULL; + + +void +Engine::instantiate(const char* port, AudioDriver* audio_driver) +{ + assert(!m_instance); + m_instance = new Engine(port, audio_driver); +} + + +Engine::Engine(const char* port, AudioDriver* audio_driver) +: m_audio_driver( (audio_driver) ? audio_driver : new JackAudioDriver() ), + m_osc_receiver(new OSCReceiver(pre_processor_queue_size, port)), +#ifdef HAVE_JACK_MIDI + m_midi_driver(new JackMidiDriver(((JackAudioDriver*)m_audio_driver)->jack_client())), +#elif HAVE_ALSA_MIDI + m_midi_driver(new AlsaMidiDriver()), +#else + m_midi_driver(new DummyMidiDriver()), +#endif + m_post_processor(new PostProcessor(post_processor_queue_size)), + m_maid(new Maid(maid_queue_size)), + m_client_broadcaster(new ClientBroadcaster()), + m_object_store(new ObjectStore()), + m_node_factory(new NodeFactory()), +#ifdef HAVE_LASH + m_lash_driver(new LashDriver()), +#else + m_lash_driver(NULL), +#endif + m_quit_flag(false), + m_activated(false) +{ + m_osc_receiver->activate(); +} + + +Engine::~Engine() +{ + deactivate(); + + for (Tree::iterator i = m_object_store->objects().begin(); + i != m_object_store->objects().end(); ++i) { + if ((*i)->parent() == NULL) + delete (*i); + } + + delete m_object_store; + delete m_client_broadcaster; + delete m_osc_receiver; + delete m_node_factory; + delete m_midi_driver; + delete m_audio_driver; + + delete m_maid; + + munlockall(); +} + + +/* driver() template specializations. + * Due to the lack of RTTI, this needs to be implemented manually like this. + * If more types/drivers start getting added, it may be worth it to enable + * RTTI and put all the drivers into a map with typeid's as the key. That's + * more elegant and extensible, but this is faster and simpler - for now. + */ +template<> +Driver* Engine::driver() { return m_midi_driver; } +template<> +Driver* Engine::driver() { return m_audio_driver; } + + +int +Engine::main() +{ + // Loop until quit flag is set (by OSCReceiver) + while ( ! m_quit_flag) { + nanosleep(&main_rate, NULL); +#ifdef HAVE_LASH + // Process any pending LASH events + if (lash_driver->enabled()) + lash_driver->process_events(); +#endif + // Run the maid (garbage collector) + m_maid->cleanup(); + } + cout << "[Main] Done main loop." << endl; + + if (m_activated) + deactivate(); + + sleep(1); + cout << "[Main] Exiting..." << endl; + + return 0; +} + + +void +Engine::activate() +{ + if (m_activated) + return; + + // Create root patch + CreatePatchEvent create_ev(CountedPtr(new Responder()), 0, "/", 1); + create_ev.pre_process(); + create_ev.execute(0); + create_ev.post_process(); + EnablePatchEvent enable_ev(CountedPtr(new Responder()), 0, "/"); + enable_ev.pre_process(); + enable_ev.execute(0); + enable_ev.post_process(); + + assert(m_audio_driver->root_patch() != NULL); + + m_audio_driver->activate(); +#ifdef HAVE_ALSA_MIDI + m_midi_driver->activate(); +#endif + + m_post_processor->start(); + + m_activated = true; +} + + +void +Engine::deactivate() +{ + if (!m_activated) + return; + + m_audio_driver->root_patch()->process(false); + m_audio_driver->root_patch()->deactivate(); + + /*for (Tree::iterator i = m_object_store->objects().begin(); + i != m_object_store->objects().end(); ++i) + if ((*i)->as_node() != NULL && (*i)->as_node()->parent() == NULL) + (*i)->as_node()->deactivate();*/ + + if (m_midi_driver != NULL) + m_midi_driver->deactivate(); + + m_osc_receiver->deactivate(); + m_audio_driver->deactivate(); + + // Finalize any lingering events (unlikely) + m_post_processor->whip(); + m_post_processor->stop(); + + m_activated = false; +} + + +} // namespace Ingen diff --git a/src/libs/engine/Engine.h b/src/libs/engine/Engine.h new file mode 100644 index 00000000..f6cfe9e9 --- /dev/null +++ b/src/libs/engine/Engine.h @@ -0,0 +1,105 @@ +/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License 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 + +template class Queue; +class Maid; + +namespace Ingen { + +class AudioDriver; +class MidiDriver; +class NodeFactory; +class OSCReceiver; +class ClientBroadcaster; +class Patch; +class ObjectStore; +class EventSource; +class PostProcessor; +class Event; +class QueuedEvent; +class LashDriver; +template class Driver; + + +/** The main class for Ingen, the whole engine basically lives in here + * + * A singleton, but shouldn't be (FIXME). Explicitly instantiated singleton + * to be exact - call instantiate before instance or suffer horrible death. + * + * \ingroup engine + */ +class Engine +{ +public: + ~Engine(); + + static void instantiate(const char* port, AudioDriver* audio_driver = 0); + static Engine& instance() { assert(m_instance); return *m_instance; } + + int main(); + + /** Set the quit flag that should kill all threads and exit cleanly. + * Note that it will take some time. */ + void quit() { m_quit_flag = true; } + + void activate(); + void deactivate(); + + AudioDriver* audio_driver() const { return m_audio_driver; } + OSCReceiver* osc_receiver() const { return m_osc_receiver; } + MidiDriver* midi_driver() const { return m_midi_driver; } + PostProcessor* post_processor() const { return m_post_processor; } + Maid* maid() const { return m_maid; } + ClientBroadcaster* client_broadcaster() const { return m_client_broadcaster; } + ObjectStore* object_store() const { return m_object_store; } + NodeFactory* node_factory() const { return m_node_factory; } + LashDriver* lash_driver() const { return m_lash_driver; } + + /** Return the active driver for the given (template parameter) type */ + template Driver* driver(); + +private: + Engine(const char* port, AudioDriver* audio_driver = 0); + + // Prevent copies (undefined) + Engine(const Engine&); + Engine& operator=(const Engine&); + + static Engine* m_instance; + + AudioDriver* m_audio_driver; + OSCReceiver* m_osc_receiver; + MidiDriver* m_midi_driver; + PostProcessor* m_post_processor; + Maid* m_maid; + ClientBroadcaster* m_client_broadcaster; + ObjectStore* m_object_store; + NodeFactory* m_node_factory; + LashDriver* m_lash_driver; + + bool m_quit_flag; + bool m_activated; +}; + + +} // namespace Ingen + +#endif // ENGINE_H diff --git a/src/libs/engine/Ingen.cpp b/src/libs/engine/Ingen.cpp deleted file mode 100644 index 695a0be5..00000000 --- a/src/libs/engine/Ingen.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public 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 "Ingen.h" -#include "config.h" -#include "tuning.h" -#include -#include -#include -#include "Event.h" -#include "util/Queue.h" -#include "JackAudioDriver.h" -#include "NodeFactory.h" -#include "OSCReceiver.h" -#include "ClientBroadcaster.h" -#include "Patch.h" -#include "ObjectStore.h" -#include "MaidObject.h" -#include "Maid.h" -#include "MidiDriver.h" -#include "QueuedEventSource.h" -#include "PostProcessor.h" -#include "CreatePatchEvent.h" -#include "EnablePatchEvent.h" -#ifdef HAVE_JACK_MIDI -#include "JackMidiDriver.h" -#endif -#ifdef HAVE_ALSA_MIDI -#include "AlsaMidiDriver.h" -#endif -#ifdef HAVE_LASH -#include "LashDriver.h" -#endif -using std::cout; using std::cerr; using std::endl; - -namespace Ingen { - - -Ingen* Ingen::m_instance = NULL; - - -void -Ingen::instantiate(const char* port, AudioDriver* audio_driver) -{ - assert(!m_instance); - m_instance = new Ingen(port, audio_driver); -} - - -Ingen::Ingen(const char* port, AudioDriver* audio_driver) -: m_audio_driver( (audio_driver) ? audio_driver : new JackAudioDriver() ), - m_osc_receiver(new OSCReceiver(pre_processor_queue_size, port)), -#ifdef HAVE_JACK_MIDI - m_midi_driver(new JackMidiDriver(((JackAudioDriver*)m_audio_driver)->jack_client())), -#elif HAVE_ALSA_MIDI - m_midi_driver(new AlsaMidiDriver()), -#else - m_midi_driver(new DummyMidiDriver()), -#endif - m_post_processor(new PostProcessor(post_processor_queue_size)), - m_maid(new Maid(maid_queue_size)), - m_client_broadcaster(new ClientBroadcaster()), - m_object_store(new ObjectStore()), - m_node_factory(new NodeFactory()), -#ifdef HAVE_LASH - m_lash_driver(new LashDriver()), -#else - m_lash_driver(NULL), -#endif - m_quit_flag(false), - m_activated(false) -{ - m_osc_receiver->activate(); -} - - -Ingen::~Ingen() -{ - deactivate(); - - for (Tree::iterator i = m_object_store->objects().begin(); - i != m_object_store->objects().end(); ++i) { - if ((*i)->parent() == NULL) - delete (*i); - } - - delete m_object_store; - delete m_client_broadcaster; - delete m_osc_receiver; - delete m_node_factory; - delete m_midi_driver; - delete m_audio_driver; - - delete m_maid; - - munlockall(); -} - - -/* driver() template specializations. - * Due to the lack of RTTI, this needs to be implemented manually like this. - * If more types/drivers start getting added, it may be worth it to enable - * RTTI and put all the drivers into a map with typeid's as the key. That's - * more elegant and extensible, but this is faster and simpler - for now. - */ -template<> -Driver* Ingen::driver() { return m_midi_driver; } -template<> -Driver* Ingen::driver() { return m_audio_driver; } - - -int -Ingen::main() -{ - // Loop until quit flag is set (by OSCReceiver) - while ( ! m_quit_flag) { - nanosleep(&main_rate, NULL); -#ifdef HAVE_LASH - // Process any pending LASH events - if (lash_driver->enabled()) - lash_driver->process_events(); -#endif - // Run the maid (garbage collector) - m_maid->cleanup(); - } - cout << "[Main] Done main loop." << endl; - - if (m_activated) - deactivate(); - - sleep(1); - cout << "[Main] Exiting..." << endl; - - return 0; -} - - -void -Ingen::activate() -{ - if (m_activated) - return; - - // Create root patch - CreatePatchEvent create_ev(CountedPtr(new Responder()), 0, "/", 1); - create_ev.pre_process(); - create_ev.execute(0); - create_ev.post_process(); - EnablePatchEvent enable_ev(CountedPtr(new Responder()), 0, "/"); - enable_ev.pre_process(); - enable_ev.execute(0); - enable_ev.post_process(); - - assert(m_audio_driver->root_patch() != NULL); - - m_audio_driver->activate(); -#ifdef HAVE_ALSA_MIDI - m_midi_driver->activate(); -#endif - - m_post_processor->start(); - - m_activated = true; -} - - -void -Ingen::deactivate() -{ - if (!m_activated) - return; - - m_audio_driver->root_patch()->process(false); - m_audio_driver->root_patch()->deactivate(); - - /*for (Tree::iterator i = m_object_store->objects().begin(); - i != m_object_store->objects().end(); ++i) - if ((*i)->as_node() != NULL && (*i)->as_node()->parent() == NULL) - (*i)->as_node()->deactivate();*/ - - if (m_midi_driver != NULL) - m_midi_driver->deactivate(); - - m_osc_receiver->deactivate(); - m_audio_driver->deactivate(); - - // Finalize any lingering events (unlikely) - m_post_processor->whip(); - m_post_processor->stop(); - - m_activated = false; -} - - -} // namespace Ingen diff --git a/src/libs/engine/Ingen.h b/src/libs/engine/Ingen.h deleted file mode 100644 index b0e1f947..00000000 --- a/src/libs/engine/Ingen.h +++ /dev/null @@ -1,107 +0,0 @@ -/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. - * - * Ingen is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef OMAPP_H -#define OMAPP_H - -#include - -template class Queue; -class Maid; - -namespace Ingen { - -class AudioDriver; -class MidiDriver; -class NodeFactory; -class OSCReceiver; -class ClientBroadcaster; -class Patch; -class ObjectStore; -class EventSource; -class PostProcessor; -class Event; -class QueuedEvent; -class LashDriver; -template class Driver; - - -/** The main class for Ingen, the whole engine basically lives in here - * - * A singleton, but shouldn't be (FIXME). Explicitly instantiated singleton - * to be exact - call instantiate before instance or suffer horrible death. - * - * \ingroup engine - */ -class Ingen -{ -public: - ~Ingen(); - - static void instantiate(const char* port, AudioDriver* audio_driver = 0); - static Ingen& instance() { assert(m_instance); return *m_instance; } - - int main(); - - /** Set the quit flag that should kill all threads and exit cleanly. - * Note that it will take some time. */ - void quit() { m_quit_flag = true; } - - void activate(); - void deactivate(); - - AudioDriver* audio_driver() const { return m_audio_driver; } - OSCReceiver* osc_receiver() const { return m_osc_receiver; } - MidiDriver* midi_driver() const { return m_midi_driver; } - PostProcessor* post_processor() const { return m_post_processor; } - Maid* maid() const { return m_maid; } - ClientBroadcaster* client_broadcaster() const { return m_client_broadcaster; } - ObjectStore* object_store() const { return m_object_store; } - NodeFactory* node_factory() const { return m_node_factory; } - LashDriver* lash_driver() const { return m_lash_driver; } - - - /** Return the active driver for the given (template parameter) type. - * This is a hook for BridgeNode. See Ingen.cpp for specializations. */ - template Driver* driver(); - -private: - Ingen(const char* port, AudioDriver* audio_driver = 0); - - // Prevent copies - Ingen(const Ingen&); - Ingen& operator=(const Ingen&); - - static Ingen* m_instance; - - AudioDriver* m_audio_driver; - OSCReceiver* m_osc_receiver; - MidiDriver* m_midi_driver; - PostProcessor* m_post_processor; - Maid* m_maid; - ClientBroadcaster* m_client_broadcaster; - ObjectStore* m_object_store; - NodeFactory* m_node_factory; - LashDriver* m_lash_driver; - - bool m_quit_flag; - bool m_activated; -}; - - -} // namespace Ingen - -#endif // OMAPP_H diff --git a/src/libs/engine/JackAudioDriver.cpp b/src/libs/engine/JackAudioDriver.cpp index aba00f7c..8f5c788a 100644 --- a/src/libs/engine/JackAudioDriver.cpp +++ b/src/libs/engine/JackAudioDriver.cpp @@ -19,7 +19,7 @@ #include "tuning.h" #include #include -#include "Ingen.h" +#include "Engine.h" #include "util.h" #include "Event.h" #include "QueuedEvent.h" @@ -182,7 +182,7 @@ JackAudioDriver::activate() } else { cout << "[JackAudioDriver] Activated Jack client." << endl; #ifdef HAVE_LASH - Ingen::instance().lash_driver()->set_jack_client_name(jack_client_get_name(m_client)); + Engine::instance().lash_driver()->set_jack_client_name(jack_client_get_name(m_client)); #endif } } @@ -192,7 +192,7 @@ void JackAudioDriver::deactivate() { if (m_is_activated) { - Ingen::instance().osc_receiver()->deactivate(); + Engine::instance().osc_receiver()->deactivate(); jack_deactivate(m_client); m_is_activated = false; @@ -204,7 +204,7 @@ JackAudioDriver::deactivate() cout << "[JackAudioDriver] Deactivated Jack client." << endl; - Ingen::instance().post_processor()->stop(); + Engine::instance().post_processor()->stop(); } } @@ -277,26 +277,26 @@ JackAudioDriver::process_events(jack_nframes_t block_start, jack_nframes_t block /* FIXME: Merge these next two loops into one */ // FIXME - while ((ev = Ingen::instance().osc_receiver()->pop_earliest_queued_before(block_end))) { + while ((ev = Engine::instance().osc_receiver()->pop_earliest_queued_before(block_end))) { ev->execute(0); // QueuedEvents are not sample accurate - Ingen::instance().post_processor()->push(ev); + Engine::instance().post_processor()->push(ev); if (++num_events_processed > MAX_QUEUED_EVENTS) break; } - while ((ev = Ingen::instance().osc_receiver()->pop_earliest_stamped_before(block_end))) { + while ((ev = Engine::instance().osc_receiver()->pop_earliest_stamped_before(block_end))) { if (ev->time_stamp() >= block_start) offset = ev->time_stamp() - block_start; else offset = 0; ev->execute(offset); - Ingen::instance().post_processor()->push(ev); + Engine::instance().post_processor()->push(ev); ++num_events_processed; } if (num_events_processed > 0) - Ingen::instance().post_processor()->whip(); + Engine::instance().post_processor()->whip(); } @@ -329,7 +329,7 @@ JackAudioDriver::m_process_cb(jack_nframes_t nframes) m_transport_state = jack_transport_query(m_client, &m_position); process_events(start_of_last_cycle, start_of_current_cycle); - Ingen::instance().midi_driver()->prepare_block(start_of_last_cycle, start_of_current_cycle); + Engine::instance().midi_driver()->prepare_block(start_of_last_cycle, start_of_current_cycle); // Set buffers of patch ports to Jack port buffers (zero-copy processing) for (List::iterator i = m_ports.begin(); i != m_ports.end(); ++i) @@ -347,7 +347,7 @@ void JackAudioDriver::m_shutdown_cb() { cout << "[JackAudioDriver] Jack shutdown. Exiting." << endl; - Ingen::instance().quit(); + Engine::instance().quit(); } diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index fbd11a16..b4b0ec45 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -19,8 +19,8 @@ libingen_la_SOURCES = \ Patch.cpp \ NodeFactory.h \ NodeFactory.cpp \ - Ingen.h \ - Ingen.cpp \ + Engine.h \ + Engine.cpp \ JackAudioDriver.h \ JackAudioDriver.cpp \ OSCReceiver.h \ diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp index 4c6c3a5f..cd483bc7 100644 --- a/src/libs/engine/MidiControlNode.cpp +++ b/src/libs/engine/MidiControlNode.cpp @@ -16,7 +16,7 @@ #include "MidiControlNode.h" #include -#include "Ingen.h" +#include "Engine.h" #include "PostProcessor.h" #include "MidiLearnEvent.h" #include "InputPort.h" @@ -92,8 +92,8 @@ MidiControlNode::control(uchar control_num, uchar val, SampleCount offset) assert(_param_port->buffer(0)->value_at(0) == control_num); _learn_event->set_value(control_num); _learn_event->execute(offset); - Ingen::instance().post_processor()->push(_learn_event); - Ingen::instance().post_processor()->whip(); + Engine::instance().post_processor()->push(_learn_event); + Engine::instance().post_processor()->whip(); _learning = false; _learn_event = NULL; } diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp index a84ebfd7..f13b054a 100644 --- a/src/libs/engine/MidiNoteNode.cpp +++ b/src/libs/engine/MidiNoteNode.cpp @@ -17,7 +17,7 @@ #include "MidiNoteNode.h" #include #include -#include "Ingen.h" +#include "Engine.h" #include "MidiMessage.h" #include "InputPort.h" #include "OutputPort.h" @@ -117,7 +117,7 @@ void MidiNoteNode::note_on(uchar note_num, uchar velocity, SampleCount offset) { // FIXME: this is stupid.. - const jack_nframes_t time_stamp = Ingen::instance().audio_driver()->time_stamp(); + const jack_nframes_t time_stamp = Engine::instance().audio_driver()->time_stamp(); assert(offset < _buffer_size); assert(note_num <= 127); diff --git a/src/libs/engine/NodeBase.cpp b/src/libs/engine/NodeBase.cpp index ce58fd8b..80ceb6ef 100644 --- a/src/libs/engine/NodeBase.cpp +++ b/src/libs/engine/NodeBase.cpp @@ -19,7 +19,7 @@ #include #include #include "util.h" -#include "Ingen.h" +#include "Engine.h" #include "Array.h" #include "Plugin.h" #include "ClientBroadcaster.h" @@ -84,16 +84,16 @@ void NodeBase::send_creation_messages(ClientInterface* client) const { cerr << "FIXME: send_creation\n"; - //Ingen::instance().client_broadcaster()->send_node_to(client, this); + //Engine::instance().client_broadcaster()->send_node_to(client, this); } */ void NodeBase::add_to_store() { - Ingen::instance().object_store()->add(this); + Engine::instance().object_store()->add(this); for (size_t i=0; i < num_ports(); ++i) - Ingen::instance().object_store()->add(_ports->at(i)); + Engine::instance().object_store()->add(_ports->at(i)); } @@ -101,17 +101,17 @@ void NodeBase::remove_from_store() { // Remove self - TreeNode* node = Ingen::instance().object_store()->remove(path()); + TreeNode* node = Engine::instance().object_store()->remove(path()); if (node != NULL) { - assert(Ingen::instance().object_store()->find(path()) == NULL); + assert(Engine::instance().object_store()->find(path()) == NULL); delete node; } // Remove ports for (size_t i=0; i < num_ports(); ++i) { - node = Ingen::instance().object_store()->remove(_ports->at(i)->path()); + node = Engine::instance().object_store()->remove(_ports->at(i)->path()); if (node != NULL) { - assert(Ingen::instance().object_store()->find(_ports->at(i)->path()) == NULL); + assert(Engine::instance().object_store()->find(_ports->at(i)->path()) == NULL); delete node; } } @@ -145,23 +145,23 @@ NodeBase::set_path(const Path& new_path) // Reinsert ports for (size_t i=0; i < num_ports(); ++i) { - treenode = Ingen::instance().object_store()->remove(old_path +"/"+ _ports->at(i)->name()); + treenode = Engine::instance().object_store()->remove(old_path +"/"+ _ports->at(i)->name()); assert(treenode != NULL); assert(treenode->node() == _ports->at(i)); treenode->key(new_path +"/" + _ports->at(i)->name()); - Ingen::instance().object_store()->add(treenode); + Engine::instance().object_store()->add(treenode); } // Rename and reinsert self - treenode = Ingen::instance().object_store()->remove(old_path); + treenode = Engine::instance().object_store()->remove(old_path); assert(treenode != NULL); assert(treenode->node() == this); GraphObject::set_path(new_path); treenode->key(new_path); - Ingen::instance().object_store()->add(treenode); + Engine::instance().object_store()->add(treenode); - assert(Ingen::instance().object_store()->find(new_path) == this); + assert(Engine::instance().object_store()->find(new_path) == this); } diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp index 68bf4c40..c2962e19 100644 --- a/src/libs/engine/NodeFactory.cpp +++ b/src/libs/engine/NodeFactory.cpp @@ -22,7 +22,7 @@ #include #include #include -#include "Ingen.h" +#include "Engine.h" #include "AudioDriver.h" #include "MidiNoteNode.h" #include "MidiTriggerNode.h" @@ -218,40 +218,40 @@ NodeFactory::load_internal_plugin(const string& uri, const string& name, size_t string plug_label = uri.substr(3); /*if (plug_label == "midi_input") { - MidiInputNode* tn = new MidiInputNode(name, 1, parent, Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); + MidiInputNode* tn = new MidiInputNode(name, 1, parent, Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size()); return tn; } else if (plug_label == "midi_output") { - MidiOutputNode* tn = new MidiOutputNode(name, 1, parent, Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); + MidiOutputNode* tn = new MidiOutputNode(name, 1, parent, Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size()); return tn; } else if (plug_label == "audio_input") { AudioInputNode* in = new AudioInputNode(name, poly, parent, - Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); + Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size()); return in; } else if (plug_label == "control_input") { ControlInputNode* in = new ControlInputNode(name, poly, parent, - Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); + Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size()); return in; } else if (plug_label == "audio_output") { AudioOutputNode* on = new AudioOutputNode(name, poly, parent, - Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); + Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size()); return on; } else if (plug_label == "control_output") { ControlOutputNode* on = new ControlOutputNode(name, poly, parent, - Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); + Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size()); return on; } else */ if (plug_label == "note_in" || plug_label == "midi_note_in") { - MidiNoteNode* mn = new MidiNoteNode(name, poly, parent, Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); + MidiNoteNode* mn = new MidiNoteNode(name, poly, parent, Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size()); return mn; } else if (plug_label == "trigger_in" || plug_label == "midi_trigger_in") { - MidiTriggerNode* mn = new MidiTriggerNode(name, 1, parent, Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); + MidiTriggerNode* mn = new MidiTriggerNode(name, 1, parent, Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size()); return mn; } else if (plug_label == "midi_control_in") { - MidiControlNode* mn = new MidiControlNode(name, 1, parent, Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); + MidiControlNode* mn = new MidiControlNode(name, 1, parent, Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size()); return mn; } else if (plug_label == "transport") { - TransportNode* tn = new TransportNode(name, 1, parent, Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); + TransportNode* tn = new TransportNode(name, 1, parent, Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size()); return tn; } else { cerr << "Unknown internal plugin type '" << plug_label << "'" << endl; @@ -334,7 +334,7 @@ NodeFactory::load_lv2_plugin(const string& plug_uri, if (plugin) { n = new LV2Node(plugin, node_name, poly, parent, - Ingen::Ingen::instance().audio_driver()->sample_rate(), Ingen::Ingen::instance().audio_driver()->buffer_size()); + Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size()); bool success = ((LV2Node*)n)->instantiate(); if (!success) { delete n; @@ -510,7 +510,7 @@ NodeFactory::load_dssi_plugin(const string& uri, } n = new DSSINode(plugin, name, poly, parent, descriptor, - Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); + Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size()); bool success = ((DSSINode*)n)->instantiate(); if (!success) { delete n; @@ -677,7 +677,7 @@ NodeFactory::load_ladspa_plugin(const string& uri, } n = new LADSPANode(plugin, name, poly, parent, descriptor, - Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); + Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size()); bool success = ((LADSPANode*)n)->instantiate(); if (!success) { delete n; diff --git a/src/libs/engine/OSCClient.cpp b/src/libs/engine/OSCClient.cpp index b1489288..acc56cdf 100644 --- a/src/libs/engine/OSCClient.cpp +++ b/src/libs/engine/OSCClient.cpp @@ -134,9 +134,9 @@ OSCClient::num_plugins(uint32_t num) void OSCClient::plugins() { - Ingen::instance().node_factory()->lock_plugin_list(); + Engine::instance().node_factory()->lock_plugin_list(); - const list& plugs = Ingen::instance().node_factory()->plugins(); + const list& plugs = Engine::instance().node_factory()->plugins(); const Plugin* plugin; lo_timetag tt; @@ -175,7 +175,7 @@ OSCClient::plugins() for (list::const_iterator i = msgs.begin(); i != msgs.end(); ++i) lo_message_free(*i); - Ingen::instance().node_factory()->unlock_plugin_list(); + Engine::instance().node_factory()->unlock_plugin_list(); } */ @@ -472,8 +472,8 @@ OSCClient::object_renamed(const string& old_path, const string& new_path) void OSCClient::all_objects() { - for (Tree::iterator i = Ingen::instance().object_store()->objects().begin(); - i != Ingen::instance().object_store()->objects().end(); ++i) + for (Tree::iterator i = Engine::instance().object_store()->objects().begin(); + i != Engine::instance().object_store()->objects().end(); ++i) if ((*i)->as_node() != NULL && (*i)->parent() == NULL) (*i)->as_node()->send_creation_messages(this); } diff --git a/src/libs/engine/OSCResponder.cpp b/src/libs/engine/OSCResponder.cpp index 76e48fe4..2fd68540 100644 --- a/src/libs/engine/OSCResponder.cpp +++ b/src/libs/engine/OSCResponder.cpp @@ -15,7 +15,7 @@ */ #include "OSCResponder.h" -#include "Ingen.h" +#include "Engine.h" #include "ClientBroadcaster.h" #include "interface/ClientKey.h" #include @@ -54,7 +54,7 @@ OSCResponder::~OSCResponder() CountedPtr OSCResponder::find_client() { - return Ingen::instance().client_broadcaster()->client(ClientKey(ClientKey::OSC_URL, _url)); + return Engine::instance().client_broadcaster()->client(ClientKey(ClientKey::OSC_URL, _url)); } diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index 8650b5cf..3055217c 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -16,7 +16,7 @@ #include "ObjectSender.h" #include "interface/ClientInterface.h" -#include "Ingen.h" +#include "Engine.h" #include "ObjectStore.h" #include "Patch.h" #include "Node.h" @@ -32,11 +32,11 @@ namespace Ingen { void ObjectSender::send_all(ClientInterface* client) { - Patch* root = Ingen::instance().object_store()->find_patch("/"); + Patch* root = Engine::instance().object_store()->find_patch("/"); assert(root); send_patch(client, root); - /*for (Tree::iterator i = Ingen::instance().object_store()->objects().begin(); - i != Ingen::instance().object_store()->objects().end(); ++i) + /*for (Tree::iterator i = Engine::instance().object_store()->objects().begin(); + i != Engine::instance().object_store()->objects().end(); ++i) if ((*i)->as_patch() != NULL && (*i)->parent() == NULL) send_patch(client, (*i)->as_patch());*/ //(*i)->as_node()->send_creation_messages(client); @@ -175,9 +175,9 @@ ObjectSender::send_port(ClientInterface* client, const Port* port) void ObjectSender::send_plugins(ClientInterface* client) { - Ingen::instance().node_factory()->lock_plugin_list(); + Engine::instance().node_factory()->lock_plugin_list(); - const list& plugs = Ingen::instance().node_factory()->plugins(); + const list& plugs = Engine::instance().node_factory()->plugins(); /* lo_timetag tt; @@ -221,7 +221,7 @@ ObjectSender::send_plugins(ClientInterface* client) for (list::const_iterator i = msgs.begin(); i != msgs.end(); ++i) lo_message_free(*i); */ - Ingen::instance().node_factory()->unlock_plugin_list(); + Engine::instance().node_factory()->unlock_plugin_list(); } diff --git a/src/libs/engine/OmInProcess.cpp b/src/libs/engine/OmInProcess.cpp index 73d96946..2096204e 100644 --- a/src/libs/engine/OmInProcess.cpp +++ b/src/libs/engine/OmInProcess.cpp @@ -19,7 +19,7 @@ #include #include #include -#include "Ingen.h" +#include "Engine.h" #include "OSCReceiver.h" #include "JackAudioDriver.h" #ifdef HAVE_LASH @@ -36,7 +36,7 @@ extern "C" void* run_main(void* arg) { - Ingen::Ingen::instance().main(); + Engine::instance().main(); // FIXME: cleanup @@ -50,7 +50,7 @@ pthread_t main_thread; int jack_initialize(jack_client_t* client, const char* load_init) { - if ((Ingen::om = new Ingen::Ingen(load_init, new Ingen::JackAudioDriver(client))) != NULL) { + if ((Ingen::om = new Engine(load_init, new Ingen::JackAudioDriver(client))) != NULL) { pthread_create(&main_thread, NULL, run_main, NULL); return 0; // Success } else { @@ -63,7 +63,7 @@ void jack_finish(void* arg) { void* ret; - Ingen::Ingen::instance().quit(); + Engine::instance().quit(); pthread_join(main_thread, &ret); } diff --git a/src/libs/engine/PostProcessor.cpp b/src/libs/engine/PostProcessor.cpp index 9ee0fa5c..47a48f21 100644 --- a/src/libs/engine/PostProcessor.cpp +++ b/src/libs/engine/PostProcessor.cpp @@ -18,7 +18,7 @@ #include #include #include -#include "Ingen.h" +#include "Engine.h" #include "Event.h" #include "util/Queue.h" #include "Maid.h" @@ -47,7 +47,7 @@ PostProcessor::_whipped() Event* const ev = _events.pop(); assert(ev); ev->post_process(); - Ingen::instance().maid()->push(ev); + Engine::instance().maid()->push(ev); } } diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp index 97f87076..f9ad8a00 100644 --- a/src/libs/engine/QueuedEngineInterface.cpp +++ b/src/libs/engine/QueuedEngineInterface.cpp @@ -18,7 +18,7 @@ #include "QueuedEventSource.h" #include "events.h" #include "util/Queue.h" -#include "Ingen.h" +#include "Engine.h" #include "AudioDriver.h" namespace Ingen { @@ -33,7 +33,7 @@ QueuedEngineInterface::QueuedEngineInterface(size_t queued_size, size_t stamped_ SampleCount QueuedEngineInterface::now() const { - return Ingen::instance().audio_driver()->time_stamp(); + return Engine::instance().audio_driver()->time_stamp(); } /** Set the Responder to send responses to commands with, once the commands @@ -102,7 +102,7 @@ void QueuedEngineInterface::quit() { _responder->respond_ok(); - Ingen::instance().quit(); + Engine::instance().quit(); } diff --git a/src/libs/engine/TransportNode.cpp b/src/libs/engine/TransportNode.cpp index 4f6abed6..be10dc99 100644 --- a/src/libs/engine/TransportNode.cpp +++ b/src/libs/engine/TransportNode.cpp @@ -22,7 +22,7 @@ #include "JackAudioDriver.h" #include "Port.h" #include "util.h" -//#include "Ingen.h" +//#include "Engine.h" namespace Ingen { @@ -86,8 +86,8 @@ TransportNode::run(size_t nframes) #if 0 // FIXME: this will die horribly with any driver other than jack (in theory) - const jack_position_t* const position = ((JackAudioDriver*)Ingen::instance().audio_driver())->position(); - jack_transport_state_t state = ((JackAudioDriver*)Ingen::instance().audio_driver())->transport_state(); + const jack_position_t* const position = ((JackAudioDriver*)Engine::instance().audio_driver())->position(); + jack_transport_state_t state = ((JackAudioDriver*)Engine::instance().audio_driver())->transport_state(); double bpm = position->beats_per_minute; float bpb = position->beats_per_bar; float spb = 60.0 / bpm; diff --git a/src/libs/engine/events/ActivateEvent.cpp b/src/libs/engine/events/ActivateEvent.cpp index 7de723c3..31a218ad 100644 --- a/src/libs/engine/events/ActivateEvent.cpp +++ b/src/libs/engine/events/ActivateEvent.cpp @@ -16,7 +16,7 @@ #include "ActivateEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" namespace Ingen { @@ -32,7 +32,7 @@ ActivateEvent::pre_process() { QueuedEvent::pre_process(); - Ingen::instance().activate(); + Engine::instance().activate(); } diff --git a/src/libs/engine/events/AddNodeEvent.cpp b/src/libs/engine/events/AddNodeEvent.cpp index 7e5e70a4..4f8d099a 100644 --- a/src/libs/engine/events/AddNodeEvent.cpp +++ b/src/libs/engine/events/AddNodeEvent.cpp @@ -20,7 +20,7 @@ #include "Node.h" #include "Tree.h" #include "Plugin.h" -#include "Ingen.h" +#include "Engine.h" #include "Patch.h" #include "NodeFactory.h" #include "ClientBroadcaster.h" @@ -55,19 +55,19 @@ AddNodeEvent::~AddNodeEvent() void AddNodeEvent::pre_process() { - if (Ingen::instance().object_store()->find(m_path) != NULL) { + if (Engine::instance().object_store()->find(m_path) != NULL) { m_node_already_exists = true; QueuedEvent::pre_process(); return; } - m_patch = Ingen::instance().object_store()->find_patch(m_path.parent()); + m_patch = Engine::instance().object_store()->find_patch(m_path.parent()); if (m_patch != NULL) { if (m_poly) - m_node = Ingen::instance().node_factory()->load_plugin(m_plugin, m_path.name(), m_patch->internal_poly(), m_patch); + m_node = Engine::instance().node_factory()->load_plugin(m_plugin, m_path.name(), m_patch->internal_poly(), m_patch); else - m_node = Ingen::instance().node_factory()->load_plugin(m_plugin, m_path.name(), 1, m_patch); + m_node = Engine::instance().node_factory()->load_plugin(m_plugin, m_path.name(), 1, m_patch); if (m_node != NULL) { m_node->activate(); @@ -94,7 +94,7 @@ AddNodeEvent::execute(SampleCount offset) m_node->add_to_patch(); if (m_patch->process_order() != NULL) - Ingen::instance().maid()->push(m_patch->process_order()); + Engine::instance().maid()->push(m_patch->process_order()); m_patch->process_order(m_process_order); } } @@ -117,8 +117,8 @@ AddNodeEvent::post_process() _responder->respond_error(msg); } else { _responder->respond_ok(); - //Ingen::instance().client_broadcaster()->send_node_creation_messages(m_node); - Ingen::instance().client_broadcaster()->send_node(m_node); + //Engine::instance().client_broadcaster()->send_node_creation_messages(m_node); + Engine::instance().client_broadcaster()->send_node(m_node); } } diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp index 9f6439e8..cf40b45f 100644 --- a/src/libs/engine/events/AddPortEvent.cpp +++ b/src/libs/engine/events/AddPortEvent.cpp @@ -19,7 +19,7 @@ #include "Patch.h" #include "Tree.h" #include "Plugin.h" -#include "Ingen.h" +#include "Engine.h" #include "Patch.h" #include "Maid.h" #include "util/Path.h" @@ -57,21 +57,21 @@ AddPortEvent::AddPortEvent(CountedPtr responder, SampleCount timestam void AddPortEvent::pre_process() { - if (Ingen::instance().object_store()->find(_path) != NULL) { + if (Engine::instance().object_store()->find(_path) != NULL) { QueuedEvent::pre_process(); return; } // FIXME: this is just a mess :/ - _patch = Ingen::instance().object_store()->find_patch(_path.parent()); + _patch = Engine::instance().object_store()->find_patch(_path.parent()); if (_patch != NULL) { assert(_patch->path() == _path.parent()); size_t buffer_size = 1; if (_type == "AUDIO" || _type == "MIDI") - buffer_size = Ingen::instance().audio_driver()->buffer_size(); + buffer_size = Engine::instance().audio_driver()->buffer_size(); _patch_port = _patch->create_port(_path.name(), _data_type, buffer_size, _is_output); if (_patch_port) { @@ -86,14 +86,14 @@ AddPortEvent::pre_process() _ports_array = new Array(_patch->num_ports() + 1, NULL); _ports_array->at(_patch->num_ports()) = _patch_port; - Ingen::instance().object_store()->add(_patch_port); + Engine::instance().object_store()->add(_patch_port); if (!_patch->parent()) { if (_type == "AUDIO") - _driver_port = Ingen::instance().audio_driver()->create_port( + _driver_port = Engine::instance().audio_driver()->create_port( dynamic_cast*>(_patch_port)); else if (_type == "MIDI") - _driver_port = Ingen::instance().midi_driver()->create_port( + _driver_port = Engine::instance().midi_driver()->create_port( dynamic_cast*>(_patch_port)); } } @@ -108,7 +108,7 @@ AddPortEvent::execute(SampleCount offset) QueuedEvent::execute(offset); if (_patch_port) { - Ingen::instance().maid()->push(_patch->external_ports()); + Engine::instance().maid()->push(_patch->external_ports()); //_patch->add_port(_port); _patch->external_ports(_ports_array); } @@ -126,7 +126,7 @@ AddPortEvent::post_process() _responder->respond_error(msg); } else { _responder->respond_ok(); - Ingen::instance().client_broadcaster()->send_port(_patch_port); + Engine::instance().client_broadcaster()->send_port(_patch_port); } } diff --git a/src/libs/engine/events/AllNotesOffEvent.cpp b/src/libs/engine/events/AllNotesOffEvent.cpp index fceb47d6..349c6cd5 100644 --- a/src/libs/engine/events/AllNotesOffEvent.cpp +++ b/src/libs/engine/events/AllNotesOffEvent.cpp @@ -16,7 +16,7 @@ #include "AllNotesOffEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "ObjectStore.h" namespace Ingen { @@ -45,7 +45,7 @@ void AllNotesOffEvent::execute(SampleCount offset) { if (m_patch == NULL && m_patch_path != "") - m_patch = Ingen::instance().object_store()->find_patch(m_patch_path); + m_patch = Engine::instance().object_store()->find_patch(m_patch_path); //if (m_patch != NULL) // for (List::iterator j = m_patch->midi_in_nodes().begin(); j != m_patch->midi_in_nodes().end(); ++j) diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp index c6e1d36c..3cd8faab 100644 --- a/src/libs/engine/events/ClearPatchEvent.cpp +++ b/src/libs/engine/events/ClearPatchEvent.cpp @@ -16,7 +16,7 @@ #include "ClearPatchEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "Patch.h" #include "ClientBroadcaster.h" #include "util.h" @@ -42,7 +42,7 @@ ClearPatchEvent::ClearPatchEvent(CountedPtr responder, SampleCount ti void ClearPatchEvent::pre_process() { - m_patch = Ingen::instance().object_store()->find_patch(m_patch_path); + m_patch = Engine::instance().object_store()->find_patch(m_patch_path); if (m_patch != NULL) { @@ -66,7 +66,7 @@ ClearPatchEvent::execute(SampleCount offset) (*i)->remove_from_patch(); if (m_patch->process_order() != NULL) { - Ingen::instance().maid()->push(m_patch->process_order()); + Engine::instance().maid()->push(m_patch->process_order()); m_patch->process_order(NULL); } } @@ -100,7 +100,7 @@ ClearPatchEvent::post_process() // Reply _responder->respond_ok(); - Ingen::instance().client_broadcaster()->send_patch_cleared(m_patch_path); + Engine::instance().client_broadcaster()->send_patch_cleared(m_patch_path); } else { _responder->respond_error(string("Patch ") + m_patch_path + " not found"); } diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp index 27da617d..bf64df0a 100644 --- a/src/libs/engine/events/ConnectionEvent.cpp +++ b/src/libs/engine/events/ConnectionEvent.cpp @@ -18,7 +18,7 @@ #include #include "Responder.h" #include "types.h" -#include "Ingen.h" +#include "Engine.h" #include "TypedConnection.h" #include "InputPort.h" #include "OutputPort.h" @@ -66,7 +66,7 @@ ConnectionEvent::pre_process() return; } - /*m_patch = Ingen::instance().object_store()->find_patch(m_src_port_path.parent().parent()); + /*m_patch = Engine::instance().object_store()->find_patch(m_src_port_path.parent().parent()); if (m_patch == NULL) { m_error = PORT_NOT_FOUND; @@ -74,8 +74,8 @@ ConnectionEvent::pre_process() return; }*/ - m_src_port = Ingen::instance().object_store()->find_port(m_src_port_path); - m_dst_port = Ingen::instance().object_store()->find_port(m_dst_port_path); + m_src_port = Engine::instance().object_store()->find_port(m_src_port_path); + m_dst_port = Engine::instance().object_store()->find_port(m_dst_port_path); if (m_src_port == NULL || m_dst_port == NULL) { m_error = PORT_NOT_FOUND; @@ -235,7 +235,7 @@ TypedConnectionEvent::execute(SampleCount offset) m_dst_port->add_connection(m_port_listnode); m_patch->add_connection(m_patch_listnode); if (m_patch->process_order() != NULL) - Ingen::instance().maid()->push(m_patch->process_order()); + Engine::instance().maid()->push(m_patch->process_order()); m_patch->process_order(m_process_order); } } @@ -250,7 +250,7 @@ TypedConnectionEvent::post_process() _responder->respond_ok(); - Ingen::instance().client_broadcaster()->send_connection(m_connection); + Engine::instance().client_broadcaster()->send_connection(m_connection); } else { _responder->respond_error("Unable to make connection."); } diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp index 50e99c64..65e2106d 100644 --- a/src/libs/engine/events/CreatePatchEvent.cpp +++ b/src/libs/engine/events/CreatePatchEvent.cpp @@ -20,7 +20,7 @@ #include "Node.h" #include "Tree.h" #include "Plugin.h" -#include "Ingen.h" +#include "Engine.h" #include "Maid.h" #include "ClientBroadcaster.h" #include "AudioDriver.h" @@ -45,7 +45,7 @@ CreatePatchEvent::CreatePatchEvent(CountedPtr responder, SampleCount void CreatePatchEvent::pre_process() { - if (Ingen::instance().object_store()->find(m_path) != NULL) { + if (Engine::instance().object_store()->find(m_path) != NULL) { m_error = OBJECT_EXISTS; QueuedEvent::pre_process(); return; @@ -58,7 +58,7 @@ CreatePatchEvent::pre_process() } if (m_path != "/") { - m_parent = Ingen::instance().object_store()->find_patch(m_path.parent()); + m_parent = Engine::instance().object_store()->find_patch(m_path.parent()); if (m_parent == NULL) { m_error = PARENT_NOT_FOUND; QueuedEvent::pre_process(); @@ -70,7 +70,7 @@ CreatePatchEvent::pre_process() if (m_parent != NULL && m_poly > 1 && m_poly == static_cast(m_parent->internal_poly())) poly = m_poly; - m_patch = new Patch(m_path.name(), poly, m_parent, Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size(), m_poly); + m_patch = new Patch(m_path.name(), poly, m_parent, Engine::instance().audio_driver()->sample_rate(), Engine::instance().audio_driver()->buffer_size(), m_poly); if (m_parent != NULL) { m_parent->add_node(new ListNode(m_patch)); @@ -97,7 +97,7 @@ CreatePatchEvent::execute(SampleCount offset) if (m_parent == NULL) { assert(m_path == "/"); assert(m_patch->parent_patch() == NULL); - Ingen::instance().audio_driver()->set_root_patch(m_patch); + Engine::instance().audio_driver()->set_root_patch(m_patch); } else { assert(m_parent != NULL); assert(m_path != "/"); @@ -105,7 +105,7 @@ CreatePatchEvent::execute(SampleCount offset) m_patch->add_to_patch(); if (m_parent->process_order() != NULL) - Ingen::instance().maid()->push(m_parent->process_order()); + Engine::instance().maid()->push(m_parent->process_order()); m_parent->process_order(m_process_order); } } @@ -121,10 +121,10 @@ CreatePatchEvent::post_process() _responder->respond_ok(); // Don't want to send nodes that have been added since prepare() - //Ingen::instance().client_broadcaster()->send_node_creation_messages(m_patch); + //Engine::instance().client_broadcaster()->send_node_creation_messages(m_patch); // Patches are always empty on creation, so this is fine - Ingen::instance().client_broadcaster()->send_patch(m_patch); + Engine::instance().client_broadcaster()->send_patch(m_patch); } else if (m_error == OBJECT_EXISTS) { string msg = "Unable to create patch: "; diff --git a/src/libs/engine/events/DSSIConfigureEvent.cpp b/src/libs/engine/events/DSSIConfigureEvent.cpp index f8899304..59a7401c 100644 --- a/src/libs/engine/events/DSSIConfigureEvent.cpp +++ b/src/libs/engine/events/DSSIConfigureEvent.cpp @@ -15,7 +15,7 @@ */ #include "DSSIConfigureEvent.h" -#include "Ingen.h" +#include "Engine.h" #include "Node.h" #include "ClientBroadcaster.h" #include "Plugin.h" @@ -37,7 +37,7 @@ DSSIConfigureEvent::DSSIConfigureEvent(CountedPtr responder, SampleCo void DSSIConfigureEvent::pre_process() { - Node* node = Ingen::instance().object_store()->find_node(m_node_path); + Node* node = Engine::instance().object_store()->find_node(m_node_path); if (node != NULL && node->plugin()->type() == Plugin::DSSI) { m_node = (DSSINode*)node; @@ -63,7 +63,7 @@ DSSIConfigureEvent::post_process() } else { string key = "dssi-configure--"; key += m_key; - Ingen::instance().client_broadcaster()->send_metadata_update(m_node_path, key, m_val); + Engine::instance().client_broadcaster()->send_metadata_update(m_node_path, key, m_val); } } diff --git a/src/libs/engine/events/DSSIControlEvent.cpp b/src/libs/engine/events/DSSIControlEvent.cpp index 565e37da..5ba8a87e 100644 --- a/src/libs/engine/events/DSSIControlEvent.cpp +++ b/src/libs/engine/events/DSSIControlEvent.cpp @@ -15,7 +15,7 @@ */ #include "DSSIControlEvent.h" -#include "Ingen.h" +#include "Engine.h" #include "Node.h" #include "Plugin.h" #include "ObjectStore.h" @@ -36,7 +36,7 @@ DSSIControlEvent::DSSIControlEvent(CountedPtr responder, SampleCount void DSSIControlEvent::pre_process() { - Node* node = Ingen::instance().object_store()->find_node(m_node_path); + Node* node = Engine::instance().object_store()->find_node(m_node_path); if (node->plugin()->type() != Plugin::DSSI) m_node = NULL; diff --git a/src/libs/engine/events/DSSIProgramEvent.cpp b/src/libs/engine/events/DSSIProgramEvent.cpp index a3ee39d1..3d62e5b8 100644 --- a/src/libs/engine/events/DSSIProgramEvent.cpp +++ b/src/libs/engine/events/DSSIProgramEvent.cpp @@ -17,7 +17,7 @@ #include "DSSIProgramEvent.h" #include #include -#include "Ingen.h" +#include "Engine.h" #include "Node.h" #include "ClientBroadcaster.h" #include "Plugin.h" @@ -41,7 +41,7 @@ DSSIProgramEvent::DSSIProgramEvent(CountedPtr responder, SampleCount void DSSIProgramEvent::pre_process() { - Node* node = Ingen::instance().object_store()->find_node(m_node_path); + Node* node = Engine::instance().object_store()->find_node(m_node_path); if (node != NULL && node->plugin()->type() == Plugin::DSSI) m_node = (DSSINode*)node; @@ -67,7 +67,7 @@ DSSIProgramEvent::post_process() // sends program as metadata in the form bank/program char* temp_buf = new char[16]; snprintf(temp_buf, 16, "%d/%d", m_bank, m_program); - Ingen::instance().client_broadcaster()->send_metadata_update(m_node_path, "dssi-program", temp_buf); + Engine::instance().client_broadcaster()->send_metadata_update(m_node_path, "dssi-program", temp_buf); } } diff --git a/src/libs/engine/events/DSSIUpdateEvent.cpp b/src/libs/engine/events/DSSIUpdateEvent.cpp index f5628b86..48590917 100644 --- a/src/libs/engine/events/DSSIUpdateEvent.cpp +++ b/src/libs/engine/events/DSSIUpdateEvent.cpp @@ -18,7 +18,7 @@ #include #include "Node.h" #include "ObjectStore.h" -#include "Ingen.h" +#include "Engine.h" #include "DSSINode.h" #include "Plugin.h" @@ -39,7 +39,7 @@ DSSIUpdateEvent::DSSIUpdateEvent(CountedPtr responder, SampleCount ti void DSSIUpdateEvent::pre_process() { - Node* node = Ingen::instance().object_store()->find_node(m_path); + Node* node = Engine::instance().object_store()->find_node(m_path); if (node == NULL || node->plugin()->type() != Plugin::DSSI) { m_node = NULL; diff --git a/src/libs/engine/events/DeactivateEvent.cpp b/src/libs/engine/events/DeactivateEvent.cpp index 28648da3..e1c0541e 100644 --- a/src/libs/engine/events/DeactivateEvent.cpp +++ b/src/libs/engine/events/DeactivateEvent.cpp @@ -16,7 +16,7 @@ #include "DeactivateEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" namespace Ingen { @@ -45,7 +45,7 @@ void DeactivateEvent::post_process() { _responder->respond_ok(); - Ingen::instance().deactivate(); + Engine::instance().deactivate(); } diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp index d490bb6b..d373389b 100644 --- a/src/libs/engine/events/DestroyEvent.cpp +++ b/src/libs/engine/events/DestroyEvent.cpp @@ -16,7 +16,7 @@ #include "DestroyEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "Patch.h" #include "Tree.h" #include "Node.h" @@ -71,7 +71,7 @@ void DestroyEvent::pre_process() { if (m_node == NULL) - m_node = Ingen::instance().object_store()->find_node(m_path); + m_node = Engine::instance().object_store()->find_node(m_path); if (m_node != NULL && m_path != "/") { assert(m_node->parent_patch() != NULL); @@ -129,7 +129,7 @@ DestroyEvent::execute(SampleCount offset) m_parent_disconnect_event->execute(offset); if (m_node->parent_patch()->process_order() != NULL) - Ingen::instance().maid()->push(m_node->parent_patch()->process_order()); + Engine::instance().maid()->push(m_node->parent_patch()->process_order()); m_node->parent_patch()->process_order(m_process_order); } } @@ -153,9 +153,9 @@ DestroyEvent::post_process() m_disconnect_event->post_process(); if (m_parent_disconnect_event != NULL) m_parent_disconnect_event->post_process(); - Ingen::instance().client_broadcaster()->send_destroyed(m_path); - Ingen::instance().maid()->push(m_patch_listnode); - Ingen::instance().maid()->push(m_node); + Engine::instance().client_broadcaster()->send_destroyed(m_path); + Engine::instance().maid()->push(m_patch_listnode); + Engine::instance().maid()->push(m_node); } else { _responder->respond_error("Unable to destroy object"); } diff --git a/src/libs/engine/events/DisablePatchEvent.cpp b/src/libs/engine/events/DisablePatchEvent.cpp index 3129736f..45b19f54 100644 --- a/src/libs/engine/events/DisablePatchEvent.cpp +++ b/src/libs/engine/events/DisablePatchEvent.cpp @@ -16,7 +16,7 @@ #include "DisablePatchEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "Patch.h" #include "ClientBroadcaster.h" #include "util.h" @@ -37,7 +37,7 @@ DisablePatchEvent::DisablePatchEvent(CountedPtr responder, SampleCoun void DisablePatchEvent::pre_process() { - m_patch = Ingen::instance().object_store()->find_patch(m_patch_path); + m_patch = Engine::instance().object_store()->find_patch(m_patch_path); QueuedEvent::pre_process(); } @@ -58,7 +58,7 @@ DisablePatchEvent::post_process() { if (m_patch != NULL) { _responder->respond_ok(); - Ingen::instance().client_broadcaster()->send_patch_disable(m_patch_path); + Engine::instance().client_broadcaster()->send_patch_disable(m_patch_path); } else { _responder->respond_error(string("Patch ") + m_patch_path + " not found"); } diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp index e29e6956..7955f602 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.cpp +++ b/src/libs/engine/events/DisconnectNodeEvent.cpp @@ -17,7 +17,7 @@ #include "DisconnectNodeEvent.h" #include #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "Maid.h" #include "List.h" #include "Node.h" @@ -77,7 +77,7 @@ DisconnectNodeEvent::pre_process() // cerr << "Preparing disconnection event...\n"; if (m_lookup) { - m_patch = Ingen::instance().object_store()->find_patch(m_node_path.parent()); + m_patch = Engine::instance().object_store()->find_patch(m_node_path.parent()); if (m_patch == NULL) { m_succeeded = false; @@ -85,7 +85,7 @@ DisconnectNodeEvent::pre_process() return; } - m_node = Ingen::instance().object_store()->find_node(m_node_path); + m_node = Engine::instance().object_store()->find_node(m_node_path); if (m_node == NULL) { m_succeeded = false; diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp index 889e8506..2126dffd 100644 --- a/src/libs/engine/events/DisconnectPortEvent.cpp +++ b/src/libs/engine/events/DisconnectPortEvent.cpp @@ -17,7 +17,7 @@ #include "DisconnectPortEvent.h" #include #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "Maid.h" #include "List.h" #include "Node.h" @@ -76,7 +76,7 @@ DisconnectPortEvent::pre_process() // cerr << "Preparing disconnection event...\n"; if (m_lookup) { - m_patch = Ingen::instance().object_store()->find_patch(m_port_path.parent().parent()); + m_patch = Engine::instance().object_store()->find_patch(m_port_path.parent().parent()); if (m_patch == NULL) { m_succeeded = false; @@ -84,7 +84,7 @@ DisconnectPortEvent::pre_process() return; } - m_port = Ingen::instance().object_store()->find_port(m_port_path); + m_port = Engine::instance().object_store()->find_port(m_port_path); if (m_port == NULL) { m_succeeded = false; diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp index 4afdf2c4..431061a2 100644 --- a/src/libs/engine/events/DisconnectionEvent.cpp +++ b/src/libs/engine/events/DisconnectionEvent.cpp @@ -17,7 +17,7 @@ #include "DisconnectionEvent.h" #include #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "TypedConnection.h" #include "InputPort.h" #include "OutputPort.h" @@ -85,7 +85,7 @@ DisconnectionEvent::pre_process() return; } - /*m_patch = Ingen::instance().object_store()->find_patch(m_src_port_path.parent().parent()); + /*m_patch = Engine::instance().object_store()->find_patch(m_src_port_path.parent().parent()); if (m_patch == NULL) { m_error = PORT_NOT_FOUND; @@ -93,8 +93,8 @@ DisconnectionEvent::pre_process() return; }*/ - m_src_port = Ingen::instance().object_store()->find_port(m_src_port_path); - m_dst_port = Ingen::instance().object_store()->find_port(m_dst_port_path); + m_src_port = Engine::instance().object_store()->find_port(m_src_port_path); + m_dst_port = Engine::instance().object_store()->find_port(m_dst_port_path); } if (m_src_port == NULL || m_dst_port == NULL) { @@ -248,12 +248,12 @@ TypedDisconnectionEvent::execute(SampleCount offset) assert((Connection*)port_connection->elem() == patch_connection->elem()); // Clean up both the list node and the connection itself... - Ingen::instance().maid()->push(port_connection); - Ingen::instance().maid()->push(patch_connection); - Ingen::instance().maid()->push(port_connection->elem()); + Engine::instance().maid()->push(port_connection); + Engine::instance().maid()->push(patch_connection); + Engine::instance().maid()->push(port_connection->elem()); if (m_patch->process_order() != NULL) - Ingen::instance().maid()->push(m_patch->process_order()); + Engine::instance().maid()->push(m_patch->process_order()); m_patch->process_order(m_process_order); } else { m_succeeded = false; // Ports weren't connected @@ -271,7 +271,7 @@ TypedDisconnectionEvent::post_process() _responder->respond_ok(); - Ingen::instance().client_broadcaster()->send_disconnection(m_src_port->path(), m_dst_port->path()); + Engine::instance().client_broadcaster()->send_disconnection(m_src_port->path(), m_dst_port->path()); } else { _responder->respond_error("Unable to disconnect ports."); } diff --git a/src/libs/engine/events/EnablePatchEvent.cpp b/src/libs/engine/events/EnablePatchEvent.cpp index e24c2fe1..b2b3ee08 100644 --- a/src/libs/engine/events/EnablePatchEvent.cpp +++ b/src/libs/engine/events/EnablePatchEvent.cpp @@ -16,7 +16,7 @@ #include "EnablePatchEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "Patch.h" #include "util.h" #include "ClientBroadcaster.h" @@ -37,7 +37,7 @@ EnablePatchEvent::EnablePatchEvent(CountedPtr responder, SampleCount void EnablePatchEvent::pre_process() { - m_patch = Ingen::instance().object_store()->find_patch(m_patch_path); + m_patch = Engine::instance().object_store()->find_patch(m_patch_path); if (m_patch != NULL) { /* Any event that requires a new process order will set the patch's @@ -70,7 +70,7 @@ EnablePatchEvent::post_process() { if (m_patch != NULL) { _responder->respond_ok(); - Ingen::instance().client_broadcaster()->send_patch_enable(m_patch_path); + Engine::instance().client_broadcaster()->send_patch_enable(m_patch_path); } else { _responder->respond_error(string("Patch ") + m_patch_path + " not found"); } diff --git a/src/libs/engine/events/LoadPluginsEvent.cpp b/src/libs/engine/events/LoadPluginsEvent.cpp index 65972c17..cae25733 100644 --- a/src/libs/engine/events/LoadPluginsEvent.cpp +++ b/src/libs/engine/events/LoadPluginsEvent.cpp @@ -16,7 +16,7 @@ #include "LoadPluginsEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "NodeFactory.h" #include @@ -29,7 +29,7 @@ LoadPluginsEvent::LoadPluginsEvent(CountedPtr responder, SampleCount : QueuedEvent(responder, timestamp) { cerr << "LOADING PLUGINS\n"; - Ingen::instance().node_factory()->load_plugins(); + Engine::instance().node_factory()->load_plugins(); } diff --git a/src/libs/engine/events/MidiLearnEvent.cpp b/src/libs/engine/events/MidiLearnEvent.cpp index 5349ba92..814ecdb5 100644 --- a/src/libs/engine/events/MidiLearnEvent.cpp +++ b/src/libs/engine/events/MidiLearnEvent.cpp @@ -16,7 +16,7 @@ #include "MidiLearnEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "ObjectStore.h" #include "Node.h" #include "MidiControlNode.h" @@ -30,7 +30,7 @@ namespace Ingen { void MidiLearnResponseEvent::post_process() { - Ingen::instance().client_broadcaster()->send_control_change(m_port_path, m_value); + Engine::instance().client_broadcaster()->send_control_change(m_port_path, m_value); } @@ -49,7 +49,7 @@ MidiLearnEvent::MidiLearnEvent(CountedPtr responder, SampleCount time void MidiLearnEvent::pre_process() { - m_node = Ingen::instance().object_store()->find_node(m_node_path); + m_node = Engine::instance().object_store()->find_node(m_node_path); m_response_event = new MidiLearnResponseEvent(m_node_path + "/Controller_Number", _time_stamp); QueuedEvent::pre_process(); diff --git a/src/libs/engine/events/NoteOffEvent.cpp b/src/libs/engine/events/NoteOffEvent.cpp index 36078e7c..027e9f1f 100644 --- a/src/libs/engine/events/NoteOffEvent.cpp +++ b/src/libs/engine/events/NoteOffEvent.cpp @@ -16,7 +16,7 @@ #include "NoteOffEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "ObjectStore.h" #include "Node.h" #include "MidiNoteNode.h" @@ -50,7 +50,7 @@ void NoteOffEvent::execute(SampleCount offset) { if (m_node == NULL && m_node_path != "") - m_node = Ingen::instance().object_store()->find_node(m_node_path); + m_node = Engine::instance().object_store()->find_node(m_node_path); // FIXME: this isn't very good at all. if (m_node != NULL && m_node->plugin()->type() == Plugin::Internal) { diff --git a/src/libs/engine/events/NoteOnEvent.cpp b/src/libs/engine/events/NoteOnEvent.cpp index 90711619..cbbc0e1d 100644 --- a/src/libs/engine/events/NoteOnEvent.cpp +++ b/src/libs/engine/events/NoteOnEvent.cpp @@ -16,7 +16,7 @@ #include "NoteOnEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "ObjectStore.h" #include "Node.h" #include "MidiNoteNode.h" @@ -60,7 +60,7 @@ NoteOnEvent::execute(SampleCount offset) { // Lookup if neccessary if (m_is_osc_triggered) - m_node = Ingen::instance().object_store()->find_node(m_node_path); + m_node = Engine::instance().object_store()->find_node(m_node_path); // FIXME: this isn't very good at all. if (m_node != NULL && m_node->plugin()->type() == Plugin::Internal) { diff --git a/src/libs/engine/events/RegisterClientEvent.cpp b/src/libs/engine/events/RegisterClientEvent.cpp index bbec1ba9..ab076059 100644 --- a/src/libs/engine/events/RegisterClientEvent.cpp +++ b/src/libs/engine/events/RegisterClientEvent.cpp @@ -16,7 +16,7 @@ #include "RegisterClientEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "ClientBroadcaster.h" namespace Ingen { @@ -36,7 +36,7 @@ RegisterClientEvent::RegisterClientEvent(CountedPtr responder, void RegisterClientEvent::pre_process() { - Ingen::instance().client_broadcaster()->register_client(_key, _client); + Engine::instance().client_broadcaster()->register_client(_key, _client); QueuedEvent::pre_process(); } diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp index 0d77dfa4..25a54285 100644 --- a/src/libs/engine/events/RenameEvent.cpp +++ b/src/libs/engine/events/RenameEvent.cpp @@ -19,7 +19,7 @@ #include "Patch.h" #include "Node.h" #include "Tree.h" -#include "Ingen.h" +#include "Engine.h" #include "ClientBroadcaster.h" #include "util/Path.h" #include "ObjectStore.h" @@ -58,13 +58,13 @@ RenameEvent::pre_process() return; } - if (Ingen::instance().object_store()->find(m_new_path)) { + if (Engine::instance().object_store()->find(m_new_path)) { m_error = OBJECT_EXISTS; QueuedEvent::pre_process(); return; } - GraphObject* obj = Ingen::instance().object_store()->find(m_old_path); + GraphObject* obj = Engine::instance().object_store()->find(m_old_path); if (obj == NULL) { m_error = OBJECT_NOT_FOUND; @@ -103,7 +103,7 @@ RenameEvent::post_process() if (m_error == NO_ERROR) { _responder->respond_ok(); - Ingen::instance().client_broadcaster()->send_rename(m_old_path, m_new_path); + Engine::instance().client_broadcaster()->send_rename(m_old_path, m_new_path); } else { if (m_error == OBJECT_EXISTS) msg.append("Object already exists at ").append(m_new_path); diff --git a/src/libs/engine/events/RequestAllObjectsEvent.cpp b/src/libs/engine/events/RequestAllObjectsEvent.cpp index 62a665b7..b28294cc 100644 --- a/src/libs/engine/events/RequestAllObjectsEvent.cpp +++ b/src/libs/engine/events/RequestAllObjectsEvent.cpp @@ -16,7 +16,7 @@ #include "RequestAllObjectsEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "ObjectSender.h" namespace Ingen { diff --git a/src/libs/engine/events/RequestMetadataEvent.cpp b/src/libs/engine/events/RequestMetadataEvent.cpp index 2f41bc35..e8112797 100644 --- a/src/libs/engine/events/RequestMetadataEvent.cpp +++ b/src/libs/engine/events/RequestMetadataEvent.cpp @@ -17,7 +17,7 @@ #include "RequestMetadataEvent.h" #include #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "GraphObject.h" #include "ObjectStore.h" #include "interface/ClientInterface.h" @@ -44,7 +44,7 @@ RequestMetadataEvent::pre_process() m_client = _responder->find_client(); if (m_client) { - m_object = Ingen::instance().object_store()->find(m_path); + m_object = Engine::instance().object_store()->find(m_path); if (m_object == NULL) { QueuedEvent::pre_process(); return; diff --git a/src/libs/engine/events/RequestPluginsEvent.cpp b/src/libs/engine/events/RequestPluginsEvent.cpp index fff549b8..65dfb7aa 100644 --- a/src/libs/engine/events/RequestPluginsEvent.cpp +++ b/src/libs/engine/events/RequestPluginsEvent.cpp @@ -16,7 +16,7 @@ #include "RequestPluginsEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "ClientBroadcaster.h" namespace Ingen { @@ -42,7 +42,7 @@ void RequestPluginsEvent::post_process() { if (m_client) { - Ingen::instance().client_broadcaster()->send_plugins_to(m_client.get()); + Engine::instance().client_broadcaster()->send_plugins_to(m_client.get()); _responder->respond_ok(); } else { _responder->respond_error("Invalid URL"); diff --git a/src/libs/engine/events/RequestPortValueEvent.cpp b/src/libs/engine/events/RequestPortValueEvent.cpp index e6384875..d02eed6a 100644 --- a/src/libs/engine/events/RequestPortValueEvent.cpp +++ b/src/libs/engine/events/RequestPortValueEvent.cpp @@ -17,7 +17,7 @@ #include "RequestPortValueEvent.h" #include #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "interface/ClientInterface.h" #include "TypedPort.h" #include "ObjectStore.h" @@ -42,7 +42,7 @@ void RequestPortValueEvent::pre_process() { m_client = _responder->find_client(); - m_port = Ingen::instance().object_store()->find_port(m_port_path); + m_port = Engine::instance().object_store()->find_port(m_port_path); QueuedEvent::pre_process(); } diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp index 9ce03bc9..3d77b77b 100644 --- a/src/libs/engine/events/SetMetadataEvent.cpp +++ b/src/libs/engine/events/SetMetadataEvent.cpp @@ -17,7 +17,7 @@ #include "SetMetadataEvent.h" #include #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "ClientBroadcaster.h" #include "GraphObject.h" #include "ObjectStore.h" @@ -40,7 +40,7 @@ SetMetadataEvent::SetMetadataEvent(CountedPtr responder, SampleCount void SetMetadataEvent::pre_process() { - m_object = Ingen::instance().object_store()->find(m_path); + m_object = Engine::instance().object_store()->find(m_path); if (m_object == NULL) { QueuedEvent::pre_process(); return; @@ -70,7 +70,7 @@ SetMetadataEvent::post_process() _responder->respond_error(msg); } else { _responder->respond_ok(); - Ingen::instance().client_broadcaster()->send_metadata_update(m_path, m_key, m_value); + Engine::instance().client_broadcaster()->send_metadata_update(m_path, m_key, m_value); } } diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp index 58bb815b..6331a4b5 100644 --- a/src/libs/engine/events/SetPortValueEvent.cpp +++ b/src/libs/engine/events/SetPortValueEvent.cpp @@ -16,7 +16,7 @@ #include "SetPortValueEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "TypedPort.h" #include "ClientBroadcaster.h" #include "Node.h" @@ -53,7 +53,7 @@ void SetPortValueEvent::execute(SampleCount offset) { if (m_port == NULL) - m_port = Ingen::instance().object_store()->find_port(m_port_path); + m_port = Engine::instance().object_store()->find_port(m_port_path); if (m_port == NULL) { m_error = PORT_NOT_FOUND; @@ -76,13 +76,13 @@ SetPortValueEvent::post_process() assert(m_port != NULL); _responder->respond_ok(); - Ingen::instance().client_broadcaster()->send_control_change(m_port_path, m_val); + Engine::instance().client_broadcaster()->send_control_change(m_port_path, m_val); // Send patch port control change, if this is a bridge port /*Port* parent_port = m_port->parent_node()->as_port(); if (parent_port != NULL) { assert(parent_port->type() == DataType::FLOAT); - Ingen::instance().client_broadcaster()->send_control_change(parent_port->path(), m_val); + Engine::instance().client_broadcaster()->send_control_change(parent_port->path(), m_val); }*/ } else if (m_error == PORT_NOT_FOUND) { diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.cpp b/src/libs/engine/events/SetPortValueQueuedEvent.cpp index bb17c44e..8a5afc65 100644 --- a/src/libs/engine/events/SetPortValueQueuedEvent.cpp +++ b/src/libs/engine/events/SetPortValueQueuedEvent.cpp @@ -16,7 +16,7 @@ #include "SetPortValueQueuedEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "TypedPort.h" #include "ClientBroadcaster.h" #include "Plugin.h" @@ -54,7 +54,7 @@ void SetPortValueQueuedEvent::pre_process() { if (m_port == NULL) - m_port = Ingen::instance().object_store()->find_port(m_port_path); + m_port = Engine::instance().object_store()->find_port(m_port_path); if (m_port == NULL) { m_error = PORT_NOT_FOUND; @@ -88,13 +88,13 @@ SetPortValueQueuedEvent::post_process() assert(m_port != NULL); _responder->respond_ok(); - Ingen::instance().client_broadcaster()->send_control_change(m_port_path, m_val); + Engine::instance().client_broadcaster()->send_control_change(m_port_path, m_val); // Send patch port control change, if this is a bridge port /*Port* parent_port = m_port->parent_node()->as_port(); if (parent_port != NULL) { assert(parent_port->type() == DataType::FLOAT); - Ingen::instance().client_broadcaster()->send_control_change(parent_port->path(), m_val); + Engine::instance().client_broadcaster()->send_control_change(parent_port->path(), m_val); }*/ } else if (m_error == PORT_NOT_FOUND) { diff --git a/src/libs/engine/events/UnregisterClientEvent.cpp b/src/libs/engine/events/UnregisterClientEvent.cpp index 0ec3c467..5e720a24 100644 --- a/src/libs/engine/events/UnregisterClientEvent.cpp +++ b/src/libs/engine/events/UnregisterClientEvent.cpp @@ -16,7 +16,7 @@ #include "UnregisterClientEvent.h" #include "Responder.h" -#include "Ingen.h" +#include "Engine.h" #include "ClientBroadcaster.h" #include "interface/ClientInterface.h" @@ -33,7 +33,7 @@ UnregisterClientEvent::UnregisterClientEvent(CountedPtr responder, Sa void UnregisterClientEvent::post_process() { - if (Ingen::instance().client_broadcaster()->unregister_client(_key)) + if (Engine::instance().client_broadcaster()->unregister_client(_key)) _responder->respond_ok(); else _responder->respond_error("Unable to unregister client"); diff --git a/src/progs/server/main.cpp b/src/progs/server/main.cpp index 1ee02bc6..8ded37b7 100644 --- a/src/progs/server/main.cpp +++ b/src/progs/server/main.cpp @@ -20,7 +20,7 @@ #include "config.h" #include "util.h" #include "cmdline.h" -#include "Ingen.h" +#include "Engine.h" #ifdef HAVE_LASH #include "LashDriver.h" #endif @@ -39,7 +39,7 @@ catch_int(int) signal(SIGTERM, catch_int); std::cout << "[Main] Ingen interrupted." << std::endl; - Ingen::Ingen::instance().quit(); + Ingen::Engine::instance().quit(); } @@ -132,13 +132,13 @@ main(int argc, char** argv) Ingen::set_denormal_flags(); - Ingen::Ingen::instantiate(args_info.port_arg); + Ingen::Engine::instantiate(args_info.port_arg); #ifdef HAVE_LASH Ingen::lash_driver = new Ingen::LashDriver(Ingen::om, lash_args); #endif - Ingen::Ingen::instance().main(); + Ingen::Engine::instance().main(); #ifdef HAVE_LASH delete Ingen::lash_driver; -- cgit v1.2.1