Browse Source

Make channels 3+4 of US428 work.

This is done by hacking driver->capture_interleave_skip
in usx2y_driver_start(). Other changes in usx2y.c improve
rawusb mode debugging.

An "if (unlikely(x))" optimization commonly found in kernel
code, applied to alsa_driver_run_cycle(), as proposed by
Lee Revell.

Signed-off-by: Karsten Wiese <annabellesgarden@yahoo.de>
Signed-off-by: Rui Nuno Capela <rncbc@rncbc.org>


git-svn-id: svn+ssh://jackaudio.org/trunk/jack@918 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
rncbc 20 years ago
parent
commit
f506c97f89
4 changed files with 37 additions and 7 deletions
  1. +1
    -1
      configure.ac
  2. +2
    -2
      drivers/alsa/alsa_driver.c
  3. +26
    -4
      drivers/alsa/usx2y.c
  4. +8
    -0
      jack/internal.h

+ 1
- 1
configure.ac View File

@@ -15,7 +15,7 @@ dnl changes are made
dnl ---
JACK_MAJOR_VERSION=0
JACK_MINOR_VERSION=100
JACK_MICRO_VERSION=2
JACK_MICRO_VERSION=3

dnl ---
dnl HOWTO: updating the jack protocol version


+ 2
- 2
drivers/alsa/alsa_driver.c View File

@@ -1681,10 +1681,10 @@ alsa_driver_run_cycle (alsa_driver_t *driver)

DEBUG ("alsaback from wait, nframes = %lu", nframes);

if (wait_status < 0)
if (unlikely(wait_status < 0))
return -1; /* driver failed */

if (nframes == 0) {
if (unlikely(nframes == 0)) {

/* we detected an xrun and restarted: notify
* clients about the delay.


+ 26
- 4
drivers/alsa/usx2y.c View File

@@ -31,7 +31,12 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif

//#define DBGHWDEP

#ifdef DBGHWDEP
int dbg_offset;
char dbg_buffer[8096];
#endif
static
int usx2y_set_input_monitor_mask (jack_hardware_t *hw, unsigned long mask)
{
@@ -118,7 +123,7 @@ usx2y_driver_get_channel_addresses_playback (alsa_driver_t *driver,
if (dbg_offset < (sizeof(dbg_buffer) - 256))
dbg_offset += sprintf(dbg_buffer + dbg_offset, "avail %li@%p\n", *playback_avail, driver->playback_addr[0]);
else {
jack_error(dbg_buffer);
printf(dbg_buffer);
return -1;
}
#endif
@@ -143,7 +148,7 @@ usx2y_driver_get_channel_addresses_capture (alsa_driver_t *driver,
return 0; /* FIXME: return -1; */
h->capture_iso_bytes_done = 0;
#ifdef DBGHWDEP
dbg_offset = sprintf(dbg_buffer, "first iso = %i %i@%p:%i\n",
dbg_offset = sprintf(dbg_buffer, "cfirst iso = %i %i@%p:%i\n",
iso, h->hwdep_pcm_shm->captured_iso[iso].length,
h->hwdep_pcm_shm->capture0x8,
h->hwdep_pcm_shm->captured_iso[iso].offset);
@@ -152,7 +157,7 @@ usx2y_driver_get_channel_addresses_capture (alsa_driver_t *driver,
iso = h->capture_iso_start;
}
#ifdef DBGHWDEP
dbg_offset += sprintf(dbg_buffer + dbg_offset, "iso = %i(%i;%i); ", iso,
dbg_offset += sprintf(dbg_buffer + dbg_offset, "ciso = %i(%i;%i); ", iso,
h->hwdep_pcm_shm->captured_iso[iso].offset,
h->hwdep_pcm_shm->captured_iso[iso].frame);
#endif
@@ -178,10 +183,21 @@ usx2y_driver_get_channel_addresses_capture (alsa_driver_t *driver,
((chn & 1) ? driver->capture_sample_bytes : 0);
}
#ifdef DBGHWDEP
{
int f = 0;
unsigned *u = driver->capture_addr[0];
static unsigned last;
dbg_offset += sprintf(dbg_buffer + dbg_offset, "\nvon %6u bis %6u\n", last, u[0]);
while (f < *capture_avail && dbg_offset < (sizeof(dbg_buffer) - 256)) {
if (u[f] != last + 1)
dbg_offset += sprintf(dbg_buffer + dbg_offset, "\nooops %6u %6u\n", last, u[f]);
last = u[f++];
}
}
if (dbg_offset < (sizeof(dbg_buffer) - 256))
dbg_offset += sprintf(dbg_buffer + dbg_offset, "avail %li@%p\n", *capture_avail, driver->capture_addr[0]);
else {
jack_error(dbg_buffer);
printf(dbg_buffer);
return -1;
}
#endif
@@ -197,6 +213,12 @@ usx2y_driver_start (alsa_driver_t *driver)

usx2y_t *h = (usx2y_t *) driver->hw->private;

if (driver->capture_nchannels == 4) {
// US428 channels 3+4 are on a seperate 2 channel stream.
// ALSA thinks its 1 stream with 4 channels, so we have to hack here.
driver->capture_interleave_skip = 2 * driver->capture_sample_bytes;
}

driver->poll_last = 0;
driver->poll_next = 0;



+ 8
- 0
jack/internal.h View File

@@ -445,5 +445,13 @@ jack_port_t *jack_port_by_id_int (const jack_client_t *client,
jack_port_t *jack_port_by_name_int (jack_client_t *client,
const char *port_name);

#ifdef __GNUC__
# define likely(x) __builtin_expect((x),1)
# define unlikely(x) __builtin_expect((x),0)
#else
# define likely(x) (x)
# define unlikely(x) (x)
#endif

#endif /* __jack_internal_h__ */


Loading…
Cancel
Save