From ee6c9cb1734af46a4e431433c41f7980e693036e Mon Sep 17 00:00:00 2001 From: trutkin Date: Thu, 6 Feb 2003 01:31:36 +0000 Subject: [PATCH] Takashi's fixes git-svn-id: svn+ssh://jackaudio.org/trunk/jack@312 0c269be4-1314-0410-8aa9-9f06e86f4224 --- .cvsignore | 4 +++ Makefile.am | 2 ++ configure.in | 2 +- doc/Makefile.am | 6 ++--- drivers/alsa/Makefile.am | 2 +- drivers/alsa/alsa_driver.c | 44 ++++++++++++++++---------------- drivers/alsa/ice1712.c | 1 + drivers/solaris/solaris_driver.c | 22 ++++++++-------- example-clients/capture_client.c | 4 +-- example-clients/connect.c | 3 ++- example-clients/metro.c | 10 ++++---- example-clients/monitor_client.c | 1 + example-clients/showtime.c | 1 + example-clients/simple_client.c | 1 + jack/alsa_driver.h | 10 ++++---- jack/cycles.h | 34 +++++++++++++++++++----- jack/engine.h | 2 +- jack/internal.h | 2 +- jack/types.h | 2 +- jackd/engine.c | 28 ++++++++++---------- libjack/client.c | 2 +- libjack/timestamps.c | 1 + 22 files changed, 109 insertions(+), 75 deletions(-) diff --git a/.cvsignore b/.cvsignore index 3332f40..e5103c9 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,3 +1,7 @@ +autom4te.cache +config.h +config.h.in +stamp-h1 config.log aclocal.m4 config.status diff --git a/Makefile.am b/Makefile.am index 82c7802..90b0e64 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,3 +29,5 @@ rpm: dist dist-hook: dist-check-doxygen EXTRA_DIST = depcomp COPYING COPYING.GPL COPYING.LGPL + +AUTOMAKE_OPTIONS = foreign diff --git a/configure.in b/configure.in index a92dcbd..2c3489c 100644 --- a/configure.in +++ b/configure.in @@ -14,7 +14,7 @@ dnl changes are made dnl --- JACK_MAJOR_VERSION=0 JACK_MINOR_VERSION=44 -JACK_MICRO_VERSION=2 +JACK_MICRO_VERSION=3 dnl --- dnl HOWTO: updating the libjack interface version diff --git a/doc/Makefile.am b/doc/Makefile.am index ddde11a..3f0ddac 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -24,14 +24,14 @@ distclean-local: clean if test -d reference; then rm -rf reference; fi install-data-local: - $(mkinstalldirs) $(DOC_DIR)/reference/html + $(mkinstalldirs) $(DESTDIR)$(DOC_DIR)/reference/html (installfiles=`echo reference/html/*.html`; \ if test "$$installfiles" = 'reference/html/*.html'; \ then echo '-- Nothing to install' ; \ else \ for i in $$installfiles reference/html/doxygen.png reference/html/doxygen.css; do \ echo '-- Installing '$$i ; \ - $(INSTALL_DATA) $$i $(DOC_DIR)/reference/html; \ + $(INSTALL_DATA) $$i $(DESTDIR)$(DOC_DIR)/reference/html; \ done; \ fi) @@ -43,7 +43,7 @@ uninstall-local: doxygen-build.stamp else \ for i in $$installfiles reference/html/doxygen.png reference/html/doxygen.css; do \ echo '-- Unstalling '$$i ; \ - rm $(DOC_DIR)/$$i; \ + rm $(DESTDIR)$(DOC_DIR)/$$i; \ done; \ fi) diff --git a/drivers/alsa/Makefile.am b/drivers/alsa/Makefile.am index 83afb1b..6478581 100644 --- a/drivers/alsa/Makefile.am +++ b/drivers/alsa/Makefile.am @@ -6,7 +6,7 @@ plugindir = $(ADDON_DIR) plugin_LTLIBRARIES = jack_alsa.la -jack_alsa_la_LDFLAGS = -module +jack_alsa_la_LDFLAGS = -module -avoid-version jack_alsa_la_SOURCES = alsa_driver.c generic_hw.c memops.c \ hammerfall.c hdsp.c ice1712.c jack_alsa_la_LIBADD = $(ALSA_LIBS) diff --git a/drivers/alsa/alsa_driver.c b/drivers/alsa/alsa_driver.c index b67d824..4e8ce15 100644 --- a/drivers/alsa/alsa_driver.c +++ b/drivers/alsa/alsa_driver.c @@ -554,8 +554,8 @@ alsa_driver_set_parameters (alsa_driver_t *driver, jack_nframes_t frames_per_cyc } driver->clock_sync_data = (ClockSyncStatus *) malloc (sizeof (ClockSyncStatus) * - driver->capture_nchannels > driver->playback_nchannels ? - driver->capture_nchannels : driver->playback_nchannels); + (driver->capture_nchannels > driver->playback_nchannels ? + driver->capture_nchannels : driver->playback_nchannels)); driver->period_usecs = (((float) driver->frames_per_cycle) / driver->frame_rate) * 1000000.0f; @@ -811,7 +811,7 @@ alsa_driver_wait (alsa_driver_t *driver, int extra_fd, int *status, float *delay int xrun_detected = FALSE; int need_capture; int need_playback; - int i; + unsigned int i; unsigned long long poll_enter, poll_ret; *status = -1; @@ -829,9 +829,9 @@ alsa_driver_wait (alsa_driver_t *driver, int extra_fd, int *status, float *delay while (need_playback || need_capture) { - int p_timed_out, c_timed_out; - int ci = 0; - int nfds; + unsigned int p_timed_out, c_timed_out; + unsigned int ci = 0; + unsigned int nfds; nfds = 0; @@ -1107,7 +1107,7 @@ alsa_driver_process (alsa_driver_t *driver, jack_nframes_t nframes) snd_pcm_mmap_commit (driver->capture_handle, capture_offset, contiguous); } - if (contiguous != driver->frames_per_cycle) { + if (contiguous != (snd_pcm_sframes_t) driver->frames_per_cycle) { jack_error ("wierd contiguous size %lu", contiguous); } @@ -1554,7 +1554,7 @@ alsa_driver_listen_for_clock_sync_status (alsa_driver_t *driver, } int -alsa_driver_stop_listening_to_clock_sync_status (alsa_driver_t *driver, int which) +alsa_driver_stop_listening_to_clock_sync_status (alsa_driver_t *driver, unsigned int which) { JSList *node; @@ -1592,20 +1592,20 @@ alsa_driver_clock_sync_notify (alsa_driver_t *driver, channel_t chn, ClockSyncSt static void alsa_usage () { - fprintf (stderr, "\ - -alsa PCM driver args: - -d alsa-pcm-name (default: default) - -r sample-rate (default: 48kHz) - -p frames-per-period (default: 1024) - -n periods-per-hardware-buffer (default: 2) - -H (use hardware monitoring if available, default: no) - -D (duplex, default: yes) - -C (capture, default: duplex) - -P (playback, default: duplex) - -z[r|t|s|-] (dither, rect|tri|shaped|off, default: off) - -s soft-mode, no xrun handling (default: off) -"); + fprintf (stderr, + +"alsa PCM driver args:\n" +" -d alsa-pcm-name (default: default)\n" +" -r sample-rate (default: 48kHz)\n" +" -p frames-per-period (default: 1024)\n" +" -n periods-per-hardware-buffer (default: 2)\n" +" -H (use hardware monitoring if available, default: no)\n" +" -D (duplex, default: yes)\n" +" -C (capture, default: duplex)\n" +" -P (playback, default: duplex)\n" +" -z[r|t|s|-] (dither, rect|tri|shaped|off, default: off)\n" +" -s soft-mode, no xrun handling (default: off)\n" +); } jack_driver_t * diff --git a/drivers/alsa/ice1712.c b/drivers/alsa/ice1712.c index 489aaa7..3bb7677 100644 --- a/drivers/alsa/ice1712.c +++ b/drivers/alsa/ice1712.c @@ -25,6 +25,7 @@ #include #include #include +#include static int ice1712_hw_monitor_toggle(jack_hardware_t *hw, int idx, int onoff) diff --git a/drivers/solaris/solaris_driver.c b/drivers/solaris/solaris_driver.c index 4aa08d5..8b6624f 100644 --- a/drivers/solaris/solaris_driver.c +++ b/drivers/solaris/solaris_driver.c @@ -117,17 +117,17 @@ solaris_driver_delete (solaris_driver_t *driver) static void solaris_usage () { - fprintf (stderr, "\ - -solaris PCM driver args: - -r sample-rate (default: 48kHz) - -p frames-per-period (default: 1024) - -n periods-per-hardware-buffer (default: 2) - -D (duplex, default: yes) - -C (capture, default: duplex) - -P (playback, default: duplex) - -z[r|t|s|-] (dither, rect|tri|shaped|off, default: off) -"); + fprintf (stderr, + +"solaris PCM driver args:\n" +" -r sample-rate (default: 48kHz)\n" +" -p frames-per-period (default: 1024)\n" +" -n periods-per-hardware-buffer (default: 2)\n" +" -D (duplex, default: yes)\n" +" -C (capture, default: duplex)\n" +" -P (playback, default: duplex)\n" +" -z[r|t|s|-] (dither, rect|tri|shaped|off, default: off)\n" +); } jack_driver_t * diff --git a/example-clients/capture_client.c b/example-clients/capture_client.c index 217c8fe..ed41aa7 100644 --- a/example-clients/capture_client.c +++ b/example-clients/capture_client.c @@ -123,7 +123,7 @@ disk_thread (void *arg) { sample_buffer_t *buf; thread_info_t *info = (thread_info_t *) arg; - int i; + unsigned int i; unsigned int chn; jack_nframes_t total_captured = 0; int done = 0; @@ -281,7 +281,7 @@ run_disk_thread (thread_info_t *info) void setup_ports (int sources, char *source_names[], thread_info_t *info) { - int i; + unsigned int i; nports = sources; diff --git a/example-clients/connect.c b/example-clients/connect.c index 0fac8aa..797f0f0 100644 --- a/example-clients/connect.c +++ b/example-clients/connect.c @@ -1,4 +1,3 @@ -#include /* Copyright (C) 2002 Jeremy Hall @@ -19,9 +18,11 @@ $Id$ */ +#include #include #include #include +#include #include diff --git a/example-clients/metro.c b/example-clients/metro.c index e0eade9..eebea08 100644 --- a/example-clients/metro.c +++ b/example-clients/metro.c @@ -237,7 +237,7 @@ main (int argc, char *argv[]) fprintf (stderr, "invalid duration (tone length = %lu, wave length = %lu\n", tone_length, wave_length); return -1; } - if (attack_length + decay_length > tone_length) { + if (attack_length + decay_length > (int)tone_length) { fprintf (stderr, "invalid attack/decay\n"); return -1; } @@ -249,16 +249,16 @@ main (int argc, char *argv[]) for (i = 0; i < attack_length; i++) { amp[i] = max_amp * i / ((double) attack_length); } - for (i = attack_length; i < tone_length - decay_length; i++) { + for (i = attack_length; i < (int)tone_length - decay_length; i++) { amp[i] = max_amp; } - for (i = tone_length - decay_length; i < tone_length; i++) { + for (i = (int)tone_length - decay_length; i < (int)tone_length; i++) { amp[i] = - max_amp * (i - (double) tone_length) / ((double) decay_length); } - for (i = 0; i < tone_length; i++) { + for (i = 0; i < (int)tone_length; i++) { wave[i] = amp[i] * sin (scale * i); } - for (i = tone_length; i < wave_length; i++) { + for (i = tone_length; i < (int)wave_length; i++) { wave[i] = 0; } diff --git a/example-clients/monitor_client.c b/example-clients/monitor_client.c index 5ef6aa0..9b4d628 100644 --- a/example-clients/monitor_client.c +++ b/example-clients/monitor_client.c @@ -1,5 +1,6 @@ #include #include +#include #include diff --git a/example-clients/showtime.c b/example-clients/showtime.c index 36e9db8..e461548 100644 --- a/example-clients/showtime.c +++ b/example-clients/showtime.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include diff --git a/example-clients/simple_client.c b/example-clients/simple_client.c index 0ebcd29..035c1e5 100644 --- a/example-clients/simple_client.c +++ b/example-clients/simple_client.c @@ -2,6 +2,7 @@ #include #include #include +#include #include diff --git a/jack/alsa_driver.h b/jack/alsa_driver.h index 2681e57..57b11ce 100644 --- a/jack/alsa_driver.h +++ b/jack/alsa_driver.h @@ -57,10 +57,10 @@ typedef struct { unsigned long interleave_unit; unsigned long capture_interleave_skip; unsigned long playback_interleave_skip; - unsigned long max_nchannels; - unsigned long user_nchannels; - unsigned long playback_nchannels; - unsigned long capture_nchannels; + channel_t max_nchannels; + channel_t user_nchannels; + channel_t playback_nchannels; + channel_t capture_nchannels; unsigned long sample_bytes; jack_nframes_t frame_rate; @@ -186,7 +186,7 @@ static __inline__ void alsa_driver_copy_channel (alsa_driver_t *driver, void alsa_driver_set_clock_sync_status (alsa_driver_t *driver, channel_t chn, ClockSyncStatus status); int alsa_driver_listen_for_clock_sync_status (alsa_driver_t *, ClockSyncListenerFunction, void *arg); -int alsa_driver_stop_listen_for_clock_sync_status (alsa_driver_t *, int); +int alsa_driver_stop_listen_for_clock_sync_status (alsa_driver_t *, unsigned int); void alsa_driver_clock_sync_notify (alsa_driver_t *, channel_t chn, ClockSyncStatus); diff --git a/jack/cycles.h b/jack/cycles.h index d0868b8..96bc4c3 100644 --- a/jack/cycles.h +++ b/jack/cycles.h @@ -22,7 +22,7 @@ #ifndef __jack_cycles_h__ #define __jack_cycles_h__ -#ifdef __i386__ +#if defined(__i386__) || defined(__x86_64__) /* * Standard way to access the cycle counter on i586+ CPUs. @@ -53,9 +53,8 @@ static inline cycles_t get_cycles (void) return ret; } -#else /* !i386 */ +#elif defined(__powerpc__) -#ifdef __powerpc__ #define CPU_FTR_601 0x00000100 typedef unsigned long cycles_t; @@ -83,9 +82,32 @@ static inline cycles_t get_cycles(void) : "=r" (ret) : "i" (CPU_FTR_601)); return ret; } -#else /* PPC */ + +#elif defined(__ia64__) +/* ia64 */ + +typedef unsigned long cycles_t; +static inline cycles_t +get_cycles (void) +{ + cycles_t ret; + __asm__ __volatile__ ("mov %0=ar.itc" : "=r"(ret)); + return ret; +} + +#elif defined(__alpha__) +/* alpha */ + +typedef unsigned int cycles_t; +static inline cycles_t get_cycles (void) +{ + cycles_t ret; + __asm__ __volatile__ ("rpcc %0" : "=r"(ret)); + return ret; +} + +#else #error You are compiling JACK on a platform for which jack/cycles.h needs work -#endif /* PPC */ -#endif /* i386 */ +#endif #endif /* __jack_cycles_h__ */ diff --git a/jack/engine.h b/jack/engine.h index 0c27644..1263a17 100644 --- a/jack/engine.h +++ b/jack/engine.h @@ -49,7 +49,7 @@ struct _jack_engine { pthread_mutex_t port_lock; int process_errors; int period_msecs; - int port_max; + unsigned int port_max; int control_shm_id; key_t control_key; key_t port_segment_key; /* XXX fix me */ diff --git a/jack/internal.h b/jack/internal.h index 4a77e23..ee74183 100644 --- a/jack/internal.h +++ b/jack/internal.h @@ -156,7 +156,7 @@ typedef enum { typedef volatile struct { - volatile int id; /* w: engine r: engine and client */ + volatile jack_client_id_t id; /* w: engine r: engine and client */ volatile jack_nframes_t nframes; /* w: engine r: client */ volatile jack_client_state_t state; /* w: engine and client r: engine */ volatile char name[JACK_CLIENT_NAME_SIZE+1]; diff --git a/jack/types.h b/jack/types.h index da1a646..c65fb35 100644 --- a/jack/types.h +++ b/jack/types.h @@ -47,7 +47,7 @@ typedef struct _jack_client jack_client_t; * Ports have unique ids. You will very rarely need to know them, however, * except in the case of the port registration callback. */ -typedef long jack_port_id_t; +typedef unsigned long jack_port_id_t; /** * Prototype for the client supplied function that is called diff --git a/jackd/engine.c b/jackd/engine.c index ec889ac..327c9c7 100644 --- a/jackd/engine.c +++ b/jackd/engine.c @@ -53,7 +53,7 @@ #define MAX_SHM_ID 256 /* likely use is more like 16 */ -#define NoPort -1 +#define NoPort (jack_port_id_t)-1 /** * Time to wait for clients in msecs. Used when jackd is @@ -98,7 +98,7 @@ static jack_client_internal_t *jack_client_internal_by_id (jack_engine_t *engine static void jack_sort_graph (jack_engine_t *engine); static int jack_rechain_graph (jack_engine_t *engine); -static int jack_get_fifo_fd (jack_engine_t *engine, int which_fifo); +static int jack_get_fifo_fd (jack_engine_t *engine, unsigned int which_fifo); static void jack_clear_fifos (jack_engine_t *engine); static int jack_port_do_connect (jack_engine_t *engine, const char *source_port, const char *destination_port); @@ -336,7 +336,7 @@ jack_add_port_segment (jack_engine_t *engine, unsigned long nports) key_t key; int id; char *addr; - int offset; + size_t offset; size_t size; size_t step; @@ -757,7 +757,7 @@ handle_new_client (jack_engine_t *engine, int client_fd) } if (engine->verbose) { - fprintf (stderr, "new client: %s, id = %d type %d @ %p fd = %d\n", + fprintf (stderr, "new client: %s, id = %ld type %d @ %p fd = %d\n", client->control->name, client->control->id, req.type, client->control, client_fd); } @@ -1152,7 +1152,7 @@ handle_client_request (jack_engine_t *engine, int fd) return -1; } - if (read (client->request_fd, &req, sizeof (req)) < sizeof (req)) { + if (read (client->request_fd, &req, sizeof (req)) < (ssize_t) sizeof (req)) { jack_error ("cannot read request from client"); client->error++; return -1; @@ -1231,7 +1231,7 @@ handle_client_request (jack_engine_t *engine, int fd) if (reply_fd >= 0) { DEBUG ("replying to client"); - if (write (reply_fd, &req, sizeof (req)) < sizeof (req)) { + if (write (reply_fd, &req, sizeof (req)) < (ssize_t) sizeof (req)) { jack_error ("cannot write request result to client"); return -1; } @@ -1360,7 +1360,7 @@ jack_engine_new (int realtime, int rtpriority, int verbose) jack_engine_t *engine; size_t control_size; void *addr; - int i; + unsigned int i; #ifdef USE_CAPABILITIES uid_t uid = getuid (); uid_t euid = geteuid (); @@ -1930,7 +1930,7 @@ static void jack_remove_client (jack_engine_t *engine, jack_client_internal_t *client) { JSList *node; - int i; + unsigned int i; if (engine->verbose) { fprintf (stderr, "adios senor %s\n", client->control->name); @@ -2446,7 +2446,7 @@ static void jack_compute_all_port_total_latencies (jack_engine_t *engine) { jack_port_shared_t *shared = engine->control->ports; - int i; + unsigned int i; int toward_port; for (i = 0; i < engine->control->port_max; i++) { @@ -2774,7 +2774,7 @@ jack_port_do_disconnect (jack_engine_t *engine, } static int -jack_get_fifo_fd (jack_engine_t *engine, int which_fifo) +jack_get_fifo_fd (jack_engine_t *engine, unsigned int which_fifo) { /* caller must hold client_lock */ @@ -2804,7 +2804,7 @@ jack_get_fifo_fd (jack_engine_t *engine, int which_fifo) } if (which_fifo >= engine->fifo_size) { - int i; + unsigned int i; engine->fifo = (int *) realloc (engine->fifo, sizeof (int) * engine->fifo_size + 16); for (i = engine->fifo_size; i < engine->fifo_size + 16; i++) { @@ -2829,7 +2829,7 @@ jack_clear_fifos (jack_engine_t *engine) { /* caller must hold client_lock */ - int i; + unsigned int i; char buf[16]; /* this just drains the existing FIFO's of any data left in them @@ -3043,7 +3043,7 @@ jack_do_get_port_connections (jack_engine_t *engine, jack_request_t *req, int re req->x.nports = jack_slist_length (port->connections); - if (write (reply_fd, req, sizeof (*req)) < sizeof (req)) { + if (write (reply_fd, req, sizeof (*req)) < (ssize_t) sizeof (req)) { jack_error ("cannot write GetPortConnections result to client"); goto out; } @@ -3062,7 +3062,7 @@ jack_do_get_port_connections (jack_engine_t *engine, jack_request_t *req, int re port_id = ((jack_connection_internal_t *) node->data)->source->shared->id; } - if (write (reply_fd, &port_id, sizeof (port_id)) < sizeof (port_id)) { + if (write (reply_fd, &port_id, sizeof (port_id)) < (ssize_t) sizeof (port_id)) { jack_error ("cannot write port id to client"); goto out; } diff --git a/libjack/client.c b/libjack/client.c index 4db80ba..6f30c34 100644 --- a/libjack/client.c +++ b/libjack/client.c @@ -1974,7 +1974,7 @@ jack_port_get_all_connections (const jack_client_t *client, const jack_port_t *p { const char **ret; jack_request_t req; - int i; + unsigned int i; req.type = GetPortConnections; diff --git a/libjack/timestamps.c b/libjack/timestamps.c index d7fefb8..af6c994 100644 --- a/libjack/timestamps.c +++ b/libjack/timestamps.c @@ -19,6 +19,7 @@ */ #include +#include #include #include #include