mmap(2) may reduce copies between user space and the kernel compared to write(2). Generally speaking, yes. But your patch seems to increase memcpy(3) instead of decreasing write(2) system call.In audioplay, well, if the audio device is mmapped 1 call to write is replaced with 1 call to memcpy. This is perfectly normal. write(2) probably uses memcpy(3)? As you say, there's less copies between user space and kernel. In user space: no more no less.
You are right in the situation where the audio file cannot be mmapped and the audio
device can. Here I do read in an intermediate buffer, which is useless. There is clearly work to be done.