[PlanetCCRMA] Tascam 428 startup and inputs 3 and 4

Karsten Wiese annabellesgarden@yahoo.de
Mon Aug 22 04:07:02 2005


--Boundary-00=_8EbCDeepBTUkF8w
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Am Samstag, 20. August 2005 20:19 schrieb Eric Princen:
> I have the 428 usable now with inputs 1 and 2. I currently have to
> manually get it going by running usx2yloader;us428control &. Is there
> way to do that in modproble.conf automatically on module load and/or on
> hotplug? Certainly would be nice to have the device simply work right
> out of the box. It's usable now in a limited way, but not yet how I
> would prefer (which I'm still very happy about. Don't get me wrong. :-)

when I made a fresh CCRMA+FC3 install some time ago, hotplug 
worked out of the box. 
My (propably self modified) modproble.conf currently has this
relevant entries:
------
alias usb-controller ehci-hcd
alias usb-controller1 uhci-hcd
install snd-usb-usx2y modprobe snd-seq; modprobe --ignore-install snd-usb-usx2y nrpacks=1 index=1
alias snd-card-0 snd-via82xx
options snd-card-0 index=0
install snd-via82xx /sbin/modprobe --ignore-install snd-via82xx && /usr/sbin/alsactl restore >/dev/null 2>&1 || :
remove snd-via82xx { /usr/sbin/alsactl store >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-via82xx
------
> 
> Question number 2 is about inputs 3 and 4, which are the ones I tend to
> use if I'm going guitar directly into the board. 1 and 2 are fine for
> vocals, but I'd like to get as close to full functionality as possible.
> I have not found a way to enable them. Is there a module setting
> required?

Yes, see above. Its the "nrpacks=1". Also you need a modified jack.
Well its only jack's alsa-usx2y driver that needs tweaking.
Attached is the patch, which I've also sent to the jack-guys.
If you have that modified jack installed,
make sure you specify the alsa-pcm device like this:
	$ jackd -dalsa -dhw0,2
the important part is the ",2".
qjackctl has a convenient dropdown menu to choose "the right thing".
> 
> BTW, Ardour is pretty sweet. Is there any documentation on us428control?

Doc is currently "read the source" only.

> I don't know what applications can use it's services, and what ones
> don't. I see that it's simply a MIDI device to Jack, which is nice. What
> can I see it work with?

Last time i checked the STOP/PLAY Buttons worked.
Not sure about the rest.

   Have fun,
   Karsten

--Boundary-00=_8EbCDeepBTUkF8w
Content-Type: text/x-diff;
  charset="utf-8";
  name="jack-usx2y-US428-ch3+4.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="jack-usx2y-US428-ch3+4.patch"

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.

Also in this patch is an unrelated "if (unlikely(x))"
optimization commonly found in kernel code.
Here it is applied to alsa_driver_run_cycle().
This has been proposed by Lee Revel.

Signed-off-by: Karsten Wiese <annabellesgarden@yahoo.de>

Index: drivers/alsa/alsa_driver.c
===================================================================
RCS file: /cvsroot/jackit/jack/drivers/alsa/alsa_driver.c,v
retrieving revision 1.69
diff -U3 -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 10:17:40 -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 -U3 -r1.3 usx2y.c
--- drivers/alsa/usx2y.c	9 Jun 2005 22:10:35 -0000	1.3
+++ drivers/alsa/usx2y.c	22 Aug 2005 10:17:41 -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 -U3 -r1.81 internal.h
--- jack/internal.h	11 May 2005 02:06:46 -0000	1.81
+++ jack/internal.h	22 Aug 2005 10:17:42 -0000
@@ -445,5 +445,9 @@
 jack_port_t *jack_port_by_name_int (jack_client_t *client,
 				    const char *port_name);
 
+#define likely(x)       __builtin_expect((x),1)
+
+#define unlikely(x)     __builtin_expect((x),0)
+
 #endif /* __jack_internal_h__ */
 

--Boundary-00=_8EbCDeepBTUkF8w--

	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de