diff options
Diffstat (limited to 'src')
77 files changed, 315 insertions, 383 deletions
diff --git a/src/server/ArcImpl.hpp b/src/server/ArcImpl.hpp index 486a5694..01984ba6 100644 --- a/src/server/ArcImpl.hpp +++ b/src/server/ArcImpl.hpp @@ -26,7 +26,7 @@ #include "raul/Deletable.hpp" #include "BufferRef.hpp" -#include "Context.hpp" +#include "RunContext.hpp" namespace Ingen { namespace Server { diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp index bf4ef0f8..02611137 100644 --- a/src/server/BlockImpl.cpp +++ b/src/server/BlockImpl.cpp @@ -25,7 +25,7 @@ #include "GraphImpl.hpp" #include "PluginImpl.hpp" #include "PortImpl.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "ThreadManager.hpp" using namespace std; @@ -41,7 +41,6 @@ BlockImpl::BlockImpl(PluginImpl* plugin, : NodeImpl(plugin->uris(), parent, symbol) , _plugin(plugin) , _ports(NULL) - , _context(Context::ID::AUDIO) , _polyphony((polyphonic && parent) ? parent->internal_poly() : 1) , _polyphonic(polyphonic) , _activated(false) @@ -121,7 +120,7 @@ BlockImpl::prepare_poly(BufferFactory& bufs, uint32_t poly) } bool -BlockImpl::apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly) +BlockImpl::apply_poly(RunContext& context, Raul::Maid& maid, uint32_t poly) { if (!_polyphonic) poly = 1; @@ -136,7 +135,7 @@ BlockImpl::apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly) } void -BlockImpl::set_buffer_size(Context& context, +BlockImpl::set_buffer_size(RunContext& context, BufferFactory& bufs, LV2_URID type, uint32_t size) @@ -178,7 +177,7 @@ BlockImpl::port_by_symbol(const char* symbol) } void -BlockImpl::pre_process(ProcessContext& context) +BlockImpl::pre_process(RunContext& context) { // Mix down input ports for (uint32_t i = 0; i < num_ports(); ++i) { @@ -189,7 +188,7 @@ BlockImpl::pre_process(ProcessContext& context) } void -BlockImpl::process(ProcessContext& context) +BlockImpl::process(RunContext& context) { pre_process(context); @@ -224,7 +223,7 @@ BlockImpl::process(ProcessContext& context) return; } - ProcessContext subcontext(context); + RunContext subcontext(context); for (SampleCount offset = 0; offset < context.nframes();) { // Find earliest offset of a value change SampleCount chunk_end = context.nframes(); @@ -259,7 +258,7 @@ BlockImpl::process(ProcessContext& context) } void -BlockImpl::post_process(ProcessContext& context) +BlockImpl::post_process(RunContext& context) { // Write output ports for (uint32_t i = 0; _ports && i < _ports->size(); ++i) { diff --git a/src/server/BlockImpl.hpp b/src/server/BlockImpl.hpp index 1924d5fe..47eaa6eb 100644 --- a/src/server/BlockImpl.hpp +++ b/src/server/BlockImpl.hpp @@ -27,10 +27,10 @@ #include "raul/Array.hpp" #include "BufferRef.hpp" -#include "Context.hpp" #include "NodeImpl.hpp" #include "PluginImpl.hpp" #include "PortType.hpp" +#include "RunContext.hpp" #include "types.hpp" namespace Raul { @@ -42,12 +42,11 @@ namespace Server { class Buffer; class BufferFactory; -class Context; class Engine; class GraphImpl; class PluginImpl; class PortImpl; -class ProcessContext; +class RunContext; class Worker; /** A Block in a Graph (which is also a Block). @@ -115,16 +114,16 @@ public: virtual void learn() {} /** Do whatever needs doing in the process thread before process() is called */ - virtual void pre_process(ProcessContext& context); + virtual void pre_process(RunContext& context); /** Run block for an entire process cycle (calls run()). */ - virtual void process(ProcessContext& context); + virtual void process(RunContext& context); /** Run block for a portion of process cycle (called from process()). */ - virtual void run(ProcessContext& context) = 0; + virtual void run(RunContext& context) = 0; /** Do whatever needs doing in the process thread after process() is called */ - virtual void post_process(ProcessContext& context); + virtual void post_process(RunContext& context); /** Set the buffer of a port to a given buffer (e.g. connect plugin to buffer) */ virtual void set_port_buffer(uint32_t voice, @@ -154,7 +153,7 @@ public: virtual bool prepare_poly(BufferFactory& bufs, uint32_t poly); virtual bool apply_poly( - ProcessContext& context, Raul::Maid& maid, uint32_t poly); + RunContext& context, Raul::Maid& maid, uint32_t poly); /** Information about the Plugin this Block is an instance of. * Not the best name - not all blocks come from plugins (ie Graph) @@ -168,7 +167,7 @@ public: virtual void plugin(PluginImpl* pi) { _plugin = pi; } - virtual void set_buffer_size(Context& context, + virtual void set_buffer_size(RunContext& context, BufferFactory& bufs, LV2_URID type, uint32_t size); @@ -176,7 +175,6 @@ public: /** The Graph this Block belongs to. */ inline GraphImpl* parent_graph() const { return (GraphImpl*)_parent; } - Context::ID context() const { return _context; } uint32_t num_ports() const { return _ports ? _ports->size() : 0; } virtual uint32_t polyphony() const { return _polyphony; } @@ -189,7 +187,6 @@ protected: PluginImpl* _plugin; Raul::Array<PortImpl*>* _ports; ///< Access in audio thread only - Context::ID _context; ///< Context this block runs in uint32_t _polyphony; std::set<BlockImpl*> _providers; ///< Blocks connected to this one's input ports std::set<BlockImpl*> _dependants; ///< Blocks this one's output ports are connected to diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp index 97f1c308..2e977845 100644 --- a/src/server/Buffer.cpp +++ b/src/server/Buffer.cpp @@ -136,7 +136,7 @@ Buffer::clear() } void -Buffer::render_sequence(const Context& context, const Buffer* src, bool add) +Buffer::render_sequence(const RunContext& context, const Buffer* src, bool add) { const LV2_URID atom_Float = _factory.uris().atom_Float; const LV2_Atom_Sequence* seq = src->get<const LV2_Atom_Sequence>(); @@ -154,7 +154,7 @@ Buffer::render_sequence(const Context& context, const Buffer* src, bool add) } void -Buffer::copy(const Context& context, const Buffer* src) +Buffer::copy(const RunContext& context, const Buffer* src) { if (!_buf) { return; @@ -233,7 +233,7 @@ mm_abs_ps(__m128 x) #endif float -Buffer::peak(const Context& context) const +Buffer::peak(const RunContext& context) const { #ifdef __SSE__ const __m128* const vbuf = (const __m128* const)samples(); @@ -276,7 +276,7 @@ Buffer::peak(const Context& context) const } void -Buffer::prepare_write(Context& context) +Buffer::prepare_write(RunContext& context) { if (_type == _factory.uris().atom_Sequence) { LV2_Atom* atom = get<LV2_Atom>(); @@ -288,7 +288,7 @@ Buffer::prepare_write(Context& context) } void -Buffer::prepare_output_write(Context& context) +Buffer::prepare_output_write(RunContext& context) { if (_type == _factory.uris().atom_Sequence) { LV2_Atom* atom = get<LV2_Atom>(); diff --git a/src/server/Buffer.hpp b/src/server/Buffer.hpp index aa732781..6944257f 100644 --- a/src/server/Buffer.hpp +++ b/src/server/Buffer.hpp @@ -35,9 +35,9 @@ namespace Ingen { namespace Server { -class Context; -class Engine; class BufferFactory; +class Engine; +class RunContext; class INGEN_API Buffer : public boost::noncopyable { @@ -51,8 +51,8 @@ public: void clear(); void resize(uint32_t size); - void copy(const Context& context, const Buffer* src); - void prepare_write(Context& context); + void copy(const RunContext& context, const Buffer* src); + void prepare_write(RunContext& context); void* port_data(PortType port_type, SampleCount offset); const void* port_data(PortType port_type, SampleCount offset) const; @@ -157,10 +157,10 @@ public: } /// Audio buffers only - float peak(const Context& context) const; + float peak(const RunContext& context) const; /// Sequence buffers only - void prepare_output_write(Context& context); + void prepare_output_write(RunContext& context); /// Sequence buffers only bool append_event(int64_t frames, @@ -182,7 +182,7 @@ public: void update_value_buffer(SampleCount offset); /// Set/add to audio buffer from the Sequence of Float in `src` - void render_sequence(const Context& context, const Buffer* src, bool add); + void render_sequence(const RunContext& context, const Buffer* src, bool add); void set_capacity(uint32_t capacity) { _capacity = capacity; } diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp index cdce838c..6e8775e7 100644 --- a/src/server/ControlBindings.cpp +++ b/src/server/ControlBindings.cpp @@ -28,7 +28,7 @@ #include "Driver.hpp" #include "Engine.hpp" #include "PortImpl.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "ThreadManager.hpp" using namespace std; @@ -125,9 +125,9 @@ ControlBindings::midi_event_key(uint16_t size, const uint8_t* buf, uint16_t& val } void -ControlBindings::port_binding_changed(ProcessContext& context, - PortImpl* port, - const Atom& binding) +ControlBindings::port_binding_changed(RunContext& context, + PortImpl* port, + const Atom& binding) { const Key key = binding_key(binding); if (key) { @@ -136,10 +136,10 @@ ControlBindings::port_binding_changed(ProcessContext& context, } void -ControlBindings::port_value_changed(ProcessContext& context, - PortImpl* port, - Key key, - const Atom& value_atom) +ControlBindings::port_value_changed(RunContext& context, + PortImpl* port, + Key key, + const Atom& value_atom) { Ingen::World* world = context.engine().world(); const Ingen::URIs& uris = world->uris(); @@ -193,7 +193,7 @@ ControlBindings::learn(PortImpl* port) } static void -get_range(ProcessContext& context, const PortImpl* port, float* min, float* max) +get_range(RunContext& context, const PortImpl* port, float* min, float* max) { *min = port->minimum().get<float>(); *max = port->maximum().get<float>(); @@ -204,7 +204,7 @@ get_range(ProcessContext& context, const PortImpl* port, float* min, float* max) } Atom -ControlBindings::control_to_port_value(ProcessContext& context, +ControlBindings::control_to_port_value(RunContext& context, const PortImpl* port, Type type, int16_t value) const @@ -236,9 +236,9 @@ ControlBindings::control_to_port_value(ProcessContext& context, } int16_t -ControlBindings::port_value_to_control(ProcessContext& context, - PortImpl* port, - Type type, +ControlBindings::port_value_to_control(RunContext& context, + PortImpl* port, + Type type, const Atom& value_atom) const { if (value_atom.type() != port->bufs().forge().Float) @@ -307,10 +307,10 @@ forge_binding(const URIs& uris, } void -ControlBindings::set_port_value(ProcessContext& context, - PortImpl* port, - Type type, - int16_t value) +ControlBindings::set_port_value(RunContext& context, + PortImpl* port, + Type type, + int16_t value) { float min, max; get_range(context, port, &min, &max); @@ -327,7 +327,7 @@ ControlBindings::set_port_value(ProcessContext& context, } bool -ControlBindings::bind(ProcessContext& context, Key key) +ControlBindings::bind(RunContext& context, Key key) { const Ingen::URIs& uris = context.engine().world()->uris(); assert(_learn_port); @@ -397,7 +397,7 @@ ControlBindings::remove(PortImpl* port) } void -ControlBindings::pre_process(ProcessContext& context, Buffer* buffer) +ControlBindings::pre_process(RunContext& context, Buffer* buffer) { uint16_t value = 0; SPtr<Bindings> bindings = _bindings; @@ -429,7 +429,7 @@ ControlBindings::pre_process(ProcessContext& context, Buffer* buffer) } void -ControlBindings::post_process(ProcessContext& context, Buffer* buffer) +ControlBindings::post_process(RunContext& context, Buffer* buffer) { // TODO: merge buffer's existing contents (anything send to it in the graph) buffer->copy(context, _feedback.get()); diff --git a/src/server/ControlBindings.hpp b/src/server/ControlBindings.hpp index 9f06c139..7ff4b3dc 100644 --- a/src/server/ControlBindings.hpp +++ b/src/server/ControlBindings.hpp @@ -31,7 +31,7 @@ namespace Ingen { namespace Server { class Engine; -class ProcessContext; +class RunContext; class PortImpl; class ControlBindings { @@ -66,17 +66,17 @@ public: void learn(PortImpl* port); - void port_binding_changed(ProcessContext& context, - PortImpl* port, + void port_binding_changed(RunContext& context, + PortImpl* port, const Atom& binding); - void port_value_changed(ProcessContext& context, - PortImpl* port, - Key key, + void port_value_changed(RunContext& context, + PortImpl* port, + Key key, const Atom& value); - void pre_process(ProcessContext& context, Buffer* control_in); - void post_process(ProcessContext& context, Buffer* control_out); + void pre_process(RunContext& context, Buffer* control_in); + void post_process(RunContext& context, Buffer* control_out); /** Remove all bindings for `path` or children of `path`. * The caller must safely drop the returned reference in the @@ -93,19 +93,19 @@ public: private: Key midi_event_key(uint16_t size, const uint8_t* buf, uint16_t& value); - void set_port_value(ProcessContext& context, + void set_port_value(RunContext& context, PortImpl* port, Type type, int16_t value); - bool bind(ProcessContext& context, Key key); + bool bind(RunContext& context, Key key); - Atom control_to_port_value(ProcessContext& context, + Atom control_to_port_value(RunContext& context, const PortImpl* port, Type type, int16_t value) const; - int16_t port_value_to_control(ProcessContext& context, + int16_t port_value_to_control(RunContext& context, PortImpl* port, Type type, const Atom& value) const; diff --git a/src/server/DirectDriver.hpp b/src/server/DirectDriver.hpp index 51f40f99..a8c7c803 100644 --- a/src/server/DirectDriver.hpp +++ b/src/server/DirectDriver.hpp @@ -55,11 +55,11 @@ public: return NULL; } - virtual void add_port(ProcessContext& context, EnginePort* port) { + virtual void add_port(RunContext& context, EnginePort* port) { _ports.push_back(*port); } - virtual void remove_port(ProcessContext& context, EnginePort* port) { + virtual void remove_port(RunContext& context, EnginePort* port) { _ports.erase(_ports.iterator_to(*port)); } @@ -81,7 +81,7 @@ public: virtual SampleCount frame_time() const { return 0; } - virtual void append_time_events(ProcessContext& context, + virtual void append_time_events(RunContext& context, Buffer& buffer) {} private: diff --git a/src/server/Driver.hpp b/src/server/Driver.hpp index 4255f652..9f261494 100644 --- a/src/server/Driver.hpp +++ b/src/server/Driver.hpp @@ -56,7 +56,7 @@ public: virtual EnginePort* get_port(const Raul::Path& path) = 0; /** Add a system visible port (e.g. a port on the root graph). */ - virtual void add_port(ProcessContext& context, EnginePort* port) = 0; + virtual void add_port(RunContext& context, EnginePort* port) = 0; /** Remove a system visible port. * @@ -64,7 +64,7 @@ public: * destroy the port. To actually remove the system port, unregister_port() * must be called later in another thread. */ - virtual void remove_port(ProcessContext& context, EnginePort* port) = 0; + virtual void remove_port(RunContext& context, EnginePort* port) = 0; /** Register a system visible port. */ virtual void register_port(EnginePort& port) = 0; @@ -94,7 +94,7 @@ public: virtual SampleCount frame_time() const = 0; /** Append time events for this cycle to `buffer`. */ - virtual void append_time_events(ProcessContext& context, + virtual void append_time_events(RunContext& context, Buffer& buffer) = 0; }; diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp index f116ae09..7e0e3cce 100644 --- a/src/server/DuplexPort.cpp +++ b/src/server/DuplexPort.cpp @@ -153,7 +153,7 @@ DuplexPort::set_driver_buffer(void* buf, uint32_t capacity) } uint32_t -DuplexPort::max_tail_poly(Context& context) const +DuplexPort::max_tail_poly(RunContext& context) const { return std::max(_poly, parent_graph()->internal_poly_process()); } @@ -170,7 +170,7 @@ DuplexPort::prepare_poly(BufferFactory& bufs, uint32_t poly) } bool -DuplexPort::apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly) +DuplexPort::apply_poly(RunContext& context, Raul::Maid& maid, uint32_t poly) { if (!parent()->parent() || poly != parent()->parent_graph()->internal_poly()) { @@ -181,7 +181,7 @@ DuplexPort::apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly) } void -DuplexPort::pre_process(Context& context) +DuplexPort::pre_process(RunContext& context) { if (_is_output) { /* This is a graph output, which is an input from the internal @@ -200,7 +200,7 @@ DuplexPort::pre_process(Context& context) } void -DuplexPort::post_process(Context& context) +DuplexPort::post_process(RunContext& context) { if (_is_output) { /* This is a graph output, which is an input from the internal diff --git a/src/server/DuplexPort.hpp b/src/server/DuplexPort.hpp index 36e37b0b..836faa36 100644 --- a/src/server/DuplexPort.hpp +++ b/src/server/DuplexPort.hpp @@ -65,11 +65,11 @@ public: void on_property(const Raul::URI& uri, const Atom& value); - uint32_t max_tail_poly(Context& context) const; + uint32_t max_tail_poly(RunContext& context) const; bool prepare_poly(BufferFactory& bufs, uint32_t poly); - bool apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly); + bool apply_poly(RunContext& context, Raul::Maid& maid, uint32_t poly); bool get_buffers(BufferFactory& bufs, Raul::Array<Voice>* voices, @@ -86,8 +86,8 @@ public: */ void set_driver_buffer(void* buf, uint32_t capacity); - void pre_process(Context& context); - void post_process(Context& context); + void pre_process(RunContext& context); + void post_process(RunContext& context); SampleCount next_value_offset(SampleCount offset, SampleCount end) const; void update_values(SampleCount offset, uint32_t voice); diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index ee56be3c..8fa4d2f5 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -46,7 +46,7 @@ #include "LV2Options.hpp" #include "PostProcessor.hpp" #include "PreProcessor.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "ThreadManager.hpp" #include "UndoStack.hpp" #include "Worker.hpp" @@ -80,7 +80,7 @@ Engine::Engine(Ingen::World* world) , _worker(new Worker(world->log(), event_queue_size())) , _sync_worker(new Worker(world->log(), event_queue_size(), true)) , _listener(NULL) - , _process_context(*this) + , _run_context(*this) , _rand_engine(0) , _uniform_dist(0.0f, 1.0f) , _quit_flag(false) @@ -115,11 +115,11 @@ Engine::~Engine() // Process all pending events const FrameTime end = std::numeric_limits<FrameTime>::max(); - _process_context.locate(_process_context.end(), end - _process_context.end()); + _run_context.locate(_run_context.end(), end - _run_context.end()); _post_processor->set_end_time(end); _post_processor->process(); while (!_pre_processor->empty()) { - _pre_processor->process(_process_context, *_post_processor, 1); + _pre_processor->process(_run_context, *_post_processor, 1); _post_processor->process(); } @@ -203,7 +203,7 @@ Engine::event_time() } const SampleCount start = _direct_driver - ? _process_context.start() + ? _run_context.start() : _driver->frame_time(); /* Exactly one cycle latency (some could run ASAP if we get lucky, but not @@ -250,7 +250,7 @@ Engine::activate() *this, SPtr<Interface>(), -1, 0, Raul::Path("/"), graph_properties); // Execute in "fake" process context (we are single threaded) - ProcessContext context(*this); + RunContext context(*this); ev.pre_process(); ev.execute(context); ev.post_process(); @@ -283,13 +283,13 @@ Engine::deactivate() unsigned Engine::run(uint32_t sample_count) { - _process_context.locate(_process_context.end(), sample_count); + _run_context.locate(_run_context.end(), sample_count); // Apply control bindings to input control_bindings()->pre_process( - _process_context, _root_graph->port_impl(0)->buffer(0).get()); + _run_context, _root_graph->port_impl(0)->buffer(0).get()); - post_processor()->set_end_time(_process_context.end()); + post_processor()->set_end_time(_run_context.end()); // Process events that came in during the last cycle // (Aiming for jitter-free 1 block event latency, ideally) @@ -297,11 +297,11 @@ Engine::run(uint32_t sample_count) // Run root graph if (_root_graph) { - _root_graph->process(_process_context); + _root_graph->process(_run_context); // Emit control binding feedback control_bindings()->post_process( - _process_context, _root_graph->port_impl(1)->buffer(0).get()); + _run_context, _root_graph->port_impl(1)->buffer(0).get()); } return n_processed_events; @@ -322,9 +322,9 @@ Engine::enqueue_event(Event* ev, Event::Mode mode) unsigned Engine::process_events() { - const size_t MAX_EVENTS_PER_CYCLE = _process_context.nframes() / 8; + const size_t MAX_EVENTS_PER_CYCLE = _run_context.nframes() / 8; return _pre_processor->process( - _process_context, *_post_processor, MAX_EVENTS_PER_CYCLE); + _run_context, *_post_processor, MAX_EVENTS_PER_CYCLE); } void diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index 37c3c713..82cbcdfb 100644 --- a/src/server/Engine.hpp +++ b/src/server/Engine.hpp @@ -27,7 +27,7 @@ #include "ingen/types.hpp" #include "Event.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" namespace Raul { class Maid; } @@ -49,7 +49,7 @@ class GraphImpl; class LV2Options; class PostProcessor; class PreProcessor; -class ProcessContext; +class RunContext; class SocketListener; class UndoStack; class Worker; @@ -96,10 +96,6 @@ public: /** Process events (process thread only). */ unsigned process_events(); - bool is_process_context(const Context& context) const { - return &context == &_process_context; - } - Ingen::World* world() const { return _world; } EventWriter* interface() const { return _event_writer; } @@ -118,7 +114,7 @@ public: Worker* worker() const { return _worker; } Worker* sync_worker() const { return _sync_worker; } - ProcessContext& process_context() { return _process_context; } + RunContext& run_context() { return _run_context; } SPtr<Store> store() const; @@ -145,7 +141,7 @@ private: Worker* _sync_worker; SocketListener* _listener; - ProcessContext _process_context; + RunContext _run_context; std::mt19937 _rand_engine; std::uniform_real_distribution<float> _uniform_dist; diff --git a/src/server/Event.hpp b/src/server/Event.hpp index 15ce386b..3cec155e 100644 --- a/src/server/Event.hpp +++ b/src/server/Event.hpp @@ -34,7 +34,7 @@ namespace Ingen { namespace Server { class Engine; -class ProcessContext; +class RunContext; /** An event (command) to perform some action on Ingen. * @@ -60,7 +60,7 @@ public: virtual bool pre_process() = 0; /** Execute this event in the audio thread (realtime). */ - virtual void execute(ProcessContext& context) = 0; + virtual void execute(RunContext& context) = 0; /** Post-process event after execution (non-realtime). */ virtual void post_process() = 0; diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp index ef7f6a22..86966b7c 100644 --- a/src/server/GraphImpl.cpp +++ b/src/server/GraphImpl.cpp @@ -153,7 +153,7 @@ GraphImpl::deactivate() } void -GraphImpl::disable(ProcessContext& context) +GraphImpl::disable(RunContext& context) { _process = false; for (auto& o : _outputs) { @@ -177,10 +177,10 @@ GraphImpl::prepare_internal_poly(BufferFactory& bufs, uint32_t poly) } bool -GraphImpl::apply_internal_poly(ProcessContext& context, - BufferFactory& bufs, - Raul::Maid& maid, - uint32_t poly) +GraphImpl::apply_internal_poly(RunContext& context, + BufferFactory& bufs, + Raul::Maid& maid, + uint32_t poly) { // TODO: Subgraph dynamic polyphony (i.e. changing port polyphony) @@ -206,7 +206,7 @@ GraphImpl::apply_internal_poly(ProcessContext& context, } void -GraphImpl::pre_process(ProcessContext& context) +GraphImpl::pre_process(RunContext& context) { // Mix down input ports and connect buffers for (uint32_t i = 0; i < num_ports(); ++i) { @@ -220,7 +220,7 @@ GraphImpl::pre_process(ProcessContext& context) } void -GraphImpl::process(ProcessContext& context) +GraphImpl::process(RunContext& context) { if (!_process) return; @@ -231,7 +231,7 @@ GraphImpl::process(ProcessContext& context) } void -GraphImpl::run(ProcessContext& context) +GraphImpl::run(RunContext& context) { if (_compiled_graph && _compiled_graph->size() > 0) { // Run all blocks @@ -242,7 +242,7 @@ GraphImpl::run(ProcessContext& context) } void -GraphImpl::set_buffer_size(Context& context, +GraphImpl::set_buffer_size(RunContext& context, BufferFactory& bufs, LV2_URID type, uint32_t size) diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp index bedf902c..7352da39 100644 --- a/src/server/GraphImpl.hpp +++ b/src/server/GraphImpl.hpp @@ -34,9 +34,8 @@ namespace Server { class ArcImpl; class CompiledGraph; -class Context; class Engine; -class ProcessContext; +class RunContext; /** A group of blocks in a graph, possibly polyphonic. * @@ -67,11 +66,11 @@ public: void activate(BufferFactory& bufs); void deactivate(); - void pre_process(ProcessContext& context); - void process(ProcessContext& context); - void run(ProcessContext& context); + void pre_process(RunContext& context); + void process(RunContext& context); + void run(RunContext& context); - void set_buffer_size(Context& context, + void set_buffer_size(RunContext& context, BufferFactory& bufs, LV2_URID type, uint32_t size); @@ -92,10 +91,10 @@ public: * \param poly Must be < the most recent value passed to prepare_internal_poly. * \param maid Any objects no longer needed will be pushed to this */ - bool apply_internal_poly(ProcessContext& context, - BufferFactory& bufs, - Raul::Maid& maid, - uint32_t poly); + bool apply_internal_poly(RunContext& context, + BufferFactory& bufs, + Raul::Maid& maid, + uint32_t poly); // Graph specific stuff not inherited from Block @@ -181,7 +180,7 @@ public: /** Whether to run this graph's DSP bits in the audio thread */ bool enabled() const { return _process; } void enable() { _process = true; } - void disable(ProcessContext& context); + void disable(RunContext& context); uint32_t internal_poly() const { return _poly_pre; } uint32_t internal_poly_process() const { return _poly_process; } diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index abaf5b62..8ee0f56a 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -28,7 +28,7 @@ #include "GraphImpl.hpp" #include "InputPort.hpp" #include "OutputPort.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "mix.hpp" using namespace std; @@ -56,7 +56,7 @@ InputPort::InputPort(BufferFactory& bufs, } bool -InputPort::apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly) +InputPort::apply_poly(RunContext& context, Raul::Maid& maid, uint32_t poly) { bool ret = PortImpl::apply_poly(context, maid, poly); if (!ret) @@ -109,13 +109,13 @@ InputPort::get_buffers(BufferFactory& bufs, } void -InputPort::add_arc(ProcessContext& context, ArcImpl* c) +InputPort::add_arc(RunContext& context, ArcImpl* c) { _arcs.push_front(*c); } ArcImpl* -InputPort::remove_arc(ProcessContext& context, const OutputPort* tail) +InputPort::remove_arc(RunContext& context, const OutputPort* tail) { ArcImpl* arc = NULL; for (Arcs::iterator i = _arcs.begin(); i != _arcs.end(); ++i) { @@ -135,13 +135,13 @@ InputPort::remove_arc(ProcessContext& context, const OutputPort* tail) } uint32_t -InputPort::max_tail_poly(Context& context) const +InputPort::max_tail_poly(RunContext& context) const { return parent_block()->parent_graph()->internal_poly_process(); } void -InputPort::pre_process(Context& context) +InputPort::pre_process(RunContext& context) { if (_set_by_user) { // Value has been set (e.g. events pushed) by the user, don't smash it @@ -167,7 +167,7 @@ InputPort::pre_process(Context& context) } void -InputPort::pre_run(Context& context) +InputPort::pre_run(RunContext& context) { if (!_set_by_user && !_arcs.empty() && !direct_connect()) { const uint32_t src_poly = max_tail_poly(context); @@ -220,7 +220,7 @@ InputPort::update_values(SampleCount offset, uint32_t voice) } void -InputPort::post_process(Context& context) +InputPort::post_process(RunContext& context) { if (!_arcs.empty() || _force_monitor_update) { monitor(context, _force_monitor_update); diff --git a/src/server/InputPort.hpp b/src/server/InputPort.hpp index 7394c19a..304185cc 100644 --- a/src/server/InputPort.hpp +++ b/src/server/InputPort.hpp @@ -31,10 +31,9 @@ namespace Ingen { namespace Server { class ArcImpl; -class Context; class BlockImpl; class OutputPort; -class ProcessContext; +class RunContext; /** An input port on a Block or Graph. * @@ -67,9 +66,9 @@ public: > Arcs; /** Return the maximum polyphony of an output connected to this input. */ - virtual uint32_t max_tail_poly(Context& context) const; + virtual uint32_t max_tail_poly(RunContext& context) const; - bool apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly); + bool apply_poly(RunContext& context, Raul::Maid& maid, uint32_t poly); /** Add an arc. Realtime safe. * @@ -78,13 +77,13 @@ public: * * setup_buffers() must be called later for the change to take effect. */ - void add_arc(ProcessContext& context, ArcImpl* c); + void add_arc(RunContext& context, ArcImpl* c); /** Remove an arc. Realtime safe. * * setup_buffers() must be called later for the change to take effect. */ - ArcImpl* remove_arc(ProcessContext& context, + ArcImpl* remove_arc(RunContext& context, const OutputPort* tail); /** Set `voices` as the buffers to be used for this port. @@ -97,13 +96,13 @@ public: bool real_time) const; /** Set up buffer pointers. */ - void pre_process(Context& context); + void pre_process(RunContext& context); /** Prepare buffer for access, mixing if necessary. */ - void pre_run(Context& context); + void pre_run(RunContext& context); /** Prepare buffer for next process cycle. */ - void post_process(Context& context); + void post_process(RunContext& context); SampleCount next_value_offset(SampleCount offset, SampleCount end) const; void update_values(SampleCount offset, uint32_t voice); diff --git a/src/server/InternalBlock.cpp b/src/server/InternalBlock.cpp index 308cb640..ef9af87e 100644 --- a/src/server/InternalBlock.cpp +++ b/src/server/InternalBlock.cpp @@ -31,7 +31,7 @@ InternalBlock::InternalBlock(PluginImpl* plugin, void -InternalBlock::pre_process(ProcessContext& context) +InternalBlock::pre_process(RunContext& context) { for (uint32_t i = 0; i < num_ports(); ++i) { PortImpl* const port = _ports->at(i); diff --git a/src/server/InternalBlock.hpp b/src/server/InternalBlock.hpp index c88e87d1..6ba25311 100644 --- a/src/server/InternalBlock.hpp +++ b/src/server/InternalBlock.hpp @@ -35,7 +35,7 @@ public: GraphImpl* parent, SampleRate rate); - virtual void pre_process(ProcessContext& context); + virtual void pre_process(RunContext& context); }; } // namespace Server diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 531fb93e..13f05ed5 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -209,7 +209,7 @@ JackDriver::get_port(const Raul::Path& path) } void -JackDriver::add_port(ProcessContext& context, EnginePort* port) +JackDriver::add_port(RunContext& context, EnginePort* port) { _ports.push_back(*port); @@ -223,7 +223,7 @@ JackDriver::add_port(ProcessContext& context, EnginePort* port) } void -JackDriver::remove_port(ProcessContext& context, EnginePort* port) +JackDriver::remove_port(RunContext& context, EnginePort* port) { _ports.erase(_ports.iterator_to(*port)); } @@ -336,7 +336,7 @@ JackDriver::create_port(DuplexPort* graph_port) } void -JackDriver::pre_process_port(ProcessContext& context, EnginePort* port) +JackDriver::pre_process_port(RunContext& context, EnginePort* port) { const URIs& uris = context.engine().world()->uris(); const SampleCount nframes = context.nframes(); @@ -371,7 +371,7 @@ JackDriver::pre_process_port(ProcessContext& context, EnginePort* port) } void -JackDriver::post_process_port(ProcessContext& context, EnginePort* port) +JackDriver::post_process_port(RunContext& context, EnginePort* port) { const URIs& uris = context.engine().world()->uris(); const SampleCount nframes = context.nframes(); @@ -409,7 +409,7 @@ JackDriver::post_process_port(ProcessContext& context, EnginePort* port) } void -JackDriver::append_time_events(ProcessContext& context, +JackDriver::append_time_events(RunContext& context, Buffer& buffer) { const URIs& uris = context.engine().world()->uris(); @@ -479,18 +479,18 @@ JackDriver::_process_cb(jack_nframes_t nframes) _transport_state = jack_transport_query(_client, &_position); - _engine.process_context().locate(start_of_current_cycle, nframes); + _engine.run_context().locate(start_of_current_cycle, nframes); // Read input for (auto& p : _ports) { - pre_process_port(_engine.process_context(), &p); + pre_process_port(_engine.run_context(), &p); } _engine.run(nframes); // Write output for (auto& p : _ports) { - post_process_port(_engine.process_context(), &p); + post_process_port(_engine.run_context(), &p); } // Update expected transport frame for next cycle to detect changes @@ -523,10 +523,10 @@ JackDriver::_block_length_cb(jack_nframes_t nframes) _block_length = nframes; _seq_size = jack_port_type_get_buffer_size(_client, JACK_DEFAULT_MIDI_TYPE); _engine.root_graph()->set_buffer_size( - _engine.process_context(), *_engine.buffer_factory(), PortType::AUDIO, + _engine.run_context(), *_engine.buffer_factory(), PortType::AUDIO, _engine.buffer_factory()->audio_buffer_size(nframes)); _engine.root_graph()->set_buffer_size( - _engine.process_context(), *_engine.buffer_factory(), PortType::ATOM, + _engine.run_context(), *_engine.buffer_factory(), PortType::ATOM, _seq_size); } return 0; diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp index bf424623..a5422f6a 100644 --- a/src/server/JackDriver.hpp +++ b/src/server/JackDriver.hpp @@ -74,8 +74,8 @@ public: void rename_port(const Raul::Path& old_path, const Raul::Path& new_path); void port_property(const Raul::Path& path, const Raul::URI& uri, const Atom& value); - void add_port(ProcessContext& context, EnginePort* port); - void remove_port(ProcessContext& context, EnginePort* port); + void add_port(RunContext& context, EnginePort* port); + void remove_port(RunContext& context, EnginePort* port); void register_port(EnginePort& port); void unregister_port(EnginePort& port); @@ -84,7 +84,7 @@ public: inline const jack_position_t* position() { return &_position; } inline jack_transport_state_t transport_state() { return _transport_state; } - void append_time_events(ProcessContext& context, + void append_time_events(RunContext& context, Buffer& buffer); jack_client_t* jack_client() const { return _client; } @@ -118,8 +118,8 @@ private: } #endif - void pre_process_port(ProcessContext& context, EnginePort* port); - void post_process_port(ProcessContext& context, EnginePort* port); + void pre_process_port(RunContext& context, EnginePort* port); + void post_process_port(RunContext& context, EnginePort* port); void port_property_internal(const jack_port_t* jport, const Raul::URI& uri, diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp index de91699b..7dcfb362 100644 --- a/src/server/LV2Block.cpp +++ b/src/server/LV2Block.cpp @@ -43,7 +43,7 @@ #include "LV2Block.hpp" #include "LV2Plugin.hpp" #include "OutputPort.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "Worker.hpp" using namespace std; @@ -205,7 +205,7 @@ LV2Block::prepare_poly(BufferFactory& bufs, uint32_t poly) } bool -LV2Block::apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly) +LV2Block::apply_poly(RunContext& context, Raul::Maid& maid, uint32_t poly) { if (!_polyphonic) poly = 1; @@ -545,14 +545,14 @@ LV2Block::work(uint32_t size, const void* data) } void -LV2Block::run(ProcessContext& context) +LV2Block::run(RunContext& context) { for (uint32_t i = 0; i < _polyphony; ++i) lilv_instance_run(instance(i), context.nframes()); } void -LV2Block::post_process(ProcessContext& context) +LV2Block::post_process(RunContext& context) { BlockImpl::post_process(context); diff --git a/src/server/LV2Block.hpp b/src/server/LV2Block.hpp index 6e78ad83..b8438d9e 100644 --- a/src/server/LV2Block.hpp +++ b/src/server/LV2Block.hpp @@ -57,15 +57,15 @@ public: GraphImpl* parent); bool prepare_poly(BufferFactory& bufs, uint32_t poly); - bool apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly); + bool apply_poly(RunContext& context, Raul::Maid& maid, uint32_t poly); void activate(BufferFactory& bufs); void deactivate(); LV2_Worker_Status work(uint32_t size, const void* data); - void run(ProcessContext& context); - void post_process(ProcessContext& context); + void run(RunContext& context); + void post_process(RunContext& context); LilvState* load_preset(const Raul::URI& uri); diff --git a/src/server/NodeImpl.hpp b/src/server/NodeImpl.hpp index 3d87b2f2..dc85a757 100644 --- a/src/server/NodeImpl.hpp +++ b/src/server/NodeImpl.hpp @@ -35,9 +35,8 @@ namespace Shared { class URIs; } namespace Server { class BufferFactory; -class Context; class GraphImpl; -class ProcessContext; +class RunContext; /** An object on the audio graph (a Graph, Block, or Port). * @@ -88,7 +87,7 @@ public: * \param maid Any objects no longer needed will be pushed to this */ virtual bool apply_poly( - ProcessContext& context, Raul::Maid& maid, uint32_t poly) = 0; + RunContext& context, Raul::Maid& maid, uint32_t poly) = 0; protected: NodeImpl(const Ingen::URIs& uris, diff --git a/src/server/OutputPort.cpp b/src/server/OutputPort.cpp index 70acfd63..4121c6a9 100644 --- a/src/server/OutputPort.cpp +++ b/src/server/OutputPort.cpp @@ -59,7 +59,7 @@ OutputPort::get_buffers(BufferFactory& bufs, } void -OutputPort::pre_process(Context& context) +OutputPort::pre_process(RunContext& context) { for (uint32_t v = 0; v < _poly; ++v) _voices->at(v).buffer->prepare_output_write(context); @@ -85,7 +85,7 @@ OutputPort::update_values(SampleCount offset, uint32_t voice) } void -OutputPort::post_process(Context& context) +OutputPort::post_process(RunContext& context) { for (uint32_t v = 0; v < _poly; ++v) { update_set_state(context, v); diff --git a/src/server/OutputPort.hpp b/src/server/OutputPort.hpp index b76d6d88..68c79768 100644 --- a/src/server/OutputPort.hpp +++ b/src/server/OutputPort.hpp @@ -51,8 +51,8 @@ public: uint32_t poly, bool real_time) const; - void pre_process(Context& context); - void post_process(Context& context); + void pre_process(RunContext& context); + void post_process(RunContext& context); SampleCount next_value_offset(SampleCount offset, SampleCount end) const; void update_values(SampleCount offset, uint32_t voice); diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index 87edd1f5..26fdd6cb 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -179,7 +179,7 @@ PortImpl::deactivate() } Raul::Array<PortImpl::Voice>* -PortImpl::set_voices(ProcessContext& context, Raul::Array<Voice>* voices) +PortImpl::set_voices(RunContext& context, Raul::Array<Voice>* voices) { Raul::Array<Voice>* ret = NULL; if (voices != _voices) { @@ -204,9 +204,9 @@ PortImpl::cache_properties() } void -PortImpl::set_control_value(const Context& context, - FrameTime time, - Sample value) +PortImpl::set_control_value(const RunContext& context, + FrameTime time, + Sample value) { for (uint32_t v = 0; v < _poly; ++v) { set_voice_value(context, v, time, value); @@ -214,10 +214,10 @@ PortImpl::set_control_value(const Context& context, } void -PortImpl::set_voice_value(const Context& context, - uint32_t voice, - FrameTime time, - Sample value) +PortImpl::set_voice_value(const RunContext& context, + uint32_t voice, + FrameTime time, + Sample value) { switch (_type.id()) { case PortType::CONTROL: @@ -262,7 +262,7 @@ PortImpl::set_voice_value(const Context& context, } void -PortImpl::update_set_state(Context& context, uint32_t v) +PortImpl::update_set_state(RunContext& context, uint32_t v) { Voice& voice = _voices->at(v); SetState& state = voice.set_state; @@ -327,7 +327,7 @@ PortImpl::prepare_poly(BufferFactory& bufs, uint32_t poly) } bool -PortImpl::apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly) +PortImpl::apply_poly(RunContext& context, Raul::Maid& maid, uint32_t poly) { if (_parent->path().is_root() || (_type == PortType::ATOM && !_value.is_valid())) { @@ -359,7 +359,7 @@ PortImpl::apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly) } void -PortImpl::set_buffer_size(Context& context, BufferFactory& bufs, size_t size) +PortImpl::set_buffer_size(RunContext& context, BufferFactory& bufs, size_t size) { _buffer_size = size; @@ -413,7 +413,7 @@ PortImpl::clear_buffers() } void -PortImpl::monitor(Context& context, bool send_now) +PortImpl::monitor(RunContext& context, bool send_now) { if (!context.must_notify(this)) { return; diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp index d16ec10f..41666523 100644 --- a/src/server/PortImpl.hpp +++ b/src/server/PortImpl.hpp @@ -25,7 +25,7 @@ #include "BufferRef.hpp" #include "NodeImpl.hpp" #include "PortType.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "types.hpp" namespace Raul { class Maid; } @@ -60,7 +60,7 @@ public: SetState() : state(State::SET), value(0), time(0) {} - void set(const Context& context, FrameTime t, Sample v) { + void set(const RunContext& context, FrameTime t, Sample v) { time = t; value = v; state = (time == context.start() @@ -92,7 +92,7 @@ public: * Audio thread. Returned value must be freed by caller. * \a buffers must be poly() long */ - Raul::Array<Voice>* set_voices(ProcessContext& context, + Raul::Array<Voice>* set_voices(RunContext& context, Raul::Array<Voice>* voices); /** Prepare for a new (external) polyphony value. @@ -107,7 +107,7 @@ public: * \a poly Must be < the most recent value passed to prepare_poly. */ virtual bool apply_poly( - ProcessContext& context, Raul::Maid& maid, uint32_t poly); + RunContext& context, Raul::Maid& maid, uint32_t poly); const Atom& value() const { return _value; } void set_value(const Atom& v) { _value = v; } @@ -129,16 +129,16 @@ public: return _prepared_voices->at(voice).buffer; } - void update_set_state(Context& context, uint32_t voice); + void update_set_state(RunContext& context, uint32_t voice); - void set_voice_value(const Context& context, - uint32_t voice, - FrameTime time, - Sample value); + void set_voice_value(const RunContext& context, + uint32_t voice, + FrameTime time, + Sample value); - void set_control_value(const Context& context, - FrameTime time, - Sample value); + void set_control_value(const RunContext& context, + FrameTime time, + Sample value); /** Prepare this port to use an external driver-provided buffer. * @@ -153,9 +153,9 @@ public: bool is_driver_port() const { return _is_driver_port; } /** Called once per process cycle */ - virtual void pre_process(Context& context) = 0; - virtual void pre_run(Context& context) {} - virtual void post_process(Context& context) = 0; + virtual void pre_process(RunContext& context) = 0; + virtual void pre_run(RunContext& context) {} + virtual void post_process(RunContext& context) = 0; /** Empty buffer contents completely (ie silence) */ virtual void clear_buffers(); @@ -209,7 +209,7 @@ public: return (_prepared_voices) ? _prepared_voices->size() : 1; } - void set_buffer_size(Context& context, BufferFactory& bufs, size_t size); + void set_buffer_size(RunContext& context, BufferFactory& bufs, size_t size); /** Return true iff this port is explicitly monitored. * @@ -223,7 +223,7 @@ public: void enable_monitoring(bool monitored) { _monitored = monitored; } /** Monitor port value and broadcast to clients periodically. */ - void monitor(Context& context, bool send_now=false); + void monitor(RunContext& context, bool send_now=false); void raise_set_by_user_flag() { _set_by_user = true; } diff --git a/src/server/PostProcessor.cpp b/src/server/PostProcessor.cpp index a0cb060b..d6016105 100644 --- a/src/server/PostProcessor.cpp +++ b/src/server/PostProcessor.cpp @@ -19,7 +19,7 @@ #include "Engine.hpp" #include "Event.hpp" #include "PostProcessor.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" using namespace std; @@ -31,7 +31,7 @@ public: Sentinel(Engine& engine) : Event(engine) {} bool pre_process() { return false; } - void execute(ProcessContext& context) {} + void execute(RunContext& context) {} void post_process() {} }; @@ -56,7 +56,7 @@ PostProcessor::~PostProcessor() } void -PostProcessor::append(ProcessContext& context, Event* first, Event* last) +PostProcessor::append(RunContext& context, Event* first, Event* last) { assert(first); assert(last); @@ -70,7 +70,7 @@ PostProcessor::append(ProcessContext& context, Event* first, Event* last) bool PostProcessor::pending() const { - return _head.load() || _engine.process_context().pending_notifications(); + return _head.load() || _engine.run_context().pending_notifications(); } void @@ -85,7 +85,7 @@ PostProcessor::process() Event* next = ev->next(); if (!next || next->time() >= end_time) { // Process audio thread notifications until end - _engine.process_context().emit_notifications(end_time); + _engine.run_context().emit_notifications(end_time); return; } @@ -95,7 +95,7 @@ PostProcessor::process() ev = next; // Process audio thread notifications up until this event's time - _engine.process_context().emit_notifications(ev->time()); + _engine.run_context().emit_notifications(ev->time()); // Post-process event ev->post_process(); @@ -109,7 +109,7 @@ PostProcessor::process() _head = ev; // Process remaining audio thread notifications until end - _engine.process_context().emit_notifications(end_time); + _engine.run_context().emit_notifications(end_time); } } // namespace Server diff --git a/src/server/PostProcessor.hpp b/src/server/PostProcessor.hpp index 6203cc53..5a3ffa62 100644 --- a/src/server/PostProcessor.hpp +++ b/src/server/PostProcessor.hpp @@ -28,7 +28,7 @@ namespace Server { class Engine; class Event; -class ProcessContext; +class RunContext; /** Processor for Events after leaving the audio thread. * @@ -50,7 +50,7 @@ public: /** Push a list of events on to the process queue. realtime-safe, not thread-safe. */ - void append(ProcessContext& context, Event* first, Event* last); + void append(RunContext& context, Event* first, Event* last); /** Post-process and delete all pending events */ void process(); diff --git a/src/server/PreProcessor.cpp b/src/server/PreProcessor.cpp index d57bb6b9..e3e5475f 100644 --- a/src/server/PreProcessor.cpp +++ b/src/server/PreProcessor.cpp @@ -23,7 +23,7 @@ #include "Event.hpp" #include "PostProcessor.hpp" #include "PreProcessor.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "ThreadManager.hpp" #include "UndoStack.hpp" @@ -81,7 +81,7 @@ PreProcessor::event(Event* const ev, Event::Mode mode) } unsigned -PreProcessor::process(ProcessContext& context, PostProcessor& dest, size_t limit) +PreProcessor::process(RunContext& context, PostProcessor& dest, size_t limit) { Event* const head = _head.load(); size_t n_processed = 0; diff --git a/src/server/PreProcessor.hpp b/src/server/PreProcessor.hpp index 9ef75473..f9b85c8f 100644 --- a/src/server/PreProcessor.hpp +++ b/src/server/PreProcessor.hpp @@ -29,7 +29,7 @@ namespace Server { class Engine; class Event; class PostProcessor; -class ProcessContext; +class RunContext; class PreProcessor { @@ -49,7 +49,7 @@ public: /** Process events for a cycle. * @return The number of events processed. */ - unsigned process(ProcessContext& context, + unsigned process(RunContext& context, PostProcessor& dest, size_t limit = 0); diff --git a/src/server/ProcessContext.hpp b/src/server/ProcessContext.hpp deleted file mode 100644 index 3ebd6a5f..00000000 --- a/src/server/ProcessContext.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2015 David Robillard <http://drobilla.net/> - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef INGEN_ENGINE_PROCESSCONTEXT_HPP -#define INGEN_ENGINE_PROCESSCONTEXT_HPP - -#include "Context.hpp" - -namespace Ingen { -namespace Server { - -/** Context of a process() call (the audio context). - * - * Currently this class has no implementation to speak of, but the type is used - * as a parameter for audio context methods to make their context clear. - * - * \ingroup engine - */ -class ProcessContext : public Context -{ -public: - explicit ProcessContext(Engine& engine) : Context(engine, ID::AUDIO) {} - - explicit ProcessContext(const ProcessContext& copy) : Context(copy) {} -}; - -} // namespace Server -} // namespace Ingen - -#endif // INGEN_ENGINE_PROCESSCONTEXT_HPP diff --git a/src/server/Context.cpp b/src/server/RunContext.cpp index 387bed8e..ee1eaf04 100644 --- a/src/server/Context.cpp +++ b/src/server/RunContext.cpp @@ -20,9 +20,9 @@ #include "Broadcaster.hpp" #include "BufferFactory.hpp" -#include "Context.hpp" #include "Engine.hpp" #include "PortImpl.hpp" +#include "RunContext.hpp" namespace Ingen { namespace Server { @@ -44,9 +44,8 @@ struct Notification LV2_URID type; }; -Context::Context(Engine& engine, ID id) +RunContext::RunContext(Engine& engine) : _engine(engine) - , _id(id) , _event_sink( new Raul::RingBuffer(engine.event_queue_size() * sizeof(Notification))) , _start(0) @@ -57,9 +56,8 @@ Context::Context(Engine& engine, ID id) , _copy(false) {} -Context::Context(const Context& copy) +RunContext::RunContext(const RunContext& copy) : _engine(copy._engine) - , _id(copy._id) , _event_sink(copy._event_sink) , _start(copy._start) , _end(copy._end) @@ -69,7 +67,7 @@ Context::Context(const Context& copy) , _copy(true) {} -Context::~Context() +RunContext::~RunContext() { if (!_copy) { delete _event_sink; @@ -77,18 +75,18 @@ Context::~Context() } bool -Context::must_notify(const PortImpl* port) const +RunContext::must_notify(const PortImpl* port) const { return (port->is_monitored() || _engine.broadcaster()->must_broadcast()); } bool -Context::notify(LV2_URID key, - FrameTime time, - PortImpl* port, - uint32_t size, - LV2_URID type, - const void* body) +RunContext::notify(LV2_URID key, + FrameTime time, + PortImpl* port, + uint32_t size, + LV2_URID type, + const void* body) { const Notification n(port, time, key, size, type); if (_event_sink->write_space() < sizeof(n) + size) { @@ -105,7 +103,7 @@ Context::notify(LV2_URID key, } void -Context::emit_notifications(FrameTime end) +RunContext::emit_notifications(FrameTime end) { const URIs& uris = _engine.buffer_factory()->uris(); const uint32_t read_space = _event_sink->read_space(); diff --git a/src/server/Context.hpp b/src/server/RunContext.hpp index 2f1967da..803d7829 100644 --- a/src/server/Context.hpp +++ b/src/server/RunContext.hpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard <http://drobilla.net/> + Copyright 2007-2016 David Robillard <http://drobilla.net/> Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -14,8 +14,8 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef INGEN_ENGINE_CONTEXT_HPP -#define INGEN_ENGINE_CONTEXT_HPP +#ifndef INGEN_ENGINE_RUNCONTEXT_HPP +#define INGEN_ENGINE_RUNCONTEXT_HPP #include "ingen/Atom.hpp" #include "ingen/World.hpp" @@ -41,18 +41,13 @@ class PortImpl; * * \ingroup engine */ -class Context +class RunContext { public: - enum class ID { - AUDIO, - MESSAGE - }; + RunContext(Engine& engine); + RunContext(const RunContext& copy); - Context(Engine& engine, ID id); - Context(const Context& copy); - - virtual ~Context(); + virtual ~RunContext(); /** Return true iff the given port should broadcast its value. * @@ -78,15 +73,13 @@ public: /** Return true iff any notifications are pending. */ bool pending_notifications() const { return _event_sink->read_space(); } - inline ID id() const { return _id; } - inline void locate(FrameTime s, SampleCount nframes) { _start = s; _end = s + nframes; _nframes = nframes; } - inline void locate(const Context& other) { + inline void locate(const RunContext& other) { _start = other._start; _end = other._end; _nframes = other._nframes; @@ -106,10 +99,9 @@ public: inline bool realtime() const { return _realtime; } protected: - const Context& operator=(const Context& copy) = delete; + const RunContext& operator=(const RunContext& copy) = delete; Engine& _engine; ///< Engine we're running in - ID _id; ///< Fast ID for this context Raul::RingBuffer* _event_sink; ///< Port updates from process context @@ -124,4 +116,4 @@ protected: } // namespace Server } // namespace Ingen -#endif // INGEN_ENGINE_CONTEXT_HPP +#endif // INGEN_ENGINE_RUNCONTEXT_HPP diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index 09838978..66f726a6 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -140,7 +140,7 @@ Connect::pre_process() } void -Connect::execute(ProcessContext& context) +Connect::execute(RunContext& context) { if (_status == Status::SUCCESS) { _head->add_arc(context, _arc.get()); diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index bd15d6d3..84b2854b 100644 --- a/src/server/events/Connect.hpp +++ b/src/server/events/Connect.hpp @@ -53,7 +53,7 @@ public: const Raul::Path& head); bool pre_process(); - void execute(ProcessContext& context); + void execute(RunContext& context); void post_process(); void undo(Interface& target); diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp index 34a63e58..0ff53843 100644 --- a/src/server/events/Copy.cpp +++ b/src/server/events/Copy.cpp @@ -194,7 +194,7 @@ Copy::filesystem_to_engine() } void -Copy::execute(ProcessContext& context) +Copy::execute(RunContext& context) { if (_block) { _parent->set_compiled_graph(_compiled_graph); diff --git a/src/server/events/Copy.hpp b/src/server/events/Copy.hpp index a1726cc6..68ee31da 100644 --- a/src/server/events/Copy.hpp +++ b/src/server/events/Copy.hpp @@ -47,7 +47,7 @@ public: const Raul::URI& new_uri); bool pre_process(); - void execute(ProcessContext& context); + void execute(RunContext& context); void post_process(); void undo(Interface& target); diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index cde15622..28afe4b2 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -147,7 +147,7 @@ CreateBlock::pre_process() } void -CreateBlock::execute(ProcessContext& context) +CreateBlock::execute(RunContext& context) { if (_block) { _graph->set_compiled_graph(_compiled_graph); diff --git a/src/server/events/CreateBlock.hpp b/src/server/events/CreateBlock.hpp index 1282fe8b..00205c6a 100644 --- a/src/server/events/CreateBlock.hpp +++ b/src/server/events/CreateBlock.hpp @@ -48,7 +48,7 @@ public: ~CreateBlock(); bool pre_process(); - void execute(ProcessContext& context); + void execute(RunContext& context); void post_process(); void undo(Interface& target); diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index b5cffcb0..ca36f258 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -186,7 +186,7 @@ CreateGraph::pre_process() } void -CreateGraph::execute(ProcessContext& context) +CreateGraph::execute(RunContext& context) { if (_graph) { if (_parent) { diff --git a/src/server/events/CreateGraph.hpp b/src/server/events/CreateGraph.hpp index efeabf48..9cae32ba 100644 --- a/src/server/events/CreateGraph.hpp +++ b/src/server/events/CreateGraph.hpp @@ -45,7 +45,7 @@ public: const Resource::Properties& properties); bool pre_process(); - void execute(ProcessContext& context); + void execute(RunContext& context); void post_process(); void undo(Interface& target); diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 0e512852..9384ce09 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -167,7 +167,7 @@ CreatePort::pre_process() } void -CreatePort::execute(ProcessContext& context) +CreatePort::execute(RunContext& context) { if (_status == Status::SUCCESS) { _old_ports_array = _graph->external_ports(); diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp index 754a238f..c002df59 100644 --- a/src/server/events/CreatePort.hpp +++ b/src/server/events/CreatePort.hpp @@ -52,7 +52,7 @@ public: const Resource::Properties& properties); bool pre_process(); - void execute(ProcessContext& context); + void execute(RunContext& context); void post_process(); void undo(Interface& target); diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index 915c56fc..5ca70a3a 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -116,7 +116,7 @@ Delete::pre_process() } void -Delete::execute(ProcessContext& context) +Delete::execute(RunContext& context) { if (_status != Status::SUCCESS) { return; diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp index c6e38839..5cd40b14 100644 --- a/src/server/events/Delete.hpp +++ b/src/server/events/Delete.hpp @@ -55,7 +55,7 @@ public: ~Delete(); bool pre_process(); - void execute(ProcessContext& context); + void execute(RunContext& context); void post_process(); void undo(Interface& target); diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index e41d6a87..d54ec53f 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -479,7 +479,7 @@ Delta::pre_process() } void -Delta::execute(ProcessContext& context) +Delta::execute(RunContext& context) { if (_status != Status::SUCCESS || _preset) { return; diff --git a/src/server/events/Delta.hpp b/src/server/events/Delta.hpp index b1f2d66a..8b00fd3a 100644 --- a/src/server/events/Delta.hpp +++ b/src/server/events/Delta.hpp @@ -74,7 +74,7 @@ public: uint32_t type); bool pre_process(); - void execute(ProcessContext& context); + void execute(RunContext& context); void post_process(); void undo(Interface& target); diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 43febed5..8d47ac5a 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -29,7 +29,7 @@ #include "InputPort.hpp" #include "OutputPort.hpp" #include "PortImpl.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "ThreadManager.hpp" #include "events/Disconnect.hpp" @@ -173,7 +173,7 @@ Disconnect::pre_process() } bool -Disconnect::Impl::execute(ProcessContext& context, bool set_head_buffers) +Disconnect::Impl::execute(RunContext& context, bool set_head_buffers) { ArcImpl* const port_arc = _head->remove_arc(context, _tail); @@ -200,7 +200,7 @@ Disconnect::Impl::execute(ProcessContext& context, bool set_head_buffers) } void -Disconnect::execute(ProcessContext& context) +Disconnect::execute(RunContext& context) { if (_status == Status::SUCCESS) { if (_impl->execute(context, true)) { diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp index 8a69dac4..69d9469c 100644 --- a/src/server/events/Disconnect.hpp +++ b/src/server/events/Disconnect.hpp @@ -55,7 +55,7 @@ public: ~Disconnect(); bool pre_process(); - void execute(ProcessContext& context); + void execute(RunContext& context); void post_process(); void undo(Interface& target); @@ -66,7 +66,7 @@ public: OutputPort* t, InputPort* h); - bool execute(ProcessContext& context, bool set_head_buffers); + bool execute(RunContext& context, bool set_head_buffers); inline OutputPort* tail() { return _tail; } inline InputPort* head() { return _head; } diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index ee19797e..380aced5 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -143,7 +143,7 @@ DisconnectAll::pre_process() } void -DisconnectAll::execute(ProcessContext& context) +DisconnectAll::execute(RunContext& context) { if (_status == Status::SUCCESS) { for (auto& i : _impls) { diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp index f8123a45..1ddfc536 100644 --- a/src/server/events/DisconnectAll.hpp +++ b/src/server/events/DisconnectAll.hpp @@ -57,7 +57,7 @@ public: ~DisconnectAll(); bool pre_process(); - void execute(ProcessContext& context); + void execute(RunContext& context); void post_process(); void undo(Interface& target); diff --git a/src/server/events/Get.hpp b/src/server/events/Get.hpp index fc5fcb13..f685df21 100644 --- a/src/server/events/Get.hpp +++ b/src/server/events/Get.hpp @@ -48,7 +48,7 @@ public: const Raul::URI& uri); bool pre_process(); - void execute(ProcessContext& context) {} + void execute(RunContext& context) {} void post_process(); private: diff --git a/src/server/events/Mark.cpp b/src/server/events/Mark.cpp index 0e14f008..32648649 100644 --- a/src/server/events/Mark.cpp +++ b/src/server/events/Mark.cpp @@ -51,7 +51,7 @@ Mark::pre_process() } void -Mark::execute(ProcessContext& context) +Mark::execute(RunContext& context) {} void diff --git a/src/server/events/Mark.hpp b/src/server/events/Mark.hpp index 995df746..895a309c 100644 --- a/src/server/events/Mark.hpp +++ b/src/server/events/Mark.hpp @@ -41,7 +41,7 @@ public: Type type); bool pre_process(); - void execute(ProcessContext& context); + void execute(RunContext& context); void post_process(); private: diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index a51617cb..b30c2ec2 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -74,7 +74,7 @@ Move::pre_process() } void -Move::execute(ProcessContext& context) +Move::execute(RunContext& context) { } diff --git a/src/server/events/Move.hpp b/src/server/events/Move.hpp index 74d32c61..ef308a01 100644 --- a/src/server/events/Move.hpp +++ b/src/server/events/Move.hpp @@ -46,7 +46,7 @@ public: ~Move(); bool pre_process(); - void execute(ProcessContext& context); + void execute(RunContext& context); void post_process(); void undo(Interface& target); diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index fd10c94f..0fac88c2 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -26,7 +26,7 @@ #include "Driver.hpp" #include "Engine.hpp" #include "PortImpl.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "SetPortValue.hpp" namespace Ingen { @@ -69,19 +69,15 @@ SetPortValue::pre_process() } void -SetPortValue::execute(ProcessContext& context) +SetPortValue::execute(RunContext& context) { assert(_time >= context.start() && _time <= context.end()); - - if (_port->parent_block()->context() == Context::ID::MESSAGE) - return; - apply(context); _engine.control_bindings()->port_value_changed(context, _port, _binding, _value); } void -SetPortValue::apply(Context& context) +SetPortValue::apply(RunContext& context) { if (_status != Status::SUCCESS) { return; diff --git a/src/server/events/SetPortValue.hpp b/src/server/events/SetPortValue.hpp index 80d0b84a..7b49096f 100644 --- a/src/server/events/SetPortValue.hpp +++ b/src/server/events/SetPortValue.hpp @@ -48,13 +48,13 @@ public: ~SetPortValue(); bool pre_process(); - void execute(ProcessContext& context); + void execute(RunContext& context); void post_process(); bool synthetic() const { return _synthetic; } private: - void apply(Context& context); + void apply(RunContext& context); PortImpl* _port; const Atom _value; diff --git a/src/server/events/Undo.cpp b/src/server/events/Undo.cpp index 28b8e188..06289aa1 100644 --- a/src/server/events/Undo.cpp +++ b/src/server/events/Undo.cpp @@ -62,7 +62,7 @@ Undo::pre_process() } void -Undo::execute(ProcessContext& context) +Undo::execute(RunContext& context) { } diff --git a/src/server/events/Undo.hpp b/src/server/events/Undo.hpp index fff06b8d..c95daea9 100644 --- a/src/server/events/Undo.hpp +++ b/src/server/events/Undo.hpp @@ -39,7 +39,7 @@ public: bool is_redo); bool pre_process(); - void execute(ProcessContext& context); + void execute(RunContext& context); void post_process(); private: diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index dbbc8a55..53d302b1 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -50,7 +50,7 @@ #include "EventWriter.hpp" #include "GraphImpl.hpp" #include "PostProcessor.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "ThreadManager.hpp" #define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" @@ -79,7 +79,7 @@ namespace Server { class LV2Driver; -void signal_main(ProcessContext& context, LV2Driver* driver); +void signal_main(RunContext& context, LV2Driver* driver); inline size_t ui_ring_size(SampleCount block_length) @@ -116,7 +116,7 @@ public: , _to_ui_overflow(false) {} - void pre_process_port(ProcessContext& context, EnginePort* port) { + void pre_process_port(RunContext& context, EnginePort* port) { const URIs& uris = _engine.world()->uris(); const SampleCount nframes = context.nframes(); DuplexPort* graph_port = port->graph_port(); @@ -150,7 +150,7 @@ public: } } - void post_process_port(ProcessContext& context, EnginePort* port) { + void post_process_port(RunContext& context, EnginePort* port) { DuplexPort* graph_port = port->graph_port(); // No copying necessary, host buffers are used directly @@ -161,13 +161,13 @@ public: } void run(uint32_t nframes) { - _engine.process_context().locate(_frame_time, nframes); + _engine.run_context().locate(_frame_time, nframes); // Notify buffer is a Chunk with size set to the available space _notify_capacity = ((LV2_Atom_Sequence*)_ports[1]->buffer())->atom.size; for (auto& p : _ports) { - pre_process_port(_engine.process_context(), p); + pre_process_port(_engine.run_context(), p); } _engine.run(nframes); @@ -175,10 +175,10 @@ public: _main_sem.post(); } - flush_to_ui(_engine.process_context()); + flush_to_ui(_engine.run_context()); for (auto& p : _ports) { - post_process_port(_engine.process_context(), p); + post_process_port(_engine.run_context(), p); } _frame_time += nframes; @@ -203,7 +203,7 @@ public: } /** Add a port. Called only during init or restore. */ - virtual void add_port(ProcessContext& context, EnginePort* port) { + virtual void add_port(RunContext& context, EnginePort* port) { const uint32_t index = port->graph_port()->index(); if (_ports.size() <= index) { _ports.resize(index + 1); @@ -212,7 +212,7 @@ public: } /** Remove a port. Called only during init or restore. */ - virtual void remove_port(ProcessContext& context, EnginePort* port) { + virtual void remove_port(RunContext& context, EnginePort* port) { const uint32_t index = port->graph_port()->index(); _ports[index] = NULL; if (index == _ports.size() - 1) { @@ -240,8 +240,8 @@ public: return new EnginePort(graph_port); } - virtual void append_time_events(ProcessContext& context, - Buffer& buffer) + virtual void append_time_events(RunContext& context, + Buffer& buffer) { const URIs& uris = _engine.world()->uris(); LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)_ports[0]->buffer(); @@ -307,7 +307,7 @@ public: free(buf); } - void flush_to_ui(ProcessContext& context) { + void flush_to_ui(RunContext& context) { if (_ports.size() < 2) { _engine.log().error("Standard control ports are not present\n"); return; @@ -558,7 +558,7 @@ ingen_instantiate(const LV2_Descriptor* descriptor, engine->activate(); Server::ThreadManager::single_threaded = true; - engine->process_context().locate(0, block_length); + engine->run_context().locate(0, block_length); engine->post_processor()->set_end_time(block_length); engine->process_events(); diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index 62400efa..be015af5 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -27,7 +27,7 @@ #include "InternalPlugin.hpp" #include "OutputPort.hpp" #include "PostProcessor.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "util.hpp" using namespace std; @@ -100,7 +100,7 @@ ControllerNode::ControllerNode(InternalPlugin* plugin, } void -ControllerNode::run(ProcessContext& context) +ControllerNode::run(RunContext& context) { Buffer* const midi_in = _midi_in_port->buffer(0).get(); LV2_Atom_Sequence* seq = midi_in->get<LV2_Atom_Sequence>(); @@ -115,7 +115,7 @@ ControllerNode::run(ProcessContext& context) } void -ControllerNode::control(ProcessContext& context, uint8_t control_num, uint8_t val, FrameTime time) +ControllerNode::control(RunContext& context, uint8_t control_num, uint8_t val, FrameTime time) { Sample scaled_value; diff --git a/src/server/internals/Controller.hpp b/src/server/internals/Controller.hpp index 1c3e05f0..31751658 100644 --- a/src/server/internals/Controller.hpp +++ b/src/server/internals/Controller.hpp @@ -45,9 +45,9 @@ public: GraphImpl* parent, SampleRate srate); - void run(ProcessContext& context); + void run(RunContext& context); - void control(ProcessContext& context, uint8_t control_num, uint8_t val, FrameTime time); + void control(RunContext& context, uint8_t control_num, uint8_t val, FrameTime time); void learn() { _learning = true; } diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp index d0413689..6ac97008 100644 --- a/src/server/internals/Delay.cpp +++ b/src/server/internals/Delay.cpp @@ -29,7 +29,7 @@ #include "InputPort.hpp" #include "InternalPlugin.hpp" #include "OutputPort.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "internals/Delay.hpp" #include "util.hpp" @@ -138,7 +138,7 @@ static inline float cube_interp(const float fr, const float inm1, const float } void -DelayNode::run(ProcessContext& context) +DelayNode::run(RunContext& context) { Buffer* const delay_buf = _delay_port->buffer(0).get(); Buffer* const in_buf = _in_port->buffer(0).get(); diff --git a/src/server/internals/Delay.hpp b/src/server/internals/Delay.hpp index 24f2854e..0dc5da30 100644 --- a/src/server/internals/Delay.hpp +++ b/src/server/internals/Delay.hpp @@ -46,7 +46,7 @@ public: void activate(BufferFactory& bufs); - void run(ProcessContext& context); + void run(RunContext& context); static InternalPlugin* internal_plugin(URIs& uris); diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp index c3ebaf71..564ae34c 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -28,7 +28,7 @@ #include "InputPort.hpp" #include "InternalPlugin.hpp" #include "OutputPort.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "ingen_config.h" #include "internals/Note.hpp" #include "util.hpp" @@ -151,7 +151,7 @@ NoteNode::prepare_poly(BufferFactory& bufs, uint32_t poly) } bool -NoteNode::apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly) +NoteNode::apply_poly(RunContext& context, Raul::Maid& maid, uint32_t poly) { if (!BlockImpl::apply_poly(context, maid, poly)) return false; @@ -168,7 +168,7 @@ NoteNode::apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly) } void -NoteNode::run(ProcessContext& context) +NoteNode::run(RunContext& context) { Buffer* const midi_in = _midi_in_port->buffer(0).get(); LV2_Atom_Sequence* seq = midi_in->get<LV2_Atom_Sequence>(); @@ -227,7 +227,7 @@ note_to_freq(uint8_t num) } void -NoteNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity, FrameTime time) +NoteNode::note_on(RunContext& context, uint8_t note_num, uint8_t velocity, FrameTime time) { assert(time >= context.start() && time <= context.end()); assert(note_num <= 127); @@ -306,7 +306,7 @@ NoteNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity, F } void -NoteNode::note_off(ProcessContext& context, uint8_t note_num, FrameTime time) +NoteNode::note_off(RunContext& context, uint8_t note_num, FrameTime time) { assert(time >= context.start() && time <= context.end()); @@ -328,7 +328,7 @@ NoteNode::note_off(ProcessContext& context, uint8_t note_num, FrameTime time) } void -NoteNode::free_voice(ProcessContext& context, uint32_t voice, FrameTime time) +NoteNode::free_voice(RunContext& context, uint32_t voice, FrameTime time) { assert(time >= context.start() && time <= context.end()); @@ -366,7 +366,7 @@ NoteNode::free_voice(ProcessContext& context, uint32_t voice, FrameTime time) } void -NoteNode::all_notes_off(ProcessContext& context, FrameTime time) +NoteNode::all_notes_off(RunContext& context, FrameTime time) { assert(time >= context.start() && time <= context.end()); @@ -379,13 +379,13 @@ NoteNode::all_notes_off(ProcessContext& context, FrameTime time) } void -NoteNode::sustain_on(ProcessContext& context, FrameTime time) +NoteNode::sustain_on(RunContext& context, FrameTime time) { _sustain = true; } void -NoteNode::sustain_off(ProcessContext& context, FrameTime time) +NoteNode::sustain_off(RunContext& context, FrameTime time) { assert(time >= context.start() && time <= context.end()); @@ -397,13 +397,13 @@ NoteNode::sustain_off(ProcessContext& context, FrameTime time) } void -NoteNode::bend(ProcessContext& context, FrameTime time, float amount) +NoteNode::bend(RunContext& context, FrameTime time, float amount) { _bend_port->set_control_value(context, time, amount); } void -NoteNode::note_pressure(ProcessContext& context, FrameTime time, uint8_t note_num, float amount) +NoteNode::note_pressure(RunContext& context, FrameTime time, uint8_t note_num, float amount) { for (uint32_t i=0; i < _polyphony; ++i) { if ((*_voices)[i].state != Voice::State::FREE && (*_voices)[i].note == note_num) { @@ -414,7 +414,7 @@ NoteNode::note_pressure(ProcessContext& context, FrameTime time, uint8_t note_nu } void -NoteNode::channel_pressure(ProcessContext& context, FrameTime time, float amount) +NoteNode::channel_pressure(RunContext& context, FrameTime time, float amount) { _pressure_port->set_control_value(context, time, amount); } diff --git a/src/server/internals/Note.hpp b/src/server/internals/Note.hpp index 6e993f06..08d1b358 100644 --- a/src/server/internals/Note.hpp +++ b/src/server/internals/Note.hpp @@ -48,20 +48,20 @@ public: ~NoteNode(); bool prepare_poly(BufferFactory& bufs, uint32_t poly); - bool apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly); + bool apply_poly(RunContext& context, Raul::Maid& maid, uint32_t poly); - void run(ProcessContext& context); + void run(RunContext& context); - void note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity, FrameTime time); - void note_off(ProcessContext& context, uint8_t note_num, FrameTime time); - void all_notes_off(ProcessContext& context, FrameTime time); + void note_on(RunContext& context, uint8_t note_num, uint8_t velocity, FrameTime time); + void note_off(RunContext& context, uint8_t note_num, FrameTime time); + void all_notes_off(RunContext& context, FrameTime time); - void sustain_on(ProcessContext& context, FrameTime time); - void sustain_off(ProcessContext& context, FrameTime time); + void sustain_on(RunContext& context, FrameTime time); + void sustain_off(RunContext& context, FrameTime time); - void bend(ProcessContext& context, FrameTime time, float amount); - void note_pressure(ProcessContext& context, FrameTime time, uint8_t note_num, float amount); - void channel_pressure(ProcessContext& context, FrameTime time, float amount); + void bend(RunContext& context, FrameTime time, float amount); + void note_pressure(RunContext& context, FrameTime time, uint8_t note_num, float amount); + void channel_pressure(RunContext& context, FrameTime time, float amount); static InternalPlugin* internal_plugin(URIs& uris); @@ -84,7 +84,7 @@ private: SampleCount time; }; - void free_voice(ProcessContext& context, uint32_t voice, FrameTime time); + void free_voice(RunContext& context, uint32_t voice, FrameTime time); Raul::Array<Voice>* _voices; Raul::Array<Voice>* _prepared_voices; diff --git a/src/server/internals/Time.cpp b/src/server/internals/Time.cpp index 13f63538..0f4bdd56 100644 --- a/src/server/internals/Time.cpp +++ b/src/server/internals/Time.cpp @@ -23,7 +23,7 @@ #include "Engine.hpp" #include "InternalPlugin.hpp" #include "OutputPort.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "internals/Time.hpp" #include "util.hpp" @@ -57,7 +57,7 @@ TimeNode::TimeNode(InternalPlugin* plugin, } void -TimeNode::run(ProcessContext& context) +TimeNode::run(RunContext& context) { BufferRef buf = _notify_port->buffer(0); LV2_Atom_Sequence* seq = buf->get<LV2_Atom_Sequence>(); diff --git a/src/server/internals/Time.hpp b/src/server/internals/Time.hpp index f8dfbd64..1a063f8d 100644 --- a/src/server/internals/Time.hpp +++ b/src/server/internals/Time.hpp @@ -44,7 +44,7 @@ public: GraphImpl* parent, SampleRate srate); - void run(ProcessContext& context); + void run(RunContext& context); static InternalPlugin* internal_plugin(URIs& uris); diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index d34b38c1..49a3a2ed 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -25,7 +25,7 @@ #include "InputPort.hpp" #include "InternalPlugin.hpp" #include "OutputPort.hpp" -#include "ProcessContext.hpp" +#include "RunContext.hpp" #include "ingen_config.h" #include "internals/Trigger.hpp" #include "util.hpp" @@ -96,7 +96,7 @@ TriggerNode::TriggerNode(InternalPlugin* plugin, } void -TriggerNode::run(ProcessContext& context) +TriggerNode::run(RunContext& context) { Buffer* const midi_in = _midi_in_port->buffer(0).get(); LV2_Atom_Sequence* seq = midi_in->get<LV2_Atom_Sequence>(); @@ -130,7 +130,7 @@ TriggerNode::run(ProcessContext& context) } void -TriggerNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity, FrameTime time) +TriggerNode::note_on(RunContext& context, uint8_t note_num, uint8_t velocity, FrameTime time) { assert(time >= context.start() && time <= context.end()); @@ -150,7 +150,7 @@ TriggerNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity } void -TriggerNode::note_off(ProcessContext& context, uint8_t note_num, FrameTime time) +TriggerNode::note_off(RunContext& context, uint8_t note_num, FrameTime time) { assert(time >= context.start() && time <= context.end()); diff --git a/src/server/internals/Trigger.hpp b/src/server/internals/Trigger.hpp index f486ef38..801e97f6 100644 --- a/src/server/internals/Trigger.hpp +++ b/src/server/internals/Trigger.hpp @@ -48,10 +48,10 @@ public: GraphImpl* parent, SampleRate srate); - void run(ProcessContext& context); + void run(RunContext& context); - void note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity, FrameTime time); - void note_off(ProcessContext& context, uint8_t note_num, FrameTime time); + void note_on(RunContext& context, uint8_t note_num, uint8_t velocity, FrameTime time); + void note_off(RunContext& context, uint8_t note_num, FrameTime time); void learn() { _learning = true; } diff --git a/src/server/mix.cpp b/src/server/mix.cpp index 6fa8626c..897a26e6 100644 --- a/src/server/mix.cpp +++ b/src/server/mix.cpp @@ -17,7 +17,7 @@ #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "Buffer.hpp" -#include "Context.hpp" +#include "RunContext.hpp" #include "mix.hpp" namespace Ingen { @@ -34,7 +34,7 @@ is_end(const Buffer* buf, const LV2_Atom_Event* ev) } void -mix(const Context& context, +mix(const RunContext& context, Buffer* dst, const Buffer*const* srcs, uint32_t num_srcs) diff --git a/src/server/mix.hpp b/src/server/mix.hpp index c10b2de6..58986750 100644 --- a/src/server/mix.hpp +++ b/src/server/mix.hpp @@ -25,11 +25,11 @@ class URIs; namespace Server { -class Context; class Buffer; +class RunContext; void -mix(const Context& context, +mix(const RunContext& context, Buffer* dst, const Buffer*const* srcs, uint32_t num_srcs); diff --git a/src/server/wscript b/src/server/wscript index 4bb9b1f3..6f5ffb86 100644 --- a/src/server/wscript +++ b/src/server/wscript @@ -10,7 +10,6 @@ def build(bld): Buffer.cpp BufferFactory.cpp ClientUpdate.cpp - Context.cpp ControlBindings.cpp DuplexPort.cpp Engine.cpp @@ -26,6 +25,7 @@ def build(bld): PortImpl.cpp PostProcessor.cpp PreProcessor.cpp + RunContext.cpp SocketListener.cpp UndoStack.cpp Worker.cpp |