From 608aeac60ef43243b85c0dcc5894ccc79f35fba5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 21 Oct 2007 19:02:02 +0000 Subject: Fix crash on OSC connection. Fix patch filename persistance. git-svn-id: http://svn.drobilla.net/lad/ingen@894 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/OSCClientReceiver.cpp | 2 +- src/libs/client/PatchModel.hpp | 5 ----- src/libs/engine/OSCBuffer.cpp | 5 +---- src/libs/engine/OSCEngineReceiver.cpp | 2 +- src/libs/gui/LoadPatchWindow.cpp | 7 +++++-- src/libs/gui/PatchWindow.cpp | 15 ++++++++------- src/libs/gui/ingen_gui.glade | 4 ++-- 7 files changed, 18 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp index 6de38da3..bd0b5db9 100644 --- a/src/libs/client/OSCClientReceiver.cpp +++ b/src/libs/client/OSCClientReceiver.cpp @@ -35,7 +35,7 @@ OSCClientReceiver::OSCClientReceiver(int listen_port) _listen_port(listen_port), _st(NULL) { - start(true); // true = dump, false = shutup + start(false); // true = dump, false = shutup } diff --git a/src/libs/client/PatchModel.hpp b/src/libs/client/PatchModel.hpp index 5d375faf..909b9e9e 100644 --- a/src/libs/client/PatchModel.hpp +++ b/src/libs/client/PatchModel.hpp @@ -48,10 +48,7 @@ public: SharedPtr get_connection(const string& src_port_path, const string& dst_port_path) const; - void set_filename(const string& filename) { _filename = filename; } - size_t poly() const { return _poly; } - const string& filename() const { return _filename; } bool enabled() const { return _enabled; } uint32_t internal_polyphony() const { return _poly; } bool polyphonic() const; @@ -86,7 +83,6 @@ private: { } - void filename(const string& f) { _filename = f; } void poly(size_t p) { _poly = p; signal_polyphony.emit(p); } void enable(); void disable(); @@ -98,7 +94,6 @@ private: void remove_connection(const string& src_port_path, const string& dst_port_path); Connections _connections; - string _filename; bool _enabled; uint32_t _poly; bool _editable; diff --git a/src/libs/engine/OSCBuffer.cpp b/src/libs/engine/OSCBuffer.cpp index f8454a14..f16bcfbf 100644 --- a/src/libs/engine/OSCBuffer.cpp +++ b/src/libs/engine/OSCBuffer.cpp @@ -76,9 +76,8 @@ OSCBuffer::unjoin() void OSCBuffer::prepare_read(SampleCount nframes) { - assert(!_joined_buf || data() == _joined_buf->data()); - rewind(); + _this_nframes = nframes; } @@ -86,8 +85,6 @@ void OSCBuffer::prepare_write(SampleCount nframes) { reset(nframes); - - assert(!_joined_buf || data() == _joined_buf->data()); } diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp index 4a713dff..66e74e70 100644 --- a/src/libs/engine/OSCEngineReceiver.cpp +++ b/src/libs/engine/OSCEngineReceiver.cpp @@ -65,7 +65,7 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t } // For debugging, print all incoming OSC messages - lo_server_add_method(_server, NULL, NULL, generic_cb, NULL); + //lo_server_add_method(_server, NULL, NULL, generic_cb, NULL); // Set response address for this message. // It's important this is first and returns nonzero. diff --git a/src/libs/gui/LoadPatchWindow.cpp b/src/libs/gui/LoadPatchWindow.cpp index 66aec5b0..57ae1536 100644 --- a/src/libs/gui/LoadPatchWindow.cpp +++ b/src/libs/gui/LoadPatchWindow.cpp @@ -15,10 +15,10 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "LoadPatchWindow.hpp" #include #include #include +#include "LoadPatchWindow.hpp" #include "interface/EngineInterface.hpp" #include "client/PatchModel.hpp" #include "App.hpp" @@ -127,8 +127,11 @@ LoadPatchWindow::ok_clicked() if (_poly_from_user_radio->get_active()) _initial_data.insert(make_pair("ingen:polyphony", _poly_spinbutton->get_value_as_int())); - if (_replace) + if (_replace) { App::instance().engine()->clear_patch(_patch->path()); + App::instance().engine()->set_variable(_patch->path(), "ingen:document", + Atom(get_uri().c_str())); + } if (_patch->path() != "/") parent = _patch->path().parent(); diff --git a/src/libs/gui/PatchWindow.cpp b/src/libs/gui/PatchWindow.cpp index 716d4356..5569c037 100644 --- a/src/libs/gui/PatchWindow.cpp +++ b/src/libs/gui/PatchWindow.cpp @@ -304,10 +304,11 @@ PatchWindow::event_import_location() void PatchWindow::event_save() { - if (_patch->filename() == "") + GraphObject::Variables::const_iterator doc = _patch->variables().find("ingen:document"); + if (doc == _patch->variables().end()) event_save_as(); else - App::instance().loader()->save_patch(_patch, _patch->filename()); + App::instance().loader()->save_patch(_patch, doc->second.get_string()); } @@ -330,9 +331,9 @@ PatchWindow::event_save_as() save_button->property_has_default() = true; // Set current folder to most sensible default - const string& current_filename = _patch->filename(); - if (current_filename.length() > 0) - dialog.set_filename(current_filename); + GraphObject::Variables::const_iterator doc = _patch->variables().find("ingen:document"); + if (doc != _patch->variables().end()) + dialog.set_uri(doc->second.get_string()); else if (App::instance().configuration()->patch_folder().length() > 0) dialog.set_current_folder(App::instance().configuration()->patch_folder()); @@ -365,8 +366,8 @@ PatchWindow::event_save_as() if (confirm) { App::instance().loader()->save_patch(_patch, filename); - _patch->set_filename(filename); - //_patch->set_variable("filename", Atom(filename.c_str())); + App::instance().engine()->set_variable(_patch->path(), "ingen:document", + Atom(Glib::filename_to_uri(filename).c_str())); } } App::instance().configuration()->set_patch_folder(dialog.get_current_folder()); diff --git a/src/libs/gui/ingen_gui.glade b/src/libs/gui/ingen_gui.glade index 18090268..e3f66321 100644 --- a/src/libs/gui/ingen_gui.glade +++ b/src/libs/gui/ingen_gui.glade @@ -404,8 +404,8 @@ True True - GTK_POLICY_NEVER - GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC True -- cgit v1.2.1