aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers/dummy.c
diff options
context:
space:
mode:
authorAhmet İnan <ainan at>2008-02-28 06:46:32 -0500
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:17 -0400
commit470f23b873679b045908551302fec6b1edf05a5a (patch)
tree145339e5b24d3436d850b07c1503c5cb1e95afba /sound/drivers/dummy.c
parentbed515b0dfdcf8f440c7e6c5bad8ce3eb96fb625 (diff)
[ALSA] snd-dummy - better realtime app support
when the time interval for a period is smaller than kernel HZ, then snd-aloop and snd-dummy cannot call snd_pcm_period_elapsed as fast enough annymore. this happens for example with games. but the app still needs to see, that the buffer actually did go further, which is provided by these patches. Signed-off-by: Ahmet İnan <ainan <at> mathematik.uni-freiburg.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/drivers/dummy.c')
-rw-r--r--sound/drivers/dummy.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index f67f65829f3e..83ac4980c5fb 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -259,10 +259,10 @@ static void snd_card_dummy_pcm_timer_function(unsigned long data)
259 dpcm->timer.expires = 1 + jiffies; 259 dpcm->timer.expires = 1 + jiffies;
260 add_timer(&dpcm->timer); 260 add_timer(&dpcm->timer);
261 dpcm->pcm_irq_pos += dpcm->pcm_bps; 261 dpcm->pcm_irq_pos += dpcm->pcm_bps;
262 dpcm->pcm_buf_pos += dpcm->pcm_bps;
263 dpcm->pcm_buf_pos %= dpcm->pcm_buffer_size * dpcm->pcm_hz;
262 if (dpcm->pcm_irq_pos >= dpcm->pcm_period_size * dpcm->pcm_hz) { 264 if (dpcm->pcm_irq_pos >= dpcm->pcm_period_size * dpcm->pcm_hz) {
263 dpcm->pcm_irq_pos %= dpcm->pcm_period_size * dpcm->pcm_hz; 265 dpcm->pcm_irq_pos %= dpcm->pcm_period_size * dpcm->pcm_hz;
264 dpcm->pcm_buf_pos += dpcm->pcm_period_size;
265 dpcm->pcm_buf_pos %= dpcm->pcm_buffer_size;
266 spin_unlock_irqrestore(&dpcm->lock, flags); 266 spin_unlock_irqrestore(&dpcm->lock, flags);
267 snd_pcm_period_elapsed(dpcm->substream); 267 snd_pcm_period_elapsed(dpcm->substream);
268 } else 268 } else
@@ -274,7 +274,7 @@ static snd_pcm_uframes_t snd_card_dummy_pcm_pointer(struct snd_pcm_substream *su
274 struct snd_pcm_runtime *runtime = substream->runtime; 274 struct snd_pcm_runtime *runtime = substream->runtime;
275 struct snd_dummy_pcm *dpcm = runtime->private_data; 275 struct snd_dummy_pcm *dpcm = runtime->private_data;
276 276
277 return bytes_to_frames(runtime, dpcm->pcm_buf_pos); 277 return bytes_to_frames(runtime, dpcm->pcm_buf_pos / dpcm->pcm_hz);
278} 278}
279 279
280static struct snd_pcm_hardware snd_card_dummy_playback = 280static struct snd_pcm_hardware snd_card_dummy_playback =