Browse Source

Merge d7c4cab48e into 7fa089095c

pull/5/merge
Erik de Castro Lopo 9 years ago
parent
commit
c24b1e6e01
3 changed files with 13 additions and 14 deletions
  1. +8
    -10
      metro.c
  2. +3
    -3
      midiseq.c
  3. +2
    -1
      simple_client.c

+ 8
- 10
metro.c View File

@@ -1,6 +1,6 @@
/* /*
Copyright (C) 2002 Anthony Van Groningen Copyright (C) 2002 Anthony Van Groningen
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
@@ -60,19 +60,19 @@ usage ()
} }


void void
process_silence (jack_nframes_t nframes)
process_silence (jack_nframes_t nframes)
{ {
sample_t *buffer = (sample_t *) jack_port_get_buffer (output_port, nframes); sample_t *buffer = (sample_t *) jack_port_get_buffer (output_port, nframes);
memset (buffer, 0, sizeof (jack_default_audio_sample_t) * nframes); memset (buffer, 0, sizeof (jack_default_audio_sample_t) * nframes);
} }


void void
process_audio (jack_nframes_t nframes)
process_audio (jack_nframes_t nframes)
{ {


sample_t *buffer = (sample_t *) jack_port_get_buffer (output_port, nframes); sample_t *buffer = (sample_t *) jack_port_get_buffer (output_port, nframes);
jack_nframes_t frames_left = nframes; jack_nframes_t frames_left = nframes;
while (wave_length - offset < frames_left) { while (wave_length - offset < frames_left) {
memcpy (buffer + (nframes - frames_left), wave + offset, sizeof (sample_t) * (wave_length - offset)); memcpy (buffer + (nframes - frames_left), wave + offset, sizeof (sample_t) * (wave_length - offset));
frames_left -= wave_length - offset; frames_left -= wave_length - offset;
@@ -111,7 +111,7 @@ sample_rate_change () {
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
sample_t scale; sample_t scale;
int i, attack_length, decay_length; int i, attack_length, decay_length;
double *amp; double *amp;
@@ -122,7 +122,6 @@ main (int argc, char *argv[])
int attack_percent = 1, decay_percent = 10, dur_arg = 100; int attack_percent = 1, decay_percent = 10, dur_arg = 100;
char *client_name = 0; char *client_name = 0;
char *bpm_string = "bpm"; char *bpm_string = "bpm";
int verbose = 0;
jack_status_t status; jack_status_t status;


const char *options = "f:A:D:a:d:b:n:thv"; const char *options = "f:A:D:a:d:b:n:thv";
@@ -140,7 +139,7 @@ main (int argc, char *argv[])
{"verbose", 0, 0, 'v'}, {"verbose", 0, 0, 'v'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
while ((opt = getopt_long (argc, argv, options, long_options, &option_index)) != EOF) { while ((opt = getopt_long (argc, argv, options, long_options, &option_index)) != EOF) {
switch (opt) { switch (opt) {
case 'f': case 'f':
@@ -186,13 +185,12 @@ main (int argc, char *argv[])
strcpy (client_name, optarg); strcpy (client_name, optarg);
break; break;
case 'v': case 'v':
verbose = 1;
break; break;
case 't': case 't':
transport_aware = 1; transport_aware = 1;
break; break;
default: default:
fprintf (stderr, "unknown option %c\n", opt);
fprintf (stderr, "unknown option %c\n", opt);
case 'h': case 'h':
usage (); usage ();
return -1; return -1;
@@ -264,5 +262,5 @@ main (int argc, char *argv[])
while (1) { while (1) {
sleep(1); sleep(1);
}; };
} }

+ 3
- 3
midiseq.c View File

@@ -1,6 +1,6 @@
/* /*
Copyright (C) 2004 Ian Esten Copyright (C) 2004 Ian Esten
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
@@ -85,7 +85,7 @@ static int process(jack_nframes_t nframes, void *arg)
int main(int narg, char **args) int main(int narg, char **args)
{ {
int i; int i;
jack_nframes_t nframes;
if((narg<6) || ((narg-3)%3 !=0)) if((narg<6) || ((narg-3)%3 !=0))
{ {
usage(); usage();
@@ -98,7 +98,7 @@ int main(int narg, char **args)
} }
jack_set_process_callback (client, process, 0); jack_set_process_callback (client, process, 0);
output_port = jack_port_register (client, "out", JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0); output_port = jack_port_register (client, "out", JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0);
nframes = jack_get_buffer_size(client);
loop_index = 0; loop_index = 0;
num_notes = (narg - 3)/3; num_notes = (narg - 3)/3;
note_frqs = malloc(num_notes*sizeof(unsigned char)); note_frqs = malloc(num_notes*sizeof(unsigned char));


+ 2
- 1
simple_client.c View File

@@ -133,6 +133,7 @@ main (int argc, char *argv[])


if (jack_connect (client, ports[0], jack_port_name (input_port))) { if (jack_connect (client, ports[0], jack_port_name (input_port))) {
fprintf (stderr, "cannot connect input ports\n"); fprintf (stderr, "cannot connect input ports\n");
exit (1);
} }


free (ports); free (ports);
@@ -160,5 +161,5 @@ main (int argc, char *argv[])
*/ */


jack_client_close (client); jack_client_close (client);
exit (0);
return 0;
} }

Loading…
Cancel
Save