/*
This file is part of Ingen.
Copyright 2007-2012 David Robillard
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
Software Foundation, either version 3 of the License, or any later version.
Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU Affero General Public License for details.
You should have received a copy of the GNU Affero General Public License
along with Ingen. If not, see .
*/
#ifndef INGEN_ENGINE_OSCENGINERECEIVER_HPP
#define INGEN_ENGINE_OSCENGINERECEIVER_HPP
#include
#include
#include "raul/Thread.hpp"
#include "raul/URI.hpp"
#include "ingen/Resource.hpp"
#include "ingen_config.h"
#include "macros.h"
namespace Ingen {
class ServerInterface;
namespace Server {
class Engine;
/* FIXME: Make this receive and preprocess in the same thread? */
/** Receive OSC messages and call interface functions.
*
* \ingroup engine
*/
class OSCEngineReceiver
{
public:
OSCEngineReceiver(Engine& engine,
SharedPtr interface,
uint16_t port);
~OSCEngineReceiver();
private:
struct ReceiveThread : public Raul::Thread {
explicit ReceiveThread(OSCEngineReceiver& receiver) : _receiver(receiver) {}
virtual void _run();
private:
OSCEngineReceiver& _receiver;
};
friend struct ReceiveThread;
ReceiveThread* _receive_thread;
Raul::URI _delta_uri;
Resource::Properties _delta_remove;
Resource::Properties _delta_add;
#ifdef LIBLO_BUNDLES
static int bundle_start_cb(lo_timetag time, void* myself) {
return ((OSCEngineReceiver*)myself)->_bundle_start_cb(time);
}
static int bundle_end_cb(void* myself) {
return ((OSCEngineReceiver*)myself)->_bundle_end_cb();
}
int _bundle_start_cb(lo_timetag time);
int _bundle_end_cb();
#endif
static void error_cb(int num, const char* msg, const char* path);
static int set_response_address_cb(LO_HANDLER_ARGS, void* myself);
static int generic_cb(LO_HANDLER_ARGS, void* myself);
static int unknown_cb(LO_HANDLER_ARGS, void* myself);
LO_HANDLER(OSCEngineReceiver, quit);
LO_HANDLER(OSCEngineReceiver, ping);
LO_HANDLER(OSCEngineReceiver, ping_slow);
LO_HANDLER(OSCEngineReceiver, register_client);
LO_HANDLER(OSCEngineReceiver, unregister_client);
LO_HANDLER(OSCEngineReceiver, get);
LO_HANDLER(OSCEngineReceiver, put);
LO_HANDLER(OSCEngineReceiver, delta_begin);
LO_HANDLER(OSCEngineReceiver, delta_remove);
LO_HANDLER(OSCEngineReceiver, delta_add);
LO_HANDLER(OSCEngineReceiver, delta_end);
LO_HANDLER(OSCEngineReceiver, move);
LO_HANDLER(OSCEngineReceiver, del);
LO_HANDLER(OSCEngineReceiver, connect);
LO_HANDLER(OSCEngineReceiver, disconnect);
LO_HANDLER(OSCEngineReceiver, disconnect_all);
LO_HANDLER(OSCEngineReceiver, note_on);
LO_HANDLER(OSCEngineReceiver, note_off);
LO_HANDLER(OSCEngineReceiver, all_notes_off);
LO_HANDLER(OSCEngineReceiver, learn);
LO_HANDLER(OSCEngineReceiver, set_property);
LO_HANDLER(OSCEngineReceiver, property_set);
Engine& _engine;
SharedPtr _interface;
lo_server _server;
};
} // namespace Server
} // namespace Ingen
#endif // INGEN_ENGINE_OSCENGINERECEIVER_HPP