mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Corrections by Kevin Conder <kconder@interaccess.com>
This commit is contained in:
parent
b559c97833
commit
853304bbf4
39 changed files with 386 additions and 386 deletions
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Author: Jaroslav Kysela <perex@suse.cz>
|
||||
*
|
||||
* Author of bandpass filtersweep effect:
|
||||
* Author of bandpass filter sweep effect:
|
||||
* Maarten de Boer <mdeboer@iua.upf.es>
|
||||
*
|
||||
* This small demo program can be used for measuring latency between
|
||||
|
|
@ -383,7 +383,7 @@ long writebuf(snd_pcm_t *handle, char *buf, long len, size_t *frames)
|
|||
#define FILTERSWEEP_LFO_FREQ 0.2
|
||||
#define FILTER_BANDWIDTH 50
|
||||
|
||||
/* filter sweep variables */
|
||||
/* filter the sweep variables */
|
||||
float lfo,dlfo,fs,fc,BW,C,D,a0,a1,a2,b1,b2,*x[3],*y[3];
|
||||
|
||||
void applyeffect(char* buffer,int r)
|
||||
|
|
@ -439,7 +439,7 @@ Usage: latency [OPTION]... [FILE]...
|
|||
-b,--block block mode
|
||||
-t,--time maximal tick time in us
|
||||
-p,--poll use poll (wait for event - reduces CPU usage)
|
||||
-e,--effect apply an effect (bandpass filtersweep)
|
||||
-e,--effect apply an effect (bandpass filter sweep)
|
||||
");
|
||||
printf("Recognized sample formats are:");
|
||||
for (k = 0; k < SND_PCM_FORMAT_LAST; ++(unsigned long) k) {
|
||||
|
|
@ -449,7 +449,7 @@ Usage: latency [OPTION]... [FILE]...
|
|||
}
|
||||
printf("\n\n");
|
||||
printf("\
|
||||
Tip #1 (useable latency with large periods, non-blocking mode, good CPU usage,
|
||||
Tip #1 (usable latency with large periods, non-blocking mode, good CPU usage,
|
||||
superb xrun prevention):
|
||||
latency -m 8192 -M 8192 -t 1 -p
|
||||
Tip #2 (superb latency, non-blocking mode, but heavy CPU usage):
|
||||
|
|
@ -576,7 +576,7 @@ int main(int argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* initialize filter sweep variables */
|
||||
/* initialize the filter sweep variables */
|
||||
if (effect) {
|
||||
fs = (float) rate;
|
||||
BW = FILTER_BANDWIDTH;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ unsigned int tempo;
|
|||
.fi
|
||||
|
||||
.SH DESCRIPTION
|
||||
The \fCmfread\fR function reads and inteprets a standard MIDI file.
|
||||
The \fCmfread\fR function reads and interprets a standard MIDI file.
|
||||
To use it you need to understand the general form of a
|
||||
MIDI file and the type of information it contains, but you don't
|
||||
need to know much, if anything, about the detailed format of the file
|
||||
|
|
@ -180,14 +180,14 @@ types:
|
|||
0x05 Lyric
|
||||
0x06 Marker
|
||||
0x07 Cue Point
|
||||
0x08-0x0F Reserverd but Undefined
|
||||
0x08-0x0F Reserved but Undefined
|
||||
.fi
|
||||
.in -1i
|
||||
|
||||
\fCMf_text\fR is called for each of these; the arguments are
|
||||
the type number, the message length, and a pointer to the message buffer.
|
||||
|
||||
Misceallaneous \fImeta\fR messages are handled by \fCMf_metamisc\fR,
|
||||
Miscellaneous \fImeta\fR messages are handled by \fCMf_metamisc\fR,
|
||||
sequencer-specific messages are handled by \fCMf_seqspecific\fR, and
|
||||
arbitrary "escape" messages (started with 0xF7) are handled by
|
||||
\fCMf_arbitrary\fR.
|
||||
|
|
@ -243,7 +243,7 @@ access your MIDI data structure, which can make use of other library
|
|||
routines to write the actual MIDI data. The routine
|
||||
\fCMf_writetrack\fR will be passed a single parameter which is the
|
||||
number of the track to be written. The pointer \fCMf_putc\fR should be
|
||||
set to point to a routine that accepts a charcter as input, writes that
|
||||
set to point to a routine that accepts a character as input, writes that
|
||||
character to a file, and returns the value that was written. In the
|
||||
case of a format 1 file, a routine has to be written to write a tempo
|
||||
map, and assigned to the function pointer \fCMf_writetempotrack\fR.
|
||||
|
|
@ -268,7 +268,7 @@ whether bit 15 is set or not. If bit 15 of division is zero,
|
|||
bits 14 through 0 represent the number of delta-time "ticks"
|
||||
which make up a quarter note. If bit 15 of division is a one,
|
||||
delta-times in a file correspond to subdivisions of a second
|
||||
similiar to SMPTE and MIDI time code. In this format bits
|
||||
similar to SMPTE and MIDI time code. In this format bits
|
||||
14 through 8 contain one of four values - 24, -25, -29, or -30,
|
||||
corresponding to the four standard SMPTE and MIDI time code
|
||||
frame per second formats, where -29 represents 30 drop frame.
|
||||
|
|
@ -279,7 +279,7 @@ the the resolution within a frame. Refer the Standard MIDI Files
|
|||
.SH WRITING EXAMPLE
|
||||
The following is a simple program to demonstrate writing MIDI files.
|
||||
The track would consist of a series of quarter notes from lowest to
|
||||
highest in pitch at constant velocity, each separted by a quarter-note
|
||||
highest in pitch at constant velocity, each separated by a quarter-note
|
||||
rest.
|
||||
.sp
|
||||
.in +1i
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
* The file format implemented here is called
|
||||
* Standard MIDI Files, and is part of the Musical
|
||||
* instrument Digital Interface specification.
|
||||
* The spec is avaiable from:
|
||||
* The spec is available from:
|
||||
*
|
||||
* International MIDI Association
|
||||
* 5316 West 57th Street
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
* (1) can now set the global variable Mf_interactive to 1 to prevent the
|
||||
* reading functions from looking for file and track headers
|
||||
* (2) can now write system exclusive data with
|
||||
* mf_write_midi_event(delta_time, system_exlusive, 0, data, size)
|
||||
* mf_write_midi_event(delta_time, system_exclusive, 0, data, size)
|
||||
* (3) changed definition of 'sequencer_specific' in midifile.h to 0x7f
|
||||
* (4) changed mf_write_tempo to take additional delta_time as first argument
|
||||
* (since delta need not be zero)
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
* because Mf_currtime does not really measure time at all, since
|
||||
* its units change value at every tempo change. Mf_realtime is
|
||||
* the midi-time elapsed in units of 1/16 of a centisecond (but it
|
||||
* does not handle smpte times)
|
||||
* does not handle SMPTE times)
|
||||
* (9) maintains a history of tempo settings to update Mf_currtempo,
|
||||
* to handle tempo tracks.
|
||||
* (10) if there is an Mf_error function, the error routine no longer
|
||||
|
|
@ -777,7 +777,7 @@ biggermsg ()
|
|||
static int laststatus = 0;
|
||||
|
||||
/*
|
||||
* mfwrite() - The only fuction you'll need to call to write out
|
||||
* mfwrite() - The only function you'll need to call to write out
|
||||
* a midi file.
|
||||
*
|
||||
* format 0 - Single multi-channel track
|
||||
|
|
@ -791,7 +791,7 @@ static int laststatus = 0;
|
|||
* bits 14 through 0 represent the number of delta-time
|
||||
* "ticks" which make up a quarter note. If bit 15 of
|
||||
* division is a one, delta-times in a file correspond to
|
||||
* subdivisions of a second similiar to SMPTE and MIDI
|
||||
* subdivisions of a second similar to SMPTE and MIDI
|
||||
* time code. In this format bits 14 through 8 contain
|
||||
* one of four values - 24, -25, -29, or -30,
|
||||
* corresponding to the four standard SMPTE and MIDI
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ extern void mferror(char *s);
|
|||
/* 7 bit controllers */
|
||||
#define damper_pedal 0x40
|
||||
#define portamento 0x41
|
||||
#define sostenuto 0x42
|
||||
#define sustenuto 0x42
|
||||
#define soft_pedal 0x43
|
||||
#define general_4 0x44
|
||||
#define hold_2 0x45
|
||||
|
|
|
|||
30
test/pcm.c
30
test/pcm.c
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* This small demo generates simple sinus wave on output of speakers.
|
||||
* This small demo sends a simple sinusoidal wave to your speakers.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -18,7 +18,7 @@ int rate = 44100; /* stream rate */
|
|||
int channels = 1; /* count of channels */
|
||||
int buffer_time = 500000; /* ring buffer length in us */
|
||||
int period_time = 100000; /* period time in us */
|
||||
double freq = 440; /* sinus wave frequency in Hz */
|
||||
double freq = 440; /* sinusoidal wave frequency in Hz */
|
||||
|
||||
snd_pcm_sframes_t buffer_size;
|
||||
snd_pcm_sframes_t period_size;
|
||||
|
|
@ -105,14 +105,14 @@ static int set_hwparams(snd_pcm_t *handle,
|
|||
printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, err);
|
||||
return -EINVAL;
|
||||
}
|
||||
/* set buffer time */
|
||||
/* set the buffer time */
|
||||
err = snd_pcm_hw_params_set_buffer_time_near(handle, params, buffer_time, &dir);
|
||||
if (err < 0) {
|
||||
printf("Unable to set buffer time %i for playback: %s\n", buffer_time, snd_strerror(err));
|
||||
return err;
|
||||
}
|
||||
buffer_size = snd_pcm_hw_params_get_buffer_size(params);
|
||||
/* set period time */
|
||||
/* set the period time */
|
||||
err = snd_pcm_hw_params_set_period_time_near(handle, params, period_time, &dir);
|
||||
if (err < 0) {
|
||||
printf("Unable to set period time %i for playback: %s\n", period_time, snd_strerror(err));
|
||||
|
|
@ -132,31 +132,31 @@ static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams)
|
|||
{
|
||||
int err;
|
||||
|
||||
/* get current swparams */
|
||||
/* get the current swparams */
|
||||
err = snd_pcm_sw_params_current(handle, swparams);
|
||||
if (err < 0) {
|
||||
printf("Unable to determine current swparams for playback: %s\n", snd_strerror(err));
|
||||
return err;
|
||||
}
|
||||
/* start transfer when the buffer is full */
|
||||
/* start the transfer when the buffer is full */
|
||||
err = snd_pcm_sw_params_set_start_threshold(handle, swparams, buffer_size);
|
||||
if (err < 0) {
|
||||
printf("Unable to set start threshold mode for playback: %s\n", snd_strerror(err));
|
||||
return err;
|
||||
}
|
||||
/* allow transfer when at least period_size samples can be processed */
|
||||
/* allow the transfer when at least period_size samples can be processed */
|
||||
err = snd_pcm_sw_params_set_avail_min(handle, swparams, period_size);
|
||||
if (err < 0) {
|
||||
printf("Unable to set avail min for playback: %s\n", snd_strerror(err));
|
||||
return err;
|
||||
}
|
||||
/* align all transfers to 1 samples */
|
||||
/* align all transfers to 1 sample */
|
||||
err = snd_pcm_sw_params_set_xfer_align(handle, swparams, 1);
|
||||
if (err < 0) {
|
||||
printf("Unable to set transfer align for playback: %s\n", snd_strerror(err));
|
||||
return err;
|
||||
}
|
||||
/* write the parameters to device */
|
||||
/* write the parameters to the playback device */
|
||||
err = snd_pcm_sw_params(handle, swparams);
|
||||
if (err < 0) {
|
||||
printf("Unable to set sw params for playback: %s\n", snd_strerror(err));
|
||||
|
|
@ -171,14 +171,14 @@ static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams)
|
|||
|
||||
static int xrun_recovery(snd_pcm_t *handle, int err)
|
||||
{
|
||||
if (err == -EPIPE) { /* underrun */
|
||||
if (err == -EPIPE) { /* under-run */
|
||||
err = snd_pcm_prepare(handle);
|
||||
if (err < 0)
|
||||
printf("Can't recovery from underrun, prepare failed: %s\n", snd_strerror(err));
|
||||
return 0;
|
||||
} else if (err == -ESTRPIPE) {
|
||||
while ((err = snd_pcm_resume(handle)) == -EAGAIN)
|
||||
sleep(1); /* wait until suspend flag is released */
|
||||
sleep(1); /* wait until the suspend flag is released */
|
||||
if (err < 0) {
|
||||
err = snd_pcm_prepare(handle);
|
||||
if (err < 0)
|
||||
|
|
@ -304,8 +304,8 @@ static int write_and_poll_loop(snd_pcm_t *handle,
|
|||
cptr -= err;
|
||||
if (cptr == 0)
|
||||
break;
|
||||
/* it is possible, that initial buffer cannot store */
|
||||
/* all data from last period, so wait awhile */
|
||||
/* it is possible, that the initial buffer cannot store */
|
||||
/* all data from the last period, so wait awhile */
|
||||
err = wait_for_poll(handle, ufds, count);
|
||||
if (err < 0) {
|
||||
if (snd_pcm_state(handle) == SND_PCM_STATE_XRUN ||
|
||||
|
|
@ -554,7 +554,7 @@ Usage: latency [OPTION]... [FILE]...
|
|||
-f,--frequency sine wave frequency in Hz
|
||||
-b,--buffer ring buffer size in samples
|
||||
-p,--period period size in us
|
||||
-m,--method tranfer method
|
||||
-m,--method transfer method
|
||||
|
||||
");
|
||||
printf("Recognized sample formats are:");
|
||||
|
|
@ -564,7 +564,7 @@ Usage: latency [OPTION]... [FILE]...
|
|||
printf(" %s", s);
|
||||
}
|
||||
printf("\n");
|
||||
printf("Recognized tranfer methods are:");
|
||||
printf("Recognized transfer methods are:");
|
||||
for (k = 0; transfer_methods[k].name; k++)
|
||||
printf(" %s", transfer_methods[k].name);
|
||||
printf("\n");
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@
|
|||
|
||||
#include "../include/asoundlib.h"
|
||||
|
||||
/* send real-time time stamps instead of midi ticks to the ALSA sequencer */
|
||||
/* send the real-time time stamps (instead of midi ticks) to the ALSA sequencer */
|
||||
static int use_realtime = 0;
|
||||
|
||||
/* control event buffering by blocking mode */
|
||||
/* control the event buffering by using a blocking mode */
|
||||
static int use_blocking_mode = 1;
|
||||
|
||||
/* default destination queue, client and port numbers */
|
||||
|
|
@ -61,7 +61,7 @@ static int use_blocking_mode = 1;
|
|||
/* event pool size */
|
||||
#define WRITE_POOL_SIZE 200
|
||||
#define WRITE_POOL_SPACE 10
|
||||
#define READ_POOL_SIZE 10 /* we need read pool only for echoing */
|
||||
#define READ_POOL_SIZE 10 /* we need to read the pool only for echoing */
|
||||
|
||||
static FILE *F;
|
||||
static snd_seq_t *seq_handle = NULL;
|
||||
|
|
@ -126,13 +126,13 @@ static void write_ev(snd_seq_event_t *ev)
|
|||
}
|
||||
}
|
||||
|
||||
/* read byte */
|
||||
/* read the byte */
|
||||
static int mygetc(void)
|
||||
{
|
||||
return getc(F);
|
||||
}
|
||||
|
||||
/* print out text */
|
||||
/* print out the text */
|
||||
static void mytext(int type ATTRIBUTE_UNUSED, int leng, char *msg)
|
||||
{
|
||||
char *p;
|
||||
|
|
@ -159,9 +159,9 @@ static void do_header(int format, int ntracks, int division)
|
|||
alsa_stop_timer();
|
||||
exit(1);
|
||||
}
|
||||
/* set ppq */
|
||||
/* set the ppq */
|
||||
snd_seq_queue_tempo_alloca(&tempo);
|
||||
/* ppq must be set before starting timer */
|
||||
/* 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);
|
||||
|
|
@ -199,7 +199,7 @@ static void do_header(int format, int ntracks, int division)
|
|||
}
|
||||
}
|
||||
|
||||
/* fill time */
|
||||
/* fill the event time */
|
||||
static void set_event_time(snd_seq_event_t *ev, unsigned int currtime)
|
||||
{
|
||||
if (use_realtime) {
|
||||
|
|
@ -216,7 +216,7 @@ static void set_event_time(snd_seq_event_t *ev, unsigned int currtime)
|
|||
}
|
||||
}
|
||||
|
||||
/* fill normal event header */
|
||||
/* fill the normal event header */
|
||||
static void set_event_header(snd_seq_event_t *ev)
|
||||
{
|
||||
snd_seq_ev_clear(ev);
|
||||
|
|
@ -225,13 +225,13 @@ static void set_event_header(snd_seq_event_t *ev)
|
|||
set_event_time(ev, Mf_currtime);
|
||||
}
|
||||
|
||||
/* start timer */
|
||||
/* start the timer */
|
||||
static void alsa_start_timer(void)
|
||||
{
|
||||
snd_seq_start_queue(seq_handle, dest_queue, NULL);
|
||||
}
|
||||
|
||||
/* stop timer */
|
||||
/* stop the timer */
|
||||
static void alsa_stop_timer(void)
|
||||
{
|
||||
snd_seq_event_t ev;
|
||||
|
|
@ -239,7 +239,7 @@ static void alsa_stop_timer(void)
|
|||
snd_seq_stop_queue(seq_handle, dest_queue, &ev);
|
||||
}
|
||||
|
||||
/* change tempo */
|
||||
/* change the tempo */
|
||||
static void do_tempo(int us)
|
||||
{
|
||||
snd_seq_event_t ev;
|
||||
|
|
@ -250,7 +250,7 @@ static void do_tempo(int us)
|
|||
printf("Tempo %d us/beat, %.2f bpm\n", us, bpm);
|
||||
}
|
||||
|
||||
/* store new tempo and timestamp of tempo change */
|
||||
/* store the new tempo and timestamp of the tempo change */
|
||||
local_secs = tick2time_dbl(Mf_currtime);
|
||||
local_ticks = Mf_currtime;
|
||||
local_tempo = us;
|
||||
|
|
@ -309,7 +309,7 @@ static void do_parameter(int chan, int control, int value)
|
|||
|
||||
|
||||
static void do_pitchbend(int chan, int lsb, int msb)
|
||||
{ /* !@#$% lsb & msb are in wrong order in docs */
|
||||
{ /* !@#$% lsb & msb are in the wrong order in docs */
|
||||
snd_seq_event_t ev;
|
||||
|
||||
if (verbose >= VERB_EVENT)
|
||||
|
|
@ -368,10 +368,10 @@ static snd_seq_event_t *wait_for_event(void)
|
|||
snd_seq_event_t *input_event;
|
||||
|
||||
if (use_blocking_mode) {
|
||||
/* read event - blocked until any event is read */
|
||||
/* read the event - blocked until any event is read */
|
||||
left = snd_seq_event_input(seq_handle, &input_event);
|
||||
} else {
|
||||
/* read event - using select syscall */
|
||||
/* read the event - using select syscall */
|
||||
while ((left = snd_seq_event_input(seq_handle, &input_event)) >= 0 &&
|
||||
input_event == NULL) {
|
||||
int npfds = snd_seq_poll_descriptors_count(seq_handle, POLLIN);
|
||||
|
|
@ -392,13 +392,13 @@ static snd_seq_event_t *wait_for_event(void)
|
|||
return input_event;
|
||||
}
|
||||
|
||||
/* synchronize to the end of event */
|
||||
/* synchronize to the end of the event */
|
||||
static void alsa_sync(void)
|
||||
{
|
||||
/* send echo event to self client. */
|
||||
/* send the echo event to the self client. */
|
||||
if (verbose >= VERB_MUCH)
|
||||
printf("alsa_sync syncing...\n");
|
||||
/* dump buffer */
|
||||
/* dump the buffer */
|
||||
snd_seq_drain_output(seq_handle);
|
||||
snd_seq_sync_output_queue(seq_handle);
|
||||
if (verbose >= VERB_MUCH)
|
||||
|
|
@ -407,12 +407,12 @@ static void alsa_sync(void)
|
|||
}
|
||||
|
||||
|
||||
/* wait for start of the queue */
|
||||
/* wait for the start of the queue */
|
||||
static void wait_start(void)
|
||||
{
|
||||
snd_seq_event_t *input_event;
|
||||
|
||||
/* wait the start event from the system timer */
|
||||
/* wait for the start event from the system timer */
|
||||
for (;;) {
|
||||
input_event = wait_for_event();
|
||||
if (input_event) {
|
||||
|
|
@ -432,7 +432,7 @@ static void wait_start(void)
|
|||
}
|
||||
|
||||
|
||||
/* print usage */
|
||||
/* print the usage */
|
||||
static void usage(void)
|
||||
{
|
||||
fprintf(stderr, "usage: playmidi1 [options] [file]\n");
|
||||
|
|
@ -441,7 +441,7 @@ static void usage(void)
|
|||
fprintf(stderr, " -a client:port : set destination address (default=%d:%d)\n",
|
||||
DEST_CLIENT_NUMBER, DEST_PORT_NUMBER);
|
||||
fprintf(stderr, " -q queue: use the specified queue\n");
|
||||
fprintf(stderr, " -s queue: slave mode (allow external clock synchronisation)\n");
|
||||
fprintf(stderr, " -s queue: slave mode (allow external clock synchronization)\n");
|
||||
fprintf(stderr, " -r : play on real-time mode\n");
|
||||
fprintf(stderr, " -b : play on non-blocking mode\n");
|
||||
}
|
||||
|
|
@ -496,8 +496,8 @@ int main(int argc, char *argv[])
|
|||
printf("ALSA MIDI Player, feeding events to song queue\n");
|
||||
}
|
||||
|
||||
/* open sequencer device */
|
||||
/* Here we open the device read/write for slave mode. */
|
||||
/* open the sequencer device */
|
||||
/* Here we open the device in read/write for slave mode. */
|
||||
tmp = snd_seq_open(&seq_handle, "hw", slave ? SND_SEQ_OPEN_DUPLEX : SND_SEQ_OPEN_OUTPUT, 0);
|
||||
if (tmp < 0) {
|
||||
perror("open /dev/snd/seq");
|
||||
|
|
@ -510,20 +510,20 @@ int main(int argc, char *argv[])
|
|||
exit(1);
|
||||
}
|
||||
|
||||
/* set name */
|
||||
/* set event filter to recieve only echo event */
|
||||
/* if running in slave mode also listen for START event */
|
||||
/* set the name */
|
||||
/* set the event filter to receive only the echo event */
|
||||
/* if running in slave mode, also listen for a START event */
|
||||
if (slave)
|
||||
snd_seq_set_client_event_filter(seq_handle, SND_SEQ_EVENT_START);
|
||||
snd_seq_set_client_name(seq_handle, "MIDI file player");
|
||||
|
||||
/* create port */
|
||||
/* create the port */
|
||||
my_port = snd_seq_create_simple_port(seq_handle, "Port 0",
|
||||
SND_SEQ_PORT_CAP_WRITE |
|
||||
SND_SEQ_PORT_CAP_READ,
|
||||
SND_SEQ_PORT_TYPE_MIDI_GENERIC);
|
||||
if (my_port < 0) {
|
||||
perror("creat port");
|
||||
perror("create port");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -534,7 +534,7 @@ int main(int argc, char *argv[])
|
|||
dest_client = dest_addr.client;
|
||||
dest_port = dest_addr.port;
|
||||
|
||||
/* setup queue */
|
||||
/* set the queue */
|
||||
if (dest_queue >= 0) {
|
||||
shared_queue = 1;
|
||||
if (snd_seq_set_queue_usage(seq_handle, dest_queue, 1) < 0) {
|
||||
|
|
@ -550,14 +550,14 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
/* setup subscriber */
|
||||
/* set the subscriber */
|
||||
tmp = snd_seq_connect_to(seq_handle, my_port, dest_client, dest_port);
|
||||
if (tmp < 0) {
|
||||
perror("subscribe");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* subscribe for timer START event */
|
||||
/* subscribe for the timer START event */
|
||||
if (slave) {
|
||||
tmp = snd_seq_connect_from(seq_handle, my_port,
|
||||
SND_SEQ_CLIENT_SYSTEM,
|
||||
|
|
@ -568,7 +568,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
/* change pool size */
|
||||
/* 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 ||
|
||||
snd_seq_set_client_pool_output_room(seq_handle, WRITE_POOL_SPACE) < 0) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ static void usage(void)
|
|||
fprintf(stderr, " example:\n");
|
||||
fprintf(stderr, " rawmidi -i hw:0,0 -o /dev/midi1\n");
|
||||
fprintf(stderr, " tests input for card 0, device 0, using snd_rawmidi API\n");
|
||||
fprintf(stderr, " and /dev/midi1 using file desciptors\n");
|
||||
fprintf(stderr, " and /dev/midi1 using file descriptors\n");
|
||||
}
|
||||
|
||||
int stop=0;
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ int decode_event(snd_seq_event_t * ev)
|
|||
printf("%sEvent = %s", space, event_names[ev->type]);
|
||||
else
|
||||
printf("%sEvent = Reserved %d\n", space, ev->type);
|
||||
/* decode actual event data... */
|
||||
/* decode the actual event data... */
|
||||
switch (ev->type) {
|
||||
case SND_SEQ_EVENT_NOTE:
|
||||
printf("; ch=%d, note=%d, velocity=%d, off_velocity=%d, duration=%d\n",
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ void event_sender_start_timer(snd_seq_t *handle, int client, int queue, snd_pcm_
|
|||
}
|
||||
bzero(&qtimer, sizeof(qtimer));
|
||||
qtimer.type = SND_SEQ_TIMER_MASTER;
|
||||
/* note: last bit from subdevices specifies playback */
|
||||
/* note: last bit from the subdevices specifies playback */
|
||||
/* or capture direction for the timer specification */
|
||||
qtimer.number = SND_TIMER_PCM(pcard, pdevice, pinfo.subdevice << 1);
|
||||
if ((err = snd_seq_set_queue_timer(handle, queue, &qtimer)) < 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue