summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-01-06 23:49:17 +0000
committerDavid Robillard <d@drobilla.net>2010-01-06 23:49:17 +0000
commitcb5e934666e128e27faa95587fbdecf01f0e324d (patch)
tree1e694e2812381efbb3eb4b5ace2cdecc118b29f6 /src/engine
parent092eb35edb999a9dd809e197d7dd9a4ebb0d6bd5 (diff)
downloadingen-cb5e934666e128e27faa95587fbdecf01f0e324d.tar.gz
ingen-cb5e934666e128e27faa95587fbdecf01f0e324d.tar.bz2
ingen-cb5e934666e128e27faa95587fbdecf01f0e324d.zip
Do all logging output via Raul streams.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2349 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/AudioBuffer.cpp6
-rw-r--r--src/engine/AudioBuffer.hpp1
-rw-r--r--src/engine/BufferFactory.cpp8
-rw-r--r--src/engine/ClientBroadcaster.cpp12
-rw-r--r--src/engine/CompiledPatch.hpp1
-rw-r--r--src/engine/ConnectionImpl.cpp15
-rw-r--r--src/engine/ConnectionImpl.hpp1
-rw-r--r--src/engine/DuplexPort.cpp1
-rw-r--r--src/engine/Engine.cpp5
-rw-r--r--src/engine/EngineStore.cpp19
-rw-r--r--src/engine/EventBuffer.cpp11
-rw-r--r--src/engine/EventSink.cpp1
-rw-r--r--src/engine/HTTPClientSender.cpp3
-rw-r--r--src/engine/HTTPClientSender.hpp1
-rw-r--r--src/engine/HTTPEngineReceiver.cpp6
-rw-r--r--src/engine/InputPort.cpp3
-rw-r--r--src/engine/InternalPlugin.hpp1
-rw-r--r--src/engine/JackDriver.cpp31
-rw-r--r--src/engine/LADSPANode.cpp12
-rw-r--r--src/engine/LADSPAPlugin.cpp5
-rw-r--r--src/engine/LADSPAPlugin.hpp1
-rw-r--r--src/engine/LV2Info.cpp1
-rw-r--r--src/engine/LV2Node.cpp16
-rw-r--r--src/engine/LV2Plugin.cpp2
-rw-r--r--src/engine/LV2Plugin.hpp1
-rw-r--r--src/engine/LV2ResizeFeature.hpp5
-rw-r--r--src/engine/MessageContext.cpp7
-rw-r--r--src/engine/NodeBase.cpp11
-rw-r--r--src/engine/NodeFactory.cpp28
-rw-r--r--src/engine/OSCClientSender.cpp6
-rw-r--r--src/engine/OSCClientSender.hpp1
-rw-r--r--src/engine/OSCEngineReceiver.cpp26
-rw-r--r--src/engine/ObjectBuffer.cpp6
-rw-r--r--src/engine/ObjectSender.cpp2
-rw-r--r--src/engine/OutputPort.cpp3
-rw-r--r--src/engine/PatchImpl.cpp18
-rw-r--r--src/engine/PluginImpl.cpp7
-rw-r--r--src/engine/PluginImpl.hpp1
-rw-r--r--src/engine/PortImpl.cpp1
-rw-r--r--src/engine/PostProcessor.cpp5
-rw-r--r--src/engine/ProcessSlave.cpp1
-rw-r--r--src/engine/QueuedEngineInterface.cpp10
-rw-r--r--src/engine/QueuedEventSource.cpp1
-rw-r--r--src/engine/events/CreatePort.cpp4
-rw-r--r--src/engine/events/Disconnect.cpp8
-rw-r--r--src/engine/events/SetMetadata.cpp3
-rw-r--r--src/engine/events/SetPortValue.cpp11
-rw-r--r--src/engine/ingen_http.cpp1
-rw-r--r--src/engine/ingen_jack.cpp1
-rw-r--r--src/engine/ingen_osc.cpp7
-rw-r--r--src/engine/internals/Controller.cpp2
-rw-r--r--src/engine/internals/Note.cpp57
-rw-r--r--src/engine/internals/Trigger.cpp11
-rw-r--r--src/engine/mix.hpp6
-rw-r--r--src/engine/util.hpp12
55 files changed, 209 insertions, 217 deletions
diff --git a/src/engine/AudioBuffer.cpp b/src/engine/AudioBuffer.cpp
index 693fa503..a1e10b63 100644
--- a/src/engine/AudioBuffer.cpp
+++ b/src/engine/AudioBuffer.cpp
@@ -15,9 +15,9 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
#include <cassert>
#include <stdlib.h>
+#include "raul/log.hpp"
#include "raul/SharedPtr.hpp"
#include "object.lv2/object.h"
#include "ingen-config.h"
@@ -27,6 +27,7 @@
#include "LV2URIMap.hpp"
using namespace std;
+using namespace Raul;
/* TODO: Be sure these functions are vectorized by GCC when its vectorizer
* stops sucking. Probably a good idea to inline them as well */
@@ -60,8 +61,7 @@ AudioBuffer::AudioBuffer(BufferFactory& factory, Shared::PortType type, size_t s
body->elem_count = size / sizeof(Sample);
body->elem_type = 0;//map->float_type;
}
-
- /*cout << "Created Audio Buffer" << endl
+ /*debug << "Created Audio Buffer" << endl
<< "\tobject @ " << (void*)object() << endl
<< "\tbody @ " << (void*)object()->body
<< "\t(offset " << (char*)object()->body - (char*)object() << ")" << endl
diff --git a/src/engine/AudioBuffer.hpp b/src/engine/AudioBuffer.hpp
index 38e4d293..c7ac5238 100644
--- a/src/engine/AudioBuffer.hpp
+++ b/src/engine/AudioBuffer.hpp
@@ -18,7 +18,6 @@
#ifndef AUDIOBUFFER_H
#define AUDIOBUFFER_H
-#include <iostream>
#include <cstddef>
#include <cassert>
#include <boost/utility.hpp>
diff --git a/src/engine/BufferFactory.cpp b/src/engine/BufferFactory.cpp
index 02104b92..86862ef8 100644
--- a/src/engine/BufferFactory.cpp
+++ b/src/engine/BufferFactory.cpp
@@ -16,7 +16,7 @@
*/
#include <algorithm>
-#include <iostream>
+#include "raul/log.hpp"
#include "shared/LV2URIMap.hpp"
#include "AudioBuffer.hpp"
#include "EventBuffer.hpp"
@@ -26,6 +26,8 @@
#include "Driver.hpp"
#include "ThreadManager.hpp"
+using namespace Raul;
+
namespace Ingen {
using namespace Shared;
@@ -65,7 +67,7 @@ BufferFactory::get(Shared::PortType type, size_t size, bool force_create)
if (ThreadManager::current_thread_id() != THREAD_PROCESS) {
return create(type, size);
} else {
- cerr << "ERROR: Failed to obtain buffer" << endl;
+ error << "Failed to obtain buffer" << endl;
return Ref();
}
}
@@ -105,7 +107,7 @@ BufferFactory::create(Shared::PortType type, size_t size)
size = 32; // FIXME
buffer = new ObjectBuffer(*this, std::max(size, sizeof(LV2_Object) + sizeof(void*)));
} else {
- cout << "ERROR: Failed to create buffer of unknown type" << endl;
+ error << "Failed to create buffer of unknown type" << endl;
return Ref();
}
diff --git a/src/engine/ClientBroadcaster.cpp b/src/engine/ClientBroadcaster.cpp
index fa19e2f1..fcae666f 100644
--- a/src/engine/ClientBroadcaster.cpp
+++ b/src/engine/ClientBroadcaster.cpp
@@ -16,8 +16,8 @@
*/
#include <cassert>
-#include <iostream>
#include <unistd.h>
+#include "raul/log.hpp"
#include "interface/ClientInterface.hpp"
#include "ClientBroadcaster.hpp"
#include "PluginImpl.hpp"
@@ -26,6 +26,8 @@
#include "ObjectSender.hpp"
#include "util.hpp"
+#define LOG(s) s << "[ClientBroadcaster] "
+
using namespace std;
using namespace Raul;
using Ingen::Shared::ClientInterface;
@@ -42,9 +44,9 @@ ClientBroadcaster::register_client(const URI& uri, ClientInterface* client)
if (i == _clients.end()) {
_clients[uri] = client;
- cout << "[ClientBroadcaster] Registered client: " << uri << endl;
+ LOG(info) << "Registered client: " << uri << endl;
} else {
- cout << "[ClientBroadcaster] Client already registered: " << uri << endl;
+ LOG(warn) << "Client already registered: " << uri << endl;
}
}
@@ -59,9 +61,9 @@ ClientBroadcaster::unregister_client(const URI& uri)
size_t erased = _clients.erase(uri);
if (erased > 0)
- cout << "Unregistered client: " << uri << endl;
+ LOG(info) << "Unregistered client: " << uri << endl;
else
- cout << "Failed to find client to unregister: " << uri << endl;
+ LOG(warn) << "Failed to find client to unregister: " << uri << endl;
return (erased > 0);
}
diff --git a/src/engine/CompiledPatch.hpp b/src/engine/CompiledPatch.hpp
index 5444085c..ef12bcd6 100644
--- a/src/engine/CompiledPatch.hpp
+++ b/src/engine/CompiledPatch.hpp
@@ -18,7 +18,6 @@
#ifndef COMPILED_PATCH_HPP
#define COMPILED_PATCH_HPP
-#include <iostream>
#include <vector>
#include "raul/List.hpp"
#include "raul/Deletable.hpp"
diff --git a/src/engine/ConnectionImpl.cpp b/src/engine/ConnectionImpl.cpp
index 47fdce36..a266a5ef 100644
--- a/src/engine/ConnectionImpl.cpp
+++ b/src/engine/ConnectionImpl.cpp
@@ -16,6 +16,7 @@
*/
#include <algorithm>
+#include "raul/log.hpp"
#include "raul/Maid.hpp"
#include "raul/IntrusivePtr.hpp"
#include "AudioBuffer.hpp"
@@ -65,7 +66,7 @@ ConnectionImpl::ConnectionImpl(BufferFactory& bufs, PortImpl* src_port, PortImpl
void
ConnectionImpl::dump() const
{
- cerr << _src_port->path() << " -> " << _dst_port->path()
+ debug << _src_port->path() << " -> " << _dst_port->path()
<< (must_mix() ? " (MIX) " : " (DIRECT) ")
<< (must_queue() ? " (QUEUE)" : " (NOQUEUE)") << endl;
}
@@ -106,13 +107,13 @@ ConnectionImpl::process(Context& context)
if (must_queue()) {
IntrusivePtr<EventBuffer> src_buf = PtrCast<EventBuffer>(_src_port->buffer(0));
if (!src_buf) {
- cerr << "ERROR: Queued connection but source is not an EventBuffer" << endl;
+ error << "Queued connection but source is not an EventBuffer" << endl;
return;
}
IntrusivePtr<ObjectBuffer> local_buf = PtrCast<ObjectBuffer>(_local_buffer);
if (!local_buf) {
- cerr << "ERROR: Queued connection but local buffer is not an ObjectBuffer" << endl;
+ error << "Queued connection but local buffer is not an ObjectBuffer" << endl;
return;
}
@@ -141,18 +142,18 @@ ConnectionImpl::queue(Context& context)
IntrusivePtr<EventBuffer> src_buf = PtrCast<EventBuffer>(_src_port->buffer(0));
if (!src_buf) {
- cerr << "ERROR: Queued connection but source is not an EventBuffer" << endl;
+ error << "Queued connection but source is not an EventBuffer" << endl;
return;
}
while (src_buf->is_valid()) {
LV2_Event* ev = src_buf->get_event();
LV2_Object* obj = LV2_OBJECT_FROM_EVENT(ev);
- /*cout << _src_port->path() << " -> " << _dst_port->path()
+ /*debug << _src_port->path() << " -> " << _dst_port->path()
<< " QUEUE OBJECT TYPE " << obj->type << ":";
for (size_t i = 0; i < obj->size; ++i)
- cout << " " << std::hex << (int)obj->body[i];
- cout << endl;*/
+ debug << " " << std::hex << (int)obj->body[i];
+ debug << endl;*/
_queue->write(sizeof(LV2_Object) + obj->size, obj);
src_buf->increment();
diff --git a/src/engine/ConnectionImpl.hpp b/src/engine/ConnectionImpl.hpp
index 63d2ecc4..00770047 100644
--- a/src/engine/ConnectionImpl.hpp
+++ b/src/engine/ConnectionImpl.hpp
@@ -18,7 +18,6 @@
#ifndef CONNECTIONIMPL_H
#define CONNECTIONIMPL_H
-#include <iostream>
#include <cstdlib>
#include <boost/utility.hpp>
#include "raul/Deletable.hpp"
diff --git a/src/engine/DuplexPort.cpp b/src/engine/DuplexPort.cpp
index 997c4e29..775e82b3 100644
--- a/src/engine/DuplexPort.cpp
+++ b/src/engine/DuplexPort.cpp
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
#include <cstdlib>
#include <cassert>
#include "util.hpp"
diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp
index 9a8bd182..bee2cec7 100644
--- a/src/engine/Engine.cpp
+++ b/src/engine/Engine.cpp
@@ -17,8 +17,8 @@
#include <cassert>
#include <sys/mman.h>
-#include <iostream>
#include <unistd.h>
+#include "raul/log.hpp"
#include "raul/Deletable.hpp"
#include "raul/Maid.hpp"
#include "raul/SharedPtr.hpp"
@@ -48,6 +48,7 @@
#include "tuning.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
@@ -111,7 +112,7 @@ Engine::main()
nanosleep(&main_rate, NULL);
main_iteration();
}
- cout << "[Main] Done main loop." << endl;
+ info << "Finished main loop" << endl;
deactivate();
diff --git a/src/engine/EngineStore.cpp b/src/engine/EngineStore.cpp
index 1d5e774b..1d17bb48 100644
--- a/src/engine/EngineStore.cpp
+++ b/src/engine/EngineStore.cpp
@@ -17,6 +17,7 @@
#include <utility>
#include <vector>
+#include "raul/log.hpp"
#include "raul/List.hpp"
#include "raul/PathTable.hpp"
#include "raul/TableImpl.hpp"
@@ -26,6 +27,8 @@
#include "PortImpl.hpp"
#include "ThreadManager.hpp"
+#define LOG(s) s << "[EngineStore] "
+
using namespace std;
using namespace Raul;
@@ -88,14 +91,7 @@ void
EngineStore::add(const Objects& table)
{
assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS);
-
- //cerr << "[EngineStore] Adding " << o[0].second->path() << endl;
cram(table);
-
- /*cerr << "[EngineStore] Adding Table:" << endl;
- for (const_iterator i = table.begin(); i != table.end(); ++i) {
- cerr << i->first << " = " << i->second->path() << endl;
- }*/
}
@@ -123,17 +119,12 @@ EngineStore::remove(iterator object)
if (object != end()) {
iterator descendants_end = find_descendants_end(object);
- //cout << "[EngineStore] Removing " << object->first << " {" << endl;
SharedPtr<Objects> removed = yank(object, descendants_end);
- /*for (iterator i = removed->begin(); i != removed->end(); ++i) {
- cout << "\t" << i->first << endl;
- }
- cout << "}" << endl;*/
return removed;
} else {
- cerr << "[EngineStore] WARNING: Removing " << object->first << " failed." << endl;
+ LOG(warn) << "Removing " << object->first << " failed." << endl;
return SharedPtr<EngineStore>();
}
}
@@ -167,7 +158,7 @@ EngineStore::remove_children(iterator object)
return yank(first_child, descendants_end);
}
} else {
- cerr << "[EngineStore] WARNING: Removing children of " << object->first << " failed." << endl;
+ LOG(warn) << "Removing children of " << object->first << " failed." << endl;
return SharedPtr<EngineStore::Objects>();
}
diff --git a/src/engine/EventBuffer.cpp b/src/engine/EventBuffer.cpp
index 4f7f6b5f..6b27ef4e 100644
--- a/src/engine/EventBuffer.cpp
+++ b/src/engine/EventBuffer.cpp
@@ -17,7 +17,7 @@
#define __STDC_LIMIT_MACROS 1
#include <stdint.h>
-#include <iostream>
+#include "raul/log.hpp"
#include "event.lv2/event.h"
#include "event.lv2/event-helpers.h"
#include "ingen-config.h"
@@ -25,6 +25,7 @@
#include "ProcessContext.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
@@ -39,7 +40,7 @@ EventBuffer::EventBuffer(BufferFactory& factory, size_t capacity)
, _latest_subframes(0)
{
if (capacity > UINT32_MAX) {
- cerr << "Event buffer size " << capacity << " too large, aborting." << endl;
+ error << "Event buffer size " << capacity << " too large, aborting." << endl;
throw std::bad_alloc();
}
@@ -51,7 +52,7 @@ EventBuffer::EventBuffer(BufferFactory& factory, size_t capacity)
#endif
if (ret != 0) {
- cerr << "Failed to allocate event buffer. Aborting." << endl;
+ error << "Failed to allocate event buffer. Aborting." << endl;
exit(EXIT_FAILURE);
}
@@ -207,11 +208,11 @@ EventBuffer::append(uint32_t frames,
}
#endif
- /*cout << "Appending event type " << type << ", size " << size
+ /*debug << "Appending event type " << type << ", size " << size
<< " @ " << frames << "." << subframes << endl;*/
if (!lv2_event_write(&_iter, frames, subframes, type, size, data)) {
- cerr << "ERROR: Failed to write event." << endl;
+ error << "Failed to write event." << endl;
return false;
} else {
_latest_frames = frames;
diff --git a/src/engine/EventSink.cpp b/src/engine/EventSink.cpp
index 2bbdc595..0bbe3d83 100644
--- a/src/engine/EventSink.cpp
+++ b/src/engine/EventSink.cpp
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
#include "EventSink.hpp"
#include "PortImpl.hpp"
diff --git a/src/engine/HTTPClientSender.cpp b/src/engine/HTTPClientSender.cpp
index b6645f7d..891a7184 100644
--- a/src/engine/HTTPClientSender.cpp
+++ b/src/engine/HTTPClientSender.cpp
@@ -17,6 +17,7 @@
#include <string>
#include <libsoup/soup.h>
+#include "raul/log.hpp"
#include "raul/Atom.hpp"
#include "raul/AtomRDF.hpp"
#include "serialisation/Serialiser.hpp"
@@ -40,7 +41,7 @@ HTTPClientSender::response_ok(int32_t id)
void
HTTPClientSender::response_error(int32_t id, const std::string& msg)
{
- cout << "HTTP ERROR " << id << ": " << msg << endl;
+ warn << "HTTP Error " << id << " (" << msg << ")" << endl;
}
diff --git a/src/engine/HTTPClientSender.hpp b/src/engine/HTTPClientSender.hpp
index 30031252..81af61db 100644
--- a/src/engine/HTTPClientSender.hpp
+++ b/src/engine/HTTPClientSender.hpp
@@ -20,7 +20,6 @@
#include <cassert>
#include <string>
-#include <iostream>
#include <pthread.h>
#include "raul/Thread.hpp"
#include "interface/ClientInterface.hpp"
diff --git a/src/engine/HTTPEngineReceiver.cpp b/src/engine/HTTPEngineReceiver.cpp
index ecb8d018..8cc39ddb 100644
--- a/src/engine/HTTPEngineReceiver.cpp
+++ b/src/engine/HTTPEngineReceiver.cpp
@@ -15,11 +15,11 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <boost/format.hpp>
+#include "raul/log.hpp"
#include "raul/Atom.hpp"
#include "raul/SharedPtr.hpp"
#include "interface/ClientInterface.hpp"
@@ -51,7 +51,7 @@ HTTPEngineReceiver::HTTPEngineReceiver(Engine& engine, uint16_t port)
soup_server_add_handler(_server, NULL, message_callback, this, NULL);
- cout << "Started HTTP server on port " << soup_server_get_port(_server) << endl;
+ info << "Started HTTP server on port " << soup_server_get_port(_server) << endl;
Thread::set_name("HTTP Receiver");
if (!engine.world()->parser || !engine.world()->serialiser)
@@ -157,7 +157,7 @@ HTTPEngineReceiver::message_callback(SoupServer* server, SoupMessage* msg, const
}
if (!Path::is_valid(path)) {
- cerr << "HTTP BAD PATH: " << path << endl;
+ error << "Bad HTTP path: " << path << endl;
soup_message_set_status (msg, SOUP_STATUS_BAD_REQUEST);
const string& err = (boost::format("Bad path: %1%") % path).str();
soup_message_set_response(msg, "text/plain", SOUP_MEMORY_COPY,
diff --git a/src/engine/InputPort.cpp b/src/engine/InputPort.cpp
index 4a1a8136..6566ab2f 100644
--- a/src/engine/InputPort.cpp
+++ b/src/engine/InputPort.cpp
@@ -16,7 +16,6 @@
*/
#include "InputPort.hpp"
-#include <iostream>
#include <cstdlib>
#include <cassert>
#include "interface/Patch.hpp"
@@ -163,7 +162,7 @@ InputPort::remove_connection(const OutputPort* src_port)
connection = _connections.erase(i);
if ( ! connection) {
- cerr << "ERROR: [InputPort::remove_connection] Connection not found!" << endl;
+ error << "[InputPort::remove_connection] Connection not found!" << endl;
return NULL;
}
diff --git a/src/engine/InternalPlugin.hpp b/src/engine/InternalPlugin.hpp
index b7797b49..70f1ba27 100644
--- a/src/engine/InternalPlugin.hpp
+++ b/src/engine/InternalPlugin.hpp
@@ -29,7 +29,6 @@
#include <boost/utility.hpp>
#include <dlfcn.h>
#include <string>
-#include <iostream>
#include "PluginImpl.hpp"
#define NS_INTERNALS "http://drobilla.net/ns/ingen-internals#"
diff --git a/src/engine/JackDriver.cpp b/src/engine/JackDriver.cpp
index 9102cbe5..98523f43 100644
--- a/src/engine/JackDriver.cpp
+++ b/src/engine/JackDriver.cpp
@@ -15,9 +15,9 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
#include <cstdlib>
#include <jack/midiport.h>
+#include "raul/log.hpp"
#include "raul/List.hpp"
#include "shared/LV2Features.hpp"
#include "shared/LV2URIMap.hpp"
@@ -40,6 +40,8 @@
#include "tuning.hpp"
#include "util.hpp"
+#define LOG(s) s << "[JackDriver] "
+
using namespace std;
using namespace Raul;
@@ -83,7 +85,7 @@ JackPort::create()
0);
if (_jack_port == NULL) {
- cerr << "[JackPort] ERROR: Failed to register port " << _patch_port->path() << endl;
+ error << "[JackPort] Failed to register port " << _patch_port->path() << endl;
throw JackDriver::PortRegistrationFailedException();
}
}
@@ -94,7 +96,7 @@ JackPort::destroy()
{
assert(_jack_port);
if (jack_port_unregister(_driver->jack_client(), _jack_port))
- cerr << "[JackMidiPort] ERROR: Unable to unregister port" << endl;
+ error << "[JackPort] Unable to unregister port" << endl;
_jack_port = NULL;
}
@@ -134,7 +136,7 @@ JackPort::pre_process(ProcessContext& context)
jack_midi_event_get(&ev, jack_buf, i);
if (!patch_buf->append(ev.time, 0, _driver->_midi_event_type, ev.size, ev.buffer))
- cerr << "WARNING: Failed to write MIDI to port buffer, event(s) lost!" << endl;
+ LOG(warn) << "Failed to write MIDI to port buffer, event(s) lost!" << endl;
}
}
}
@@ -226,8 +228,7 @@ JackDriver::attach(const std::string& server_name,
_client = jack_client_open(client_name.c_str(),
JackServerName, NULL, server_name.c_str());
if (_client)
- cerr << "[JackDriver] Connected to JACK server '" <<
- server_name << "'" << endl;
+ LOG(info) << "Connected to JACK server '" << server_name << "'" << endl;
}
// Either server name not specified, or supplied server name does not exist
@@ -236,12 +237,12 @@ JackDriver::attach(const std::string& server_name,
_client = jack_client_open(client_name.c_str(), JackNullOption, NULL);
if (_client)
- cerr << "[JackDriver] Connected to default JACK server." << endl;
+ LOG(info) << "Connected to default JACK server." << endl;
}
// Still failed
if (!_client) {
- cerr << "[JackDriver] Unable to connect to Jack. Exiting." << endl;
+ LOG(error) << "Unable to connect to Jack. Exiting." << endl;
return false;
}
} else {
@@ -270,7 +271,7 @@ void
JackDriver::activate()
{
if (_is_activated) {
- cerr << "[JackDriver] Jack driver already activated." << endl;
+ LOG(warn) << "Jack driver already activated." << endl;
return;
}
@@ -283,10 +284,10 @@ JackDriver::activate()
_is_activated = true;
if (jack_activate(_client)) {
- cerr << "[JackDriver] Could not activate Jack client, aborting." << endl;
+ LOG(error) << "Could not activate Jack client, aborting." << endl;
exit(EXIT_FAILURE);
} else {
- cout << "[JackDriver] Activated Jack client." << endl;
+ LOG(info) << "Activated Jack client." << endl;
}
}
@@ -310,7 +311,7 @@ JackDriver::deactivate()
}
_jack_thread->stop();
- cout << "[JackDriver] Deactivated Jack client." << endl;
+ LOG(info) << "Deactivated Jack client." << endl;
}
}
@@ -348,7 +349,7 @@ JackDriver::remove_port(const Path& path)
if ((*i)->patch_port()->path() == path)
return (Raul::List<DriverPort*>::Node*)(_ports.erase(i));
- cerr << "[JackDriver::remove_port] WARNING: Unable to find port " << path << endl;
+ LOG(warn) << "Unable to find port " << path << endl;
return NULL;
}
@@ -466,7 +467,7 @@ JackDriver::_thread_init_cb()
void
JackDriver::_shutdown_cb()
{
- cout << "[JackDriver] Jack shutdown. Exiting." << endl;
+ LOG(info) << "Jack shutdown. Exiting." << endl;
_is_activated = false;
delete _jack_thread;
_jack_thread = NULL;
@@ -478,7 +479,7 @@ int
JackDriver::_sample_rate_cb(jack_nframes_t nframes)
{
if (_is_activated) {
- cerr << "[JackDriver] On-the-fly sample rate changing not supported (yet). Aborting." << endl;
+ LOG(error) << "On-the-fly sample rate changing not supported (yet). Aborting." << endl;
exit(EXIT_FAILURE);
} else {
_sample_rate = nframes;
diff --git a/src/engine/LADSPANode.cpp b/src/engine/LADSPANode.cpp
index 3d405b5c..d3db5a04 100644
--- a/src/engine/LADSPANode.cpp
+++ b/src/engine/LADSPANode.cpp
@@ -15,13 +15,13 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
#include <cassert>
#include <cmath>
#include <map>
#include <stdint.h>
-#include "raul/Maid.hpp"
#include <boost/optional.hpp>
+#include "raul/log.hpp"
+#include "raul/Maid.hpp"
#include "LADSPANode.hpp"
#include "AudioBuffer.hpp"
#include "InputPort.hpp"
@@ -75,7 +75,7 @@ LADSPANode::prepare_poly(BufferFactory& bufs, uint32_t poly)
for (uint32_t i = _polyphony; i < _prepared_instances->size(); ++i) {
_prepared_instances->at(i) = _descriptor->instantiate(_descriptor, _srate);
if (_prepared_instances->at(i) == NULL) {
- cerr << "Failed to instantiate plugin!" << endl;
+ error << "Failed to instantiate plugin" << endl;
return false;
}
@@ -154,7 +154,7 @@ LADSPANode::instantiate(BufferFactory& bufs)
for (uint32_t i=0; i < _polyphony; ++i) {
(*_instances)[i] = _descriptor->instantiate(_descriptor, _srate);
if ((*_instances)[i] == NULL) {
- cerr << "Failed to instantiate plugin!" << endl;
+ error << "Failed to instantiate plugin" << endl;
return false;
}
}
@@ -222,13 +222,13 @@ LADSPANode::instantiate(BufferFactory& bufs)
// Work around broke-ass crackhead plugins
if (default_val && default_val.get() < min.get()) {
- cerr << "WARNING: Broken LADSPA " << _descriptor->UniqueID
+ warn << "Broken LADSPA " << _descriptor->UniqueID
<< ": Port default < minimum. Minimum adjusted." << endl;
min = default_val;
}
if (default_val && default_val.get() > max.get()) {
- cerr << "WARNING: Broken LADSPA " << _descriptor->UniqueID
+ warn << "Broken LADSPA " << _descriptor->UniqueID
<< ": Maximum adjusted." << endl;
max = default_val;
}
diff --git a/src/engine/LADSPAPlugin.cpp b/src/engine/LADSPAPlugin.cpp
index 30b0eae2..7bf4ef4a 100644
--- a/src/engine/LADSPAPlugin.cpp
+++ b/src/engine/LADSPAPlugin.cpp
@@ -17,7 +17,6 @@
#include <cassert>
#include <ladspa.h>
-#include <iostream>
#include <raul/Symbol.hpp>
#include "LADSPAPlugin.hpp"
#include "LADSPANode.hpp"
@@ -83,7 +82,7 @@ LADSPAPlugin::instantiate(BufferFactory& bufs,
assert(*_module);
if (!_module->get_symbol("ladspa_descriptor", df.dp)) {
- cerr << "Looks like this isn't a LADSPA plugin." << endl;
+ warn << _library_path << " is not a LADSPA plugin library" << endl;
return NULL;
}
@@ -104,7 +103,7 @@ LADSPAPlugin::instantiate(BufferFactory& bufs,
}
} else {
- cerr << "Could not find plugin \"" << _id << "\" in " << _library_path << endl;
+ error << "Could not find plugin \"" << _id << "\" in " << _library_path << endl;
}
return n;
diff --git a/src/engine/LADSPAPlugin.hpp b/src/engine/LADSPAPlugin.hpp
index 332bdd8e..5c5e4faa 100644
--- a/src/engine/LADSPAPlugin.hpp
+++ b/src/engine/LADSPAPlugin.hpp
@@ -23,7 +23,6 @@
#include <boost/utility.hpp>
#include <dlfcn.h>
#include <string>
-#include <iostream>
#include "raul/Path.hpp"
#include "raul/Atom.hpp"
#include "PluginImpl.hpp"
diff --git a/src/engine/LV2Info.cpp b/src/engine/LV2Info.cpp
index 93f4b386..774828dd 100644
--- a/src/engine/LV2Info.cpp
+++ b/src/engine/LV2Info.cpp
@@ -17,7 +17,6 @@
#define __STDC_LIMIT_MACROS 1
#include <cassert>
-#include <iostream>
#include <stdint.h>
#include "object.lv2/object.h"
#include "LV2Info.hpp"
diff --git a/src/engine/LV2Node.cpp b/src/engine/LV2Node.cpp
index 6f39782b..3356b4aa 100644
--- a/src/engine/LV2Node.cpp
+++ b/src/engine/LV2Node.cpp
@@ -15,11 +15,11 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
#include <cassert>
#include <float.h>
#include <stdint.h>
#include <cmath>
+#include "raul/log.hpp"
#include "raul/Maid.hpp"
#include "AudioBuffer.hpp"
#include "InputPort.hpp"
@@ -86,7 +86,7 @@ LV2Node::prepare_poly(BufferFactory& bufs, uint32_t poly)
_lv2_plugin->slv2_plugin(), _srate, _features->array());
if (_prepared_instances->at(i) == NULL) {
- cerr << "Failed to instantiate plugin!" << endl;
+ error << "Failed to instantiate plugin" << endl;
return false;
}
@@ -159,7 +159,7 @@ LV2Node::instantiate(BufferFactory& bufs)
for (uint32_t i=0; i < _polyphony; ++i) {
(*_instances)[i] = slv2_plugin_instantiate(plug, _srate, _features->array());
if ((*_instances)[i] == NULL) {
- cerr << "Failed to instantiate plugin!" << endl;
+ error << "Failed to instantiate plugin" << endl;
return false;
}
@@ -170,7 +170,7 @@ LV2Node::instantiate(BufferFactory& bufs)
(*_instances)[i], LV2_CONTEXT_MESSAGE);
if (i == 0 && ctx_ext) {
- cerr << _lv2_plugin->uri() << " has message context" << endl;
+ Raul::info << _lv2_plugin->uri() << " has message context" << endl;
assert(!_message_funcs);
_message_funcs = (LV2MessageContext*)ctx_ext;
}
@@ -284,14 +284,14 @@ LV2Node::instantiate(BufferFactory& bufs)
SLV2Value c = slv2_values_get_at(contexts, i);
const char* context = slv2_value_as_string(c);
if (!strcmp(LV2_CONTEXT_MESSAGE, context)) {
- cerr << _lv2_plugin->uri() << " port " << i << " has message context" << endl;
+ Raul::info << _lv2_plugin->uri() << " port " << i << " has message context" << endl;
if (!_message_funcs) {
- cerr << _lv2_plugin->uri()
- << " has a message port, but no context extension data." << endl;
+ warn << _lv2_plugin->uri()
+ << " has a message port, but no context extension data." << endl;
}
port->set_context(Context::MESSAGE);
} else {
- cout << _lv2_plugin->uri() << " port " << i << " has unknown context "
+ warn << _lv2_plugin->uri() << " port " << i << " has unknown context "
<< slv2_value_as_string(slv2_values_get_at(contexts, i))
<< endl;
}
diff --git a/src/engine/LV2Plugin.cpp b/src/engine/LV2Plugin.cpp
index b8b159e3..eafa3be2 100644
--- a/src/engine/LV2Plugin.cpp
+++ b/src/engine/LV2Plugin.cpp
@@ -99,7 +99,7 @@ LV2Plugin::library_path() const
if (v) {
_library_path = slv2_uri_to_path(slv2_value_as_uri(v));
} else {
- cerr << "WARNING: Plugin " << uri() << " has no library path" << endl;
+ warn << uri() << " has no library path" << endl;
return empty_string;
}
}
diff --git a/src/engine/LV2Plugin.hpp b/src/engine/LV2Plugin.hpp
index fdb90a22..2a6f1996 100644
--- a/src/engine/LV2Plugin.hpp
+++ b/src/engine/LV2Plugin.hpp
@@ -29,7 +29,6 @@
#include <boost/utility.hpp>
#include <dlfcn.h>
#include <string>
-#include <iostream>
#include "slv2/slv2.h"
#include "raul/SharedPtr.hpp"
#include "PluginImpl.hpp"
diff --git a/src/engine/LV2ResizeFeature.hpp b/src/engine/LV2ResizeFeature.hpp
index 90452552..723d9447 100644
--- a/src/engine/LV2ResizeFeature.hpp
+++ b/src/engine/LV2ResizeFeature.hpp
@@ -18,12 +18,13 @@
#ifndef LV2_RESIZE_FEATURE_H
#define LV2_RESIZE_FEATURE_H
-#include <iostream>
+#include "raul/log.hpp"
#include "shared/LV2Features.hpp"
#include "NodeImpl.hpp"
#include "PortImpl.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
@@ -34,7 +35,7 @@ struct ResizeFeature : public Shared::LV2Features::Feature {
NodeImpl* node = (NodeImpl*)data;
PortImpl* port = node->port_impl(index);
if (port->context() == Context::MESSAGE) {
- cout << "Resizing " << port->path() << " to " << size << " bytes" << endl;
+ info << "Resizing " << port->path() << " to " << size << " bytes" << endl;
port->buffer(0)->resize(size);
port->connect_buffers();
return true;
diff --git a/src/engine/MessageContext.cpp b/src/engine/MessageContext.cpp
index 1ffc4bfc..71700bbf 100644
--- a/src/engine/MessageContext.cpp
+++ b/src/engine/MessageContext.cpp
@@ -15,7 +15,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
+#include "raul/log.hpp"
#include "raul/Atom.hpp"
#include "ConnectionImpl.hpp"
#include "Engine.hpp"
@@ -28,6 +28,7 @@
#include "ThreadManager.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
@@ -46,9 +47,9 @@ MessageContext::run(PortImpl* port, FrameTime time)
_requests.write(sizeof(Request), &r);
// signal() will be called at the end of this process cycle
} else if (ThreadManager::current_thread_id() == THREAD_MESSAGE) {
- cout << "Message context recursion at " << port->path() << endl;
+ warn << "Message context recursion at " << port->path() << endl;
} else {
- cout << "[MessageContext] ERROR: Run requested from unknown thread" << endl;
+ error << "Run requested from unknown thread" << endl;
}
}
diff --git a/src/engine/NodeBase.cpp b/src/engine/NodeBase.cpp
index ab8b7054..8fe266e6 100644
--- a/src/engine/NodeBase.cpp
+++ b/src/engine/NodeBase.cpp
@@ -17,7 +17,6 @@
#include "NodeBase.hpp"
#include <cassert>
-#include <iostream>
#include <stdint.h>
#include "raul/List.hpp"
#include "raul/Array.hpp"
@@ -154,7 +153,6 @@ NodeBase::set_buffer_size(BufferFactory& bufs, size_t size)
void
NodeBase::reset_input_ready()
{
- //cout << path() << " RESET" << endl;
_n_inputs_ready = 0;
_process_lock = 0;
_input_ready.reset(0);
@@ -181,14 +179,8 @@ NodeBase::wait_for_input(size_t num_providers)
assert(ThreadManager::current_thread_id() == THREAD_PROCESS);
assert(_process_lock.get() == 1);
- while ((unsigned)_n_inputs_ready.get() < num_providers) {
- //cout << path() << " WAITING " << _n_inputs_ready.get() << endl;
+ while ((unsigned)_n_inputs_ready.get() < num_providers)
_input_ready.wait();
- //cout << path() << " CAUGHT SIGNAL" << endl;
- //++_n_inputs_ready;
- }
-
- //cout << path() << " READY" << endl;
}
@@ -196,7 +188,6 @@ void
NodeBase::signal_input_ready()
{
assert(ThreadManager::current_thread_id() == THREAD_PROCESS);
- //cout << path() << " SIGNAL" << endl;
++_n_inputs_ready;
_input_ready.post();
}
diff --git a/src/engine/NodeFactory.cpp b/src/engine/NodeFactory.cpp
index c6dca64b..224c2b68 100644
--- a/src/engine/NodeFactory.cpp
+++ b/src/engine/NodeFactory.cpp
@@ -15,14 +15,15 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "ingen-config.h"
#include <cstdlib>
#include <pthread.h>
#include <dirent.h>
#include <float.h>
#include <cmath>
#include "redlandmm/World.hpp"
+#include "raul/log.hpp"
#include "raul/Atom.hpp"
+#include "ingen-config.h"
#include "module/World.hpp"
#include "internals/Note.hpp"
#include "internals/Trigger.hpp"
@@ -43,6 +44,7 @@
#endif
using namespace std;
+using namespace Raul;
namespace Ingen {
@@ -96,7 +98,7 @@ NodeFactory::plugin(const string& type, const string& lib, const string& label)
}
#endif
- cerr << "ERROR: Failed to find " << type << " plugin " << lib << " / " << label << endl;
+ error << "Failed to find " << type << " plugin " << lib << " / " << label << endl;
return NULL;
}
@@ -129,8 +131,6 @@ NodeFactory::load_plugins()
}
_world->rdf_world->mutex().unlock();
-
- //cerr << "[NodeFactory] # Plugins: " << _plugins.size() << endl;
}
@@ -168,8 +168,6 @@ NodeFactory::load_lv2_plugins()
{
SLV2Plugins plugins = slv2_world_get_all_plugins(_world->slv2_world);
- //cerr << "[NodeFactory] Found " << slv2_plugins_size(plugins) << " LV2 plugins:" << endl;
-
for (unsigned i=0; i < slv2_plugins_size(plugins); ++i) {
SLV2Plugin lv2_plug = slv2_plugins_get_at(plugins, i);
@@ -200,9 +198,9 @@ NodeFactory::load_ladspa_plugins()
char* env_ladspa_path = getenv("LADSPA_PATH");
string ladspa_path;
if (!env_ladspa_path) {
- cerr << "[NodeFactory] LADSPA_PATH is empty. Assuming /usr/lib/ladspa:/usr/local/lib/ladspa:~/.ladspa" << endl;
+ info << "Using default LADSPA_PATH=/usr/lib/ladspa:/usr/local/lib/ladspa:~/.ladspa" << endl;
ladspa_path = string("/usr/lib/ladspa:/usr/local/lib/ladspa:").append(
- getenv("HOME")).append("/.ladspa");
+ getenv("HOME")).append("/.ladspa");
} else {
ladspa_path = env_ladspa_path;
}
@@ -216,10 +214,8 @@ NodeFactory::load_ladspa_plugins()
ladspa_path = "";
DIR* pdir = opendir(dir.c_str());
- if (pdir == NULL) {
- //cerr << "[NodeFactory] Unreadable directory in LADSPA_PATH: " << dir.c_str() << endl;
+ if (pdir == NULL)
continue;
- }
struct dirent* pfile;
while ((pfile = readdir(pdir))) {
@@ -238,10 +234,8 @@ NodeFactory::load_ladspa_plugins()
const string lib_path = dir +"/"+ pfile->d_name;
// Ignore stupid libtool files. Kludge alert.
- if (lib_path.substr(lib_path.length()-3) == ".la") {
- //cerr << "WARNING: Skipping stupid libtool file " << pfile->d_name << endl;
+ if (lib_path.substr(lib_path.length()-3) == ".la")
continue;
- }
Glib::Module* plugin_library = new Glib::Module(lib_path, Glib::MODULE_BIND_LOCAL);
if (!plugin_library || !(*plugin_library))
@@ -249,9 +243,7 @@ NodeFactory::load_ladspa_plugins()
bool found = plugin_library->get_symbol("ladspa_descriptor", df.dp);
if (!found || !df.dp) {
- cerr << "WARNING: Non-LADSPA library found in LADSPA path: " <<
- lib_path << endl;
- // Not a LADSPA plugin library
+ warn << "Non-LADSPA library " << lib_path << " found in LADSPA path" << endl;
delete plugin_library;
continue;
}
@@ -272,7 +264,7 @@ NodeFactory::load_ladspa_plugins()
_plugins.insert(make_pair(uri, plugin));
} else {
- cerr << "Warning: Duplicate " << uri
+ warn << "Duplicate " << uri
<< " - Using " << i->second->library_path()
<< " over " << lib_path << endl;
}
diff --git a/src/engine/OSCClientSender.cpp b/src/engine/OSCClientSender.cpp
index 87382727..13147a42 100644
--- a/src/engine/OSCClientSender.cpp
+++ b/src/engine/OSCClientSender.cpp
@@ -16,8 +16,8 @@
*/
#include <cassert>
-#include <iostream>
#include <unistd.h>
+#include "raul/log.hpp"
#include "raul/AtomLiblo.hpp"
#include "interface/ClientInterface.hpp"
#include "EngineStore.hpp"
@@ -54,7 +54,7 @@ OSCClientSender::response_ok(int32_t id)
return;
if (lo_send(_address, "/ingen/ok", "i", id) < 0) {
- cerr << "Unable to send ok " << id << "! ("
+ Raul::error << "Unable to send OK " << id << "! ("
<< lo_address_errstr(_address) << ")" << endl;
}
}
@@ -74,7 +74,7 @@ OSCClientSender::response_error(int32_t id, const std::string& msg)
return;
if (lo_send(_address, "/ingen/error", "is", id, msg.c_str()) < 0) {
- cerr << "Unable to send error " << id << "! ("
+ Raul::error << "Unable to send error " << id << "! ("
<< lo_address_errstr(_address) << ")" << endl;
}
}
diff --git a/src/engine/OSCClientSender.hpp b/src/engine/OSCClientSender.hpp
index 833ad25e..34d88fc4 100644
--- a/src/engine/OSCClientSender.hpp
+++ b/src/engine/OSCClientSender.hpp
@@ -20,7 +20,6 @@
#include <cassert>
#include <string>
-#include <iostream>
#include <lo/lo.h>
#include <pthread.h>
#include "interface/ClientInterface.hpp"
diff --git a/src/engine/OSCEngineReceiver.cpp b/src/engine/OSCEngineReceiver.cpp
index 5afddfe9..e9348d13 100644
--- a/src/engine/OSCEngineReceiver.cpp
+++ b/src/engine/OSCEngineReceiver.cpp
@@ -17,11 +17,11 @@
//#define ENABLE_AVAHI 1
-#include <iostream>
#include <cstdlib>
#include <string>
#include <lo/lo.h>
#include "ingen-config.h"
+#include "raul/log.hpp"
#include "raul/AtomLiblo.hpp"
#include "raul/SharedPtr.hpp"
#include "interface/ClientInterface.hpp"
@@ -32,6 +32,8 @@
#include "QueuedEventSource.hpp"
#include "ThreadManager.hpp"
+#define LOG(s) s << "[OSCEngineReceiver] "
+
using namespace std;
using namespace Raul;
@@ -66,11 +68,11 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
#endif
if (_server == NULL) {
- cerr << "[OSC] Could not start OSC server. Aborting." << endl;
+ LOG(error) << "Could not start OSC server. Aborting." << endl;
exit(EXIT_FAILURE);
} else {
char* lo_url = lo_server_get_url(_server);
- cout << "[OSC] Started OSC server at " << lo_url << endl;
+ LOG(info) << "Started OSC server at " << lo_url << endl;
free(lo_url);
}
@@ -163,12 +165,6 @@ OSCEngineReceiver::ReceiveThread::_run()
* they all get executed in the same cycle */
while (true) {
- assert(_receiver._server);
- /*if ( ! _server) {
- cout << "[OSCEngineReceiver] Server is NULL, exiting" << endl;
- break;
- }*/
-
// Wait on a message and enqueue it
lo_server_recv(_receiver._server);
@@ -234,7 +230,7 @@ OSCEngineReceiver::set_response_address_cb(const char* path, const char* types,
void
OSCEngineReceiver::error_cb(int num, const char* msg, const char* path)
{
- cerr << "liblo server error " << num << " in path \"" << "\" - " << msg << endl;
+ error << "liblo server error " << num << " in path \"" << "\" - " << msg << endl;
}
@@ -249,7 +245,7 @@ OSCEngineReceiver::_ping_cb(const char* path, const char* types, lo_arg** argv,
{
const lo_address addr = lo_message_get_source(msg);
if (lo_send(addr, "/ingen/ok", "i", argv[0]->i) < 0)
- cerr << "WARNING: Unable to send response: " << lo_address_errstr(addr) << endl;
+ warn << "Unable to send response (" << lo_address_errstr(addr) << ")" << endl;
return 0;
}
@@ -570,7 +566,7 @@ OSCEngineReceiver::_note_on_cb(const char* path, const char* types, lo_arg** arg
const uint8_t note_num = argv[2]->i;
const uint8_t velocity = argv[3]->i;
*/
- cerr << "FIXME: OSC note on\n";
+ warn << "TODO: OSC note on" << endl;
//note_on(node_path, note_num, velocity);
return 0;
}
@@ -591,7 +587,7 @@ OSCEngineReceiver::_note_off_cb(const char* path, const char* types, lo_arg** ar
const char* patch_path = &argv[1]->s;
const uint8_t note_num = argv[2]->i;
*/
- cerr << "FIXME: OSC note off\n";
+ warn << "TODO: OSC note off" << endl;
//note_off(patch_path, note_num);
return 0;
}
@@ -611,7 +607,7 @@ OSCEngineReceiver::_all_notes_off_cb(const char* path, const char* types, lo_arg
const char* patch_path = &argv[1]->s;
*/
- cerr << "FIXME: OSC all notes off\n";
+ warn << "TODO: OSC all notes off" << endl;
//all_notes_off(patch_path);
return 0;
}
@@ -734,7 +730,7 @@ OSCEngineReceiver::unknown_cb(const char* path, const char* types, lo_arg** argv
const lo_address addr = lo_message_get_source(msg);
char* const url = lo_address_get_url(addr);
- cerr << "Unknown command " << path << " (" << types << "), sending error.\n";
+ warn << "Unknown OSC command " << path << " (" << types << ")" << endl;
string error_msg = "Unknown command: ";
error_msg.append(path).append(" ").append(types);
diff --git a/src/engine/ObjectBuffer.cpp b/src/engine/ObjectBuffer.cpp
index 9611f124..a391bb99 100644
--- a/src/engine/ObjectBuffer.cpp
+++ b/src/engine/ObjectBuffer.cpp
@@ -19,7 +19,7 @@
#include <string.h>
#include <stdint.h>
#include <algorithm>
-#include <iostream>
+#include "raul/log.hpp"
#include "uri-map.lv2/uri-map.h"
#include "ingen-config.h"
#include "shared/LV2Features.hpp"
@@ -28,6 +28,7 @@
#include "Engine.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
@@ -40,7 +41,6 @@ using namespace Shared;
ObjectBuffer::ObjectBuffer(BufferFactory& factory, size_t capacity)
: Buffer(factory, PortType(PortType::VALUE), capacity)
{
- //cerr << "Creating Object Buffer capacity = " << capacity << endl;
assert(capacity >= sizeof(LV2_Object));
#ifdef HAVE_POSIX_MEMALIGN
@@ -51,7 +51,7 @@ ObjectBuffer::ObjectBuffer(BufferFactory& factory, size_t capacity)
#endif
if (ret != 0) {
- cerr << "Failed to allocate buffer. Aborting." << endl;
+ error << "Failed to allocate object buffer. Aborting." << endl;
exit(EXIT_FAILURE);
}
diff --git a/src/engine/ObjectSender.cpp b/src/engine/ObjectSender.cpp
index c25bf9c4..65ad4f8b 100644
--- a/src/engine/ObjectSender.cpp
+++ b/src/engine/ObjectSender.cpp
@@ -102,7 +102,7 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu
}
if (plugin->uri().length() == 0) {
- cerr << "Node " << node->path() << " plugin has no URI! Not sending." << endl;
+ error << "Node " << node->path() << "'s plugin has no URI! Not sending." << endl;
return;
}
diff --git a/src/engine/OutputPort.cpp b/src/engine/OutputPort.cpp
index 4524805f..56e4bfdd 100644
--- a/src/engine/OutputPort.cpp
+++ b/src/engine/OutputPort.cpp
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
#include "interface/Patch.hpp"
#include "Buffer.hpp"
#include "NodeImpl.hpp"
@@ -62,8 +61,6 @@ OutputPort::post_process(Context& context)
for (uint32_t v = 0; v < _poly; ++v)
buffer(v)->prepare_read(context);
- //cerr << path() << " output post: buffer: " << buffer(0) << endl;
-
if (_broadcast)
broadcast_value(context, false);
}
diff --git a/src/engine/PatchImpl.cpp b/src/engine/PatchImpl.cpp
index 6958c8b5..4dc61a21 100644
--- a/src/engine/PatchImpl.cpp
+++ b/src/engine/PatchImpl.cpp
@@ -17,7 +17,7 @@
#include <cassert>
#include <cmath>
-#include <iostream>
+#include "raul/log.hpp"
#include "ThreadManager.hpp"
#include "NodeImpl.hpp"
#include "PatchImpl.hpp"
@@ -310,7 +310,7 @@ PatchImpl::remove_connection(const PortImpl* src_port, const PortImpl* dst_port)
}
if ( ! found)
- cerr << "WARNING: [PatchImpl::remove_connection] Connection not found" << endl;
+ error << "[PatchImpl::remove_connection] Connection not found" << endl;
return connection;
}
@@ -348,7 +348,7 @@ PortImpl*
PatchImpl::create_port(BufferFactory& bufs, const string& name, PortType type, size_t buffer_size, bool is_output)
{
if (type == PortType::UNKNOWN) {
- cerr << "[PatchImpl::create_port] Unknown port type " << type.uri() << endl;
+ error << "[PatchImpl::create_port] Unknown port type " << type.uri() << endl;
return NULL;
}
@@ -388,7 +388,7 @@ PatchImpl::remove_port(const string& symbol)
}
if ( ! found)
- cerr << "WARNING: [PatchImpl::remove_port] Port not found!" << endl;
+ error << "[PatchImpl::remove_port] Port not found!" << endl;
return ret;
}
@@ -445,8 +445,6 @@ PatchImpl::compile() const
{
assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS);
- //cerr << "*********** Compiling " << path() << endl;
-
CompiledPatch* const compiled_patch = new CompiledPatch();//_nodes.size());
for (Nodes::const_iterator i = _nodes.begin(); i != _nodes.end(); ++i)
@@ -466,12 +464,14 @@ PatchImpl::compile() const
compile_recursive(node, compiled_patch);
}
- /*cerr << "----------------------------------------\n";
+#ifdef LOG_DEBUG
+ debug << path() << " compiled {" << endl;
for (size_t i=0; i < process_order->size(); ++i) {
assert(process_order->at(i));
- cerr << process_order->at(i)->path() << endl;
+ debug << " " << process_order->at(i)->path() << endl;
}
- cerr << "----------------------------------------\n";*/
+ debug << "}" << endl;
+#endif
assert(compiled_patch->size() == _nodes.size());
diff --git a/src/engine/PluginImpl.cpp b/src/engine/PluginImpl.cpp
index cdc6ffb2..4aa38032 100644
--- a/src/engine/PluginImpl.cpp
+++ b/src/engine/PluginImpl.cpp
@@ -15,13 +15,14 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
+#include "raul/log.hpp"
#include "PluginImpl.hpp"
#include "internals/Note.hpp"
#include "internals/Trigger.hpp"
#include "internals/Controller.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
@@ -30,7 +31,7 @@ void
PluginImpl::load()
{
if (!_module) {
- //cerr << "Loading " << _library_path << " library" << endl;
+ debug << "Loading plugin library " << _library_path << endl;
_module = new Glib::Module(_library_path, Glib::MODULE_BIND_LOCAL);
if (!(*_module))
delete _module;
@@ -42,7 +43,7 @@ void
PluginImpl::unload()
{
if (_module) {
- //cerr << "Unloading " << _library_path << endl;
+ debug << "Unloading plugin library " << _library_path << endl;
delete _module;
_module = NULL;
}
diff --git a/src/engine/PluginImpl.hpp b/src/engine/PluginImpl.hpp
index 6dcf77a5..c8fb9f82 100644
--- a/src/engine/PluginImpl.hpp
+++ b/src/engine/PluginImpl.hpp
@@ -23,7 +23,6 @@
#include <boost/utility.hpp>
#include <dlfcn.h>
#include <string>
-#include <iostream>
#include "interface/Plugin.hpp"
#include "shared/ResourceImpl.hpp"
diff --git a/src/engine/PortImpl.cpp b/src/engine/PortImpl.cpp
index bbda42ea..ce4fedbf 100644
--- a/src/engine/PortImpl.cpp
+++ b/src/engine/PortImpl.cpp
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
#include "raul/Array.hpp"
#include "raul/Maid.hpp"
#include "contexts.lv2/contexts.h"
diff --git a/src/engine/PostProcessor.cpp b/src/engine/PostProcessor.cpp
index 513274d5..de073f1a 100644
--- a/src/engine/PostProcessor.cpp
+++ b/src/engine/PostProcessor.cpp
@@ -16,8 +16,8 @@
*/
#include <cassert>
-#include <iostream>
#include <pthread.h>
+#include "raul/log.hpp"
#include "raul/SRSWQueue.hpp"
#include "events/SendPortValue.hpp"
#include "Event.hpp"
@@ -27,6 +27,7 @@
#include "ProcessContext.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
@@ -59,7 +60,7 @@ PostProcessor::process()
Driver* driver = _engine.driver();
if (driver && driver->context().event_sink().read(_event_buffer_size, _event_buffer)) {
if (((Event*)_event_buffer)->time() > end_time) {
- cerr << "WARNING: Lost event with time "
+ warn << "Lost event with time "
<< ((Event*)_event_buffer)->time() << " > " << end_time << endl;
break;
}
diff --git a/src/engine/ProcessSlave.cpp b/src/engine/ProcessSlave.cpp
index 3d5a9127..5047ec33 100644
--- a/src/engine/ProcessSlave.cpp
+++ b/src/engine/ProcessSlave.cpp
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
#include "raul/Atom.hpp"
#include "ProcessSlave.hpp"
#include "NodeImpl.hpp"
diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp
index 5532b732..03365a87 100644
--- a/src/engine/QueuedEngineInterface.cpp
+++ b/src/engine/QueuedEngineInterface.cpp
@@ -15,7 +15,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
+#include "raul/log.hpp"
#include "QueuedEngineInterface.hpp"
#include "tuning.hpp"
#include "QueuedEventSource.hpp"
@@ -23,6 +23,8 @@
#include "Engine.hpp"
#include "Driver.hpp"
+#define LOG(s) s << "[QueuedEngineInterface] "
+
using namespace std;
using namespace Raul;
@@ -158,11 +160,11 @@ QueuedEngineInterface::put(const URI& uri,
bool meta = ResourceImpl::is_meta_uri(uri);
URI subject(meta ? (string("path:/") + uri.substr(6)) : uri.str());
- /*cerr << "ENGINE PUT " << subject << " {" << endl;
+ LOG(debug) << "PUT " << subject << " {" << endl;
typedef Resource::Properties::const_iterator iterator;
for (iterator i = properties.begin(); i != properties.end(); ++i)
- cerr << "\t" << i->first << " = " << i->second << " :: " << i->second.type() << endl;
- cerr << "}" << endl;*/
+ LOG(debug) << " " << i->first << " = " << i->second << " :: " << i->second.type() << endl;
+ LOG(debug) << "}" << endl;
push_queued(new Events::SetMetadata(_engine, _responder, now(), this, true, meta, subject, properties));
}
diff --git a/src/engine/QueuedEventSource.cpp b/src/engine/QueuedEventSource.cpp
index 98b34acc..9fcd5711 100644
--- a/src/engine/QueuedEventSource.cpp
+++ b/src/engine/QueuedEventSource.cpp
@@ -16,7 +16,6 @@
*/
#include <sys/mman.h>
-#include <iostream>
#include "QueuedEventSource.hpp"
#include "QueuedEvent.hpp"
#include "PostProcessor.hpp"
diff --git a/src/engine/events/CreatePort.cpp b/src/engine/events/CreatePort.cpp
index ea2b3efa..299e60e9 100644
--- a/src/engine/events/CreatePort.cpp
+++ b/src/engine/events/CreatePort.cpp
@@ -70,10 +70,8 @@ CreatePort::CreatePort(
* TODO: fix this using RCU?
*/
- if (_data_type == PortType::UNKNOWN) {
- cerr << "[CreatePortEvent] Unknown port type " << type << endl;
+ if (_data_type == PortType::UNKNOWN)
_error = UNKNOWN_TYPE;
- }
}
diff --git a/src/engine/events/Disconnect.cpp b/src/engine/events/Disconnect.cpp
index 77878d43..c0fc9656 100644
--- a/src/engine/events/Disconnect.cpp
+++ b/src/engine/events/Disconnect.cpp
@@ -15,6 +15,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "raul/log.hpp"
#include "raul/Maid.hpp"
#include "raul/Path.hpp"
#include "events/Disconnect.hpp"
@@ -29,6 +30,7 @@
#include "EngineStore.hpp"
using namespace std;
+using namespace Raul;
namespace Ingen {
namespace Events {
@@ -175,8 +177,8 @@ Disconnect::execute(ProcessContext& context)
assert(_patch_connection);
if (port_connection->elem() != _patch_connection->elem()) {
- cerr << "ERROR: Corrupt connections:" << endl;
- cerr << "\t" << port_connection->elem() << ": "
+ error << "Corrupt connections:" << endl
+ << "\t" << port_connection->elem() << ": "
<< port_connection->elem()->src_port_path()
<< " -> " << port_connection->elem()->dst_port_path() << endl
<< "!=" << endl
@@ -207,10 +209,8 @@ Disconnect::post_process()
_responder->respond_ok();
_engine.broadcaster()->send_disconnection(_src_port->path(), _dst_port->path());
} else {
- // FIXME: better error messages
string msg = "Unable to disconnect ";
msg.append(_src_port_path.str() + " -> " + _dst_port_path.str());
- cerr << "DISCONNECTION ERROR " << (unsigned)_error << endl;
_responder->respond_error(msg);
}
}
diff --git a/src/engine/events/SetMetadata.cpp b/src/engine/events/SetMetadata.cpp
index e058b1f4..53e79977 100644
--- a/src/engine/events/SetMetadata.cpp
+++ b/src/engine/events/SetMetadata.cpp
@@ -17,6 +17,7 @@
#include <string>
#include <boost/format.hpp>
+#include "raul/log.hpp"
#include "interface/PortType.hpp"
#include "ClientBroadcaster.hpp"
#include "CreateNode.hpp"
@@ -174,7 +175,7 @@ SetMetadata::pre_process()
ev->pre_process();
_set_events.push_back(ev);
} else {
- cerr << "WARNING: Set value for non-port " << _object->uri() << endl;
+ warn << "Set value for non-port " << _object->uri() << endl;
}
}
}
diff --git a/src/engine/events/SetPortValue.cpp b/src/engine/events/SetPortValue.cpp
index 5efc35ae..de1190fb 100644
--- a/src/engine/events/SetPortValue.cpp
+++ b/src/engine/events/SetPortValue.cpp
@@ -16,6 +16,7 @@
*/
#include <sstream>
+#include "raul/log.hpp"
#include "event.lv2/event.h"
#include "shared/LV2URIMap.hpp"
#include "shared/LV2Features.hpp"
@@ -207,15 +208,15 @@ SetPortValue::apply(Context& context)
if (obuf) {
obuf->object()->size = obuf->size() - sizeof(LV2_Object);
if (LV2Object::from_atom(_engine.world(), _value, obuf->object())) {
- cout << "Converted atom " << _value << " :: " << obuf->object()->type
+ debug << "Converted atom " << _value << " :: " << obuf->object()->type
<< " * " << obuf->object()->size << " @ " << obuf->object() << endl;
return;
} else {
- cerr << "WARNING: Failed to convert atom to LV2 object" << endl;
+ warn << "Failed to convert atom to LV2 object" << endl;
}
}
- cerr << "WARNING: Unknown value type " << (int)_value.type() << endl;
+ warn << "Unknown value type " << (int)_value.type() << endl;
}
}
@@ -232,7 +233,9 @@ SetPortValue::post_process()
_engine.broadcaster()->send_port_value(_port_path, _value);
break;
case TYPE_MISMATCH:
- _responder->respond_error("type mismatch");
+ ss << "Illegal value type " << _value.type()
+ << " for port " << _port_path << endl;
+ _responder->respond_error(ss.str());
break;
case ILLEGAL_VOICE:
ss << "Illegal voice number " << _voice_num;
diff --git a/src/engine/ingen_http.cpp b/src/engine/ingen_http.cpp
index dade5bd3..86ac481a 100644
--- a/src/engine/ingen_http.cpp
+++ b/src/engine/ingen_http.cpp
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
#include "module/Module.hpp"
#include "module/World.hpp"
#include "HTTPEngineReceiver.hpp"
diff --git a/src/engine/ingen_jack.cpp b/src/engine/ingen_jack.cpp
index 63fa6229..cdf9199e 100644
--- a/src/engine/ingen_jack.cpp
+++ b/src/engine/ingen_jack.cpp
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
#include "module/Module.hpp"
#include "module/World.hpp"
#include "JackDriver.hpp"
diff --git a/src/engine/ingen_osc.cpp b/src/engine/ingen_osc.cpp
index 0599adb8..69c8b279 100644
--- a/src/engine/ingen_osc.cpp
+++ b/src/engine/ingen_osc.cpp
@@ -15,7 +15,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <iostream>
#include "module/Module.hpp"
#include "module/World.hpp"
#include "OSCEngineReceiver.hpp"
@@ -27,10 +26,10 @@ using namespace Ingen;
struct IngenOSCModule : public Ingen::Shared::Module {
void load(Ingen::Shared::World* world) {
- cout << "FIXME: OSC port" << endl;
- uint16_t port = 16180;
SharedPtr<OSCEngineReceiver> interface(
- new Ingen::OSCEngineReceiver(*world->local_engine.get(), event_queue_size, port));
+ new Ingen::OSCEngineReceiver(*world->local_engine.get(),
+ event_queue_size,
+ world->conf->option("engine-port").get_int32()));
world->local_engine->add_event_source(interface);
}
};
diff --git a/src/engine/internals/Controller.cpp b/src/engine/internals/Controller.cpp
index bc2f2349..9ad940d2 100644
--- a/src/engine/internals/Controller.cpp
+++ b/src/engine/internals/Controller.cpp
@@ -138,6 +138,6 @@ ControllerNode::control(ProcessContext& context, uint8_t control_num, uint8_t va
}
-} // namespace Ingen
} // namespace Internals
+} // namespace Ingen
diff --git a/src/engine/internals/Note.cpp b/src/engine/internals/Note.cpp
index cfaab3ed..76659cfd 100644
--- a/src/engine/internals/Note.cpp
+++ b/src/engine/internals/Note.cpp
@@ -15,11 +15,11 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <cmath>
+#include "raul/log.hpp"
#include "raul/Array.hpp"
#include "raul/Maid.hpp"
#include "raul/midi_events.h"
-#include <cmath>
-#include <iostream>
#include "internals/Note.hpp"
#include "AudioBuffer.hpp"
#include "Driver.hpp"
@@ -30,6 +30,9 @@
#include "PatchImpl.hpp"
#include "ProcessContext.hpp"
#include "util.hpp"
+#include "ingen-config.h"
+
+#define LOG(s) s << "[NoteNode] "
using namespace std;
@@ -132,10 +135,12 @@ NoteNode::process(ProcessContext& context)
for (midi_in->rewind(); midi_in->get_event(&frames, &subframes, &type, &size, &buf);
midi_in->increment()) {
- /*cout << "EVENT TYPE " << type << " @ " << frames << "." << subframes << ": ";
+#ifdef LOG_DEBUG
+ LOG(debug) << "EVENT TYPE " << type << " @ " << frames << "." << subframes << ": ";
for (uint16_t i = 0; i < size; ++i)
- cout << (int)((char)buf[i]) << " ";
- cout << endl;*/
+ debug << (int)((char)buf[i]) << " ";
+ debug << endl;
+#endif
const FrameTime time = context.start() + (FrameTime)frames;
@@ -166,7 +171,7 @@ NoteNode::process(ProcessContext& context)
// ?
break;
default:
- //cerr << "Ignored controller " << buf[1] << endl;
+ //warn << "Ignored controller " << buf[1] << endl;
break;
}
break;
@@ -195,7 +200,9 @@ NoteNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity, F
uint32_t voice_num = 0;
if (key->state != Key::OFF) {
- //cerr << "[NoteNode] Double midi note received" << endl;
+#ifdef LOG_DEBUG
+ LOG(debug) << "Double midi note received" << endl;
+#endif
return;
}
@@ -224,15 +231,19 @@ NoteNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity, F
assert(voice != NULL);
assert(voice == &(*_voices)[voice_num]);
- /*cerr << "[NoteNode] Note " << (int)note_num << " on @ " << time
- << ". Voice " << voice_num << " / " << _polyphony << endl;*/
+#ifdef LOG_DEBUG
+ LOG(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;
- //cerr << "[NoteNode] Stole voice " << voice_num << endl;
+#ifdef LOG_DEBUG
+ LOG(debug) << "Stole voice " << voice_num << endl;
+#endif
}
// Store key information for later reallocation on note off
@@ -276,7 +287,9 @@ NoteNode::note_off(ProcessContext& context, uint8_t note_num, FrameTime time)
Key* key = &_keys[note_num];
- //cerr << "[NoteNode] Note " << (int)note_num << " off @ " << time << endl;
+#ifdef LOG_DEBUG
+ debug << "Note " << (int)note_num << " off @ " << time << endl;
+#endif
if (key->state == Key::ON_ASSIGNED) {
// Assigned key, turn off voice and key
@@ -284,16 +297,20 @@ NoteNode::note_off(ProcessContext& context, uint8_t note_num, FrameTime time)
assert((*_voices)[key->voice].note == note_num);
if ( ! _sustain) {
- //cerr << "... free voice " << key->voice << endl;
+#ifdef LOG_DEBUG
+ debug << "Free voice " << key->voice << endl;
+#endif
free_voice(context, key->voice, time);
} else {
- //cerr << "... hold voice " << key->voice << endl;
+#ifdef LOG_DEBUG
+ debug << "Hold voice " << key->voice << endl;
+#endif
(*_voices)[key->voice].state = Voice::HOLDING;
}
} else {
-#ifndef NDEBUG
- cerr << "WARNING: Assigned key, but voice not active" << endl;
+#ifdef LOG_DEBUG
+ debug << "WARNING: Assigned key, but voice not active" << endl;
#endif
}
}
@@ -335,7 +352,9 @@ 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)
- //cerr << "[NoteNode] Note off. Key " << (int)note_num << ", Voice " << voice << " Killed" << endl;
+#ifdef LOG_DEBUG
+ LOG(debug) << "Note off: key " << (int)note_num << " voice " << voice << endl;
+#endif
((AudioBuffer*)_gate_port->buffer(voice).get())->set_value(0.0f, context.start(), time);
(*_voices)[voice].state = Voice::FREE;
}
@@ -348,7 +367,9 @@ NoteNode::all_notes_off(ProcessContext& context, FrameTime time)
assert(time >= context.start() && time <= context.end());
assert(time - context.start() < _buffer_size);
- //cerr << "All notes off @ " << offset << endl;
+#ifdef LOG_DEBUG
+ LOG(debug) << "All notes off @ " << offset << endl;
+#endif
// FIXME: set all keys to Key::OFF?
@@ -390,6 +411,6 @@ NoteNode::sustain_off(ProcessContext& context, FrameTime time)
}
-} // namespace Ingen
} // namespace Internals
+} // namespace Ingen
diff --git a/src/engine/internals/Trigger.cpp b/src/engine/internals/Trigger.cpp
index fcd657c7..7c05a1d3 100644
--- a/src/engine/internals/Trigger.cpp
+++ b/src/engine/internals/Trigger.cpp
@@ -16,6 +16,7 @@
*/
#include <cmath>
+#include "raul/log.hpp"
#include "raul/midi_events.h"
#include "internals/Trigger.hpp"
#include "AudioBuffer.hpp"
@@ -26,7 +27,10 @@
#include "ProcessContext.hpp"
#include "util.hpp"
+#define LOG(s) s << "[TriggerNode] "
+
using namespace std;
+using namespace Raul;
namespace Ingen {
namespace Internals {
@@ -124,7 +128,9 @@ TriggerNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity
_learning = false;
}
- /*cerr << "[TriggerNode] " << path() << " Note " << (int)note_num << " on @ " << time << endl;*/
+#ifdef LOG_DEBUG
+ LOG(debug) << path() << " note " << (int)note_num << " on @ " << time << endl;
+#endif
Sample filter_note = ((AudioBuffer*)_note_port->buffer(0).get())->value_at(0);
if (filter_note >= 0.0 && filter_note < 127.0 && (note_num == (uint8_t)filter_note)) {
@@ -148,6 +154,5 @@ TriggerNode::note_off(ProcessContext& context, uint8_t note_num, FrameTime time)
}
-} // namespace Ingen
} // namespace Internals
-
+} // namespace Ingen
diff --git a/src/engine/mix.hpp b/src/engine/mix.hpp
index a4cd16d8..792e4e94 100644
--- a/src/engine/mix.hpp
+++ b/src/engine/mix.hpp
@@ -18,11 +18,13 @@
#ifndef MIX_HPP
#define MIX_HPP
-#include <iostream>
+#include "raul/log.hpp"
#include "interface/PortType.hpp"
#include "Buffer.hpp"
#include "Context.hpp"
+using namespace Raul;
+
namespace Ingen {
inline void
@@ -74,7 +76,7 @@ mix(Context& context, Buffer* dst, const Buffer*const* srcs, uint32_t num_srcs)
break;
default:
- std::cerr << "ERROR: Mix of unsupported buffer types" << std::endl;
+ error << "Mix of unsupported buffer types" << std::endl;
return;
}
}
diff --git a/src/engine/util.hpp b/src/engine/util.hpp
index 945e5101..3b9d436c 100644
--- a/src/engine/util.hpp
+++ b/src/engine/util.hpp
@@ -18,10 +18,10 @@
#ifndef UTIL_HPP
#define UTIL_HPP
-#include "ingen-config.h"
-#include "raul/Path.hpp"
-#include <iostream>
#include <cstdlib>
+#include "raul/log.hpp"
+#include "raul/Path.hpp"
+#include "ingen-config.h"
#include <fenv.h>
#ifdef __SSE__
@@ -63,11 +63,11 @@ set_denormal_flags()
}
if (d1 & 1<<26) { /* bit 26, SSE2 support */
_mm_setcsr(_mm_getcsr() | 0x8040); // set DAZ and FZ bits of MXCSR
- //cerr << "Set SSE denormal fix flag." << endl;
+ Raul::info << "Set SSE denormal fix flag" << endl;
}
} else {
- std::cerr << "This code has been built with SSE support, but your processor does"
- << " not support the SSE instruction set." << std::endl << "Exiting." << std::endl;
+ 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