* 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 <[hidden email]> Signed-off-by: Rui Nuno Capela <[hidden email]> Index: configure.ac =================================================================== RCS file: /cvsroot/jackit/jack/configure.ac,v retrieving revision 1.64 diff -u -r1.64 configure.ac --- configure.ac 16 Aug 2005 10:53:06 -0000 1.64 +++ configure.ac 22 Aug 2005 20:36:33 -0000 @@ -15,7 +15,7 @@ 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 Index: drivers/alsa/alsa_driver.c =================================================================== RCS file: /cvsroot/jackit/jack/drivers/alsa/alsa_driver.c,v retrieving revision 1.69 diff -u -r1.69 alsa_driver.c --- drivers/alsa/alsa_driver.c 15 Jun 2005 09:21:31 -0000 1.69 +++ drivers/alsa/alsa_driver.c 22 Aug 2005 20:36:34 -0000 @@ -1681,10 +1681,10 @@ 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. Index: drivers/alsa/usx2y.c =================================================================== RCS file: /cvsroot/jackit/jack/drivers/alsa/usx2y.c,v retrieving revision 1.3 diff -u -r1.3 usx2y.c --- drivers/alsa/usx2y.c 9 Jun 2005 22:10:35 -0000 1.3 +++ drivers/alsa/usx2y.c 22 Aug 2005 20:36:34 -0000 @@ -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 @@ 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 @@ 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 @@ 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 @@ ((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_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; Index: jack/internal.h =================================================================== RCS file: /cvsroot/jackit/jack/jack/internal.h,v retrieving revision 1.81 diff -u -r1.81 internal.h --- jack/internal.h 11 May 2005 02:06:46 -0000 1.81 +++ jack/internal.h 22 Aug 2005 20:36:34 -0000 @@ -445,5 +445,13 @@ 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__ */ ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Jackit-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/jackit-devel |
Hi all,
Do we really want this ? > - jack_error(dbg_buffer); > + printf(dbg_buffer); Thomas ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Jackit-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/jackit-devel |
> Do we really want this ?
> >> - jack_error(dbg_buffer); >> + printf(dbg_buffer); > No, we don't. However, I don't think we should mind at all. That's only effective on a very special debug mode (#ifdef DBGHWDEP) which is not compiled in by default. Ultimately, it's only of use to Karsten, not us mere mortals ;) As he's the one to credit for the original usx2y code, I find it fair to make like so. After all he's the one who shall debug the stuff, isn't he? Or so I believe :) Cheers. -- rncbc aka Rui Nuno Capela [hidden email] ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Jackit-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/jackit-devel |
Free forum by Nabble | Edit this page |