snd_pcm_direct_t *dmix = pcm->private_data;
dmix->hw_ptr %= pcm->period_size;
dmix->appl_ptr = dmix->last_appl_ptr = dmix->hw_ptr;
+ dmix->slave_appl_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr;
snd_pcm_direct_reset_slave_ptr(pcm, dmix);
return 0;
}
int err;
snd_pcm_hwsync(dmix->spcm);
+ dmix->slave_appl_ptr = dmix->slave_hw_ptr = *dmix->spcm->hw.ptr;
snd_pcm_direct_reset_slave_ptr(pcm, dmix);
err = snd_timer_start(dmix->timer);
if (err < 0)
snd_pcm_direct_t *dshare = pcm->private_data;
dshare->hw_ptr %= pcm->period_size;
dshare->appl_ptr = dshare->last_appl_ptr = dshare->hw_ptr;
+ dshare->slave_appl_ptr = dshare->slave_hw_ptr = *dshare->spcm->hw.ptr;
snd_pcm_direct_reset_slave_ptr(pcm, dshare);
return 0;
}
int err;
snd_pcm_hwsync(dshare->spcm);
+ dshare->slave_appl_ptr = dshare->slave_hw_ptr = *dshare->spcm->hw.ptr;
snd_pcm_direct_reset_slave_ptr(pcm, dshare);
err = snd_timer_start(dshare->timer);
if (err < 0)
dsnoop->hw_ptr %= pcm->period_size;
dsnoop->appl_ptr = dsnoop->hw_ptr;
dsnoop->slave_appl_ptr = dsnoop->slave_hw_ptr;
+ snd_pcm_direct_reset_slave_ptr(pcm, dsnoop);
return 0;
}
{
snd_pcm_direct_t *dsnoop = pcm->private_data;
int err;
-
+
if (dsnoop->state != SND_PCM_STATE_PREPARED)
return -EBADFD;
snd_pcm_hwsync(dsnoop->spcm);
snoop_timestamp(pcm);
dsnoop->slave_appl_ptr = dsnoop->slave_hw_ptr;
+ snd_pcm_direct_reset_slave_ptr(pcm, dsnoop);
err = snd_timer_start(dsnoop->timer);
if (err < 0)
return err;
dsnoop->max_periods = opts->max_periods;
dsnoop->var_periodsize = opts->var_periodsize;
dsnoop->sync_ptr = snd_pcm_dsnoop_sync_ptr;
+ dsnoop->hw_ptr_alignment = opts->hw_ptr_alignment;
retry:
if (first_instance) {
ipc_key INT # unique IPC key
ipc_key_add_uid BOOL # add current uid to unique IPC key
ipc_perm INT # IPC permissions (octal, default 0600)
+ hw_ptr_alignment STR # Slave application and hw pointer alignment type
+ # STR can be one of the below strings :
+ # no
+ # roundup
+ # rounddown
+ # auto (default)
slave STR
# or
slave { # Slave definition
}
\endcode
+<code>hw_ptr_alignment</code> specifies slave application and hw
+pointer alignment type. By default hw_ptr_alignment is auto. Below are
+the possible configurations:
+- no: minimal latency with minimal frames dropped at startup. But
+ wakeup of application (return from snd_pcm_wait() or poll()) can
+ take up to 2 * period.
+- roundup: It is guaranteed that all frames will be played at
+ startup. But the latency will increase upto period-1 frames.
+- rounddown: It is guaranteed that a wakeup will happen for each
+ period and frames can be written from application. But on startup
+ upto period-1 frames will be dropped.
+- auto: Selects the best approach depending on the used period and
+ buffer size.
+ If the application buffer size is < 2 * application period,
+ "roundup" will be selected to avoid over runs. If the slave_period
+ is < 10ms we could expect that there are low latency
+ requirements. Therefore "rounddown" will be chosen to avoid long
+ wakeup times. Else "no" will be chosen.
+
\subsection pcm_plugins_dsnoop_funcref Function reference
<UL>