Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 92065
b: refs/heads/master
c: 53463a8
h: refs/heads/master
i:
  92063: 07a1c63
v: v3
  • Loading branch information
Ahmet İnan authored and Takashi Iwai committed Apr 24, 2008
1 parent 9db756a commit 6534bf4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 03d7ca177fd2ecac8eb22f482f327ecaae4ac8cb
refs/heads/master: 53463a8302d0c3148c4c64c034312215e76429c2
26 changes: 15 additions & 11 deletions trunk/sound/drivers/dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ struct snd_dummy_pcm {
struct snd_dummy *dummy;
spinlock_t lock;
struct timer_list timer;
unsigned int pcm_size;
unsigned int pcm_count;
unsigned int pcm_buffer_size;
unsigned int pcm_period_size;
unsigned int pcm_bps; /* bytes per second */
unsigned int pcm_jiffie; /* bytes per one jiffie */
unsigned int pcm_hz; /* HZ */
unsigned int pcm_irq_pos; /* IRQ position */
unsigned int pcm_buf_pos; /* position in buffer */
struct snd_pcm_substream *substream;
Expand Down Expand Up @@ -238,11 +238,15 @@ static int snd_card_dummy_pcm_prepare(struct snd_pcm_substream *substream)
if (bps <= 0)
return -EINVAL;
dpcm->pcm_bps = bps;
dpcm->pcm_jiffie = bps / HZ;
dpcm->pcm_size = snd_pcm_lib_buffer_bytes(substream);
dpcm->pcm_count = snd_pcm_lib_period_bytes(substream);
dpcm->pcm_hz = HZ;
dpcm->pcm_buffer_size = snd_pcm_lib_buffer_bytes(substream);
dpcm->pcm_period_size = snd_pcm_lib_period_bytes(substream);
dpcm->pcm_irq_pos = 0;
dpcm->pcm_buf_pos = 0;

snd_pcm_format_set_silence(runtime->format, runtime->dma_area,
bytes_to_samples(runtime, runtime->dma_bytes));

return 0;
}

Expand All @@ -254,11 +258,11 @@ static void snd_card_dummy_pcm_timer_function(unsigned long data)
spin_lock_irqsave(&dpcm->lock, flags);
dpcm->timer.expires = 1 + jiffies;
add_timer(&dpcm->timer);
dpcm->pcm_irq_pos += dpcm->pcm_jiffie;
dpcm->pcm_buf_pos += dpcm->pcm_jiffie;
dpcm->pcm_buf_pos %= dpcm->pcm_size;
if (dpcm->pcm_irq_pos >= dpcm->pcm_count) {
dpcm->pcm_irq_pos %= dpcm->pcm_count;
dpcm->pcm_irq_pos += dpcm->pcm_bps;
if (dpcm->pcm_irq_pos >= dpcm->pcm_period_size * dpcm->pcm_hz) {
dpcm->pcm_irq_pos %= dpcm->pcm_period_size * dpcm->pcm_hz;
dpcm->pcm_buf_pos += dpcm->pcm_period_size;
dpcm->pcm_buf_pos %= dpcm->pcm_buffer_size;
spin_unlock_irqrestore(&dpcm->lock, flags);
snd_pcm_period_elapsed(dpcm->substream);
} else
Expand Down

0 comments on commit 6534bf4

Please sign in to comment.