summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-10-01 17:47:37 -0400
committerDavid Robillard <d@drobilla.net>2016-10-02 12:24:57 -0400
commite2f63c5d8e296a35c06d4a3fd522aa5224a6ad3d (patch)
tree724dc9a1945b7ffa8a286a1f1a9f0bf6b0c11332
parenta172e76897157e5a0d2ebd3fa3f7f77ec38a5df0 (diff)
downloadingen-e2f63c5d8e296a35c06d4a3fd522aa5224a6ad3d.tar.gz
ingen-e2f63c5d8e296a35c06d4a3fd522aa5224a6ad3d.tar.bz2
ingen-e2f63c5d8e296a35c06d4a3fd522aa5224a6ad3d.zip
Fix unit test responses and ensure events succeed
-rw-r--r--ingen/AtomReader.hpp2
-rw-r--r--ingen/AtomSink.hpp6
-rw-r--r--ingen/TurtleWriter.hpp2
-rw-r--r--src/AtomReader.cpp4
-rw-r--r--src/TurtleWriter.cpp2
-rw-r--r--src/gui/ingen_gui_lv2.cpp2
-rw-r--r--src/server/UndoStack.cpp2
-rw-r--r--src/server/UndoStack.hpp2
-rw-r--r--src/server/ingen_lv2.cpp2
-rw-r--r--tests/ingen_test.cpp2
10 files changed, 15 insertions, 11 deletions
diff --git a/ingen/AtomReader.hpp b/ingen/AtomReader.hpp
index 7bb4b359..09aa672a 100644
--- a/ingen/AtomReader.hpp
+++ b/ingen/AtomReader.hpp
@@ -45,7 +45,7 @@ public:
static bool is_message(const URIs& uris, const LV2_Atom* msg);
- bool write(const LV2_Atom* msg);
+ bool write(const LV2_Atom* msg, int32_t default_id=0);
private:
void get_atom(const LV2_Atom* in, Atom& out);
diff --git a/ingen/AtomSink.hpp b/ingen/AtomSink.hpp
index 789b7d61..8228001e 100644
--- a/ingen/AtomSink.hpp
+++ b/ingen/AtomSink.hpp
@@ -30,9 +30,13 @@ public:
virtual ~AtomSink() {}
/** Write an Atom to the sink.
+ *
+ * @param default_id The default response ID to use if no
+ * patch:sequenceNumber property is present on the message.
+ *
* @return True on success.
*/
- virtual bool write(const LV2_Atom* msg) = 0;
+ virtual bool write(const LV2_Atom* msg, int32_t default_id=0) = 0;
};
} // namespace Ingen
diff --git a/ingen/TurtleWriter.hpp b/ingen/TurtleWriter.hpp
index 4ce10f3c..3a439b98 100644
--- a/ingen/TurtleWriter.hpp
+++ b/ingen/TurtleWriter.hpp
@@ -44,7 +44,7 @@ public:
virtual ~TurtleWriter();
/** AtomSink method which receives calls serialized to LV2 atoms. */
- bool write(const LV2_Atom* msg);
+ bool write(const LV2_Atom* msg, int32_t default_id=0);
/** Pure virtual text sink which receives calls serialized to Turtle. */
virtual size_t text_sink(const void* buf, size_t len) = 0;
diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp
index 2d6db912..f77d8d76 100644
--- a/src/AtomReader.cpp
+++ b/src/AtomReader.cpp
@@ -124,7 +124,7 @@ AtomReader::is_message(const URIs& uris, const LV2_Atom* msg)
}
bool
-AtomReader::write(const LV2_Atom* msg)
+AtomReader::write(const LV2_Atom* msg, int32_t default_id)
{
if (msg->type != _uris.atom_Object) {
_log.warn(fmt("Unknown message type <%1%>\n")
@@ -145,7 +145,7 @@ AtomReader::write(const LV2_Atom* msg)
const int32_t seq_id = ((number && number->type == _uris.atom_Int)
? ((const LV2_Atom_Int*)number)->body
- : 0);
+ : default_id);
_iface.set_response_id(seq_id);
if (obj->body.otype == _uris.patch_Get) {
diff --git a/src/TurtleWriter.cpp b/src/TurtleWriter.cpp
index 7ee4a43f..7be046a4 100644
--- a/src/TurtleWriter.cpp
+++ b/src/TurtleWriter.cpp
@@ -86,7 +86,7 @@ TurtleWriter::~TurtleWriter()
}
bool
-TurtleWriter::write(const LV2_Atom* msg)
+TurtleWriter::write(const LV2_Atom* msg, int32_t default_id)
{
if (!_wrote_prefixes) {
// Write namespace prefixes once to reduce traffic
diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp
index 682df7a1..9387f742 100644
--- a/src/gui/ingen_gui_lv2.cpp
+++ b/src/gui/ingen_gui_lv2.cpp
@@ -43,7 +43,7 @@ struct IngenLV2AtomSink : public AtomSink {
, _ui_controller(ui_controller)
{}
- bool write(const LV2_Atom* atom) {
+ bool write(const LV2_Atom* atom, int32_t default_id) {
_ui_write(_ui_controller,
0,
lv2_atom_total_size(atom),
diff --git a/src/server/UndoStack.cpp b/src/server/UndoStack.cpp
index 87391bc7..de4c64ca 100644
--- a/src/server/UndoStack.cpp
+++ b/src/server/UndoStack.cpp
@@ -44,7 +44,7 @@ UndoStack::start_entry()
}
bool
-UndoStack::write(const LV2_Atom* msg)
+UndoStack::write(const LV2_Atom* msg, int32_t default_id)
{
_stack.back().push_event(msg);
return true;
diff --git a/src/server/UndoStack.hpp b/src/server/UndoStack.hpp
index d8d60e84..6ce6475f 100644
--- a/src/server/UndoStack.hpp
+++ b/src/server/UndoStack.hpp
@@ -78,7 +78,7 @@ public:
UndoStack(URIs& uris, URIMap& map) : _uris(uris), _map(map), _depth(0) {}
int start_entry();
- bool write(const LV2_Atom* msg);
+ bool write(const LV2_Atom* msg, int32_t default_id=0);
int finish_entry();
bool empty() const { return _stack.empty(); }
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index a21cb4c9..cc01f68a 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -274,7 +274,7 @@ public:
/** AtomSink::write implementation called by the PostProcessor in the main
* thread to write responses to the UI.
*/
- bool write(const LV2_Atom* atom) {
+ bool write(const LV2_Atom* atom, int32_t default_id) {
// Called from post-processor in main thread
while (_to_ui.write(lv2_atom_total_size(atom), atom) == 0) {
// Overflow, wait until ring is drained next cycle
diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp
index 6633e5c5..bb013ebd 100644
--- a/tests/ingen_test.cpp
+++ b/tests/ingen_test.cpp
@@ -256,7 +256,7 @@ main(int argc, char** argv)
NULL, NULL, atom->type, atom->size, LV2_ATOM_BODY(atom)) << endl;
#endif
- if (!atom_reader.write((const LV2_Atom*)out.buf)) {
+ if (!atom_reader.write((const LV2_Atom*)out.buf, n_events + 1)) {
return EXIT_FAILURE;
}