Skip to content

Commit

Permalink
reinstate “loop” syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Gold committed Apr 23, 2015
1 parent 59678a1 commit 868293b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
7 changes: 2 additions & 5 deletions audio.c
Expand Up @@ -674,13 +674,10 @@ extern int audio_play(t_play_args* a) {

new->cut_continue = 0;
if (a->start < 0) {
a->start = -(a->start);
a->start = 0;
new->cut_continue = 1;
}
new->sample_loop = (int) trunc(a->end) - (int) trunc(a->start);
a->end = a->end - trunc(a->end - 1e-6); // 1e-6 is so 1.0 stays as 1.0
a->start = a->start - trunc(a->start);
//printf("loop/start/end: %d\t%f\t%f\n", new->sample_loop, a->start, a->end);
new->sample_loop = a->sample_loop;

init_vcf(new);
init_hpf(new);
Expand Down
1 change: 1 addition & 0 deletions audio.h
Expand Up @@ -129,6 +129,7 @@ typedef struct {
float bandf;
float bandq;
char unit;
int sample_loop;
} t_play_args;


Expand Down
11 changes: 9 additions & 2 deletions server.c
Expand Up @@ -127,8 +127,9 @@ int play_handler(const char *path, const char *types, lo_arg **argv,
float bandq = argc > (23+poffset) ? argv[23+poffset]->f : 0;

char *unit_name = argc > (24+poffset) ? (char *) argv[24+poffset] : "r";
int sample_loop = argc > (25+poffset) ? argv[25+poffset]->i : 0;

if (argc > 25+poffset) {
if (argc > 26+poffset) {
printf("play server unexpectedly received extra parameters, maybe update Dirt?\n");
}

Expand Down Expand Up @@ -180,7 +181,8 @@ int play_handler(const char *path, const char *types, lo_arg **argv,
hresonance,
bandf,
bandq,
unit
unit,
sample_loop
};
audio_play(&args);
free(sample_name);
Expand Down Expand Up @@ -244,6 +246,11 @@ extern int server_init(void) {

lo_server_thread st = lo_server_thread_new(OSC_PORT, error);

lo_server_thread_add_method(st, "/play", "iisffffffsffffififfffifffffi",
play_handler,
NULL
);

lo_server_thread_add_method(st, "/play", "iisffffffsffffififfffifffff",
play_handler,
NULL
Expand Down

0 comments on commit 868293b

Please sign in to comment.