At Wed, 11 Apr 2007 00:11:51 -0700 (PDT), Ciaccia wrote:
Hi Lee, Thanks a lot for the explanation! Now I understand what's wrong with the module, I must remove the buffer allocation from the trigger and put it somewhere else... You said I should move it in the prepare function, this page http://www.alsa-project.org/~iwai/writing-an-alsa-driver/x639.htm says it should go in the hw_params. What's the best place where to put it?
The document recommends hw_params callback because prepare callback was atomic in the earlier ALSA version while now it's non-atomic, too. If it's currently in trigger callback, prepare might be slightly easier, I guess.
I did not write the module, so I really don't know why all the sample format conversion code is in the module... How could I fix/improve it and use the sample conversion already available in alsa-lib?
Just drop the whole sample conversion part in the driver and define only the natively supported format in snd_pcm_hardware.formats field. Then the rest necessary thing will be done automatically in alsa-lib.
I still didn't see the code at this moment, so just a guess. I'll review it soon later.
thanks,
Takashi