mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-14 06:59:54 -05:00
huge correction of tabulators and whitespaces
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
b37ac0982b
commit
66a3d542ac
157 changed files with 2008 additions and 2008 deletions
|
|
@ -390,7 +390,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
|
||||
printf("\t capture: systime: %lli nsec, audio time %lli nsec, \tsystime delta %lli \t resolution %d ns \n",
|
||||
printf("\t capture: systime: %lli nsec, audio time %lli nsec, \tsystime delta %lli \t resolution %d ns \n",
|
||||
timediff(tstamp_c, trigger_tstamp_c),
|
||||
timestamp2ns(audio_tstamp_c),
|
||||
timediff(tstamp_c, trigger_tstamp_c) - timestamp2ns(audio_tstamp_c), audio_tstamp_report_c.accuracy
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ int main(void)
|
|||
}
|
||||
snd_ctl_close(handle);
|
||||
}
|
||||
|
||||
|
||||
snd_config_update_free_global();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,9 +251,9 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize)
|
|||
}
|
||||
|
||||
__again:
|
||||
if (buffer_size > 0)
|
||||
return -1;
|
||||
if (last_bufsize == *bufsize)
|
||||
if (buffer_size > 0)
|
||||
return -1;
|
||||
if (last_bufsize == *bufsize)
|
||||
*bufsize += 4;
|
||||
last_bufsize = *bufsize;
|
||||
if (*bufsize > latency_max)
|
||||
|
|
@ -282,8 +282,8 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize)
|
|||
snd_pcm_hw_params_get_buffer_size(p_params, &p_size);
|
||||
playback_buffer_size = p_size;
|
||||
if (p_psize * 2 < p_size) {
|
||||
snd_pcm_hw_params_get_periods_min(p_params, &val, NULL);
|
||||
if (val > 2) {
|
||||
snd_pcm_hw_params_get_periods_min(p_params, &val, NULL);
|
||||
if (val > 2) {
|
||||
printf("playback device does not support 2 periods per buffer\n");
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -291,7 +291,7 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize)
|
|||
}
|
||||
snd_pcm_hw_params_get_buffer_size(c_params, &c_size);
|
||||
if (c_psize * 2 < c_size) {
|
||||
snd_pcm_hw_params_get_periods_min(c_params, &val, NULL);
|
||||
snd_pcm_hw_params_get_periods_min(c_params, &val, NULL);
|
||||
if (val > 2 ) {
|
||||
printf("capture device does not support 2 periods per buffer\n");
|
||||
exit(0);
|
||||
|
|
@ -490,7 +490,7 @@ void applyeffect(char* buffer,int r)
|
|||
y[chn][1] = y[chn][0];
|
||||
|
||||
x[chn][0] = samples[i*channels+chn];
|
||||
y[chn][0] = a0*x[chn][0] + a1*x[chn][1] + a2*x[chn][2]
|
||||
y[chn][0] = a0*x[chn][0] + a1*x[chn][1] + a2*x[chn][2]
|
||||
- b1*y[chn][1] - b2*y[chn][2];
|
||||
samples[i*channels+chn] = y[chn][0];
|
||||
}
|
||||
|
|
@ -537,14 +537,14 @@ void help(void)
|
|||
"-X,--realtime do a realtime check (buffering)\n"
|
||||
"-O,--policy set scheduler policy (RR, FIFO or OTHER)\n"
|
||||
);
|
||||
printf("Recognized sample formats are:");
|
||||
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
|
||||
const char *s = snd_pcm_format_name(k);
|
||||
if (s)
|
||||
printf(" %s", s);
|
||||
}
|
||||
printf("\n\n");
|
||||
printf(
|
||||
printf("Recognized sample formats are:");
|
||||
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
|
||||
const char *s = snd_pcm_format_name(k);
|
||||
if (s)
|
||||
printf(" %s", s);
|
||||
}
|
||||
printf("\n\n");
|
||||
printf(
|
||||
"Tip #1 (usable latency with large periods, non-blocking mode, good CPU usage,\n"
|
||||
" superb xrun prevention):\n"
|
||||
" latency -m 8192 -M 8192 -t 1 -p\n"
|
||||
|
|
@ -724,17 +724,17 @@ int main(int argc, char *argv[])
|
|||
lfo = 0;
|
||||
dlfo = 2.*M_PI*FILTERSWEEP_LFO_FREQ/fs;
|
||||
|
||||
x[0] = (float*) malloc(channels*sizeof(float));
|
||||
x[1] = (float*) malloc(channels*sizeof(float));
|
||||
x[2] = (float*) malloc(channels*sizeof(float));
|
||||
y[0] = (float*) malloc(channels*sizeof(float));
|
||||
y[1] = (float*) malloc(channels*sizeof(float));
|
||||
y[2] = (float*) malloc(channels*sizeof(float));
|
||||
x[0] = (float*) malloc(channels*sizeof(float));
|
||||
x[1] = (float*) malloc(channels*sizeof(float));
|
||||
x[2] = (float*) malloc(channels*sizeof(float));
|
||||
y[0] = (float*) malloc(channels*sizeof(float));
|
||||
y[1] = (float*) malloc(channels*sizeof(float));
|
||||
y[2] = (float*) malloc(channels*sizeof(float));
|
||||
}
|
||||
|
||||
cap_avail_max = 0;
|
||||
pbk_fill_min = latency * 2;
|
||||
|
||||
|
||||
while (1) {
|
||||
frames_in = frames_out = 0;
|
||||
if (setparams(phandle, chandle, &latency) < 0)
|
||||
|
|
@ -819,7 +819,7 @@ int main(int argc, char *argv[])
|
|||
else {
|
||||
if (effect)
|
||||
applyeffect(buffer, r);
|
||||
if (writebuf(phandle, buffer, r, &frames_out) < 0)
|
||||
if (writebuf(phandle, buffer, r, &frames_out) < 0)
|
||||
ok = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -370,8 +370,8 @@ readtrack (void) /* read a track chunk */
|
|||
old_currtempo = Mf_currtempo;
|
||||
old_realtime = Mf_realtime;
|
||||
if (revised_time != tempo_change_time) {
|
||||
old_f_realtime = Mf_f_realtime;
|
||||
old_currtime = save_time;
|
||||
old_f_realtime = Mf_f_realtime;
|
||||
old_currtime = save_time;
|
||||
}
|
||||
delta_secs = mf_ticks2sec (revised_time-old_currtime, Mf_division, save_tempo);
|
||||
#ifdef DEBUG_TIMES
|
||||
|
|
@ -856,17 +856,17 @@ mf_write_track_chunk (int which_track, FILE *fp)
|
|||
eputc(laststatus = meta_event);
|
||||
eputc(end_of_track);
|
||||
|
||||
eputc(0);
|
||||
eputc(0);
|
||||
*/
|
||||
|
||||
/* It's impossible to know how long the track chunk will be beforehand,
|
||||
so the position of the track length data is kept so that it can
|
||||
be written after the chunk has been generated */
|
||||
so the position of the track length data is kept so that it can
|
||||
be written after the chunk has been generated */
|
||||
place_marker = ftell (fp);
|
||||
|
||||
/* This method turned out not to be portable because the
|
||||
parameter returned from ftell is not guaranteed to be
|
||||
in bytes on every machine */
|
||||
parameter returned from ftell is not guaranteed to be
|
||||
in bytes on every machine */
|
||||
/* track.length = place_marker - offset - (long) sizeof(track); */
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ extern void mferror(char *s);
|
|||
|
||||
/* 7 bit controllers */
|
||||
#define damper_pedal 0x40
|
||||
#define portamento 0x41
|
||||
#define portamento 0x41
|
||||
#define sustenuto 0x42
|
||||
#define soft_pedal 0x43
|
||||
#define general_4 0x44
|
||||
|
|
@ -119,7 +119,7 @@ extern void mferror(char *s);
|
|||
#define Lexicon (0x06) /* Lexicon */
|
||||
#define Tempi (0x20) /* Bon Tempi */
|
||||
#define Siel (0x21) /* S.I.E.L. */
|
||||
#define Kawai (0x41)
|
||||
#define Kawai (0x41)
|
||||
#define Roland (0x42)
|
||||
#define Korg (0x42)
|
||||
#define Yamaha (0x43)
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ int main(int argc, char** argv)
|
|||
struct timeval start, end;
|
||||
long long diff;
|
||||
snd_rawmidi_status_t *istat, *ostat;
|
||||
|
||||
|
||||
for (i = 1 ; i<argc ; i++) {
|
||||
if (argv[i][0]=='-') {
|
||||
if (!strcmp(argv[i], "--help")) {
|
||||
|
|
@ -96,7 +96,7 @@ int main(int argc, char** argv)
|
|||
if (i + 1 < argc)
|
||||
oname = argv[++i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ int main(int argc, char** argv)
|
|||
fprintf(stderr, "Using: \n");
|
||||
fprintf(stderr, " Input: %s Output: %s\n", iname, oname);
|
||||
}
|
||||
|
||||
|
||||
err = snd_rawmidi_open(&handle_in, NULL, iname, SND_RAWMIDI_NONBLOCK);
|
||||
if (err) {
|
||||
fprintf(stderr,"snd_rawmidi_open %s failed: %d\n",iname,err);
|
||||
|
|
@ -180,11 +180,11 @@ int main(int argc, char** argv)
|
|||
if (verbose) {
|
||||
fprintf(stderr,"Closing\n");
|
||||
}
|
||||
|
||||
snd_rawmidi_drain(handle_in);
|
||||
snd_rawmidi_close(handle_in);
|
||||
snd_rawmidi_drain(handle_out);
|
||||
snd_rawmidi_close(handle_out);
|
||||
|
||||
snd_rawmidi_drain(handle_in);
|
||||
snd_rawmidi_close(handle_in);
|
||||
snd_rawmidi_drain(handle_out);
|
||||
snd_rawmidi_close(handle_out);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,30 +92,30 @@ void mix_areas_srv(unsigned int size,
|
|||
{
|
||||
src_step /= sizeof(*src);
|
||||
sum_step /= sizeof(*sum);
|
||||
while (size-- > 0) {
|
||||
atomic_add(sum, *src);
|
||||
src += src_step;
|
||||
sum += sum_step;
|
||||
}
|
||||
while (size-- > 0) {
|
||||
atomic_add(sum, *src);
|
||||
src += src_step;
|
||||
sum += sum_step;
|
||||
}
|
||||
}
|
||||
|
||||
void saturate(unsigned int size,
|
||||
s16 *dst, const s32 *sum,
|
||||
unsigned int dst_step, unsigned int sum_step)
|
||||
s16 *dst, const s32 *sum,
|
||||
unsigned int dst_step, unsigned int sum_step)
|
||||
{
|
||||
dst_step /= sizeof(*dst);
|
||||
sum_step /= sizeof(*sum);
|
||||
while (size-- > 0) {
|
||||
s32 sample = *sum;
|
||||
if (unlikely(sample < -0x8000))
|
||||
*dst = -0x8000;
|
||||
else if (unlikely(sample > 0x7fff))
|
||||
*dst = 0x7fff;
|
||||
else
|
||||
*dst = sample;
|
||||
dst += dst_step;
|
||||
sum += sum_step;
|
||||
}
|
||||
while (size-- > 0) {
|
||||
s32 sample = *sum;
|
||||
if (unlikely(sample < -0x8000))
|
||||
*dst = -0x8000;
|
||||
else if (unlikely(sample > 0x7fff))
|
||||
*dst = 0x7fff;
|
||||
else
|
||||
*dst = sample;
|
||||
dst += dst_step;
|
||||
sum += sum_step;
|
||||
}
|
||||
}
|
||||
|
||||
void mix_areas0(unsigned int size,
|
||||
|
|
@ -206,7 +206,7 @@ void init(s16 *dst, s32 *sum, int size)
|
|||
{
|
||||
int count;
|
||||
char *a;
|
||||
|
||||
|
||||
for (count = size - 1; count >= 0; count--)
|
||||
*sum++ = 0;
|
||||
for (count = size - 1; count >= 0; count--)
|
||||
|
|
@ -226,16 +226,16 @@ int main(int argc, char **argv)
|
|||
int LOOP = 100;
|
||||
int i, t;
|
||||
unsigned long long begin, end, diff, diffS, diff0, diff1, diff1_mmx, diff2;
|
||||
double cpu_clock = detect_cpu_clock();
|
||||
double cpu_clock = detect_cpu_clock();
|
||||
s16 *dst = malloc(sizeof(*dst) * size);
|
||||
s32 *sum = calloc(size, sizeof(*sum));
|
||||
s16 **srcs = malloc(sizeof(*srcs) * n);
|
||||
|
||||
setscheduler();
|
||||
#ifndef CONFIG_SMP
|
||||
printf("CPU clock: %fMhz (UP)\n\n", cpu_clock / 10e5);
|
||||
printf("CPU clock: %fMhz (UP)\n\n", cpu_clock / 10e5);
|
||||
#else
|
||||
printf("CPU clock: %fMhz (SMP)\n\n", cpu_clock / 10e5);
|
||||
printf("CPU clock: %fMhz (SMP)\n\n", cpu_clock / 10e5);
|
||||
#endif
|
||||
if (argc > 3) {
|
||||
size = atoi(argv[1]);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(pname, "-")) {
|
||||
if (strcmp(pname, "-")) {
|
||||
err = snd_pcm_open(&phandle, pname, SND_PCM_STREAM_PLAYBACK, 0);
|
||||
if (err < 0) {
|
||||
fprintf(stderr, "Playback PCM open error: %s\n", snd_strerror(err));
|
||||
|
|
|
|||
38
test/pcm.c
38
test/pcm.c
|
|
@ -33,7 +33,7 @@ static snd_pcm_sframes_t buffer_size;
|
|||
static snd_pcm_sframes_t period_size;
|
||||
static snd_output_t *output = NULL;
|
||||
|
||||
static void generate_sine(const snd_pcm_channel_area_t *areas,
|
||||
static void generate_sine(const snd_pcm_channel_area_t *areas,
|
||||
snd_pcm_uframes_t offset,
|
||||
int count, double *_phase)
|
||||
{
|
||||
|
|
@ -224,7 +224,7 @@ static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams)
|
|||
/*
|
||||
* Underrun and suspend recovery
|
||||
*/
|
||||
|
||||
|
||||
static int xrun_recovery(snd_pcm_t *handle, int err)
|
||||
{
|
||||
if (verbose)
|
||||
|
|
@ -279,7 +279,7 @@ static int write_loop(snd_pcm_t *handle,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Transfer method - write and wait for room in buffer using poll
|
||||
*/
|
||||
|
|
@ -401,7 +401,7 @@ static void async_callback(snd_async_handler_t *ahandler)
|
|||
snd_pcm_channel_area_t *areas = data->areas;
|
||||
snd_pcm_sframes_t avail;
|
||||
int err;
|
||||
|
||||
|
||||
avail = snd_pcm_avail_update(handle);
|
||||
while (avail >= period_size) {
|
||||
generate_sine(areas, 0, period_size, &data->phase);
|
||||
|
|
@ -474,7 +474,7 @@ static void async_direct_callback(snd_async_handler_t *ahandler)
|
|||
snd_pcm_sframes_t avail, commitres;
|
||||
snd_pcm_state_t state;
|
||||
int first = 0, err;
|
||||
|
||||
|
||||
while (1) {
|
||||
state = snd_pcm_state(handle);
|
||||
if (state == SND_PCM_STATE_XRUN) {
|
||||
|
|
@ -678,7 +678,7 @@ static int direct_loop(snd_pcm_t *handle,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Transfer method - direct write only using mmap_write functions
|
||||
*/
|
||||
|
|
@ -711,7 +711,7 @@ static int direct_write_loop(snd_pcm_t *handle,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
|
@ -753,16 +753,16 @@ static void help(void)
|
|||
"-n,--noresample do not resample\n"
|
||||
"-e,--pevent enable poll event after each period\n"
|
||||
"\n");
|
||||
printf("Recognized sample formats are:");
|
||||
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
|
||||
const char *s = snd_pcm_format_name(k);
|
||||
if (s)
|
||||
printf(" %s", s);
|
||||
}
|
||||
printf("\n");
|
||||
printf("Recognized transfer methods are:");
|
||||
for (k = 0; transfer_methods[k].name; k++)
|
||||
printf(" %s", transfer_methods[k].name);
|
||||
printf("Recognized sample formats are:");
|
||||
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
|
||||
const char *s = snd_pcm_format_name(k);
|
||||
if (s)
|
||||
printf(" %s", s);
|
||||
}
|
||||
printf("\n");
|
||||
printf("Recognized transfer methods are:");
|
||||
for (k = 0; transfer_methods[k].name; k++)
|
||||
printf(" %s", transfer_methods[k].name);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
|
@ -889,7 +889,7 @@ int main(int argc, char *argv[])
|
|||
printf("Playback open error: %s\n", snd_strerror(err));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if ((err = set_hwparams(handle, hwparams, transfer_methods[method].access)) < 0) {
|
||||
printf("Setting of hwparams failed: %s\n", snd_strerror(err));
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
@ -907,7 +907,7 @@ int main(int argc, char *argv[])
|
|||
printf("No enough memory\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
areas = calloc(channels, sizeof(snd_pcm_channel_area_t));
|
||||
if (areas == NULL) {
|
||||
printf("No enough memory\n");
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ int main(void)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
for (i = 0; i < 16; i++) {
|
||||
frames = snd_pcm_writei(handle, buffer, sizeof(buffer));
|
||||
if (frames < 0)
|
||||
frames = snd_pcm_recover(handle, frames, 0);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* MIDI file player for ALSA sequencer
|
||||
* MIDI file player for ALSA sequencer
|
||||
* (type 0 only!, the library that is used doesn't support merging of tracks)
|
||||
*
|
||||
* Copyright (c) 1998 by Frank van de Pol <F.K.W.van.de.Pol@inter.nl.net>
|
||||
|
|
@ -166,15 +166,15 @@ static void do_header(int format, int ntracks, int division)
|
|||
snd_seq_queue_tempo_alloca(&tempo);
|
||||
/* ppq must be set before starting the timer */
|
||||
if (snd_seq_get_queue_tempo(seq_handle, dest_queue, tempo) < 0) {
|
||||
perror("get_queue_tempo");
|
||||
exit(1);
|
||||
perror("get_queue_tempo");
|
||||
exit(1);
|
||||
}
|
||||
if ((slave_ppq = snd_seq_queue_tempo_get_ppq(tempo)) != ppq) {
|
||||
snd_seq_queue_tempo_set_ppq(tempo, ppq);
|
||||
if (snd_seq_set_queue_tempo(seq_handle, dest_queue, tempo) < 0) {
|
||||
perror("set_queue_tempo");
|
||||
if (!slave && !shared_queue)
|
||||
exit(1);
|
||||
perror("set_queue_tempo");
|
||||
if (!slave && !shared_queue)
|
||||
exit(1);
|
||||
else
|
||||
printf("different PPQ %d in SMF from queue PPQ %d\n", ppq, slave_ppq);
|
||||
} else
|
||||
|
|
@ -186,10 +186,10 @@ static void do_header(int format, int ntracks, int division)
|
|||
/* start playing... */
|
||||
if (slave) {
|
||||
if (verbose >= VERB_INFO)
|
||||
printf("Wait till timer starts...\n");
|
||||
printf("Wait till timer starts...\n");
|
||||
wait_start();
|
||||
if (verbose >= VERB_INFO)
|
||||
printf("Go!\n");
|
||||
printf("Go!\n");
|
||||
} else if (shared_queue) {
|
||||
snd_seq_queue_status_t *stat;
|
||||
snd_seq_queue_status_alloca(&stat);
|
||||
|
|
@ -369,7 +369,7 @@ static snd_seq_event_t *wait_for_event(void)
|
|||
{
|
||||
int left;
|
||||
snd_seq_event_t *input_event;
|
||||
|
||||
|
||||
if (use_blocking_mode) {
|
||||
/* read the event - blocked until any event is read */
|
||||
left = snd_seq_event_input(seq_handle, &input_event);
|
||||
|
|
@ -506,13 +506,13 @@ int main(int argc, char *argv[])
|
|||
perror("open /dev/snd/seq");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
tmp = snd_seq_nonblock(seq_handle, !use_blocking_mode);
|
||||
if (tmp < 0) {
|
||||
perror("block_mode");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* set the name */
|
||||
/* set the event filter to receive only the echo event */
|
||||
/* if running in slave mode, also listen for a START event */
|
||||
|
|
@ -529,7 +529,7 @@ int main(int argc, char *argv[])
|
|||
perror("create port");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
if (snd_seq_parse_address(seq_handle, &dest_addr, addr) < 0) {
|
||||
perror("invalid destination address");
|
||||
exit(1);
|
||||
|
|
@ -560,17 +560,17 @@ int main(int argc, char *argv[])
|
|||
exit(1);
|
||||
}
|
||||
|
||||
/* subscribe for the timer START event */
|
||||
if (slave) {
|
||||
/* subscribe for the timer START event */
|
||||
if (slave) {
|
||||
tmp = snd_seq_connect_from(seq_handle, my_port,
|
||||
SND_SEQ_CLIENT_SYSTEM,
|
||||
dest_queue + 16 /*snd_seq_queue_sync_port(dest_queue)*/);
|
||||
if (tmp < 0) {
|
||||
perror("subscribe");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* change the pool size */
|
||||
if (snd_seq_set_client_pool_output(seq_handle, WRITE_POOL_SIZE) < 0 ||
|
||||
snd_seq_set_client_pool_input(seq_handle, READ_POOL_SIZE) < 0 ||
|
||||
|
|
@ -578,7 +578,7 @@ int main(int argc, char *argv[])
|
|||
perror("pool");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
if (optind < argc) {
|
||||
F = fopen(argv[optind], "r");
|
||||
if (F == NULL) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ void normalize(struct timeval *tv)
|
|||
} else if (tv->tv_sec < 0) {
|
||||
while (tv->tv_usec <= -1000000) { tv->tv_usec += 1000000; --tv->tv_sec; }
|
||||
while (tv->tv_usec > 0) { tv->tv_usec -= 1000000; ++tv->tv_sec; }
|
||||
} else {
|
||||
} else {
|
||||
while (tv->tv_usec >= 1000000) { tv->tv_usec -= 1000000; ++tv->tv_sec; }
|
||||
while (tv->tv_usec < 0) { tv->tv_usec += 1000000; --tv->tv_sec; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ int main(int argc,char** argv)
|
|||
|
||||
int fd_in = -1,fd_out = -1;
|
||||
snd_rawmidi_t *handle_in = 0,*handle_out = 0;
|
||||
|
||||
|
||||
if (argc==1) {
|
||||
usage();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
for (i = 1 ; i<argc ; i++) {
|
||||
if (argv[i][0]=='-') {
|
||||
switch (argv[i][1]) {
|
||||
|
|
@ -80,7 +80,7 @@ int main(int argc,char** argv)
|
|||
if (i + 1 < argc)
|
||||
node_out = argv[++i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ int main(int argc,char** argv)
|
|||
if (device_in) {
|
||||
fprintf(stderr,"device %s\n",device_in);
|
||||
}else if (node_in){
|
||||
fprintf(stderr,"%s\n",node_in);
|
||||
fprintf(stderr,"%s\n",node_in);
|
||||
}else{
|
||||
fprintf(stderr,"NONE\n");
|
||||
}
|
||||
|
|
@ -98,14 +98,14 @@ int main(int argc,char** argv)
|
|||
if (device_out) {
|
||||
fprintf(stderr,"device %s\n",device_out);
|
||||
}else if (node_out){
|
||||
fprintf(stderr,"%s\n",node_out);
|
||||
fprintf(stderr,"%s\n",node_out);
|
||||
}else{
|
||||
fprintf(stderr,"NONE\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (device_in) {
|
||||
err = snd_rawmidi_open(&handle_in,NULL,device_in,0);
|
||||
err = snd_rawmidi_open(&handle_in,NULL,device_in,0);
|
||||
if (err) {
|
||||
fprintf(stderr,"snd_rawmidi_open %s failed: %d\n",device_in,err);
|
||||
}
|
||||
|
|
@ -114,7 +114,7 @@ int main(int argc,char** argv)
|
|||
fd_in = open(node_in,O_RDONLY);
|
||||
if (fd_in<0) {
|
||||
fprintf(stderr,"open %s for input failed\n",node_in);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signal(SIGINT,sighandler);
|
||||
|
|
@ -126,17 +126,17 @@ int main(int argc,char** argv)
|
|||
}
|
||||
}
|
||||
if (node_out && (!node_in || strcmp(node_out,node_in))) {
|
||||
fd_out = open(node_out,O_WRONLY);
|
||||
fd_out = open(node_out,O_WRONLY);
|
||||
if (fd_out<0) {
|
||||
fprintf(stderr,"open %s for output failed\n",node_out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (node_in && node_out && strcmp(node_out,node_in)==0) {
|
||||
fd_in = fd_out = open(node_out,O_RDWR);
|
||||
fd_in = fd_out = open(node_out,O_RDWR);
|
||||
if (fd_out<0) {
|
||||
fprintf(stderr,"open %s for input and output failed\n",node_out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!thru) {
|
||||
|
|
@ -210,7 +210,7 @@ int main(int argc,char** argv)
|
|||
if (verbose) {
|
||||
fprintf(stderr,"read %02x\n",ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (handle_out || fd_out!=-1) {
|
||||
|
|
@ -227,7 +227,7 @@ int main(int argc,char** argv)
|
|||
ch=0x90; snd_rawmidi_write(handle_out,&ch,1);
|
||||
ch=60; snd_rawmidi_write(handle_out,&ch,1);
|
||||
ch=0; snd_rawmidi_write(handle_out,&ch,1);
|
||||
snd_rawmidi_drain(handle_out);
|
||||
snd_rawmidi_drain(handle_out);
|
||||
}
|
||||
if (fd_out!=-1) {
|
||||
unsigned char ch;
|
||||
|
|
@ -246,27 +246,27 @@ int main(int argc,char** argv)
|
|||
}
|
||||
while (!stop) {
|
||||
unsigned char ch;
|
||||
|
||||
|
||||
if (handle_in) {
|
||||
snd_rawmidi_read(handle_in,&ch,1);
|
||||
}
|
||||
if (fd_in!=-1) {
|
||||
read(fd_in,&ch,1);
|
||||
}
|
||||
}
|
||||
if (verbose) {
|
||||
fprintf(stderr,"thru: %02x\n",ch);
|
||||
}
|
||||
|
||||
if (handle_out) {
|
||||
snd_rawmidi_write(handle_out,&ch,1);
|
||||
snd_rawmidi_drain(handle_out);
|
||||
snd_rawmidi_drain(handle_out);
|
||||
}
|
||||
if (fd_out!=-1) {
|
||||
write(fd_out,&ch,1);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
fprintf(stderr,"Testing midi thru needs both input and output\n");
|
||||
fprintf(stderr,"Testing midi thru needs both input and output\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
|
@ -274,14 +274,14 @@ int main(int argc,char** argv)
|
|||
if (verbose) {
|
||||
fprintf(stderr,"Closing\n");
|
||||
}
|
||||
|
||||
|
||||
if (handle_in) {
|
||||
snd_rawmidi_drain(handle_in);
|
||||
snd_rawmidi_close(handle_in);
|
||||
snd_rawmidi_drain(handle_in);
|
||||
snd_rawmidi_close(handle_in);
|
||||
}
|
||||
if (handle_out) {
|
||||
snd_rawmidi_drain(handle_out);
|
||||
snd_rawmidi_close(handle_out);
|
||||
snd_rawmidi_drain(handle_out);
|
||||
snd_rawmidi_close(handle_out);
|
||||
}
|
||||
if (fd_in!=-1) {
|
||||
close(fd_in);
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ int decode_event(snd_seq_event_t * ev)
|
|||
ev->data.note.note,
|
||||
ev->data.note.velocity);
|
||||
break;
|
||||
|
||||
|
||||
case SND_SEQ_EVENT_CONTROLLER:
|
||||
printf("; ch=%d, param=%i, value=%i\n",
|
||||
ev->data.control.channel,
|
||||
|
|
@ -162,32 +162,32 @@ int decode_event(snd_seq_event_t * ev)
|
|||
ev->data.control.channel,
|
||||
ev->data.control.value);
|
||||
break;
|
||||
|
||||
|
||||
case SND_SEQ_EVENT_CHANPRESS:
|
||||
case SND_SEQ_EVENT_PITCHBEND:
|
||||
printf("; ch=%d, value=%i\n",
|
||||
ev->data.control.channel,
|
||||
ev->data.control.value);
|
||||
break;
|
||||
|
||||
|
||||
case SND_SEQ_EVENT_SYSEX:
|
||||
{
|
||||
unsigned char *sysex = (unsigned char *) ev + sizeof(snd_seq_event_t);
|
||||
unsigned int c;
|
||||
|
||||
|
||||
printf("; len=%d [", ev->data.ext.len);
|
||||
|
||||
|
||||
for (c = 0; c < ev->data.ext.len; c++) {
|
||||
printf("%02x%s", sysex[c], c < ev->data.ext.len - 1 ? ":" : "");
|
||||
}
|
||||
printf("]\n");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SND_SEQ_EVENT_QFRAME:
|
||||
printf("; frame=0x%02x\n", ev->data.control.value);
|
||||
break;
|
||||
|
||||
|
||||
case SND_SEQ_EVENT_CLOCK:
|
||||
case SND_SEQ_EVENT_START:
|
||||
case SND_SEQ_EVENT_CONTINUE:
|
||||
|
|
@ -202,14 +202,14 @@ int decode_event(snd_seq_event_t * ev)
|
|||
case SND_SEQ_EVENT_ECHO:
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
printf("; ");
|
||||
for (i = 0; i < 8; i++) {
|
||||
printf("%02i%s", ev->data.raw8.d[i], i < 7 ? ":" : "\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SND_SEQ_EVENT_CLIENT_START:
|
||||
case SND_SEQ_EVENT_CLIENT_EXIT:
|
||||
case SND_SEQ_EVENT_CLIENT_CHANGE:
|
||||
|
|
@ -340,7 +340,7 @@ void event_decoder(snd_seq_t *handle, int argc, char *argv[])
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
max = snd_seq_poll_descriptors_count(handle, POLLIN);
|
||||
pfds = alloca(sizeof(*pfds) * max);
|
||||
while (1) {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ void event_sender_start_timer(snd_seq_t *handle,
|
|||
snd_pcm_t *phandle ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
||||
#ifdef USE_PCM
|
||||
if (phandle) {
|
||||
snd_pcm_playback_info_t pinfo;
|
||||
|
|
@ -90,7 +90,7 @@ void event_sender_start_timer(snd_seq_t *handle,
|
|||
fprintf(stderr, "Sequencer PCM timer setup failed: %s\n", snd_strerror(err));
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if ((err = snd_seq_start_queue(handle, queue, NULL))<0)
|
||||
fprintf(stderr, "Timer event output error: %s\n", snd_strerror(err));
|
||||
|
|
@ -108,11 +108,11 @@ void event_sender_filter(snd_seq_t *handle)
|
|||
}
|
||||
|
||||
void send_event(snd_seq_t *handle, int queue, int client, int port,
|
||||
snd_seq_addr_t *dest, int *time)
|
||||
snd_seq_addr_t *dest, int *time)
|
||||
{
|
||||
int err;
|
||||
snd_seq_event_t ev;
|
||||
|
||||
|
||||
bzero(&ev, sizeof(ev));
|
||||
ev.queue = queue;
|
||||
ev.source.client = ev.dest.client = client;
|
||||
|
|
@ -222,7 +222,7 @@ void event_sender(snd_seq_t *handle, int argc, char *argv[])
|
|||
}
|
||||
#endif
|
||||
event_sender_start_timer(handle, client, queue, phandle);
|
||||
|
||||
|
||||
/* send the first event */
|
||||
send_event(handle, queue, client, port, &addr, &time);
|
||||
#ifdef USE_PCM
|
||||
|
|
|
|||
24
test/seq.c
24
test/seq.c
|
|
@ -28,7 +28,7 @@ void set_name(snd_seq_t *handle)
|
|||
{
|
||||
int err;
|
||||
char name[64];
|
||||
|
||||
|
||||
sprintf(name, "SeqUtil - %i", getpid());
|
||||
if ((err = snd_seq_set_client_name(handle, name)) < 0) {
|
||||
fprintf(stderr, "Set client info error: %s\n", snd_strerror(err));
|
||||
|
|
@ -40,7 +40,7 @@ void system_info(snd_seq_t *handle)
|
|||
{
|
||||
int err;
|
||||
snd_seq_system_info_t *sysinfo;
|
||||
|
||||
|
||||
snd_seq_system_info_alloca(&sysinfo);
|
||||
if ((err = snd_seq_system_info(handle, sysinfo))<0) {
|
||||
fprintf(stderr, "System info error: %s\n", snd_strerror(err));
|
||||
|
|
@ -75,7 +75,7 @@ void show_queue_status(snd_seq_t *handle, int queue)
|
|||
exit(0);
|
||||
}
|
||||
printf("Queue %i info\n", snd_seq_queue_status_get_queue(status));
|
||||
printf(" Tick : %u\n", snd_seq_queue_status_get_tick_time(status));
|
||||
printf(" Tick : %u\n", snd_seq_queue_status_get_tick_time(status));
|
||||
printf(" Realtime : %i.%i\n",
|
||||
snd_seq_queue_status_get_real_time(status)->tv_sec,
|
||||
snd_seq_queue_status_get_real_time(status)->tv_nsec);
|
||||
|
|
@ -162,10 +162,10 @@ int main(int argc, char *argv[])
|
|||
{"verbose", 0, NULL, HELPID_VERBOSE},
|
||||
{"version", 0, NULL, HELPID_VERSION},
|
||||
{NULL, 0, NULL, 0},
|
||||
};
|
||||
|
||||
morehelp = 0;
|
||||
|
||||
};
|
||||
|
||||
morehelp = 0;
|
||||
|
||||
while (1) {
|
||||
int c;
|
||||
|
||||
|
|
@ -193,10 +193,10 @@ int main(int argc, char *argv[])
|
|||
morehelp++;
|
||||
}
|
||||
}
|
||||
if (morehelp) {
|
||||
help();
|
||||
return 1;
|
||||
}
|
||||
if (morehelp) {
|
||||
help();
|
||||
return 1;
|
||||
}
|
||||
if (argc - optind <= 0) {
|
||||
fprintf(stderr, "seq: Specify command...\n");
|
||||
return 0;
|
||||
|
|
@ -208,7 +208,7 @@ int main(int argc, char *argv[])
|
|||
set_name(handle);
|
||||
system_info(handle);
|
||||
|
||||
if (!strcmp(argv[optind], "system")) {
|
||||
if (!strcmp(argv[optind], "system")) {
|
||||
show_system_info(handle);
|
||||
} else if (!strcmp(argv[optind], "queue")) {
|
||||
arg = argc - optind > 1 ? atoi(argv[optind + 1]) : -1;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ void show_status(void *handle)
|
|||
{
|
||||
int err;
|
||||
snd_timer_status_t *status;
|
||||
|
||||
|
||||
snd_timer_status_alloca(&status);
|
||||
if ((err = snd_timer_status(handle, status)) < 0) {
|
||||
fprintf(stderr, "timer status %i (%s)\n", err, snd_strerror(err));
|
||||
|
|
@ -27,7 +27,7 @@ void read_loop(void *handle, int master_ticks, int timeout)
|
|||
int count, err;
|
||||
struct pollfd *fds;
|
||||
snd_timer_read_t tr;
|
||||
|
||||
|
||||
count = snd_timer_poll_descriptors_count(handle);
|
||||
fds = calloc(count, sizeof(struct pollfd));
|
||||
if (fds == NULL) {
|
||||
|
|
@ -60,7 +60,7 @@ static void async_callback(snd_async_handler_t *ahandler)
|
|||
snd_timer_t *handle = snd_async_handler_get_timer(ahandler);
|
||||
int *acount = snd_async_handler_get_callback_private(ahandler);
|
||||
snd_timer_read_t tr;
|
||||
|
||||
|
||||
while (snd_timer_read(handle, &tr, sizeof(tr)) == sizeof(tr)) {
|
||||
printf("TIMER: resolution = %uns, ticks = %u\n",
|
||||
tr.resolution, tr.ticks);
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ static int add_iec958_elem_set(struct elem_set_trial *trial,
|
|||
|
||||
err = snd_ctl_elem_add_iec958(trial->handle, trial->id);
|
||||
if (err < 0)
|
||||
return err;
|
||||
return err;
|
||||
|
||||
/*
|
||||
* In historical reason, the above API is not allowed to fill all of
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue