int snd_pcm_channel_flush(snd_pcm_t *handle, int channel);
int snd_pcm_playback_pause(snd_pcm_t *handle, int enable);
int snd_pcm_channel_pause(snd_pcm_t *handle, int channel, int enable);
+int snd_pcm_channel_update(snd_pcm_t *handle, int channel);
ssize_t snd_pcm_transfer_size(snd_pcm_t *handle, int channel);
ssize_t snd_pcm_write(snd_pcm_t *handle, const void *buffer, size_t size);
ssize_t snd_pcm_read(snd_pcm_t *handle, void *buffer, size_t size);
return pcm->ops->channel_status(pcm, status);
}
+int snd_pcm_channel_update(snd_pcm_t *pcm, int channel)
+{
+ int err;
+ if (!pcm)
+ return -EFAULT;
+ if (channel < 0 || channel > 1)
+ return -EINVAL;
+ if (!pcm->chan[channel].open)
+ return -EBADFD;
+ err = pcm->ops->channel_update(pcm, channel);
+ if (err < 0)
+ return err;
+ snd_pcm_mmap_status_change(pcm, channel, -1);
+ return 0;
+}
+
int snd_pcm_channel_prepare(snd_pcm_t *pcm, int channel)
{
int err;
return 0;
}
+static int snd_pcm_hw_channel_update(snd_pcm_t *pcm, int channel)
+{
+ int fd;
+ snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
+ fd = hw->chan[channel].fd;
+ if (ioctl(fd, SND_PCM_IOCTL_CHANNEL_UPDATE) < 0)
+ return -errno;
+ return 0;
+}
+
static int snd_pcm_hw_channel_prepare(snd_pcm_t *pcm, int channel)
{
int fd;
channel_setup: snd_pcm_hw_channel_setup,
voice_setup: snd_pcm_hw_voice_setup,
channel_status: snd_pcm_hw_channel_status,
+ channel_update: snd_pcm_hw_channel_update,
channel_prepare: snd_pcm_hw_channel_prepare,
channel_go: snd_pcm_hw_channel_go,
sync_go: snd_pcm_hw_sync_go,
int (*voice_setup)(snd_pcm_t *pcm, int channel, snd_pcm_voice_setup_t *setup);
int (*channel_status)(snd_pcm_t *pcm, snd_pcm_channel_status_t *status);
int (*channel_prepare)(snd_pcm_t *pcm, int channel);
+ int (*channel_update)(snd_pcm_t *pcm, int channel);
int (*channel_go)(snd_pcm_t *pcm, int channel);
int (*sync_go)(snd_pcm_t *pcm, snd_pcm_sync_t *sync);
int (*channel_drain)(snd_pcm_t *pcm, int channel);
{
struct snd_pcm_chan *chan;
ssize_t bytes_used;
- // snd_pcm_update_pos(pcm, SND_PCM_CHANNEL_PLAYBACK);
chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK];
bytes_used = chan->mmap_control->pos_data - chan->mmap_control->pos_io;
if (bytes_used < (ssize_t)(chan->setup.buffer_size - chan->setup.pos_boundary))
{
struct snd_pcm_chan *chan;
ssize_t bytes_used;
- // snd_pcm_update_pos(pcm, SND_PCM_CHANNEL_CAPTURE);
chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE];
bytes_used = chan->mmap_control->pos_io - chan->mmap_control->pos_data;
if (bytes_used < 0)
}
}
}
+ if (chan->mode & SND_PCM_NONBLOCK)
+ snd_pcm_channel_update(pcm, SND_PCM_CHANNEL_PLAYBACK);
while (count > 0) {
size_t bytes;
int ready = snd_pcm_mmap_playback_ready(pcm);
if (err < 0)
return err;
}
+ if (chan->mode & SND_PCM_NONBLOCK)
+ snd_pcm_channel_update(pcm, SND_PCM_CHANNEL_CAPTURE);
while (count > 0) {
size_t bytes;
int ready = snd_pcm_mmap_capture_ready(pcm);
return 0;
}
+static int snd_pcm_plug_channel_update(snd_pcm_t *pcm, int channel)
+{
+ snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
+ int err;
+ err = snd_pcm_channel_update(plug->slave, channel);
+ if (err < 0)
+ return err;
+ if (snd_pcm_plug_direct(pcm, channel))
+ return 0;
+#if 0
+ /* To think more about that */
+ if ((err = snd_pcm_plug_action(pcm, channel, UPDATE, 0))<0)
+ return err;
+#endif
+ return 0;
+}
+
static int snd_pcm_plug_channel_prepare(snd_pcm_t *pcm, int channel)
{
snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
channel_setup: snd_pcm_plug_channel_setup,
voice_setup: snd_pcm_plug_voice_setup,
channel_status: snd_pcm_plug_channel_status,
+ channel_update: snd_pcm_plug_channel_update,
channel_prepare: snd_pcm_plug_channel_prepare,
channel_go: snd_pcm_plug_channel_go,
sync_go: snd_pcm_plug_sync_go,