mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-10-06 08:28:00 +02:00
Compare commits
11 commits
ac41182565
...
82fabc1ed7
Author | SHA1 | Date | |
---|---|---|---|
|
82fabc1ed7 | ||
|
d480eac6f2 | ||
|
c95db638c0 | ||
|
5703d27773 | ||
|
39053b90d5 | ||
|
397c198955 | ||
|
946ea467cf | ||
|
c7b342db82 | ||
|
d26b66f881 | ||
|
cac4935ba2 | ||
|
4aae5a770f |
6 changed files with 100 additions and 124 deletions
13
configure.ac
13
configure.ac
|
@ -21,7 +21,7 @@ AC_PROG_SED
|
|||
AC_DISABLE_STATIC
|
||||
AM_PROG_LIBTOOL
|
||||
PKG_PROG_PKG_CONFIG
|
||||
AM_PATH_ALSA(1.2.5)
|
||||
AM_PATH_ALSA(1.2.12)
|
||||
if test "x$enable_alsatest" = "xyes"; then
|
||||
AC_CHECK_FUNC([snd_ctl_elem_add_enumerated],
|
||||
, [AC_ERROR([No user enum control support in alsa-lib])])
|
||||
|
@ -47,17 +47,6 @@ AC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"]
|
|||
[#include <samplerate.h>])
|
||||
|
||||
AC_CHECK_LIB([asound], [snd_seq_client_info_get_card], [HAVE_SEQ_CLIENT_INFO_GET_CARD="yes"])
|
||||
if test "$HAVE_SEQ_CLIENT_INFO_GET_CARD" = "yes" ; then
|
||||
AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_CARD], 1, [alsa-lib supports snd_seq_client_info_get_card])
|
||||
fi
|
||||
AC_CHECK_LIB([asound], [snd_seq_client_info_get_pid], [HAVE_SEQ_CLIENT_INFO_GET_PID="yes"])
|
||||
if test "$HAVE_SEQ_CLIENT_INFO_GET_PID" = "yes" ; then
|
||||
AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_PID], 1, [alsa-lib supports snd_seq_client_info_get_pid])
|
||||
fi
|
||||
AC_CHECK_LIB([asound], [snd_seq_client_info_get_midi_version], [HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION="yes"])
|
||||
if test "$HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION" = "yes" -a "$have_rawmidi" = "yes"; then
|
||||
AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION], 1, [alsa-lib supports snd_seq_client_info_get_midi_version])
|
||||
fi
|
||||
AC_CHECK_LIB([atopology], [snd_tplg_save], [have_topology="yes"], [have_topology="no"])
|
||||
|
||||
#
|
||||
|
|
|
@ -29,12 +29,7 @@
|
|||
#include <alsa/asoundlib.h>
|
||||
#include "gettext.h"
|
||||
|
||||
#ifdef SND_SEQ_PORT_CAP_INACTIVE
|
||||
#define HANDLE_SHOW_ALL
|
||||
static int show_all;
|
||||
#else
|
||||
#define show_all 0
|
||||
#endif
|
||||
|
||||
static void error_handler(const char *file, int line, const char *function, int err, const char *fmt, ...)
|
||||
{
|
||||
|
@ -67,9 +62,7 @@ static void usage(void)
|
|||
printf(_(" aconnect -i|-o [-options]\n"));
|
||||
printf(_(" -i,--input list input (readable) ports\n"));
|
||||
printf(_(" -o,--output list output (writable) ports\n"));
|
||||
#ifdef HANDLE_SHOW_ALL
|
||||
printf(_(" -a,--all show inactive ports, too\n"));
|
||||
#endif
|
||||
printf(_(" -l,--list list current connections of each port\n"));
|
||||
printf(_(" * Remove all exported connections\n"));
|
||||
printf(_(" -x, --removeall\n"));
|
||||
|
@ -84,15 +77,11 @@ static void usage(void)
|
|||
|
||||
#define perm_ok(cap,bits) (((cap) & (bits)) == (bits))
|
||||
|
||||
#ifdef SND_SEQ_PORT_DIR_INPUT
|
||||
static int check_direction(snd_seq_port_info_t *pinfo, int bit)
|
||||
{
|
||||
int dir = snd_seq_port_info_get_direction(pinfo);
|
||||
return !dir || (dir & bit);
|
||||
}
|
||||
#else
|
||||
#define check_direction(x, y) 1
|
||||
#endif
|
||||
|
||||
static int check_permission(snd_seq_port_info_t *pinfo, int perm)
|
||||
{
|
||||
|
@ -174,20 +163,16 @@ static void do_search_port(snd_seq_t *seq, int perm, action_func_t do_action)
|
|||
/* reset query info */
|
||||
snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo));
|
||||
snd_seq_port_info_set_port(pinfo, -1);
|
||||
#ifdef HANDLE_SHOW_ALL
|
||||
if (show_all)
|
||||
snd_seq_port_info_set_capability(pinfo, SND_SEQ_PORT_CAP_INACTIVE);
|
||||
#endif
|
||||
count = 0;
|
||||
while (snd_seq_query_next_port(seq, pinfo) >= 0) {
|
||||
if (check_permission(pinfo, perm)) {
|
||||
do_action(seq, cinfo, pinfo, count);
|
||||
count++;
|
||||
}
|
||||
#ifdef HANDLE_SHOW_ALL
|
||||
if (show_all)
|
||||
snd_seq_port_info_set_capability(pinfo, SND_SEQ_PORT_CAP_INACTIVE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +190,6 @@ static void print_port(snd_seq_t *seq ATTRIBUTE_UNUSED,
|
|||
snd_seq_client_info_get_name(cinfo),
|
||||
(snd_seq_client_info_get_type(cinfo) == SND_SEQ_USER_CLIENT ?
|
||||
_("user") : _("kernel")));
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
switch (snd_seq_client_info_get_midi_version(cinfo)) {
|
||||
case SND_SEQ_CLIENT_UMP_MIDI_1_0:
|
||||
printf(",UMP-MIDI1");
|
||||
|
@ -214,16 +198,11 @@ static void print_port(snd_seq_t *seq ATTRIBUTE_UNUSED,
|
|||
printf(",UMP-MIDI2");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_CARD
|
||||
card = snd_seq_client_info_get_card(cinfo);
|
||||
#endif
|
||||
if (card != -1)
|
||||
printf(",card=%d", card);
|
||||
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_PID
|
||||
pid = snd_seq_client_info_get_pid(cinfo);
|
||||
#endif
|
||||
if (pid != -1)
|
||||
printf(",pid=%d", pid);
|
||||
printf("]\n");
|
||||
|
@ -231,10 +210,8 @@ static void print_port(snd_seq_t *seq ATTRIBUTE_UNUSED,
|
|||
printf(" %3d '%-16s'",
|
||||
snd_seq_port_info_get_port(pinfo),
|
||||
snd_seq_port_info_get_name(pinfo));
|
||||
#ifdef HANDLE_SHOW_ALL
|
||||
if (snd_seq_port_info_get_capability(pinfo) & SND_SEQ_PORT_CAP_INACTIVE)
|
||||
printf(" [INACTIVE]");
|
||||
#endif
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
@ -299,11 +276,7 @@ enum {
|
|||
SUBSCRIBE, UNSUBSCRIBE, LIST, REMOVE_ALL
|
||||
};
|
||||
|
||||
#ifdef HANDLE_SHOW_ALL
|
||||
#define ACONNECT_OPTS "dior:t:elxa"
|
||||
#else
|
||||
#define ACONNECT_OPTS "dior:t:elx"
|
||||
#endif
|
||||
|
||||
static const struct option long_option[] = {
|
||||
{"disconnect", 0, NULL, 'd'},
|
||||
|
@ -314,9 +287,7 @@ static const struct option long_option[] = {
|
|||
{"exclusive", 0, NULL, 'e'},
|
||||
{"list", 0, NULL, 'l'},
|
||||
{"removeall", 0, NULL, 'x'},
|
||||
#ifdef HANDLE_SHOW_ALL
|
||||
{"all", 0, NULL, 'a'},
|
||||
#endif
|
||||
{NULL, 0, NULL, 0},
|
||||
};
|
||||
|
||||
|
@ -370,12 +341,10 @@ int main(int argc, char **argv)
|
|||
case 'x':
|
||||
command = REMOVE_ALL;
|
||||
break;
|
||||
#ifdef HANDLE_SHOW_ALL
|
||||
case 'a':
|
||||
command = LIST;
|
||||
show_all = 1;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
usage();
|
||||
exit(1);
|
||||
|
|
|
@ -30,9 +30,7 @@
|
|||
#include <unistd.h>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include "version.h"
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
#include <alsa/ump_msg.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 31.25 kbaud, one start bit, eight data bits, two stop bits.
|
||||
|
@ -78,9 +76,7 @@ static int file_offset; /* current offset in input file */
|
|||
static int num_tracks;
|
||||
static struct track *tracks;
|
||||
static int smpte_timing;
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
static int ump_mode;
|
||||
#endif
|
||||
|
||||
/* prints an error message to stderr */
|
||||
static void errormsg(const char *msg, ...)
|
||||
|
@ -685,7 +681,6 @@ static int fill_legacy_event(struct event* event, snd_seq_event_t *ev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
static unsigned char to_ump_status(unsigned char ev_type)
|
||||
{
|
||||
switch (ev_type) {
|
||||
|
@ -762,13 +757,10 @@ static int fill_ump_event(struct event* event, snd_seq_ump_event_t *ump_ev,
|
|||
snd_seq_ev_set_ump_data(ump_ev, &ump, sizeof(ump));
|
||||
return 0;
|
||||
}
|
||||
#endif /* HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION */
|
||||
|
||||
static void play_midi(void)
|
||||
{
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
snd_seq_ump_event_t ump_ev;
|
||||
#endif
|
||||
snd_seq_event_t ev;
|
||||
int i, max_tick, err;
|
||||
|
||||
|
@ -830,7 +822,7 @@ static void play_midi(void)
|
|||
if (err < 0)
|
||||
continue;
|
||||
}
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
|
||||
if (ump_mode) {
|
||||
err = fill_ump_event(event, &ump_ev, &ev);
|
||||
if (err < 0)
|
||||
|
@ -839,7 +831,6 @@ static void play_midi(void)
|
|||
check_snd("output event", err);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* this blocks when the output pool has been filled */
|
||||
err = snd_seq_event_output(seq, &ev);
|
||||
|
@ -957,9 +948,7 @@ static void usage(const char *argv0)
|
|||
"-V, --version print current version\n"
|
||||
"-l, --list list all possible output ports\n"
|
||||
"-p, --port=client:port,... set port(s) to play to\n"
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
"-u, --ump=version UMP output (only version=1 is supported)\n"
|
||||
#endif
|
||||
"-d, --delay=seconds delay after song ends\n",
|
||||
argv0);
|
||||
}
|
||||
|
@ -969,12 +958,7 @@ static void version(void)
|
|||
puts("aplaymidi version " SND_UTIL_VERSION_STR);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
#define OPTIONS "hVlp:d:u:"
|
||||
#else
|
||||
#define OPTIONS "hVlp:d:"
|
||||
#endif
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
@ -984,9 +968,7 @@ int main(int argc, char *argv[])
|
|||
{"version", 0, NULL, 'V'},
|
||||
{"list", 0, NULL, 'l'},
|
||||
{"port", 1, NULL, 'p'},
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
{"ump", 1, NULL, 'u'},
|
||||
#endif
|
||||
{"delay", 1, NULL, 'd'},
|
||||
{0}
|
||||
};
|
||||
|
@ -1013,15 +995,11 @@ int main(int argc, char *argv[])
|
|||
case 'd':
|
||||
end_delay = atoi(optarg);
|
||||
break;
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
case 'u':
|
||||
if (strcmp(optarg, "1")) {
|
||||
errormsg("Only MIDI 1.0 is supported");
|
||||
return 1;
|
||||
}
|
||||
ump_mode = 1;
|
||||
ump_mode = atoi(optarg);
|
||||
if (ump_mode < 0 || ump_mode > 1)
|
||||
fatal("Only MIDI 1.0 is supported");
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
|
@ -1029,13 +1007,11 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
if (ump_mode) {
|
||||
int err;
|
||||
err = snd_seq_set_client_midi_version(seq, SND_SEQ_CLIENT_UMP_MIDI_1_0);
|
||||
check_snd("set midi version", err);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (do_list) {
|
||||
list_ports();
|
||||
|
|
|
@ -29,9 +29,7 @@
|
|||
#include <poll.h>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include "version.h"
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
#include <alsa/ump_msg.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
VIEW_RAW, VIEW_NORMALIZED, VIEW_PERCENT
|
||||
|
@ -41,11 +39,7 @@ static snd_seq_t *seq;
|
|||
static int port_count;
|
||||
static snd_seq_addr_t *ports;
|
||||
static volatile sig_atomic_t stop = 0;
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
static int ump_version;
|
||||
#else
|
||||
#define ump_version 0
|
||||
#endif
|
||||
static int view_mode = VIEW_RAW;
|
||||
|
||||
/* prints an error message to stderr, and dies */
|
||||
|
@ -368,7 +362,6 @@ static void dump_event(const snd_seq_event_t *ev)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
static int group_number(unsigned char c)
|
||||
{
|
||||
if (view_mode != VIEW_RAW)
|
||||
|
@ -680,6 +673,7 @@ static void dump_ump_sysex_event(const unsigned int *ump)
|
|||
int i, length;
|
||||
|
||||
printf("Group %2d, ", group_number(snd_ump_msg_group(ump)));
|
||||
printf("SysEx ");
|
||||
switch (snd_ump_sysex_msg_status(ump)) {
|
||||
case SND_UMP_SYSEX_STATUS_SINGLE:
|
||||
printf("Single ");
|
||||
|
@ -986,7 +980,6 @@ static void dump_ump_event(const snd_seq_ump_event_t *ev)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION */
|
||||
|
||||
static void list_ports(void)
|
||||
{
|
||||
|
@ -1029,10 +1022,8 @@ static void help(const char *argv0)
|
|||
" -N,--normalized-view show normalized values\n"
|
||||
" -P,--percent-view show percent values\n"
|
||||
" -R,--raw-view show raw values (default)\n"
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
" -u,--ump=version set client MIDI version (0=legacy, 1= UMP MIDI 1.0, 2=UMP MIDI2.0)\n"
|
||||
" -r,--raw do not convert UMP and legacy events\n"
|
||||
#endif
|
||||
" -p,--port=client:port,... source port(s)\n",
|
||||
argv0);
|
||||
}
|
||||
|
@ -1049,11 +1040,7 @@ static void sighandler(int sig ATTRIBUTE_UNUSED)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
static const char short_options[] = "hVlp:NPR"
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
"u:r"
|
||||
#endif
|
||||
;
|
||||
static const char short_options[] = "hVlp:NPRu:r";
|
||||
static const struct option long_options[] = {
|
||||
{"help", 0, NULL, 'h'},
|
||||
{"version", 0, NULL, 'V'},
|
||||
|
@ -1062,10 +1049,8 @@ int main(int argc, char *argv[])
|
|||
{"normalized-view", 0, NULL, 'N'},
|
||||
{"percent-view", 0, NULL, 'P'},
|
||||
{"raw-view", 0, NULL, 'R'},
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
{"ump", 1, NULL, 'u'},
|
||||
{"raw", 0, NULL, 'r'},
|
||||
#endif
|
||||
{0}
|
||||
};
|
||||
|
||||
|
@ -1100,15 +1085,15 @@ int main(int argc, char *argv[])
|
|||
case 'N':
|
||||
view_mode = VIEW_NORMALIZED;
|
||||
break;
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
case 'u':
|
||||
ump_version = atoi(optarg);
|
||||
if (ump_version < 0 || ump_version > 2)
|
||||
fatal("Invalid UMP version %d", ump_version);
|
||||
snd_seq_set_client_midi_version(seq, ump_version);
|
||||
break;
|
||||
case 'r':
|
||||
snd_seq_set_client_ump_conversion(seq, 0);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
help(argv[0]);
|
||||
return 1;
|
||||
|
@ -1150,7 +1135,6 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
for (;;) {
|
||||
snd_seq_event_t *event;
|
||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
||||
snd_seq_ump_event_t *ump_ev;
|
||||
if (ump_version > 0) {
|
||||
err = snd_seq_ump_event_input(seq, &ump_ev);
|
||||
|
@ -1160,7 +1144,6 @@ int main(int argc, char *argv[])
|
|||
dump_ump_event(ump_ev);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
err = snd_seq_event_input(seq, &event);
|
||||
if (err < 0)
|
||||
|
|
|
@ -14,41 +14,48 @@ It can also send any other MIDI commands.
|
|||
Messages to be send can be given in the last argument as hex encoded byte string or can be read from raw binary file.
|
||||
When sending several SysEx messages at once there is a delay of 1ms after each message as deafult and can be set to different value with option \-i.
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
.TP
|
||||
\-h
|
||||
Prints a list of options.
|
||||
|
||||
.TP
|
||||
\-V
|
||||
Prints the current version.
|
||||
|
||||
.TP
|
||||
\-l
|
||||
Prints a list of possible output ports.
|
||||
|
||||
.TP
|
||||
\-v
|
||||
Prints number of bytes actually sent
|
||||
|
||||
.TP
|
||||
\-p
|
||||
Target port by number or name
|
||||
|
||||
.TP
|
||||
\-s
|
||||
Send raw binary data from given file name
|
||||
|
||||
.TP
|
||||
\-i
|
||||
Interval between SysEx messages in miliseconds
|
||||
|
||||
|
||||
A client can be specified by its number, its name, or a prefix of its
|
||||
name. A port is specified by its number; for port 0 of a client, the
|
||||
":0" part of the port specification can be omitted.
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
.TP
|
||||
\-h, \-\-help
|
||||
Prints a list of options.
|
||||
|
||||
.TP
|
||||
\-V, \-\-version
|
||||
Prints the current version.
|
||||
|
||||
.TP
|
||||
\-l, \-\-list
|
||||
Prints a list of possible output ports.
|
||||
|
||||
.TP
|
||||
\-v, \-\-verbose
|
||||
Prints number of bytes actually sent
|
||||
|
||||
.TP
|
||||
\-p, -\-port=client:port
|
||||
Target port by number or name
|
||||
|
||||
.TP
|
||||
\-s, \-\-file=filename
|
||||
Send raw binary data from given file name
|
||||
|
||||
.TP
|
||||
\-i, \-\-interval=msec
|
||||
Interval between SysEx messages in miliseconds
|
||||
|
||||
.TP
|
||||
\-u, \-\-ump=version
|
||||
Specify the MIDI version. 0 for the legacy MIDI 1.0 (default),
|
||||
1 for UMP MIDI 1.0 protocol and 2 for UMP MIDI 2.0 protocol.
|
||||
|
||||
When UMP MIDI 1.0 or MIDI 2.0 protocol is specified, \fBaseqsend\fP
|
||||
reads the input as raw UMP packets, 4 each byte in big endian.
|
||||
|
||||
.SH EXAMPLES
|
||||
|
||||
aseqsend -p 128:0 "F0 41 10 00 00 64 12 18 00 21 06 59 41 59 4E F7"
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <alsa/asoundlib.h>
|
||||
#include <alsa/ump_msg.h>
|
||||
|
||||
typedef unsigned char mbyte_t;
|
||||
|
||||
|
@ -43,6 +44,7 @@ static char *send_hex;
|
|||
static mbyte_t *send_data;
|
||||
static snd_seq_addr_t addr;
|
||||
static int send_data_length;
|
||||
static int ump_version;
|
||||
|
||||
static void error(const char *format, ...)
|
||||
{
|
||||
|
@ -320,6 +322,32 @@ static void send_midi_msg(snd_seq_event_type_t type, mbyte_t *data, int len)
|
|||
snd_seq_drain_output(seq);
|
||||
}
|
||||
|
||||
static int send_ump(const unsigned char *data)
|
||||
{
|
||||
static int ump_len = 0, offset = 0;
|
||||
unsigned int ump[4];
|
||||
snd_seq_ump_event_t ev;
|
||||
|
||||
ump[offset] = (data[0] << 24) | (data[1] << 16) |
|
||||
(data[2] << 8) | data[3];
|
||||
if (!offset)
|
||||
ump_len = snd_ump_packet_length(snd_ump_msg_type(ump));
|
||||
|
||||
offset++;
|
||||
if (offset < ump_len)
|
||||
return 0;
|
||||
|
||||
snd_seq_ump_ev_clear(&ev);
|
||||
snd_seq_ev_set_source(&ev, 0);
|
||||
snd_seq_ev_set_dest(&ev, addr.client, addr.port);
|
||||
snd_seq_ev_set_direct(&ev);
|
||||
snd_seq_ev_set_ump_data(&ev, ump, ump_len * 4);
|
||||
snd_seq_ump_event_output(seq, &ev);
|
||||
snd_seq_drain_output(seq);
|
||||
offset = 0;
|
||||
return ump_len * 4;
|
||||
}
|
||||
|
||||
static int msg_byte_in_range(mbyte_t *data, mbyte_t len)
|
||||
{
|
||||
for (int i = 0; i < len; i++) {
|
||||
|
@ -334,6 +362,17 @@ static int msg_byte_in_range(mbyte_t *data, mbyte_t len)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
static const struct option long_options[] = {
|
||||
{"help", 0, NULL, 'h'},
|
||||
{"version", 0, NULL, 'V'},
|
||||
{"verbose", 0, NULL, 'v'},
|
||||
{"list", 0, NULL, 'l'},
|
||||
{"port", 1, NULL, 'p'},
|
||||
{"file", 1, NULL, 's'},
|
||||
{"interval", 1, NULL, 'i'},
|
||||
{"ump", 1, NULL, 'u'},
|
||||
{0}
|
||||
};
|
||||
char c = 0;
|
||||
char do_send_file = 0;
|
||||
char do_port_list = 0;
|
||||
|
@ -342,7 +381,7 @@ int main(int argc, char *argv[])
|
|||
int sent_data_c;
|
||||
int k;
|
||||
|
||||
while ((c = getopt(argc, argv, "hi:Vvlp:s:")) != -1) {
|
||||
while ((c = getopt_long(argc, argv, "hi:Vvlp:s:u:", long_options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case 'h':
|
||||
usage();
|
||||
|
@ -366,6 +405,9 @@ int main(int argc, char *argv[])
|
|||
case 'i':
|
||||
sysex_interval = atoi(optarg) * 1000; //ms--->us
|
||||
break;
|
||||
case 'u':
|
||||
ump_version = atoi(optarg);
|
||||
break;
|
||||
default:
|
||||
error("Try 'aseqsend -h' for more information.");
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -401,7 +443,11 @@ int main(int argc, char *argv[])
|
|||
if (!send_data)
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
if (ump_version && (send_data_length % 4) != 0)
|
||||
fatal("UMP data must be aligned to 4 bytes");
|
||||
|
||||
init_seq();
|
||||
snd_seq_set_client_midi_version(seq, ump_version);
|
||||
create_port();
|
||||
|
||||
if (snd_seq_parse_address(seq, &addr, port_name) < 0) {
|
||||
|
@ -414,6 +460,12 @@ int main(int argc, char *argv[])
|
|||
|
||||
while (k < send_data_length) {
|
||||
|
||||
if (ump_version) {
|
||||
sent_data_c += send_ump(send_data + k);
|
||||
k += 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (send_data[k] == 0xF0) {
|
||||
|
||||
int c1 = k;
|
||||
|
|
Loading…
Reference in a new issue