static int _write_frames(frames_t out_frames, bool silence, s32_t gainL, s32_t gainR, s32_t cross_gain_in, s32_t cross_gain_out, s32_t **cross_ptr) { const snd_pcm_channel_area_t *areas; snd_pcm_uframes_t offset; void *outputptr; s32_t *inputptr; int err; if (alsa.mmap) { snd_pcm_uframes_t alsa_frames = (snd_pcm_uframes_t)out_frames; snd_pcm_avail_update(pcmp); if ((err = snd_pcm_mmap_begin(pcmp, &areas, &offset, &alsa_frames)) < 0) { LOG_WARN("error from mmap_begin: %s", snd_strerror(err)); return -1; } out_frames = (frames_t)alsa_frames; } if (!silence) { // applying cross fade is delayed until this point as mmap_begin can change out_frames if (output.fade == FADE_ACTIVE && output.fade_dir == FADE_CROSS && *cross_ptr) { _apply_cross(outputbuf, out_frames, cross_gain_in, cross_gain_out, cross_ptr); } } inputptr = (s32_t *) (silence ? silencebuf : outputbuf->readp); IF_DSD( if (output.dop) { if (silence) { inputptr = (s32_t *) silencebuf_dop; } update_dop((u32_t *) inputptr, out_frames, output.invert && !silence); } ) if (alsa.mmap || alsa.format != NATIVE_FORMAT) {
static int _write_frames(frames_t out_frames, bool silence, s32_t gainL, s32_t gainR, s32_t cross_gain_in, s32_t cross_gain_out, s32_t **cross_ptr) { if (!silence) { if (output.fade == FADE_ACTIVE && output.fade_dir == FADE_CROSS && *cross_ptr) { _apply_cross(outputbuf, out_frames, cross_gain_in, cross_gain_out, cross_ptr); } if (gainL != FIXED_ONE || gainR!= FIXED_ONE) { _apply_gain(outputbuf, out_frames, gainL, gainR); } IF_DSD( if (output.dop) { update_dop_marker((u32_t *) outputbuf->readp, out_frames); } ) memcpy(optr, outputbuf->readp, out_frames * BYTES_PER_FRAME); } else {