Skip to contentSkip to conversation

Example app source code or docs needed to help me do mmap.

DISCUSSION James Courtier-Dutton 4 participants 5 messages Apr 27, 2002

lore
Share & tools
lore
#0 lore raw

Can someone point me to an example alsa app doing mmap ?

I want to convert my application from plain pcm_write to mmap mode. I would also like to understand how you detect if a sound card can do mmap or not.

I help develope a multimedia application, and 6 audio channels (5.1 sound) starts to require mmap mode on very slow PCs.

Cheers
James

#1 lore raw
Quoted 1 line · James Courtier-Dutton

Can someone point me to an example alsa app doing mmap ?

I like the implementation in jack's alsa_driver. It is tricky code though (just MHO, after having ported it to a gstreamer alsa plugin) -- the write() api is of course much easier.

regards,

wingo.

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [email protected]

#2 lore raw

glue for new driver

In reply to James Courtier-Dutton

Hi,

I am writing a driver for a new card, and wonder how the ALSA server will recognize my module as one of its own? Besides, is there anything I should know regarding debugging ALSA drivers?

Thanks,
Guilhem.

__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

#4 lore raw
In reply to James Courtier-Dutton
Quoted 8 lines

Can someone point me to an example alsa app doing mmap ?

I want to convert my application from plain pcm_write to mmap mode. I would also like to understand how you detect if a sound card can do mmap or not.

I help develope a multimedia application, and 6 audio channels (5.1 sound) starts to require mmap mode on very slow PCs.

either

aplay.c (simple, confusing) latency.c (simple, limited) {JACK}/alsa_driver.c (complete, confusing)

might help. I think that the Jack case is the only one that handles what I would call "synchronous full duplex" (i.e. capture and playback running in sync). the others don't tend to worry about that detail, and it affects the inner loops of the code quite a bit.

to find out if mmap is support, you ask use

snd_pcm_hw_params_set_access (handle, params,

			         SND_PCM_ACCESS_MMAP_NONINTERLEAVED);

or

snd_pcm_hw_params_set_access (handle, params,

			         SND_PCM_ACCESS_MMAP_INTERLEAVED);

if it works, then it works :) BTW, any "plug" device supports mmap mode regardless or not of the corresponding "hw" device(s) do. that's partly why JACK uses mmap mode without checking for this - if a user tries it on h/w that doesn't support it, they can just use "plughw:D,S" instead of "hw:D,S" when naming it.

--p

#3 lore raw

Re: glue for new driver

In reply to Guilhem Tardy
Quoted 6 lines

Hi,

I am writing a driver for a new card, and wonder how the ALSA server will recognize my module as one of its own? Besides, is there anything I should kno w
regarding debugging ALSA drivers?

there is no "ALSA server", at least not in the context you're discussing.

you should download ALSA from CVS and build your driver within your copy of the ALSA source tree, modifying makefiles etc. as needed to include it in the build. that way, when its ready, you can submit a patch back to jaroslav that includes everything thats needed, not just driver source.

--p