diff --git a/configure.in b/configure.in index 8caf21e..3e5e843 100644 --- a/configure.in +++ b/configure.in @@ -13,8 +13,8 @@ dnl micro version = incremented when implementation-only dnl changes are made dnl --- JACK_MAJOR_VERSION=0 -JACK_MINOR_VERSION=79 -JACK_MICRO_VERSION=3 +JACK_MINOR_VERSION=80 +JACK_MICRO_VERSION=0 dnl --- dnl HOWTO: updating the jack protocal version @@ -41,7 +41,7 @@ dnl slacker than this, and closer to those for the JACK version dnl number. dnl --- JACK_API_CURRENT=0 -JACK_API_REVISION=21 +JACK_API_REVISION=22 JACK_API_AGE=0 AC_SUBST(JACK_MAJOR_VERSION) diff --git a/drivers/alsa/alsa_driver.c b/drivers/alsa/alsa_driver.c index 7359dbd..14a7c26 100644 --- a/drivers/alsa/alsa_driver.c +++ b/drivers/alsa/alsa_driver.c @@ -299,8 +299,12 @@ alsa_driver_configure_stream (alsa_driver_t *driver, char *device_name, } } - if ((err = snd_pcm_hw_params_set_rate_near (handle, hw_params, driver->frame_rate, 0)) < 0) { - jack_error ("ALSA: cannot set sample/frame rate to %u for %s", driver->frame_rate, stream_name); + if ((err = snd_pcm_hw_params_set_rate_near (handle, hw_params, + driver->frame_rate, 0)) + < 0) { + jack_error ("ALSA: cannot set sample/frame rate to %" + PRIu32 " for %s", driver->frame_rate, + stream_name); return -1; } @@ -327,8 +331,13 @@ alsa_driver_configure_stream (alsa_driver_t *driver, char *device_name, return -1; } - if ((err = snd_pcm_hw_params_set_period_size (handle, hw_params, driver->frames_per_cycle, 0)) < 0) { - jack_error ("ALSA: cannot set period size to %u frames for %s", driver->frames_per_cycle, stream_name); + if ((err = snd_pcm_hw_params_set_period_size (handle, hw_params, + driver->frames_per_cycle, + 0)) + < 0) { + jack_error ("ALSA: cannot set period size to %" PRIu32 + " frames for %s", driver->frames_per_cycle, + stream_name); return -1; } @@ -338,7 +347,10 @@ alsa_driver_configure_stream (alsa_driver_t *driver, char *device_name, } if ((err = snd_pcm_hw_params_set_buffer_size (handle, hw_params, driver->user_nperiods * driver->frames_per_cycle)) < 0) { - jack_error ("ALSA: cannot set buffer length to %u for %s", driver->user_nperiods * driver->frames_per_cycle, stream_name); + jack_error ("ALSA: cannot set buffer length to %" PRIu32 + " for %s", + driver->user_nperiods * driver->frames_per_cycle, + stream_name); return -1; } @@ -435,8 +447,10 @@ alsa_driver_set_parameters (alsa_driver_t *driver, jack_nframes_t frames_per_cyc driver->playback_interleaved = (snd_pcm_hw_params_get_access (driver->playback_hw_params) == SND_PCM_ACCESS_MMAP_INTERLEAVED); if (p_period_size != driver->frames_per_cycle) { - jack_error ("alsa_pcm: requested an interrupt every %u frames but got %uc frames for playback", - driver->frames_per_cycle,p_period_size); + jack_error ("alsa_pcm: requested an interrupt every %" + PRIu32 + " frames but got %u frames for playback", + driver->frames_per_cycle, p_period_size); return -1; } } @@ -448,8 +462,10 @@ alsa_driver_set_parameters (alsa_driver_t *driver, jack_nframes_t frames_per_cyc driver->capture_interleaved = (snd_pcm_hw_params_get_access (driver->capture_hw_params) == SND_PCM_ACCESS_MMAP_INTERLEAVED); if (c_period_size != driver->frames_per_cycle) { - jack_error ("alsa_pcm: requested an interrupt every %u frames but got %uc frames for capture", - driver->frames_per_cycle,p_period_size); + jack_error ("alsa_pcm: requested an interrupt every %" + PRIu32 + " frames but got %uc frames for capture", + driver->frames_per_cycle, p_period_size); return -1; } } @@ -1150,7 +1166,8 @@ alsa_driver_read (alsa_driver_t *driver, jack_nframes_t nframes) } if (snd_pcm_mmap_commit (driver->capture_handle, offset, contiguous) < 0) { - jack_error ("alsa_pcm: could not complete read of %lu frames\n", contiguous); + jack_error ("alsa_pcm: could not complete read of %" + PRIu32 " frames\n", contiguous); return -1; } @@ -1225,8 +1242,12 @@ alsa_driver_write (alsa_driver_t* driver, jack_nframes_t nframes) alsa_driver_silence_untouched_channels (driver, contiguous); } - if ((err = snd_pcm_mmap_commit (driver->playback_handle, offset, contiguous)) < 0) { - jack_error ("could not complete playback of %lu frames: error = %d", contiguous, err); + if ((err = snd_pcm_mmap_commit (driver->playback_handle, + offset, contiguous)) + < 0) { + jack_error ("could not complete playback of %" + PRIu32 " frames: error = %d", + contiguous, err); if (err != -EPIPE && err != -ESTRPIPE) return -1; } @@ -1469,9 +1490,12 @@ alsa_driver_new (char *name, char *playback_alsa_device, char *capture_alsa_devi alsa_driver_t *driver; - printf ("creating alsa driver ... %s|%s|%lu|%lu|%lu|%s|%s|%s\n", - playback_alsa_device, capture_alsa_device, frames_per_cycle, user_nperiods, rate, - hw_monitoring ? "hwmon":"nomon", hw_metering ? "hwmeter":"swmeter", soft_mode ? "soft-mode":"rt"); + printf ("creating alsa driver ... %s|%s|%" PRIu32 "|%" PRIu32 + "|%" PRIu32 "|%s|%s|%s\n", playback_alsa_device, + capture_alsa_device, frames_per_cycle, user_nperiods, rate, + hw_monitoring ? "hwmon": "nomon", + hw_metering ? "hwmeter":"swmeter", + soft_mode ? "soft-mode":"rt"); driver = (alsa_driver_t *) calloc (1, sizeof (alsa_driver_t)); diff --git a/drivers/alsa/hammerfall.c b/drivers/alsa/hammerfall.c index b066140..680dcd8 100644 --- a/drivers/alsa/hammerfall.c +++ b/drivers/alsa/hammerfall.c @@ -23,6 +23,10 @@ #include #include +/* Set this to 1 if you want this compile error: + * warning: `hammerfall_monitor_controls' defined but not used */ +#define HAMMERFALL_MONITOR_CONTROLS 0 + static void set_control_id (snd_ctl_elem_id_t *ctl, const char *name) { @@ -34,6 +38,7 @@ set_control_id (snd_ctl_elem_id_t *ctl, const char *name) snd_ctl_elem_id_set_index (ctl, 0); } +#if HAMMERFALL_MONITOR_CONTROLS static void hammerfall_broadcast_channel_status_change (hammerfall_t *h, int lock, int sync, channel_t lowchn, channel_t highchn) @@ -125,6 +130,7 @@ hammerfall_check_sync (hammerfall_t *h, snd_ctl_elem_value_t *ctl) jack_error ("Hammerfall: unknown control \"%s\"", name); } } +#endif /* HAMMERFALL_MONITOR_CONTROLS */ static int hammerfall_set_input_monitor_mask (jack_hardware_t *hw, unsigned long mask) @@ -203,6 +209,7 @@ hammerfall_release (jack_hardware_t *hw) free (h); } +#if HAMMERFALL_MONITOR_CONTROLS static void * hammerfall_monitor_controls (void *arg) { @@ -252,6 +259,7 @@ hammerfall_monitor_controls (void *arg) pthread_exit (0); } +#endif /* HAMMERFALL_MONITOR_CONTROLS */ jack_hardware_t * jack_alsa_hammerfall_hw_new (alsa_driver_t *driver) diff --git a/drivers/dummy/dummy_driver.c b/drivers/dummy/dummy_driver.c index 82e19f7..de94479 100644 --- a/drivers/dummy/dummy_driver.c +++ b/drivers/dummy/dummy_driver.c @@ -181,8 +181,8 @@ dummy_driver_new (jack_client_t * client, { dummy_driver_t * driver; - printf ("creating dummy driver ... %s|%lu|%lu|%lu|%u|%u\n", - name, sample_rate, period_size, wait_time, + printf ("creating dummy driver ... %s|%" PRIu32 "|%" PRIu32 + "|%lu|%u|%u\n", name, sample_rate, period_size, wait_time, capture_ports, playback_ports); driver = (dummy_driver_t *) calloc (1, sizeof (dummy_driver_t)); diff --git a/drivers/portaudio/portaudio_driver.c b/drivers/portaudio/portaudio_driver.c index d543477..cbd5048 100644 --- a/drivers/portaudio/portaudio_driver.c +++ b/drivers/portaudio/portaudio_driver.c @@ -231,7 +231,8 @@ portaudio_driver_new (char *name, int numDevices; int i,j; - printf ("creating portaudio driver ... %lu|%lu|%lu\n", frames_per_cycle, rate); + printf ("creating portaudio driver ... %" PRIu32 "|%" + PRIu32 "\n", frames_per_cycle, rate); driver = (portaudio_driver_t *) calloc (1, sizeof (portaudio_driver_t)); diff --git a/example-clients/capture_client.c b/example-clients/capture_client.c index 16f7126..2c5813b 100644 --- a/example-clients/capture_client.c +++ b/example-clients/capture_client.c @@ -203,8 +203,8 @@ run_disk_thread (thread_info_t *info) if (overruns > 0) { fprintf (stderr, "jackrec failed with %ld overruns.\n", overruns); - fprintf (stderr, " try a bigger buffer than -B %ld.\n", - info->rb_size); + fprintf (stderr, " try a bigger buffer than -B %" + PRIu32 ".\n", info->rb_size); info->status = EPIPE; } if (info->status) { diff --git a/example-clients/connect.c b/example-clients/connect.c index 797f0f0..9b10820 100644 --- a/example-clients/connect.c +++ b/example-clients/connect.c @@ -74,7 +74,8 @@ main (int argc, char *argv[]) callback (see above) for this value. */ - printf ("engine sample rate: %lu\n", jack_get_sample_rate (client)); + printf ("engine sample rate: %" PRIu32 "\n", + jack_get_sample_rate (client)); /* find the two ports */ diff --git a/example-clients/impulse_grabber.c b/example-clients/impulse_grabber.c index c7123b8..2eac2a1 100644 --- a/example-clients/impulse_grabber.c +++ b/example-clients/impulse_grabber.c @@ -149,9 +149,11 @@ main (int argc, char *argv[]) */ fs = jack_get_sample_rate(client); - response_duration = (int)(fs * duration); + response_duration = (unsigned long) (fs * duration); response = malloc(response_duration * sizeof(float)); - fprintf(stderr, "Grabbing %f seconds (%lu samples) of impulse response\n", duration, response_duration); + fprintf(stderr, + "Grabbing %f seconds (%lu samples) of impulse response\n", + duration, response_duration); /* create two ports */ diff --git a/example-clients/intime.c b/example-clients/intime.c index 7201ca6..f697a81 100644 --- a/example-clients/intime.c +++ b/example-clients/intime.c @@ -29,15 +29,24 @@ /* timebase callback + * + * It would probably be faster to compute frame_time without the + * conditional expression. But, it demonstrates the invariant: + * next_time[i] == frame_time[i+1], unless a reposition occurs. * * Runs in the process thread. Realtime, must not wait. */ void timebase(jack_transport_state_t state, jack_nframes_t nframes, jack_position_t *pos, int new_pos, void *arg) { + /* nominal transport speed */ + double seconds_per_frame = 1.0 / (double) pos->frame_rate; + pos->valid = JackPositionTimecode; - pos->frame_time = pos->frame / (double) pos->frame_rate; - pos->period_duration = nframes / (double) pos->frame_rate; + pos->frame_time = (new_pos? + pos->frame * seconds_per_frame: + pos->next_time); + pos->next_time = (pos->frame + nframes) * seconds_per_frame; } /* after internal client loaded */ diff --git a/example-clients/lsp.c b/example-clients/lsp.c index f7c6652..26529a8 100644 --- a/example-clients/lsp.c +++ b/example-clients/lsp.c @@ -109,7 +109,8 @@ main (int argc, char *argv[]) if (show_latency) { jack_port_t *port = jack_port_by_name (client, ports[i]); if (port) { - printf (" latency = %lu frames\n", jack_port_get_total_latency (client, port)); + printf (" latency = %" PRIu32 " frames\n", + jack_port_get_total_latency (client, port)); free (port); } } diff --git a/example-clients/metro.c b/example-clients/metro.c index e61b73a..c801b04 100644 --- a/example-clients/metro.c +++ b/example-clients/metro.c @@ -228,7 +228,9 @@ main (int argc, char *argv[]) scale = 2 * PI * freq / sr; if (tone_length >= wave_length) { - fprintf (stderr, "invalid duration (tone length = %lu, wave length = %lu\n", tone_length, wave_length); + fprintf (stderr, "invalid duration (tone length = %" PRIu32 + ", wave length = %" PRIu32 "\n", tone_length, + wave_length); return -1; } if (attack_length + decay_length > (int)tone_length) { diff --git a/example-clients/showtime.c b/example-clients/showtime.c index 2ce5b31..d175ab1 100644 --- a/example-clients/showtime.c +++ b/example-clients/showtime.c @@ -18,7 +18,7 @@ showtime () transport_state = jack_transport_query (client, ¤t); - printf ("frame: %7lu\t", current.frame); + printf ("frame: %7" PRIu32 "\t", current.frame); switch (transport_state) { case JackTransportStopped: @@ -35,12 +35,12 @@ showtime () } if (current.valid & JackPositionBBT) - printf ("\tBBT: %3d|%d|%04d", - current.bar, current.beat, current.tick); + printf ("\tBBT: %3" PRIi32 "|%" PRIi32 "|%04" + PRIi32, current.bar, current.beat, current.tick); if (current.valid & JackPositionTimecode) - printf ("\tTC: %.6f, %.6f", - current.frame_time, current.period_duration); + printf ("\tTC: (%.6f, %.6f)", + current.frame_time, current.next_time); printf ("\n"); } diff --git a/example-clients/simple_client.c b/example-clients/simple_client.c index 79a5308..2bba4f6 100644 --- a/example-clients/simple_client.c +++ b/example-clients/simple_client.c @@ -25,7 +25,7 @@ int srate (jack_nframes_t nframes, void *arg) { - printf ("the sample rate is now %lu/sec\n", nframes); + printf ("the sample rate is now %" PRIu32 "/sec\n", nframes); return 0; } @@ -93,7 +93,8 @@ main (int argc, char *argv[]) callback (see above) for this value. */ - printf ("engine sample rate: %lu\n", jack_get_sample_rate (client)); + printf ("engine sample rate: %" PRIu32 "\n", + jack_get_sample_rate (client)); /* create two ports */ diff --git a/example-clients/transport.c b/example-clients/transport.c index ad36a89..a528b68 100644 --- a/example-clients/transport.c +++ b/example-clients/transport.c @@ -82,7 +82,8 @@ void timebase(jack_transport_state_t state, jack_nframes_t nframes, #if 0 /* some debug code... */ - fprintf(stderr, "\nnew position: %lu\tBBT: %3d|%d|%04d\n", + fprintf(stderr, "\nnew position: %" PRIu32 "\tBBT: %3" + PRIi32 "|%" PRIi32 "|%04" PRIi32 "\n", pos->frame, pos->bar, pos->beat, pos->tick); #endif diff --git a/jack/internal.h b/jack/internal.h index de041a0..1cd8d3d 100644 --- a/jack/internal.h +++ b/jack/internal.h @@ -46,7 +46,7 @@ #ifdef DEBUG_ENABLED #define DEBUG(format,args...) \ - printf ("jack:%5d:%Lu %s:%s:%d: " format "\n", getpid(), jack_get_microseconds(), __FILE__, __FUNCTION__, __LINE__ , ## args) + printf ("jack:%5d:%" PRIu64 " %s:%s:%d: " format "\n", getpid(), jack_get_microseconds(), __FILE__, __FUNCTION__, __LINE__ , ## args) #else #if defined(__APPLE__) && defined(__POWERPC__) #define DEBUG(format...) @@ -70,7 +70,7 @@ typedef void * dlhandle; typedef struct { const char *shm_name; - size_t offset; + size_t offset; /* JOQ: 32/64 problem? */ } jack_port_buffer_info_t; typedef enum { @@ -103,26 +103,26 @@ typedef struct { jack_position_t pending_time; /* position for next cycle */ jack_position_t request_time; /* latest requested position */ jack_unique_t prev_request; /* previous request unique ID */ - volatile long seq_number; /* unique ID sequence number */ - char new_pos; /* new position this cycle */ - char pending_pos; /* new position request pending */ + volatile uint32_t seq_number; /* unique ID sequence number */ + int8_t new_pos; /* new position this cycle */ + int8_t pending_pos; /* new position request pending */ jack_nframes_t pending_frame; /* pending frame number */ - unsigned long sync_clients; /* number of is_slowsync clients */ - unsigned long sync_remain; /* number of them with sync_poll */ + uint32_t sync_clients; /* number of is_slowsync clients */ + uint32_t sync_remain; /* number of them with sync_poll */ jack_time_t sync_timeout; jack_time_t sync_time_left; jack_frame_timer_t frame_timer; - int internal; + int32_t internal; jack_nframes_t frames_at_cycle_start; pid_t engine_pid; - unsigned long buffer_size; - char real_time; - int client_priority; - int has_capabilities; + uint32_t buffer_size; + int8_t real_time; + int32_t client_priority; + int32_t has_capabilities; float cpu_load; - unsigned long port_max; - int engine_ok; - unsigned long n_port_types; + uint32_t port_max; + int32_t engine_ok; + uint32_t n_port_types; jack_port_type_info_t port_types[JACK_MAX_PORT_TYPES]; jack_port_shared_t ports[0]; @@ -143,18 +143,18 @@ typedef enum { typedef struct { EventType type; union { - unsigned long n; + uint32_t n; jack_port_id_t port_id; jack_port_id_t self_id; shm_name_t shm_name; } x; union { - unsigned long n; + uint32_t n; jack_port_id_t other_id; - void* addr; + void* addr; /* JOQ: 32/64 problem? */ } y; union { - size_t size; + size_t size; /* JOQ: 32/64 problem? */ } z; } jack_event_t; @@ -177,22 +177,24 @@ typedef volatile struct { 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]; + volatile int8_t name[JACK_CLIENT_NAME_SIZE+1]; volatile ClientType type; /* w: engine r: engine and client */ - volatile char active : 1; /* w: engine r: engine and client */ - volatile char dead : 1; /* r/w: engine */ - volatile char timed_out : 1; /* r/w: engine */ - volatile char is_timebase : 1; /* w: engine, r: engine and client */ - volatile char is_slowsync : 1; /* w: engine, r: engine and client */ - volatile char sync_poll : 1; /* w: engine and client, r: engine */ - volatile char sync_new : 1; /* w: engine and client, r: engine */ + volatile int8_t active : 1; /* w: engine r: engine and client */ + volatile int8_t dead : 1; /* r/w: engine */ + volatile int8_t timed_out : 1; /* r/w: engine */ + volatile int8_t is_timebase : 1; /* w: engine, r: engine and client */ + volatile int8_t is_slowsync : 1; /* w: engine, r: engine and client */ + volatile int8_t sync_poll : 1; /* w: engine and client, r: engine */ + volatile int8_t sync_new : 1; /* w: engine and client, r: engine */ volatile pid_t pid; /* w: client r: engine; client pid */ - volatile unsigned long long signalled_at; - volatile unsigned long long awake_at; - volatile unsigned long long finished_at; + volatile uint64_t signalled_at; + volatile uint64_t awake_at; + volatile uint64_t finished_at; + + /* JOQ: all these pointers are trouble for 32/64 compatibility, + * they should move to non-shared memory. */ /* callbacks */ - JackProcessCallback process; void *process_arg; JackBufferSizeCallback bufsize; @@ -222,7 +224,7 @@ typedef volatile struct { typedef struct { - int load; + int32_t load; ClientType type; char name[JACK_CLIENT_NAME_SIZE+1]; @@ -233,17 +235,17 @@ typedef struct { typedef struct { - int status; + int32_t status; - unsigned int protocol_v; + uint32_t protocol_v; - shm_name_t client_shm_name; - shm_name_t control_shm_name; + shm_name_t client_shm_name; + shm_name_t control_shm_name; - char fifo_prefix[PATH_MAX+1]; + int8_t fifo_prefix[PATH_MAX+1]; - int realtime; - int realtime_priority; + int32_t realtime; + int32_t realtime_priority; /* these two are valid only if the connect request was for type == ClientDriver. @@ -251,17 +253,17 @@ typedef struct { jack_client_control_t *client_control; jack_control_t *engine_control; - size_t control_size; + size_t control_size; /* JOQ: 32/64 problem? */ /* when we write this response, we deliver n_port_types of jack_port_type_info_t after it. */ - unsigned long n_port_types; + uint32_t n_port_types; #if defined(__APPLE__) && defined(__POWERPC__) - /* specific ressources for server/client real-time thread communication */ - int portnum; + /* specific resources for server/client real-time thread communication */ + int32_t portnum; #endif } jack_client_connect_result_t; @@ -271,7 +273,7 @@ typedef struct { } jack_client_connect_ack_request_t; typedef struct { - char status; + int8_t status; } jack_client_connect_ack_result_t; typedef enum { @@ -299,8 +301,8 @@ struct _jack_request { struct { char name[JACK_PORT_NAME_SIZE+1]; char type[JACK_PORT_TYPE_SIZE+1]; - unsigned long flags; - unsigned long buffer_size; + uint32_t flags; + uint32_t buffer_size; jack_port_id_t port_id; jack_client_id_t client_id; } port_info; @@ -309,20 +311,22 @@ struct _jack_request { char destination_port[JACK_PORT_NAME_SIZE+1]; } connect; struct { - unsigned int nports; - const char **ports; + int32_t nports; + const char **ports; /* JOQ: 32/64 problem? */ } port_connections; struct { jack_client_id_t client_id; - int conditional; + int32_t conditional; } timebase; jack_client_id_t client_id; jack_nframes_t nframes; jack_time_t timeout; } x; - int status; + int32_t status; }; +/* per-client structure allocated in the server's address space + * JOQ: then why isn't this in engine.h? */ typedef struct _jack_client_internal { jack_client_control_t *control; @@ -337,12 +341,12 @@ typedef struct _jack_client_internal { unsigned long execution_order; struct _jack_client_internal *next_client; /* not a linked list! */ dlhandle handle; - int (*initialize)(jack_client_t*, const char*); /* for internal clients only */ - void (*finish)(void *); /* for internal clients only */ + int (*initialize)(jack_client_t*, const char*); /* int. clients only */ + void (*finish)(void *); /* internal clients only */ int error; #if defined(__APPLE__) && defined(__POWERPC__) - /* specific ressources for server/client real-time thread communication */ + /* specific resources for server/client real-time thread communication */ mach_port_t serverport; trivial_message message; int running; @@ -353,14 +357,17 @@ typedef struct _jack_client_internal { extern void jack_cleanup_files (); -extern int jack_client_handle_port_connection (jack_client_t *client, jack_event_t *event); -extern void jack_client_handle_new_port_type (jack_client_t *client, shm_name_t, size_t, void* addr); +extern int jack_client_handle_port_connection (jack_client_t *client, + jack_event_t *event); +extern void jack_client_handle_new_port_type (jack_client_t *client, + shm_name_t, size_t, void* addr); -extern jack_client_t *jack_driver_client_new (jack_engine_t *, const char *client_name); -jack_client_t *jack_client_alloc_internal (jack_client_control_t*, jack_control_t*); - -/* internal clients call this. its defined in jack/engine.c */ +extern jack_client_t *jack_driver_client_new (jack_engine_t *, + const char *client_name); +jack_client_t *jack_client_alloc_internal (jack_client_control_t*, + jack_control_t*); +/* internal clients call this. it's defined in jack/engine.c */ void handle_internal_client_request (jack_control_t*, jack_request_t*); extern char *jack_server_dir; @@ -373,7 +380,6 @@ extern void jack_client_invalidate_port_buffers (jack_client_t *client); extern void jack_transport_copy_position (jack_position_t *from, jack_position_t *to); - extern void jack_call_sync_client (jack_client_t *client); extern void jack_call_timebase_master (jack_client_t *client); diff --git a/jack/jack.h b/jack/jack.h index 4a4f2fb..043a228 100644 --- a/jack/jack.h +++ b/jack/jack.h @@ -494,7 +494,7 @@ int jack_port_disconnect (jack_client_t *, jack_port_t *); * This returns the sample rate of the jack system, as set by the user when * jackd was started. */ -unsigned long jack_get_sample_rate (jack_client_t *); +jack_nframes_t jack_get_sample_rate (jack_client_t *); /** * This returns the current maximum size that will diff --git a/jack/port.h b/jack/port.h index 8c4bde4..ef0c0ba 100644 --- a/jack/port.h +++ b/jack/port.h @@ -30,7 +30,7 @@ /* these should probably go somewhere else */ #define JACK_CLIENT_NAME_SIZE 32 -typedef unsigned long jack_client_id_t; +typedef uint32_t jack_client_id_t; typedef struct { shm_name_t shm_name; @@ -40,7 +40,7 @@ typedef struct { typedef struct _jack_port_type_info { - unsigned long type_id; + uint32_t type_id; const char type_name[JACK_PORT_TYPE_SIZE]; void (*mixdown)(jack_port_t *, jack_nframes_t); /* function to mixdown multiple inputs to a buffer. can be @@ -60,7 +60,7 @@ typedef struct _jack_port_type_info { the return value is normalized to a [0..1] range. */ - long buffer_scale_factor; /* If == 1, then a buffer to handle nframes worth of + int32_t buffer_scale_factor; /* If == 1, then a buffer to handle nframes worth of data is sizeof(jack_default_audio_sample_t) * nframes bytes large. If anything other than 1, the buffer allocated @@ -94,13 +94,13 @@ typedef struct _jack_port_shared { // start of the port's type-specific shared // memory region. jack_port_id_t id; // index into engine port array for this port - unsigned long flags; + uint32_t flags; char name[JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE+2]; jack_client_id_t client_id; // who owns me volatile jack_nframes_t latency; volatile jack_nframes_t total_latency; - volatile unsigned char monitor_requests; + volatile uint8_t monitor_requests; char in_use : 1; char locked : 1; diff --git a/jack/transport.h b/jack/transport.h index 9bb4b67..a3c1d71 100644 --- a/jack/transport.h +++ b/jack/transport.h @@ -41,7 +41,7 @@ typedef enum { } jack_transport_state_t; -typedef unsigned long long jack_unique_t; /**< Unique ID (opaque) */ +typedef uint64_t jack_unique_t; /**< Unique ID (opaque) */ /** * Optional struct jack_position_t fields. @@ -71,24 +71,25 @@ typedef struct { jack_position_bits_t valid; /**< which other fields are valid */ /* JackPositionBBT fields: */ - int bar; /**< current bar */ - int beat; /**< current beat-within-bar */ - int tick; /**< current tick-within-beat */ - double bar_start_tick; + int32_t bar; /**< current bar */ + int32_t beat; /**< current beat-within-bar */ + int32_t tick; /**< current tick-within-beat */ + double bar_start_tick; - float beats_per_bar; - float beat_type; - double ticks_per_beat; - double beats_per_minute; + float beats_per_bar; + float beat_type; + double ticks_per_beat; + double beats_per_minute; - /* JackPositionTimecode fields: */ - double frame_time; /**< current time in seconds */ - double period_duration; /**< period duration (sec) */ + /* JackPositionTimecode fields: (EXPERIMENTAL: could change) */ + double frame_time; /**< current time in seconds */ + double next_time; /**< next sequential frame_time + (unless repositioned) */ /* For binary compatibility, new fields should be allocated from * this padding area with new valid bits controlling access, so * the existing structure size and offsets are preserved. */ - int padding[10]; + int32_t padding[10]; /* When (unique_1 == unique_2) the contents are consistent. */ jack_unique_t unique_2; /**< unique ID */ diff --git a/jack/types.h b/jack/types.h index 1feba11..fcc354d 100644 --- a/jack/types.h +++ b/jack/types.h @@ -21,38 +21,43 @@ #ifndef __jack_types_h__ #define __jack_types_h__ -#include /* ULONG_MAX */ +#include typedef char shm_name_t[32]; /** * Type used to represent sample frame counts. */ -typedef unsigned long jack_nframes_t; +typedef uint32_t jack_nframes_t; /** * Maximum value that can be stored in jack_nframes_t */ -#define JACK_MAX_FRAMES ULONG_MAX; +#define JACK_MAX_FRAMES UINT32_MAX; /** * Type used to represent the value of free running * monotonic clock with units of microseconds. */ +/* JOQ: this is trouble. APPLE POWERPC should use a compatible + * typedef, explicitly converting from double, if necessary. + * Otherwise applications cannot safely print a jack_time_t. */ #if defined(__APPLE__) && defined(__POWERPC__) typedef double jack_time_t; #else -typedef unsigned long long jack_time_t; +typedef uint64_t jack_time_t; #endif /** - * jack_port_t is an opaque type. You may only access it using the API provided. + * jack_port_t is an opaque type. You may only access it using the + * API provided. */ typedef struct _jack_port jack_port_t; /** - * jack_client_t is an opaque type. You may only access it using the API provided. + * jack_client_t is an opaque type. You may only access it using the + * API provided. */ typedef struct _jack_client jack_client_t; @@ -60,7 +65,7 @@ typedef struct _jack_client jack_client_t; * Ports have unique ids. A port registration callback is the only * place you ever need to know their value. */ -typedef unsigned long jack_port_id_t; +typedef uint32_t jack_port_id_t; /** * Prototype for the client supplied function that is called diff --git a/jackd/engine.c b/jackd/engine.c index 00b78f4..fdb3f60 100644 --- a/jackd/engine.c +++ b/jackd/engine.c @@ -506,8 +506,11 @@ jack_process_external(jack_engine_t *engine, JSList *node) if (status != 0) { if (engine->verbose) { - fprintf (stderr, "at %Lu client waiting on %d took %Lu usecs, status = %d sig = %Lu " - "awa = %Lu fin = %Lu dur=%Lu\n", + fprintf (stderr, "at %" PRIu64 + " client waiting on %d took %" PRIu64 + " usecs, status = %d sig = %" PRIu64 + " awa = %" PRIu64 " fin = %" PRIu64 + " dur=%" PRIu64 "\n", now, client->subgraph_wait_fd, now - then, @@ -710,7 +713,9 @@ jack_engine_post_process (jack_engine_t *engine) if (!jack_client_is_internal (client) && ctl->process) { if (ctl->awake_at != 0 && ctl->state > NotTriggered && ctl->state != Finished && ctl->timed_out++) { - fprintf (stderr, "client %s error: awake_at = %Lu state = %d timed_out = %d\n", + fprintf (stderr, "client %s error: awake_at = %" + PRIu64 + " state = %d timed_out = %d\n", ctl->name, ctl->awake_at, ctl->state, @@ -802,7 +807,8 @@ setup_client (jack_engine_t *engine, int client_fd, jack_client_connect_request_ } if (engine->verbose) { - fprintf (stderr, "new client: %s, id = %ld type %d @ %p fd = %d\n", + fprintf (stderr, "new client: %s, id = %" PRIu32 + " type %d @ %p fd = %d\n", client->control->name, client->control->id, req->type, client->control, client_fd); } @@ -3130,7 +3136,8 @@ jack_port_do_disconnect_all (jack_engine_t *engine, jack_port_id_t port_id) { if (port_id >= engine->control->port_max) { - jack_error ("illegal port ID in attempted disconnection [%u]", port_id); + jack_error ("illegal port ID in attempted disconnection [%" + PRIu32 "]", port_id); return -1; } @@ -3413,14 +3420,17 @@ jack_port_do_unregister (jack_engine_t *engine, jack_request_t *req) jack_port_internal_t *port; if (req->x.port_info.port_id < 0 || req->x.port_info.port_id > engine->port_max) { - jack_error ("invalid port ID %d in unregister request", req->x.port_info.port_id); + jack_error ("invalid port ID %" PRIu32 + " in unregister request", req->x.port_info.port_id); return -1; } shared = &engine->control->ports[req->x.port_info.port_id]; if (shared->client_id != req->x.port_info.client_id) { - jack_error ("Client %d is not allowed to remove port %s", req->x.port_info.client_id, shared->name); + jack_error ("Client %" PRIu32 + " is not allowed to remove port %s", + req->x.port_info.client_id, shared->name); return -1; } @@ -3606,7 +3616,8 @@ jack_send_connection_notification (jack_engine_t *engine, jack_client_id_t clien jack_event_t event; if ((client = jack_client_internal_by_id (engine, client_id)) == NULL) { - jack_error ("no such client %d during connection notification", client_id); + jack_error ("no such client %" PRIu32 + " during connection notification", client_id); return -1; } diff --git a/jackd/transengine.c b/jackd/transengine.c index c8559a1..d2497a9 100644 --- a/jackd/transengine.c +++ b/jackd/transengine.c @@ -50,7 +50,7 @@ jack_sync_poll_new (jack_engine_t *engine, jack_client_internal_t *client) engine->control->transport_state = JackTransportStarting; VERBOSE (engine, "force transport state to Starting\n"); } - VERBOSE (engine, "polling sync client %lu\n", client->control->id); + VERBOSE (engine, "polling sync client %" PRIu32 "\n", client->control->id); } /* stop polling a specific slow-sync client @@ -63,7 +63,7 @@ jack_sync_poll_exit (jack_engine_t *engine, jack_client_internal_t *client) client->control->sync_poll = 0; client->control->sync_new = 0; engine->control->sync_remain--; - VERBOSE (engine, "sync poll interrupted for client %lu\n", + VERBOSE (engine, "sync poll interrupted for client %" PRIu32 "\n", client->control->id); } client->control->is_slowsync = 0; @@ -92,7 +92,8 @@ jack_sync_poll_stop (jack_engine_t *engine) //JOQ: check invariant for debugging... assert (poll_count == engine->control->sync_remain); VERBOSE (engine, - "sync poll halted with %ld clients and %8.6f secs remaining\n", + "sync poll halted with %" PRIu32 + " clients and %8.6f secs remaining\n", engine->control->sync_remain, (double) (engine->control->sync_time_left / 1000000.0)); engine->control->sync_remain = 0; @@ -121,8 +122,8 @@ jack_sync_poll_start (jack_engine_t *engine) assert (sync_count == engine->control->sync_clients); engine->control->sync_remain = engine->control->sync_clients; engine->control->sync_time_left = engine->control->sync_timeout; - VERBOSE (engine, "transport Starting, sync poll of %ld clients " - "for %8.6f secs\n", engine->control->sync_remain, + VERBOSE (engine, "transport Starting, sync poll of %" PRIu32 + " clients for %8.6f secs\n", engine->control->sync_remain, (double) (engine->control->sync_time_left / 1000000.0)); } @@ -200,8 +201,7 @@ jack_timebase_set (jack_engine_t *engine, client = jack_client_internal_by_id (engine, client_id); if (client == NULL) { - // JOQ: use PRIuLEAST32 here... - VERBOSE (engine, " %lu no longer exists!\n", client_id); + VERBOSE (engine, " %" PRIu32 " no longer exists\n", client_id); jack_unlock_graph (engine); return EINVAL; } @@ -446,8 +446,9 @@ jack_transport_cycle_end (jack_engine_t *engine) if (ectl->request_time.unique_1 != ectl->prev_request) { jack_transport_copy_position(&ectl->request_time, &ectl->pending_time); - VERBOSE (engine, "new transport position: %lu, id=0x%llx\n", - ectl->pending_time.frame, ectl->pending_time.unique_1); + VERBOSE (engine, "new transport position: %" PRIu32 + ", id=0x%" PRIx64 "\n", ectl->pending_time.frame, + ectl->pending_time.unique_1); ectl->prev_request = ectl->pending_time.unique_1; ectl->pending_pos = 1; } diff --git a/libjack/ChangeLog b/libjack/ChangeLog index 0a48ce6..af0f4c3 100644 --- a/libjack/ChangeLog +++ b/libjack/ChangeLog @@ -1,3 +1,31 @@ +2003-08-26 Jack O'Quin + + * typedefs are now defined using the C99 standard + fixed-size integer typedefs. These new typedefs are binary + compatible with 32-bit platforms, but not 64-bit machines. + + Programs using printf on these values will get GCC compiler + warnings. To suppress the warnings, use the corresponding C99 + printf specifications defined in . That header is + already implicitly included by , but can also be + included explicitly to maintain compatibility with older versions + of JACK without messy #ifdef's. Adding explicit casts will also + work, but may suppress future warnings you might want to see. + + * jack_get_sample_rate() now returns jack_nframes_t rather than + unsigned long. These are the same on 32-bit machines, but not on + 64-bit platforms. + +2003-08-13 Jack O'Quin + + * Many new transport interfaces. It would be silly to list them + all here. Please see the new transport control section in the + JACK reference manual. + + * jack_set_transport_info() and jack_engine_takeover_timebase(), + (the old timebase master interfaces) now do nothing. Instead, use + jack_set_timebase_callback(). + 2003-05-09 Jack O'Quin * Added new jack_is_realtime() function. diff --git a/libjack/client.c b/libjack/client.c index e06de5a..250ca2d 100644 --- a/libjack/client.c +++ b/libjack/client.c @@ -267,7 +267,7 @@ jack_handle_reorder (jack_client_t *client, jack_event_t *event) client->graph_next_fd = -1; } - sprintf (path, "%s-%lu", client->fifo_prefix, event->x.n); + sprintf (path, "%s-%" PRIu32, client->fifo_prefix, event->x.n); if ((client->graph_wait_fd = open (path, O_RDONLY|O_NONBLOCK)) < 0) { jack_error ("cannot open specified fifo [%s] for reading (%s)", path, strerror (errno)); @@ -277,7 +277,7 @@ jack_handle_reorder (jack_client_t *client, jack_event_t *event) DEBUG ("opened new graph_wait_fd %d (%s)", client->graph_wait_fd, path); - sprintf (path, "%s-%lu", client->fifo_prefix, event->x.n+1); + sprintf (path, "%s-%" PRIu32, client->fifo_prefix, event->x.n+1); if ((client->graph_next_fd = open (path, O_WRONLY|O_NONBLOCK)) < 0) { jack_error ("cannot open specified fifo [%s] for writing (%s)", path, strerror (errno)); @@ -782,7 +782,10 @@ jack_client_thread (void *arg) jack_reset_timestamps (); #endif - DEBUG ("client %d signalled at %Lu, awake for process at %Lu (delay = %Lu usecs) (wakeup on graph_wait_fd==%d)", + DEBUG ("client %d signalled at %" PRIu64 + ", awake for process at %" PRIu64 + " (delay = %" PRIu64 + " usecs) (wakeup on graph_wait_fd==%d)", getpid(), control->signalled_at, control->awake_at, @@ -1278,7 +1281,7 @@ int jack_is_realtime (jack_client_t *client) return client->engine->real_time; } -unsigned long jack_get_buffer_size (jack_client_t *client) +jack_nframes_t jack_get_buffer_size (jack_client_t *client) { return client->engine->buffer_size; @@ -1538,15 +1541,15 @@ jack_get_mhz (void) } #ifdef __powerpc__ - ret = sscanf(buf, "clock\t: %LuMHz", &mhz); + ret = sscanf(buf, "clock\t: %" SCNu64 "MHz", &mhz); #else - ret = sscanf(buf, "cpu MHz : %Lu", &mhz); + ret = sscanf(buf, "cpu MHz : %" SCNu64, &mhz); #endif /* __powerpc__ */ if (ret == 1) { fclose(f); - return mhz; + return (jack_time_t)mhz; } } } diff --git a/libjack/timestamps.c b/libjack/timestamps.c index ae8264a..9e5e041 100644 --- a/libjack/timestamps.c +++ b/libjack/timestamps.c @@ -39,7 +39,8 @@ jack_init_timestamps (unsigned long howmany) if (timestamps) { free (timestamps); } - timestamps = (jack_timestamp_t *) malloc (howmany * sizeof(jack_timestamp_t)); + timestamps = (jack_timestamp_t *) + malloc (howmany * sizeof(jack_timestamp_t)); timestamp_cnt = howmany; memset (timestamps, 0, sizeof (jack_timestamp_t) * howmany); timestamp_index = 0; @@ -61,11 +62,12 @@ jack_dump_timestamps (FILE *out) unsigned long i; for (i = 0; i < timestamp_index; ++i) { - fprintf (out, "%-.32s %Lu %Lu", + fprintf (out, "%-.32s %" PRIu64 " %" PRIu64, timestamps[i].what, timestamps[i].when, timestamps[i].when - timestamps[0].when); if (i > 0) { - fprintf (out, " %Lu", timestamps[i].when - timestamps[i-1].when); + fprintf (out, " %" PRIu64, + timestamps[i].when - timestamps[i-1].when); } fputc ('\n', out); } diff --git a/libjack/transclient.c b/libjack/transclient.c index 14d5c51..99fe28a 100644 --- a/libjack/transclient.c +++ b/libjack/transclient.c @@ -63,8 +63,9 @@ jack_generate_unique_id (jack_control_t *ectl) // forcing JACK to either depend on that pesky header file, or // maintain its own like ardour does. - // fprintf (stderr, "unique ID 0x%llx, process %d, cycle 0x%lx\n", - // id.unique, id.field.pid, id.field.cycle); + // fprintf (stderr, "unique ID 0x%" PRIx64 + // ", process %d, cycle 0x%" PRIx32 "\n", + // id.unique, id.field.pid, id.field.cycle); return id.unique; } @@ -229,7 +230,7 @@ jack_frame_time (const jack_client_t *client) return current.frames + elapsed; } -unsigned long +jack_nframes_t jack_get_sample_rate (jack_client_t *client) { return client->engine->current_time.frame_rate;