mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 00:35:42 +01:00
Changed mmap control. Removed *right* useless mode setting
This commit is contained in:
parent
84d62fd991
commit
ac470cab8e
1 changed files with 5 additions and 3 deletions
|
@ -634,6 +634,7 @@ static void set_format(void)
|
|||
snd_pcm_munmap(pcm_handle, channel);
|
||||
fcn_flush(pcm_handle, channel); /* to be in right state */
|
||||
memset(¶ms, 0, sizeof(params));
|
||||
params.mode = mode;
|
||||
params.channel = channel;
|
||||
memcpy(¶ms.format, &format, sizeof(format));
|
||||
if (channel == SND_PCM_CHANNEL_PLAYBACK) {
|
||||
|
@ -669,7 +670,6 @@ static void set_format(void)
|
|||
exit(1);
|
||||
}
|
||||
memset(&setup, 0, sizeof(setup));
|
||||
setup.mode = mode;
|
||||
setup.channel = channel;
|
||||
if (fcn_setup(pcm_handle, &setup) < 0) {
|
||||
fprintf(stderr, "%s: unable to obtain setup\n", command);
|
||||
|
@ -1213,7 +1213,8 @@ void playback_go(int fd, int loaded, u_long count, int rtype, char *name)
|
|||
}
|
||||
usleep(10000);
|
||||
}
|
||||
memcpy(mmap_data + mmap_control->fragments[frag].addr, audiobuf, buffer_size);
|
||||
/* FIXME: it's better to use snd_pcm_voice_setup data */
|
||||
memcpy(mmap_data + buffer_size * frag, audiobuf, buffer_size);
|
||||
mmap_control->fragments[frag].data = 1;
|
||||
frag++; frag %= frags;
|
||||
} else if (mode == SND_PCM_MODE_BLOCK) {
|
||||
|
@ -1291,7 +1292,8 @@ void capture_go(int fd, int loaded, u_long count, int rtype, char *name)
|
|||
}
|
||||
if (c > buffer_size)
|
||||
c = buffer_size;
|
||||
if (write(fd, mmap_data + mmap_control->fragments[frag].addr, c) != c) {
|
||||
/* FIXME: it's better to use snd_pcm_voice_setup data */
|
||||
if (write(fd, mmap_data + buffer_size * frag, c) != c) {
|
||||
perror(name);
|
||||
exit(-1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue