diff options
Diffstat (limited to 'src/libs')
135 files changed, 649 insertions, 846 deletions
diff --git a/src/libs/engine/AlsaMidiDriver.cpp b/src/libs/engine/AlsaMidiDriver.cpp index 4e225d8c..a27470dd 100644 --- a/src/libs/engine/AlsaMidiDriver.cpp +++ b/src/libs/engine/AlsaMidiDriver.cpp @@ -18,10 +18,9 @@ #include <iostream> #include <cstdlib> #include <pthread.h> -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "types.h" -#include "OmApp.h" +#include "Ingen.h" #include "Maid.h" #include "AudioDriver.h" #include "MidiMessage.h" @@ -120,7 +119,7 @@ void AlsaMidiPort::event(snd_seq_event_t* const ev) { // Abuse the tick field to hold the timestamp - ev->time.tick = om->audio_driver()->time_stamp(); + ev->time.tick = Ingen::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) @@ -137,7 +136,7 @@ AlsaMidiPort::event(snd_seq_event_t* const ev) * 1 cycle delay) and creates a flat port buffer for this cycle. */ void -AlsaMidiPort::prepare_block(const samplecount block_start, const samplecount block_end) +AlsaMidiPort::prepare_block(const SampleCount block_start, const SampleCount block_end) { assert(block_end >= block_start); @@ -233,7 +232,7 @@ AlsaMidiDriver::activate() bool success = false; m_midi_thread_exit_flag = false; - //if (om->audio_driver()->is_realtime()) { + //if (Ingen::instance().audio_driver()->is_realtime()) { pthread_attr_t attr; pthread_attr_init(&attr); @@ -268,7 +267,7 @@ AlsaMidiDriver::activate() } #ifdef HAVE_LASH - om->lash_driver()->set_alsa_client_id(snd_seq_client_id(m_seq_handle)); + Ingen::instance().lash_driver()->set_alsa_client_id(snd_seq_client_id(m_seq_handle)); #endif m_is_activated = true; @@ -292,7 +291,7 @@ AlsaMidiDriver::deactivate() /** Build flat arrays of events for DSSI plugins for each Port. */ void -AlsaMidiDriver::prepare_block(const samplecount block_start, const samplecount block_end) +AlsaMidiDriver::prepare_block(const SampleCount block_start, const SampleCount block_end) { for (List<AlsaMidiPort*>::iterator i = m_in_ports.begin(); i != m_in_ports.end(); ++i) (*i)->prepare_block(block_start, block_end); diff --git a/src/libs/engine/AlsaMidiDriver.h b/src/libs/engine/AlsaMidiDriver.h index 4ffc7054..2ddbaecd 100644 --- a/src/libs/engine/AlsaMidiDriver.h +++ b/src/libs/engine/AlsaMidiDriver.h @@ -44,7 +44,7 @@ public: void event(snd_seq_event_t* const ev); - void prepare_block(const samplecount block_start, const samplecount block_end); + void prepare_block(const SampleCount block_start, const SampleCount block_end); void add_to_driver(); void remove_from_driver(); @@ -84,7 +84,7 @@ public: bool is_activated() const { return m_is_activated; } - void prepare_block(const samplecount block_start, const samplecount block_end); + void prepare_block(const SampleCount block_start, const SampleCount block_end); DriverPort* create_port(DuplexPort<MidiMessage>* patch_port) { return new AlsaMidiPort(this, patch_port); } diff --git a/src/libs/engine/AudioDriver.h b/src/libs/engine/AudioDriver.h index 5e56c31b..a76fce8d 100644 --- a/src/libs/engine/AudioDriver.h +++ b/src/libs/engine/AudioDriver.h @@ -32,16 +32,16 @@ template <typename T> class TypedPort; * * \ingroup engine */ -class AudioDriver : public Driver<sample> +class AudioDriver : public Driver<Sample> { public: virtual void set_root_patch(Patch* patch) = 0; virtual Patch* root_patch() = 0; - virtual samplecount buffer_size() const = 0; - virtual samplecount sample_rate() const = 0; - virtual samplecount time_stamp() const = 0; + virtual SampleCount buffer_size() const = 0; + virtual SampleCount sample_rate() const = 0; + virtual SampleCount time_stamp() const = 0; }; diff --git a/src/libs/engine/Buffer.cpp b/src/libs/engine/Buffer.cpp index a7f11e8f..ff43664d 100644 --- a/src/libs/engine/Buffer.cpp +++ b/src/libs/engine/Buffer.cpp @@ -41,7 +41,7 @@ Buffer<T>::Buffer(size_t size) allocate(); assert(m_data); } -template Buffer<sample>::Buffer(size_t size); +template Buffer<Sample>::Buffer(size_t size); template Buffer<MidiMessage>::Buffer(size_t size); @@ -68,7 +68,7 @@ Buffer<T>::allocate() set(0, 0, m_size-1); } -template void Buffer<sample>::allocate(); +template void Buffer<Sample>::allocate(); template void Buffer<MidiMessage>::allocate(); @@ -84,7 +84,7 @@ Buffer<T>::deallocate() m_data = NULL; m_local_data = NULL; } -template void Buffer<sample>::deallocate(); +template void Buffer<Sample>::deallocate(); template void Buffer<MidiMessage>::deallocate(); @@ -98,7 +98,7 @@ Buffer<T>::clear() m_state = OK; m_filled_size = 0; } -template void Buffer<sample>::clear(); +template void Buffer<Sample>::clear(); template void Buffer<MidiMessage>::clear(); @@ -121,7 +121,7 @@ Buffer<T>::set(T val, size_t start_sample) m_set_value = val; } -template void Buffer<sample>::set(sample val, size_t start_sample); +template void Buffer<Sample>::set(Sample val, size_t start_sample); template void Buffer<MidiMessage>::set(MidiMessage val, size_t start_sample); @@ -140,7 +140,7 @@ Buffer<T>::set(T val, size_t start_sample, size_t end_sample) for (size_t i=start_sample; i <= end_sample; ++i) m_data[i] = val; } -template void Buffer<sample>::set(sample val, size_t start_sample, size_t end_sample); +template void Buffer<Sample>::set(Sample val, size_t start_sample, size_t end_sample); template void Buffer<MidiMessage>::set(MidiMessage val, size_t start_sample, size_t end_sample); @@ -159,7 +159,7 @@ Buffer<T>::scale(T val, size_t start_sample, size_t end_sample) for (size_t i=start_sample; i <= end_sample; ++i) m_data[i] *= val; } -template void Buffer<sample>::scale(sample val, size_t start_sample, size_t end_sample); +template void Buffer<Sample>::scale(Sample val, size_t start_sample, size_t end_sample); /** Copy a block of @a src into buffer. @@ -182,7 +182,7 @@ Buffer<T>::copy(const Buffer<T>* src, size_t start_sample, size_t end_sample) for (size_t i=start_sample; i <= end_sample; ++i) m_data[i] = src_data[i]; } -template void Buffer<sample>::copy(const Buffer<sample>* const src, size_t start_sample, size_t end_sample); +template void Buffer<Sample>::copy(const Buffer<Sample>* const src, size_t start_sample, size_t end_sample); template void Buffer<MidiMessage>::copy(const Buffer<MidiMessage>* const src, size_t start_sample, size_t end_sample); @@ -207,7 +207,7 @@ Buffer<T>::accumulate(const Buffer<T>* const src, size_t start_sample, size_t en m_data[i] += src_data[i]; } -template void Buffer<sample>::accumulate(const Buffer<sample>* const src, size_t start_sample, size_t end_sample); +template void Buffer<Sample>::accumulate(const Buffer<Sample>* const src, size_t start_sample, size_t end_sample); /** Use another buffer's data instead of the local one. @@ -226,7 +226,7 @@ Buffer<T>::join(Buffer<T>* buf) assert(m_filled_size <= m_size); } -template void Buffer<sample>::join(Buffer<sample>* buf); +template void Buffer<Sample>::join(Buffer<Sample>* buf); template void Buffer<MidiMessage>::join(Buffer<MidiMessage>* buf); @@ -237,13 +237,13 @@ Buffer<T>::unjoin() m_is_joined = false; m_data = m_local_data; } -template void Buffer<sample>::unjoin(); +template void Buffer<Sample>::unjoin(); template void Buffer<MidiMessage>::unjoin(); template<> void -Buffer<sample>::prepare(samplecount nframes) +Buffer<Sample>::prepare(SampleCount nframes) { // FIXME: nframes parameter doesn't actually work, // writing starts from 0 every time @@ -265,7 +265,7 @@ Buffer<sample>::prepare(samplecount nframes) template<> void -Buffer<MidiMessage>::prepare(samplecount nframes) +Buffer<MidiMessage>::prepare(SampleCount nframes) { } @@ -281,7 +281,7 @@ Buffer<T>::set_data(T* data) assert(!m_is_joined); m_data = data; } -template void Buffer<sample>::set_data(sample* data); +template void Buffer<Sample>::set_data(Sample* data); template void Buffer<MidiMessage>::set_data(MidiMessage* data); @@ -294,7 +294,7 @@ DriverBuffer<T>::DriverBuffer(size_t size) Buffer<T>::deallocate(); // FIXME: allocate then immediately deallocate, dirty Buffer<T>::m_data = NULL; } -template DriverBuffer<sample>::DriverBuffer(size_t size); +template DriverBuffer<Sample>::DriverBuffer(size_t size); template DriverBuffer<MidiMessage>::DriverBuffer(size_t size); @@ -309,7 +309,7 @@ DriverBuffer<T>::set_data(T* data) assert(!m_is_joined); m_data = data; } -template void DriverBuffer<sample>::set_data(sample* data); +template void DriverBuffer<Sample>::set_data(sample* data); template void DriverBuffer<MidiMessage>::set_data(MidiMessage* data); #endif diff --git a/src/libs/engine/Buffer.h b/src/libs/engine/Buffer.h index 1be23bca..96407623 100644 --- a/src/libs/engine/Buffer.h +++ b/src/libs/engine/Buffer.h @@ -45,7 +45,7 @@ public: inline T& value_at(size_t offset) { assert(offset < m_size); return m_data[offset]; } - void prepare(samplecount nframes); + void prepare(SampleCount nframes); void filled_size(size_t size) { m_filled_size = size; } size_t filled_size() const { return m_filled_size; } diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp index e8636805..f073fd19 100644 --- a/src/libs/engine/ClientBroadcaster.cpp +++ b/src/libs/engine/ClientBroadcaster.cpp @@ -18,8 +18,7 @@ #include <cassert> #include <iostream> #include <unistd.h> -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "ObjectStore.h" #include "NodeFactory.h" #include "util.h" @@ -129,13 +128,14 @@ ClientBroadcaster::send_error(const string& msg) } - +/* FIXME: Make a copy method for list and just make a copy and pass it here + * instead of this global+locking mess */ void ClientBroadcaster::send_plugins_to(ClientInterface* client) { - om->node_factory()->lock_plugin_list(); + Ingen::instance().node_factory()->lock_plugin_list(); - const list<Plugin*>& plugs = om->node_factory()->plugins(); + const list<Plugin*>& plugs = Ingen::instance().node_factory()->plugins(); const Plugin* plugin; lo_timetag tt; @@ -175,7 +175,7 @@ ClientBroadcaster::send_plugins_to(ClientInterface* client) for (list<lo_bundle>::const_iterator i = msgs.begin(); i != msgs.end(); ++i) lo_message_free(*i); - om->node_factory()->unlock_plugin_list(); + Ingen::instance().node_factory()->unlock_plugin_list(); } diff --git a/src/libs/engine/Connection.cpp b/src/libs/engine/Connection.cpp index 7900c9c6..ac650753 100644 --- a/src/libs/engine/Connection.cpp +++ b/src/libs/engine/Connection.cpp @@ -17,7 +17,6 @@ #include "Connection.h" #include "util.h" #include "Node.h" -#include "Om.h" #include "Port.h" namespace Om { diff --git a/src/libs/engine/DSSINode.cpp b/src/libs/engine/DSSINode.cpp index 524a9642..ba415446 100644 --- a/src/libs/engine/DSSINode.cpp +++ b/src/libs/engine/DSSINode.cpp @@ -17,8 +17,7 @@ #include "DSSINode.h" #include <map> #include <set> -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "ClientBroadcaster.h" #include "interface/ClientInterface.h" #include "InputPort.h" @@ -28,7 +27,7 @@ using namespace std; namespace Om { -DSSINode::DSSINode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, DSSI_Descriptor* descriptor, samplerate srate, size_t buffer_size) +DSSINode::DSSINode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size) : LADSPANode(plugin, name, 1, parent, descriptor->LADSPA_Plugin, srate, buffer_size), _dssi_descriptor(descriptor), _ui_addr(NULL), @@ -105,10 +104,10 @@ DSSINode::set_ui_url(const string& url) void -DSSINode::set_control(size_t port_num, sample val) +DSSINode::set_control(size_t port_num, Sample val) { assert(port_num < _descriptor->PortCount); - ((TypedPort<sample>*)_ports->at(port_num))->set_value(val, 0); + ((TypedPort<Sample>*)_ports->at(port_num))->set_value(val, 0); } @@ -160,7 +159,7 @@ DSSINode::has_midi_input() const void -DSSINode::process(samplecount nframes) +DSSINode::process(SampleCount nframes) { NodeBase::process(nframes); @@ -242,7 +241,7 @@ DSSINode::send_update() // send "control"s for (size_t i=0; i < _ports->size(); ++i) if (_ports->at(i)->type() == DataType::FLOAT && _ports->at(i)->buffer_size() == 1) - send_control(_ports->at(i)->num(), ((TypedPort<sample>*)_ports->at(i))->buffer(0)->value_at(0)); + send_control(_ports->at(i)->num(), ((TypedPort<Sample>*)_ports->at(i))->buffer(0)->value_at(0)); // send "show" FIXME: not to spec send_show(); @@ -276,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) { - om->client_broadcaster()->send_program_add(path(), descriptor->Bank, + Ingen::instance().client_broadcaster()->send_program_add(path(), descriptor->Bank, descriptor->Program, descriptor->Name); } @@ -291,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) - om->client_broadcaster()->send_program_remove(path(), set_iter->first, set_iter->second); + Ingen::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/DSSINode.h b/src/libs/engine/DSSINode.h index e28b2230..71bb053b 100644 --- a/src/libs/engine/DSSINode.h +++ b/src/libs/engine/DSSINode.h @@ -39,7 +39,7 @@ public: typedef map<int, string> Bank; - DSSINode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, DSSI_Descriptor* descriptor, samplerate srate, size_t buffer_size); + DSSINode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, DSSI_Descriptor* descriptor, SampleRate srate, size_t buffer_size); ~DSSINode(); bool instantiate(); @@ -49,11 +49,11 @@ public: void set_ui_url(const string& url); void send_update(); - void set_control(size_t port_num, sample val); + void set_control(size_t port_num, Sample val); void configure(const string& key, const string& val); void program(int bank, int program); - void process(samplecount nframes); + void process(SampleCount nframes); bool update_programs(bool send_events); void set_default_program(); @@ -61,7 +61,7 @@ public: //void send_creation_messages(ClientInterface* client) const; - const Plugin* plugin() const { return _plugin; } + const Plugin* plugin() const { return _plugin; } void plugin(const Plugin* const pi) { _plugin = pi; } private: diff --git a/src/libs/engine/Driver.h b/src/libs/engine/Driver.h index 86cbe405..5f452781 100644 --- a/src/libs/engine/Driver.h +++ b/src/libs/engine/Driver.h @@ -102,7 +102,7 @@ public: void enable() {} void disable() {} - DriverPort* create_port(TypedPort<sample>* patch_port) { return NULL; } + DriverPort* create_port(TypedPort<Sample>* patch_port) { return NULL; } }; #endif diff --git a/src/libs/engine/DuplexPort.cpp b/src/libs/engine/DuplexPort.cpp index 4b70b49c..55316f1c 100644 --- a/src/libs/engine/DuplexPort.cpp +++ b/src/libs/engine/DuplexPort.cpp @@ -21,7 +21,6 @@ #include "TypedConnection.h" #include "OutputPort.h" #include "Node.h" -#include "Om.h" #include "util.h" using std::cerr; using std::cout; using std::endl; @@ -39,7 +38,7 @@ DuplexPort<T>::DuplexPort(Node* parent, const string& name, size_t index, size_t { assert(TypedPort<T>::_parent == parent); } -template DuplexPort<sample>::DuplexPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size, bool is_output); +template DuplexPort<Sample>::DuplexPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size, bool is_output); template DuplexPort<MidiMessage>::DuplexPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size, bool is_output); diff --git a/src/libs/engine/DuplexPort.h b/src/libs/engine/DuplexPort.h index 50f28418..c1f8e16e 100644 --- a/src/libs/engine/DuplexPort.h +++ b/src/libs/engine/DuplexPort.h @@ -60,7 +60,7 @@ protected: }; -template class DuplexPort<sample>; +template class DuplexPort<Sample>; template class DuplexPort<MidiMessage>; } // namespace Om diff --git a/src/libs/engine/Event.h b/src/libs/engine/Event.h index b394e797..f726339d 100644 --- a/src/libs/engine/Event.h +++ b/src/libs/engine/Event.h @@ -44,27 +44,27 @@ public: virtual ~Event() {} /** Execute this event in the audio thread (MUST be realtime safe). */ - virtual void execute(samplecount offset) { assert(!_executed); _executed = true; } + virtual void execute(SampleCount offset) { assert(!_executed); _executed = true; } /** Perform any actions after execution (ie send replies to commands) * (no realtime requirements). */ virtual void post_process() {} - inline samplecount time_stamp() { return _time_stamp; } + inline SampleCount time_stamp() { return _time_stamp; } protected: // Prevent copies Event(const Event&); Event& operator=(const Event&); - Event(CountedPtr<Responder> responder, samplecount timestamp) + Event(CountedPtr<Responder> responder, SampleCount timestamp) : _responder(responder) , _time_stamp(timestamp) , _executed(false) {} CountedPtr<Responder> _responder; - samplecount _time_stamp; + SampleCount _time_stamp; bool _executed; }; diff --git a/src/libs/engine/EventSource.h b/src/libs/engine/EventSource.h index e92a7757..28b07d18 100644 --- a/src/libs/engine/EventSource.h +++ b/src/libs/engine/EventSource.h @@ -41,9 +41,9 @@ public: virtual ~EventSource() {} - virtual Event* pop_earliest_queued_before(const samplecount time) = 0; + virtual Event* pop_earliest_queued_before(const SampleCount time) = 0; - virtual Event* pop_earliest_stamped_before(const samplecount time) = 0; + virtual Event* pop_earliest_stamped_before(const SampleCount time) = 0; protected: EventSource() {} diff --git a/src/libs/engine/GraphObject.h b/src/libs/engine/GraphObject.h index 7da0dcbb..409be3ea 100644 --- a/src/libs/engine/GraphObject.h +++ b/src/libs/engine/GraphObject.h @@ -57,7 +57,7 @@ public: inline GraphObject* parent() const { return _parent; } inline const string& name() const { return _name; } - virtual void process(samplecount nframes) = 0; + virtual void process(SampleCount nframes) = 0; /** Rename */ virtual void set_path(const Path& new_path) { diff --git a/src/libs/engine/OmApp.cpp b/src/libs/engine/Ingen.cpp index 0fcd8e1f..37e8f893 100644 --- a/src/libs/engine/OmApp.cpp +++ b/src/libs/engine/Ingen.cpp @@ -49,11 +49,11 @@ using std::cout; using std::cerr; using std::endl; namespace Om { -Ingen::m_instance = NULL; +Ingen* Ingen::m_instance = NULL; -static void -Ingen::instantiate(const char* port, AudioDriver* audio_driver = 0) +void +Ingen::instantiate(const char* port, AudioDriver* audio_driver) { assert(!m_instance); m_instance = new Ingen(port, audio_driver); diff --git a/src/libs/engine/OmApp.h b/src/libs/engine/Ingen.h index f59b15f5..0b1ecccf 100644 --- a/src/libs/engine/OmApp.h +++ b/src/libs/engine/Ingen.h @@ -17,6 +17,8 @@ #ifndef OMAPP_H #define OMAPP_H +#include <cassert> + template<typename T> class Queue; class Maid; @@ -44,13 +46,13 @@ template <typename T> class Driver; * * \ingroup engine */ -class OmApp +class Ingen { public: - ~OmApp(); + ~Ingen(); - static void instantiate(const char* port, AudioDriver* audio_driver = 0); - OmApp& instance() { assert(m_instance); return *m_instance; } + static void instantiate(const char* port, AudioDriver* audio_driver = 0); + static Ingen& instance() { assert(m_instance); return *m_instance; } int main(); @@ -73,17 +75,17 @@ public: /** Return the active driver for the given (template parameter) type. - * This is a hook for BridgeNode. See OmApp.cpp for specializations. */ + * This is a hook for BridgeNode. See Ingen.cpp for specializations. */ template<typename T> Driver<T>* driver(); private: - OmApp(const char* port, AudioDriver* audio_driver = 0); + Ingen(const char* port, AudioDriver* audio_driver = 0); // Prevent copies - OmApp(const OmApp&); - OmApp& operator=(const OmApp&); + Ingen(const Ingen&); + Ingen& operator=(const Ingen&); - static OmApp* m_instance; + static Ingen* m_instance; AudioDriver* m_audio_driver; OSCReceiver* m_osc_receiver; diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp index efd52e61..fefc39f7 100644 --- a/src/libs/engine/InputPort.cpp +++ b/src/libs/engine/InputPort.cpp @@ -21,7 +21,6 @@ #include "TypedConnection.h" #include "OutputPort.h" #include "Node.h" -#include "Om.h" #include "util.h" using std::cerr; using std::cout; using std::endl; @@ -35,7 +34,7 @@ InputPort<T>::InputPort(Node* parent, const string& name, size_t index, size_t p : TypedPort<T>(parent, name, index, poly, type, buffer_size) { } -template InputPort<sample>::InputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size); +template InputPort<Sample>::InputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size); template InputPort<MidiMessage>::InputPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size); @@ -78,7 +77,7 @@ InputPort<T>::add_connection(ListNode<TypedConnection<T>*>* const c) //assert( ! m_is_tied || m_tied_port != NULL); //assert( ! m_is_tied || m_buffers.at(0)->data() == m_tied_port->buffer(0)->data()); } -template void InputPort<sample>::add_connection(ListNode<TypedConnection<sample>*>* const c); +template void InputPort<Sample>::add_connection(ListNode<TypedConnection<Sample>*>* const c); template void InputPort<MidiMessage>::add_connection(ListNode<TypedConnection<MidiMessage>*>* const c); @@ -133,8 +132,8 @@ InputPort<T>::remove_connection(const OutputPort<T>* const src_port) return connection; } -template ListNode<TypedConnection<sample>*>* -InputPort<sample>::remove_connection(const OutputPort<sample>* const src_port); +template ListNode<TypedConnection<Sample>*>* +InputPort<Sample>::remove_connection(const OutputPort<Sample>* const src_port); template ListNode<TypedConnection<MidiMessage>*>* InputPort<MidiMessage>::remove_connection(const OutputPort<MidiMessage>* const src_port); @@ -151,7 +150,7 @@ InputPort<T>::update_buffers() for (size_t i=0; i < _poly; ++i) InputPort<T>::parent_node()->set_port_buffer(i, _index, m_buffers.at(i)->data()); } -template void InputPort<sample>::update_buffers(); +template void InputPort<Sample>::update_buffers(); template void InputPort<MidiMessage>::update_buffers(); @@ -168,7 +167,7 @@ InputPort<T>::is_connected_to(const OutputPort<T>* const port) const return false; } -template bool InputPort<sample>::is_connected_to(const OutputPort<sample>* const port) const; +template bool InputPort<Sample>::is_connected_to(const OutputPort<Sample>* const port) const; template bool InputPort<MidiMessage>::is_connected_to(const OutputPort<MidiMessage>* const port) const; @@ -201,7 +200,7 @@ InputPort<T>::tie(OutputPort<T>* const port) //cerr << "*** Tied " << this->path() << " <-> " << port->path() << endl; } -template void InputPort<sample>::tie(OutputPort<sample>* const port); +template void InputPort<Sample>::tie(OutputPort<Sample>* const port); template void InputPort<MidiMessage>::tie(OutputPort<MidiMessage>* const port); */ @@ -210,11 +209,11 @@ template void InputPort<MidiMessage>::tie(OutputPort<MidiMessage>* const port); */ template<> void -InputPort<sample>::process(samplecount nframes) +InputPort<Sample>::process(SampleCount nframes) { //assert(!m_is_tied || m_tied_port != NULL); - typedef List<TypedConnection<sample>*>::iterator TypedConnectionListIterator; + typedef List<TypedConnection<Sample>*>::iterator TypedConnectionListIterator; bool do_mixdown = true; if (m_connections.size() == 0) return; @@ -273,7 +272,7 @@ InputPort<sample>::process(samplecount nframes) */ template <> void -InputPort<MidiMessage>::process(samplecount nframes) +InputPort<MidiMessage>::process(SampleCount nframes) { //assert(!m_is_tied || m_tied_port != NULL); diff --git a/src/libs/engine/InputPort.h b/src/libs/engine/InputPort.h index f8b79cc8..e6ac55cb 100644 --- a/src/libs/engine/InputPort.h +++ b/src/libs/engine/InputPort.h @@ -55,7 +55,7 @@ public: const List<TypedConnection<T>*>& connections() { return m_connections; } - void process(samplecount nframes); + void process(SampleCount nframes); bool is_connected() const { return (m_connections.size() > 0); } bool is_connected_to(const OutputPort<T>* const port) const; @@ -81,7 +81,7 @@ private: }; -template class InputPort<sample>; +template class InputPort<Sample>; template class InputPort<MidiMessage>; } // namespace Om diff --git a/src/libs/engine/InternalNode.h b/src/libs/engine/InternalNode.h index ddff5bd1..995799e6 100644 --- a/src/libs/engine/InternalNode.h +++ b/src/libs/engine/InternalNode.h @@ -33,7 +33,7 @@ class Patch; class InternalNode : public NodeBase { public: - InternalNode(const Plugin* plugin, const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size) + InternalNode(const Plugin* plugin, const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) : NodeBase(plugin, path, poly, parent, srate, buffer_size), _is_added(false) { @@ -44,7 +44,7 @@ public: virtual void deactivate() { if (_is_added) remove_from_patch(); NodeBase::deactivate(); } - virtual void process(samplecount nframes) { NodeBase::process(nframes); } + virtual void process(SampleCount nframes) { NodeBase::process(nframes); } virtual void add_to_patch() { assert(!_is_added); _is_added = true; } virtual void remove_from_patch() { assert(_is_added); _is_added = false; } diff --git a/src/libs/engine/JackAudioDriver.cpp b/src/libs/engine/JackAudioDriver.cpp index d81ad23a..2df1f026 100644 --- a/src/libs/engine/JackAudioDriver.cpp +++ b/src/libs/engine/JackAudioDriver.cpp @@ -19,8 +19,7 @@ #include "tuning.h" #include <iostream> #include <cstdlib> -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "util.h" #include "Event.h" #include "QueuedEvent.h" @@ -46,7 +45,7 @@ namespace Om { //// JackAudioPort //// -JackAudioPort::JackAudioPort(JackAudioDriver* driver, DuplexPort<sample>* patch_port) +JackAudioPort::JackAudioPort(JackAudioDriver* driver, DuplexPort<Sample>* patch_port) : DriverPort(), ListNode<JackAudioPort*>(this), m_driver(driver), @@ -183,7 +182,7 @@ JackAudioDriver::activate() } else { cout << "[JackAudioDriver] Activated Jack client." << endl; #ifdef HAVE_LASH - om->lash_driver()->set_jack_client_name("Om"); // FIXME: unique name + Ingen::instance().lash_driver()->set_jack_client_name("Om"); // FIXME: unique name #endif } } @@ -193,7 +192,7 @@ void JackAudioDriver::deactivate() { if (m_is_activated) { - om->osc_receiver()->deactivate(); + Ingen::instance().osc_receiver()->deactivate(); jack_deactivate(m_client); m_is_activated = false; @@ -205,7 +204,7 @@ JackAudioDriver::deactivate() cout << "[JackAudioDriver] Deactivated Jack client." << endl; - om->post_processor()->stop(); + Ingen::instance().post_processor()->stop(); } } @@ -245,7 +244,7 @@ JackAudioDriver::remove_port(JackAudioPort* port) DriverPort* -JackAudioDriver::create_port(DuplexPort<sample>* patch_port) +JackAudioDriver::create_port(DuplexPort<Sample>* patch_port) { if (patch_port->buffer_size() == m_buffer_size) return new JackAudioPort(this, patch_port); @@ -278,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 = om->osc_receiver()->pop_earliest_queued_before(block_end))) { + while ((ev = Ingen::instance().osc_receiver()->pop_earliest_queued_before(block_end))) { ev->execute(0); // QueuedEvents are not sample accurate - om->post_processor()->push(ev); + Ingen::instance().post_processor()->push(ev); if (++num_events_processed > MAX_QUEUED_EVENTS) break; } - while ((ev = om->osc_receiver()->pop_earliest_stamped_before(block_end))) { + while ((ev = Ingen::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); - om->post_processor()->push(ev); + Ingen::instance().post_processor()->push(ev); ++num_events_processed; } if (num_events_processed > 0) - om->post_processor()->whip(); + Ingen::instance().post_processor()->whip(); } @@ -330,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); - om->midi_driver()->prepare_block(start_of_last_cycle, start_of_current_cycle); + Ingen::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<JackAudioPort*>::iterator i = m_ports.begin(); i != m_ports.end(); ++i) @@ -348,7 +347,7 @@ void JackAudioDriver::m_shutdown_cb() { cout << "[JackAudioDriver] Jack shutdown. Exiting." << endl; - om->quit(); + Ingen::instance().quit(); } diff --git a/src/libs/engine/JackAudioDriver.h b/src/libs/engine/JackAudioDriver.h index fdffc9bc..cfbcc4c5 100644 --- a/src/libs/engine/JackAudioDriver.h +++ b/src/libs/engine/JackAudioDriver.h @@ -39,7 +39,7 @@ typedef jack_default_audio_sample_t jack_sample_t; class JackAudioPort : public DriverPort, public ListNode<JackAudioPort*> { public: - JackAudioPort(JackAudioDriver* driver, DuplexPort<sample>* patch_port); + JackAudioPort(JackAudioDriver* driver, DuplexPort<Sample>* patch_port); ~JackAudioPort(); void add_to_driver(); @@ -49,7 +49,7 @@ public: void prepare_buffer(jack_nframes_t nframes); jack_port_t* jack_port() const { return m_jack_port; } - DuplexPort<sample>* patch_port() const { return m_patch_port; } + DuplexPort<Sample>* patch_port() const { return m_patch_port; } private: // Prevent copies (undefined) @@ -59,7 +59,7 @@ private: JackAudioDriver* m_driver; jack_port_t* m_jack_port; jack_sample_t* m_jack_buffer; ///< Cached for output ports - DuplexPort<sample>* m_patch_port; + DuplexPort<Sample>* m_patch_port; }; @@ -86,7 +86,7 @@ public: void process_events(jack_nframes_t block_start, jack_nframes_t block_end); - DriverPort* create_port(DuplexPort<sample>* patch_port); + DriverPort* create_port(DuplexPort<Sample>* patch_port); Patch* root_patch() { return m_root_patch; } void set_root_patch(Patch* patch) { m_root_patch = patch; } @@ -99,11 +99,11 @@ public: bool is_realtime() { return jack_is_realtime(m_client); } jack_client_t* jack_client() const { return m_client; } - samplecount buffer_size() const { return m_buffer_size; } - samplecount sample_rate() const { return m_sample_rate; } + SampleCount buffer_size() const { return m_buffer_size; } + SampleCount sample_rate() const { return m_sample_rate; } bool is_activated() const { return m_is_activated; } - samplecount time_stamp() const { return jack_frame_time(m_client); } + SampleCount time_stamp() const { return jack_frame_time(m_client); } private: // Prevent copies (undefined) diff --git a/src/libs/engine/JackMidiDriver.cpp b/src/libs/engine/JackMidiDriver.cpp index ea8d241e..91869ca6 100644 --- a/src/libs/engine/JackMidiDriver.cpp +++ b/src/libs/engine/JackMidiDriver.cpp @@ -18,11 +18,8 @@ #include <iostream> #include <cstdlib> #include <pthread.h> -#include "Om.h" -#include "OmApp.h" #include "types.h" #include "midi.h" -#include "OmApp.h" #include "Maid.h" #include "AudioDriver.h" #include "MidiMessage.h" @@ -86,11 +83,11 @@ JackMidiPort::remove_from_driver() * 1 cycle delay). */ void -JackMidiPort::prepare_block(const samplecount block_start, const samplecount block_end) +JackMidiPort::prepare_block(const SampleCount block_start, const SampleCount block_end) { assert(block_end >= block_start); - const samplecount nframes = block_end - block_start; + const SampleCount nframes = block_end - block_start; void* jack_buffer = jack_port_get_buffer(m_jack_port, nframes); const jack_nframes_t event_count = jack_midi_port_get_info(jack_buffer, nframes)->event_count; @@ -161,7 +158,7 @@ JackMidiDriver::deactivate() /** Build flat arrays of events for DSSI plugins for each Port. */ void -JackMidiDriver::prepare_block(const samplecount block_start, const samplecount block_end) +JackMidiDriver::prepare_block(const SampleCount block_start, const SampleCount block_end) { for (List<JackMidiPort*>::iterator i = m_in_ports.begin(); i != m_in_ports.end(); ++i) (*i)->prepare_block(block_start, block_end); diff --git a/src/libs/engine/JackMidiDriver.h b/src/libs/engine/JackMidiDriver.h index 95ce4209..2e155d60 100644 --- a/src/libs/engine/JackMidiDriver.h +++ b/src/libs/engine/JackMidiDriver.h @@ -42,7 +42,7 @@ public: JackMidiPort(JackMidiDriver* driver, DuplexPort<MidiMessage>* port); virtual ~JackMidiPort(); - void prepare_block(const samplecount block_start, const samplecount block_end); + void prepare_block(const SampleCount block_start, const SampleCount block_end); void add_to_driver(); void remove_from_driver(); @@ -82,7 +82,7 @@ public: bool is_activated() const { return m_is_activated; } bool is_enabled() const { return m_is_enabled; } - void prepare_block(const samplecount block_start, const samplecount block_end); + void prepare_block(const SampleCount block_start, const SampleCount block_end); JackMidiPort* create_port(DuplexPort<MidiMessage>* patch_port) { return new JackMidiPort(this, patch_port); } diff --git a/src/libs/engine/LADSPANode.cpp b/src/libs/engine/LADSPANode.cpp index 8c375fb4..356fe07d 100644 --- a/src/libs/engine/LADSPANode.cpp +++ b/src/libs/engine/LADSPANode.cpp @@ -33,7 +33,7 @@ namespace Om { * Object is not usable until instantiate() is called with success. * (It _will_ crash!) */ -LADSPANode::LADSPANode(const Plugin* plugin, const string& path, size_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, samplerate srate, size_t buffer_size) +LADSPANode::LADSPANode(const Plugin* plugin, const string& path, size_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size) : NodeBase(plugin, path, poly, parent, srate, buffer_size), _descriptor(descriptor), _instances(NULL) @@ -103,21 +103,21 @@ LADSPANode::instantiate() || LADSPA_IS_PORT_OUTPUT(_descriptor->PortDescriptors[j])); if (LADSPA_IS_PORT_INPUT(_descriptor->PortDescriptors[j])) { - port = new InputPort<sample>(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size); + port = new InputPort<Sample>(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size); _ports->at(j) = port; } else if (LADSPA_IS_PORT_OUTPUT(_descriptor->PortDescriptors[j])) { - port = new OutputPort<sample>(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size); + port = new OutputPort<Sample>(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size); _ports->at(j) = port; } assert(_ports->at(j) != NULL); - sample default_val = default_port_value(j); + Sample default_val = default_port_value(j); // Set default control val if (port->buffer_size() == 1) { - ((TypedPort<sample>*)port)->set_value(default_val, 0); + ((TypedPort<Sample>*)port)->set_value(default_val, 0); } else { - ((TypedPort<sample>*)port)->set_value(0.0f, 0); + ((TypedPort<Sample>*)port)->set_value(0.0f, 0); } } @@ -139,12 +139,12 @@ LADSPANode::activate() { NodeBase::activate(); - TypedPort<sample>* port = NULL; + TypedPort<Sample>* port = NULL; for (size_t i=0; i < _poly; ++i) { for (unsigned long j=0; j < _descriptor->PortCount; ++j) { - port = static_cast<TypedPort<sample>*>(_ports->at(j)); - set_port_buffer(i, j, ((TypedPort<sample>*)_ports->at(j))->buffer(i)->data()); + port = static_cast<TypedPort<Sample>*>(_ports->at(j)); + set_port_buffer(i, j, ((TypedPort<Sample>*)_ports->at(j))->buffer(i)->data()); /* if (port->type() == DataType::FLOAT && port->buffer_size() == 1) port->set_value(0.0f, 0); // FIXME else if (port->type() == DataType::FLOAT && port->buffer_size() > 1) @@ -168,7 +168,7 @@ LADSPANode::deactivate() void -LADSPANode::process(samplecount nframes) +LADSPANode::process(SampleCount nframes) { NodeBase::process(nframes); // mixes down input ports for (size_t i=0; i < _poly; ++i) @@ -183,7 +183,7 @@ LADSPANode::set_port_buffer(size_t voice, size_t port_num, void* buf) // Could be a MIDI port after this if (port_num < _descriptor->PortCount) - _descriptor->connect_port(_instances[voice], port_num, (sample*)buf); + _descriptor->connect_port(_instances[voice], port_num, (Sample*)buf); } #if 0 @@ -262,7 +262,7 @@ LADSPANode::get_port_vals(ulong port_index, PortInfo* info) #endif -sample +Sample LADSPANode::default_port_value(ulong port_index) { LADSPA_Data normal = 0.0f; diff --git a/src/libs/engine/LADSPANode.h b/src/libs/engine/LADSPANode.h index fde34bfb..1c98eb44 100644 --- a/src/libs/engine/LADSPANode.h +++ b/src/libs/engine/LADSPANode.h @@ -33,7 +33,7 @@ namespace Om { class LADSPANode : public NodeBase { public: - LADSPANode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, samplerate srate, size_t buffer_size); + LADSPANode(const Plugin* plugin, const string& name, size_t poly, Patch* parent, const LADSPA_Descriptor* descriptor, SampleRate srate, size_t buffer_size); virtual ~LADSPANode(); virtual bool instantiate(); @@ -41,7 +41,7 @@ public: void activate(); void deactivate(); - void process(samplecount nframes); + void process(SampleCount nframes); void set_port_buffer(size_t voice, size_t port_num, void* buf); @@ -54,7 +54,7 @@ protected: LADSPANode& operator=(const LADSPANode&); //void get_port_vals(ulong port_index, PortInfo* info); - sample default_port_value(ulong port_index); + Sample default_port_value(ulong port_index); const LADSPA_Descriptor* _descriptor; LADSPA_Handle* _instances; diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp index 15cb9567..59127915 100644 --- a/src/libs/engine/LV2Node.cpp +++ b/src/libs/engine/LV2Node.cpp @@ -36,7 +36,7 @@ LV2Node::LV2Node(const Plugin* plugin, const string& name, size_t poly, Patch* parent, - samplerate srate, + SampleRate srate, size_t buffer_size) : NodeBase(plugin, name, poly, parent, srate, buffer_size), _lv2_plugin(plugin->slv2_plugin()), @@ -101,10 +101,10 @@ LV2Node::instantiate() port_buffer_size = _buffer_size; if (is_input) { - port = new InputPort<sample>(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size); + port = new InputPort<Sample>(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size); _ports->at(j) = port; } else /* output */ { - port = new OutputPort<sample>(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size); + port = new OutputPort<Sample>(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size); _ports->at(j) = port; } @@ -115,9 +115,9 @@ LV2Node::instantiate() // Set default control val /*if (pi->is_control()) - ((TypedPort<sample>*)port)->set_value(pi->default_val(), 0); + ((TypedPort<Sample>*)port)->set_value(pi->default_val(), 0); else - ((TypedPort<sample>*)port)->set_value(0.0f, 0);*/ + ((TypedPort<Sample>*)port)->set_value(0.0f, 0);*/ } return true; } @@ -137,12 +137,12 @@ LV2Node::activate() { NodeBase::activate(); - TypedPort<sample>* port = NULL; + TypedPort<Sample>* port = NULL; for (size_t i=0; i < _poly; ++i) { for (unsigned long j=0; j < num_ports(); ++j) { - port = static_cast<TypedPort<sample>*>(_ports->at(j)); - set_port_buffer(i, j, ((TypedPort<sample>*)_ports->at(j))->buffer(i)->data()); + port = static_cast<TypedPort<Sample>*>(_ports->at(j)); + set_port_buffer(i, j, ((TypedPort<Sample>*)_ports->at(j))->buffer(i)->data()); if (port->type() == DataType::FLOAT && port->buffer_size() == 1) port->set_value(0.0f, 0); // FIXME else if (port->type() == DataType::FLOAT && port->buffer_size() > 1) @@ -164,7 +164,7 @@ LV2Node::deactivate() void -LV2Node::process(samplecount nframes) +LV2Node::process(SampleCount nframes) { NodeBase::process(nframes); // mixes down input ports for (size_t i=0; i < _poly; ++i) diff --git a/src/libs/engine/LV2Node.h b/src/libs/engine/LV2Node.h index 84deeaf2..54739fa2 100644 --- a/src/libs/engine/LV2Node.h +++ b/src/libs/engine/LV2Node.h @@ -37,7 +37,7 @@ public: const string& name, size_t poly, Patch* parent, - samplerate srate, + SampleRate srate, size_t buffer_size); virtual ~LV2Node(); @@ -47,7 +47,7 @@ public: void activate(); void deactivate(); - void process(samplecount nframes); + void process(SampleCount nframes); void set_port_buffer(size_t voice, size_t port_num, void* buf); diff --git a/src/libs/engine/LashDriver.cpp b/src/libs/engine/LashDriver.cpp index bdc385dd..0a014eb0 100644 --- a/src/libs/engine/LashDriver.cpp +++ b/src/libs/engine/LashDriver.cpp @@ -19,7 +19,6 @@ #include <iostream> #include <string> #include <cassert> -#include "OmApp.h" using std::cerr; using std::cout; using std::endl; using std::string; @@ -27,7 +26,7 @@ using std::string; namespace Om { -LashDriver::LashDriver(OmApp* app, lash_args_t* args) +LashDriver::LashDriver(Ingen* app, lash_args_t* args) : m_app(app), m_client(NULL), m_alsa_client_id(0) // FIXME: appropriate sentinel? diff --git a/src/libs/engine/LashDriver.h b/src/libs/engine/LashDriver.h index bb2a11de..1a36b59b 100644 --- a/src/libs/engine/LashDriver.h +++ b/src/libs/engine/LashDriver.h @@ -24,7 +24,7 @@ using std::string; namespace Om { -class OmApp; +class Ingen; /** Handles all support for LASH session management. @@ -32,7 +32,7 @@ class OmApp; class LashDriver { public: - LashDriver(OmApp* app, lash_args_t* args); + LashDriver(Ingen* app, lash_args_t* args); bool enabled() { return (m_client != NULL && lash_enabled(m_client)); } void process_events(); @@ -41,7 +41,7 @@ public: void restore_finished(); private: - OmApp* m_app; + Ingen* m_app; lash_client_t* m_client; int m_alsa_client_id; diff --git a/src/libs/engine/Maid.h b/src/libs/engine/Maid.h index 5b1b6087..c0e6cb74 100644 --- a/src/libs/engine/Maid.h +++ b/src/libs/engine/Maid.h @@ -28,7 +28,7 @@ * * cleanup() is meant to be called periodically to free memory, often * enough to prevent the queue from overdflowing. This is done by the - * main thread (in OmApp.cpp) since it has nothing better to do. + * main thread (in Ingen.cpp) since it has nothing better to do. * * \ingroup engine */ diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index e356e488..82e09ce7 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -19,10 +19,9 @@ libingen_la_SOURCES = \ Patch.cpp \ NodeFactory.h \ NodeFactory.cpp \ - Om.h \ Om.cpp \ - OmApp.h \ - OmApp.cpp \ + Ingen.h \ + Ingen.cpp \ JackAudioDriver.h \ JackAudioDriver.cpp \ OSCReceiver.h \ diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp index 504e289d..688fd48f 100644 --- a/src/libs/engine/MidiControlNode.cpp +++ b/src/libs/engine/MidiControlNode.cpp @@ -16,8 +16,7 @@ #include "MidiControlNode.h" #include <math.h> -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "PostProcessor.h" #include "MidiLearnEvent.h" #include "InputPort.h" @@ -30,7 +29,7 @@ namespace Om { -MidiControlNode::MidiControlNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size) +MidiControlNode::MidiControlNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) : InternalNode(new Plugin(Plugin::Internal, "Om:ControlNode"), path, 1, parent, srate, buffer_size), _learning(false) { @@ -39,22 +38,22 @@ MidiControlNode::MidiControlNode(const string& path, size_t poly, Patch* parent, _midi_in_port = new InputPort<MidiMessage>(this, "MIDI_In", 0, 1, DataType::MIDI, _buffer_size); _ports->at(0) = _midi_in_port; - _param_port = new InputPort<sample>(this, "Controller_Number", 1, 1, DataType::FLOAT, 1); + _param_port = new InputPort<Sample>(this, "Controller_Number", 1, 1, DataType::FLOAT, 1); _ports->at(1) = _param_port; - _log_port = new InputPort<sample>(this, "Logarithmic", 2, 1, DataType::FLOAT, 1); + _log_port = new InputPort<Sample>(this, "Logarithmic", 2, 1, DataType::FLOAT, 1); _ports->at(2) = _log_port; - _min_port = new InputPort<sample>(this, "Min", 3, 1, DataType::FLOAT, 1); + _min_port = new InputPort<Sample>(this, "Min", 3, 1, DataType::FLOAT, 1); _ports->at(3) = _min_port; - _max_port = new InputPort<sample>(this, "Max", 4, 1, DataType::FLOAT, 1); + _max_port = new InputPort<Sample>(this, "Max", 4, 1, DataType::FLOAT, 1); _ports->at(4) = _max_port; - _audio_port = new OutputPort<sample>(this, "Out_(AR)", 5, 1, DataType::FLOAT, _buffer_size); + _audio_port = new OutputPort<Sample>(this, "Out_(AR)", 5, 1, DataType::FLOAT, _buffer_size); _ports->at(5) = _audio_port; - _control_port = new OutputPort<sample>(this, "Out_(CR)", 6, 1, DataType::FLOAT, 1); + _control_port = new OutputPort<Sample>(this, "Out_(CR)", 6, 1, DataType::FLOAT, 1); _ports->at(6) = _control_port; _plugin.plug_label("midi_control_in"); @@ -63,7 +62,7 @@ MidiControlNode::MidiControlNode(const string& path, size_t poly, Patch* parent, void -MidiControlNode::process(samplecount nframes) +MidiControlNode::process(SampleCount nframes) { InternalNode::process(nframes); @@ -79,13 +78,13 @@ MidiControlNode::process(samplecount nframes) void -MidiControlNode::control(uchar control_num, uchar val, samplecount offset) +MidiControlNode::control(uchar control_num, uchar val, SampleCount offset) { assert(offset < _buffer_size); - sample scaled_value; + Sample scaled_value; - const sample nval = (val / 127.0f); // normalized [0, 1] + const Sample nval = (val / 127.0f); // normalized [0, 1] if (_learning) { assert(_learn_event != NULL); @@ -93,23 +92,23 @@ 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); - om->post_processor()->push(_learn_event); - om->post_processor()->whip(); + Ingen::instance().post_processor()->push(_learn_event); + Ingen::instance().post_processor()->whip(); _learning = false; _learn_event = NULL; } if (_log_port->buffer(0)->value_at(0) > 0.0f) { // haaaaack, stupid negatives and logarithms - sample log_offset = 0; + Sample log_offset = 0; if (_min_port->buffer(0)->value_at(0) < 0) log_offset = fabs(_min_port->buffer(0)->value_at(0)); - const sample min = log(_min_port->buffer(0)->value_at(0)+1+log_offset); - const sample max = log(_max_port->buffer(0)->value_at(0)+1+log_offset); + const Sample min = log(_min_port->buffer(0)->value_at(0)+1+log_offset); + const Sample max = log(_max_port->buffer(0)->value_at(0)+1+log_offset); scaled_value = expf(nval * (max - min) + min) - 1 - log_offset; } else { - const sample min = _min_port->buffer(0)->value_at(0); - const sample max = _max_port->buffer(0)->value_at(0); + const Sample min = _min_port->buffer(0)->value_at(0); + const Sample max = _max_port->buffer(0)->value_at(0); scaled_value = ((nval) * (max - min)) + min; } diff --git a/src/libs/engine/MidiControlNode.h b/src/libs/engine/MidiControlNode.h index 619c3bcd..4048abde 100644 --- a/src/libs/engine/MidiControlNode.h +++ b/src/libs/engine/MidiControlNode.h @@ -40,11 +40,11 @@ template <typename T> class OutputPort; class MidiControlNode : public InternalNode { public: - MidiControlNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size); + MidiControlNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); - void process(samplecount nframes); + void process(SampleCount nframes); - void control(uchar control_num, uchar val, samplecount offset); + void control(uchar control_num, uchar val, SampleCount offset); void learn(MidiLearnResponseEvent* ev) { _learning = true; _learn_event = ev; } @@ -56,12 +56,12 @@ private: bool _learning; InputPort<MidiMessage>* _midi_in_port; - InputPort<sample>* _param_port; - InputPort<sample>* _log_port; - InputPort<sample>* _min_port; - InputPort<sample>* _max_port; - OutputPort<sample>* _control_port; - OutputPort<sample>* _audio_port; + InputPort<Sample>* _param_port; + InputPort<Sample>* _log_port; + InputPort<Sample>* _min_port; + InputPort<Sample>* _max_port; + OutputPort<Sample>* _control_port; + OutputPort<Sample>* _audio_port; MidiLearnResponseEvent* _learn_event; }; diff --git a/src/libs/engine/MidiDriver.h b/src/libs/engine/MidiDriver.h index 7dc2383f..aa3a73ee 100644 --- a/src/libs/engine/MidiDriver.h +++ b/src/libs/engine/MidiDriver.h @@ -34,7 +34,7 @@ class MidiDriver : public Driver<MidiMessage> { public: /** Prepare events (however neccessary) for the specified block (realtime safe) */ - virtual void prepare_block(const samplecount block_start, const samplecount block_end) = 0; + virtual void prepare_block(const SampleCount block_start, const SampleCount block_end) = 0; }; @@ -68,7 +68,7 @@ public: DriverPort* create_port(DuplexPort<MidiMessage>* patch_port) { return NULL; } - void prepare_block(const samplecount block_start, const samplecount block_end) {} + void prepare_block(const SampleCount block_start, const SampleCount block_end) {} }; diff --git a/src/libs/engine/MidiMessage.h b/src/libs/engine/MidiMessage.h index e15b2fd1..fd415ef8 100644 --- a/src/libs/engine/MidiMessage.h +++ b/src/libs/engine/MidiMessage.h @@ -39,7 +39,7 @@ public: // Really just to allow setting to zero for generic algos MidiMessage(const int& i) : time(0), size(0), buffer(NULL) {} - samplecount time; + SampleCount time; size_t size; unsigned char* buffer; }; diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp index c6df626f..e6916a72 100644 --- a/src/libs/engine/MidiNoteNode.cpp +++ b/src/libs/engine/MidiNoteNode.cpp @@ -17,13 +17,12 @@ #include "MidiNoteNode.h" #include <cmath> #include <iostream> +#include "Ingen.h" #include "MidiMessage.h" #include "InputPort.h" #include "OutputPort.h" #include "Plugin.h" #include "Array.h" -#include "Om.h" -#include "OmApp.h" #include "AudioDriver.h" #include "util.h" #include "midi.h" @@ -34,7 +33,7 @@ using std::cerr; using std::cout; using std::endl; namespace Om { -MidiNoteNode::MidiNoteNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size) +MidiNoteNode::MidiNoteNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) : InternalNode(new Plugin(Plugin::Internal, "Om:NoteNode"), path, poly, parent, srate, buffer_size), _voices(new Voice[poly]), _sustain(false) @@ -44,19 +43,19 @@ MidiNoteNode::MidiNoteNode(const string& path, size_t poly, Patch* parent, sampl _midi_in_port = new InputPort<MidiMessage>(this, "MIDI_In", 0, 1, DataType::MIDI, _buffer_size); _ports->at(0) = _midi_in_port; - _freq_port = new OutputPort<sample>(this, "Frequency", 1, poly, DataType::FLOAT, _buffer_size); + _freq_port = new OutputPort<Sample>(this, "Frequency", 1, poly, DataType::FLOAT, _buffer_size); // new PortInfo("Frequency", AUDIO, OUTPUT, 440, 0, 99999), _buffer_size); _ports->at(1) = _freq_port; - _vel_port = new OutputPort<sample>(this, "Velocity", 2, poly, DataType::FLOAT, _buffer_size); + _vel_port = new OutputPort<Sample>(this, "Velocity", 2, poly, DataType::FLOAT, _buffer_size); // new PortInfo("Velocity", AUDIO, OUTPUT, 0, 0, 1), _buffer_size); _ports->at(2) = _vel_port; - _gate_port = new OutputPort<sample>(this, "Gate", 3, poly, DataType::FLOAT, _buffer_size); + _gate_port = new OutputPort<Sample>(this, "Gate", 3, poly, DataType::FLOAT, _buffer_size); // new PortInfo("Gate", AUDIO, OUTPUT, 0, 0, 1), _buffer_size); _ports->at(3) = _gate_port; - _trig_port = new OutputPort<sample>(this, "Trigger", 4, poly, DataType::FLOAT, _buffer_size); + _trig_port = new OutputPort<Sample>(this, "Trigger", 4, poly, DataType::FLOAT, _buffer_size); // new PortInfo("Trigger", AUDIO, OUTPUT, 0, 0, 1), _buffer_size); _ports->at(4) = _trig_port; @@ -72,7 +71,7 @@ MidiNoteNode::~MidiNoteNode() void -MidiNoteNode::process(samplecount nframes) +MidiNoteNode::process(SampleCount nframes) { InternalNode::process(nframes); @@ -115,9 +114,10 @@ MidiNoteNode::process(samplecount nframes) void -MidiNoteNode::note_on(uchar note_num, uchar velocity, samplecount offset) +MidiNoteNode::note_on(uchar note_num, uchar velocity, SampleCount offset) { - const jack_nframes_t time_stamp = om->audio_driver()->time_stamp(); + // FIXME: this is stupid.. + const jack_nframes_t time_stamp = Ingen::instance().audio_driver()->time_stamp(); assert(offset < _buffer_size); assert(note_num <= 127); @@ -175,7 +175,7 @@ MidiNoteNode::note_on(uchar note_num, uchar velocity, samplecount offset) assert(_keys[voice->note].voice == voice_num); // one-sample jitter hack to avoid having to deal with trigger sample "next time" - if (offset == (samplecount)(_buffer_size-1)) + if (offset == (SampleCount)(_buffer_size-1)) --offset; _freq_port->buffer(voice_num)->set(note_to_freq(note_num), offset); @@ -194,7 +194,7 @@ MidiNoteNode::note_on(uchar note_num, uchar velocity, samplecount offset) void -MidiNoteNode::note_off(uchar note_num, samplecount offset) +MidiNoteNode::note_off(uchar note_num, SampleCount offset) { assert(offset < _buffer_size); @@ -217,7 +217,7 @@ MidiNoteNode::note_off(uchar note_num, samplecount offset) void -MidiNoteNode::free_voice(size_t voice, samplecount offset) +MidiNoteNode::free_voice(size_t voice, SampleCount offset) { // Find a key to reassign to the freed voice (the newest, if there is one) Key* replace_key = NULL; @@ -254,7 +254,7 @@ MidiNoteNode::free_voice(size_t voice, samplecount offset) void -MidiNoteNode::all_notes_off(samplecount offset) +MidiNoteNode::all_notes_off(SampleCount offset) { //cerr << "Note off starting at sample " << offset << endl; assert(offset < _buffer_size); @@ -286,7 +286,7 @@ MidiNoteNode::sustain_on() void -MidiNoteNode::sustain_off(samplecount offset) +MidiNoteNode::sustain_off(SampleCount offset) { _sustain = false; diff --git a/src/libs/engine/MidiNoteNode.h b/src/libs/engine/MidiNoteNode.h index db51235a..e7d3831a 100644 --- a/src/libs/engine/MidiNoteNode.h +++ b/src/libs/engine/MidiNoteNode.h @@ -39,17 +39,17 @@ template <typename T> class OutputPort; class MidiNoteNode : public InternalNode { public: - MidiNoteNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size); + MidiNoteNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); ~MidiNoteNode(); - void process(samplecount nframes); + void process(SampleCount nframes); - void note_on(uchar note_num, uchar velocity, samplecount offset); - void note_off(uchar note_num, samplecount offset); - void all_notes_off(samplecount offset); + void note_on(uchar note_num, uchar velocity, SampleCount offset); + void note_off(uchar note_num, SampleCount offset); + void all_notes_off(SampleCount offset); void sustain_on(); - void sustain_off(samplecount offset); + void sustain_off(SampleCount offset); private: @@ -57,28 +57,28 @@ private: struct Key { enum State { OFF, ON_ASSIGNED, ON_UNASSIGNED }; Key() : state(OFF), voice(0), time(0) {} - State state; size_t voice; samplecount time; + State state; size_t voice; SampleCount time; }; /** Voice, one of these always exists for each voice */ struct Voice { enum State { FREE, ACTIVE, HOLDING }; Voice() : state(FREE), note(0) {} - State state; uchar note; samplecount time; + State state; uchar note; SampleCount time; }; float note_to_freq(int num); - void free_voice(size_t voice, samplecount offset); + void free_voice(size_t voice, SampleCount offset); Voice* _voices; Key _keys[128]; bool _sustain; ///< Whether or not hold pedal is depressed InputPort<MidiMessage>* _midi_in_port; - OutputPort<sample>* _freq_port; - OutputPort<sample>* _vel_port; - OutputPort<sample>* _gate_port; - OutputPort<sample>* _trig_port; + OutputPort<Sample>* _freq_port; + OutputPort<Sample>* _vel_port; + OutputPort<Sample>* _gate_port; + OutputPort<Sample>* _trig_port; }; diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp index b2b7b3ce..98a30011 100644 --- a/src/libs/engine/MidiTriggerNode.cpp +++ b/src/libs/engine/MidiTriggerNode.cpp @@ -25,7 +25,7 @@ namespace Om { -MidiTriggerNode::MidiTriggerNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size) +MidiTriggerNode::MidiTriggerNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) : InternalNode(new Plugin(Plugin::Internal, "Om:TriggerNode"), path, 1, parent, srate, buffer_size) { _ports = new Array<Port*>(5); @@ -33,19 +33,19 @@ MidiTriggerNode::MidiTriggerNode(const string& path, size_t poly, Patch* parent, _midi_in_port = new InputPort<MidiMessage>(this, "MIDI_In", 0, 1, DataType::MIDI, _buffer_size); _ports->at(0) = _midi_in_port; - _note_port = new InputPort<sample>(this, "Note_Number", 1, 1, DataType::FLOAT, 1); + _note_port = new InputPort<Sample>(this, "Note_Number", 1, 1, DataType::FLOAT, 1); // new PortInfo("Note Number", CONTROL, INPUT, INTEGER, 60, 0, 127), 1); _ports->at(1) = _note_port; - _gate_port = new OutputPort<sample>(this, "Gate", 2, 1, DataType::FLOAT, _buffer_size); + _gate_port = new OutputPort<Sample>(this, "Gate", 2, 1, DataType::FLOAT, _buffer_size); // new PortInfo("Gate", AUDIO, OUTPUT, 0, 0, 1), _buffer_size); _ports->at(2) = _gate_port; - _trig_port = new OutputPort<sample>(this, "Trigger", 3, 1, DataType::FLOAT, _buffer_size); + _trig_port = new OutputPort<Sample>(this, "Trigger", 3, 1, DataType::FLOAT, _buffer_size); // new PortInfo("Trigger", AUDIO, OUTPUT, 0, 0, 1), _buffer_size); _ports->at(3) = _trig_port; - _vel_port = new OutputPort<sample>(this, "Velocity", 4, poly, DataType::FLOAT, _buffer_size); + _vel_port = new OutputPort<Sample>(this, "Velocity", 4, poly, DataType::FLOAT, _buffer_size); // new PortInfo("Velocity", AUDIO, OUTPUT, 0, 0, 1), _buffer_size); _ports->at(4) = _vel_port; @@ -55,7 +55,7 @@ MidiTriggerNode::MidiTriggerNode(const string& path, size_t poly, Patch* parent, void -MidiTriggerNode::process(samplecount nframes) +MidiTriggerNode::process(SampleCount nframes) { InternalNode::process(nframes); @@ -86,16 +86,16 @@ MidiTriggerNode::process(samplecount nframes) void -MidiTriggerNode::note_on(uchar note_num, uchar velocity, samplecount offset) +MidiTriggerNode::note_on(uchar note_num, uchar velocity, SampleCount offset) { //std::cerr << "Note on starting at sample " << offset << std::endl; assert(offset < _buffer_size); - const sample filter_note = _note_port->buffer(0)->value_at(0); + const Sample filter_note = _note_port->buffer(0)->value_at(0); if (filter_note >= 0.0 && filter_note < 127.0 && (note_num == (uchar)filter_note)){ // See comments in MidiNoteNode::note_on (FIXME) - if (offset == (samplecount)(_buffer_size-1)) + if (offset == (SampleCount)(_buffer_size-1)) --offset; _gate_port->buffer(0)->set(1.0f, offset); @@ -107,7 +107,7 @@ MidiTriggerNode::note_on(uchar note_num, uchar velocity, samplecount offset) void -MidiTriggerNode::note_off(uchar note_num, samplecount offset) +MidiTriggerNode::note_off(uchar note_num, SampleCount offset) { assert(offset < _buffer_size); diff --git a/src/libs/engine/MidiTriggerNode.h b/src/libs/engine/MidiTriggerNode.h index 6c3d8f57..14b586de 100644 --- a/src/libs/engine/MidiTriggerNode.h +++ b/src/libs/engine/MidiTriggerNode.h @@ -43,19 +43,19 @@ template <typename T> class OutputPort; class MidiTriggerNode : public InternalNode { public: - MidiTriggerNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size); + MidiTriggerNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); - void process(samplecount nframes); + void process(SampleCount nframes); - void note_on(uchar note_num, uchar velocity, samplecount offset); - void note_off(uchar note_num, samplecount offset); + void note_on(uchar note_num, uchar velocity, SampleCount offset); + void note_off(uchar note_num, SampleCount offset); private: InputPort<MidiMessage>* _midi_in_port; - InputPort<sample>* _note_port; - OutputPort<sample>* _gate_port; - OutputPort<sample>* _trig_port; - OutputPort<sample>* _vel_port; + InputPort<Sample>* _note_port; + OutputPort<Sample>* _gate_port; + OutputPort<Sample>* _trig_port; + OutputPort<Sample>* _vel_port; }; diff --git a/src/libs/engine/NodeBase.cpp b/src/libs/engine/NodeBase.cpp index be1a5963..f5c4e546 100644 --- a/src/libs/engine/NodeBase.cpp +++ b/src/libs/engine/NodeBase.cpp @@ -18,9 +18,8 @@ #include <cassert> #include <iostream> #include <stdint.h> -#include "Om.h" -#include "OmApp.h" #include "util.h" +#include "Ingen.h" #include "Array.h" #include "Plugin.h" #include "ClientBroadcaster.h" @@ -34,7 +33,7 @@ using std::cout; using std::cerr; using std::endl; namespace Om { -NodeBase::NodeBase(const Plugin* plugin, const string& name, size_t poly, Patch* parent, samplerate srate, size_t buffer_size) +NodeBase::NodeBase(const Plugin* plugin, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) : Node(parent, name), _plugin(plugin), _poly(poly), @@ -85,16 +84,16 @@ void NodeBase::send_creation_messages(ClientInterface* client) const { cerr << "FIXME: send_creation\n"; - //om->client_broadcaster()->send_node_to(client, this); + //Ingen::instance().client_broadcaster()->send_node_to(client, this); } */ void NodeBase::add_to_store() { - om->object_store()->add(this); + Ingen::instance().object_store()->add(this); for (size_t i=0; i < num_ports(); ++i) - om->object_store()->add(_ports->at(i)); + Ingen::instance().object_store()->add(_ports->at(i)); } @@ -102,17 +101,17 @@ void NodeBase::remove_from_store() { // Remove self - TreeNode<GraphObject*>* node = om->object_store()->remove(path()); + TreeNode<GraphObject*>* node = Ingen::instance().object_store()->remove(path()); if (node != NULL) { - assert(om->object_store()->find(path()) == NULL); + assert(Ingen::instance().object_store()->find(path()) == NULL); delete node; } // Remove ports for (size_t i=0; i < num_ports(); ++i) { - node = om->object_store()->remove(_ports->at(i)->path()); + node = Ingen::instance().object_store()->remove(_ports->at(i)->path()); if (node != NULL) { - assert(om->object_store()->find(_ports->at(i)->path()) == NULL); + assert(Ingen::instance().object_store()->find(_ports->at(i)->path()) == NULL); delete node; } } @@ -122,7 +121,7 @@ NodeBase::remove_from_store() /** Runs the Node for the specified number of frames (block size) */ void -NodeBase::process(samplecount nframes) +NodeBase::process(SampleCount nframes) { assert(_activated); // Mix down any ports with multiple inputs @@ -146,23 +145,23 @@ NodeBase::set_path(const Path& new_path) // Reinsert ports for (size_t i=0; i < num_ports(); ++i) { - treenode = om->object_store()->remove(old_path +"/"+ _ports->at(i)->name()); + treenode = Ingen::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()); - om->object_store()->add(treenode); + Ingen::instance().object_store()->add(treenode); } // Rename and reinsert self - treenode = om->object_store()->remove(old_path); + treenode = Ingen::instance().object_store()->remove(old_path); assert(treenode != NULL); assert(treenode->node() == this); GraphObject::set_path(new_path); treenode->key(new_path); - om->object_store()->add(treenode); + Ingen::instance().object_store()->add(treenode); - assert(om->object_store()->find(new_path) == this); + assert(Ingen::instance().object_store()->find(new_path) == this); } diff --git a/src/libs/engine/NodeBase.h b/src/libs/engine/NodeBase.h index ddcb8ef5..859a3306 100644 --- a/src/libs/engine/NodeBase.h +++ b/src/libs/engine/NodeBase.h @@ -40,7 +40,7 @@ namespace Shared { class NodeBase : public Node { public: - NodeBase(const Plugin* plugin, const string& name, size_t poly, Patch* parent, samplerate srate, size_t buffer_size); + NodeBase(const Plugin* plugin, const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); virtual ~NodeBase(); @@ -48,7 +48,7 @@ public: virtual void deactivate(); bool activated() { return _activated; } - virtual void process(samplecount nframes); + virtual void process(SampleCount nframes); virtual void set_port_buffer(size_t voice, size_t port_num, void* buf) {} @@ -89,7 +89,7 @@ protected: size_t _poly; - samplerate _srate; + SampleRate _srate; size_t _buffer_size; bool _activated; diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp index 652576a7..60d8f44a 100644 --- a/src/libs/engine/NodeFactory.cpp +++ b/src/libs/engine/NodeFactory.cpp @@ -22,24 +22,15 @@ #include <float.h> #include <cmath> #include <dlfcn.h> +#include "Ingen.h" #include "AudioDriver.h" #include "MidiNoteNode.h" #include "MidiTriggerNode.h" #include "MidiControlNode.h" -#if 0 -#include "AudioInputNode.h" -#include "AudioOutputNode.h" -#include "ControlInputNode.h" -#include "ControlOutputNode.h" -#include "MidiInputNode.h" -#include "MidiOutputNode.h" -#endif #include "TransportNode.h" #include "PluginLibrary.h" #include "Plugin.h" #include "Patch.h" -#include "Om.h" -#include "OmApp.h" #ifdef HAVE_SLV2 #include "LV2Node.h" #include <slv2/slv2.h> @@ -227,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, om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size()); + MidiInputNode* tn = new MidiInputNode(name, 1, parent, Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); return tn; } else if (plug_label == "midi_output") { - MidiOutputNode* tn = new MidiOutputNode(name, 1, parent, om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size()); + MidiOutputNode* tn = new MidiOutputNode(name, 1, parent, Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); return tn; } else if (plug_label == "audio_input") { AudioInputNode* in = new AudioInputNode(name, poly, parent, - om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size()); + Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); return in; } else if (plug_label == "control_input") { ControlInputNode* in = new ControlInputNode(name, poly, parent, - om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size()); + Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); return in; } else if (plug_label == "audio_output") { AudioOutputNode* on = new AudioOutputNode(name, poly, parent, - om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size()); + Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); return on; } else if (plug_label == "control_output") { ControlOutputNode* on = new ControlOutputNode(name, poly, parent, - om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size()); + Ingen::instance().audio_driver()->sample_rate(), Ingen::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, om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size()); + MidiNoteNode* mn = new MidiNoteNode(name, poly, parent, Ingen::instance().audio_driver()->sample_rate(), Ingen::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, om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size()); + MidiTriggerNode* mn = new MidiTriggerNode(name, 1, parent, Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); return mn; } else if (plug_label == "midi_control_in") { - MidiControlNode* mn = new MidiControlNode(name, 1, parent, om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size()); + MidiControlNode* mn = new MidiControlNode(name, 1, parent, Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); return mn; } else if (plug_label == "transport") { - TransportNode* tn = new TransportNode(name, 1, parent, om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size()); + TransportNode* tn = new TransportNode(name, 1, parent, Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); return tn; } else { cerr << "Unknown internal plugin type '" << plug_label << "'" << endl; @@ -343,7 +334,7 @@ NodeFactory::load_lv2_plugin(const string& plug_uri, if (plugin) { n = new Om::LV2Node(plugin, node_name, poly, parent, - om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size()); + Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); bool success = ((LV2Node*)n)->instantiate(); if (!success) { delete n; @@ -519,7 +510,7 @@ NodeFactory::load_dssi_plugin(const string& uri, } n = new DSSINode(plugin, name, poly, parent, descriptor, - om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size()); + Ingen::instance().audio_driver()->sample_rate(), Ingen::instance().audio_driver()->buffer_size()); bool success = ((DSSINode*)n)->instantiate(); if (!success) { delete n; @@ -686,7 +677,7 @@ NodeFactory::load_ladspa_plugin(const string& uri, } n = new LADSPANode(plugin, name, poly, parent, descriptor, - om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size()); + Ingen::instance().audio_driver()->sample_rate(), Ingen::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 7ab78240..a902f629 100644 --- a/src/libs/engine/OSCClient.cpp +++ b/src/libs/engine/OSCClient.cpp @@ -18,8 +18,6 @@ #include <cassert> #include <iostream> #include <unistd.h> -#include "Om.h" -#include "OmApp.h" #include "ObjectStore.h" #include "NodeFactory.h" #include "util.h" @@ -136,9 +134,9 @@ OSCClient::num_plugins(uint32_t num) void OSCClient::plugins() { - om->node_factory()->lock_plugin_list(); + Ingen::instance().node_factory()->lock_plugin_list(); - const list<Plugin*>& plugs = om->node_factory()->plugins(); + const list<Plugin*>& plugs = Ingen::instance().node_factory()->plugins(); const Plugin* plugin; lo_timetag tt; @@ -177,7 +175,7 @@ OSCClient::plugins() for (list<lo_bundle>::const_iterator i = msgs.begin(); i != msgs.end(); ++i) lo_message_free(*i); - om->node_factory()->unlock_plugin_list(); + Ingen::instance().node_factory()->unlock_plugin_list(); } */ @@ -278,7 +276,7 @@ void OSCClient::new_node(const string& plugin_type, // Send control values for (size_t i=0; i < node->ports().size(); ++i) { - TypedPort<sample>* port = (TypedPort<sample>*)node->ports().at(i); + TypedPort<Sample>* port = (TypedPort<Sample>*)node->ports().at(i); if (port->port_info()->is_input() && port->port_info()->is_control()) control_change(port->path(), port->buffer(0)->value_at(0)); } @@ -474,8 +472,8 @@ OSCClient::object_renamed(const string& old_path, const string& new_path) void OSCClient::all_objects() { - for (Tree<GraphObject*>::iterator i = om->object_store()->objects().begin(); - i != om->object_store()->objects().end(); ++i) + for (Tree<GraphObject*>::iterator i = Ingen::instance().object_store()->objects().begin(); + i != Ingen::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/OSCReceiver.cpp b/src/libs/engine/OSCReceiver.cpp index c03dbf29..1f5ef4d0 100644 --- a/src/libs/engine/OSCReceiver.cpp +++ b/src/libs/engine/OSCReceiver.cpp @@ -20,8 +20,6 @@ #include <string> #include <lo/lo.h> #include "types.h" -#include "Om.h" -#include "OmApp.h" #include "util/Queue.h" #include "util/CountedPtr.h" #include "QueuedEventSource.h" @@ -894,12 +892,15 @@ OSCReceiver::generic_cb(const char* path, const char* types, lo_arg** argv, int int OSCReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* user_data) { + const lo_address addr = lo_message_get_source(msg); + char* const url = lo_address_get_url(addr); + cerr << "Unknown command " << path << " (" << types << "), sending error.\n"; string error_msg = "Unknown command: "; error_msg.append(path).append(" ").append(types); - om->client_broadcaster()->send_error(error_msg); + OSCResponder(0, url).respond_error(error_msg); return 0; } diff --git a/src/libs/engine/OSCResponder.cpp b/src/libs/engine/OSCResponder.cpp index fd076e80..4d337aa5 100644 --- a/src/libs/engine/OSCResponder.cpp +++ b/src/libs/engine/OSCResponder.cpp @@ -15,8 +15,7 @@ */ #include "OSCResponder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "ClientBroadcaster.h" #include "interface/ClientKey.h" #include <cstdlib> @@ -55,7 +54,7 @@ OSCResponder::~OSCResponder() CountedPtr<Shared::ClientInterface> OSCResponder::find_client() { - return om->client_broadcaster()->client(ClientKey(ClientKey::OSC_URL, _url)); + return Ingen::instance().client_broadcaster()->client(ClientKey(ClientKey::OSC_URL, _url)); } diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index b96414e5..38ddc55f 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -16,8 +16,7 @@ #include "ObjectSender.h" #include "interface/ClientInterface.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "ObjectStore.h" #include "Patch.h" #include "Node.h" @@ -33,11 +32,11 @@ namespace Om { void ObjectSender::send_all(ClientInterface* client) { - Patch* root = om->object_store()->find_patch("/"); + Patch* root = Ingen::instance().object_store()->find_patch("/"); assert(root); send_patch(client, root); - /*for (Tree<GraphObject*>::iterator i = om->object_store()->objects().begin(); - i != om->object_store()->objects().end(); ++i) + /*for (Tree<GraphObject*>::iterator i = Ingen::instance().object_store()->objects().begin(); + i != Ingen::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); @@ -70,7 +69,7 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch) // Control port, send value if (port->type() == DataType::FLOAT && port->buffer_size() == 1) client->control_change(port->path(), - dynamic_cast<TypedPort<sample>*>(port)->buffer(0)->value_at(0)); + dynamic_cast<TypedPort<Sample>*>(port)->buffer(0)->value_at(0)); */ } @@ -160,7 +159,7 @@ ObjectSender::send_port(ClientInterface* client, const Port* port) // Send control value if (port->type() == DataType::FLOAT && port->buffer_size() == 1) { - sample default_value = dynamic_cast<const TypedPort<sample>*>( + Sample default_value = dynamic_cast<const TypedPort<Sample>*>( port)->buffer(0)->value_at(0); //cerr << port->path() << " sending default value " << default_value << endl; client->control_change(port->path(), default_value); @@ -176,9 +175,9 @@ ObjectSender::send_port(ClientInterface* client, const Port* port) void ObjectSender::send_plugins(ClientInterface* client) { - om->node_factory()->lock_plugin_list(); + Ingen::instance().node_factory()->lock_plugin_list(); - const list<Plugin*>& plugs = om->node_factory()->plugins(); + const list<Plugin*>& plugs = Ingen::instance().node_factory()->plugins(); /* lo_timetag tt; @@ -222,7 +221,7 @@ ObjectSender::send_plugins(ClientInterface* client) for (list<lo_bundle>::const_iterator i = msgs.begin(); i != msgs.end(); ++i) lo_message_free(*i); */ - om->node_factory()->unlock_plugin_list(); + Ingen::instance().node_factory()->unlock_plugin_list(); } diff --git a/src/libs/engine/ObjectStore.cpp b/src/libs/engine/ObjectStore.cpp index 82f0606a..d56b3e7b 100644 --- a/src/libs/engine/ObjectStore.cpp +++ b/src/libs/engine/ObjectStore.cpp @@ -15,8 +15,6 @@ */ #include "ObjectStore.h" -#include "Om.h" -#include "OmApp.h" #include "Patch.h" #include "Node.h" #include "Port.h" diff --git a/src/libs/engine/Om.cpp b/src/libs/engine/Om.cpp index d6e624fe..8b4ac0fb 100644 --- a/src/libs/engine/Om.cpp +++ b/src/libs/engine/Om.cpp @@ -15,7 +15,7 @@ */ #include "config.h" -#include "OmApp.h" +#include "Ingen.h" #ifdef HAVE_LASH #include "LashDriver.h" #endif @@ -29,5 +29,5 @@ */ namespace Om { - OmApp* om = 0; + Ingen* om = 0; } diff --git a/src/libs/engine/Om.h b/src/libs/engine/Om.h deleted file mode 100644 index 576b3ae7..00000000 --- a/src/libs/engine/Om.h +++ /dev/null @@ -1,38 +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 OM_H -#define OM_H - -// FIXME: this dependency has to go -#include "config.h" - - -/* Things all over the place access various bits of Om through this. - * This was a bad design decision, it just evolved this way :/ - * I may refactor it eventually, but it works. - */ - -/** \defgroup engine Engine - */ -namespace Om -{ - class OmApp; - extern OmApp* om; -} - -#endif // OM_H - diff --git a/src/libs/engine/OmInProcess.cpp b/src/libs/engine/OmInProcess.cpp index af27e7c9..b5cee7f3 100644 --- a/src/libs/engine/OmInProcess.cpp +++ b/src/libs/engine/OmInProcess.cpp @@ -19,9 +19,7 @@ #include <stdio.h> #include <memory.h> #include <jack/jack.h> - -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "OSCReceiver.h" #include "JackAudioDriver.h" #ifdef HAVE_LASH @@ -38,7 +36,7 @@ extern "C" void* run_main(void* arg) { - Om::om->main(); + Om::Ingen::instance().main(); #ifdef HAVE_LASH delete Om::lash_driver; @@ -55,7 +53,7 @@ pthread_t main_thread; int jack_initialize(jack_client_t* client, const char* load_init) { - if ((Om::om = new Om::OmApp(load_init, new Om::JackAudioDriver(client))) != NULL) { + if ((Om::om = new Om::Ingen(load_init, new Om::JackAudioDriver(client))) != NULL) { pthread_create(&main_thread, NULL, run_main, NULL); return 0; // Success } else { @@ -68,7 +66,7 @@ void jack_finish(void* arg) { void* ret; - Om::om->quit(); + Om::Ingen::instance().quit(); pthread_join(main_thread, &ret); } diff --git a/src/libs/engine/OutputPort.h b/src/libs/engine/OutputPort.h index 4ec9f7a4..f1e08a31 100644 --- a/src/libs/engine/OutputPort.h +++ b/src/libs/engine/OutputPort.h @@ -60,7 +60,7 @@ private: }; -template class OutputPort<sample>; +template class OutputPort<Sample>; } // namespace Om diff --git a/src/libs/engine/Patch.cpp b/src/libs/engine/Patch.cpp index 418bb79e..358bc778 100644 --- a/src/libs/engine/Patch.cpp +++ b/src/libs/engine/Patch.cpp @@ -21,24 +21,15 @@ #include "Patch.h" #include "Plugin.h" #include "Port.h" -#include "ClientBroadcaster.h" -#include "InternalNode.h" #include "Connection.h" -#include "Om.h" -#include "OmApp.h" -#include "TypedPort.h" -#include "ObjectStore.h" -#include "InputPort.h" -#include "OutputPort.h" #include "DuplexPort.h" -#include "interface/ClientInterface.h" using std::cerr; using std::cout; using std::endl; namespace Om { -Patch::Patch(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size, size_t internal_poly) +Patch::Patch(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size, size_t internal_poly) : NodeBase(new Plugin(Plugin::Patch, "Om:Patch"), path, poly, parent, srate, buffer_size), _internal_poly(internal_poly), _process_order(NULL), @@ -123,7 +114,7 @@ Patch::process(bool p) * Calls all Nodes in the order _process_order specifies. */ void -Patch::process(samplecount nframes) +Patch::process(SampleCount nframes) { if (_process_order == NULL || !_process) return; @@ -148,48 +139,6 @@ Patch::process(samplecount nframes) } -#if 0 -void -Patch::send_creation_messages(ClientInterface* client) const -{ - cerr << "FIXME: creation\n"; - - om->client_broadcaster()->send_patch_to(client, this); - - for (List<Node*>::const_iterator j = _nodes.begin(); j != _nodes.end(); ++j) { - Node* node = (*j); - Port* port = node->as_port(); // NULL unless a bridge node - node->send_creation_messages(client); - - usleep(100); - - // If this is a bridge (input/output) node, send the patch control value as well - if (port != NULL && port->port_info()->is_control()) - om->client_broadcaster()->send_control_change_to(client, port->path(), - ((TypedPort<sample>*)port)->buffer(0)->value_at(0)); - } - - for (List<Connection*>::const_iterator j = _connections.begin(); j != _connections.end(); ++j) { - om->client_broadcaster()->send_connection_to(client, *j); - } - - // Send port information - /*for (size_t i=0; i < _ports.size(); ++i) { - Port* const port = _ports.at(i); - - // Send metadata - const map<string, string>& data = port->metadata(); - for (map<string, string>::const_iterator i = data.begin(); i != data.end(); ++i) - om->client_broadcaster()->send_metadata_update_to(client, port->path(), (*i).first, (*i).second); - - if (port->port_info()->is_control()) - om->client_broadcaster()->send_control_change_to(client, port->path(), - ((TypedPort<sample>*)port)->buffer(0)->value_at(0)); - }*/ -} -#endif - - void Patch::add_to_store() { @@ -209,10 +158,8 @@ Patch::remove_from_store() NodeBase::remove_from_store(); // Remove nodes - for (List<Node*>::iterator j = _nodes.begin(); j != _nodes.end(); ++j) { + for (List<Node*>::iterator j = _nodes.begin(); j != _nodes.end(); ++j) (*j)->remove_from_store(); - assert(om->object_store()->find((*j)->path()) == NULL); - } } @@ -298,7 +245,7 @@ Patch::create_port(const string& name, DataType type, size_t buffer_size, bool i // FIXME: is it possible to just "pass" the type directly as the template parameter somehow? if (type == DataType::FLOAT) - return new DuplexPort<sample>(this, name, 0, _poly, type, buffer_size, is_output); + return new DuplexPort<Sample>(this, name, 0, _poly, type, buffer_size, is_output); else if (type == DataType::MIDI) return new DuplexPort<MidiMessage>(this, name, 0, _poly, type, buffer_size, is_output); else diff --git a/src/libs/engine/Patch.h b/src/libs/engine/Patch.h index 494b4cf1..59993b68 100644 --- a/src/libs/engine/Patch.h +++ b/src/libs/engine/Patch.h @@ -48,13 +48,13 @@ namespace Shared { class Patch : public NodeBase { public: - Patch(const string& name, size_t poly, Patch* parent, samplerate srate, size_t buffer_size, size_t local_poly); + Patch(const string& name, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size, size_t local_poly); virtual ~Patch(); void activate(); void deactivate(); - void process(samplecount nframes); + void process(SampleCount nframes); //void send_creation_messages(ClientInterface* client) const; diff --git a/src/libs/engine/Port.cpp b/src/libs/engine/Port.cpp index 8ccbc2fb..cccb6931 100644 --- a/src/libs/engine/Port.cpp +++ b/src/libs/engine/Port.cpp @@ -16,9 +16,6 @@ #include "Port.h" #include "Node.h" -#include "Om.h" -#include "OmApp.h" -#include "ObjectStore.h" #include "DataType.h" namespace Om { @@ -40,22 +37,4 @@ Port::Port(Node* const node, const string& name, size_t index, size_t poly, Data } -void -Port::add_to_store() -{ - om->object_store()->add(this); -} - - -void -Port::remove_from_store() -{ - // Remove self - TreeNode<GraphObject*>* node = om->object_store()->remove(path()); - assert(node != NULL); - assert(om->object_store()->find(path()) == NULL); - delete node; -} - - } // namespace Om diff --git a/src/libs/engine/Port.h b/src/libs/engine/Port.h index 7ec7ec20..d742f5a9 100644 --- a/src/libs/engine/Port.h +++ b/src/libs/engine/Port.h @@ -43,14 +43,14 @@ class Port : public GraphObject public: virtual ~Port() {} - void add_to_store(); - void remove_from_store(); + void add_to_store() { assert(false); } + void remove_from_store() { assert(false); } /** A port's parent is always a node, so static cast should be safe */ Node* parent_node() const { return (Node*)_parent; } /** Called once per process cycle */ - virtual void process(samplecount nframes) = 0; + virtual void process(SampleCount nframes) = 0; /** Empty buffer contents completely (ie silence) */ virtual void clear_buffers() = 0; diff --git a/src/libs/engine/PostProcessor.cpp b/src/libs/engine/PostProcessor.cpp index aad686d8..80dc13cc 100644 --- a/src/libs/engine/PostProcessor.cpp +++ b/src/libs/engine/PostProcessor.cpp @@ -18,8 +18,7 @@ #include <cassert> #include <iostream> #include <pthread.h> -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "Event.h" #include "util/Queue.h" #include "Maid.h" @@ -48,7 +47,7 @@ PostProcessor::_whipped() Event* const ev = _events.pop(); assert(ev); ev->post_process(); - om->maid()->push(ev); + Ingen::instance().maid()->push(ev); } } diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp index 9f35ba28..4c1e815c 100644 --- a/src/libs/engine/QueuedEngineInterface.cpp +++ b/src/libs/engine/QueuedEngineInterface.cpp @@ -17,9 +17,8 @@ #include "QueuedEngineInterface.h" #include "QueuedEventSource.h" #include "events.h" -#include "Om.h" #include "util/Queue.h" -#include "OmApp.h" +#include "Ingen.h" #include "AudioDriver.h" namespace Om { @@ -31,6 +30,12 @@ QueuedEngineInterface::QueuedEngineInterface(size_t queued_size, size_t stamped_ } +SampleCount +QueuedEngineInterface::now() const +{ + return Ingen::instance().audio_driver()->time_stamp(); +} + /** Set the Responder to send responses to commands with, once the commands * are preprocessed and ready to be executed (or not). * @@ -58,16 +63,14 @@ QueuedEngineInterface::disable_responses() void QueuedEngineInterface::register_client(ClientKey key, CountedPtr<ClientInterface> client) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new RegisterClientEvent(_responder, timestamp, key, client)); + push_queued(new RegisterClientEvent(_responder, now(), key, client)); } void QueuedEngineInterface::unregister_client(ClientKey key) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new UnregisterClientEvent(_responder, timestamp, key)); + push_queued(new UnregisterClientEvent(_responder, now(), key)); } @@ -76,8 +79,7 @@ QueuedEngineInterface::unregister_client(ClientKey key) void QueuedEngineInterface::load_plugins() { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new LoadPluginsEvent(_responder, timestamp)); + push_queued(new LoadPluginsEvent(_responder, now())); } @@ -85,16 +87,14 @@ QueuedEngineInterface::load_plugins() void QueuedEngineInterface::activate() { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new ActivateEvent(_responder, timestamp)); + push_queued(new ActivateEvent(_responder, now())); } void QueuedEngineInterface::deactivate() { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new DeactivateEvent(_responder, timestamp)); + push_queued(new DeactivateEvent(_responder, now())); } @@ -102,7 +102,7 @@ void QueuedEngineInterface::quit() { _responder->respond_ok(); - om->quit(); + Ingen::instance().quit(); } @@ -113,8 +113,7 @@ void QueuedEngineInterface::create_patch(const string& path, uint32_t poly) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new CreatePatchEvent(_responder, timestamp, path, poly)); + push_queued(new CreatePatchEvent(_responder, now(), path, poly)); } @@ -123,8 +122,7 @@ void QueuedEngineInterface::create_port(const string& path, const string& data_type, bool direction) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new AddPortEvent(_responder, timestamp, path, data_type, direction)); + push_queued(new AddPortEvent(_responder, now(), path, data_type, direction)); } @@ -134,14 +132,13 @@ QueuedEngineInterface::create_node(const string& path, const string& plugin_uri, bool polyphonic) { - const samplecount timestamp = om->audio_driver()->time_stamp(); // FIXME: ew Plugin* plugin = new Plugin(); plugin->set_type(plugin_type); plugin->uri(plugin_uri); - push_queued(new AddNodeEvent(_responder, timestamp, path, plugin, polyphonic)); + push_queued(new AddNodeEvent(_responder, now(), path, plugin, polyphonic)); } @@ -152,7 +149,6 @@ QueuedEngineInterface::create_node(const string& path, const string& plugin_label, bool polyphonic) { - const samplecount timestamp = om->audio_driver()->time_stamp(); // FIXME: ew Plugin* plugin = new Plugin(); @@ -160,47 +156,42 @@ QueuedEngineInterface::create_node(const string& path, plugin->lib_name(plugin_lib); plugin->plug_label(plugin_label); - push_queued(new AddNodeEvent(_responder, timestamp, path, plugin, polyphonic)); + push_queued(new AddNodeEvent(_responder, now(), path, plugin, polyphonic)); } void QueuedEngineInterface::rename(const string& old_path, const string& new_name) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new RenameEvent(_responder, timestamp, old_path, new_name)); + push_queued(new RenameEvent(_responder, now(), old_path, new_name)); } void QueuedEngineInterface::destroy(const string& path) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new DestroyEvent(_responder, timestamp, this, path)); + push_queued(new DestroyEvent(_responder, now(), this, path)); } void QueuedEngineInterface::clear_patch(const string& patch_path) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new ClearPatchEvent(_responder, timestamp, patch_path)); + push_queued(new ClearPatchEvent(_responder, now(), patch_path)); } void QueuedEngineInterface::enable_patch(const string& patch_path) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new EnablePatchEvent(_responder, timestamp, patch_path)); + push_queued(new EnablePatchEvent(_responder, now(), patch_path)); } void QueuedEngineInterface::disable_patch(const string& patch_path) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new DisablePatchEvent(_responder, timestamp, patch_path)); + push_queued(new DisablePatchEvent(_responder, now(), patch_path)); } @@ -208,8 +199,7 @@ void QueuedEngineInterface::connect(const string& src_port_path, const string& dst_port_path) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new ConnectionEvent(_responder, timestamp, src_port_path, dst_port_path)); + push_queued(new ConnectionEvent(_responder, now(), src_port_path, dst_port_path)); } @@ -218,16 +208,14 @@ void QueuedEngineInterface::disconnect(const string& src_port_path, const string& dst_port_path) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new DisconnectionEvent(_responder, timestamp, src_port_path, dst_port_path)); + push_queued(new DisconnectionEvent(_responder, now(), src_port_path, dst_port_path)); } void QueuedEngineInterface::disconnect_all(const string& node_path) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new DisconnectNodeEvent(_responder, timestamp, node_path)); + push_queued(new DisconnectNodeEvent(_responder, now(), node_path)); } @@ -235,8 +223,7 @@ void QueuedEngineInterface::set_port_value(const string& port_path, float value) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_stamped(new SetPortValueEvent(_responder, timestamp, port_path, value)); + push_stamped(new SetPortValueEvent(_responder, now(), port_path, value)); } @@ -245,8 +232,7 @@ QueuedEngineInterface::set_port_value(const string& port_path, uint32_t voice, float value) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_stamped(new SetPortValueEvent(_responder, timestamp, voice, port_path, value)); + push_stamped(new SetPortValueEvent(_responder, now(), voice, port_path, value)); } @@ -254,8 +240,7 @@ void QueuedEngineInterface::set_port_value_queued(const string& port_path, float value) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new SetPortValueQueuedEvent(_responder, timestamp, port_path, value)); + push_queued(new SetPortValueQueuedEvent(_responder, now(), port_path, value)); } @@ -264,16 +249,14 @@ QueuedEngineInterface::set_program(const string& node_path, uint32_t bank, uint32_t program) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new DSSIProgramEvent(_responder, timestamp, node_path, bank, program)); + push_queued(new DSSIProgramEvent(_responder, now(), node_path, bank, program)); } void QueuedEngineInterface::midi_learn(const string& node_path) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new MidiLearnEvent(_responder, timestamp, node_path)); + push_queued(new MidiLearnEvent(_responder, now(), node_path)); } @@ -282,8 +265,7 @@ QueuedEngineInterface::set_metadata(const string& path, const string& predicate, const string& value) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new SetMetadataEvent(_responder, timestamp, path, predicate, value)); + push_queued(new SetMetadataEvent(_responder, now(), path, predicate, value)); } @@ -292,32 +274,28 @@ QueuedEngineInterface::set_metadata(const string& path, void QueuedEngineInterface::ping() { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new PingQueuedEvent(_responder, timestamp)); + push_queued(new PingQueuedEvent(_responder, now())); } void QueuedEngineInterface::request_port_value(const string& port_path) { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new RequestPortValueEvent(_responder, timestamp, port_path)); + push_queued(new RequestPortValueEvent(_responder, now(), port_path)); } void QueuedEngineInterface::request_plugins() { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new RequestPluginsEvent(_responder, timestamp)); + push_queued(new RequestPluginsEvent(_responder, now())); } void QueuedEngineInterface::request_all_objects() { - const samplecount timestamp = om->audio_driver()->time_stamp(); - push_queued(new RequestAllObjectsEvent(_responder, timestamp)); + push_queued(new RequestAllObjectsEvent(_responder, now())); } diff --git a/src/libs/engine/QueuedEngineInterface.h b/src/libs/engine/QueuedEngineInterface.h index bd3cb42d..ee4a18ad 100644 --- a/src/libs/engine/QueuedEngineInterface.h +++ b/src/libs/engine/QueuedEngineInterface.h @@ -149,6 +149,9 @@ protected: /** Where responses to current messages will go. */ CountedPtr<Responder> _responder; + +private: + SampleCount now() const; }; diff --git a/src/libs/engine/QueuedEvent.h b/src/libs/engine/QueuedEvent.h index c1281da4..1e2603aa 100644 --- a/src/libs/engine/QueuedEvent.h +++ b/src/libs/engine/QueuedEvent.h @@ -49,7 +49,7 @@ public: _pre_processed = true; } - virtual void execute(samplecount offset) { + virtual void execute(SampleCount offset) { assert(_pre_processed); Event::execute(offset); } @@ -67,7 +67,7 @@ protected: QueuedEvent& operator=(const QueuedEvent&); QueuedEvent(CountedPtr<Responder> responder, - samplecount timestamp, + SampleCount timestamp, bool blocking = false, QueuedEventSource* source = NULL) : Event(responder, timestamp) diff --git a/src/libs/engine/QueuedEventSource.cpp b/src/libs/engine/QueuedEventSource.cpp index d4f0f251..638d9b42 100644 --- a/src/libs/engine/QueuedEventSource.cpp +++ b/src/libs/engine/QueuedEventSource.cpp @@ -82,7 +82,7 @@ QueuedEventSource::push_stamped(Event* const ev) * it wants). */ Event* -QueuedEventSource::pop_earliest_queued_before(const samplecount time) +QueuedEventSource::pop_earliest_queued_before(const SampleCount time) { QueuedEvent* const front_event = _events[_front]; diff --git a/src/libs/engine/QueuedEventSource.h b/src/libs/engine/QueuedEventSource.h index 255cf575..23b8601c 100644 --- a/src/libs/engine/QueuedEventSource.h +++ b/src/libs/engine/QueuedEventSource.h @@ -50,8 +50,8 @@ public: void activate() { Slave::start(); } void deactivate() { Slave::stop(); } - Event* pop_earliest_queued_before(const samplecount time); - inline Event* pop_earliest_stamped_before(const samplecount time); + Event* pop_earliest_queued_before(const SampleCount time); + inline Event* pop_earliest_stamped_before(const SampleCount time); void unblock(); @@ -92,7 +92,7 @@ private: * the beginning of the cycle (offset 0), when eg. skipped cycles occur. */ inline Event* -QueuedEventSource::pop_earliest_stamped_before(const samplecount time) +QueuedEventSource::pop_earliest_stamped_before(const SampleCount time) { if (!_stamped_queue.is_empty() && _stamped_queue.front()->time_stamp() < time) return _stamped_queue.pop(); diff --git a/src/libs/engine/TransportNode.cpp b/src/libs/engine/TransportNode.cpp index 375bd4ea..40f531c9 100644 --- a/src/libs/engine/TransportNode.cpp +++ b/src/libs/engine/TransportNode.cpp @@ -22,56 +22,55 @@ #include "JackAudioDriver.h" #include "Port.h" #include "util.h" -#include "Om.h" -#include "OmApp.h" +//#include "Ingen.h" namespace Om { -TransportNode::TransportNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size) +TransportNode::TransportNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size) : InternalNode(new Plugin(Plugin::Internal, "Om:TransportNode"), path, 1, parent, srate, buffer_size) { #if 0 _num_ports = 10; _ports.alloc(_num_ports); - OutputPort<sample>* spb_port = new OutputPort<sample>(this, "Seconds per Beat", 0, 1, + OutputPort<Sample>* spb_port = new OutputPort<Sample>(this, "Seconds per Beat", 0, 1, // new PortInfo("Seconds per Beat", CONTROL, OUTPUT, 0, 0, 1), 1); _ports.at(0) = spb_port; - OutputPort<sample>* bpb_port = new OutputPort<sample>(this, "Beats per Bar", 1, 1, + OutputPort<Sample>* bpb_port = new OutputPort<Sample>(this, "Beats per Bar", 1, 1, // new PortInfo("Beats per Bar", CONTROL, OUTPUT, 0, 0, 1), 1); _ports.at(1) = bpb_port; - OutputPort<sample>* bar_port = new OutputPort<sample>(this, "Bar", 3, 1, + OutputPort<Sample>* bar_port = new OutputPort<Sample>(this, "Bar", 3, 1, // new PortInfo("Bar", CONTROL, OUTPUT, 0, 0, 1), buffer_size); _ports.at(2) = bar_port; - OutputPort<sample>* beat_port = new OutputPort<sample>(this, "Beat", 3, 1, + OutputPort<Sample>* beat_port = new OutputPort<Sample>(this, "Beat", 3, 1, // new PortInfo("Beat", CONTROL, OUTPUT, 0, 0, 1), buffer_size); _ports.at(3) = beat_port; - OutputPort<sample>* frame_port = new OutputPort<sample>(this, "Frame", 3, 1, + OutputPort<Sample>* frame_port = new OutputPort<Sample>(this, "Frame", 3, 1, // new PortInfo("Frame", CONTROL, OUTPUT, 0, 0, 1), buffer_size); _ports.at(4) = frame_port; - OutputPort<sample>* hour_port = new OutputPort<sample>(this, "Hour", 3, 1, + OutputPort<Sample>* hour_port = new OutputPort<Sample>(this, "Hour", 3, 1, // new PortInfo("Hour", CONTROL, OUTPUT, 0, 0, 1), buffer_size); _ports.at(5) = hour_port; - OutputPort<sample>* minute_port = new OutputPort<sample>(this, "Minute", 3, 1, + OutputPort<Sample>* minute_port = new OutputPort<Sample>(this, "Minute", 3, 1, // new PortInfo("Minute", CONTROL, OUTPUT, 0, 0, 1), buffer_size); _ports.at(6) = minute_port; - OutputPort<sample>* second_port = new OutputPort<sample>(this, "Second", 3, 1, + OutputPort<Sample>* second_port = new OutputPort<Sample>(this, "Second", 3, 1, // new PortInfo("Second", CONTROL, OUTPUT, 0, 0, 1), buffer_size); _ports.at(7) = second_port; - OutputPort<sample>* trg_port = new OutputPort<sample>(this, "Beat Tick", 2, 1, + OutputPort<Sample>* trg_port = new OutputPort<Sample>(this, "Beat Tick", 2, 1, // new PortInfo("Beat Tick", AUDIO, OUTPUT, 0, 0, 1), buffer_size); _ports.at(8) = trg_port; - OutputPort<sample>* bar_trig_port = new OutputPort<sample>(this, "Bar Tick", 3, 1, + OutputPort<Sample>* bar_trig_port = new OutputPort<Sample>(this, "Bar Tick", 3, 1, // new PortInfo("Bar Tick", AUDIO, OUTPUT, 0, 0, 1), buffer_size); _ports.at(9) = bar_trig_port; #endif @@ -87,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*)om->audio_driver())->position(); - jack_transport_state_t state = ((JackAudioDriver*)om->audio_driver())->transport_state(); + const jack_position_t* const position = ((JackAudioDriver*)Ingen::instance().audio_driver())->position(); + jack_transport_state_t state = ((JackAudioDriver*)Ingen::instance().audio_driver())->transport_state(); double bpm = position->beats_per_minute; float bpb = position->beats_per_bar; float spb = 60.0 / bpm; @@ -122,12 +121,12 @@ TransportNode::run(size_t nframes) } - ((OutputPort<sample>*)m_ports.at(0))->buffer(0)->set(spb, 0, 0); - ((OutputPort<sample>*)m_ports.at(1))->buffer(0)->set(bpb, 0, 0); + ((OutputPort<Sample>*)m_ports.at(0))->buffer(0)->set(spb, 0, 0); + ((OutputPort<Sample>*)m_ports.at(1))->buffer(0)->set(bpb, 0, 0); // fill the trigger buffers with zeros - ((OutputPort<sample>*)m_ports.at(2))->buffer(0)->set(0.0f, 0, nframes - 1); - ((OutputPort<sample>*)m_ports.at(3))->buffer(0)->set(0.0f, 0, nframes - 1); + ((OutputPort<Sample>*)m_ports.at(2))->buffer(0)->set(0.0f, 0, nframes - 1); + ((OutputPort<Sample>*)m_ports.at(3))->buffer(0)->set(0.0f, 0, nframes - 1); // if the transport is rolling, add triggers at the right frame positions if ((position->valid & JackTransportBBT) && (state == JackTransportRolling)) { @@ -139,9 +138,9 @@ TransportNode::run(size_t nframes) --first_beat_no; } for ( ; first_beat < nframes; first_beat += frames_per_beat) { - ((OutputPort<sample>*)m_ports.at(2))->buffer(0)->set(1.0f, size_t(first_beat)); + ((OutputPort<Sample>*)m_ports.at(2))->buffer(0)->set(1.0f, size_t(first_beat)); if (first_beat_no % int(bpb) == 0) { - ((OutputPort<sample>*)m_ports.at(3))->buffer(0)->set(1.0f, size_t(first_beat)); + ((OutputPort<Sample>*)m_ports.at(3))->buffer(0)->set(1.0f, size_t(first_beat)); ++first_beat_no; } } diff --git a/src/libs/engine/TransportNode.h b/src/libs/engine/TransportNode.h index 621e585d..2ad5cc40 100644 --- a/src/libs/engine/TransportNode.h +++ b/src/libs/engine/TransportNode.h @@ -37,7 +37,7 @@ using std::string; class TransportNode : public InternalNode { public: - TransportNode(const string& path, size_t poly, Patch* parent, samplerate srate, size_t buffer_size); + TransportNode(const string& path, size_t poly, Patch* parent, SampleRate srate, size_t buffer_size); void run(size_t nframes); }; diff --git a/src/libs/engine/TypedConnection.cpp b/src/libs/engine/TypedConnection.cpp index 714f5696..8915bfce 100644 --- a/src/libs/engine/TypedConnection.cpp +++ b/src/libs/engine/TypedConnection.cpp @@ -19,7 +19,6 @@ #include "InputPort.h" #include "OutputPort.h" #include "Node.h" -#include "Om.h" #include "Port.h" namespace Om { @@ -49,7 +48,7 @@ TypedConnection<T>::TypedConnection(OutputPort<T>* const src_port, InputPort<T>* //cerr << "Connection " << src_port->path() << " -> " << dst_port->path() // << "\t mixing: " << m_must_mix << endl; } -template TypedConnection<sample>::TypedConnection(OutputPort<sample>* const src_port, InputPort<sample>* const dst_port); +template TypedConnection<Sample>::TypedConnection(OutputPort<Sample>* const src_port, InputPort<Sample>* const dst_port); template TypedConnection<MidiMessage>::TypedConnection(OutputPort<MidiMessage>* const src_port, InputPort<MidiMessage>* const dst_port); @@ -58,13 +57,13 @@ TypedConnection<T>::~TypedConnection() { delete m_local_buffer; } -template TypedConnection<sample>::~TypedConnection(); +template TypedConnection<Sample>::~TypedConnection(); template TypedConnection<MidiMessage>::~TypedConnection(); -template <typename sample> +template <typename Sample> void -TypedConnection<sample>::process(samplecount nframes) +TypedConnection<Sample>::process(SampleCount nframes) { // FIXME: nframes parameter not used assert(nframes == m_buffer_size); @@ -92,13 +91,13 @@ TypedConnection<sample>::process(samplecount nframes) m_local_buffer->scale(1.0f/(float)src_port()->poly(), 0, m_buffer_size-1); } } -template void TypedConnection<sample>::process(samplecount nframes); +template void TypedConnection<Sample>::process(SampleCount nframes); // FIXME: MIDI mixing not implemented template <> void -TypedConnection<MidiMessage>::process(samplecount nframes) +TypedConnection<MidiMessage>::process(SampleCount nframes) { } diff --git a/src/libs/engine/TypedConnection.h b/src/libs/engine/TypedConnection.h index a0f50362..18f086f1 100644 --- a/src/libs/engine/TypedConnection.h +++ b/src/libs/engine/TypedConnection.h @@ -39,7 +39,7 @@ public: TypedConnection(OutputPort<T>* const src_port, InputPort<T>* const dst_port); virtual ~TypedConnection(); - void process(samplecount nframes); + void process(SampleCount nframes); inline OutputPort<T>* src_port() const { return dynamic_cast<OutputPort<T>*>(m_src_port); } inline InputPort<T>* dst_port() const { return dynamic_cast<InputPort<T>*>(m_dst_port); } @@ -68,10 +68,10 @@ private: template <> -inline Buffer<sample>* -TypedConnection<sample>::buffer(size_t voice) const +inline Buffer<Sample>* +TypedConnection<Sample>::buffer(size_t voice) const { - TypedPort<sample>* const src_port = (TypedPort<sample>*)m_src_port; + TypedPort<Sample>* const src_port = (TypedPort<Sample>*)m_src_port; if (m_must_mix) { return m_local_buffer; @@ -97,7 +97,7 @@ TypedConnection<MidiMessage>::buffer(size_t voice) const } -template class TypedConnection<sample>; +template class TypedConnection<Sample>; template class TypedConnection<MidiMessage>; } // namespace Om diff --git a/src/libs/engine/TypedPort.cpp b/src/libs/engine/TypedPort.cpp index 2cc0762b..63c75b46 100644 --- a/src/libs/engine/TypedPort.cpp +++ b/src/libs/engine/TypedPort.cpp @@ -40,7 +40,7 @@ TypedPort<T>::TypedPort(Node* parent, const string& name, size_t index, size_t p assert(m_buffers.size() > 0); } template -TypedPort<sample>::TypedPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size); +TypedPort<Sample>::TypedPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size); template TypedPort<MidiMessage>::TypedPort(Node* parent, const string& name, size_t index, size_t poly, DataType type, size_t buffer_size); @@ -51,7 +51,7 @@ TypedPort<T>::~TypedPort() for (size_t i=0; i < _poly; ++i) delete m_buffers.at(i); } -template TypedPort<sample>::~TypedPort(); +template TypedPort<Sample>::~TypedPort(); template TypedPort<MidiMessage>::~TypedPort(); @@ -59,7 +59,7 @@ template TypedPort<MidiMessage>::~TypedPort(); */ template<> void -TypedPort<sample>::set_value(sample val, size_t offset) +TypedPort<Sample>::set_value(Sample val, size_t offset) { if (offset >= _buffer_size) offset = 0; @@ -75,7 +75,7 @@ TypedPort<sample>::set_value(sample val, size_t offset) */ template<> void -TypedPort<sample>::set_value(size_t voice, sample val, size_t offset) +TypedPort<Sample>::set_value(size_t voice, Sample val, size_t offset) { if (offset >= _buffer_size) offset = 0; @@ -96,13 +96,13 @@ TypedPort<T>::allocate_buffers() for (size_t i=0; i < _poly; ++i) m_buffers.at(i) = new Buffer<T>(_buffer_size); } -template void TypedPort<sample>::allocate_buffers(); +template void TypedPort<Sample>::allocate_buffers(); template void TypedPort<MidiMessage>::allocate_buffers(); template <typename T> void -TypedPort<T>::process(samplecount nframes) +TypedPort<T>::process(SampleCount nframes) { for (size_t i=0; i < _poly; ++i) m_buffers.at(i)->prepare(nframes); @@ -116,7 +116,7 @@ TypedPort<T>::clear_buffers() for (size_t i=0; i < _poly; ++i) m_buffers.at(i)->clear(); } -template void TypedPort<sample>::clear_buffers(); +template void TypedPort<Sample>::clear_buffers(); template void TypedPort<MidiMessage>::clear_buffers(); diff --git a/src/libs/engine/TypedPort.h b/src/libs/engine/TypedPort.h index eebbc97b..ef667d28 100644 --- a/src/libs/engine/TypedPort.h +++ b/src/libs/engine/TypedPort.h @@ -49,7 +49,7 @@ public: Buffer<T>* buffer(size_t voice) const { return m_buffers.at(voice); } - virtual void process(samplecount nframes); + virtual void process(SampleCount nframes); virtual void clear_buffers(); /** Used by drivers to prevent port from changing buffers */ @@ -71,7 +71,7 @@ protected: }; -template class TypedPort<sample>; +template class TypedPort<Sample>; template class TypedPort<MidiMessage>; } // namespace Om diff --git a/src/libs/engine/events/ActivateEvent.cpp b/src/libs/engine/events/ActivateEvent.cpp index b558b83a..27875c59 100644 --- a/src/libs/engine/events/ActivateEvent.cpp +++ b/src/libs/engine/events/ActivateEvent.cpp @@ -16,13 +16,12 @@ #include "ActivateEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" namespace Om { -ActivateEvent::ActivateEvent(CountedPtr<Responder> responder, samplecount timestamp) +ActivateEvent::ActivateEvent(CountedPtr<Responder> responder, SampleCount timestamp) : QueuedEvent(responder, timestamp) { } @@ -33,18 +32,14 @@ ActivateEvent::pre_process() { QueuedEvent::pre_process(); - if (om != NULL) - om->activate(); + Ingen::instance().activate(); } void ActivateEvent::post_process() { - if (om != NULL) - _responder->respond_ok(); - else - _responder->respond_error("Not ready to activate yet."); + _responder->respond_ok(); } diff --git a/src/libs/engine/events/ActivateEvent.h b/src/libs/engine/events/ActivateEvent.h index d9c8eae9..cb961eab 100644 --- a/src/libs/engine/events/ActivateEvent.h +++ b/src/libs/engine/events/ActivateEvent.h @@ -29,7 +29,7 @@ namespace Om { class ActivateEvent : public QueuedEvent { public: - ActivateEvent(CountedPtr<Responder> responder, samplecount timestamp); + ActivateEvent(CountedPtr<Responder> responder, SampleCount timestamp); void pre_process(); void post_process(); diff --git a/src/libs/engine/events/AddNodeEvent.cpp b/src/libs/engine/events/AddNodeEvent.cpp index 29d98360..1dc30263 100644 --- a/src/libs/engine/events/AddNodeEvent.cpp +++ b/src/libs/engine/events/AddNodeEvent.cpp @@ -20,8 +20,7 @@ #include "Node.h" #include "Tree.h" #include "Plugin.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "Patch.h" #include "NodeFactory.h" #include "ClientBroadcaster.h" @@ -34,7 +33,7 @@ namespace Om { -AddNodeEvent::AddNodeEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, Plugin* plugin, bool poly) +AddNodeEvent::AddNodeEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly) : QueuedEvent(responder, timestamp), m_path(path), m_plugin(plugin), @@ -56,19 +55,19 @@ AddNodeEvent::~AddNodeEvent() void AddNodeEvent::pre_process() { - if (om->object_store()->find(m_path) != NULL) { + if (Ingen::instance().object_store()->find(m_path) != NULL) { m_node_already_exists = true; QueuedEvent::pre_process(); return; } - m_patch = om->object_store()->find_patch(m_path.parent()); + m_patch = Ingen::instance().object_store()->find_patch(m_path.parent()); if (m_patch != NULL) { if (m_poly) - m_node = om->node_factory()->load_plugin(m_plugin, m_path.name(), m_patch->internal_poly(), m_patch); + m_node = Ingen::instance().node_factory()->load_plugin(m_plugin, m_path.name(), m_patch->internal_poly(), m_patch); else - m_node = om->node_factory()->load_plugin(m_plugin, m_path.name(), 1, m_patch); + m_node = Ingen::instance().node_factory()->load_plugin(m_plugin, m_path.name(), 1, m_patch); if (m_node != NULL) { m_node->activate(); @@ -77,7 +76,7 @@ AddNodeEvent::pre_process() // node tree - just the process order array m_patch->add_node(new ListNode<Node*>(m_node)); m_node->add_to_store(); - + if (m_patch->process()) m_process_order = m_patch->build_process_order(); } @@ -87,7 +86,7 @@ AddNodeEvent::pre_process() void -AddNodeEvent::execute(samplecount offset) +AddNodeEvent::execute(SampleCount offset) { QueuedEvent::execute(offset); @@ -95,7 +94,7 @@ AddNodeEvent::execute(samplecount offset) m_node->add_to_patch(); if (m_patch->process_order() != NULL) - om->maid()->push(m_patch->process_order()); + Ingen::instance().maid()->push(m_patch->process_order()); m_patch->process_order(m_process_order); } } @@ -118,8 +117,8 @@ AddNodeEvent::post_process() _responder->respond_error(msg); } else { _responder->respond_ok(); - //om->client_broadcaster()->send_node_creation_messages(m_node); - om->client_broadcaster()->send_node(m_node); + //Ingen::instance().client_broadcaster()->send_node_creation_messages(m_node); + Ingen::instance().client_broadcaster()->send_node(m_node); } } diff --git a/src/libs/engine/events/AddNodeEvent.h b/src/libs/engine/events/AddNodeEvent.h index 3fc204f9..99f89fe0 100644 --- a/src/libs/engine/events/AddNodeEvent.h +++ b/src/libs/engine/events/AddNodeEvent.h @@ -39,11 +39,11 @@ class Plugin; class AddNodeEvent : public QueuedEvent { public: - AddNodeEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, Plugin* plugin, bool poly); + AddNodeEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, Plugin* plugin, bool poly); ~AddNodeEvent(); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp index c8360996..01937259 100644 --- a/src/libs/engine/events/AddPortEvent.cpp +++ b/src/libs/engine/events/AddPortEvent.cpp @@ -19,8 +19,7 @@ #include "Patch.h" #include "Tree.h" #include "Plugin.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "Patch.h" #include "Maid.h" #include "util/Path.h" @@ -37,7 +36,7 @@ namespace Om { -AddPortEvent::AddPortEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& type, bool is_output) +AddPortEvent::AddPortEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& type, bool is_output) : QueuedEvent(responder, timestamp), _path(path), _type(type), @@ -58,21 +57,21 @@ AddPortEvent::AddPortEvent(CountedPtr<Responder> responder, samplecount timestam void AddPortEvent::pre_process() { - if (om->object_store()->find(_path) != NULL) { + if (Ingen::instance().object_store()->find(_path) != NULL) { QueuedEvent::pre_process(); return; } // FIXME: this is just a mess :/ - _patch = om->object_store()->find_patch(_path.parent()); + _patch = Ingen::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 = om->audio_driver()->buffer_size(); + buffer_size = Ingen::instance().audio_driver()->buffer_size(); _patch_port = _patch->create_port(_path.name(), _data_type, buffer_size, _is_output); if (_patch_port) { @@ -87,14 +86,14 @@ AddPortEvent::pre_process() _ports_array = new Array<Port*>(_patch->num_ports() + 1, NULL); _ports_array->at(_patch->num_ports()) = _patch_port; - om->object_store()->add(_patch_port); + Ingen::instance().object_store()->add(_patch_port); if (!_patch->parent()) { if (_type == "AUDIO") - _driver_port = om->audio_driver()->create_port( - dynamic_cast<DuplexPort<sample>*>(_patch_port)); + _driver_port = Ingen::instance().audio_driver()->create_port( + dynamic_cast<DuplexPort<Sample>*>(_patch_port)); else if (_type == "MIDI") - _driver_port = om->midi_driver()->create_port( + _driver_port = Ingen::instance().midi_driver()->create_port( dynamic_cast<DuplexPort<MidiMessage>*>(_patch_port)); } } @@ -104,12 +103,12 @@ AddPortEvent::pre_process() void -AddPortEvent::execute(samplecount offset) +AddPortEvent::execute(SampleCount offset) { QueuedEvent::execute(offset); if (_patch_port) { - om->maid()->push(_patch->external_ports()); + Ingen::instance().maid()->push(_patch->external_ports()); //_patch->add_port(_port); _patch->external_ports(_ports_array); } @@ -127,7 +126,7 @@ AddPortEvent::post_process() _responder->respond_error(msg); } else { _responder->respond_ok(); - om->client_broadcaster()->send_port(_patch_port); + Ingen::instance().client_broadcaster()->send_port(_patch_port); } } diff --git a/src/libs/engine/events/AddPortEvent.h b/src/libs/engine/events/AddPortEvent.h index ba3f860a..e8599348 100644 --- a/src/libs/engine/events/AddPortEvent.h +++ b/src/libs/engine/events/AddPortEvent.h @@ -41,10 +41,10 @@ class DriverPort; class AddPortEvent : public QueuedEvent { public: - AddPortEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& type, bool is_output); + AddPortEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& type, bool is_output); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/AllNotesOffEvent.cpp b/src/libs/engine/events/AllNotesOffEvent.cpp index e7be3e0b..01d5b448 100644 --- a/src/libs/engine/events/AllNotesOffEvent.cpp +++ b/src/libs/engine/events/AllNotesOffEvent.cpp @@ -16,8 +16,7 @@ #include "AllNotesOffEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "ObjectStore.h" namespace Om { @@ -25,7 +24,7 @@ namespace Om { /** Note off with patch explicitly passed - triggered by MIDI. */ -AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, samplecount timestamp, Patch* patch) +AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, Patch* patch) : Event(responder, timestamp), m_patch(patch) { @@ -34,7 +33,7 @@ AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, samplecount /** Note off event with lookup - triggered by OSC. */ -AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path) +AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path) : Event(responder, timestamp), m_patch(NULL), m_patch_path(patch_path) @@ -43,10 +42,10 @@ AllNotesOffEvent::AllNotesOffEvent(CountedPtr<Responder> responder, samplecount void -AllNotesOffEvent::execute(samplecount offset) +AllNotesOffEvent::execute(SampleCount offset) { if (m_patch == NULL && m_patch_path != "") - m_patch = om->object_store()->find_patch(m_patch_path); + m_patch = Ingen::instance().object_store()->find_patch(m_patch_path); //if (m_patch != NULL) // for (List<MidiInNode*>::iterator j = m_patch->midi_in_nodes().begin(); j != m_patch->midi_in_nodes().end(); ++j) diff --git a/src/libs/engine/events/AllNotesOffEvent.h b/src/libs/engine/events/AllNotesOffEvent.h index fbdd8e14..a994daae 100644 --- a/src/libs/engine/events/AllNotesOffEvent.h +++ b/src/libs/engine/events/AllNotesOffEvent.h @@ -33,10 +33,10 @@ class Patch; class AllNotesOffEvent : public Event { public: - AllNotesOffEvent(CountedPtr<Responder> responder, samplecount timestamp, Patch* patch); - AllNotesOffEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path); + AllNotesOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, Patch* patch); + AllNotesOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp index e95880c3..fc045633 100644 --- a/src/libs/engine/events/ClearPatchEvent.cpp +++ b/src/libs/engine/events/ClearPatchEvent.cpp @@ -16,8 +16,7 @@ #include "ClearPatchEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "Patch.h" #include "ClientBroadcaster.h" #include "util.h" @@ -31,7 +30,7 @@ namespace Om { -ClearPatchEvent::ClearPatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path) +ClearPatchEvent::ClearPatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path) : QueuedEvent(responder, true), m_patch_path(patch_path), m_patch(NULL), @@ -43,7 +42,7 @@ ClearPatchEvent::ClearPatchEvent(CountedPtr<Responder> responder, samplecount ti void ClearPatchEvent::pre_process() { - m_patch = om->object_store()->find_patch(m_patch_path); + m_patch = Ingen::instance().object_store()->find_patch(m_patch_path); if (m_patch != NULL) { @@ -58,7 +57,7 @@ ClearPatchEvent::pre_process() void -ClearPatchEvent::execute(samplecount offset) +ClearPatchEvent::execute(SampleCount offset) { if (m_patch != NULL) { m_patch->process(false); @@ -67,7 +66,7 @@ ClearPatchEvent::execute(samplecount offset) (*i)->remove_from_patch(); if (m_patch->process_order() != NULL) { - om->maid()->push(m_patch->process_order()); + Ingen::instance().maid()->push(m_patch->process_order()); m_patch->process_order(NULL); } } @@ -101,7 +100,7 @@ ClearPatchEvent::post_process() // Reply _responder->respond_ok(); - om->client_broadcaster()->send_patch_cleared(m_patch_path); + Ingen::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/ClearPatchEvent.h b/src/libs/engine/events/ClearPatchEvent.h index 3106abdf..1a2fe14b 100644 --- a/src/libs/engine/events/ClearPatchEvent.h +++ b/src/libs/engine/events/ClearPatchEvent.h @@ -35,10 +35,10 @@ class Patch; class ClearPatchEvent : public QueuedEvent { public: - ClearPatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path); + ClearPatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp index d229ab7c..15b79b46 100644 --- a/src/libs/engine/events/ConnectionEvent.cpp +++ b/src/libs/engine/events/ConnectionEvent.cpp @@ -18,8 +18,7 @@ #include <string> #include "Responder.h" #include "types.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "TypedConnection.h" #include "InputPort.h" #include "OutputPort.h" @@ -37,7 +36,7 @@ namespace Om { //// ConnectionEvent //// -ConnectionEvent::ConnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& src_port_path, const string& dst_port_path) +ConnectionEvent::ConnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path) : QueuedEvent(responder, timestamp), m_src_port_path(src_port_path), m_dst_port_path(dst_port_path), @@ -67,7 +66,7 @@ ConnectionEvent::pre_process() return; } - /*m_patch = om->object_store()->find_patch(m_src_port_path.parent().parent()); + /*m_patch = Ingen::instance().object_store()->find_patch(m_src_port_path.parent().parent()); if (m_patch == NULL) { m_error = PORT_NOT_FOUND; @@ -75,8 +74,8 @@ ConnectionEvent::pre_process() return; }*/ - m_src_port = om->object_store()->find_port(m_src_port_path); - m_dst_port = om->object_store()->find_port(m_dst_port_path); + 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); if (m_src_port == NULL || m_dst_port == NULL) { m_error = PORT_NOT_FOUND; @@ -105,8 +104,8 @@ ConnectionEvent::pre_process() // Create the typed event to actually do the work const DataType type = m_src_port->type(); if (type == DataType::FLOAT) { - m_typed_event = new TypedConnectionEvent<sample>(_responder, _time_stamp, - dynamic_cast<OutputPort<sample>*>(m_src_port), dynamic_cast<InputPort<sample>*>(m_dst_port)); + m_typed_event = new TypedConnectionEvent<Sample>(_responder, _time_stamp, + dynamic_cast<OutputPort<Sample>*>(m_src_port), dynamic_cast<InputPort<Sample>*>(m_dst_port)); } else if (type == DataType::MIDI) { m_typed_event = new TypedConnectionEvent<MidiMessage>(_responder, _time_stamp, dynamic_cast<OutputPort<MidiMessage>*>(m_src_port), dynamic_cast<InputPort<MidiMessage>*>(m_dst_port)); @@ -123,7 +122,7 @@ ConnectionEvent::pre_process() void -ConnectionEvent::execute(samplecount offset) +ConnectionEvent::execute(SampleCount offset) { QueuedEvent::execute(offset); @@ -151,7 +150,7 @@ ConnectionEvent::post_process() template <typename T> -TypedConnectionEvent<T>::TypedConnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port) +TypedConnectionEvent<T>::TypedConnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port) : QueuedEvent(responder, timestamp), m_src_port(src_port), m_dst_port(dst_port), @@ -229,14 +228,14 @@ TypedConnectionEvent<T>::pre_process() template <typename T> void -TypedConnectionEvent<T>::execute(samplecount offset) +TypedConnectionEvent<T>::execute(SampleCount offset) { if (m_succeeded) { // These must be inserted here, since they're actually used by the audio thread m_dst_port->add_connection(m_port_listnode); m_patch->add_connection(m_patch_listnode); if (m_patch->process_order() != NULL) - om->maid()->push(m_patch->process_order()); + Ingen::instance().maid()->push(m_patch->process_order()); m_patch->process_order(m_process_order); } } @@ -251,7 +250,7 @@ TypedConnectionEvent<T>::post_process() _responder->respond_ok(); - om->client_broadcaster()->send_connection(m_connection); + Ingen::instance().client_broadcaster()->send_connection(m_connection); } else { _responder->respond_error("Unable to make connection."); } diff --git a/src/libs/engine/events/ConnectionEvent.h b/src/libs/engine/events/ConnectionEvent.h index 6a95817a..b617b158 100644 --- a/src/libs/engine/events/ConnectionEvent.h +++ b/src/libs/engine/events/ConnectionEvent.h @@ -46,11 +46,11 @@ template <typename T> class TypedConnectionEvent; // helper, defined below class ConnectionEvent : public QueuedEvent { public: - ConnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& src_port_path, const string& dst_port_path); + ConnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path); ~ConnectionEvent(); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: @@ -80,10 +80,10 @@ template <typename T> class TypedConnectionEvent : public QueuedEvent { public: - TypedConnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port); + TypedConnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp index 7fe72471..65daf327 100644 --- a/src/libs/engine/events/CreatePatchEvent.cpp +++ b/src/libs/engine/events/CreatePatchEvent.cpp @@ -20,8 +20,7 @@ #include "Node.h" #include "Tree.h" #include "Plugin.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "Maid.h" #include "ClientBroadcaster.h" #include "AudioDriver.h" @@ -31,7 +30,7 @@ namespace Om { -CreatePatchEvent::CreatePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, int poly) +CreatePatchEvent::CreatePatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, int poly) : QueuedEvent(responder, timestamp), m_path(path), m_patch(NULL), @@ -46,7 +45,7 @@ CreatePatchEvent::CreatePatchEvent(CountedPtr<Responder> responder, samplecount void CreatePatchEvent::pre_process() { - if (om->object_store()->find(m_path) != NULL) { + if (Ingen::instance().object_store()->find(m_path) != NULL) { m_error = OBJECT_EXISTS; QueuedEvent::pre_process(); return; @@ -59,7 +58,7 @@ CreatePatchEvent::pre_process() } if (m_path != "/") { - m_parent = om->object_store()->find_patch(m_path.parent()); + m_parent = Ingen::instance().object_store()->find_patch(m_path.parent()); if (m_parent == NULL) { m_error = PARENT_NOT_FOUND; QueuedEvent::pre_process(); @@ -71,7 +70,7 @@ CreatePatchEvent::pre_process() if (m_parent != NULL && m_poly > 1 && m_poly == static_cast<int>(m_parent->internal_poly())) poly = m_poly; - m_patch = new Patch(m_path.name(), poly, m_parent, om->audio_driver()->sample_rate(), om->audio_driver()->buffer_size(), 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); if (m_parent != NULL) { m_parent->add_node(new ListNode<Node*>(m_patch)); @@ -90,7 +89,7 @@ CreatePatchEvent::pre_process() void -CreatePatchEvent::execute(samplecount offset) +CreatePatchEvent::execute(SampleCount offset) { QueuedEvent::execute(offset); @@ -98,7 +97,7 @@ CreatePatchEvent::execute(samplecount offset) if (m_parent == NULL) { assert(m_path == "/"); assert(m_patch->parent_patch() == NULL); - om->audio_driver()->set_root_patch(m_patch); + Ingen::instance().audio_driver()->set_root_patch(m_patch); } else { assert(m_parent != NULL); assert(m_path != "/"); @@ -106,7 +105,7 @@ CreatePatchEvent::execute(samplecount offset) m_patch->add_to_patch(); if (m_parent->process_order() != NULL) - om->maid()->push(m_parent->process_order()); + Ingen::instance().maid()->push(m_parent->process_order()); m_parent->process_order(m_process_order); } } @@ -122,10 +121,10 @@ CreatePatchEvent::post_process() _responder->respond_ok(); // Don't want to send nodes that have been added since prepare() - //om->client_broadcaster()->send_node_creation_messages(m_patch); + //Ingen::instance().client_broadcaster()->send_node_creation_messages(m_patch); // Patches are always empty on creation, so this is fine - om->client_broadcaster()->send_patch(m_patch); + Ingen::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/CreatePatchEvent.h b/src/libs/engine/events/CreatePatchEvent.h index 0be7723a..cbaca4fb 100644 --- a/src/libs/engine/events/CreatePatchEvent.h +++ b/src/libs/engine/events/CreatePatchEvent.h @@ -39,10 +39,10 @@ class Plugin; class CreatePatchEvent : public QueuedEvent { public: - CreatePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, int poly); + CreatePatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, int poly); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/DSSIConfigureEvent.cpp b/src/libs/engine/events/DSSIConfigureEvent.cpp index f8514631..290d177a 100644 --- a/src/libs/engine/events/DSSIConfigureEvent.cpp +++ b/src/libs/engine/events/DSSIConfigureEvent.cpp @@ -15,8 +15,7 @@ */ #include "DSSIConfigureEvent.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "Node.h" #include "ClientBroadcaster.h" #include "Plugin.h" @@ -25,7 +24,7 @@ namespace Om { -DSSIConfigureEvent::DSSIConfigureEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, const string& key, const string& val) +DSSIConfigureEvent::DSSIConfigureEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, const string& key, const string& val) : QueuedEvent(responder, timestamp), m_node_path(node_path), m_key(key), @@ -38,7 +37,7 @@ DSSIConfigureEvent::DSSIConfigureEvent(CountedPtr<Responder> responder, sampleco void DSSIConfigureEvent::pre_process() { - Node* node = om->object_store()->find_node(m_node_path); + Node* node = Ingen::instance().object_store()->find_node(m_node_path); if (node != NULL && node->plugin()->type() == Plugin::DSSI) { m_node = (DSSINode*)node; @@ -50,7 +49,7 @@ DSSIConfigureEvent::pre_process() void -DSSIConfigureEvent::execute(samplecount offset) +DSSIConfigureEvent::execute(SampleCount offset) { // Nothing. } @@ -64,7 +63,7 @@ DSSIConfigureEvent::post_process() } else { string key = "dssi-configure--"; key += m_key; - om->client_broadcaster()->send_metadata_update(m_node_path, key, m_val); + Ingen::instance().client_broadcaster()->send_metadata_update(m_node_path, key, m_val); } } diff --git a/src/libs/engine/events/DSSIConfigureEvent.h b/src/libs/engine/events/DSSIConfigureEvent.h index c9a4402a..6d0a1000 100644 --- a/src/libs/engine/events/DSSIConfigureEvent.h +++ b/src/libs/engine/events/DSSIConfigureEvent.h @@ -30,10 +30,10 @@ namespace Om { class DSSIConfigureEvent : public QueuedEvent { public: - DSSIConfigureEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, const string& key, const string& val); + DSSIConfigureEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, const string& key, const string& val); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/DSSIControlEvent.cpp b/src/libs/engine/events/DSSIControlEvent.cpp index 534c5c0a..568ef573 100644 --- a/src/libs/engine/events/DSSIControlEvent.cpp +++ b/src/libs/engine/events/DSSIControlEvent.cpp @@ -15,8 +15,7 @@ */ #include "DSSIControlEvent.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "Node.h" #include "Plugin.h" #include "ObjectStore.h" @@ -24,7 +23,7 @@ namespace Om { -DSSIControlEvent::DSSIControlEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, int port_num, sample val) +DSSIControlEvent::DSSIControlEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, int port_num, Sample val) : QueuedEvent(responder, timestamp), m_node_path(node_path), m_port_num(port_num), @@ -37,7 +36,7 @@ DSSIControlEvent::DSSIControlEvent(CountedPtr<Responder> responder, samplecount void DSSIControlEvent::pre_process() { - Node* node = om->object_store()->find_node(m_node_path); + Node* node = Ingen::instance().object_store()->find_node(m_node_path); if (node->plugin()->type() != Plugin::DSSI) m_node = NULL; @@ -49,7 +48,7 @@ DSSIControlEvent::pre_process() void -DSSIControlEvent::execute(samplecount offset) +DSSIControlEvent::execute(SampleCount offset) { if (m_node != NULL) m_node->set_control(m_port_num, m_val); diff --git a/src/libs/engine/events/DSSIControlEvent.h b/src/libs/engine/events/DSSIControlEvent.h index 1bc055fe..52df88a8 100644 --- a/src/libs/engine/events/DSSIControlEvent.h +++ b/src/libs/engine/events/DSSIControlEvent.h @@ -32,10 +32,10 @@ namespace Om { class DSSIControlEvent : public QueuedEvent { public: - DSSIControlEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, int port_num, sample val); + DSSIControlEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, int port_num, Sample val); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/DSSIProgramEvent.cpp b/src/libs/engine/events/DSSIProgramEvent.cpp index 9b5a85dd..a9f82b33 100644 --- a/src/libs/engine/events/DSSIProgramEvent.cpp +++ b/src/libs/engine/events/DSSIProgramEvent.cpp @@ -17,8 +17,7 @@ #include "DSSIProgramEvent.h" #include <cstdio> #include <iostream> -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "Node.h" #include "ClientBroadcaster.h" #include "Plugin.h" @@ -29,7 +28,7 @@ using std::cout; using std::cerr; using std::endl; namespace Om { -DSSIProgramEvent::DSSIProgramEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, int bank, int program) +DSSIProgramEvent::DSSIProgramEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, int bank, int program) : QueuedEvent(responder, timestamp), m_node_path(node_path), m_bank(bank), @@ -42,7 +41,7 @@ DSSIProgramEvent::DSSIProgramEvent(CountedPtr<Responder> responder, samplecount void DSSIProgramEvent::pre_process() { - Node* node = om->object_store()->find_node(m_node_path); + Node* node = Ingen::instance().object_store()->find_node(m_node_path); if (node != NULL && node->plugin()->type() == Plugin::DSSI) m_node = (DSSINode*)node; @@ -52,7 +51,7 @@ DSSIProgramEvent::pre_process() void -DSSIProgramEvent::execute(samplecount offset) +DSSIProgramEvent::execute(SampleCount offset) { if (m_node != NULL) m_node->program(m_bank, m_program); @@ -68,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); - om->client_broadcaster()->send_metadata_update(m_node_path, "dssi-program", temp_buf); + Ingen::instance().client_broadcaster()->send_metadata_update(m_node_path, "dssi-program", temp_buf); } } diff --git a/src/libs/engine/events/DSSIProgramEvent.h b/src/libs/engine/events/DSSIProgramEvent.h index 59d364b5..6ac0dd5f 100644 --- a/src/libs/engine/events/DSSIProgramEvent.h +++ b/src/libs/engine/events/DSSIProgramEvent.h @@ -30,10 +30,10 @@ namespace Om { class DSSIProgramEvent : public QueuedEvent { public: - DSSIProgramEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, int bank, int program); + DSSIProgramEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, int bank, int program); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/DSSIUpdateEvent.cpp b/src/libs/engine/events/DSSIUpdateEvent.cpp index 216428ac..9a0a6585 100644 --- a/src/libs/engine/events/DSSIUpdateEvent.cpp +++ b/src/libs/engine/events/DSSIUpdateEvent.cpp @@ -18,8 +18,7 @@ #include <iostream> #include "Node.h" #include "ObjectStore.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "DSSINode.h" #include "Plugin.h" @@ -28,7 +27,7 @@ using std::cerr; using std::endl; namespace Om { -DSSIUpdateEvent::DSSIUpdateEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& url) +DSSIUpdateEvent::DSSIUpdateEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& url) : QueuedEvent(responder, timestamp), m_path(path), m_url(url), @@ -40,7 +39,7 @@ DSSIUpdateEvent::DSSIUpdateEvent(CountedPtr<Responder> responder, samplecount ti void DSSIUpdateEvent::pre_process() { - Node* node = om->object_store()->find_node(m_path); + Node* node = Ingen::instance().object_store()->find_node(m_path); if (node == NULL || node->plugin()->type() != Plugin::DSSI) { m_node = NULL; @@ -55,7 +54,7 @@ DSSIUpdateEvent::pre_process() void -DSSIUpdateEvent::execute(samplecount offset) +DSSIUpdateEvent::execute(SampleCount offset) { if (m_node != NULL) { m_node->set_ui_url(m_url); diff --git a/src/libs/engine/events/DSSIUpdateEvent.h b/src/libs/engine/events/DSSIUpdateEvent.h index 184dd29a..5182e3f0 100644 --- a/src/libs/engine/events/DSSIUpdateEvent.h +++ b/src/libs/engine/events/DSSIUpdateEvent.h @@ -36,10 +36,10 @@ class DSSINode; class DSSIUpdateEvent : public QueuedEvent { public: - DSSIUpdateEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& url); + DSSIUpdateEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& url); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/DeactivateEvent.cpp b/src/libs/engine/events/DeactivateEvent.cpp index 0deee46a..803373f1 100644 --- a/src/libs/engine/events/DeactivateEvent.cpp +++ b/src/libs/engine/events/DeactivateEvent.cpp @@ -16,13 +16,12 @@ #include "DeactivateEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" namespace Om { -DeactivateEvent::DeactivateEvent(CountedPtr<Responder> responder, samplecount timestamp) +DeactivateEvent::DeactivateEvent(CountedPtr<Responder> responder, SampleCount timestamp) : QueuedEvent(responder, timestamp) { } @@ -36,7 +35,7 @@ DeactivateEvent::pre_process() void -DeactivateEvent::execute(samplecount offset) +DeactivateEvent::execute(SampleCount offset) { QueuedEvent::execute(offset); } @@ -46,7 +45,7 @@ void DeactivateEvent::post_process() { _responder->respond_ok(); - om->deactivate(); + Ingen::instance().deactivate(); } diff --git a/src/libs/engine/events/DeactivateEvent.h b/src/libs/engine/events/DeactivateEvent.h index 5e0d2880..27c2aa33 100644 --- a/src/libs/engine/events/DeactivateEvent.h +++ b/src/libs/engine/events/DeactivateEvent.h @@ -29,10 +29,10 @@ namespace Om { class DeactivateEvent : public QueuedEvent { public: - DeactivateEvent(CountedPtr<Responder> responder, samplecount timestamp); + DeactivateEvent(CountedPtr<Responder> responder, SampleCount timestamp); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); }; diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp index b4b54080..1725f608 100644 --- a/src/libs/engine/events/DestroyEvent.cpp +++ b/src/libs/engine/events/DestroyEvent.cpp @@ -16,8 +16,7 @@ #include "DestroyEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "Patch.h" #include "Tree.h" #include "Node.h" @@ -35,7 +34,7 @@ namespace Om { -DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, samplecount timestamp, QueuedEventSource* source, const string& path, bool lock_mutex) +DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, SampleCount timestamp, QueuedEventSource* source, const string& path, bool lock_mutex) : QueuedEvent(responder, true, source), m_path(path), m_node(NULL), @@ -48,7 +47,7 @@ DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, samplecount timestam } -DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* node, bool lock_mutex) +DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, SampleCount timestamp, Node* node, bool lock_mutex) : QueuedEvent(responder, true), m_path(node->path()), m_node(node), @@ -72,7 +71,7 @@ void DestroyEvent::pre_process() { if (m_node == NULL) - m_node = om->object_store()->find_node(m_path); + m_node = Ingen::instance().object_store()->find_node(m_path); if (m_node != NULL && m_path != "/") { assert(m_node->parent_patch() != NULL); @@ -117,7 +116,7 @@ DestroyEvent::pre_process() void -DestroyEvent::execute(samplecount offset) +DestroyEvent::execute(SampleCount offset) { QueuedEvent::execute(offset); @@ -130,7 +129,7 @@ DestroyEvent::execute(samplecount offset) m_parent_disconnect_event->execute(offset); if (m_node->parent_patch()->process_order() != NULL) - om->maid()->push(m_node->parent_patch()->process_order()); + Ingen::instance().maid()->push(m_node->parent_patch()->process_order()); m_node->parent_patch()->process_order(m_process_order); } } @@ -154,9 +153,9 @@ DestroyEvent::post_process() m_disconnect_event->post_process(); if (m_parent_disconnect_event != NULL) m_parent_disconnect_event->post_process(); - om->client_broadcaster()->send_destroyed(m_path); - om->maid()->push(m_patch_listnode); - om->maid()->push(m_node); + Ingen::instance().client_broadcaster()->send_destroyed(m_path); + Ingen::instance().maid()->push(m_patch_listnode); + Ingen::instance().maid()->push(m_node); } else { _responder->respond_error("Unable to destroy object"); } diff --git a/src/libs/engine/events/DestroyEvent.h b/src/libs/engine/events/DestroyEvent.h index d101c00a..4f94e6a0 100644 --- a/src/libs/engine/events/DestroyEvent.h +++ b/src/libs/engine/events/DestroyEvent.h @@ -44,12 +44,12 @@ class DisconnectPortEvent; class DestroyEvent : public QueuedEvent { public: - DestroyEvent(CountedPtr<Responder> responder, samplecount timestamp, QueuedEventSource* source, const string& path, bool lock_mutex = true); - DestroyEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* node, bool lock_mutex = true); + DestroyEvent(CountedPtr<Responder> responder, SampleCount timestamp, QueuedEventSource* source, const string& path, bool lock_mutex = true); + DestroyEvent(CountedPtr<Responder> responder, SampleCount timestamp, Node* node, bool lock_mutex = true); ~DestroyEvent(); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/DisablePatchEvent.cpp b/src/libs/engine/events/DisablePatchEvent.cpp index aa141b9c..42f0ecdf 100644 --- a/src/libs/engine/events/DisablePatchEvent.cpp +++ b/src/libs/engine/events/DisablePatchEvent.cpp @@ -16,8 +16,7 @@ #include "DisablePatchEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "Patch.h" #include "ClientBroadcaster.h" #include "util.h" @@ -27,7 +26,7 @@ namespace Om { -DisablePatchEvent::DisablePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path) +DisablePatchEvent::DisablePatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path) : QueuedEvent(responder, timestamp), m_patch_path(patch_path), m_patch(NULL) @@ -38,14 +37,14 @@ DisablePatchEvent::DisablePatchEvent(CountedPtr<Responder> responder, samplecoun void DisablePatchEvent::pre_process() { - m_patch = om->object_store()->find_patch(m_patch_path); + m_patch = Ingen::instance().object_store()->find_patch(m_patch_path); QueuedEvent::pre_process(); } void -DisablePatchEvent::execute(samplecount offset) +DisablePatchEvent::execute(SampleCount offset) { if (m_patch != NULL) m_patch->process(false); @@ -59,7 +58,7 @@ DisablePatchEvent::post_process() { if (m_patch != NULL) { _responder->respond_ok(); - om->client_broadcaster()->send_patch_disable(m_patch_path); + Ingen::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/DisablePatchEvent.h b/src/libs/engine/events/DisablePatchEvent.h index 52fbc81b..b6a21a23 100644 --- a/src/libs/engine/events/DisablePatchEvent.h +++ b/src/libs/engine/events/DisablePatchEvent.h @@ -34,10 +34,10 @@ class Patch; class DisablePatchEvent : public QueuedEvent { public: - DisablePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path); + DisablePatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp index 3d2407a2..7b746fd1 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.cpp +++ b/src/libs/engine/events/DisconnectNodeEvent.cpp @@ -17,8 +17,7 @@ #include "DisconnectNodeEvent.h" #include <iostream> #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "Maid.h" #include "List.h" #include "Node.h" @@ -39,7 +38,7 @@ using std::cerr; using std::endl; namespace Om { -DisconnectNodeEvent::DisconnectNodeEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path) +DisconnectNodeEvent::DisconnectNodeEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path) : QueuedEvent(responder, timestamp), m_node_path(node_path), m_patch(NULL), @@ -78,7 +77,7 @@ DisconnectNodeEvent::pre_process() // cerr << "Preparing disconnection event...\n"; if (m_lookup) { - m_patch = om->object_store()->find_patch(m_node_path.parent()); + m_patch = Ingen::instance().object_store()->find_patch(m_node_path.parent()); if (m_patch == NULL) { m_succeeded = false; @@ -86,7 +85,7 @@ DisconnectNodeEvent::pre_process() return; } - m_node = om->object_store()->find_node(m_node_path); + m_node = Ingen::instance().object_store()->find_node(m_node_path); if (m_node == NULL) { m_succeeded = false; @@ -113,7 +112,7 @@ DisconnectNodeEvent::pre_process() void -DisconnectNodeEvent::execute(samplecount offset) +DisconnectNodeEvent::execute(SampleCount offset) { if (m_succeeded) { for (List<DisconnectionEvent*>::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i) diff --git a/src/libs/engine/events/DisconnectNodeEvent.h b/src/libs/engine/events/DisconnectNodeEvent.h index 0e679dc0..7623bc40 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.h +++ b/src/libs/engine/events/DisconnectNodeEvent.h @@ -42,12 +42,12 @@ template <typename T> class OutputPort; class DisconnectNodeEvent : public QueuedEvent { public: - DisconnectNodeEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path); + DisconnectNodeEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path); DisconnectNodeEvent(Node* node); ~DisconnectNodeEvent(); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp index d62e3b2c..a3b93727 100644 --- a/src/libs/engine/events/DisconnectPortEvent.cpp +++ b/src/libs/engine/events/DisconnectPortEvent.cpp @@ -17,8 +17,7 @@ #include "DisconnectPortEvent.h" #include <iostream> #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "Maid.h" #include "List.h" #include "Node.h" @@ -39,7 +38,7 @@ using std::cerr; using std::endl; namespace Om { -DisconnectPortEvent::DisconnectPortEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path) +DisconnectPortEvent::DisconnectPortEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path) : QueuedEvent(responder, timestamp), m_port_path(port_path), m_patch(NULL), @@ -77,7 +76,7 @@ DisconnectPortEvent::pre_process() // cerr << "Preparing disconnection event...\n"; if (m_lookup) { - m_patch = om->object_store()->find_patch(m_port_path.parent().parent()); + m_patch = Ingen::instance().object_store()->find_patch(m_port_path.parent().parent()); if (m_patch == NULL) { m_succeeded = false; @@ -85,7 +84,7 @@ DisconnectPortEvent::pre_process() return; } - m_port = om->object_store()->find_port(m_port_path); + m_port = Ingen::instance().object_store()->find_port(m_port_path); if (m_port == NULL) { m_succeeded = false; @@ -118,7 +117,7 @@ DisconnectPortEvent::pre_process() void -DisconnectPortEvent::execute(samplecount offset) +DisconnectPortEvent::execute(SampleCount offset) { if (m_succeeded) { for (List<DisconnectionEvent*>::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i) diff --git a/src/libs/engine/events/DisconnectPortEvent.h b/src/libs/engine/events/DisconnectPortEvent.h index b52401ba..0beee4b9 100644 --- a/src/libs/engine/events/DisconnectPortEvent.h +++ b/src/libs/engine/events/DisconnectPortEvent.h @@ -43,12 +43,12 @@ using std::string; class DisconnectPortEvent : public QueuedEvent { public: - DisconnectPortEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path); + DisconnectPortEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path); DisconnectPortEvent(Port* port); ~DisconnectPortEvent(); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp index e30d851f..29caf45c 100644 --- a/src/libs/engine/events/DisconnectionEvent.cpp +++ b/src/libs/engine/events/DisconnectionEvent.cpp @@ -17,8 +17,7 @@ #include "DisconnectionEvent.h" #include <string> #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "TypedConnection.h" #include "InputPort.h" #include "OutputPort.h" @@ -36,7 +35,7 @@ namespace Om { //// DisconnectionEvent //// -DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& src_port_path, const string& dst_port_path) +DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path) : QueuedEvent(responder, timestamp), m_src_port_path(src_port_path), m_dst_port_path(dst_port_path), @@ -50,7 +49,7 @@ DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, sampleco } -DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, Port* const src_port, Port* const dst_port) +DisconnectionEvent::DisconnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, Port* const src_port, Port* const dst_port) : QueuedEvent(responder, timestamp), m_src_port_path(src_port->path()), m_dst_port_path(dst_port->path()), @@ -86,7 +85,7 @@ DisconnectionEvent::pre_process() return; } - /*m_patch = om->object_store()->find_patch(m_src_port_path.parent().parent()); + /*m_patch = Ingen::instance().object_store()->find_patch(m_src_port_path.parent().parent()); if (m_patch == NULL) { m_error = PORT_NOT_FOUND; @@ -94,8 +93,8 @@ DisconnectionEvent::pre_process() return; }*/ - m_src_port = om->object_store()->find_port(m_src_port_path); - m_dst_port = om->object_store()->find_port(m_dst_port_path); + 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); } if (m_src_port == NULL || m_dst_port == NULL) { @@ -113,8 +112,8 @@ DisconnectionEvent::pre_process() // Create the typed event to actually do the work const DataType type = m_src_port->type(); if (type == DataType::FLOAT) { - m_typed_event = new TypedDisconnectionEvent<sample>(_responder, _time_stamp, - dynamic_cast<OutputPort<sample>*>(m_src_port), dynamic_cast<InputPort<sample>*>(m_dst_port)); + m_typed_event = new TypedDisconnectionEvent<Sample>(_responder, _time_stamp, + dynamic_cast<OutputPort<Sample>*>(m_src_port), dynamic_cast<InputPort<Sample>*>(m_dst_port)); } else if (type == DataType::MIDI) { m_typed_event = new TypedDisconnectionEvent<MidiMessage>(_responder, _time_stamp, dynamic_cast<OutputPort<MidiMessage>*>(m_src_port), dynamic_cast<InputPort<MidiMessage>*>(m_dst_port)); @@ -132,7 +131,7 @@ DisconnectionEvent::pre_process() void -DisconnectionEvent::execute(samplecount offset) +DisconnectionEvent::execute(SampleCount offset) { QueuedEvent::execute(offset); @@ -160,7 +159,7 @@ DisconnectionEvent::post_process() template <typename T> -TypedDisconnectionEvent<T>::TypedDisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port) +TypedDisconnectionEvent<T>::TypedDisconnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port) : QueuedEvent(responder, timestamp), m_src_port(src_port), m_dst_port(dst_port), @@ -234,7 +233,7 @@ TypedDisconnectionEvent<T>::pre_process() template <typename T> void -TypedDisconnectionEvent<T>::execute(samplecount offset) +TypedDisconnectionEvent<T>::execute(SampleCount offset) { if (m_succeeded) { @@ -249,12 +248,12 @@ TypedDisconnectionEvent<T>::execute(samplecount offset) assert((Connection*)port_connection->elem() == patch_connection->elem()); // Clean up both the list node and the connection itself... - om->maid()->push(port_connection); - om->maid()->push(patch_connection); - om->maid()->push(port_connection->elem()); + Ingen::instance().maid()->push(port_connection); + Ingen::instance().maid()->push(patch_connection); + Ingen::instance().maid()->push(port_connection->elem()); if (m_patch->process_order() != NULL) - om->maid()->push(m_patch->process_order()); + Ingen::instance().maid()->push(m_patch->process_order()); m_patch->process_order(m_process_order); } else { m_succeeded = false; // Ports weren't connected @@ -272,7 +271,7 @@ TypedDisconnectionEvent<T>::post_process() _responder->respond_ok(); - om->client_broadcaster()->send_disconnection(m_src_port->path(), m_dst_port->path()); + Ingen::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/DisconnectionEvent.h b/src/libs/engine/events/DisconnectionEvent.h index 4a259855..3fe95fad 100644 --- a/src/libs/engine/events/DisconnectionEvent.h +++ b/src/libs/engine/events/DisconnectionEvent.h @@ -46,12 +46,12 @@ template <typename T> class TypedDisconnectionEvent; // helper, defined below class DisconnectionEvent : public QueuedEvent { public: - DisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& src_port_path, const string& dst_port_path); - DisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, Port* const src_port, Port* const dst_port); + DisconnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path); + DisconnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, Port* const src_port, Port* const dst_port); ~DisconnectionEvent(); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: @@ -82,10 +82,10 @@ template <typename T> class TypedDisconnectionEvent : public QueuedEvent { public: - TypedDisconnectionEvent(CountedPtr<Responder> responder, samplecount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port); + TypedDisconnectionEvent(CountedPtr<Responder> responder, SampleCount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/EnablePatchEvent.cpp b/src/libs/engine/events/EnablePatchEvent.cpp index 8bf769b4..042acd12 100644 --- a/src/libs/engine/events/EnablePatchEvent.cpp +++ b/src/libs/engine/events/EnablePatchEvent.cpp @@ -16,8 +16,7 @@ #include "EnablePatchEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "Patch.h" #include "util.h" #include "ClientBroadcaster.h" @@ -26,7 +25,7 @@ namespace Om { -EnablePatchEvent::EnablePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path) +EnablePatchEvent::EnablePatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path) : QueuedEvent(responder, timestamp), m_patch_path(patch_path), m_patch(NULL), @@ -38,7 +37,7 @@ EnablePatchEvent::EnablePatchEvent(CountedPtr<Responder> responder, samplecount void EnablePatchEvent::pre_process() { - m_patch = om->object_store()->find_patch(m_patch_path); + m_patch = Ingen::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 @@ -53,7 +52,7 @@ EnablePatchEvent::pre_process() void -EnablePatchEvent::execute(samplecount offset) +EnablePatchEvent::execute(SampleCount offset) { if (m_patch != NULL) { m_patch->process(true); @@ -71,7 +70,7 @@ EnablePatchEvent::post_process() { if (m_patch != NULL) { _responder->respond_ok(); - om->client_broadcaster()->send_patch_enable(m_patch_path); + Ingen::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/EnablePatchEvent.h b/src/libs/engine/events/EnablePatchEvent.h index b2b3e300..1984f72c 100644 --- a/src/libs/engine/events/EnablePatchEvent.h +++ b/src/libs/engine/events/EnablePatchEvent.h @@ -37,10 +37,10 @@ class Node; class EnablePatchEvent : public QueuedEvent { public: - EnablePatchEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& patch_path); + EnablePatchEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& patch_path); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/LashRestoreDoneEvent.h b/src/libs/engine/events/LashRestoreDoneEvent.h index c6dd0392..b090e01d 100644 --- a/src/libs/engine/events/LashRestoreDoneEvent.h +++ b/src/libs/engine/events/LashRestoreDoneEvent.h @@ -39,7 +39,7 @@ class Port; class LashRestoreDoneEvent : public QueuedEvent { public: - LashRestoreDoneEvent(CountedPtr<Responder> responder, samplecount timestamp) : QueuedEvent(responder, timestamp) {} + LashRestoreDoneEvent(CountedPtr<Responder> responder, SampleCount timestamp) : QueuedEvent(responder, timestamp) {} void post_process() { diff --git a/src/libs/engine/events/LoadPluginsEvent.cpp b/src/libs/engine/events/LoadPluginsEvent.cpp index f35fc2fb..317171ba 100644 --- a/src/libs/engine/events/LoadPluginsEvent.cpp +++ b/src/libs/engine/events/LoadPluginsEvent.cpp @@ -16,8 +16,7 @@ #include "LoadPluginsEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "NodeFactory.h" #include <iostream> @@ -26,11 +25,11 @@ using std::cerr; namespace Om { -LoadPluginsEvent::LoadPluginsEvent(CountedPtr<Responder> responder, samplecount timestamp) +LoadPluginsEvent::LoadPluginsEvent(CountedPtr<Responder> responder, SampleCount timestamp) : QueuedEvent(responder, timestamp) { cerr << "LOADING PLUGINS\n"; - om->node_factory()->load_plugins(); + Ingen::instance().node_factory()->load_plugins(); } diff --git a/src/libs/engine/events/LoadPluginsEvent.h b/src/libs/engine/events/LoadPluginsEvent.h index 435d6f15..9600bdbc 100644 --- a/src/libs/engine/events/LoadPluginsEvent.h +++ b/src/libs/engine/events/LoadPluginsEvent.h @@ -29,7 +29,7 @@ namespace Om { class LoadPluginsEvent : public QueuedEvent { public: - LoadPluginsEvent(CountedPtr<Responder> responder, samplecount timestamp); + LoadPluginsEvent(CountedPtr<Responder> responder, SampleCount timestamp); void post_process(); }; diff --git a/src/libs/engine/events/MidiLearnEvent.cpp b/src/libs/engine/events/MidiLearnEvent.cpp index b1cfb69d..be0597f1 100644 --- a/src/libs/engine/events/MidiLearnEvent.cpp +++ b/src/libs/engine/events/MidiLearnEvent.cpp @@ -16,8 +16,7 @@ #include "MidiLearnEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "ObjectStore.h" #include "Node.h" #include "MidiControlNode.h" @@ -31,14 +30,14 @@ namespace Om { void MidiLearnResponseEvent::post_process() { - om->client_broadcaster()->send_control_change(m_port_path, m_value); + Ingen::instance().client_broadcaster()->send_control_change(m_port_path, m_value); } // MidiLearnEvent -MidiLearnEvent::MidiLearnEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path) +MidiLearnEvent::MidiLearnEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path) : QueuedEvent(responder, timestamp), m_node_path(node_path), m_node(NULL), @@ -50,7 +49,7 @@ MidiLearnEvent::MidiLearnEvent(CountedPtr<Responder> responder, samplecount time void MidiLearnEvent::pre_process() { - m_node = om->object_store()->find_node(m_node_path); + m_node = Ingen::instance().object_store()->find_node(m_node_path); m_response_event = new MidiLearnResponseEvent(m_node_path + "/Controller_Number", _time_stamp); QueuedEvent::pre_process(); @@ -58,7 +57,7 @@ MidiLearnEvent::pre_process() void -MidiLearnEvent::execute(samplecount offset) +MidiLearnEvent::execute(SampleCount offset) { QueuedEvent::execute(offset); diff --git a/src/libs/engine/events/MidiLearnEvent.h b/src/libs/engine/events/MidiLearnEvent.h index bf4ebae2..26e8d3ec 100644 --- a/src/libs/engine/events/MidiLearnEvent.h +++ b/src/libs/engine/events/MidiLearnEvent.h @@ -37,18 +37,18 @@ class ControlChangeEvent; class MidiLearnResponseEvent : public Event { public: - MidiLearnResponseEvent(const string& port_path, samplecount timestamp) + MidiLearnResponseEvent(const string& port_path, SampleCount timestamp) : Event(NULL, timestamp), m_port_path(port_path), m_value(0.0f) {} - void set_value(sample val) { m_value = val; } + void set_value(Sample val) { m_value = val; } void post_process(); private: string m_port_path; - sample m_value; + Sample m_value; }; @@ -64,10 +64,10 @@ private: class MidiLearnEvent : public QueuedEvent { public: - MidiLearnEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path); + MidiLearnEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/NoteOffEvent.cpp b/src/libs/engine/events/NoteOffEvent.cpp index cd411d81..39b04f31 100644 --- a/src/libs/engine/events/NoteOffEvent.cpp +++ b/src/libs/engine/events/NoteOffEvent.cpp @@ -16,8 +16,7 @@ #include "NoteOffEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "ObjectStore.h" #include "Node.h" #include "MidiNoteNode.h" @@ -28,7 +27,7 @@ namespace Om { /** Note off with patch explicitly passed - triggered by MIDI. */ -NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* node, uchar note_num) +NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, Node* node, uchar note_num) : Event(responder, timestamp), m_node(node), m_note_num(note_num) @@ -38,7 +37,7 @@ NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, samplecount timestam /** Note off event with lookup - triggered by OSC. */ -NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, uchar note_num) +NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num) : Event(responder, timestamp), m_node(NULL), m_node_path(node_path), @@ -48,10 +47,10 @@ NoteOffEvent::NoteOffEvent(CountedPtr<Responder> responder, samplecount timestam void -NoteOffEvent::execute(samplecount offset) +NoteOffEvent::execute(SampleCount offset) { if (m_node == NULL && m_node_path != "") - m_node = om->object_store()->find_node(m_node_path); + m_node = Ingen::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/NoteOffEvent.h b/src/libs/engine/events/NoteOffEvent.h index 4e527e62..8bf14dae 100644 --- a/src/libs/engine/events/NoteOffEvent.h +++ b/src/libs/engine/events/NoteOffEvent.h @@ -34,10 +34,10 @@ class Node; class NoteOffEvent : public Event { public: - NoteOffEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* node, uchar note_num); - NoteOffEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, uchar note_num); + NoteOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, Node* node, uchar note_num); + NoteOffEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/NoteOnEvent.cpp b/src/libs/engine/events/NoteOnEvent.cpp index bd9531e1..df28c478 100644 --- a/src/libs/engine/events/NoteOnEvent.cpp +++ b/src/libs/engine/events/NoteOnEvent.cpp @@ -16,8 +16,7 @@ #include "NoteOnEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "ObjectStore.h" #include "Node.h" #include "MidiNoteNode.h" @@ -31,7 +30,7 @@ namespace Om { * * Used to be triggered by MIDI. Not used anymore. */ -NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* patch, uchar note_num, uchar velocity) +NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity) : Event(responder, timestamp), m_node(patch), m_note_num(note_num), @@ -45,7 +44,7 @@ NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, samplecount timestamp, * * Triggered by OSC. */ -NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, uchar note_num, uchar velocity) +NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity) : Event(responder, timestamp), m_node(NULL), m_node_path(node_path), @@ -57,11 +56,11 @@ NoteOnEvent::NoteOnEvent(CountedPtr<Responder> responder, samplecount timestamp, void -NoteOnEvent::execute(samplecount offset) +NoteOnEvent::execute(SampleCount offset) { // Lookup if neccessary if (m_is_osc_triggered) - m_node = om->object_store()->find_node(m_node_path); + m_node = Ingen::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.h b/src/libs/engine/events/NoteOnEvent.h index 91b6d3ac..b0a20b04 100644 --- a/src/libs/engine/events/NoteOnEvent.h +++ b/src/libs/engine/events/NoteOnEvent.h @@ -34,10 +34,10 @@ class Node; class NoteOnEvent : public Event { public: - NoteOnEvent(CountedPtr<Responder> responder, samplecount timestamp, Node* patch, uchar note_num, uchar velocity); - NoteOnEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, uchar note_num, uchar velocity); + NoteOnEvent(CountedPtr<Responder> responder, SampleCount timestamp, Node* patch, uchar note_num, uchar velocity); + NoteOnEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, uchar note_num, uchar velocity); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/PingQueuedEvent.h b/src/libs/engine/events/PingQueuedEvent.h index c6dab069..92b965c4 100644 --- a/src/libs/engine/events/PingQueuedEvent.h +++ b/src/libs/engine/events/PingQueuedEvent.h @@ -34,7 +34,7 @@ class Port; class PingQueuedEvent : public QueuedEvent { public: - PingQueuedEvent(CountedPtr<Responder> responder, samplecount timestamp) : QueuedEvent(responder, timestamp) {} + PingQueuedEvent(CountedPtr<Responder> responder, SampleCount timestamp) : QueuedEvent(responder, timestamp) {} void post_process() { _responder->respond_ok(); } }; diff --git a/src/libs/engine/events/RegisterClientEvent.cpp b/src/libs/engine/events/RegisterClientEvent.cpp index 2c3c8dbf..54c47ce6 100644 --- a/src/libs/engine/events/RegisterClientEvent.cpp +++ b/src/libs/engine/events/RegisterClientEvent.cpp @@ -16,15 +16,14 @@ #include "RegisterClientEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "ClientBroadcaster.h" namespace Om { RegisterClientEvent::RegisterClientEvent(CountedPtr<Responder> responder, - samplecount timestamp, + SampleCount timestamp, ClientKey key, CountedPtr<ClientInterface> client) : QueuedEvent(responder, timestamp) @@ -37,7 +36,7 @@ RegisterClientEvent::RegisterClientEvent(CountedPtr<Responder> responder, void RegisterClientEvent::pre_process() { - om->client_broadcaster()->register_client(_key, _client); + Ingen::instance().client_broadcaster()->register_client(_key, _client); QueuedEvent::pre_process(); } diff --git a/src/libs/engine/events/RegisterClientEvent.h b/src/libs/engine/events/RegisterClientEvent.h index ba55a241..4e0dee7e 100644 --- a/src/libs/engine/events/RegisterClientEvent.h +++ b/src/libs/engine/events/RegisterClientEvent.h @@ -36,7 +36,7 @@ class RegisterClientEvent : public QueuedEvent { public: RegisterClientEvent(CountedPtr<Responder> responder, - samplecount timestamp, + SampleCount timestamp, ClientKey key, CountedPtr<ClientInterface> client); diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp index 5cd9a19a..a383fc3b 100644 --- a/src/libs/engine/events/RenameEvent.cpp +++ b/src/libs/engine/events/RenameEvent.cpp @@ -19,8 +19,7 @@ #include "Patch.h" #include "Node.h" #include "Tree.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "ClientBroadcaster.h" #include "util/Path.h" #include "ObjectStore.h" @@ -28,7 +27,7 @@ namespace Om { -RenameEvent::RenameEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& name) +RenameEvent::RenameEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& name) : QueuedEvent(responder, timestamp), m_old_path(path), m_name(name), @@ -59,13 +58,13 @@ RenameEvent::pre_process() return; } - if (om->object_store()->find(m_new_path)) { + if (Ingen::instance().object_store()->find(m_new_path)) { m_error = OBJECT_EXISTS; QueuedEvent::pre_process(); return; } - GraphObject* obj = om->object_store()->find(m_old_path); + GraphObject* obj = Ingen::instance().object_store()->find(m_old_path); if (obj == NULL) { m_error = OBJECT_NOT_FOUND; @@ -90,7 +89,7 @@ RenameEvent::pre_process() void -RenameEvent::execute(samplecount offset) +RenameEvent::execute(SampleCount offset) { //cout << "Executing rename event..."; QueuedEvent::execute(offset); @@ -104,7 +103,7 @@ RenameEvent::post_process() if (m_error == NO_ERROR) { _responder->respond_ok(); - om->client_broadcaster()->send_rename(m_old_path, m_new_path); + Ingen::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/RenameEvent.h b/src/libs/engine/events/RenameEvent.h index db1bdd41..bfd726d6 100644 --- a/src/libs/engine/events/RenameEvent.h +++ b/src/libs/engine/events/RenameEvent.h @@ -42,11 +42,11 @@ class DisconnectPortEvent; class RenameEvent : public QueuedEvent { public: - RenameEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& name); + RenameEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& name); ~RenameEvent(); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/RequestAllObjectsEvent.cpp b/src/libs/engine/events/RequestAllObjectsEvent.cpp index 702325ea..0260dd65 100644 --- a/src/libs/engine/events/RequestAllObjectsEvent.cpp +++ b/src/libs/engine/events/RequestAllObjectsEvent.cpp @@ -16,14 +16,13 @@ #include "RequestAllObjectsEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "ObjectSender.h" namespace Om { -RequestAllObjectsEvent::RequestAllObjectsEvent(CountedPtr<Responder> responder, samplecount timestamp) +RequestAllObjectsEvent::RequestAllObjectsEvent(CountedPtr<Responder> responder, SampleCount timestamp) : QueuedEvent(responder, timestamp), m_client(CountedPtr<ClientInterface>(NULL)) { diff --git a/src/libs/engine/events/RequestAllObjectsEvent.h b/src/libs/engine/events/RequestAllObjectsEvent.h index 44f3603d..a37b953f 100644 --- a/src/libs/engine/events/RequestAllObjectsEvent.h +++ b/src/libs/engine/events/RequestAllObjectsEvent.h @@ -35,7 +35,7 @@ namespace Shared { class RequestAllObjectsEvent : public QueuedEvent { public: - RequestAllObjectsEvent(CountedPtr<Responder> responder, samplecount timestamp); + RequestAllObjectsEvent(CountedPtr<Responder> responder, SampleCount timestamp); void pre_process(); void post_process(); diff --git a/src/libs/engine/events/RequestMetadataEvent.cpp b/src/libs/engine/events/RequestMetadataEvent.cpp index 54a9fa0a..860d9f3f 100644 --- a/src/libs/engine/events/RequestMetadataEvent.cpp +++ b/src/libs/engine/events/RequestMetadataEvent.cpp @@ -17,8 +17,7 @@ #include "RequestMetadataEvent.h" #include <string> #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "GraphObject.h" #include "ObjectStore.h" #include "interface/ClientInterface.h" @@ -28,7 +27,7 @@ using std::string; namespace Om { -RequestMetadataEvent::RequestMetadataEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& node_path, const string& key) +RequestMetadataEvent::RequestMetadataEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& node_path, const string& key) : QueuedEvent(responder, timestamp), m_path(node_path), m_key(key), @@ -45,7 +44,7 @@ RequestMetadataEvent::pre_process() m_client = _responder->find_client(); if (m_client) { - m_object = om->object_store()->find(m_path); + m_object = Ingen::instance().object_store()->find(m_path); if (m_object == NULL) { QueuedEvent::pre_process(); return; diff --git a/src/libs/engine/events/RequestMetadataEvent.h b/src/libs/engine/events/RequestMetadataEvent.h index b84a0094..1da4ffe6 100644 --- a/src/libs/engine/events/RequestMetadataEvent.h +++ b/src/libs/engine/events/RequestMetadataEvent.h @@ -37,7 +37,7 @@ namespace Shared { class RequestMetadataEvent : public QueuedEvent { public: - RequestMetadataEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& key); + RequestMetadataEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& key); void pre_process(); void post_process(); diff --git a/src/libs/engine/events/RequestPluginsEvent.cpp b/src/libs/engine/events/RequestPluginsEvent.cpp index 6f3a92a8..286badb4 100644 --- a/src/libs/engine/events/RequestPluginsEvent.cpp +++ b/src/libs/engine/events/RequestPluginsEvent.cpp @@ -16,14 +16,13 @@ #include "RequestPluginsEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "ClientBroadcaster.h" namespace Om { -RequestPluginsEvent::RequestPluginsEvent(CountedPtr<Responder> responder, samplecount timestamp) +RequestPluginsEvent::RequestPluginsEvent(CountedPtr<Responder> responder, SampleCount timestamp) : QueuedEvent(responder, timestamp), m_client(CountedPtr<ClientInterface>(NULL)) { @@ -43,7 +42,7 @@ void RequestPluginsEvent::post_process() { if (m_client) { - om->client_broadcaster()->send_plugins_to(m_client.get()); + Ingen::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/RequestPluginsEvent.h b/src/libs/engine/events/RequestPluginsEvent.h index 240e00db..29bb0958 100644 --- a/src/libs/engine/events/RequestPluginsEvent.h +++ b/src/libs/engine/events/RequestPluginsEvent.h @@ -36,7 +36,7 @@ namespace Shared { class RequestPluginsEvent : public QueuedEvent { public: - RequestPluginsEvent(CountedPtr<Responder> responder, samplecount timestamp); + RequestPluginsEvent(CountedPtr<Responder> responder, SampleCount timestamp); void pre_process(); void post_process(); diff --git a/src/libs/engine/events/RequestPortValueEvent.cpp b/src/libs/engine/events/RequestPortValueEvent.cpp index ccdd9312..8cb401dc 100644 --- a/src/libs/engine/events/RequestPortValueEvent.cpp +++ b/src/libs/engine/events/RequestPortValueEvent.cpp @@ -17,8 +17,7 @@ #include "RequestPortValueEvent.h" #include <string> #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "interface/ClientInterface.h" #include "TypedPort.h" #include "ObjectStore.h" @@ -29,7 +28,7 @@ using std::string; namespace Om { -RequestPortValueEvent::RequestPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path) +RequestPortValueEvent::RequestPortValueEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path) : QueuedEvent(responder, timestamp), m_port_path(port_path), m_port(NULL), @@ -43,17 +42,17 @@ void RequestPortValueEvent::pre_process() { m_client = _responder->find_client(); - m_port = om->object_store()->find_port(m_port_path); + m_port = Ingen::instance().object_store()->find_port(m_port_path); QueuedEvent::pre_process(); } void -RequestPortValueEvent::execute(samplecount offset) +RequestPortValueEvent::execute(SampleCount offset) { if (m_port != NULL && m_port->type() == DataType::FLOAT) - m_value = ((TypedPort<sample>*)m_port)->buffer(0)->value_at(offset); + m_value = ((TypedPort<Sample>*)m_port)->buffer(0)->value_at(offset); else m_port = NULL; // triggers error response diff --git a/src/libs/engine/events/RequestPortValueEvent.h b/src/libs/engine/events/RequestPortValueEvent.h index f9f14a41..eba37122 100644 --- a/src/libs/engine/events/RequestPortValueEvent.h +++ b/src/libs/engine/events/RequestPortValueEvent.h @@ -37,16 +37,16 @@ using Shared::ClientInterface; class RequestPortValueEvent : public QueuedEvent { public: - RequestPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path); + RequestPortValueEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: string m_port_path; Port* m_port; - sample m_value; + Sample m_value; CountedPtr<ClientInterface> m_client; }; diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp index 3ea38c4f..a2a02318 100644 --- a/src/libs/engine/events/SetMetadataEvent.cpp +++ b/src/libs/engine/events/SetMetadataEvent.cpp @@ -17,8 +17,7 @@ #include "SetMetadataEvent.h" #include <string> #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "ClientBroadcaster.h" #include "GraphObject.h" #include "ObjectStore.h" @@ -28,7 +27,7 @@ using std::string; namespace Om { -SetMetadataEvent::SetMetadataEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& key, const string& value) +SetMetadataEvent::SetMetadataEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& key, const string& value) : QueuedEvent(responder, timestamp), m_path(path), m_key(key), @@ -41,7 +40,7 @@ SetMetadataEvent::SetMetadataEvent(CountedPtr<Responder> responder, samplecount void SetMetadataEvent::pre_process() { - m_object = om->object_store()->find(m_path); + m_object = Ingen::instance().object_store()->find(m_path); if (m_object == NULL) { QueuedEvent::pre_process(); return; @@ -54,7 +53,7 @@ SetMetadataEvent::pre_process() void -SetMetadataEvent::execute(samplecount offset) +SetMetadataEvent::execute(SampleCount offset) { // Do nothing @@ -71,7 +70,7 @@ SetMetadataEvent::post_process() _responder->respond_error(msg); } else { _responder->respond_ok(); - om->client_broadcaster()->send_metadata_update(m_path, m_key, m_value); + Ingen::instance().client_broadcaster()->send_metadata_update(m_path, m_key, m_value); } } diff --git a/src/libs/engine/events/SetMetadataEvent.h b/src/libs/engine/events/SetMetadataEvent.h index 021567a9..40ec5978 100644 --- a/src/libs/engine/events/SetMetadataEvent.h +++ b/src/libs/engine/events/SetMetadataEvent.h @@ -34,10 +34,10 @@ class GraphObject; class SetMetadataEvent : public QueuedEvent { public: - SetMetadataEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& path, const string& key, const string& value); + SetMetadataEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& key, const string& value); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp index 68aec224..f29a89d1 100644 --- a/src/libs/engine/events/SetPortValueEvent.cpp +++ b/src/libs/engine/events/SetPortValueEvent.cpp @@ -16,8 +16,7 @@ #include "SetPortValueEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "TypedPort.h" #include "ClientBroadcaster.h" #include "Node.h" @@ -28,7 +27,7 @@ namespace Om { /** Voice-specific control setting */ -SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, size_t voice_num, const string& port_path, sample val) +SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val) : Event(responder, timestamp), m_voice_num(voice_num), m_port_path(port_path), @@ -39,7 +38,7 @@ SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, samplecoun } -SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path, sample val) +SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path, Sample val) : Event(responder, timestamp), m_voice_num(-1), m_port_path(port_path), @@ -51,10 +50,10 @@ SetPortValueEvent::SetPortValueEvent(CountedPtr<Responder> responder, samplecoun void -SetPortValueEvent::execute(samplecount offset) +SetPortValueEvent::execute(SampleCount offset) { if (m_port == NULL) - m_port = om->object_store()->find_port(m_port_path); + m_port = Ingen::instance().object_store()->find_port(m_port_path); if (m_port == NULL) { m_error = PORT_NOT_FOUND; @@ -62,10 +61,10 @@ SetPortValueEvent::execute(samplecount offset) m_error = TYPE_MISMATCH; } else { if (m_voice_num == -1) - ((TypedPort<sample>*)m_port)->set_value(m_val, offset); + ((TypedPort<Sample>*)m_port)->set_value(m_val, offset); else - ((TypedPort<sample>*)m_port)->set_value(m_voice_num, m_val, offset); - //((TypedPort<sample>*)m_port)->buffer(m_voice_num)->set(m_val, offset); // FIXME: check range + ((TypedPort<Sample>*)m_port)->set_value(m_voice_num, m_val, offset); + //((TypedPort<Sample>*)m_port)->buffer(m_voice_num)->set(m_val, offset); // FIXME: check range } } @@ -77,13 +76,13 @@ SetPortValueEvent::post_process() assert(m_port != NULL); _responder->respond_ok(); - om->client_broadcaster()->send_control_change(m_port_path, m_val); + Ingen::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); - om->client_broadcaster()->send_control_change(parent_port->path(), m_val); + Ingen::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/SetPortValueEvent.h b/src/libs/engine/events/SetPortValueEvent.h index 0fbc354e..4aca1aaf 100644 --- a/src/libs/engine/events/SetPortValueEvent.h +++ b/src/libs/engine/events/SetPortValueEvent.h @@ -34,10 +34,10 @@ class Port; class SetPortValueEvent : public Event { public: - SetPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path, sample val); - SetPortValueEvent(CountedPtr<Responder> responder, samplecount timestamp, size_t voice_num, const string& port_path, sample val); + SetPortValueEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path, Sample val); + SetPortValueEvent(CountedPtr<Responder> responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.cpp b/src/libs/engine/events/SetPortValueQueuedEvent.cpp index 134ac462..71d796b1 100644 --- a/src/libs/engine/events/SetPortValueQueuedEvent.cpp +++ b/src/libs/engine/events/SetPortValueQueuedEvent.cpp @@ -16,8 +16,7 @@ #include "SetPortValueQueuedEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "TypedPort.h" #include "ClientBroadcaster.h" #include "Plugin.h" @@ -29,7 +28,7 @@ namespace Om { /** Voice-specific control setting */ -SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder, samplecount timestamp, size_t voice_num, const string& port_path, sample val) +SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val) : QueuedEvent(responder, timestamp), m_voice_num(voice_num), m_port_path(port_path), @@ -40,7 +39,7 @@ SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder } -SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path, sample val) +SetPortValueQueuedEvent::SetPortValueQueuedEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path, Sample val) : QueuedEvent(responder, timestamp), m_voice_num(-1), m_port_path(port_path), @@ -55,7 +54,7 @@ void SetPortValueQueuedEvent::pre_process() { if (m_port == NULL) - m_port = om->object_store()->find_port(m_port_path); + m_port = Ingen::instance().object_store()->find_port(m_port_path); if (m_port == NULL) { m_error = PORT_NOT_FOUND; @@ -68,16 +67,16 @@ SetPortValueQueuedEvent::pre_process() void -SetPortValueQueuedEvent::execute(samplecount offset) +SetPortValueQueuedEvent::execute(SampleCount offset) { QueuedEvent::execute(offset); if (m_error == NO_ERROR) { assert(m_port != NULL); if (m_voice_num == -1) - ((TypedPort<sample>*)m_port)->set_value(m_val, offset); + ((TypedPort<Sample>*)m_port)->set_value(m_val, offset); else - ((TypedPort<sample>*)m_port)->buffer(m_voice_num)->set(m_val, offset); // FIXME: check range + ((TypedPort<Sample>*)m_port)->buffer(m_voice_num)->set(m_val, offset); // FIXME: check range } } @@ -89,13 +88,13 @@ SetPortValueQueuedEvent::post_process() assert(m_port != NULL); _responder->respond_ok(); - om->client_broadcaster()->send_control_change(m_port_path, m_val); + Ingen::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); - om->client_broadcaster()->send_control_change(parent_port->path(), m_val); + Ingen::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.h b/src/libs/engine/events/SetPortValueQueuedEvent.h index 653153f4..2dbca248 100644 --- a/src/libs/engine/events/SetPortValueQueuedEvent.h +++ b/src/libs/engine/events/SetPortValueQueuedEvent.h @@ -34,11 +34,11 @@ class Port; class SetPortValueQueuedEvent : public QueuedEvent { public: - SetPortValueQueuedEvent(CountedPtr<Responder> responder, samplecount timestamp, const string& port_path, sample val); - SetPortValueQueuedEvent(CountedPtr<Responder> responder, samplecount timestamp, size_t voice_num, const string& port_path, sample val); + SetPortValueQueuedEvent(CountedPtr<Responder> responder, SampleCount timestamp, const string& port_path, Sample val); + SetPortValueQueuedEvent(CountedPtr<Responder> responder, SampleCount timestamp, size_t voice_num, const string& port_path, Sample val); void pre_process(); - void execute(samplecount offset); + void execute(SampleCount offset); void post_process(); private: diff --git a/src/libs/engine/events/UnregisterClientEvent.cpp b/src/libs/engine/events/UnregisterClientEvent.cpp index 97f36b0b..622b6c9a 100644 --- a/src/libs/engine/events/UnregisterClientEvent.cpp +++ b/src/libs/engine/events/UnregisterClientEvent.cpp @@ -16,15 +16,14 @@ #include "UnregisterClientEvent.h" #include "Responder.h" -#include "Om.h" -#include "OmApp.h" +#include "Ingen.h" #include "ClientBroadcaster.h" #include "interface/ClientInterface.h" namespace Om { -UnregisterClientEvent::UnregisterClientEvent(CountedPtr<Responder> responder, samplecount timestamp, ClientKey key) +UnregisterClientEvent::UnregisterClientEvent(CountedPtr<Responder> responder, SampleCount timestamp, ClientKey key) : QueuedEvent(responder, timestamp) , _key(key) { @@ -34,7 +33,7 @@ UnregisterClientEvent::UnregisterClientEvent(CountedPtr<Responder> responder, sa void UnregisterClientEvent::post_process() { - if (om->client_broadcaster()->unregister_client(_key)) + if (Ingen::instance().client_broadcaster()->unregister_client(_key)) _responder->respond_ok(); else _responder->respond_error("Unable to unregister client"); diff --git a/src/libs/engine/events/UnregisterClientEvent.h b/src/libs/engine/events/UnregisterClientEvent.h index 41adcef1..634fe762 100644 --- a/src/libs/engine/events/UnregisterClientEvent.h +++ b/src/libs/engine/events/UnregisterClientEvent.h @@ -39,7 +39,7 @@ using Shared::ClientKey; class UnregisterClientEvent : public QueuedEvent { public: - UnregisterClientEvent(CountedPtr<Responder> responder, samplecount timestamp, ClientKey key); + UnregisterClientEvent(CountedPtr<Responder> responder, SampleCount timestamp, ClientKey key); void post_process(); diff --git a/src/libs/engine/types.h b/src/libs/engine/types.h index 81222102..125651bc 100644 --- a/src/libs/engine/types.h +++ b/src/libs/engine/types.h @@ -22,12 +22,12 @@ #include <jack/jack.h> typedef unsigned char uchar; -typedef unsigned int uint; +typedef unsigned int uint; typedef unsigned long ulong; -typedef jack_default_audio_sample_t sample; -typedef jack_nframes_t samplecount; -typedef jack_nframes_t samplerate; +typedef jack_default_audio_sample_t Sample; +typedef jack_nframes_t SampleCount; +typedef jack_nframes_t SampleRate; /** A type that Om can patch (eg can be stored in a port) */ enum DataType { FLOAT, MIDI, UNKNOWN }; |