i18nize some programs

i18nize some programs with gettext.
This commit is contained in:
Takashi Iwai 2005-06-23 10:38:06 +00:00
parent fefe0aafaf
commit 6343f35202
25 changed files with 2001 additions and 252 deletions

View file

@ -4,7 +4,7 @@ ALSAMIXER_DIR=alsamixer
else
ALSAMIXER_DIR=
endif
SUBDIRS= include alsactl alsaconf $(ALSAMIXER_DIR) amidi amixer aplay iecset seq speaker-test utils m4
SUBDIRS= include alsactl alsaconf $(ALSAMIXER_DIR) amidi amixer aplay iecset seq speaker-test utils m4 po
EXTRA_DIST=ChangeLog INSTALL TODO README configure cvscompile depcomp
AUTOMAKE_OPTIONS=foreign
ACLOCAL_AMFLAGS = -I m4

View file

@ -1,5 +1,5 @@
INCLUDES = -I$(top_srcdir)/include
LDADD = -lasound
LDADD = -lasound $(LIBINTL)
# debug flags
#LDFLAGS = -static

View file

@ -44,6 +44,7 @@
#include <sys/time.h>
#include <sys/signal.h>
#include "aconfig.h"
#include "gettext.h"
#include "formats.h"
#include "version.h"
@ -122,10 +123,10 @@ struct fmt_capture {
void (*end) (int fd);
char *what;
} fmt_rec_table[] = {
{ NULL, end_raw, "raw data" },
{ begin_voc, end_voc, "VOC" },
{ begin_wave, end_wave, "WAVE" },
{ begin_au, end_au, "Sparc Audio" }
{ NULL, end_raw, N_("raw data") },
{ begin_voc, end_voc, N_("VOC") },
{ begin_wave, end_wave, N_("WAVE") },
{ begin_au, end_au, N_("Sparc Audio")}
};
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
@ -146,7 +147,7 @@ static void usage(char *command)
{
snd_pcm_format_t k;
fprintf(stderr,
"Usage: %s [OPTION]... [FILE]...\n"
_("Usage: %s [OPTION]... [FILE]...\n"
"\n"
"-h, --help help\n"
" --version print current version\n"
@ -171,19 +172,19 @@ static void usage(char *command)
" (relative to buffer size if <= 0)\n"
"-T, --stop-delay=# delay for automatic PCM stop is # microseconds from xrun\n"
"-v, --verbose show PCM structure and setup (accumulative)\n"
"-I, --separate-channels one file for each channel\n"
"-I, --separate-channels one file for each channel\n")
, command);
fprintf(stderr, "Recognized sample formats are:");
fprintf(stderr, _("Recognized sample formats are:"));
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
const char *s = snd_pcm_format_name(k);
if (s)
fprintf(stderr, " %s", s);
}
fprintf(stderr, "\nSome of these may not be available on selected hardware\n");
fprintf(stderr, "The availabled format shortcuts are:\n");
fprintf(stderr, "-f cd (16 bit little endian, 44100, stereo)\n");
fprintf(stderr, "-f cdr (16 bit big endian, 44100, stereo)\n");
fprintf(stderr, "-f dat (16 bit little endian, 48000, stereo)\n");
fprintf(stderr, _("\nSome of these may not be available on selected hardware\n"));
fprintf(stderr, _("The availabled format shortcuts are:\n"));
fprintf(stderr, _("-f cd (16 bit little endian, 44100, stereo)\n"));
fprintf(stderr, _("-f cdr (16 bit big endian, 44100, stereo)\n"));
fprintf(stderr, _("-f dat (16 bit little endian, 48000, stereo)\n"));
}
static void names_list(void)
@ -193,7 +194,7 @@ static void names_list(void)
err = snd_names_list("pcm", &list);
if (err < 0) {
error("snd_names_list error: %s", snd_strerror(err));
error(_("snd_names_list error: %s"), snd_strerror(err));
return;
}
item = list;
@ -215,10 +216,11 @@ static void device_list(void)
card = -1;
if (snd_card_next(&card) < 0 || card < 0) {
error("no soundcards found...");
error(_("no soundcards found..."));
return;
}
fprintf(stderr, "**** List of %s Hardware Devices ****\n", snd_pcm_stream_name(stream));
fprintf(stderr, _("**** List of %s Hardware Devices ****\n"),
snd_pcm_stream_name(stream));
while (card >= 0) {
char name[32];
sprintf(name, "hw:%d", card);
@ -246,19 +248,21 @@ static void device_list(void)
error("control digital audio info (%i): %s", card, snd_strerror(err));
continue;
}
fprintf(stderr, "card %i: %s [%s], device %i: %s [%s]\n",
fprintf(stderr, _("card %i: %s [%s], device %i: %s [%s]\n"),
card, snd_ctl_card_info_get_id(info), snd_ctl_card_info_get_name(info),
dev,
snd_pcm_info_get_id(pcminfo),
snd_pcm_info_get_name(pcminfo));
count = snd_pcm_info_get_subdevices_count(pcminfo);
fprintf(stderr, " Subdevices: %i/%i\n", snd_pcm_info_get_subdevices_avail(pcminfo), count);
fprintf(stderr, _(" Subdevices: %i/%i\n"),
snd_pcm_info_get_subdevices_avail(pcminfo), count);
for (idx = 0; idx < (int)count; idx++) {
snd_pcm_info_set_subdevice(pcminfo, idx);
if ((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) {
error("control digital audio playback info (%i): %s", card, snd_strerror(err));
} else {
fprintf(stderr, " Subdevice #%i: %s\n", idx, snd_pcm_info_get_subdevice_name(pcminfo));
fprintf(stderr, _(" Subdevice #%i: %s\n"),
idx, snd_pcm_info_get_subdevice_name(pcminfo));
}
}
}
@ -285,7 +289,7 @@ static void pcm_list(void)
err = snd_config_search(snd_config, "pcm", &conf);
if (err < 0)
return;
fprintf(stderr, "PCM list:\n");
fprintf(stderr, _("PCM list:\n"));
snd_config_save(conf, out);
snd_output_close(out);
}
@ -298,7 +302,7 @@ static void version(void)
static void signal_handler(int sig)
{
if (!quiet_mode)
fprintf(stderr, "Aborted by signal %s...\n", strsignal(sig));
fprintf(stderr, _("Aborted by signal %s...\n"), strsignal(sig));
if (stream == SND_PCM_STREAM_CAPTURE) {
fmt_rec_table[file_type].end(fd);
stream = -1;
@ -358,6 +362,9 @@ int main(int argc, char *argv[])
int do_names_list = 0, do_device_list = 0, do_pcm_list = 0;
snd_pcm_info_t *info;
setlocale(LC_ALL, "");
textdomain(PACKAGE);
snd_pcm_info_alloca(&info);
err = snd_output_stdio_attach(&log, stderr, 0);
@ -374,7 +381,7 @@ int main(int argc, char *argv[])
stream = SND_PCM_STREAM_PLAYBACK;
command = "aplay";
} else {
error("command should be named either arecord or aplay");
error(_("command should be named either arecord or aplay"));
return 1;
}
@ -416,14 +423,14 @@ int main(int argc, char *argv[])
else if (strcasecmp(optarg, "au") == 0 || strcasecmp(optarg, "sparc") == 0)
file_type = FORMAT_AU;
else {
error("unrecognized file format %s", optarg);
error(_("unrecognized file format %s"), optarg);
return 1;
}
break;
case 'c':
rhwparams.channels = atoi(optarg);
if (rhwparams.channels < 1 || rhwparams.channels > 32) {
error("value %i for channels is invalid", rhwparams.channels);
error(_("value %i for channels is invalid"), rhwparams.channels);
return 1;
}
break;
@ -442,7 +449,7 @@ int main(int argc, char *argv[])
} else {
rhwparams.format = snd_pcm_format_value(optarg);
if (rhwparams.format == SND_PCM_FORMAT_UNKNOWN) {
error("wrong extended format '%s'", optarg);
error(_("wrong extended format '%s'"), optarg);
exit(EXIT_FAILURE);
}
}
@ -453,7 +460,7 @@ int main(int argc, char *argv[])
tmp *= 1000;
rhwparams.rate = tmp;
if (tmp < 2000 || tmp > 192000) {
error("bad speed value %i", tmp);
error(_("bad speed value %i"), tmp);
return 1;
}
break;
@ -509,7 +516,7 @@ int main(int argc, char *argv[])
file_type = FORMAT_WAVE;
break;
default:
fprintf(stderr, "Try `%s --help' for more information.\n", command);
fprintf(stderr, _("Try `%s --help' for more information.\n"), command);
return 1;
}
}
@ -530,19 +537,19 @@ int main(int argc, char *argv[])
err = snd_pcm_open(&handle, pcm_name, stream, open_mode);
if (err < 0) {
error("audio open error: %s", snd_strerror(err));
error(_("audio open error: %s"), snd_strerror(err));
return 1;
}
if ((err = snd_pcm_info(handle, info)) < 0) {
error("info error: %s", snd_strerror(err));
error(_("info error: %s"), snd_strerror(err));
return 1;
}
if (nonblock) {
err = snd_pcm_nonblock(handle, 1);
if (err < 0) {
error("nonblock setting error: %s", snd_strerror(err));
error(_("nonblock setting error: %s"), snd_strerror(err));
return 1;
}
}
@ -552,7 +559,7 @@ int main(int argc, char *argv[])
audiobuf = (char *)malloc(1024);
if (audiobuf == NULL) {
error("not enough memory");
error(_("not enough memory"));
return 1;
}
@ -646,7 +653,7 @@ size_t test_wavefile_read(int fd, char *buffer, size_t *size, size_t reqsize, in
if (*size >= reqsize)
return *size;
if ((size_t)safe_read(fd, buffer + *size, reqsize - *size) != reqsize - *size) {
error("read error (called from line %i)", line);
error(_("read error (called from line %i)"), line);
exit(EXIT_FAILURE);
}
return *size = reqsize;
@ -656,7 +663,7 @@ size_t test_wavefile_read(int fd, char *buffer, size_t *size, size_t reqsize, in
if (len > blimit) { \
blimit = len; \
if ((buffer = realloc(buffer, blimit)) == NULL) { \
error("not enough memory"); \
error(_("not enough memory")); \
exit(EXIT_FAILURE); \
} \
}
@ -704,18 +711,19 @@ static ssize_t test_wavefile(int fd, char *_buffer, size_t size)
}
if (len < sizeof(WaveFmtBody)) {
error("unknown length of 'fmt ' chunk (read %u, should be %u at least)", len, (u_int)sizeof(WaveFmtBody));
error(_("unknown length of 'fmt ' chunk (read %u, should be %u at least)"),
len, (u_int)sizeof(WaveFmtBody));
exit(EXIT_FAILURE);
}
check_wavefile_space(buffer, len, blimit);
test_wavefile_read(fd, buffer, &size, len, __LINE__);
f = (WaveFmtBody*) buffer;
if (LE_SHORT(f->format) != WAV_PCM_CODE) {
error("can't play not PCM-coded WAVE-files");
error(_("can't play not PCM-coded WAVE-files"));
exit(EXIT_FAILURE);
}
if (LE_SHORT(f->modus) < 1) {
error("can't play WAVE-files with %d tracks", LE_SHORT(f->modus));
error(_("can't play WAVE-files with %d tracks"), LE_SHORT(f->modus));
exit(EXIT_FAILURE);
}
hwparams.channels = LE_SHORT(f->modus);
@ -723,13 +731,13 @@ static ssize_t test_wavefile(int fd, char *_buffer, size_t size)
case 8:
if (hwparams.format != DEFAULT_FORMAT &&
hwparams.format != SND_PCM_FORMAT_U8)
fprintf(stderr, "Warning: format is changed to U8\n");
fprintf(stderr, _("Warning: format is changed to U8\n"));
hwparams.format = SND_PCM_FORMAT_U8;
break;
case 16:
if (hwparams.format != DEFAULT_FORMAT &&
hwparams.format != SND_PCM_FORMAT_S16_LE)
fprintf(stderr, "Warning: format is changed to S16_LE\n");
fprintf(stderr, _("Warning: format is changed to S16_LE\n"));
hwparams.format = SND_PCM_FORMAT_S16_LE;
break;
case 24:
@ -737,17 +745,18 @@ static ssize_t test_wavefile(int fd, char *_buffer, size_t size)
case 3:
if (hwparams.format != DEFAULT_FORMAT &&
hwparams.format != SND_PCM_FORMAT_S24_3LE)
fprintf(stderr, "Warning: format is changed to S24_3LE\n");
fprintf(stderr, _("Warning: format is changed to S24_3LE\n"));
hwparams.format = SND_PCM_FORMAT_S24_3LE;
break;
case 4:
if (hwparams.format != DEFAULT_FORMAT &&
hwparams.format != SND_PCM_FORMAT_S24_LE)
fprintf(stderr, "Warning: format is changed to S24_LE\n");
fprintf(stderr, _("Warning: format is changed to S24_LE\n"));
hwparams.format = SND_PCM_FORMAT_S24_LE;
break;
default:
error(" can't play WAVE-files with sample %d bits in %d bytes wide (%d channels)", LE_SHORT(f->bit_p_spl), LE_SHORT(f->byte_p_spl), hwparams.channels);
error(_(" can't play WAVE-files with sample %d bits in %d bytes wide (%d channels)"),
LE_SHORT(f->bit_p_spl), LE_SHORT(f->byte_p_spl), hwparams.channels);
exit(EXIT_FAILURE);
}
break;
@ -755,7 +764,8 @@ static ssize_t test_wavefile(int fd, char *_buffer, size_t size)
hwparams.format = SND_PCM_FORMAT_S32_LE;
break;
default:
error(" can't play WAVE-files with sample %d bits wide", LE_SHORT(f->bit_p_spl));
error(_(" can't play WAVE-files with sample %d bits wide"),
LE_SHORT(f->bit_p_spl));
exit(EXIT_FAILURE);
}
hwparams.rate = LE_INT(f->sample_fq);
@ -812,19 +822,19 @@ static int test_au(int fd, void *buffer)
case AU_FMT_ULAW:
if (hwparams.format != DEFAULT_FORMAT &&
hwparams.format != SND_PCM_FORMAT_MU_LAW)
fprintf(stderr, "Warning: format is changed to MU_LAW\n");
fprintf(stderr, _("Warning: format is changed to MU_LAW\n"));
hwparams.format = SND_PCM_FORMAT_MU_LAW;
break;
case AU_FMT_LIN8:
if (hwparams.format != DEFAULT_FORMAT &&
hwparams.format != SND_PCM_FORMAT_U8)
fprintf(stderr, "Warning: format is changed to U8\n");
fprintf(stderr, _("Warning: format is changed to U8\n"));
hwparams.format = SND_PCM_FORMAT_U8;
break;
case AU_FMT_LIN16:
if (hwparams.format != DEFAULT_FORMAT &&
hwparams.format != SND_PCM_FORMAT_S16_BE)
fprintf(stderr, "Warning: format is changed to S16_BE\n");
fprintf(stderr, _("Warning: format is changed to S16_BE\n"));
hwparams.format = SND_PCM_FORMAT_S16_BE;
break;
default:
@ -837,7 +847,7 @@ static int test_au(int fd, void *buffer)
if (hwparams.channels < 1 || hwparams.channels > 128)
return -1;
if ((size_t)safe_read(fd, buffer + sizeof(AuHeader), BE_INT(ap->hdr_size) - sizeof(AuHeader)) != BE_INT(ap->hdr_size) - sizeof(AuHeader)) {
error("read error");
error(_("read error"));
exit(EXIT_FAILURE);
}
return 0;
@ -857,7 +867,7 @@ static void set_params(void)
snd_pcm_sw_params_alloca(&swparams);
err = snd_pcm_hw_params_any(handle, params);
if (err < 0) {
error("Broken configuration for this PCM: no configurations available");
error(_("Broken configuration for this PCM: no configurations available"));
exit(EXIT_FAILURE);
}
if (mmap_flag) {
@ -874,17 +884,17 @@ static void set_params(void)
err = snd_pcm_hw_params_set_access(handle, params,
SND_PCM_ACCESS_RW_NONINTERLEAVED);
if (err < 0) {
error("Access type not available");
error(_("Access type not available"));
exit(EXIT_FAILURE);
}
err = snd_pcm_hw_params_set_format(handle, params, hwparams.format);
if (err < 0) {
error("Sample format non available");
error(_("Sample format non available"));
exit(EXIT_FAILURE);
}
err = snd_pcm_hw_params_set_channels(handle, params, hwparams.channels);
if (err < 0) {
error("Channels count non available");
error(_("Channels count non available"));
exit(EXIT_FAILURE);
}
@ -897,8 +907,8 @@ static void set_params(void)
assert(err >= 0);
if ((float)rate * 1.05 < hwparams.rate || (float)rate * 0.95 > hwparams.rate) {
if (!quiet_mode) {
fprintf(stderr, "Warning: rate is not accurate (requested = %iHz, got = %iHz)\n", rate, hwparams.rate);
fprintf(stderr, " please, try the plug plugin (-Dplug:%s)\n", snd_pcm_name(handle));
fprintf(stderr, _("Warning: rate is not accurate (requested = %iHz, got = %iHz)\n"), rate, hwparams.rate);
fprintf(stderr, _(" please, try the plug plugin (-Dplug:%s)\n"), snd_pcm_name(handle));
}
}
rate = hwparams.rate;
@ -932,20 +942,21 @@ static void set_params(void)
assert(err >= 0);
err = snd_pcm_hw_params(handle, params);
if (err < 0) {
error("Unable to install hw params:");
error(_("Unable to install hw params:"));
snd_pcm_hw_params_dump(params, log);
exit(EXIT_FAILURE);
}
snd_pcm_hw_params_get_period_size(params, &chunk_size, 0);
snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
if (chunk_size == buffer_size) {
error("Can't use period equal to buffer size (%lu == %lu)", chunk_size, buffer_size);
error(_("Can't use period equal to buffer size (%lu == %lu)"),
chunk_size, buffer_size);
exit(EXIT_FAILURE);
}
snd_pcm_sw_params_current(handle, swparams);
err = snd_pcm_sw_params_get_xfer_align(swparams, &xfer_align);
if (err < 0) {
error("Unable to obtain xfer align\n");
error(_("Unable to obtain xfer align\n"));
exit(EXIT_FAILURE);
}
if (sleep_min)
@ -982,7 +993,7 @@ static void set_params(void)
assert(err >= 0);
if (snd_pcm_sw_params(handle, swparams) < 0) {
error("unable to install sw params:");
error(_("unable to install sw params:"));
snd_pcm_sw_params_dump(swparams, log);
exit(EXIT_FAILURE);
}
@ -995,7 +1006,7 @@ static void set_params(void)
chunk_bytes = chunk_size * bits_per_frame / 8;
audiobuf = realloc(audiobuf, chunk_bytes);
if (audiobuf == NULL) {
error("not enough memory");
error(_("not enough memory"));
exit(EXIT_FAILURE);
}
// fprintf(stderr, "real chunk_size = %i, frags = %i, total = %i\n", chunk_size, setup.buf.block.frags, setup.buf.block.frags * chunk_size);
@ -1021,7 +1032,7 @@ static void xrun(void)
snd_pcm_status_alloca(&status);
if ((res = snd_pcm_status(handle, status))<0) {
error("status error: %s", snd_strerror(res));
error(_("status error: %s"), snd_strerror(res));
exit(EXIT_FAILURE);
}
if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) {
@ -1029,37 +1040,37 @@ static void xrun(void)
gettimeofday(&now, 0);
snd_pcm_status_get_trigger_tstamp(status, &tstamp);
timersub(&now, &tstamp, &diff);
fprintf(stderr, "%s!!! (at least %.3f ms long)\n",
stream == SND_PCM_STREAM_PLAYBACK ? "underrun" : "overrun",
fprintf(stderr, _("%s!!! (at least %.3f ms long)\n"),
stream == SND_PCM_STREAM_PLAYBACK ? _("underrun") : _("overrun"),
diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
if (verbose) {
fprintf(stderr, "Status:\n");
fprintf(stderr, _("Status:\n"));
snd_pcm_status_dump(status, log);
}
if ((res = snd_pcm_prepare(handle))<0) {
error("xrun: prepare error: %s", snd_strerror(res));
error(_("xrun: prepare error: %s"), snd_strerror(res));
exit(EXIT_FAILURE);
}
return; /* ok, data should be accepted again */
} if (snd_pcm_status_get_state(status) == SND_PCM_STATE_DRAINING) {
if (verbose) {
fprintf(stderr, "Status(DRAINING):\n");
fprintf(stderr, _("Status(DRAINING):\n"));
snd_pcm_status_dump(status, log);
}
if (stream == SND_PCM_STREAM_CAPTURE) {
fprintf(stderr, "capture stream format change? attempting recover...\n");
fprintf(stderr, _("capture stream format change? attempting recover...\n"));
if ((res = snd_pcm_prepare(handle))<0) {
error("xrun(DRAINING): prepare error: %s", snd_strerror(res));
error(_("xrun(DRAINING): prepare error: %s"), snd_strerror(res));
exit(EXIT_FAILURE);
}
return;
}
}
if (verbose) {
fprintf(stderr, "Status(R/W):\n");
fprintf(stderr, _("Status(R/W):\n"));
snd_pcm_status_dump(status, log);
}
error("read/write error, state = %s", snd_pcm_state_name(snd_pcm_status_get_state(status)));
error(_("read/write error, state = %s"), snd_pcm_state_name(snd_pcm_status_get_state(status)));
exit(EXIT_FAILURE);
}
@ -1069,19 +1080,19 @@ static void suspend(void)
int res;
if (!quiet_mode)
fprintf(stderr, "Suspended. Trying resume. "); fflush(stderr);
fprintf(stderr, _("Suspended. Trying resume. ")); fflush(stderr);
while ((res = snd_pcm_resume(handle)) == -EAGAIN)
sleep(1); /* wait until suspend flag is released */
if (res < 0) {
if (!quiet_mode)
fprintf(stderr, "Failed. Restarting stream. "); fflush(stderr);
fprintf(stderr, _("Failed. Restarting stream. ")); fflush(stderr);
if ((res = snd_pcm_prepare(handle)) < 0) {
error("suspend: prepare error: %s", snd_strerror(res));
error(_("suspend: prepare error: %s"), snd_strerror(res));
exit(EXIT_FAILURE);
}
}
if (!quiet_mode)
fprintf(stderr, "Done.\n");
fprintf(stderr, _("Done.\n"));
}
/* peak handler */
@ -1132,7 +1143,7 @@ static void compute_max_peak(u_char *data, size_t count)
max = 1 << (bits_per_sample-1);
if (max <= 0)
max = 0x7fffffff;
printf("Max peak (%li samples): %05i (0x%04x) ", (long)ocount, max_peak, max_peak);
printf(_("Max peak (%li samples): %05i (0x%04x) "), (long)ocount, max_peak, max_peak);
if (bits_per_sample > 16)
perc = max_peak / (max / 100);
else
@ -1168,7 +1179,7 @@ static ssize_t pcm_write(u_char *data, size_t count)
} else if (r == -ESTRPIPE) {
suspend();
} else if (r < 0) {
error("write error: %s", snd_strerror(r));
error(_("write error: %s"), snd_strerror(r));
exit(EXIT_FAILURE);
}
if (r > 0) {
@ -1210,7 +1221,7 @@ static ssize_t pcm_writev(u_char **data, unsigned int channels, size_t count)
} else if (r == -ESTRPIPE) {
suspend();
} else if (r < 0) {
error("writev error: %s", snd_strerror(r));
error(_("writev error: %s"), snd_strerror(r));
exit(EXIT_FAILURE);
}
if (r > 0) {
@ -1249,7 +1260,7 @@ static ssize_t pcm_read(u_char *data, size_t rcount)
} else if (r == -ESTRPIPE) {
suspend();
} else if (r < 0) {
error("read error: %s", snd_strerror(r));
error(_("read error: %s"), snd_strerror(r));
exit(EXIT_FAILURE);
}
if (r > 0) {
@ -1288,7 +1299,7 @@ static ssize_t pcm_readv(u_char **data, unsigned int channels, size_t rcount)
} else if (r == -ESTRPIPE) {
suspend();
} else if (r < 0) {
error("readv error: %s", snd_strerror(r));
error(_("readv error: %s"), snd_strerror(r));
exit(EXIT_FAILURE);
}
if (r > 0) {
@ -1336,7 +1347,7 @@ static void voc_write_silence(unsigned x)
buf = (char *) malloc(chunk_bytes);
if (buf == NULL) {
error("can't allocate buffer for silence");
error(_("can't allocate buffer for silence"));
return; /* not fatal error */
}
snd_pcm_format_set_silence(hwparams.format, buf, chunk_size * hwparams.channels);
@ -1345,7 +1356,7 @@ static void voc_write_silence(unsigned x)
if (l > chunk_size)
l = chunk_size;
if (voc_pcm_write(buf, l) != (ssize_t)l) {
error("write error");
error(_("write error"));
exit(EXIT_FAILURE);
}
x -= l;
@ -1359,13 +1370,13 @@ static void voc_pcm_flush(void)
size_t b;
if (sleep_min == 0) {
if (snd_pcm_format_set_silence(hwparams.format, audiobuf + buffer_pos, chunk_bytes - buffer_pos * 8 / bits_per_sample) < 0)
fprintf(stderr, "voc_pcm_flush - silence error");
fprintf(stderr, _("voc_pcm_flush - silence error"));
b = chunk_size;
} else {
b = buffer_pos * 8 / bits_per_frame;
}
if (pcm_write(audiobuf, b) != (ssize_t)b)
error("voc_pcm_flush error");
error(_("voc_pcm_flush error"));
}
snd_pcm_drain(handle);
}
@ -1389,23 +1400,23 @@ static void voc_play(int fd, int ofs, char *name)
data = buf = (u_char *)malloc(64 * 1024);
buffer_pos = 0;
if (data == NULL) {
error("malloc error");
error(_("malloc error"));
exit(EXIT_FAILURE);
}
if (!quiet_mode) {
fprintf(stderr, "Playing Creative Labs Channel file '%s'...\n", name);
fprintf(stderr, _("Playing Creative Labs Channel file '%s'...\n"), name);
}
/* first we waste the rest of header, ugly but we don't need seek */
while (ofs > (ssize_t)chunk_bytes) {
if ((size_t)safe_read(fd, buf, chunk_bytes) != chunk_bytes) {
error("read error");
error(_("read error"));
exit(EXIT_FAILURE);
}
ofs -= chunk_bytes;
}
if (ofs) {
if (safe_read(fd, buf, ofs) != ofs) {
error("read error");
error(_("read error"));
exit(EXIT_FAILURE);
}
}
@ -1461,7 +1472,7 @@ static void voc_play(int fd, int ofs, char *name)
d_printf("Channel data %d Hz\n", dsp_speed);
#endif
if (vd->pack) { /* /dev/dsp can't it */
error("can't play packed .voc files");
error(_("can't play packed .voc files"));
return;
}
if (hwparams.channels == 2) /* if we are in Stereo-Mode, switch back */
@ -1513,7 +1524,7 @@ static void voc_play(int fd, int ofs, char *name)
#endif
if (filepos >= 0) { /* if < 0, one seek fails, why test another */
if ((filepos = lseek64(fd, 0, 1)) < 0) {
error("can't play loops; %s isn't seekable\n", name);
error(_("can't play loops; %s isn't seekable\n"), name);
repeat = 0;
} else {
filepos -= in_buffer; /* set filepos after repeat */
@ -1553,7 +1564,7 @@ static void voc_play(int fd, int ofs, char *name)
if (hwparams.channels == 2)
hwparams.rate = hwparams.rate >> 1;
if (eb->pack) { /* /dev/dsp can't it */
error("can't play packed .voc files");
error(_("can't play packed .voc files"));
return;
}
#if 0
@ -1562,7 +1573,7 @@ static void voc_play(int fd, int ofs, char *name)
#endif
break;
default:
error("unknown blocktype %d. terminate.", bp->type);
error(_("unknown blocktype %d. terminate."), bp->type);
return;
} /* switch (bp->type) */
} /* while (! nextblock) */
@ -1573,12 +1584,12 @@ static void voc_play(int fd, int ofs, char *name)
if (l) {
if (output && !quiet_mode) {
if (write(2, data, l) != l) { /* to stderr */
error("write error");
error(_("write error"));
exit(EXIT_FAILURE);
}
} else {
if (voc_pcm_write(data, l) != l) {
error("write error");
error(_("write error"));
exit(EXIT_FAILURE);
}
}
@ -1625,7 +1636,7 @@ static void begin_voc(int fd, size_t cnt)
vh.coded_ver = LE_SHORT(0x1233 - VOC_ACTUAL_VERSION);
if (write(fd, &vh, sizeof(VocHeader)) != sizeof(VocHeader)) {
error("write error");
error(_("write error"));
exit(EXIT_FAILURE);
}
if (hwparams.channels > 1) {
@ -1634,14 +1645,14 @@ static void begin_voc(int fd, size_t cnt)
bt.datalen = 4;
bt.datalen_m = bt.datalen_h = 0;
if (write(fd, &bt, sizeof(VocBlockType)) != sizeof(VocBlockType)) {
error("write error");
error(_("write error"));
exit(EXIT_FAILURE);
}
eb.tc = LE_SHORT(65536 - 256000000L / (hwparams.rate << 1));
eb.pack = 0;
eb.mode = 1;
if (write(fd, &eb, sizeof(VocExtBlock)) != sizeof(VocExtBlock)) {
error("write error");
error(_("write error"));
exit(EXIT_FAILURE);
}
}
@ -1651,13 +1662,13 @@ static void begin_voc(int fd, size_t cnt)
bt.datalen_m = (u_char) ((cnt & 0xFF00) >> 8);
bt.datalen_h = (u_char) ((cnt & 0xFF0000) >> 16);
if (write(fd, &bt, sizeof(VocBlockType)) != sizeof(VocBlockType)) {
error("write error");
error(_("write error"));
exit(EXIT_FAILURE);
}
vd.tc = (u_char) (256 - (1000000 / hwparams.rate));
vd.pack = 0;
if (write(fd, &vd, sizeof(VocVoiceData)) != sizeof(VocVoiceData)) {
error("write error");
error(_("write error"));
exit(EXIT_FAILURE);
}
}
@ -1692,7 +1703,7 @@ static void begin_wave(int fd, size_t cnt)
bits = 24;
break;
default:
error("Wave doesn't support %s format...", snd_pcm_format_name(hwparams.format));
error(_("Wave doesn't support %s format..."), snd_pcm_format_name(hwparams.format));
exit(EXIT_FAILURE);
}
h.magic = WAV_RIFF;
@ -1725,7 +1736,7 @@ static void begin_wave(int fd, size_t cnt)
write(fd, &cf, sizeof(WaveChunkHeader)) != sizeof(WaveChunkHeader) ||
write(fd, &f, sizeof(WaveFmtBody)) != sizeof(WaveFmtBody) ||
write(fd, &cd, sizeof(WaveChunkHeader)) != sizeof(WaveChunkHeader)) {
error("write error");
error(_("write error"));
exit(EXIT_FAILURE);
}
}
@ -1749,13 +1760,13 @@ static void begin_au(int fd, size_t cnt)
ah.encoding = BE_INT(AU_FMT_LIN16);
break;
default:
error("Sparc Audio doesn't support %s format...", snd_pcm_format_name(hwparams.format));
error(_("Sparc Audio doesn't support %s format..."), snd_pcm_format_name(hwparams.format));
exit(EXIT_FAILURE);
}
ah.sample_rate = BE_INT(hwparams.rate);
ah.channels = BE_INT(hwparams.channels);
if (write(fd, &ah, sizeof(AuHeader)) != sizeof(AuHeader)) {
error("write error");
error(_("write error"));
exit(EXIT_FAILURE);
}
}
@ -1769,7 +1780,7 @@ static void end_voc(int fd)
char dummy = 0; /* Write a Terminator */
if (write(fd, &dummy, 1) != 1) {
error("write error");
error(_("write error"));
exit(EXIT_FAILURE);
}
length_seek = sizeof(VocHeader);
@ -1834,17 +1845,17 @@ static void header(int rtype, char *name)
{
if (!quiet_mode) {
fprintf(stderr, "%s %s '%s' : ",
(stream == SND_PCM_STREAM_PLAYBACK) ? "Playing" : "Recording",
fmt_rec_table[rtype].what,
(stream == SND_PCM_STREAM_PLAYBACK) ? _("Playing") : _("Recording"),
gettext(fmt_rec_table[rtype].what),
name);
fprintf(stderr, "%s, ", snd_pcm_format_description(hwparams.format));
fprintf(stderr, "Rate %d Hz, ", hwparams.rate);
fprintf(stderr, _("Rate %d Hz, "), hwparams.rate);
if (hwparams.channels == 1)
fprintf(stderr, "Mono");
fprintf(stderr, _("Mono"));
else if (hwparams.channels == 2)
fprintf(stderr, "Stereo");
fprintf(stderr, _("Stereo"));
else
fprintf(stderr, "Channels %i", hwparams.channels);
fprintf(stderr, _("Channels %i"), hwparams.channels);
fprintf(stderr, "\n");
}
}
@ -1952,7 +1963,7 @@ static void playback(char *name)
/* read the file header */
dta = sizeof(AuHeader);
if ((size_t)safe_read(fd, audiobuf, dta) != dta) {
error("read error");
error(_("read error"));
exit(EXIT_FAILURE);
}
if (test_au(fd, audiobuf) >= 0) {
@ -1964,7 +1975,7 @@ static void playback(char *name)
dta = sizeof(VocHeader);
if ((size_t)safe_read(fd, audiobuf + sizeof(AuHeader),
dta - sizeof(AuHeader)) != dta - sizeof(AuHeader)) {
error("read error");
error(_("read error"));
exit(EXIT_FAILURE);
}
if ((ofs = test_vocfile(audiobuf)) >= 0) {
@ -2126,7 +2137,7 @@ static void playbackv(char **names, unsigned int count)
}
alloced = 1;
} else if (count != channels) {
error("You need to specify %d files", channels);
error(_("You need to specify %d files"), channels);
exit(EXIT_FAILURE);
}
@ -2179,7 +2190,7 @@ static void capturev(char **names, unsigned int count)
}
alloced = 1;
} else if (count != channels) {
error("You need to specify %d files", channels);
error(_("You need to specify %d files"), channels);
exit(EXIT_FAILURE);
}

View file

@ -84,7 +84,7 @@ AC_PROG_GCC_TRADITIONAL
SAVE_UTIL_VERSION
AC_OUTPUT(Makefile alsactl/Makefile alsamixer/Makefile amidi/Makefile amixer/Makefile \
m4/Makefile \
m4/Makefile po/Makefile.in \
alsaconf/alsaconf alsaconf/Makefile \
alsaconf/po/Makefile \
aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \

16
include/gettext.h Normal file
View file

@ -0,0 +1,16 @@
#ifndef __MY_GETTEXT_H
#define __MY_GETTEXT_H
#if ENABLE_NLS
# include <libintl.h>
#else
# define gettext(msgid) (msgid)
# define textdomain(domain)
# define bindtextdomain(domain, dir)
#endif
#define _(msgid) gettext (msgid)
#define gettext_noop(msgid) msgid
#define N_(msgid) gettext_noop (msgid)
#endif /* __MY_GETTEXT_H */

1
po/LINGUAS Normal file
View file

@ -0,0 +1 @@
ja

366
po/Makefile.in.in Normal file
View file

@ -0,0 +1,366 @@
# Makefile for PO directory in any package using GNU gettext.
# Copyright (C) 1995-1997, 2000-2004 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU General Public
# License but which still want to provide support for the GNU gettext
# functionality.
# Please note that the actual code of GNU gettext is covered by the GNU
# General Public License and is *not* in the public domain.
#
# Origin: gettext-0.14
PACKAGE = @PACKAGE@
VERSION = @VERSION@
SHELL = /bin/sh
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datadir = @datadir@
localedir = $(datadir)/locale
gettextsrcdir = $(datadir)/gettext/po
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MKINSTALLDIRS = @MKINSTALLDIRS@
mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = @XGETTEXT@
MSGMERGE = msgmerge
MSGMERGE_UPDATE = @MSGMERGE@ --update
MSGINIT = msginit
MSGCONV = msgconv
MSGFILTER = msgfilter
POFILES = @POFILES@
GMOFILES = @GMOFILES@
UPDATEPOFILES = @UPDATEPOFILES@
DUMMYPOFILES = @DUMMYPOFILES@
DISTFILES.common = Makefile.in.in remove-potcdate.sin \
$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
DISTFILES = $(DISTFILES.common) Makevars POTFILES.in $(DOMAIN).pot stamp-po \
$(POFILES) $(GMOFILES) \
$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
POTFILES = \
CATALOGS = @CATALOGS@
# Makevars gets inserted here. (Don't remove this line!)
.SUFFIXES:
.SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
.po.mo:
@echo "$(MSGFMT) -c -o $@ $<"; \
$(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
.po.gmo:
@lang=`echo $* | sed -e 's,.*/,,'`; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
.sin.sed:
sed -e '/^#/d' $< > t-$@
mv t-$@ $@
all: all-@USE_NLS@
all-yes: stamp-po
all-no:
# stamp-po is a timestamp denoting the last time at which the CATALOGS have
# been loosely updated. Its purpose is that when a developer or translator
# checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
# "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
# invocations of "make" will do nothing. This timestamp would not be necessary
# if updating the $(CATALOGS) would always touch them; however, the rule for
# $(POFILES) has been designed to not touch files that don't need to be
# changed.
stamp-po: $(srcdir)/$(DOMAIN).pot
test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
@echo "touch stamp-po"
@echo timestamp > stamp-poT
@mv stamp-poT stamp-po
# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
# otherwise packages like GCC can not be built if only parts of the source
# have been downloaded.
# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
--add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
--files-from=$(srcdir)/POTFILES.in \
--copyright-holder='$(COPYRIGHT_HOLDER)' \
--msgid-bugs-address='$(MSGID_BUGS_ADDRESS)'
test ! -f $(DOMAIN).po || { \
if test -f $(srcdir)/$(DOMAIN).pot; then \
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
else \
rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
fi; \
else \
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
fi; \
}
# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
# every "make" invocation, only create it when it is missing.
# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
$(srcdir)/$(DOMAIN).pot:
$(MAKE) $(DOMAIN).pot-update
# This target rebuilds a PO file if $(DOMAIN).pot has changed.
# Note that a PO file is not touched if it doesn't need to be changed.
$(POFILES): $(srcdir)/$(DOMAIN).pot
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
if test -f "$(srcdir)/$${lang}.po"; then \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
else \
$(MAKE) $${lang}.po-create; \
fi
install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
if test "$(PACKAGE)" = "gettext-tools"; then \
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
for file in $(DISTFILES.common) Makevars.template; do \
$(INSTALL_DATA) $(srcdir)/$$file \
$(DESTDIR)$(gettextsrcdir)/$$file; \
done; \
for file in Makevars; do \
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
done; \
else \
: ; \
fi
install-data-no: all
install-data-yes: all
$(mkinstalldirs) $(DESTDIR)$(datadir)
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
dir=$(localedir)/$$lang/LC_MESSAGES; \
$(mkinstalldirs) $(DESTDIR)$$dir; \
if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
$(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
if test -n "$$lc"; then \
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
for file in *; do \
if test -f $$file; then \
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
fi; \
done); \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
else \
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
:; \
else \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
fi; \
fi; \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
fi; \
done; \
done
install-strip: install
installdirs: installdirs-exec installdirs-data
installdirs-exec:
installdirs-data: installdirs-data-@USE_NLS@
if test "$(PACKAGE)" = "gettext-tools"; then \
$(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
else \
: ; \
fi
installdirs-data-no:
installdirs-data-yes:
$(mkinstalldirs) $(DESTDIR)$(datadir)
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
dir=$(localedir)/$$lang/LC_MESSAGES; \
$(mkinstalldirs) $(DESTDIR)$$dir; \
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
if test -n "$$lc"; then \
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
for file in *; do \
if test -f $$file; then \
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
fi; \
done); \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
else \
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
:; \
else \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
fi; \
fi; \
fi; \
done; \
done
# Define this as empty until I found a useful application.
installcheck:
uninstall: uninstall-exec uninstall-data
uninstall-exec:
uninstall-data: uninstall-data-@USE_NLS@
if test "$(PACKAGE)" = "gettext-tools"; then \
for file in $(DISTFILES.common) Makevars.template; do \
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
done; \
else \
: ; \
fi
uninstall-data-no:
uninstall-data-yes:
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
done; \
done
check: all
info dvi ps pdf html tags TAGS ctags CTAGS ID:
mostlyclean:
rm -f remove-potcdate.sed
rm -f stamp-poT
rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
rm -fr *.o
clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES *.mo
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
rm -f stamp-po $(GMOFILES)
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir:
$(MAKE) update-po
@$(MAKE) dist2
# This is a separate target because 'update-po' must be executed before.
dist2: $(DISTFILES)
dists="$(DISTFILES)"; \
if test "$(PACKAGE)" = "gettext-tools"; then \
dists="$$dists Makevars.template"; \
fi; \
if test -f $(srcdir)/ChangeLog; then \
dists="$$dists ChangeLog"; \
fi; \
for i in 0 1 2 3 4 5 6 7 8 9; do \
if test -f $(srcdir)/ChangeLog.$$i; then \
dists="$$dists ChangeLog.$$i"; \
fi; \
done; \
if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
for file in $$dists; do \
if test -f $$file; then \
cp -p $$file $(distdir); \
else \
cp -p $(srcdir)/$$file $(distdir); \
fi; \
done
update-po: Makefile
$(MAKE) $(DOMAIN).pot-update
test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
$(MAKE) update-gmo
# General rule for creating PO files.
.nop.po-create:
@lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
exit 1
# General rule for updating PO files.
.nop.po-update:
@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
tmpdir=`pwd`; \
echo "$$lang:"; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
cd $(srcdir); \
if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
:; \
else \
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
exit 1; \
fi; \
fi; \
else \
echo "msgmerge for $$lang.po failed!" 1>&2; \
rm -f $$tmpdir/$$lang.new.po; \
fi
$(DUMMYPOFILES):
update-gmo: Makefile $(GMOFILES)
@:
Makefile: Makefile.in.in $(top_builddir)/config.status @POMAKEFILEDEPS@
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
$(SHELL) ./config.status
force:
# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

41
po/Makevars Normal file
View file

@ -0,0 +1,41 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)
# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = Free Software Foundation, Inc.
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS =
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =

41
po/Makevars.template Normal file
View file

@ -0,0 +1,41 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)
# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = Free Software Foundation, Inc.
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS =
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =

4
po/POTFILES.in Normal file
View file

@ -0,0 +1,4 @@
aplay/aplay.c
seq/aconnect/aconnect.c
seq/aseqnet/aseqnet.c
speaker-test/speaker-test.c

47
po/Rules-quot Normal file
View file

@ -0,0 +1,47 @@
# Special Makefile rules for English message catalogs with quotation marks.
DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
.SUFFIXES: .insert-header .po-update-en
en@quot.po-create:
$(MAKE) en@quot.po-update
en@boldquot.po-create:
$(MAKE) en@boldquot.po-update
en@quot.po-update: en@quot.po-update-en
en@boldquot.po-update: en@boldquot.po-update-en
.insert-header.po-update-en:
@lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
tmpdir=`pwd`; \
echo "$$lang:"; \
ll=`echo $$lang | sed -e 's/@.*//'`; \
LC_ALL=C; export LC_ALL; \
cd $(srcdir); \
if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
:; \
else \
echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
exit 1; \
fi; \
fi; \
else \
echo "creation of $$lang.po failed!" 1>&2; \
rm -f $$tmpdir/$$lang.new.po; \
fi
en@quot.insert-header: insert-header.sin
sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
en@boldquot.insert-header: insert-header.sin
sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
mostlyclean: mostlyclean-quot
mostlyclean-quot:
rm -f *.insert-header

10
po/boldquot.sed Normal file
View file

@ -0,0 +1,10 @@
s/"\([^"]*\)"/“\1”/g
s/`\([^`']*\)'/\1/g
s/ '\([^`']*\)' / \1 /g
s/ '\([^`']*\)'$/ \1/g
s/^'\([^`']*\)' /\1 /g
s/“”/""/g
s///g
s//”/g
s///g
s///g

25
po/en@boldquot.header Normal file
View file

@ -0,0 +1,25 @@
# All this catalog "translates" are quotation characters.
# The msgids must be ASCII and therefore cannot contain real quotation
# characters, only substitutes like grave accent (0x60), apostrophe (0x27)
# and double quote (0x22). These substitutes look strange; see
# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
#
# This catalog translates grave accent (0x60) and apostrophe (0x27) to
# left single quotation mark (U+2018) and right single quotation mark (U+2019).
# It also translates pairs of apostrophe (0x27) to
# left single quotation mark (U+2018) and right single quotation mark (U+2019)
# and pairs of quotation mark (0x22) to
# left double quotation mark (U+201C) and right double quotation mark (U+201D).
#
# When output to an UTF-8 terminal, the quotation characters appear perfectly.
# When output to an ISO-8859-1 terminal, the single quotation marks are
# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to
# grave/acute accent (by libiconv), and the double quotation marks are
# transliterated to 0x22.
# When output to an ASCII terminal, the single quotation marks are
# transliterated to apostrophes, and the double quotation marks are
# transliterated to 0x22.
#
# This catalog furthermore displays the text between the quotation marks in
# bold face, assuming the VT100/XTerm escape sequences.
#

22
po/en@quot.header Normal file
View file

@ -0,0 +1,22 @@
# All this catalog "translates" are quotation characters.
# The msgids must be ASCII and therefore cannot contain real quotation
# characters, only substitutes like grave accent (0x60), apostrophe (0x27)
# and double quote (0x22). These substitutes look strange; see
# http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html
#
# This catalog translates grave accent (0x60) and apostrophe (0x27) to
# left single quotation mark (U+2018) and right single quotation mark (U+2019).
# It also translates pairs of apostrophe (0x27) to
# left single quotation mark (U+2018) and right single quotation mark (U+2019)
# and pairs of quotation mark (0x22) to
# left double quotation mark (U+201C) and right double quotation mark (U+201D).
#
# When output to an UTF-8 terminal, the quotation characters appear perfectly.
# When output to an ISO-8859-1 terminal, the single quotation marks are
# transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to
# grave/acute accent (by libiconv), and the double quotation marks are
# transliterated to 0x22.
# When output to an ASCII terminal, the single quotation marks are
# transliterated to apostrophes, and the double quotation marks are
# transliterated to 0x22.
#

23
po/insert-header.sin Normal file
View file

@ -0,0 +1,23 @@
# Sed script that inserts the file called HEADER before the header entry.
#
# At each occurrence of a line starting with "msgid ", we execute the following
# commands. At the first occurrence, insert the file. At the following
# occurrences, do nothing. The distinction between the first and the following
# occurrences is achieved by looking at the hold space.
/^msgid /{
x
# Test if the hold space is empty.
s/m/m/
ta
# Yes it was empty. First occurrence. Read the file.
r HEADER
# Output the file's contents by reading the next line. But don't lose the
# current line while doing this.
g
N
bb
:a
# The hold space was nonempty. Following occurrences. Do nothing.
x
:b
}

1090
po/ja.po Normal file

File diff suppressed because it is too large Load diff

6
po/quot.sed Normal file
View file

@ -0,0 +1,6 @@
s/"\([^"]*\)"/“\1”/g
s/`\([^`']*\)'/\1/g
s/ '\([^`']*\)' / \1 /g
s/ '\([^`']*\)'$/ \1/g
s/^'\([^`']*\)' /\1 /g
s/“”/""/g

11
po/remove-potcdate.sed Normal file
View file

@ -0,0 +1,11 @@
/^"POT-Creation-Date: .*"$/{
x
s/P/P/
ta
g
d
bb
:a
x
:b
}

19
po/remove-potcdate.sin Normal file
View file

@ -0,0 +1,19 @@
# Sed script that remove the POT-Creation-Date line in the header entry
# from a POT file.
#
# The distinction between the first and the following occurrences of the
# pattern is achieved by looking at the hold space.
/^"POT-Creation-Date: .*"$/{
x
# Test if the hold space is empty.
s/P/P/
ta
# Yes it was empty. First occurrence. Remove the line.
g
d
bb
:a
# The hold space was nonempty. Following occurrences. Do nothing.
x
:b
}

View file

@ -1,5 +1,6 @@
INCLUDES = -I$(top_srcdir)/include
EXTRA_DIST = README.aconnect aconnect.1
LDADD = $(LIBINTL)
bin_PROGRAMS = aconnect
aconnect_SOURCES = aconnect.c

View file

@ -25,6 +25,8 @@
#include <stdarg.h>
#include <sys/ioctl.h>
#include <alsa/asoundlib.h>
#include "aconfig.h"
#include "gettext.h"
static void error_handler(const char *file, int line, const char *function, int err, const char *fmt, ...)
{
@ -43,23 +45,23 @@ static void error_handler(const char *file, int line, const char *function, int
static void usage(void)
{
fprintf(stderr, "aconnect - ALSA sequencer connection manager\n");
fprintf(stderr, "Copyright (C) 1999-2000 Takashi Iwai\n");
fprintf(stderr, "Usage:\n");
fprintf(stderr, " * Connection/disconnection between two ports\n");
fprintf(stderr, " aconnect [-options] sender receiver\n");
fprintf(stderr, " sender, receiver = client:port pair\n");
fprintf(stderr, " -d,--disconnect disconnect\n");
fprintf(stderr, " -e,--exclusive exclusive connection\n");
fprintf(stderr, " -r,--real # convert real-time-stamp on queue\n");
fprintf(stderr, " -t,--tick # convert tick-time-stamp on queue\n");
fprintf(stderr, " * List connected ports (no subscription action)\n");
fprintf(stderr, " aconnect -i|-o [-options]\n");
fprintf(stderr, " -i,--input list input (readable) ports\n");
fprintf(stderr, " -o,--output list output (writable) ports\n");
fprintf(stderr, " -l,--list list current connections of each port\n");
fprintf(stderr, " * Remove all exported connections\n");
fprintf(stderr, " -x, --removeall\n");
fprintf(stderr, _("aconnect - ALSA sequencer connection manager\n"));
fprintf(stderr, _("Copyright (C) 1999-2000 Takashi Iwai\n"));
fprintf(stderr, _("Usage:\n"));
fprintf(stderr, _(" * Connection/disconnection between two ports\n"));
fprintf(stderr, _(" aconnect [-options] sender receiver\n"));
fprintf(stderr, _(" sender, receiver = client:port pair\n"));
fprintf(stderr, _(" -d,--disconnect disconnect\n"));
fprintf(stderr, _(" -e,--exclusive exclusive connection\n"));
fprintf(stderr, _(" -r,--real # convert real-time-stamp on queue\n"));
fprintf(stderr, _(" -t,--tick # convert tick-time-stamp on queue\n"));
fprintf(stderr, _(" * List connected ports (no subscription action)\n"));
fprintf(stderr, _(" aconnect -i|-o [-options]\n"));
fprintf(stderr, _(" -i,--input list input (readable) ports\n"));
fprintf(stderr, _(" -o,--output list output (writable) ports\n"));
fprintf(stderr, _(" -l,--list list current connections of each port\n"));
fprintf(stderr, _(" * Remove all exported connections\n"));
fprintf(stderr, _(" -x, --removeall\n"));
}
/*
@ -126,8 +128,8 @@ static void list_subscribers(snd_seq_t *seq, const snd_seq_addr_t *addr)
snd_seq_query_subscribe_t *subs;
snd_seq_query_subscribe_alloca(&subs);
snd_seq_query_subscribe_set_root(subs, addr);
list_each_subs(seq, subs, SND_SEQ_QUERY_SUBS_READ, "Connecting To");
list_each_subs(seq, subs, SND_SEQ_QUERY_SUBS_WRITE, "Connected From");
list_each_subs(seq, subs, SND_SEQ_QUERY_SUBS_READ, _("Connecting To"));
list_each_subs(seq, subs, SND_SEQ_QUERY_SUBS_WRITE, _("Connected From"));
}
/*
@ -163,10 +165,11 @@ static void print_port(snd_seq_t *seq, snd_seq_client_info_t *cinfo,
snd_seq_port_info_t *pinfo, int count)
{
if (! count) {
printf("client %d: '%s' [type=%s]\n",
printf(_("client %d: '%s' [type=%s]\n"),
snd_seq_client_info_get_client(cinfo),
snd_seq_client_info_get_name(cinfo),
(snd_seq_client_info_get_type(cinfo) == SND_SEQ_USER_CLIENT ? "user" : "kernel"));
(snd_seq_client_info_get_type(cinfo) == SND_SEQ_USER_CLIENT ?
_("user") : _("kernel")));
}
printf(" %3d '%-16s'\n",
snd_seq_port_info_get_port(pinfo),
@ -275,6 +278,9 @@ int main(int argc, char **argv)
snd_seq_port_subscribe_t *subs;
snd_seq_addr_t sender, dest;
setlocale(LC_ALL, "");
textdomain(PACKAGE);
while ((c = getopt_long(argc, argv, "dior:t:elx", long_option, NULL)) != -1) {
switch (c) {
case 'd':
@ -314,7 +320,7 @@ int main(int argc, char **argv)
}
if (snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0) < 0) {
fprintf(stderr, "can't open sequencer\n");
fprintf(stderr, _("can't open sequencer\n"));
return 1;
}
@ -342,26 +348,26 @@ int main(int argc, char **argv)
if ((client = snd_seq_client_id(seq)) < 0) {
snd_seq_close(seq);
fprintf(stderr, "can't get client id\n");
fprintf(stderr, _("can't get client id\n"));
return 1;
}
/* set client info */
if (snd_seq_set_client_name(seq, "ALSA Connector") < 0) {
snd_seq_close(seq);
fprintf(stderr, "can't set client info\n");
fprintf(stderr, _("can't set client info\n"));
return 1;
}
/* set subscription */
if (snd_seq_parse_address(seq, &sender, argv[optind]) < 0) {
snd_seq_close(seq);
fprintf(stderr, "invalid sender address %s\n", argv[optind]);
fprintf(stderr, _("invalid sender address %s\n"), argv[optind]);
return 1;
}
if (snd_seq_parse_address(seq, &dest, argv[optind + 1]) < 0) {
snd_seq_close(seq);
fprintf(stderr, "invalid destination address %s\n", argv[optind + 1]);
fprintf(stderr, _("invalid destination address %s\n"), argv[optind + 1]);
return 1;
}
snd_seq_port_subscribe_alloca(&subs);
@ -375,23 +381,23 @@ int main(int argc, char **argv)
if (command == UNSUBSCRIBE) {
if (snd_seq_get_port_subscription(seq, subs) < 0) {
snd_seq_close(seq);
fprintf(stderr, "No subscription is found\n");
fprintf(stderr, _("No subscription is found\n"));
return 1;
}
if (snd_seq_unsubscribe_port(seq, subs) < 0) {
snd_seq_close(seq);
fprintf(stderr, "Disconnection failed (%s)\n", snd_strerror(errno));
fprintf(stderr, _("Disconnection failed (%s)\n"), snd_strerror(errno));
return 1;
}
} else {
if (snd_seq_get_port_subscription(seq, subs) == 0) {
snd_seq_close(seq);
fprintf(stderr, "Connection is already subscribed\n");
fprintf(stderr, _("Connection is already subscribed\n"));
return 1;
}
if (snd_seq_subscribe_port(seq, subs) < 0) {
snd_seq_close(seq);
fprintf(stderr, "Connection failed (%s)\n", snd_strerror(errno));
fprintf(stderr, _("Connection failed (%s)\n"), snd_strerror(errno));
return 1;
}
}

View file

@ -238,7 +238,7 @@ static void dump_event(const snd_seq_event_t *ev)
break;
case SND_SEQ_EVENT_TUNE_REQUEST:
/* something's fishy here ... */
printf("Tuna request\n");
printf("Tune request\n");
break;
case SND_SEQ_EVENT_RESET:
printf("Reset\n");

View file

@ -25,6 +25,8 @@
#include <alsa/asoundlib.h>
#include <getopt.h>
#include <signal.h>
#include "aconfig.h"
#include "gettext.h"
/*
* prototypes
@ -95,6 +97,9 @@ int main(int argc, char **argv)
int port = DEFAULT_PORT;
char *source = NULL, *dest = NULL;
setlocale(LC_ALL, "");
textdomain(PACKAGE);
while ((c = getopt_long(argc, argv, "p:s:d:vi", long_option, NULL)) != -1) {
switch (c) {
case 'p':
@ -152,17 +157,17 @@ int main(int argc, char **argv)
*/
static void usage(void)
{
fprintf(stderr, "aseqnet - network client/server on ALSA sequencer\n");
fprintf(stderr, " Copyright (C) 1999 Takashi Iwai\n");
fprintf(stderr, "usage:\n");
fprintf(stderr, " server mode: aseqnet [-options]\n");
fprintf(stderr, " client mode: aseqnet [-options] server_host\n");
fprintf(stderr, "options:\n");
fprintf(stderr, " -p,--port # : sepcify TCP port (digit or service name)\n");
fprintf(stderr, " -s,--source addr : read from given addr (client:port)\n");
fprintf(stderr, " -d,--dest addr : write to given addr (client:port)\n");
fprintf(stderr, " -v, --verbose : print verbose messages\n");
fprintf(stderr, " -i, --info : print certain received events\n");
fprintf(stderr, _("aseqnet - network client/server on ALSA sequencer\n"));
fprintf(stderr, _(" Copyright (C) 1999 Takashi Iwai\n"));
fprintf(stderr, _("usage:\n"));
fprintf(stderr, _(" server mode: aseqnet [-options]\n"));
fprintf(stderr, _(" client mode: aseqnet [-options] server_host\n"));
fprintf(stderr, _("options:\n"));
fprintf(stderr, _(" -p,--port # : sepcify TCP port (digit or service name)\n"));
fprintf(stderr, _(" -s,--source addr : read from given addr (client:port)\n"));
fprintf(stderr, _(" -d,--dest addr : write to given addr (client:port)\n"));
fprintf(stderr, _(" -v, --verbose : print verbose messages\n"));
fprintf(stderr, _(" -i, --info : print certain received events\n"));
}
@ -176,7 +181,7 @@ static void init_buf(void)
writebuf = malloc(max_wrlen);
readbuf = malloc(max_rdlen);
if (writebuf == NULL || readbuf == NULL) {
fprintf(stderr, "can't malloc\n");
fprintf(stderr, _("can't malloc\n"));
exit(1);
}
memset(writebuf, 0, max_wrlen);
@ -201,7 +206,7 @@ static void close_files(void)
{
int i;
if (verbose)
fprintf(stderr, "closing files..\n");
fprintf(stderr, _("closing files..\n"));
for (i = 0; i < max_connection; i++) {
if (netfd[i] >= 0)
close(netfd[i]);
@ -260,14 +265,14 @@ static void init_seq(char *source, char *dest)
exit(1);
}
if (verbose)
fprintf(stderr, "sequencer opened: %d:%d\n",
fprintf(stderr, _("sequencer opened: %d:%d\n"),
snd_seq_client_id(handle), seq_port);
/* explicit subscriptions */
if (source) {
/* read subscription */
if (snd_seq_parse_address(handle, &addr, source) < 0) {
fprintf(stderr, "invalid source address %s\n", source);
fprintf(stderr, _("invalid source address %s\n"), source);
exit(1);
}
if (snd_seq_connect_from(handle, seq_port, addr.client, addr.port)) {
@ -278,7 +283,7 @@ static void init_seq(char *source, char *dest)
if (dest) {
/* write subscription */
if (snd_seq_parse_address(handle, &addr, dest) < 0) {
fprintf(stderr, "invalid destination address %s\n", dest);
fprintf(stderr, _("invalid destination address %s\n"), dest);
exit(1);
}
if (snd_seq_connect_to(handle, seq_port, addr.client, addr.port)) {
@ -297,7 +302,7 @@ static int get_port(char *service)
struct servent *sp;
if ((sp = getservbyname(service, "tcp")) == NULL){
fprintf(stderr, "service '%s' is not found in /etc/services\n", service);
fprintf(stderr, _("service '%s' is not found in /etc/services\n"), service);
return -1;
}
return sp->s_port;
@ -365,7 +370,7 @@ static void start_connection(void)
break;
}
if (i >= max_connection) {
fprintf(stderr, "too many connections!\n");
fprintf(stderr, _("too many connections!\n"));
exit(1);
}
memset(&addr, 0, sizeof(addr));
@ -376,7 +381,7 @@ static void start_connection(void)
exit(1);
}
if (verbose)
fprintf(stderr, "accepted[%d]\n", netfd[i]);
fprintf(stderr, _("accepted[%d]\n"), netfd[i]);
cur_connected++;
}
@ -399,7 +404,7 @@ static void init_client(char *server, int port)
exit(1);
}
if ((host = gethostbyname(server)) == NULL){
fprintf(stderr,"can't get address %s\n", server);
fprintf(stderr, _("can't get address %s\n"), server);
exit(1);
}
addr.sin_port = htons(port);
@ -410,7 +415,7 @@ static void init_client(char *server, int port)
exit(1);
}
if (verbose)
fprintf(stderr, "ok.. connected\n");
fprintf(stderr, _("ok.. connected\n"));
netfd[0] = fd;
cur_connected = 1;
}
@ -506,21 +511,21 @@ static void print_event(snd_seq_event_t *ev)
{
switch (ev->type) {
case SND_SEQ_EVENT_CONTROLLER:
printf("Channel %2d: Control event : %5d\n",
printf(_("Channel %2d: Control event : %5d\n"),
ev->data.control.channel, ev->data.control.value);
break;
case SND_SEQ_EVENT_PITCHBEND:
printf("Channel %2d: Pitchbender : %5d\n",
printf(_("Channel %2d: Pitchbender : %5d\n"),
ev->data.control.channel, ev->data.control.value);
break;
case SND_SEQ_EVENT_NOTEON:
printf("Channel %2d: Note On event : %5d\n",
printf(_("Channel %2d: Note On event : %5d\n"),
ev->data.control.channel, ev->data.note.note);
break;
break;
case SND_SEQ_EVENT_NOTEOFF:
printf("Channel %2d: Note Off event: %5d\n",
ev->data.control.channel, ev->data.note.note);
break;
printf(_("Channel %2d: Note Off event: %5d\n"),
ev->data.control.channel, ev->data.note.note);
break;
}
}
@ -573,7 +578,7 @@ static int copy_remote_to_local(int fd)
if (count == 0) {
if (verbose)
fprintf(stderr, "disconnected\n");
fprintf(stderr, _("disconnected\n"));
return 1;
}

View file

@ -1,6 +1,7 @@
SPEAKER_TEST_VERSION = 0.0.8
INCLUDES = -I$(top_srcdir)/include -DVERSION=\"$(SPEAKER_TEST_VERSION)\"
INCLUDES = -I$(top_srcdir)/include -DSPEAKER_TEST_VERSION=\"$(SPEAKER_TEST_VERSION)\"
SUBDIRS= samples
LDADD = $(LIBINTL)
bin_PROGRAMS = speaker-test
speaker_test_SOURCES = speaker-test.c pink.c

View file

@ -44,14 +44,14 @@
#include <getopt.h>
#include <inttypes.h>
/* #include "aconfig.h" */
#define ALSA_PCM_NEW_HW_PARAMS_API
#define ALSA_PCM_NEW_SW_PARAMS_API
#include <alsa/asoundlib.h>
#include <sys/time.h>
#include <math.h>
#include "pink.h"
#include "aconfig.h"
#include "gettext.h"
static char *device = "plughw:0,0"; /* playback device */
static snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */
@ -68,23 +68,23 @@ static snd_output_t *output = NULL;
static snd_pcm_uframes_t buffer_size;
static snd_pcm_uframes_t period_size;
static const char *channel_name[] = {
"Front Left" ,
"Front Right" ,
"Rear Left" ,
"Rear Right" ,
"Center" ,
"LFE",
"Side Left",
"Side Right",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"15",
"16"
N_("Front Left"),
N_("Front Right"),
N_("Rear Left"),
N_("Rear Right"),
N_("Center"),
N_("LFE"),
N_("Side Left"),
N_("Side Right"),
N_("8"),
N_("9"),
N_("10"),
N_("11"),
N_("12"),
N_("13"),
N_("14"),
N_("15"),
N_("16")
};
static const int channels4[] = {
@ -234,28 +234,28 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_
/* choose all parameters */
err = snd_pcm_hw_params_any(handle, params);
if (err < 0) {
printf("Broken configuration for playback: no configurations available: %s\n", snd_strerror(err));
printf(_("Broken configuration for playback: no configurations available: %s\n"), snd_strerror(err));
return err;
}
/* set the interleaved read/write format */
err = snd_pcm_hw_params_set_access(handle, params, access);
if (err < 0) {
printf("Access type not available for playback: %s\n", snd_strerror(err));
printf(_("Access type not available for playback: %s\n"), snd_strerror(err));
return err;
}
/* set the sample format */
err = snd_pcm_hw_params_set_format(handle, params, format);
if (err < 0) {
printf("Sample format not available for playback: %s\n", snd_strerror(err));
printf(_("Sample format not available for playback: %s\n"), snd_strerror(err));
return err;
}
/* set the count of channels */
err = snd_pcm_hw_params_set_channels(handle, params, channels);
if (err < 0) {
printf("Channels count (%i) not available for playbacks: %s\n", channels, snd_strerror(err));
printf(_("Channels count (%i) not available for playbacks: %s\n"), channels, snd_strerror(err));
return err;
}
@ -263,16 +263,16 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_
rrate = rate;
err = snd_pcm_hw_params_set_rate(handle, params, rate, 0);
if (err < 0) {
printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err));
printf(_("Rate %iHz not available for playback: %s\n"), rate, snd_strerror(err));
return err;
}
if (rrate != rate) {
printf("Rate doesn't match (requested %iHz, get %iHz, err %d)\n", rate, rrate, err);
printf(_("Rate doesn't match (requested %iHz, get %iHz, err %d)\n"), rate, rrate, err);
return -EINVAL;
}
printf("Rate set to %iHz (requested %iHz)\n", rrate, rate);
printf(_("Rate set to %iHz (requested %iHz)\n"), rrate, rate);
/* set the buffer time */
buffer_time_to_size = ( (snd_pcm_uframes_t)buffer_time * rate) / 1000000;
err = snd_pcm_hw_params_get_buffer_size_min(params, &buffer_size_min);
@ -281,10 +281,10 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_
err = snd_pcm_hw_params_get_period_size_min(params, &period_size_min,&dir);
dir=0;
err = snd_pcm_hw_params_get_period_size_max(params, &period_size_max,&dir);
printf("Buffer size range from %lu to %lu\n",buffer_size_min, buffer_size_max);
printf("Period size range from %lu to %lu\n",period_size_min, period_size_max);
printf("Periods = %d\n", PERIODS);
printf("Buffer time size %lu\n",buffer_time_to_size);
printf(_("Buffer size range from %lu to %lu\n"),buffer_size_min, buffer_size_max);
printf(_("Period size range from %lu to %lu\n"),period_size_min, period_size_max);
printf(_("Periods = %d\n"), PERIODS);
printf(_("Buffer time size %lu\n"),buffer_time_to_size);
buffer_size = buffer_time_to_size;
//buffer_size=8096;
@ -295,29 +295,29 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_
period_size = buffer_size/PERIODS;
buffer_size = period_size*PERIODS;
//period_size = 510;
printf("To choose buffer_size = %lu\n",buffer_size);
printf("To choose period_size = %lu\n",period_size);
printf(_("To choose buffer_size = %lu\n"),buffer_size);
printf(_("To choose period_size = %lu\n"),period_size);
dir=0;
err = snd_pcm_hw_params_set_period_size_near(handle, params, &period_size, &dir);
if (err < 0) {
printf("Unable to set period size %lu for playback: %s\n", period_size, snd_strerror(err));
printf(_("Unable to set period size %lu for playback: %s\n"), period_size, snd_strerror(err));
return err;
}
dir=0;
err = snd_pcm_hw_params_get_period_size(params, &period_size, &dir);
if (err < 0) printf("Unable to get period size for playback: %s\n", snd_strerror(err));
if (err < 0) printf(_("Unable to get period size for playback: %s\n"), snd_strerror(err));
dir=0;
err = snd_pcm_hw_params_set_buffer_size_near(handle, params, &buffer_size);
if (err < 0) {
printf("Unable to set buffer size %lu for playback: %s\n", buffer_size, snd_strerror(err));
printf(_("Unable to set buffer size %lu for playback: %s\n"), buffer_size, snd_strerror(err));
return err;
}
err = snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
printf("was set period_size = %lu\n",period_size);
printf("was set buffer_size = %lu\n",buffer_size);
printf(_("was set period_size = %lu\n"),period_size);
printf(_("was set buffer_size = %lu\n"),buffer_size);
if (2*period_size > buffer_size) {
printf("buffer to small, could not use\n");
printf(_("buffer to small, could not use\n"));
return err;
}
@ -325,7 +325,7 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_
/* write the parameters to device */
err = snd_pcm_hw_params(handle, params);
if (err < 0) {
printf("Unable to set hw params for playback: %s\n", snd_strerror(err));
printf(_("Unable to set hw params for playback: %s\n"), snd_strerror(err));
return err;
}
@ -338,35 +338,35 @@ static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *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));
printf(_("Unable to determine current swparams for playback: %s\n"), snd_strerror(err));
return err;
}
/* start the transfer when a 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));
printf(_("Unable to set start threshold mode for playback: %s\n"), snd_strerror(err));
return err;
}
/* allow the transfer when at least period_size frames 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));
printf(_("Unable to set avail min for playback: %s\n"), snd_strerror(err));
return err;
}
/* 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));
printf(_("Unable to set transfer align for playback: %s\n"), snd_strerror(err));
return err;
}
/* 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));
printf(_("Unable to set sw params for playback: %s\n"), snd_strerror(err));
return err;
}
@ -381,7 +381,7 @@ static int xrun_recovery(snd_pcm_t *handle, int err) {
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));
printf(_("Can't recovery from underrun, prepare failed: %s\n"), snd_strerror(err));
return 0;
}
else if (err == -ESTRPIPE) {
@ -392,7 +392,7 @@ static int xrun_recovery(snd_pcm_t *handle, int err) {
if (err < 0) {
err = snd_pcm_prepare(handle);
if (err < 0)
printf("Can't recovery from suspend, prepare failed: %s\n", snd_strerror(err));
printf(_("Can't recovery from suspend, prepare failed: %s\n"), snd_strerror(err));
}
return 0;
@ -428,9 +428,9 @@ static int write_loop(snd_pcm_t *handle, int channel, int periods, uint8_t *fram
continue;
if (err < 0) {
printf("Write error: %d,%s\n", err, snd_strerror(err));
printf(_("Write error: %d,%s\n"), err, snd_strerror(err));
if (xrun_recovery(handle, err) < 0) {
printf("xrun_recovery failed: %d,%s\n", err, snd_strerror(err));
printf(_("xrun_recovery failed: %d,%s\n"), err, snd_strerror(err));
return -1;
}
break; /* skip one period */
@ -449,20 +449,20 @@ static void help(void)
int k;
printf(
"Usage: speaker-test [OPTION]... \n"
"-h,--help help\n"
"-D,--device playback device\n"
"-r,--rate stream rate in Hz\n"
"-c,--channels count of channels in stream\n"
"-f,--frequency sine wave frequency in Hz\n"
"-F,--format sample format\n"
"-b,--buffer ring buffer size in us\n"
"-p,--period period size in us\n"
"-t,--test 1=use pink noise, 2=use sine wave\n"
"-s,--speaker single speaker test. Values 1=Left or 2=right\n"
"\n");
_("Usage: speaker-test [OPTION]... \n"
"-h,--help help\n"
"-D,--device playback device\n"
"-r,--rate stream rate in Hz\n"
"-c,--channels count of channels in stream\n"
"-f,--frequency sine wave frequency in Hz\n"
"-F,--format sample format\n"
"-b,--buffer ring buffer size in us\n"
"-p,--period period size in us\n"
"-t,--test 1=use pink noise, 2=use sine wave\n"
"-s,--speaker single speaker test. Values 1=Left or 2=right\n"
"\n"));
#if 1
printf("Recognized sample formats are:");
printf(_("Recognized sample formats are:"));
for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) {
const char *s = snd_pcm_format_name(k);
if (s)
@ -498,12 +498,15 @@ int main(int argc, char *argv[]) {
{NULL, 0, NULL, 0 },
};
setlocale(LC_ALL, "");
textdomain(PACKAGE);
snd_pcm_hw_params_alloca(&hwparams);
snd_pcm_sw_params_alloca(&swparams);
morehelp = 0;
printf("\nspeaker-test %s\n\n",VERSION);
printf("\nspeaker-test %s\n\n", SPEAKER_TEST_VERSION);
while (1) {
int c;
@ -555,12 +558,12 @@ int main(int argc, char *argv[]) {
speaker = speaker < 1 ? 0 : speaker;
speaker = speaker > channels ? 0 : speaker;
if (speaker==0) {
printf("Invalid parameter for -s option.\n");
printf(_("Invalid parameter for -s option.\n"));
exit(EXIT_FAILURE);
}
break;
default:
printf("Unknown option '%c'\n", c);
printf(_("Unknown option '%c'\n"), c);
exit(EXIT_FAILURE);
break;
}
@ -573,32 +576,32 @@ int main(int argc, char *argv[]) {
err = snd_output_stdio_attach(&output, stdout, 0);
if (err < 0) {
printf("Output failed: %s\n", snd_strerror(err));
printf(_("Output failed: %s\n"), snd_strerror(err));
exit(EXIT_FAILURE);
}
printf("Playback device is %s\n", device);
printf("Stream parameters are %iHz, %s, %i channels\n", rate, snd_pcm_format_name(format), channels);
printf(_("Playback device is %s\n"), device);
printf(_("Stream parameters are %iHz, %s, %i channels\n"), rate, snd_pcm_format_name(format), channels);
if(test_type==1)
printf("Using 16 octaves of pink noise\n");
printf(_("Using 16 octaves of pink noise\n"));
else
printf("Sine wave rate is %.4fHz\n", freq);
printf(_("Sine wave rate is %.4fHz\n"), freq);
loop:
while ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
printf("Playback open error: %d,%s\n", err,snd_strerror(err));
printf(_("Playback open error: %d,%s\n"), err,snd_strerror(err));
sleep(1);
}
if ((err = set_hwparams(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
printf("Setting of hwparams failed: %s\n", snd_strerror(err));
printf(_("Setting of hwparams failed: %s\n"), snd_strerror(err));
snd_pcm_close(handle);
goto loop;
exit(EXIT_FAILURE);
}
//getchar();
if ((err = set_swparams(handle, swparams)) < 0) {
printf("Setting of swparams failed: %s\n", snd_strerror(err));
printf(_("Setting of swparams failed: %s\n"), snd_strerror(err));
snd_pcm_close(handle);
goto loop;
exit(EXIT_FAILURE);
@ -608,7 +611,7 @@ loop:
initialize_pink_noise( &pink, 16);
if (frames == NULL) {
printf("No enough memory\n");
printf(_("No enough memory\n"));
exit(EXIT_FAILURE);
}
if (speaker==0) {
@ -626,16 +629,16 @@ loop:
if (channels == 8) {
channel=channels8[chn];
}
printf(" %d - %s\n", channel, channel_name[channel]);
printf(" %d - %s\n", channel, gettext(channel_name[channel]));
err = write_loop(handle, channel, ((rate*3)/period_size), frames);
//err = write_loop(handle, 255, ((rate*3)/period_size), frames);
if (err < 0) {
printf("Transfer failed: %s\n", snd_strerror(err));
printf(_("Transfer failed: %s\n"), snd_strerror(err));
free(frames);
snd_pcm_close(handle);
printf("Pausing\n");
printf(_("Pausing\n"));
goto loop ;
//pause();
//printf("Done Pausing\n");
@ -647,14 +650,14 @@ loop:
time1 = (double)tv1.tv_sec + ((double)tv1.tv_usec / 1000000.0);
time2 = (double)tv2.tv_sec + ((double)tv2.tv_usec / 1000000.0);
time3 = time2 - time1;
printf("Time per period = %lf\n", time3 );
printf(_("Time per period = %lf\n"), time3 );
}
} else {
printf(" - %s\n", channel_name[speaker-1]);
printf(" - %s\n", gettext(channel_name[speaker-1]));
err = write_loop(handle, speaker-1, ((rate*5)/period_size), frames);
if (err < 0) {
printf("Transfer failed: %s\n", snd_strerror(err));
printf(_("Transfer failed: %s\n"), snd_strerror(err));
}
}