Skip to contentSkip to conversation

Help with dummy.c (where/how to write?)

DISCUSSION Smilen Dimitrov 1 participant 2 messages Jul 5, 2010 – Jul 6, 2010 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi all,

I am trying to work on dummy.c:

http://lxr.linux.no/#linux+v2.6.32/sound/drivers/dummy.c

as an exercise, and I'd like to modify it so it behaves as an 'oscillator'; that is, when I choose 'dummy' as an input in say Audacity, and press Record - I'd like to be able to write something to the audio (pcm) buffer of the driver directly from the driver itself (say a single sample), and be able to observe those samples recorded in Audacity.

So far, by adding some debug statements, the only thing I can figure, is that when 'Record' in Audacity is pressed, 'dummy_hrtimer_callback' is called continuously - but I cannot tell what functions to use to modify / write to output buffers (not even sure what the output buffers there are, I guess dpcm->substream->private_data).

Could anyone point to me if there is a similar example existing already, or if not. provide me with some pointers on how to do this?

Thanks in advance,
Cheers!

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi Eliot,

Thanks so much for your response:

Quoted 9 lines
Quoted 8 lines

I am trying to work on dummy.c:

http://lxr.linux.no/#linux+v2.6.32/sound/drivers/dummy.c

as an exercise, and I'd like to modify it so it behaves as an 'oscillator'; [snip]

Quoted 6 lines

You are better to look at the loopback driver in alsa-driver repo:

http://git.alsa-project.org/?p=alsa-driver.git;a=blob_plain;f=drivers/aloop-kernel.c;hb=HEAD

You would put your generation code in clear_capture_buf()

Fantastic info - that is exactly what I needed :)

(Don't know why your response hasn't shown in the alsa-devel archives yet, hopefully my reply will bump it up there)

Cheers!