Exemple #1
0
Server::Server() {
    st = lo_server_thread_new("6340", error);
    if (st) lo_server_thread_start(st);
    else { printf("err: starting Server\n"); while(1);}
    
    st_tcp = lo_server_thread_new_with_proto("6341", LO_TCP, errorTCP);
    if (st_tcp) lo_server_thread_start(st_tcp);
    else { printf("err: starting Server\n"); while(1);}
}
Exemple #2
0
/* Main */
int main (int argc, const char * argv[])
{    
    // Port number for incoming OSC messages
    char *portNumber = {'\0'};
    
    /* Parse input options */
    int opt;
    
    while ((opt = getopt(argc, (char * const*)argv, "p:h")) != -1)
    {
        printf("opt = %d\n", opt);
        switch(opt)
        {
            case 'p':
                portNumber = optarg;
                break;

            case 'h':
            default:
                print_usage(basename((char *)argv[0]));
                break;
        }
    }
    
    // If we haven't specified a port...
    if (&portNumber[0] == '\0') portNumber = DEFAULT_PORT_NUMBER;
    printf("Initializing liblo using port number %s\n", portNumber);
    
    /* start a new server on specified port */
    lo_server_thread st = lo_server_thread_new(portNumber, error);
    
    /* add method that will match any path and args */
    lo_server_thread_add_method(st, NULL, NULL, handleOSC, NULL);
    
    /* start the thread and get the initial time */
    lo_server_thread_start(st);
    gettimeofday(&tv_init, NULL);
    
    /* Main run loop */
    char input[80];
    bool shouldStop = false;
    
    printf("Enter 'q' to quit\n");
    
    while (shouldStop == false) {
        
        // Grab an input line
        scanf("%s", input);
        
        // Check for quit command, else continue
        if (input[0] == 'q')
            shouldStop = true;
    }
    
    printf("cleaning up...\n");
    
    lo_server_thread_free(st);
    
    return 0;
}
Exemple #3
0
extern int server_init(void) {

  lo_server_thread st = lo_server_thread_new(OSC_PORT, error);
  lo_server_thread_add_method(st, "/play", "iisffffffsffffi",
                              play_handler, 
                              NULL
                             );

  lo_server_thread_add_method(st, "/kriole", "iifff",
                              kriole_handler, 
                              NULL
                             );

#ifdef FEEDBACK
  lo_server_thread_add_method(st, "/preload", "s",
                              preload_handler, 
                              NULL
                             );
  lo_server_thread_add_method(st, "/pause_input", "i",
                              pause_input_handler, 
                              NULL
                             );
#endif

  lo_server_thread_add_method(st, NULL, NULL, generic_handler, NULL);
  lo_server_thread_start(st);

  
#ifdef ZEROMQ
  pthread_t t;
  pthread_create(&t, NULL, (void *(*)(void *)) zmqthread, NULL);
#endif
  
  return(1);
}
Exemple #4
0
int initialize_osc(int osc_port) {
  char tmp[255];
  int j;
  uint32_t port = (osc_port>100 && osc_port< 60000)?osc_port:7000;
  for (j=0; j < PORTAINC; ++j) {
    snprintf(tmp, sizeof(tmp), "%d", port);
    fprintf(stderr, "OSC trying port:%i\n",port);
    if ((osc_server = lo_server_thread_new (tmp, oscb_error))) break;
    fprintf (stderr,"OSC port %i is in use.\n", port);
    port++;
  }

  if (osc_server) {
    char *urlstr;
    urlstr = lo_server_thread_get_url (osc_server);
    fprintf(stderr, "OSC server name: %s\n",urlstr);
    free (urlstr);

    lo_server_thread_add_method(osc_server, "/jadeo/fps", "f",  &oscb_fps, NULL);
    lo_server_thread_add_method(osc_server, "/jadeo/seek", "i", &oscb_seek, NULL);
    lo_server_thread_add_method(osc_server, "/jadeo/load", "S", &oscb_load, NULL);
    lo_server_thread_add_method(osc_server, "/jadeo/quit", "", &oscb_quit, NULL);

    lo_server_thread_start(osc_server);
    if(want_verbose) fprintf(stderr, "OSC server started on port %i\n",port);
    return (0);
  } 

  if(want_verbose) fprintf(stderr, "OSC start failed.");
  return(1);
}
Exemple #5
0
void OscCtrlServer::start() {
  osc_thread_ = lo_server_thread_new(port_.c_str(), osc_error);
  /* add method that will match any path and args */
  lo_server_thread_add_method(osc_thread_, nullptr, nullptr, osc_handler,
                              this);
  lo_server_thread_start(osc_thread_);
}
int main()
{
    /* start a new server on port 7770 */
    lo_server_thread st = lo_server_thread_new("7770", error);

    /* add method that will match any path and args */
    lo_server_thread_add_method(st, NULL, NULL, generic_handler, NULL);

    /* add method that will match the path /foo/bar, with two numbers, coerced
     * to float and int */
    lo_server_thread_add_method(st, "/foo/bar", "fi", foo_handler, NULL);

    /* add method that will match the path /quit with no args */
    lo_server_thread_add_method(st, "/quit", "", quit_handler, NULL);

    lo_server_thread_start(st);

    while (!done) {
#ifdef WIN32
    Sleep(1);
#else
	usleep(1000);
#endif
    }

    lo_server_thread_free(st);

    return 0;
}
// Constructor.
qtractorNsmClient::qtractorNsmClient (
	const QString& nsm_url, QObject *pParent )
	: QObject(pParent),
	#ifdef CONFIG_LIBLO
		m_address(NULL),
		m_thread(NULL),
		m_server(NULL),
	#endif
		m_active(false)
{
#ifdef CONFIG_LIBLO
	m_address = lo_address_new_from_url(nsm_url.toUtf8().constData());
	const int proto = lo_address_get_protocol(m_address);
	m_thread = lo_server_thread_new_with_proto(NULL, proto, NULL);
	if (m_thread) {
		m_server = lo_server_thread_get_server(m_thread);
		lo_server_thread_add_method(m_thread,
			"/error", "sis", osc_nsm_error, this);
		lo_server_thread_add_method(m_thread,
			"/reply", "ssss", osc_nsm_reply, this);
		lo_server_thread_add_method(m_thread,
			"/nsm/client/open", "sss", osc_nsm_open, this);
		lo_server_thread_add_method(m_thread,
			"/nsm/client/save", "", osc_nsm_save, this);
		lo_server_thread_add_method(m_thread,
			"/nsm/client/session_is_loaded", "", osc_nsm_loaded, this);
		lo_server_thread_add_method(m_thread,
			"/nsm/client/show_optional_gui", "", osc_nsm_show, this);
		lo_server_thread_add_method(m_thread,
			"/nsm/client/hide_optional_gui", "", osc_nsm_hide, this);
		lo_server_thread_start(m_thread);
	}
#endif
}
Exemple #8
0
void OSCPlugin::openInput(quint32 input)
{
    if (input >= OSC_INPUTS)
        return;

    qDebug() << Q_FUNC_INFO << "Input " << input << " port: " << m_ports[input];

	/** Cleanup a previous server instance if started */
    if (m_serv_threads[input] != NULL)
    {
        lo_server_thread_stop(m_serv_threads[input]);
        lo_server_thread_free(m_serv_threads[input]);
        m_serv_threads[input] = NULL;
    }
    /* start a new server on the defined port */
    QByteArray p_bytes  = m_ports[input].toLatin1();
    const char *c_port = p_bytes.data();

    m_serv_threads[input] = lo_server_thread_new(c_port, errorCallback);

    if (m_serv_threads[input] != NULL)
	{
		/* add method that will match any path and args */
        lo_server_thread_add_method(m_serv_threads[input], NULL, NULL, messageCallback, &m_callbackInfo[input]);

        lo_server_thread_start(m_serv_threads[input]);
	}
}
Exemple #9
0
static void threadOSC(int port, EventSystem* evsys)
{
    std::string portstr = boost::lexical_cast<std::string>(port);
    lo_server_thread st = lo_server_thread_new(portstr.c_str(), loerror);
    lo_server_thread_add_method(st, NULL, NULL, generic_handler, evsys);
    lo_server_thread_start(st);
}
Exemple #10
0
int osc_init(struct twinterface *twinterface)
{
    osc = (struct osc *) malloc(sizeof(struct osc));
    osc->twinterface = twinterface;
    osc->ndeck = 0;
    
    /* start a new server on port 7770 */
    st = lo_server_thread_new("7771", error);

    /* add method that will match any path and args */
    lo_server_thread_add_method(st, "/xwax/ppm", "ibi", ppm_handler, NULL);
    
    lo_server_thread_add_method(st, "/xwax/ppm_end", "i", ppm_end_handler, NULL);

    /* add method that will match any path and args */
    lo_server_thread_add_method(st, "/xwax/track_load", "iissi", track_load_handler, NULL);

    /* add method that will match any path and args */
    lo_server_thread_add_method(st, "/xwax/position", "iff", pos_handler, NULL);

    /* add method that will match any path and args */
    lo_server_thread_add_method(st, "/xwax/scale", "i", scale_handler, NULL);    

    /* add method that will match any path and args */
    //lo_server_thread_add_method(st, NULL, NULL, generic_handler, NULL);
    
    lo_server_thread_start(st);
    
    /* Notify osc server that where at this address */
    lo_address t = lo_address_new(ADDRESS, "7770");
    lo_send(t, "/xwax/connect", "");
    printf("Sent connect message\n");

    return 0;
}
Exemple #11
0
int main(int argc,char *argv[]) {
	srand(time(NULL));

	int quit = 0;
	int seed = rand() % 255;

	lo_address client = lo_address_new("localhost","9999");
	lo_server_thread server = lo_server_thread_new("9998",err_callback);
	lo_server_thread_add_method(server,"/client/quit","",quit_callback,(void*)&quit);
	lo_server_thread_add_method(server,NULL,NULL,all_callback,NULL);

	printf("starting osc server at %s with seed %d\n",lo_server_thread_get_url(server),seed);
	lo_server_thread_start(server);

	int k = 0;
	while (!quit) {
		if (lo_send(client,"/client/test","ii",seed,k++) < 0) fprintf(stderr,"osc client error: %s\n",lo_address_errstr(client));
		sleep(1);
	}

	printf("stopping osc server\n");
	lo_server_thread_stop(server);

	lo_server_thread_free(server);
	lo_address_free(client);
	return 0;
}
Exemple #12
0
//------------------------------------------------------------------------
tresult PLUGIN_API AGain::initialize (FUnknown* context)
{
	//---always initialize the parent-------
	tresult result = AudioEffect::initialize (context);

	wp = 0;
	rp = 0;
	if(!server) {
		server = lo_server_thread_new("10001", lo_err_handler);
		//lo_method tmp = lo_server_thread_add_method(server,"/dummy",NULL,lo_method_handler,this);
		int res = lo_server_thread_start(server);
	}


	// if everything Ok, continue
	if (result != kResultOk)
	{
		return result;
	}

	//---create Audio In/Out busses------
	// we want a stereo Input and a Stereo Output
	addAudioInput  (STR16 ("Stereo In"),  SpeakerArr::kStereo);
	addAudioOutput (STR16 ("Stereo Out"), SpeakerArr::kStereo);

	//---create Event In/Out busses (1 bus with only 1 channel)------
	addEventInput (STR16 ("Event In"), 1);

	return kResultOk;
}
Exemple #13
0
static int osc_listener_init(CSOUND *csound, OSCINIT *p)
{
    OSC_GLOBALS *pp;
    OSC_PORT    *ports;
    char        buff[32];
    int         n;

    /* allocate and initialise the globals structure */
    pp = alloc_globals(csound);
    n = pp->nPorts;
    ports = (OSC_PORT*) csound->ReAlloc(csound, pp->ports,
                                        sizeof(OSC_PORT) * (n + 1));
    ports[n].csound = csound;
    ports[n].mutex_ = csound->Create_Mutex(0);
    ports[n].oplst = NULL;
    snprintf(buff, 32, "%d", (int) *(p->port));
    ports[n].thread = lo_server_thread_new(buff, OSC_error);
    if (ports[n].thread==NULL)
      return csound->InitError(csound,
                               Str("cannot start OSC listener on port %s\n"),
                               buff);
    ///if (lo_server_thread_start(ports[n].thread)<0)
    ///  return csound->InitError(csound,
    ///                           Str("cannot start OSC listener on port %s\n"),
    ///                           buff);
    lo_server_thread_start(ports[n].thread);
    pp->ports = ports;
    pp->nPorts = n + 1;
    csound->Warning(csound, Str("OSC listener #%d started on port %s\n"), n, buff);
    *(p->ihandle) = (MYFLT) n;
    csound->RegisterDeinitCallback(csound, p,
                                   (int (*)(CSOUND *, void *)) OSC_deinit);
    return OK;
}
Exemple #14
0
int osc_server( int port)
{
	char sport[8];

	if( !port)
	{
		printf("[OSC SERVER] No valid port\n");
		return 0;
	}
	else
	{
		snprintf( sport, 8, "%d", port);
		printf("[OSC SERVER] Init server at %d\n", port);
	}

	lo_server_thread st = lo_server_thread_new( sport, osc_error);

	lo_server_thread_add_method(st, NULL, NULL, osc_handler_generic, NULL);
	lo_server_thread_add_method(st, "/a/b/c", "fff", osc_handler_vector, NULL);
	lo_server_thread_add_method(st, "/quit", "", osc_handler_quit, NULL);
	lo_server_thread_add_method(st, "/int", "i", osc_handler_int, NULL);
	lo_server_thread_add_method(st, "/quad", "iffff", osc_handler_quad, NULL);

	lo_server_thread_start(st);

	while ( !osc_server_done)
	{
		usleep(1000);
	}

	lo_server_thread_free(st);

	return 0;
}
Exemple #15
0
int main(int argc, char *argv[])
{
    lo_server st = lo_server_thread_new(NULL, NULL);
    lo_address t;
   
    if (argc != 2) {
	fprintf(stderr, "Usage: subtest <uri>\n");

	return 1;
    }

    lo_server_thread_add_method(st, NULL, "i", subtest_handler, NULL);
    lo_server_thread_start(st);

    t = lo_address_new_from_url(argv[1]);
    lo_send(t, "/subtest", "i", 0xf00);

#ifdef WIN32
    Sleep(4000);
#else
    sleep(4);
#endif

    return 0;
}
Exemple #16
0
    bool OSCInput::doStart() {
        m_oscServer = lo_server_thread_new(
            std::to_string(m_iPort).c_str(), error);

        lo_server_thread_add_method(
            m_oscServer, NULL, "f",
            float_handler, this);

	return lo_server_thread_start(m_oscServer) == 0;
    }
Exemple #17
0
int osc_start(struct deck *deck, struct library *library)
{
    osc_deck = deck;
    osc_library = library;
    
    address[0] = lo_address_new_from_url("osc.udp://0.0.0.0:7771/");
    address[1] = lo_address_new_from_url("osc.udp://0.0.0.0:7771/");
    
    
    /* start a new server on port 7770 */
    st = lo_server_thread_new("7770", error);
    
    lo_server_thread_add_method(st, "/xwax/load_track", "isss", load_track_handler, NULL);

    lo_server_thread_add_method(st, "/xwax/set_cue", "iif", set_cue_handler, NULL);

    lo_server_thread_add_method(st, "/xwax/punch_cue", "ii", punch_cue_handler, NULL);  

    lo_server_thread_add_method(st, "/xwax/get_status", "i", get_status_handler, NULL);
    
    lo_server_thread_add_method(st, "/xwax/recue", "i", recue_handler, NULL); 
  
    lo_server_thread_add_method(st, "/xwax/disconnect", "i", disconnect_handler, NULL);    
    
    lo_server_thread_add_method(st, "/xwax/reconnect", "i", reconnect_handler, NULL);    

    lo_server_thread_add_method(st, "/xwax/connect", "", connect_handler, NULL);

    lo_server_thread_add_method(st, "/xwax/pitch", "if", pitch_handler, NULL);

    lo_server_thread_add_method(st, "/xwax/position", "if", position_handler, NULL);
    
    /* add method that will match the path /quit with no args */
    lo_server_thread_add_method(st, "/quit", "", quit_handler, NULL);

    lo_server_thread_start(st);
    
    ///* Start a TCP server used for receiving PPM packets */
    //st_tcp = lo_server_thread_new_with_proto("7771", LO_TCP, error);
    //if (!st_tcp) {
        //printf("Could not create tcp server thread.\n");
        //exit(1);
    //}
    
    //lo_server s = lo_server_thread_get_server(st);   
    
    ///* add method that will match the path /foo/bar, with two numbers, coerced
     //* to float and int */
    
    //lo_server_thread_start(st_tcp);
    
    //printf("Listening on TCP port %s\n", "7771");

    return 0;
}
Exemple #18
0
void OscReceiver::start()
{
	if(!m_serverThread)
	{
		LOG_ERROR << "OscReceiver: Cannot start thread, address not set" << std::endl;
		return;
	}

	lo_server_thread_start(m_serverThread);
	m_bIsRunning = true;
}
Exemple #19
0
int main (int argc, char * argv[]) {
  lo_server_thread st;        // server to receive messages from
  lo_address addr;            // address to send messages to
  static struct filter ftr;   // stores data to be passed to handler
  int i, j;                   // index variables

  /* Set up the filter signature.  The signature helps us verify that things 
   * that we think are filters are actually filters. */
  srandom ((unsigned int) time (NULL));
  FILTER_SIGNATURE = random ();

  /* check for read port and write port */
  if (argc < 3)
    {
      printf ("- Missing Argument -\nUsage: oschand read_port write_port\n");
      exit (1);
    } // if

  /* start a new server and set up write port */
  st = lo_server_thread_new (argv[1], &error);
  addr = lo_address_new ("127.0.0.1", argv[2]);

  /* setup filter structure to be passed to joint handler */
  ftr.signature = FILTER_SIGNATURE;
  ftr.addr = addr;
  ftr.num_joints = argc - 3;
  ftr.joints = (char **) malloc (sizeof (char *) * ftr.num_joints);

  for (j = 0, i = 3; j < ftr.num_joints; j++, i++)
    ftr.joints[j] = argv[i];

  /* add method that will handle joints */
  lo_server_thread_add_method (st, "/joint", "sifff", joint_handler, &ftr);

  /* add method that will match the path /quit with no args */
  lo_server_thread_add_method (st, "/quit", "", quit_handler, NULL);

  lo_server_thread_start (st);

  /* wait for messages */
  while (!done)
    {
#ifdef WIN32
      Sleep (1);
#else
      usleep (1000);
#endif
    } // while

  lo_server_thread_free (st);
  lo_address_free (addr);

  return 0;
} // main
Exemple #20
0
void osc_server_start( t_osc *osc)
{
	lo_server_thread_start( osc->thread);

	while ( !osc->done)
	{
		usleep(1000);
	}

	lo_server_thread_free( osc->thread);
}
Server::Obj::Obj( int port, Proto proto )
{
	string portStr = boost::lexical_cast< string >( port );
	mThread = lo_server_thread_new_with_proto( ( port == PORT_ANY ) ? NULL : portStr.c_str(), proto, errorHandler );
	if ( port == PORT_ANY )
		mPort = lo_server_thread_get_port( mThread );
	else
		mPort = port;

	lo_server_thread_start( mThread );
}
void	*veejay_new_osc_server( void *data, const char *port )
{
	osc_recv_t *s = (osc_recv_t*) vj_malloc(sizeof( osc_recv_t));
	s->st = lo_server_thread_new( port, error_handler );
	lo_server_thread_start( s->st );

	s->url = lo_server_thread_get_url( s->st );
	s->port = lo_server_thread_get_port( s->st );

	veejay_msg( 0, "OSC server '%s' ready",s->url );

	return (void*) s;
}
Exemple #23
0
Server::Server( int port, Proto proto /* = PROTO_UDP */ )
{
	string portStr = boost::lexical_cast< string >( port );
	mThread = lo_server_thread_new_with_proto( ( port == PORT_ANY ) ? NULL : portStr.c_str(), proto, errorHandler );
	if ( port == PORT_ANY )
	{
		mPort = lo_server_thread_get_port( mThread );
	}
	else
	{
		mPort = port;
	}

	lo_server_thread_start( mThread );
}
void OSCServer::activate(int numTB, int numBB){
    numTrackBanks = numTB;
    numBusBanks = numBB;

    if(!started){
        //start a new server on port 3820 will change to config file
        serverThread = lo_server_thread_new("8000", NULL);

        /* add method that will match any path and args */
        lo_server_thread_add_method(serverThread, NULL, NULL, staticHandler, static_cast<void*>(this));

        lo_server_thread_start(serverThread);
        started = true;
    }

}
Exemple #25
0
int main(int argc, char *argv[]) {
  // Catch signals
  signal(SIGINT, mh_sigint);
  signal(SIGTERM, mh_sigint);

  // Initialise LEDs
  if (matrix_init() < 0) return 1;

  // Set up OSC server
  const char *path;
  lo_server_thread st;
  int chmod_err = 0;

  if (argc > 1) {
    path = argv[1];
  } else {
    path = SOCKET_PATH;
  }

  unlink(path);
  st = lo_server_thread_new(path, mh_osc_error);
  chmod_err = chmod_socket(path);

  if (chmod_err != 0) {
    fprintf(stderr, "Error changing socket permissions\n");
    return 1;
  }

  // Set up OSC message handlers
  lo_server_thread_add_method(st, "/set", "iii", mh_osc_set, NULL);
  lo_server_thread_add_method(st, "/render", NULL, mh_osc_render, NULL);
  lo_server_thread_add_method(st, "/clear", NULL, mh_osc_clear, NULL);
  lo_server_thread_start(st);

  // Ready
  printf("Listening on socket: %s\n", path);

  while (1) {
    usleep(1000);
  }

  // Cleanup
  lo_server_thread_free(st);
  mh_cleanup();

  return 0;
}
Exemple #26
0
int main(int argc, char * argv[])
{
	if (argc < 2)
	{
		printf("- Missing Argument -\nUsage: osc2text port\n");
		exit(1);
	}

	char port[6];
	int ret;

	/* TODO: We could have some better port number checks here, rather than letting
	 * liblo handle it
	 */
	if ((ret = snprintf(port,6,"%s",argv[1])) < 0)
	{
		printf("- Invalid port -");
		exit(ret);
	}

    /* start a new server on port 7770 */
    lo_server_thread st = lo_server_thread_new(port, error);

    /* add method that will match any path and args */
    lo_server_thread_add_method(st, NULL, NULL, generic_handler, NULL);

    /* add method that will match the path /foo/bar, with two numbers, coerced
     * to float and int */
    lo_server_thread_add_method(st, "/foo/bar", "fi", foo_handler, NULL);

    /* add method that will match the path /quit with no args */
    lo_server_thread_add_method(st, "/quit", "", quit_handler, NULL);

    lo_server_thread_start(st);

    while (!done) {
#ifdef WIN32
    Sleep(1);
#else
  usleep(1000);
#endif
    }

    lo_server_thread_free(st);

    return 0;
}
Exemple #27
0
void Gear_OscInput::startOscServer(std::string port)
{
	stopOscServer();
	
	_loServerThread = lo_server_thread_new(port.c_str(), error);
	if (!_loServerThread)
	{
		std::cout << "fail to start osc server thread!" << std::endl;
		return;
	}
		
	//add the method that will handle osc message
	lo_server_thread_add_method(_loServerThread, NULL, NULL, configuredOscHandler, this);
		
	lo_server_thread_start(_loServerThread);
	
}
Exemple #28
0
bool Ambix_rotator_zAudioProcessor::oscIn(bool arg)
{
	if (arg) {
        if (!osc_in) {

            st = lo_server_thread_new(osc_in_port.toUTF8(), error);
			if (st != NULL)
			{
				lo_server_thread_add_method(st, "/rotation", "fff", rotation_handler, this);
				lo_server_thread_add_method(st, "/head_pose", "fffffff", headpose_handler, this);

				int res = lo_server_thread_start(st);
				if (res == 0)
				{
					arg = true;
					osc_in = true;
					osc_error = "OSC: receiving on port ";
					osc_error += osc_in_port;
				}
            } else {
                osc_error = "OSC: ERROR port is not free";
                //osc_error.formatted("OSC: ERROR %s", lo_address_errstr());
                arg = false;
                osc_in = false;
            }
        } else {
            
            oscIn(false);
            oscIn(true);
        }
	} else { // turn off osc
        if (osc_in)
        {
			lo_server_thread_stop(st);

#ifndef _WIN32
            lo_server_thread_free(st); // this crashes in windows
#endif
            arg = false;
            osc_in = false;
            osc_error = "OSC: not receiving";
        }
	}
	return arg;
}
static void osc_start (void)
{
	if (g_oscThread)
		return;

#ifdef CONFIG_DEBUG
	qDebug("osc_start()");
#endif

	// Create OSC thread...
	g_oscThread = lo_server_thread_new(NULL, osc_error);
	g_sOscPath  = lo_server_thread_get_url(g_oscThread);
	g_sOscPath += "dssi";

	lo_server_thread_add_method(g_oscThread,
		NULL, NULL, osc_message, NULL);
	lo_server_thread_start(g_oscThread);
}
Exemple #30
0
MantaOSC::MantaOSC(int serverPort, int clientPort)
{
   char serverPortString[16];
   char clientPortString[16];
   sprintf(serverPortString, "%d", serverPort);
   sprintf(clientPortString, "%d", clientPort);
   OSCServerThread = lo_server_thread_new(serverPortString, ErrorHandler);
   OSCAddress = lo_address_new("127.0.0.1", clientPortString);
   /* the callbacks are static, so we need to pass the "this" pointer so that object methods
    * can be called from within the callbacks */
   lo_server_thread_add_method(OSCServerThread, "/manta/ledcontrol", "si", LEDControlHandler, this);
   lo_server_thread_add_method(OSCServerThread, "/manta/led/pad", "si", LEDPadHandler, this);
   lo_server_thread_add_method(OSCServerThread, "/manta/led/pad/row", "sii", LEDRowHandler, this);
   lo_server_thread_add_method(OSCServerThread, "/manta/led/pad/column", "sii", LEDColumnHandler, this);
   lo_server_thread_add_method(OSCServerThread, "/manta/led/pad/frame", "sb", LEDFrameHandler, this);
   lo_server_thread_add_method(OSCServerThread, "/manta/led/slider", "sii", LEDSliderHandler, this);
   lo_server_thread_add_method(OSCServerThread, "/manta/led/button", "si", LEDButtonHandler, this);
   lo_server_thread_start(OSCServerThread);
}