Skip to contentSkip to conversation

Enable low latency EFX capture on emu10k1

PATCH In review Lee Revell 2 participants 3 messages Jul 14, 2004

lore
Share & tools
lore

Lee Revell

author
#0 lore raw

PATCH 1/1 Enable low latency EFX capture on emu10k1

The following patch fixes EFX capture on the emu10k1. The capture_period_sizes table is in bytes, but the hardware constraint was being set in frames.

I tested 4 channel recording with a capture period of 64 frames (64 frames x 2 bytes/sample x 4 channels = 512, the lowest power of 2 capture period allowed).

Lee

Index: alsa-kernel/pci/emu10k1/emupcm.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/emu10k1/emupcm.c,v retrieving revision 1.29

pci/emu10k1/emupcm.c 14 Jul 2004 06:14:38 -0000 renamed from pci/emu10k1/emupcm.c 1 Jul 2004 09:22:16 -0000 1.29 +3 -3
diff -u -r1.29 emupcm.c
@@ -852,7 +852,7 @@
        runtime->hw = snd_emu10k1_capture;
        emu->capture_interrupt = snd_emu10k1_pcm_ac97adc_interrupt;
        emu->pcm_capture_substream = substream;
-       snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, &hw_constraints_capture_period_sizes);
+       snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, &hw_constraints_capture_period_sizes);
        snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_capture_rates);
        return 0;
 }
@@ -891,7 +891,7 @@
        runtime->hw.channels_min = 1;
        emu->capture_mic_interrupt = snd_emu10k1_pcm_ac97mic_interrupt;
        emu->pcm_capture_mic_substream = substream;
-       snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, &hw_constraints_capture_period_sizes);
+       snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, &hw_constraints_capture_period_sizes);
        return 0;
 }
 
@@ -942,7 +942,7 @@
        spin_unlock_irqrestore(&emu->reg_lock, flags);
        emu->capture_efx_interrupt = snd_emu10k1_pcm_efx_interrupt;
        emu->pcm_capture_efx_substream = substream;
-       snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, &hw_constraints_capture_period_sizes);
+       snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, &hw_constraints_capture_period_sizes);
        return 0;
 }
 

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

author
#1 lore raw
Quoted 8 lines · Lee Revell

The following patch fixes EFX capture on the emu10k1. The capture_period_sizes table is in bytes, but the hardware constraint was being set in frames.

I tested 4 channel recording with a capture period of 64 frames (64 frames x 2 bytes/sample x 4 channels = 512, the lowest power of 2 capture period allowed).

With this patch, I can record 8 channels with a period of 64 frames. Trying to record 16 gives the error "alsactl: set_control:966: Cannot write control '3:0:0:EFX voices mask:0' : Invalid argument".

Lee

root@mindpipe:/home/rlrevell# jackd -vvv --realtime -d alsa --rate 48000 -p 64 -C -d hw:0,2 -S 
getting driver descriptor from /usr/local/lib/jack/jack_dummy.so
getting driver descriptor from /usr/local/lib/jack/jack_oss.so
getting driver descriptor from /usr/local/lib/jack/jack_alsa.so
jackd 0.98.1
Copyright 2001-2003 Paul Davis and others.
jackd comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details

registered builtin port type 32 bit float mono audio loading driver ..
new client: alsa_pcm, id = 1 type 1 @ 0x8056a20 fd = -1 apparent rate = 48000
creating alsa driver ... -|hw:0,2|64|2|48000|0|0|nomon|swmeter|-|16bit control device hw:0
configuring for 48000Hz, period = 64 frames, buffer = 2 periods new buffer size 64
registered port alsa_pcm:capture_1, offset = 256
registered port alsa_pcm:capture_2, offset = 512
registered port alsa_pcm:capture_3, offset = 768
registered port alsa_pcm:capture_4, offset = 1024 registered port alsa_pcm:capture_5, offset = 1280 registered port alsa_pcm:capture_6, offset = 1536 registered port alsa_pcm:capture_7, offset = 1792 registered port alsa_pcm:capture_8, offset = 2048
++ jack_rechain_graph():
client alsa_pcm: internal client, execution_order=0.
-- jack_rechain_graph()
2136 waiting for signals
load = 0.2626 max usecs: 7.000, spare = 1326.000
load = 0.3938 max usecs: 7.000, spare = 1326.000
load = 0.4595 max usecs: 7.000, spare = 1326.000
load = 0.4923 max usecs: 7.000, spare = 1326.000
load = 0.5087 max usecs: 7.000, spare = 1326.000
load = 0.5544 max usecs: 8.000, spare = 1325.000
jack main caught signal 2
stopping driver
detaching driver
unloading driver
freeing shared port segments
stopping server thread
stopping watchdog thread
freeing engine shared memory
engine deleted

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com

#2 lore raw

At Wed, 14 Jul 2004 12:05:55 -0400,

Quoted 6 lines · Lee Revell
Quoted 4 lines · Lee Revell

The following patch fixes EFX capture on the emu10k1. The capture_period_sizes table is in bytes, but the hardware constraint was being set in frames.

Quoted 6 lines
Quoted 4 lines

I tested 4 channel recording with a capture period of 64 frames (64 frames x 2 bytes/sample x 4 channels = 512, the lowest power of 2 capture period allowed).

With this patch, I can record 8 channels with a period of 64 frames.

Your patch was applied to cvs now. Thanks.

I applied the patch manually because your mailer likely broke the patch with tab->space conversion. Please check the cvs version later (after sf's anon. cvs tree is sync'ed).

Takashi

-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com