162306a36Sopenharmony_ci=================================================================
262306a36Sopenharmony_ciLow latency, multichannel audio with JACK and the emu10k1/emu10k2
362306a36Sopenharmony_ci=================================================================
462306a36Sopenharmony_ci
562306a36Sopenharmony_ciThis document is a guide to using the emu10k1 based devices with JACK for low
662306a36Sopenharmony_cilatency, multichannel recording functionality.  All of my recent work to allow
762306a36Sopenharmony_ciLinux users to use the full capabilities of their hardware has been inspired 
862306a36Sopenharmony_ciby the kX Project.  Without their work I never would have discovered the true
962306a36Sopenharmony_cipower of this hardware.
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci	http://www.kxproject.com
1262306a36Sopenharmony_ci						- Lee Revell, 2005.03.30
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciUntil recently, emu10k1 users on Linux did not have access to the same low
1662306a36Sopenharmony_cilatency, multichannel features offered by the "kX ASIO" feature of their
1762306a36Sopenharmony_ciWindows driver.  As of ALSA 1.0.9 this is no more!
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ciFor those unfamiliar with kX ASIO, this consists of 16 capture and 16 playback
2062306a36Sopenharmony_cichannels.  With a post 2.6.9 Linux kernel, latencies down to 64 (1.33 ms) or
2162306a36Sopenharmony_cieven 32 (0.66ms) frames should work well.
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ciThe configuration is slightly more involved than on Windows, as you have to
2462306a36Sopenharmony_ciselect the correct device for JACK to use.  Actually, for qjackctl users it's
2562306a36Sopenharmony_cifairly self explanatory - select Duplex, then for capture and playback select
2662306a36Sopenharmony_cithe multichannel devices, set the in and out channels to 16, and the sample
2762306a36Sopenharmony_cirate to 48000Hz.  The command line looks like this:
2862306a36Sopenharmony_ci::
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci  /usr/local/bin/jackd -R -dalsa -r48000 -p64 -n2 -D -Chw:0,2 -Phw:0,3 -S
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciThis will give you 16 input ports and 16 output ports.
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ciThe 16 output ports map onto the 16 FX buses (or the first 16 of 64, for the
3562306a36Sopenharmony_ciAudigy).  The mapping from FX bus to physical output is described in
3662306a36Sopenharmony_cisb-live-mixer.rst (or audigy-mixer.rst).
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ciThe 16 input ports are connected to the 16 physical inputs.  Contrary to
3962306a36Sopenharmony_cipopular belief, all emu10k1 cards are multichannel cards.  Which of these
4062306a36Sopenharmony_ciinput channels have physical inputs connected to them depends on the card
4162306a36Sopenharmony_cimodel.  Trial and error is highly recommended; the pinout diagrams
4262306a36Sopenharmony_cifor the card have been reverse engineered by some enterprising kX users and are 
4362306a36Sopenharmony_ciavailable on the internet.  Meterbridge is helpful here, and the kX forums are
4462306a36Sopenharmony_cipacked with useful information.
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ciEach input port will either correspond to a digital (SPDIF) input, an analog
4762306a36Sopenharmony_ciinput, or nothing.  The one exception is the SBLive! 5.1.  On these devices,
4862306a36Sopenharmony_cithe second and third input ports are wired to the center/LFE output.  You will
4962306a36Sopenharmony_cistill see 16 capture channels, but only 14 are available for recording inputs.
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ciThis chart, borrowed from kxfxlib/da_asio51.cpp, describes the mapping of JACK
5262306a36Sopenharmony_ciports to FXBUS2 (multitrack recording input) and EXTOUT (physical output)
5362306a36Sopenharmony_cichannels.
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ciJACK (& ASIO) mappings on 10k1 5.1 SBLive cards:
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci==============  ========        ============
5862306a36Sopenharmony_ciJACK		Epilog		FXBUS2(nr)
5962306a36Sopenharmony_ci==============  ========        ============
6062306a36Sopenharmony_cicapture_1	asio14		FXBUS2(0xe)
6162306a36Sopenharmony_cicapture_2	asio15		FXBUS2(0xf)
6262306a36Sopenharmony_cicapture_3	asio0		FXBUS2(0x0)	
6362306a36Sopenharmony_ci~capture_4	Center		EXTOUT(0x11)	// mapped to by Center
6462306a36Sopenharmony_ci~capture_5	LFE		EXTOUT(0x12)	// mapped to by LFE
6562306a36Sopenharmony_cicapture_6	asio3		FXBUS2(0x3)
6662306a36Sopenharmony_cicapture_7	asio4		FXBUS2(0x4)
6762306a36Sopenharmony_cicapture_8	asio5		FXBUS2(0x5)
6862306a36Sopenharmony_cicapture_9	asio6		FXBUS2(0x6)
6962306a36Sopenharmony_cicapture_10	asio7		FXBUS2(0x7)
7062306a36Sopenharmony_cicapture_11	asio8		FXBUS2(0x8)
7162306a36Sopenharmony_cicapture_12	asio9		FXBUS2(0x9)
7262306a36Sopenharmony_cicapture_13	asio10		FXBUS2(0xa)
7362306a36Sopenharmony_cicapture_14	asio11		FXBUS2(0xb)
7462306a36Sopenharmony_cicapture_15	asio12		FXBUS2(0xc)
7562306a36Sopenharmony_cicapture_16	asio13		FXBUS2(0xd)
7662306a36Sopenharmony_ci==============  ========        ============
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ciTODO: describe use of ld10k1/qlo10k1 in conjunction with JACK
79