Skip to content

Commit

Permalink
add a help option. not that helpful but tells you what port it's list…
Browse files Browse the repository at this point in the history
…ening on
  • Loading branch information
yaxu committed Nov 29, 2013
1 parent 5a6200a commit c4b8766
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
5 changes: 5 additions & 0 deletions config.h
@@ -1,3 +1,8 @@
#ifndef _DIRTCONFIGH_
#define _DIRTCONFIGH_

//#define FEEDBACK
//#define INPUT
#define OSC_PORT "7771"

#endif
19 changes: 16 additions & 3 deletions dirt.c
@@ -1,16 +1,29 @@
#include <stdio.h>

#include <unistd.h>
#include <string.h>

#include "jack.h"
#include "audio.h"
#include "server.h"

int main (int argc, char **argv) {
printf("init audio\n");
if (argc > 1 && strncmp(argv[1], "-h", 2) == 0) {
printf("Dirt - a software sampler, which listens for\n"
"OpenSoundControl messages on port %s.\n"
"Mainly used with Tidal http://yaxu.org/tidal/\n"
"Released as free software under the terms of the\n"
"GNU Public License version 3.0 and later.\n",
OSC_PORT
);
return(0);
}

fprintf(stderr, "init audio\n");
audio_init();
printf("init osc\n");

fprintf(stderr, "init open sound control\n");
server_init();

sleep(-1);
return(0);
}
6 changes: 5 additions & 1 deletion server.c
Expand Up @@ -10,6 +10,7 @@

#include "server.h"
#include "audio.h"
#include "config.h"

#ifdef ZEROMQ
#include <zmq.h>
Expand Down Expand Up @@ -87,6 +88,9 @@ int play_handler(const char *path, const char *types, lo_arg **argv,
/* lo_timetag ts = lo_message_get_timestamp(data); */

double when = (double) argv[0]->i + ((double) argv[1]->i / 1000000.0);
#ifdef SUBLATENCY
when -= SUBLATENCY;
#endif
char *sample_name = strdup((char *) argv[2]);

float offset = argv[3]->f;
Expand Down Expand Up @@ -176,7 +180,7 @@ void *zmqthread(void *data){

extern int server_init(void) {

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

0 comments on commit c4b8766

Please sign in to comment.