[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Openvortex-dev] DMA buffer constraints (no more clicks)
From: |
Manuel Jander |
Subject: |
[Openvortex-dev] DMA buffer constraints (no more clicks) |
Date: |
01 Jul 2003 22:16:45 -0400 |
Hello,
Adding the following lines to the "open" callback in au88x0_pcm.c
should eliminate clicks. It prevents wrong period sizes.
Know as i think about it, it semes quite obvious. If a period isnt a
multiple of a frame size, at least one frame gets cut in 2 pieces when
crossing the period boundary. Being a hardware guy, i wouldn't expect
the Aureal chips to reassemble a split frame ;)
This how it should be. I didnt upload it to CVS, because some programs
like aplay just give up on playback if the period size the want can't be
granted. I don't know how to solve that now; thats aplay's fault in my
opinion.
The ice1724 driver does basically the same (for reference).
Any comments a greatly appreciated.
Best Regards
Manuel Jander.
static int snd_vortex_pcm_open(snd_pcm_substream_t *substream) {
chip_t *chip = snd_pcm_substream_chip(substream);
snd_pcm_runtime_t *runtime = substream->runtime;
int dma, err;
/* Force equal size periods */
if ((err = snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
return err;
/* Force DMA 32 bit alignment */
if ((err = snd_pcm_hw_constraint_step(runtime, 0,
SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 4)) < 0)
return err;
if (substream->pcm == chip->pcm_adb) {
runtime->hw = snd_vortex_playback_hw_adb;
dma = vortex_getadb(chip);
if (dma < 0)
return -EBUSY;
substream->runtime->private_data = &chip->dma_adb[dma];
chip->dma_adb[dma].substream = substream;
} else {
runtime->hw = snd_vortex_playback_hw_wt;
dma = vortex_getwt(chip);
if (dma < 0)
return -EBUSY;
substream->runtime->private_data = &chip->dma_wt[dma];
chip->dma_wt[dma].substream = substream;
}
return 0;
}