From 318b37d8b556add13b3f156f31c9e72eca339a16 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 17 Aug 2012 02:14:07 +0000 Subject: Implement real logging system, LV2 log extension support, and purge evil/ugly/untranslatable C++ stream printing. Remove coloured log stuff from Raul. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4717 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/Broadcaster.cpp | 9 ----- src/server/Buffer.cpp | 12 ++---- src/server/BufferFactory.cpp | 4 +- src/server/Context.cpp | 14 +++---- src/server/ControlBindings.cpp | 18 +++------ src/server/EdgeImpl.cpp | 1 - src/server/EdgeImpl.hpp | 1 - src/server/Engine.cpp | 5 ++- src/server/Engine.hpp | 5 ++- src/server/EventWriter.cpp | 2 - src/server/GraphObjectImpl.cpp | 2 - src/server/InputPort.cpp | 7 ++-- src/server/JackDriver.cpp | 30 +++++++------- src/server/LV2Node.cpp | 32 +++++++-------- src/server/LV2ResizeFeature.hpp | 1 - src/server/NodeFactory.cpp | 5 ++- src/server/PatchImpl.cpp | 8 ++-- src/server/Worker.cpp | 18 +++++---- src/server/Worker.hpp | 6 ++- src/server/events/Delta.cpp | 22 +++++----- src/server/events/Disconnect.cpp | 1 - src/server/events/SetPortValue.cpp | 1 - src/server/ingen_engine.cpp | 2 +- src/server/ingen_jack.cpp | 4 +- src/server/ingen_lv2.cpp | 83 +++++++++++++++++++++++--------------- src/server/internals/Delay.cpp | 3 -- src/server/internals/Note.cpp | 37 ----------------- src/server/internals/Trigger.cpp | 7 ---- src/server/mix.cpp | 2 - src/server/util.hpp | 39 ++---------------- 30 files changed, 149 insertions(+), 232 deletions(-) (limited to 'src/server') diff --git a/src/server/Broadcaster.cpp b/src/server/Broadcaster.cpp index fe8ceae4..33ee5369 100644 --- a/src/server/Broadcaster.cpp +++ b/src/server/Broadcaster.cpp @@ -18,14 +18,11 @@ #include #include "ingen/Interface.hpp" -#include "raul/log.hpp" #include "Broadcaster.hpp" #include "PluginImpl.hpp" #include "NodeFactory.hpp" -#define LOG(s) (s("[Broadcaster] ")) - namespace Ingen { namespace Server { @@ -36,7 +33,6 @@ Broadcaster::register_client(const Raul::URI& uri, SharedPtr client) { Glib::Mutex::Lock lock(_clients_mutex); - LOG(Raul::info)(Raul::fmt("Registered client <%1%>\n") % uri.c_str()); _clients[uri] = client; } @@ -49,11 +45,6 @@ Broadcaster::unregister_client(const Raul::URI& uri) { Glib::Mutex::Lock lock(_clients_mutex); const size_t erased = _clients.erase(uri); - - if (erased > 0) { - LOG(Raul::info)(Raul::fmt("Unregistered client <%1%>\n") % uri.c_str()); - } - return (erased > 0); } diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp index 9bc2572f..79ec3847 100644 --- a/src/server/Buffer.cpp +++ b/src/server/Buffer.cpp @@ -31,7 +31,7 @@ #include "ingen/World.hpp" #include "ingen_config.h" #include "lv2/lv2plug.in/ns/ext/atom/util.h" -#include "raul/log.hpp" +#include "ingen/Log.hpp" #include "Buffer.hpp" #include "BufferFactory.hpp" @@ -55,7 +55,7 @@ Buffer::Buffer(BufferFactory& bufs, LV2_URID type, uint32_t capacity) #endif if (ret) { - Raul::error << "Failed to allocate event buffer." << std::endl; + bufs.engine().log().error("Failed to allocate event buffer\n"); throw std::bad_alloc(); } @@ -129,18 +129,12 @@ Buffer::port_data(PortType port_type) return (float*)LV2_ATOM_BODY(_atom); } else if (_atom->type == _factory.uris().atom_Sound) { return (float*)LV2_ATOM_CONTENTS(LV2_Atom_Vector, _atom); - } else { - Raul::warn << "Audio data requested from non-audio buffer " << this << " :: " - << _atom->type << " - " - << _factory.engine().world()->uri_map().unmap_uri(_atom->type) - << std::endl; - assert(false); - return NULL; } break; default: return _atom; } + return NULL; } const void* diff --git a/src/server/BufferFactory.cpp b/src/server/BufferFactory.cpp index a295611f..69cba30b 100644 --- a/src/server/BufferFactory.cpp +++ b/src/server/BufferFactory.cpp @@ -14,8 +14,8 @@ along with Ingen. If not, see . */ +#include "ingen/Log.hpp" #include "ingen/URIs.hpp" -#include "raul/log.hpp" #include "Buffer.hpp" #include "BufferFactory.hpp" @@ -112,7 +112,7 @@ BufferFactory::get(LV2_URID type, return create(type, capacity); } else { assert(false); - Raul::error << "Failed to obtain buffer" << std::endl; + _engine.world()->log().error("Failed to obtain buffer"); return BufferRef(); } } diff --git a/src/server/Context.cpp b/src/server/Context.cpp index a7a78b43..3b07373d 100644 --- a/src/server/Context.cpp +++ b/src/server/Context.cpp @@ -15,8 +15,8 @@ */ #include "ingen/Forge.hpp" +#include "ingen/Log.hpp" #include "ingen/URIMap.hpp" -#include "raul/log.hpp" #include "Context.hpp" #include "Engine.hpp" @@ -63,12 +63,12 @@ Context::notify(LV2_URID key, { const Notification n(port, time, key, size, type); if (_event_sink.write_space() < sizeof(n) + size) { - Raul::warn("Notification ring overflow\n"); + _engine.log().warn("Notification ring overflow\n"); } else { if (_event_sink.write(sizeof(n), &n) != sizeof(n)) { - Raul::error("Error writing header to notification ring\n"); + _engine.log().error("Error writing header to notification ring\n"); } else if (_event_sink.write(size, body) != size) { - Raul::error("Error writing body to notification ring\n"); + _engine.log().error("Error writing body to notification ring\n"); } } } @@ -93,13 +93,13 @@ Context::emit_notifications(FrameTime end) _engine.broadcaster()->set_property( note.port->uri(), Raul::URI(key), value); } else { - Raul::error("Error unmapping notification key URI\n"); + _engine.log().error("Error unmapping notification key URI\n"); } } else { - Raul::error("Error reading body from notification ring\n"); + _engine.log().error("Error reading body from notification ring\n"); } } else { - Raul::error("Error reading header from notification ring\n"); + _engine.log().error("Error reading header from notification ring\n"); } } } diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp index c5e20853..de6818ff 100644 --- a/src/server/ControlBindings.cpp +++ b/src/server/ControlBindings.cpp @@ -16,12 +16,12 @@ #include +#include "ingen/Log.hpp" #include "ingen/URIMap.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "lv2/lv2plug.in/ns/ext/midi/midi.h" -#include "raul/log.hpp" #include "Buffer.hpp" #include "ControlBindings.hpp" @@ -31,8 +31,6 @@ #include "ProcessContext.hpp" #include "ThreadManager.hpp" -#define LOG(s) s << "[ControlBindings] " - using namespace std; namespace Ingen { @@ -81,9 +79,9 @@ ControlBindings::binding_key(const Raul::Atom& binding) const lv2_atom_object_body_get( binding.size(), obj, (LV2_URID)uris.midi_controllerNumber, &num, NULL); if (!num) { - Raul::error << "Controller binding missing number" << std::endl; + _engine.log().error("Controller binding missing number\n"); } else if (num->type != uris.atom_Int) { - Raul::error << "Controller number not an integer" << std::endl; + _engine.log().error("Controller number not an integer\n"); } else { key = Key(MIDI_CC, ((LV2_Atom_Int*)num)->body); } @@ -91,15 +89,15 @@ ControlBindings::binding_key(const Raul::Atom& binding) const lv2_atom_object_body_get( binding.size(), obj, (LV2_URID)uris.midi_noteNumber, &num, NULL); if (!num) { - Raul::error << "Note binding missing number" << std::endl; + _engine.log().error("Note binding missing number\n"); } else if (num->type != uris.atom_Int) { - Raul::error << "Note number not an integer" << std::endl; + _engine.log().error("Note number not an integer\n"); } else { key = Key(MIDI_NOTE, ((LV2_Atom_Int*)num)->body); } } } else if (binding.type()) { - Raul::error << "Unknown binding type " << binding.type() << std::endl; + _engine.log().error(Raul::fmt("Unknown binding type %1%\n") % binding.type()); } return key; } @@ -252,14 +250,10 @@ ControlBindings::port_value_to_control(ProcessContext& context, float normal = (value - min) / (max - min); if (normal < 0.0f) { - LOG(Raul::warn) << "Value " << value << " (normal " << normal << ") for " - << port->path() << " out of range" << endl; normal = 0.0f; } if (normal > 1.0f) { - LOG(Raul::warn) << "Value " << value << " (normal " << normal << ") for " - << port->path() << " out of range" << endl; normal = 1.0f; } diff --git a/src/server/EdgeImpl.cpp b/src/server/EdgeImpl.cpp index b044e5c5..23b840d4 100644 --- a/src/server/EdgeImpl.cpp +++ b/src/server/EdgeImpl.cpp @@ -16,7 +16,6 @@ #include "ingen/URIs.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" -#include "raul/log.hpp" #include "Buffer.hpp" #include "BufferFactory.hpp" diff --git a/src/server/EdgeImpl.hpp b/src/server/EdgeImpl.hpp index fd5b5ca0..4a4553b1 100644 --- a/src/server/EdgeImpl.hpp +++ b/src/server/EdgeImpl.hpp @@ -25,7 +25,6 @@ #include "ingen/Edge.hpp" #include "lv2/lv2plug.in/ns/ext/atom/atom.h" #include "raul/Deletable.hpp" -#include "raul/log.hpp" #include "BufferRef.hpp" #include "Context.hpp" diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index c7fef892..4efb9f5e 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -21,6 +21,7 @@ #include "ingen/Store.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" +#include "ingen/Log.hpp" #include "raul/Maid.hpp" #include "raul/SharedPtr.hpp" @@ -59,7 +60,7 @@ Engine::Engine(Ingen::World* world) , _post_processor(new PostProcessor(*this)) , _event_writer(new EventWriter(*this)) , _root_patch(NULL) - , _worker(new Worker(event_queue_size())) + , _worker(new Worker(world->log(), event_queue_size())) , _process_context(*this) , _quit_flag(false) , _direct_driver(true) @@ -319,12 +320,14 @@ Engine::process_events() void Engine::register_client(const Raul::URI& uri, SharedPtr client) { + log().info(Raul::fmt("Registering client <%1%>\n") % uri.c_str()); _broadcaster->register_client(uri, client); } bool Engine::unregister_client(const Raul::URI& uri) { + log().info(Raul::fmt("Unregistering client <%1%>\n") % uri.c_str()); return _broadcaster->unregister_client(uri); } diff --git a/src/server/Engine.hpp b/src/server/Engine.hpp index 81cdc5d5..ca844261 100644 --- a/src/server/Engine.hpp +++ b/src/server/Engine.hpp @@ -96,10 +96,11 @@ public: BufferFactory* buffer_factory() const { return _buffer_factory; } ControlBindings* control_bindings() const { return _control_bindings; } Driver* driver() const { return _driver.get(); } - Raul::Maid* maid() const { return _maid; } + Log& log() const { return _world->log(); } NodeFactory* node_factory() const { return _node_factory; } - PostProcessor* post_processor() const { return _post_processor; } PatchImpl* root_patch() const { return _root_patch; } + PostProcessor* post_processor() const { return _post_processor; } + Raul::Maid* maid() const { return _maid; } Worker* worker() const { return _worker; } ProcessContext& process_context() { return _process_context; } diff --git a/src/server/EventWriter.cpp b/src/server/EventWriter.cpp index c913c17a..b4f95294 100644 --- a/src/server/EventWriter.cpp +++ b/src/server/EventWriter.cpp @@ -20,8 +20,6 @@ #include "EventWriter.hpp" #include "events.hpp" -#define LOG(s) s << "[EventWriter] " - using namespace std; namespace Ingen { diff --git a/src/server/GraphObjectImpl.cpp b/src/server/GraphObjectImpl.cpp index 447e859c..212e5196 100644 --- a/src/server/GraphObjectImpl.cpp +++ b/src/server/GraphObjectImpl.cpp @@ -14,8 +14,6 @@ along with Ingen. If not, see . */ -#include "raul/log.hpp" - #include "GraphObjectImpl.hpp" #include "PatchImpl.hpp" #include "ThreadManager.hpp" diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index 8e50e3b8..0bce5b93 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -17,6 +17,9 @@ #include #include +#include "ingen/Log.hpp" +#include "ingen/URIs.hpp" + #include "Buffer.hpp" #include "BufferFactory.hpp" #include "EdgeImpl.hpp" @@ -26,7 +29,6 @@ #include "OutputPort.hpp" #include "PatchImpl.hpp" #include "ProcessContext.hpp" -#include "ingen/URIs.hpp" #include "mix.hpp" using namespace std; @@ -143,8 +145,7 @@ InputPort::remove_edge(ProcessContext& context, const OutputPort* tail) } if (!edge) { - Raul::error << "[InputPort::remove_edge] Edge not found!" - << std::endl; + context.engine().log().error("Attempt to remove non-existent edge\n"); return NULL; } diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 83a86a54..b950c350 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -28,9 +28,9 @@ #include "ingen/Configuration.hpp" #include "ingen/LV2Features.hpp" +#include "ingen/Log.hpp" #include "ingen/World.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" -#include "raul/log.hpp" #include "Buffer.hpp" #include "DuplexPort.hpp" @@ -41,8 +41,6 @@ #include "ThreadManager.hpp" #include "util.hpp" -#define LOG(s) (s("[JackDriver] ")) - using namespace std; typedef jack_default_audio_sample_t jack_sample_t; @@ -83,7 +81,7 @@ JackDriver::attach(const std::string& server_name, _client = jack_client_open(client_name.c_str(), JackSessionID, NULL, uuid.c_str()); - LOG(Raul::info)(Raul::fmt("Connected to JACK as `%1%' (UUID `%2%')\n") + _engine.log().info(Raul::fmt("Connected to JACK as `%1%' (UUID `%2%')\n") % client_name.c_str() % uuid); } #endif @@ -93,7 +91,7 @@ JackDriver::attach(const std::string& server_name, if ((_client = jack_client_open(client_name.c_str(), JackServerName, NULL, server_name.c_str()))) { - LOG(Raul::info)(Raul::fmt("Connected to JACK server `%1%'\n") + _engine.log().info(Raul::fmt("Connected to JACK server `%1%'\n") % server_name); } } @@ -102,12 +100,12 @@ JackDriver::attach(const std::string& server_name, // Connect to default server if (!_client) { if ((_client = jack_client_open(client_name.c_str(), JackNullOption, NULL))) - LOG(Raul::info)("Connected to default JACK server\n"); + _engine.log().info("Connected to default JACK server\n"); } // Still failed if (!_client) { - LOG(Raul::error)("Unable to connect to Jack\n"); + _engine.log().error("Unable to connect to Jack\n"); return false; } } else { @@ -138,7 +136,7 @@ JackDriver::activate() World* world = _engine.world(); if (_is_activated) { - LOG(Raul::warn)("Jack driver already activated\n"); + _engine.log().warn("Jack driver already activated\n"); return; } @@ -151,10 +149,10 @@ JackDriver::activate() _is_activated = true; if (jack_activate(_client)) { - LOG(Raul::error)("Could not activate Jack client, aborting\n"); + _engine.log().error("Could not activate Jack client, aborting\n"); exit(EXIT_FAILURE); } else { - LOG(Raul::info)("Activated Jack client\n"); + _engine.log().info("Activated Jack client\n"); } } @@ -176,7 +174,7 @@ JackDriver::deactivate() _client = NULL; } - LOG(Raul::info)("Deactivated Jack client\n"); + _engine.log().info("Deactivated Jack client\n"); } } @@ -227,7 +225,7 @@ void JackDriver::unregister_port(EnginePort& port) { if (jack_port_unregister(_client, (jack_port_t*)port.handle())) { - LOG(Raul::error)("Failed to unregister Jack port\n"); + _engine.log().error("Failed to unregister Jack port\n"); } } @@ -293,7 +291,7 @@ JackDriver::pre_process_port(ProcessContext& context, EnginePort* port) if (!patch_buf->append_event( ev.time, ev.size, _midi_event_type, ev.buffer)) { - LOG(Raul::warn)("Failed to write to MIDI buffer, events lost!\n"); + _engine.log().warn("Failed to write to MIDI buffer, events lost!\n"); } } } @@ -382,7 +380,7 @@ JackDriver::_thread_init_cb() void JackDriver::_shutdown_cb() { - LOG(Raul::info)("Jack shutdown, exiting\n"); + _engine.log().info("Jack shutdown, exiting\n"); _is_activated = false; _client = NULL; } @@ -403,7 +401,7 @@ JackDriver::_block_length_cb(jack_nframes_t nframes) void JackDriver::_session_cb(jack_session_event_t* event) { - LOG(Raul::info)(Raul::fmt("Jack session save to %1%\n") % event->session_dir); + _engine.log().info(Raul::fmt("Jack session save to %1%\n") % event->session_dir); const string cmd = (boost::format("ingen -eg -n %1% -u %2% -l ${SESSION_DIR}") % jack_get_client_name(_client) @@ -423,7 +421,7 @@ JackDriver::_session_cb(jack_session_event_t* event) case JackSessionSave: break; case JackSessionSaveAndQuit: - LOG(Raul::warn)("Jack session quit\n"); + _engine.log().warn("Jack session quit\n"); _engine.quit(); break; case JackSessionSaveTemplate: diff --git a/src/server/LV2Node.cpp b/src/server/LV2Node.cpp index c1951baa..654aeab0 100644 --- a/src/server/LV2Node.cpp +++ b/src/server/LV2Node.cpp @@ -22,10 +22,10 @@ #include "lv2/lv2plug.in/ns/ext/resize-port/resize-port.h" #include "lv2/lv2plug.in/ns/ext/morph/morph.h" -#include "raul/log.hpp" #include "raul/Maid.hpp" #include "raul/Array.hpp" +#include "ingen/Log.hpp" #include "ingen/URIMap.hpp" #include "ingen/URIs.hpp" @@ -36,6 +36,7 @@ #include "LV2Node.hpp" #include "LV2Plugin.hpp" #include "OutputPort.hpp" +#include "PatchImpl.hpp" #include "ProcessContext.hpp" using namespace std; @@ -77,8 +78,9 @@ LV2Node::make_instance(URIs& uris, _lv2_plugin->lilv_plugin(), rate, _features->array()); if (!inst) { - Raul::error(Raul::fmt("Failed to instantiate <%1%>\n") - % _lv2_plugin->uri().c_str()); + parent_patch()->engine().log().error( + Raul::fmt("Failed to instantiate <%1%>\n") + % _lv2_plugin->uri().c_str()); return SharedPtr(); } @@ -91,7 +93,6 @@ LV2Node::make_instance(URIs& uris, ? port->prepared_buffer(voice).get() : port->buffer(voice).get(); if (port->is_morph() && port->is_a(PortType::CV)) { - //Raul::info(Raul::fmt("Morphing %1% to CV\n") % port->path()); if (morph_iface) { morph_iface->morph_port( inst->lv2_handle, p, uris.lv2_CVPort, NULL); @@ -115,15 +116,12 @@ LV2Node::make_instance(URIs& uris, inst->lv2_handle, p, NULL); if (type == _uris.lv2_ControlPort) { port->set_type(PortType::CONTROL, 0); - /*Raul::info(Raul::fmt("Auto-morphed %1% to control\n") - % port->path());*/ } else if (type == _uris.lv2_CVPort) { port->set_type(PortType::CV, 0); - /*Raul::info(Raul::fmt("Auto-morphed %1% to CV\n") - % port->path());*/ } else { - Raul::error(Raul::fmt("%1% auto-morphed to unknown type %2%\n") - % port->path().c_str() % type); + parent_patch()->engine().log().error( + Raul::fmt("%1% auto-morphed to unknown type %2%\n") + % port->path().c_str() % type); return SharedPtr(); } } @@ -293,8 +291,9 @@ LV2Node::instantiate(BufferFactory& bufs) } lilv_nodes_free(sizes); - Raul::info(Raul::fmt("Atom port %1% buffer size %2%\n") - % path().c_str() % port_buffer_size); + bufs.engine().log().info( + Raul::fmt("Atom port %1% buffer size %2%\n") + % path().c_str() % port_buffer_size); } enum { UNKNOWN, INPUT, OUTPUT } direction = UNKNOWN; @@ -305,8 +304,9 @@ LV2Node::instantiate(BufferFactory& bufs) } if (port_type == PortType::UNKNOWN || direction == UNKNOWN) { - Raul::error(Raul::fmt("<%1%> port %2% has unknown type or direction\n") - % _lv2_plugin->uri().c_str() % port_sym.c_str()); + parent_patch()->engine().log().error( + Raul::fmt("<%1%> port %2% has unknown type or direction\n") + % _lv2_plugin->uri().c_str() % port_sym.c_str()); ret = false; break; } @@ -422,8 +422,8 @@ LV2Node::work(uint32_t size, const void* data) if (_worker_iface) { LV2_Handle inst = lilv_instance_get_handle(instance(0)); if (_worker_iface->work(inst, work_respond, this, size, data)) { - Raul::error(Raul::fmt("Error calling %1% work method\n") - % _path.c_str()); + parent_patch()->engine().log().error( + Raul::fmt("Error calling %1% work method\n") % _path); } } } diff --git a/src/server/LV2ResizeFeature.hpp b/src/server/LV2ResizeFeature.hpp index a32d3d8f..eeab3d4a 100644 --- a/src/server/LV2ResizeFeature.hpp +++ b/src/server/LV2ResizeFeature.hpp @@ -19,7 +19,6 @@ #include "ingen/LV2Features.hpp" #include "lv2/lv2plug.in/ns/ext/resize-port/resize-port.h" -#include "raul/log.hpp" #include "NodeImpl.hpp" #include "PortImpl.hpp" diff --git a/src/server/NodeFactory.cpp b/src/server/NodeFactory.cpp index 5f525434..3f07e534 100644 --- a/src/server/NodeFactory.cpp +++ b/src/server/NodeFactory.cpp @@ -18,11 +18,12 @@ #include "lilv/lilv.h" +#include "ingen/Log.hpp" +#include "ingen/World.hpp" #include "internals/Controller.hpp" #include "internals/Delay.hpp" #include "internals/Note.hpp" #include "internals/Trigger.hpp" -#include "ingen/World.hpp" #include "InternalPlugin.hpp" #include "LV2Plugin.hpp" @@ -120,7 +121,7 @@ NodeFactory::load_lv2_plugins() const Raul::URI uri(lilv_node_as_uri(lilv_plugin_get_uri(lv2_plug))); if (_plugins.find(uri) != _plugins.end()) { - Raul::warn(Raul::fmt("Already discovered <%s>\n") % uri); + _world->log().warn(Raul::fmt("Already discovered <%s>\n") % uri); continue; } diff --git a/src/server/PatchImpl.cpp b/src/server/PatchImpl.cpp index 5ea3b93b..b280886e 100644 --- a/src/server/PatchImpl.cpp +++ b/src/server/PatchImpl.cpp @@ -16,9 +16,9 @@ #include +#include "ingen/Log.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" -#include "raul/log.hpp" #include "BufferFactory.hpp" #include "EdgeImpl.hpp" @@ -216,7 +216,6 @@ PatchImpl::remove_edge(const PortImpl* tail, const PortImpl* dst_port) _edges.erase(i); return c; } else { - Raul::error << "[PatchImpl::remove_edge] Edge not found" << endl; return SharedPtr(); } } @@ -248,7 +247,8 @@ PatchImpl::create_port(BufferFactory& bufs, bool polyphonic) { if (type == PortType::UNKNOWN) { - Raul::error << "[PatchImpl::create_port] Unknown port type " << type.uri() << endl; + bufs.engine().log().error(Raul::fmt("Unknown port type %1%\n") + % type.uri()); return NULL; } @@ -369,7 +369,7 @@ PatchImpl::compile() } if (compiled_patch->size() != _nodes.size()) { - Raul::error(Raul::fmt("Failed to compile patch %1%\n") % _path); + _engine.log().error(Raul::fmt("Failed to compile patch %1%\n") % _path); delete compiled_patch; return NULL; } diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp index 9f255081..e8c51335 100644 --- a/src/server/Worker.cpp +++ b/src/server/Worker.cpp @@ -15,8 +15,8 @@ */ #include "ingen/LV2Features.hpp" +#include "ingen/Log.hpp" #include "lv2/lv2plug.in/ns/ext/worker/worker.h" -#include "raul/log.hpp" #include "Driver.hpp" #include "Engine.hpp" @@ -51,18 +51,19 @@ Worker::request(LV2Node* node, uint32_t size, const void* data) { + Engine& engine = node->parent_patch()->engine(); if (_requests.write_space() < sizeof(MessageHeader) + size) { - Raul::error("Work request ring overflow\n"); + engine.log().error("Work request ring overflow\n"); return LV2_WORKER_ERR_NO_SPACE; } const MessageHeader msg = { node, size }; if (_requests.write(sizeof(msg), &msg) != sizeof(msg)) { - Raul::error("Error writing header to work request ring\n"); + engine.log().error("Error writing header to work request ring\n"); return LV2_WORKER_ERR_UNKNOWN; } if (_requests.write(size, data) != size) { - Raul::error("Error writing body to work request ring\n"); + engine.log().error("Error writing body to work request ring\n"); return LV2_WORKER_ERR_UNKNOWN; } @@ -99,9 +100,10 @@ Worker::Schedule::feature(World* world, GraphObject* n) } -Worker::Worker(uint32_t buffer_size) +Worker::Worker(Log& log, uint32_t buffer_size) : Raul::Thread() , _schedule(new Schedule()) + , _log(log) , _sem(0) , _requests(buffer_size) , _responses(buffer_size) @@ -123,17 +125,17 @@ Worker::_run() MessageHeader msg; if (_requests.read_space() > sizeof(msg)) { if (_requests.read(sizeof(msg), &msg) != sizeof(msg)) { - Raul::error("Error reading header from work request ring\n"); + _log.error("Error reading header from work request ring\n"); continue; } if (msg.size >= _buffer_size - sizeof(msg)) { - Raul::error("Corrupt work request ring\n"); + _log.error("Corrupt work request ring\n"); return; } if (_requests.read(msg.size, _buffer) != msg.size) { - Raul::error("Error reading body from work request ring\n"); + _log.error("Error reading body from work request ring\n"); continue; } diff --git a/src/server/Worker.hpp b/src/server/Worker.hpp index 25300502..0310de90 100644 --- a/src/server/Worker.hpp +++ b/src/server/Worker.hpp @@ -24,6 +24,9 @@ #include "raul/Thread.hpp" namespace Ingen { + +class Log; + namespace Server { class LV2Node; @@ -31,7 +34,7 @@ class LV2Node; class Worker : public Raul::Thread { public: - Worker(uint32_t buffer_size); + Worker(Log& log, uint32_t buffer_size); ~Worker(); struct Schedule : public LV2Features::Feature { @@ -47,6 +50,7 @@ public: private: SharedPtr _schedule; + Log& _log; Raul::Semaphore _sem; Raul::RingBuffer _requests; Raul::RingBuffer _responses; diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 17ef8d45..1120af92 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -35,10 +35,8 @@ #include "PortType.hpp" #include "SetPortValue.hpp" -#define LOG(s) s << "[Delta] " - // #define DUMP 1 -#include "ingen/URIMap.hpp" +// #include "ingen/URIMap.hpp" namespace Ingen { namespace Server { @@ -75,20 +73,22 @@ Delta::Delta(Engine& engine, } #ifdef DUMP - LOG(Raul::info) << "Delta " << subject << " : " << context << " {" << std::endl; + std::cerr << "Delta " << subject << " : " << context << " {" << std::endl; typedef Resource::Properties::const_iterator iterator; for (iterator i = properties.begin(); i != properties.end(); ++i) { - LOG(Raul::info) << " + " << i->first - << " = " << engine.world()->forge().str(i->second) - << " :: " << engine.world()->uri_map().unmap_uri(i->second.type()) << std::endl; + std::cerr << " + " << i->first + << " = " << engine.world()->forge().str(i->second) + << " :: " << engine.world()->uri_map().unmap_uri(i->second.type()) + << std::endl; } typedef Resource::Properties::const_iterator iterator; for (iterator i = remove.begin(); i != remove.end(); ++i) { - LOG(Raul::info) << " - " << i->first - << " = " << engine.world()->forge().str(i->second) - << " :: " << engine.world()->uri_map().unmap_uri(i->second.type()) << std::endl; + std::cerr << " - " << i->first + << " = " << engine.world()->forge().str(i->second) + << " :: " << engine.world()->uri_map().unmap_uri(i->second.type()) + << std::endl; } - LOG(Raul::info) << "}" << std::endl; + std::cerr << "}" << std::endl; #endif } diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 5b756d84..9e1e9531 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -21,7 +21,6 @@ #include "ingen/Store.hpp" #include "raul/Maid.hpp" #include "raul/Path.hpp" -#include "raul/log.hpp" #include "Broadcaster.hpp" #include "Buffer.hpp" diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index 38b36a7c..d81a38f7 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -18,7 +18,6 @@ #include "ingen/Store.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" -#include "raul/log.hpp" #include "Broadcaster.hpp" #include "Buffer.hpp" diff --git a/src/server/ingen_engine.cpp b/src/server/ingen_engine.cpp index 3a0d4324..d0311cae 100644 --- a/src/server/ingen_engine.cpp +++ b/src/server/ingen_engine.cpp @@ -24,7 +24,7 @@ using namespace Ingen; struct IngenEngineModule : public Ingen::Module { virtual void load(Ingen::World* world) { - Server::set_denormal_flags(); + Server::set_denormal_flags(world->log()); SharedPtr engine(new Server::Engine(world)); world->set_engine(engine); if (!world->interface()) { diff --git a/src/server/ingen_jack.cpp b/src/server/ingen_jack.cpp index 6019d1d8..ec690756 100644 --- a/src/server/ingen_jack.cpp +++ b/src/server/ingen_jack.cpp @@ -19,8 +19,8 @@ #include "ingen/Configuration.hpp" #include "ingen/Module.hpp" #include "ingen/World.hpp" +#include "ingen/Log.hpp" #include "raul/Configuration.hpp" -#include "raul/log.hpp" #include "JackDriver.hpp" #include "Engine.hpp" @@ -31,7 +31,7 @@ using namespace Ingen; struct IngenJackModule : public Ingen::Module { void load(Ingen::World* world) { if (((Server::Engine*)world->engine().get())->driver()) { - Raul::warn << "Engine already has a driver" << std::endl; + world->log().warn("Engine already has a driver\n"); return; } diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index 095e0fd6..100e1a4c 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -26,11 +26,13 @@ #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "lv2/lv2plug.in/ns/ext/buf-size/buf-size.h" +#include "lv2/lv2plug.in/ns/ext/log/log.h" #include "lv2/lv2plug.in/ns/ext/state/state.h" #include "lv2/lv2plug.in/ns/ext/urid/urid.h" #include "lv2/lv2plug.in/ns/lv2core/lv2.h" #include "ingen/Interface.hpp" +#include "ingen/Log.hpp" #include "ingen/serialisation/Parser.hpp" #include "ingen/serialisation/Serialiser.hpp" #include "ingen/AtomReader.hpp" @@ -41,7 +43,6 @@ #include "raul/Semaphore.hpp" #include "raul/SharedPtr.hpp" #include "raul/Thread.hpp" -#include "raul/log.hpp" #include "Buffer.hpp" #include "Driver.hpp" @@ -92,6 +93,7 @@ public: , _main_sem(0) , _reader(engine.world()->uri_map(), engine.world()->uris(), + engine.world()->log(), engine.world()->forge(), *engine.world()->interface().get()) , _writer(engine.world()->uri_map(), @@ -132,7 +134,7 @@ public: if (!patch_buf->append_event( ev->time.frames, ev->body.size, ev->body.type, (const uint8_t*)LV2_ATOM_BODY(&ev->body))) { - Raul::warn("Failed to write to buffer, event lost!\n"); + _engine.log().warn("Failed to write to buffer, event lost!\n"); } if (AtomReader::is_message(uris, &ev->body)) { @@ -233,7 +235,7 @@ public: void enqueue_message(const LV2_Atom* atom) { if (_from_ui.write(lv2_atom_total_size(atom), atom) == 0) { #ifndef NDEBUG - Raul::error << "Control input buffer overflow" << std::endl; + _engine.log().error("Control input buffer overflow\n"); #endif } } @@ -260,7 +262,7 @@ public: for (uint32_t read = 0; read < read_space;) { LV2_Atom atom; if (!_from_ui.read(sizeof(LV2_Atom), &atom)) { - Raul::error << "Error reading head from from-UI ring" << std::endl; + _engine.log().error("Error reading head from from-UI ring\n"); break; } @@ -268,7 +270,7 @@ public: memcpy(buf, &atom, sizeof(LV2_Atom)); if (!_from_ui.read(atom.size, (char*)buf + sizeof(LV2_Atom))) { - Raul::error << "Error reading body from from-UI ring" << std::endl; + _engine.log().error("Error reading body from from-UI ring\n"); break; } @@ -283,7 +285,7 @@ public: LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)_ports[1]->buffer(); if (!seq) { - Raul::error << "Control out port not connected" << std::endl; + _engine.log().error("Control out port not connected\n"); return; } @@ -298,7 +300,7 @@ public: for (uint32_t read = 0; read < read_space;) { LV2_Atom atom; if (!_to_ui.peek(sizeof(LV2_Atom), &atom)) { - Raul::error << "Error reading head from to-UI ring" << std::endl; + _engine.log().error("Error reading head from to-UI ring\n"); break; } @@ -314,7 +316,7 @@ public: _to_ui.skip(sizeof(LV2_Atom)); if (!_to_ui.read(ev->body.size, LV2_ATOM_BODY(&ev->body))) { - Raul::error << "Error reading body from to-UI ring" << std::endl; + _engine.log().error("Error reading body from to-UI ring\n"); break; } @@ -432,8 +434,6 @@ find_patches(const Glib::ustring& manifest_uri) patches.push_back(boost::shared_ptr( new LV2Patch(patch_uri, (const char*)file_path))); free(file_path); - } else { - Raul::error << "[Ingen] Patch has no rdfs:seeAlso" << std::endl; } } @@ -447,6 +447,23 @@ ingen_instantiate(const LV2_Descriptor* descriptor, const char* bundle_path, const LV2_Feature*const* features) { + // Get features from features array + LV2_URID_Map* map = NULL; + LV2_URID_Unmap* unmap = NULL; + LV2_Buf_Size_Access* access = NULL; + LV2_Log_Log* log = NULL; + for (int i = 0; features[i]; ++i) { + if (!strcmp(features[i]->URI, LV2_URID__map)) { + map = (LV2_URID_Map*)features[i]->data; + } else if (!strcmp(features[i]->URI, LV2_URID__unmap)) { + unmap = (LV2_URID_Unmap*)features[i]->data; + } else if (!strcmp(features[i]->URI, LV2_BUF_SIZE__access)) { + access = (LV2_Buf_Size_Access*)features[i]->data; + } else if (!strcmp(features[i]->URI, LV2_LOG__log)) { + log = (LV2_Log_Log*)features[i]->data; + } + } + if (!Glib::thread_supported()) { Glib::thread_init(); } @@ -464,25 +481,23 @@ ingen_instantiate(const LV2_Descriptor* descriptor, } if (!patch) { - Raul::error << "Could not find patch " << descriptor->URI << std::endl; - return NULL; - } - - IngenPlugin* plugin = new IngenPlugin(); - LV2_URID_Unmap* unmap = NULL; - LV2_Buf_Size_Access* access = NULL; - for (int i = 0; features[i]; ++i) { - if (!strcmp(features[i]->URI, LV2_URID__map)) { - plugin->map = (LV2_URID_Map*)features[i]->data; - } else if (!strcmp(features[i]->URI, LV2_URID__unmap)) { - unmap = (LV2_URID_Unmap*)features[i]->data; - } else if (!strcmp(features[i]->URI, LV2_BUF_SIZE__access)) { - access = (LV2_Buf_Size_Access*)features[i]->data; + const std::string msg((Raul::fmt("Could not find patch %1%\n") + % descriptor->URI).str()); + if (log) { + log->vprintf(log->handle, + map->map(map->handle, LV2_LOG__Error), + msg.c_str(), + NULL); + } else { + std::cerr << msg.c_str() << std::endl; } + return NULL; } + IngenPlugin* plugin = new IngenPlugin(); + plugin->map = map; plugin->world = new Ingen::World( - plugin->argc, plugin->argv, plugin->map, unmap); + plugin->argc, plugin->argv, map, unmap, log); if (!plugin->world->load_module("serialisation")) { delete plugin->world; return NULL; @@ -497,10 +512,12 @@ ingen_instantiate(const LV2_Descriptor* descriptor, access->get_buf_size( access->handle, &seq_size, plugin->world->uris().atom_Sequence, block_length); - Raul::info(Raul::fmt("Block length: %1% frames\n") % block_length); - Raul::info(Raul::fmt("Sequence size: %1% bytes\n") % seq_size); + plugin->world->log().info( + Raul::fmt("Block: %1% frames, Sequence: %2% bytes\n") + % block_length % seq_size); } else { - Raul::warn("Warning: No buffer size access, guessing 4096 frames.\n"); + plugin->world->log().warn( + "No buffer size access, guessing 4096 frames\n"); } SharedPtr engine(new Server::Engine(plugin->world)); @@ -559,7 +576,8 @@ ingen_connect_port(LV2_Handle instance, uint32_t port, void* data) assert(driver->ports().at(port)->patch_port()->index() == port); assert(driver->ports().at(port)->buffer() == data); } else { - Raul::warn << "Connect to non-existent port " << port << std::endl; + engine->log().warn(Raul::fmt("Connect to non-existent port %1%\n") + % port); } } @@ -629,8 +647,7 @@ ingen_save(LV2_Handle instance, LV2_State_Make_Path* make_path = NULL; get_state_features(features, &map_path, &make_path); if (!map_path || !make_path || !plugin->map) { - Raul::error << "Missing state:mapPath, state:makePath, or urid:Map." - << std::endl; + plugin->world->log().error("Missing state:mapPath, state:makePath, or urid:Map\n"); return LV2_STATE_ERR_NO_FEATURE; } @@ -668,7 +685,7 @@ ingen_restore(LV2_Handle instance, LV2_State_Map_Path* map_path = NULL; get_state_features(features, &map_path, NULL); if (!map_path) { - Raul::error << "Missing state:mapPath" << std::endl; + plugin->world->log().error("Missing state:mapPath\n"); return LV2_STATE_ERR_NO_FEATURE; } @@ -682,7 +699,7 @@ ingen_restore(LV2_Handle instance, &size, &type, &valflags); if (!path) { - Raul::error << "Failed to restore ingen:file" << std::endl; + plugin->world->log().error("Failed to restore ingen:file\n"); return LV2_STATE_ERR_NO_PROPERTY; } diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp index d64f7a8f..26799260 100644 --- a/src/server/internals/Delay.cpp +++ b/src/server/internals/Delay.cpp @@ -21,7 +21,6 @@ #include "ingen/URIs.hpp" #include "raul/Array.hpp" #include "raul/Maid.hpp" -#include "raul/log.hpp" #include "Buffer.hpp" #include "Driver.hpp" @@ -34,8 +33,6 @@ #include "internals/Delay.hpp" #include "util.hpp" -#define LOG(s) s << "[DelayNode] " - #define CALC_DELAY(delaytime) \ (f_clamp (delaytime * (float)sample_rate, 1.0f, (float)(buffer_mask + 1))) diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp index 81562f83..25e8aee5 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -21,7 +21,6 @@ #include "lv2/lv2plug.in/ns/ext/midi/midi.h" #include "raul/Array.hpp" #include "raul/Maid.hpp" -#include "raul/log.hpp" #include "Buffer.hpp" #include "Driver.hpp" @@ -34,8 +33,6 @@ #include "internals/Note.hpp" #include "util.hpp" -#define LOG(s) s << "[NoteNode] " - // #define NOTE_DEBUG 1 using namespace std; @@ -190,9 +187,6 @@ NoteNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity, F uint32_t voice_num = 0; if (key->state != Key::OFF) { -#ifdef NOTE_DEBUG - LOG(Raul::debug) << "Double midi note received" << endl; -#endif return; } @@ -221,19 +215,11 @@ NoteNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity, F assert(voice != NULL); assert(voice == &(*_voices)[voice_num]); -#ifdef NOTE_DEBUG - LOG(Raul::debug) << "Note " << (int)note_num << " on @ " << time - << ". Voice " << voice_num << " / " << _polyphony << endl; -#endif - // Update stolen key, if applicable if (voice->state == Voice::Voice::ACTIVE) { assert(_keys[voice->note].state == Key::ON_ASSIGNED); assert(_keys[voice->note].voice == voice_num); _keys[voice->note].state = Key::Key::ON_UNASSIGNED; -#ifdef NOTE_DEBUG - LOG(Raul::debug) << "Stole voice " << voice_num << endl; -#endif } // Store key information for later reallocation on note off @@ -268,31 +254,15 @@ NoteNode::note_off(ProcessContext& context, uint8_t note_num, FrameTime time) Key* key = &_keys[note_num]; -#ifdef NOTE_DEBUG - LOG(Raul::debug) << "Note " << (int)note_num << " off @ " << time << endl; -#endif - if (key->state == Key::ON_ASSIGNED) { // Assigned key, turn off voice and key if ((*_voices)[key->voice].state == Voice::ACTIVE) { assert((*_voices)[key->voice].note == note_num); - if ( ! _sustain) { -#ifdef NOTE_DEBUG - LOG(Raul::debug) << "Free voice " << key->voice << endl; -#endif free_voice(context, key->voice, time); } else { -#ifdef NOTE_DEBUG - LOG(Raul::debug) << "Hold voice " << key->voice << endl; -#endif (*_voices)[key->voice].state = Voice::HOLDING; } - - } else { -#ifdef NOTE_DEBUG - LOG(Raul::debug) << "WARNING: Assigned key, but voice not active" << endl; -#endif } } @@ -331,9 +301,6 @@ NoteNode::free_voice(ProcessContext& context, uint32_t voice, FrameTime time) (*_voices)[voice].state = Voice::ACTIVE; } else { // No new note for voice, deactivate (set gate low) -#ifdef NOTE_DEBUG - LOG(Raul::debug) << "Note off: key " << (int)(*_voices)[voice].note << " voice " << voice << endl; -#endif _gate_port->set_voice_value(context, voice, time, 0.0f); (*_voices)[voice].state = Voice::FREE; } @@ -344,10 +311,6 @@ NoteNode::all_notes_off(ProcessContext& context, FrameTime time) { assert(time >= context.start() && time <= context.end()); -#ifdef NOTE_DEBUG - LOG(Raul::debug) << "All notes off @ " << time << endl; -#endif - // FIXME: set all keys to Key::OFF? for (uint32_t i = 0; i < _polyphony; ++i) { diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index 81361bb8..f7bbd4c5 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -19,7 +19,6 @@ #include "ingen/URIs.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" #include "lv2/lv2plug.in/ns/ext/midi/midi.h" -#include "raul/log.hpp" #include "Buffer.hpp" #include "Engine.hpp" @@ -31,8 +30,6 @@ #include "internals/Trigger.hpp" #include "util.hpp" -#define LOG(s) s << "[TriggerNode] " - using namespace std; namespace Ingen { @@ -140,10 +137,6 @@ TriggerNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity _learning = false; } -#ifdef RAUL_LOG_DEBUG - LOG(Raul::debug) << path() << " note " << (int)note_num << " on @ " << time << endl; -#endif - Sample filter_note = _note_port->buffer(0)->value_at(0); if (filter_note >= 0.0 && filter_note < 127.0 && (note_num == (uint8_t)filter_note)) { _gate_port->set_control_value(context, time, 1.0f); diff --git a/src/server/mix.cpp b/src/server/mix.cpp index 773b2aa7..c4fbbed5 100644 --- a/src/server/mix.cpp +++ b/src/server/mix.cpp @@ -16,8 +16,6 @@ #include "lv2/lv2plug.in/ns/ext/atom/util.h" -#include "raul/log.hpp" - #include "Buffer.hpp" #include "Context.hpp" #include "mix.hpp" diff --git a/src/server/util.hpp b/src/server/util.hpp index 8f5a39ee..106d09de 100644 --- a/src/server/util.hpp +++ b/src/server/util.hpp @@ -19,7 +19,7 @@ #include -#include "raul/log.hpp" +#include "ingen/Log.hpp" #include "raul/Path.hpp" #include "ingen_config.h" @@ -35,48 +35,17 @@ # define REALTIME #endif -#ifdef USE_ASSEMBLY -# if SIZEOF_VOID_P==8 -# define cpuid(a, b, c, d, n) asm("xchgq %%rbx, %1; cpuid; xchgq %%rbx, %1": "=a" (a), "=r" (b), "=c" (c), "=d" (d) : "a" (n)); -# else -# define cpuid(a, b, c, d, n) asm("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1": "=a" (a), "=r" (b), "=c" (c), "=d" (d) : "a" (n)); -# endif -#endif - namespace Ingen { namespace Server { /** Set flags to disable denormal processing. */ inline void -set_denormal_flags() +set_denormal_flags(Ingen::Log& log) { -#ifdef USE_ASSEMBLY #ifdef __SSE__ - unsigned long a, b, c, d0, d1; - cpuid(a, b, c, d1, 1); - if (d1 & 1<<25) { /* It has SSE support */ - _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); - const int family = (a >> 8) & 0xF; - const int extfamily = (a >> 20) & 0xFF; - const int model = (a >> 4) & 0xF; - const int stepping = a & 0xF; - cpuid(a, b, c, d0, 0); - if (b == 0x756e6547) { /* It's an Intel */ - if (family == 15 && extfamily == 0 && model == 0 && stepping < 7) { - return; - } - } - if (d1 & 1<<26) { /* bit 26, SSE2 support */ - _mm_setcsr(_mm_getcsr() | 0x8040); // set DAZ and FZ bits of MXCSR - Raul::info << "Set SSE denormal fix flag" << endl; - } - } else { - Raul::warn << "This code has been built with SSE support, but your processor does" - << " not support the SSE instruction set, exiting." << std::endl; - exit(EXIT_FAILURE); - } -#endif + _mm_setcsr(_mm_getcsr() | 0x8040); + log.info("Set SSE denormal-are-zero and flush-to-zero flags\n"); #endif } -- cgit v1.2.1