output/jack: use std::fill()
This commit is contained in:
		| @@ -157,8 +157,7 @@ JackOutput::Process(jack_nframes_t nframes) | |||||||
| 				(jack_default_audio_sample_t *) | 				(jack_default_audio_sample_t *) | ||||||
| 				jack_port_get_buffer(ports[i], nframes); | 				jack_port_get_buffer(ports[i], nframes); | ||||||
|  |  | ||||||
| 			for (jack_nframes_t f = 0; f < nframes; ++f) | 			std::fill_n(out, nframes, 0.0); | ||||||
| 				out[f] = 0.0; |  | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		return; | 		return; | ||||||
| @@ -181,9 +180,8 @@ JackOutput::Process(jack_nframes_t nframes) | |||||||
| 		jack_ringbuffer_read(ringbuffer[i], | 		jack_ringbuffer_read(ringbuffer[i], | ||||||
| 				     (char *)out, available * jack_sample_size); | 				     (char *)out, available * jack_sample_size); | ||||||
|  |  | ||||||
| 		for (jack_nframes_t f = available; f < nframes; ++f) |  | ||||||
| 		/* ringbuffer underrun, fill with silence */ | 		/* ringbuffer underrun, fill with silence */ | ||||||
| 			out[f] = 0.0; | 		std::fill(out + available, out + nframes, 0.0); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/* generate silence for the unused source ports */ | 	/* generate silence for the unused source ports */ | ||||||
| @@ -199,8 +197,7 @@ JackOutput::Process(jack_nframes_t nframes) | |||||||
| 			   buffer */ | 			   buffer */ | ||||||
| 			continue; | 			continue; | ||||||
|  |  | ||||||
| 		for (jack_nframes_t f = 0; f < nframes; ++f) | 		std::fill_n(out, nframes, 0.0); | ||||||
| 			out[f] = 0.0; |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -540,8 +537,8 @@ JackOutput::Start(Error &error) | |||||||
| 	if (audio_format.channels >= 2 && num_dports == 1) { | 	if (audio_format.channels >= 2 && num_dports == 1) { | ||||||
| 		/* mix stereo signal on one speaker */ | 		/* mix stereo signal on one speaker */ | ||||||
|  |  | ||||||
| 		while (num_dports < audio_format.channels) | 		std::fill(dports + num_dports, dports + audio_format.channels, | ||||||
| 			dports[num_dports++] = dports[0]; | 			  dports[0]); | ||||||
| 	} else if (num_dports > audio_format.channels) { | 	} else if (num_dports > audio_format.channels) { | ||||||
| 		if (audio_format.channels == 1 && num_dports > 2) { | 		if (audio_format.channels == 1 && num_dports > 2) { | ||||||
| 			/* mono input file: connect the one source | 			/* mono input file: connect the one source | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann