diff options
| author | David Robillard <d@drobilla.net> | 2016-10-05 18:59:34 -0400 | 
|---|---|---|
| committer | David Robillard <d@drobilla.net> | 2016-10-05 18:59:34 -0400 | 
| commit | b5d63916aec46ffd71d982bd39f902a71f972c96 (patch) | |
| tree | 13e1363576bdc10ba46e9cfc6c4120102af170b5 | |
| parent | 741586ae2aa4f928296a2b4c2dc03830ffaff833 (diff) | |
| download | lv2-b5d63916aec46ffd71d982bd39f902a71f972c96.tar.xz | |
Avoid repeatedly requesting the same peaks
| -rw-r--r-- | plugins/eg-sampler.lv2/sampler_ui.c | 5 | 
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/eg-sampler.lv2/sampler_ui.c b/plugins/eg-sampler.lv2/sampler_ui.c index 9ea662c..ac4601a 100644 --- a/plugins/eg-sampler.lv2/sampler_ui.c +++ b/plugins/eg-sampler.lv2/sampler_ui.c @@ -102,6 +102,10 @@ on_play_clicked(GtkFileChooserButton* widget, void* handle)  static void  request_peaks(SamplerUI* ui, uint32_t n_peaks)  { +	if (n_peaks == ui->requested_n_peaks) { +		return; +	} +  	lv2_atom_forge_set_buffer(&ui->forge, ui->forge_buf, sizeof(ui->forge_buf));  	LV2_Atom_Forge_Frame frame; @@ -292,6 +296,7 @@ port_event(LV2UI_Handle handle,  					gtk_file_chooser_set_filename(  						GTK_FILE_CHOOSER(ui->file_button), path);  					peaks_receiver_clear(&ui->precv); +					ui->requested_n_peaks = 0;  					request_peaks(ui, ui->width / 2 * 2);  				} else if (!path) {  					lv2_log_warning(&ui->logger, "Set message has no path\n");  |