summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-09-18 08:24:25 -0400
committerDavid Robillard <d@drobilla.net>2016-09-18 11:43:30 -0400
commita43528ab069f325e68dab6e18cf2cab19cc22e56 (patch)
treeacecc484fa015c063c6361baa03616202d336e89
parentce6dc3d549bc58515d5d55db1d0a009a92887f3c (diff)
downloadingen-a43528ab069f325e68dab6e18cf2cab19cc22e56.tar.gz
ingen-a43528ab069f325e68dab6e18cf2cab19cc22e56.tar.bz2
ingen-a43528ab069f325e68dab6e18cf2cab19cc22e56.zip
Clean up code
-rw-r--r--src/server/ControlBindings.cpp2
-rw-r--r--src/server/ControlBindings.hpp12
-rw-r--r--src/server/DirectDriver.hpp2
-rw-r--r--src/server/Driver.hpp2
-rw-r--r--src/server/Event.hpp4
-rw-r--r--src/server/InputPort.hpp2
-rw-r--r--src/server/JackDriver.cpp2
-rw-r--r--src/server/JackDriver.hpp2
-rw-r--r--src/server/PreProcessor.hpp31
9 files changed, 34 insertions, 25 deletions
diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp
index 6e8775e7..2e18442c 100644
--- a/src/server/ControlBindings.cpp
+++ b/src/server/ControlBindings.cpp
@@ -239,7 +239,7 @@ int16_t
ControlBindings::port_value_to_control(RunContext& context,
PortImpl* port,
Type type,
- const Atom& value_atom) const
+ const Atom& value_atom) const
{
if (value_atom.type() != port->bufs().forge().Float)
return 0;
diff --git a/src/server/ControlBindings.hpp b/src/server/ControlBindings.hpp
index 7ff4b3dc..532ee4d8 100644
--- a/src/server/ControlBindings.hpp
+++ b/src/server/ControlBindings.hpp
@@ -94,9 +94,9 @@ private:
Key midi_event_key(uint16_t size, const uint8_t* buf, uint16_t& value);
void set_port_value(RunContext& context,
- PortImpl* port,
- Type type,
- int16_t value);
+ PortImpl* port,
+ Type type,
+ int16_t value);
bool bind(RunContext& context, Key key);
@@ -106,9 +106,9 @@ private:
int16_t value) const;
int16_t port_value_to_control(RunContext& context,
- PortImpl* port,
- Type type,
- const Atom& value) const;
+ PortImpl* port,
+ Type type,
+ const Atom& value) const;
Engine& _engine;
PortImpl* _learn_port;
diff --git a/src/server/DirectDriver.hpp b/src/server/DirectDriver.hpp
index a8c7c803..a9800947 100644
--- a/src/server/DirectDriver.hpp
+++ b/src/server/DirectDriver.hpp
@@ -82,7 +82,7 @@ public:
virtual SampleCount frame_time() const { return 0; }
virtual void append_time_events(RunContext& context,
- Buffer& buffer) {}
+ Buffer& buffer) {}
private:
typedef boost::intrusive::list<EnginePort> Ports;
diff --git a/src/server/Driver.hpp b/src/server/Driver.hpp
index 9f261494..dc4eee1d 100644
--- a/src/server/Driver.hpp
+++ b/src/server/Driver.hpp
@@ -95,7 +95,7 @@ public:
/** Append time events for this cycle to `buffer`. */
virtual void append_time_events(RunContext& context,
- Buffer& buffer) = 0;
+ Buffer& buffer) = 0;
};
} // namespace Server
diff --git a/src/server/Event.hpp b/src/server/Event.hpp
index 3cec155e..11bffeb3 100644
--- a/src/server/Event.hpp
+++ b/src/server/Event.hpp
@@ -86,10 +86,10 @@ public:
/** Return the status (success or error code) of this event. */
Status status() const { return _status; }
- /** Return true iff this is a generated undo event. */
+ /** Return undo mode of this event. */
Mode get_mode() const { return _mode; }
- /** Flag this event as a generated undo event. */
+ /** Set the undo mode of this event. */
void set_mode(Mode mode) { _mode = mode; }
inline Engine& engine() { return _engine; }
diff --git a/src/server/InputPort.hpp b/src/server/InputPort.hpp
index 304185cc..f93aa4df 100644
--- a/src/server/InputPort.hpp
+++ b/src/server/InputPort.hpp
@@ -83,7 +83,7 @@ public:
*
* setup_buffers() must be called later for the change to take effect.
*/
- ArcImpl* remove_arc(RunContext& context,
+ ArcImpl* remove_arc(RunContext& context,
const OutputPort* tail);
/** Set `voices` as the buffers to be used for this port.
diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp
index 13f05ed5..db567866 100644
--- a/src/server/JackDriver.cpp
+++ b/src/server/JackDriver.cpp
@@ -410,7 +410,7 @@ JackDriver::post_process_port(RunContext& context, EnginePort* port)
void
JackDriver::append_time_events(RunContext& context,
- Buffer& buffer)
+ Buffer& buffer)
{
const URIs& uris = context.engine().world()->uris();
const jack_position_t* pos = &_position;
diff --git a/src/server/JackDriver.hpp b/src/server/JackDriver.hpp
index a5422f6a..ef7bbd78 100644
--- a/src/server/JackDriver.hpp
+++ b/src/server/JackDriver.hpp
@@ -85,7 +85,7 @@ public:
inline jack_transport_state_t transport_state() { return _transport_state; }
void append_time_events(RunContext& context,
- Buffer& buffer);
+ Buffer& buffer);
jack_client_t* jack_client() const { return _client; }
SampleCount block_length() const { return _block_length; }
diff --git a/src/server/PreProcessor.hpp b/src/server/PreProcessor.hpp
index f9b85c8f..5dc7bef0 100644
--- a/src/server/PreProcessor.hpp
+++ b/src/server/PreProcessor.hpp
@@ -49,22 +49,31 @@ public:
/** Process events for a cycle.
* @return The number of events processed.
*/
- unsigned process(RunContext& context,
- PostProcessor& dest,
- size_t limit = 0);
+ unsigned process(RunContext& context,
+ PostProcessor& dest,
+ size_t limit = 0);
protected:
void run();
private:
- Engine& _engine;
- std::mutex _mutex;
- Raul::Semaphore _sem;
- std::atomic<Event*> _head;
- std::atomic<Event*> _prepared_back;
- std::atomic<Event*> _tail;
- bool _exit_flag;
- std::thread _thread;
+ enum class BlockState {
+ UNBLOCKED, ///< Normal, unblocked execution
+ PRE_BLOCKED, ///< Preprocess thread has enqueued blocking event
+ BLOCKED, ///< Process thread has reached blocking event
+ PRE_UNBLOCKED, ///< Preprocess thread has enqueued unblocking event
+ PROCESSING ///< Process thread is executing all events in-between
+ };
+
+ Engine& _engine;
+ std::mutex _mutex;
+ Raul::Semaphore _sem;
+ std::atomic<Event*> _head;
+ std::atomic<Event*> _prepared_back;
+ std::atomic<Event*> _tail;
+ std::atomic<BlockState> _block_state;
+ bool _exit_flag;
+ std::thread _thread;
};
} // namespace Server