2 * Copyright (C) 2017 Johannes Mueller <github@johannes-mueller.org>
3 * based on a-comp (C) 2016 Damien Zammit <damien@zamaudio.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
24 #include <cairo/cairo.h>
25 #include "ardour/lv2_extensions.h"
28 #include "lv2/lv2plug.in/ns/lv2core/lv2.h"
30 #define RESET_PEAK_AFTER_SECONDS 3
32 #define AEXP_URI "urn:ardour:a-exp"
33 #define AEXP_STEREO_URI "urn:ardour:a-exp#stereo"
36 # define M_PI 3.14159265358979323846
41 #define isfinite_local(val) (bool)_finite((double)val)
43 #define isfinite_local isfinite
95 LV2_Inline_Display_Image_Surface surf;
97 cairo_surface_t* display;
98 LV2_Inline_Display* queue_draw;
101 /* ports pointers are only valid during run so we'll
102 * have to cache them for the display, besides
103 * we do want to check for changes
114 uint32_t peakdb_samples;
119 instantiate(const LV2_Descriptor* descriptor,
121 const char* bundle_path,
122 const LV2_Feature* const* features)
124 AExp* aexp = (AExp*)calloc(1, sizeof(AExp));
126 for (int i=0; features[i]; ++i) {
128 if (!strcmp(features[i]->URI, LV2_INLINEDISPLAY__queue_draw)) {
129 aexp->queue_draw = (LV2_Inline_Display*) features[i]->data;
135 aexp->tau = (1.0 - exp (-2.f * M_PI * 25.f / aexp->srate));
137 aexp->need_expose = true;
138 aexp->v_lvl_out = -70.f;
141 return (LV2_Handle)aexp;
145 connect_port(LV2_Handle instance,
149 AExp* aexp = (AExp*)instance;
151 switch ((PortIndex)port) {
153 aexp->attack = (float*)data;
156 aexp->release = (float*)data;
159 aexp->knee = (float*)data;
162 aexp->ratio = (float*)data;
165 aexp->thresdb = (float*)data;
168 aexp->makeup = (float*)data;
171 aexp->gainr = (float*)data;
174 aexp->outlevel = (float*)data;
177 aexp->inlevel = (float*)data;
180 aexp->sidechain = (float*)data;
183 aexp->enable = (float*)data;
191 connect_mono(LV2_Handle instance,
195 AExp* aexp = (AExp*)instance;
196 connect_port (instance, port, data);
198 switch ((PortIndex)port) {
200 aexp->input0 = (float*)data;
203 aexp->sc = (float*)data;
206 aexp->output0 = (float*)data;
214 connect_stereo(LV2_Handle instance,
218 AExp* aexp = (AExp*)instance;
219 connect_port (instance, port, data);
221 switch ((PortIndex)port) {
223 aexp->input0 = (float*)data;
226 aexp->input1 = (float*)data;
229 aexp->sc = (float*)data;
232 aexp->output0 = (float*)data;
235 aexp->output1 = (float*)data;
242 // Force already-denormal float value to zero
244 sanitize_denormal(float value) {
245 if (!isnormal(value)) {
253 return (exp(gdb/20.f*log(10.f)));
258 return (20.f*log10(g));
262 activate(LV2_Handle instance)
264 AExp* aexp = (AExp*)instance;
266 *(aexp->gainr) = 160.0f;
267 *(aexp->outlevel) = -45.0f;
268 *(aexp->inlevel) = -45.0f;
271 aexp->v_peakdb = -160.f;
272 aexp->peakdb_samples = 0;
277 run_mono(LV2_Handle instance, uint32_t n_samples)
279 AExp* aexp = (AExp*)instance;
281 const float* const input = aexp->input0;
282 const float* const sc = aexp->sc;
283 float* const output = aexp->output0;
285 float srate = aexp->srate;
286 float width = (6.f * *(aexp->knee)) + 0.01;
287 float attack_coeff = exp(-1000.f/(*(aexp->attack) * srate));
288 float release_coeff = exp(-1000.f/(*(aexp->release) * srate));
291 float lgaininp = 0.f;
297 int usesidechain = (*(aexp->sidechain) <= 0.f) ? 0 : 1;
303 float ratio = *aexp->ratio;
304 float thresdb = *aexp->thresdb;
305 float makeup = *aexp->makeup;
306 float makeup_target = from_dB(makeup);
307 float makeup_gain = aexp->makeup_gain;
309 const float tau = aexp->tau;
311 if (*aexp->enable <= 0) {
316 if (!aexp->was_disabled) {
318 aexp->was_disabled = true;
321 if (aexp->was_disabled) {
322 *aexp->gainr = 160.f;
323 aexp->was_disabled = false;
328 if (aexp->v_knee != *aexp->knee) {
329 aexp->v_knee = *aexp->knee;
330 aexp->need_expose = true;
333 if (aexp->v_ratio != ratio) {
334 aexp->v_ratio = ratio;
335 aexp->need_expose = true;
338 if (aexp->v_thresdb != thresdb) {
339 aexp->v_thresdb = thresdb;
340 aexp->need_expose = true;
343 if (aexp->v_makeup != makeup) {
344 aexp->v_makeup = makeup;
345 aexp->need_expose = true;
348 float in_peak_db = -160.f;
349 old_gainr = *aexp->gainr;
350 float max_gainr = 0.0;
352 for (i = 0; i < n_samples; i++) {
355 ingain = usesidechain ? fabs(sc0) : fabs(in0);
357 Lxg = (ingain==0.f) ? -160.f : to_dB(ingain);
358 Lxg = sanitize_denormal(Lxg);
360 if (Lxg > in_peak_db) {
364 if (2.f*(Lxg-thresdb) < -width) {
365 Lyg = thresdb + (Lxg-thresdb) * ratio;
366 Lyg = sanitize_denormal(Lyg);
367 } else if (2.f*(Lxg-thresdb) > width) {
370 Lyg = Lxg + (1.f-ratio)*(Lxg-thresdb-width/2.f)*(Lxg-thresdb-width/2.f)/(2.f*width);
373 current_gainr = Lxg - Lyg;
375 if (current_gainr > 160.f) {
376 current_gainr = 160.f;
379 if (current_gainr > old_gainr) {
380 current_gainr = release_coeff*old_gainr + (1.f-release_coeff)*current_gainr;
381 } else if (current_gainr < old_gainr) {
382 current_gainr = attack_coeff*old_gainr + (1.f-attack_coeff)*current_gainr;
385 current_gainr = sanitize_denormal(current_gainr);
387 Lgain = from_dB(-current_gainr);
389 old_gainr = current_gainr;
391 *(aexp->gainr) = current_gainr;
392 if (current_gainr > max_gainr) {
393 max_gainr = current_gainr;
396 lgaininp = in0 * Lgain;
398 makeup_gain += tau * (makeup_target - makeup_gain) + 1e-12;
399 output[i] = lgaininp * makeup_gain;
401 max = (fabsf(output[i]) > max) ? fabsf(output[i]) : sanitize_denormal(max);
404 *(aexp->outlevel) = (max < 0.0056f) ? -45.f : to_dB(max);
405 *(aexp->inlevel) = in_peak_db;
406 aexp->makeup_gain = makeup_gain;
409 if (in_peak_db > aexp->v_peakdb) {
410 aexp->v_peakdb = in_peak_db;
411 aexp->peakdb_samples = 0;
413 aexp->peakdb_samples += n_samples;
414 if ((float)aexp->peakdb_samples/aexp->srate > RESET_PEAK_AFTER_SECONDS) {
415 aexp->v_peakdb = in_peak_db;
416 aexp->peakdb_samples = 0;
417 aexp->need_expose = true;
421 const float v_lvl_out = (max < 0.001f) ? -1600.f : to_dB(max);
422 const float v_lvl_in = in_peak_db;
424 if (fabsf (aexp->v_lvl_out - v_lvl_out) >= .1 ||
425 fabsf (aexp->v_lvl_in - v_lvl_in) >= .1 ||
426 fabsf (aexp->v_gainr - max_gainr) >= .1) {
427 // >= 0.1dB difference
428 aexp->need_expose = true;
429 aexp->v_lvl_in = v_lvl_in;
430 aexp->v_lvl_out = v_lvl_out;
431 aexp->v_gainr = max_gainr;
433 if (aexp->need_expose && aexp->queue_draw) {
434 aexp->need_expose = false;
435 aexp->queue_draw->queue_draw (aexp->queue_draw->handle);
442 run_stereo(LV2_Handle instance, uint32_t n_samples)
444 AExp* aexp = (AExp*)instance;
446 const float* const input0 = aexp->input0;
447 const float* const input1 = aexp->input1;
448 const float* const sc = aexp->sc;
449 float* const output0 = aexp->output0;
450 float* const output1 = aexp->output1;
452 float srate = aexp->srate;
453 float width = (6.f * *(aexp->knee)) + 0.01;
454 float attack_coeff = exp(-1000.f/(*(aexp->attack) * srate));
455 float release_coeff = exp(-1000.f/(*(aexp->release) * srate));
458 float lgaininp = 0.f;
459 float rgaininp = 0.f;
463 float old_gainr = *aexp->gainr;
465 int usesidechain = (*(aexp->sidechain) <= 0.f) ? 0 : 1;
473 float ratio = *aexp->ratio;
474 float thresdb = *aexp->thresdb;
475 float makeup = *aexp->makeup;
476 float makeup_target = from_dB(makeup);
477 float makeup_gain = aexp->makeup_gain;
479 const float tau = aexp->tau;
481 if (*aexp->enable <= 0) {
486 if (!aexp->was_disabled) {
488 aexp->was_disabled = true;
491 if (aexp->was_disabled) {
492 *aexp->gainr = 160.f;
493 aexp->was_disabled = false;
498 if (aexp->v_knee != *aexp->knee) {
499 aexp->v_knee = *aexp->knee;
500 aexp->need_expose = true;
503 if (aexp->v_ratio != ratio) {
504 aexp->v_ratio = ratio;
505 aexp->need_expose = true;
508 if (aexp->v_thresdb != thresdb) {
509 aexp->v_thresdb = thresdb;
510 aexp->need_expose = true;
513 if (aexp->v_makeup != makeup) {
514 aexp->v_makeup = makeup;
515 aexp->need_expose = true;
519 float in_peak_db = -160.f;
520 old_gainr = *aexp->gainr;
521 float max_gainr = 0.0;
523 for (i = 0; i < n_samples; i++) {
527 maxabslr = fmaxf(fabs(in0), fabs(in1));
528 ingain = usesidechain ? fabs(sc0) : maxabslr;
530 Lxg = (ingain==0.f) ? -160.f : to_dB(ingain);
531 Lxg = sanitize_denormal(Lxg);
533 if (Lxg > in_peak_db) {
537 if (2.f*(Lxg-thresdb) < -width) {
538 Lyg = thresdb + (Lxg-thresdb) * ratio;
539 Lyg = sanitize_denormal(Lyg);
540 } else if (2.f*(Lxg-thresdb) > width) {
543 Lyg = Lxg + (1.f-ratio)*(Lxg-thresdb-width/2.f)*(Lxg-thresdb-width/2.f)/(2.f*width);
546 current_gainr = Lxg - Lyg;
548 if (current_gainr > 160.f) {
549 current_gainr = 160.f;
552 if (current_gainr > old_gainr) {
553 current_gainr = release_coeff*old_gainr + (1.f-release_coeff)*current_gainr;
554 } else if (current_gainr < old_gainr) {
555 current_gainr = attack_coeff*old_gainr + (1.f-attack_coeff)*current_gainr;
558 current_gainr = sanitize_denormal(current_gainr);
560 Lgain = from_dB(-current_gainr);
562 old_gainr = current_gainr;
564 *(aexp->gainr) = current_gainr;
565 if (current_gainr > max_gainr) {
566 max_gainr = current_gainr;
569 lgaininp = in0 * Lgain;
570 rgaininp = in1 * Lgain;
572 makeup_gain += tau * (makeup_target - makeup_gain) + 1e-12;
574 output0[i] = lgaininp * makeup_gain;
575 output1[i] = rgaininp * makeup_gain;
577 max = (fmaxf(fabs(output0[i]), fabs(output1[i])) > max) ? fmaxf(fabs(output0[i]), fabs(output1[i])) : sanitize_denormal(max);
580 *(aexp->outlevel) = (max < 0.0056f) ? -45.f : to_dB(max);
581 *(aexp->inlevel) = in_peak_db;
582 aexp->makeup_gain = makeup_gain;
585 if (in_peak_db > aexp->v_peakdb) {
586 aexp->v_peakdb = in_peak_db;
587 aexp->peakdb_samples = 0;
589 aexp->peakdb_samples += n_samples;
590 if ((float)aexp->peakdb_samples/aexp->srate > RESET_PEAK_AFTER_SECONDS) {
591 aexp->v_peakdb = in_peak_db;
592 aexp->peakdb_samples = 0;
593 aexp->need_expose = true;
597 const float v_lvl_out = (max < 0.001f) ? -1600.f : to_dB(max);
598 const float v_lvl_in = in_peak_db;
600 if (fabsf (aexp->v_lvl_out - v_lvl_out) >= .1 ||
601 fabsf (aexp->v_lvl_in - v_lvl_in) >= .1 ||
602 fabsf (aexp->v_gainr - max_gainr) >= .1) {
603 // >= 0.1dB difference
604 aexp->need_expose = true;
605 aexp->v_lvl_in = v_lvl_in;
606 aexp->v_lvl_out = v_lvl_out;
607 aexp->v_gainr = max_gainr;
609 if (aexp->need_expose && aexp->queue_draw) {
610 aexp->need_expose = false;
611 aexp->queue_draw->queue_draw (aexp->queue_draw->handle);
618 deactivate(LV2_Handle instance)
624 cleanup(LV2_Handle instance)
627 AExp* aexp = (AExp*)instance;
629 cairo_surface_destroy (aexp->display);
638 #define MIN(A,B) ((A) < (B)) ? (A) : (B)
643 exp_curve (const AExp* self, float xg) {
644 const float knee = self->v_knee;
645 const float ratio = self->v_ratio;
646 const float thresdb = self->v_thresdb;
647 const float makeup = self->v_makeup;
649 const float width = 6.f * knee + 0.01f;
652 if (2.f * (xg - thresdb) < -width) {
653 yg = thresdb + (xg - thresdb) * ratio;
654 } else if (2.f * (xg - thresdb) > width) {
657 yg = xg + (1.f - ratio) * (xg - thresdb - width / 2.f) * (xg - thresdb - width / 2.f) / (2.f * width);
667 render_inline_full (cairo_t* cr, const AExp* self)
669 const float w = self->w;
670 const float h = self->h;
672 const float makeup_thres = self->v_thresdb + self->v_makeup;
675 cairo_rectangle (cr, 0, 0, w, h);
676 cairo_set_source_rgba (cr, .2, .2, .2, 1.0);
679 cairo_set_line_width(cr, 1.0);
681 // draw grid 10dB steps
682 const double dash1[] = {1, 2};
683 const double dash2[] = {1, 3};
685 cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
686 cairo_set_dash(cr, dash2, 2, 2);
687 cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 0.5);
689 for (uint32_t d = 1; d < 7; ++d) {
690 const float x = -.5 + floorf (w * (d * 10.f / 70.f));
691 const float y = -.5 + floorf (h * (d * 10.f / 70.f));
693 cairo_move_to (cr, x, 0);
694 cairo_line_to (cr, x, h);
697 cairo_move_to (cr, 0, y);
698 cairo_line_to (cr, w, y);
701 cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 1.0);
702 cairo_set_dash(cr, dash1, 2, 2);
703 if (self->v_thresdb < 0) {
704 const float y = -.5 + floorf (h * ((makeup_thres - 10.f) / -70.f));
705 cairo_move_to (cr, 0, y);
706 cairo_line_to (cr, w, y);
710 cairo_move_to (cr, 0, h);
711 cairo_line_to (cr, w, 0);
716 cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 0.5);
717 const float x = -.5 + floorf (w * (60.f / 70.f));
718 const float y = -.5 + floorf (h * (10.f / 70.f));
719 cairo_move_to (cr, x, 0);
720 cairo_line_to (cr, x, h);
722 cairo_move_to (cr, 0, y);
723 cairo_line_to (cr, w, y);
728 const float x = -.5 + floorf (w * (62.5f / 70.f));
729 const float y = -.5 + floorf (h * (10.0f / 70.f));
730 const float wd = floorf (w * (5.f / 70.f));
731 const float ht = floorf (h * (55.f / 70.f));
732 cairo_rectangle (cr, x, y, wd, ht);
735 const float h_gr = fminf (ht, floorf (h * self->v_gainr / 70.f));
736 cairo_set_source_rgba (cr, 0.95, 0.0, 0.0, 1.0);
737 cairo_rectangle (cr, x, y, wd, h_gr);
739 cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 0.5);
740 cairo_rectangle (cr, x, y, wd, ht);
741 cairo_set_source_rgba (cr, 0.75, 0.75, 0.75, 1.0);
746 cairo_set_source_rgba (cr, .8, .8, .8, 1.0);
747 cairo_move_to (cr, 0, h);
749 for (uint32_t x = 0; x < w; ++x) {
751 const float x_db = 70.f * (-1.f + x / (float)w) + 10.f;
752 const float y_db = exp_curve (self, x_db) - 10.f;
753 const float y = h * (y_db / -70.f);
754 cairo_line_to (cr, x, y);
756 cairo_stroke_preserve (cr);
758 cairo_line_to (cr, w, h);
759 cairo_close_path (cr);
762 // draw signal level & reduction/gradient
763 const float top = exp_curve (self, 0) - 10.f;
764 cairo_pattern_t* pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, h);
765 if (top > makeup_thres - 10.f) {
766 cairo_pattern_add_color_stop_rgba (pat, 0.0, 0.8, 0.1, 0.1, 0.5);
767 cairo_pattern_add_color_stop_rgba (pat, top / -70.f, 0.8, 0.1, 0.1, 0.5);
769 if (self->v_knee > 0) {
770 cairo_pattern_add_color_stop_rgba (pat, ((makeup_thres -10.f) / -70.f), 0.7, 0.7, 0.2, 0.5);
771 cairo_pattern_add_color_stop_rgba (pat, ((makeup_thres - self->v_knee - 10.f) / -70.f), 0.5, 0.5, 0.5, 0.5);
773 cairo_pattern_add_color_stop_rgba (pat, ((makeup_thres - 10.f)/ -70.f), 0.7, 0.7, 0.2, 0.5);
774 cairo_pattern_add_color_stop_rgba (pat, ((makeup_thres - 10.01f) / -70.f), 0.5, 0.5, 0.5, 0.5);
776 cairo_pattern_add_color_stop_rgba (pat, 1.0, 0.5, 0.5, 0.5, 0.5);
778 // maybe cut off at x-position?
779 const float x = w * (self->v_lvl_in + 60) / 70.f;
780 const float y = x + h*self->v_makeup;
781 cairo_rectangle (cr, 0, h - y, x, y);
782 if (self->v_ratio > 1.0) {
783 cairo_set_source (cr, pat);
785 cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 0.5);
790 cairo_set_source_rgba (cr, .0f, 1.f, 0.f, 1.0);
791 cairo_set_line_width(cr, 1.0);
793 const float peak_x = w * (1.f - (10.f-self->v_peakdb)/70.f);
794 const float peak_y = h * (exp_curve (self, self->v_peakdb) - 10.f) / -70.f;
796 cairo_move_to(cr, peak_x, h);
797 cairo_line_to(cr, peak_x, peak_y);
800 cairo_pattern_destroy (pat); // TODO cache pattern
804 render_inline_only_bars (cairo_t* cr, const AExp* self)
806 const float w = self->w;
807 const float h = self->h;
809 cairo_rectangle (cr, 0, 0, w, h);
810 cairo_set_source_rgba (cr, .2, .2, .2, 1.0);
816 const float ht = 0.25f * h;
818 const float x1 = w*0.05;
819 const float wd = w - 2.0f*x1;
821 const float y1 = 0.17*h;
822 const float y2 = h - y1 - ht;
824 cairo_set_source_rgba (cr, 0.5, 0.5, 0.5, 0.5);
826 cairo_rectangle (cr, x1, y1, wd, ht);
829 cairo_rectangle (cr, x1, y2, wd, ht);
832 cairo_set_source_rgba (cr, 0.75, 0.0, 0.0, 1.0);
833 const float w_gr = (self->v_gainr > 60.f) ? wd : wd * self->v_gainr * (1.f/60.f);
834 cairo_rectangle (cr, x1+wd-w_gr, y2, w_gr, ht);
837 if (self->v_lvl_in > -60.f) {
838 if (self->v_lvl_out > 10.f) {
839 cairo_set_source_rgba (cr, 0.75, 0.0, 0.0, 1.0);
840 } else if (self->v_lvl_out > 0.f) {
841 cairo_set_source_rgba (cr, 0.66, 0.66, 0.0, 1.0);
843 cairo_set_source_rgba (cr, 0.0, 0.66, 0.0, 1.0);
845 const float w_g = (self->v_lvl_in > 10.f) ? wd : wd * (60.f+self->v_lvl_in) / 70.f;
846 cairo_rectangle (cr, x1, y1, w_g, ht);
850 cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0);
852 const float tck = 0.33*ht;
854 cairo_set_line_width (cr, .5);
856 for (uint32_t d = 1; d < 7; ++d) {
857 const float x = x1 + (d * wd * (10.f / 70.f));
859 cairo_move_to (cr, x, y1);
860 cairo_line_to (cr, x, y1+tck);
862 cairo_move_to (cr, x, y1+ht);
863 cairo_line_to (cr, x, y1+ht-tck);
865 cairo_move_to (cr, x, y2);
866 cairo_line_to (cr, x, y2+tck);
868 cairo_move_to (cr, x, y2+ht);
869 cairo_line_to (cr, x, y2+ht-tck);
874 const float x_0dB = x1 + wd*(60.f/70.f);
876 cairo_move_to (cr, x_0dB, y1);
877 cairo_line_to (cr, x_0dB, y1+ht);
879 cairo_rectangle (cr, x1, y1, wd, ht);
880 cairo_rectangle (cr, x1, y2, wd, ht);
883 cairo_set_line_width (cr, 2.0);
885 // visualize threshold
886 const float tr = x1 + wd * (60.f+self->v_thresdb) / 70.f;
887 cairo_set_source_rgba (cr, 0.95, 0.95, 0.0, 1.0);
888 cairo_move_to (cr, tr, y1);
889 cairo_line_to (cr, tr, y1+ht);
893 const float reduced_0dB = self->v_thresdb * (1.f - 1.f/self->v_ratio);
894 const float rt = x1 + wd * (60.f+reduced_0dB) / 70.f;
895 cairo_set_source_rgba (cr, 0.95, 0.0, 0.0, 1.0);
896 cairo_move_to (cr, rt, y1);
897 cairo_line_to (cr, rt, y1+ht);
901 if (self->v_peakdb > -60.f) {
902 cairo_set_source_rgba (cr, 0.0, 1.0, 0.0, 1.0);
903 const float pk = (self->v_peakdb > 10.f) ? x1+wd : wd * (60.f+self->v_peakdb) / 70.f;
904 cairo_move_to (cr, pk, y1);
905 cairo_line_to (cr, pk, y1+ht);
911 static LV2_Inline_Display_Image_Surface *
912 render_inline (LV2_Handle instance, uint32_t w, uint32_t max_h)
914 AExp* self = (AExp*)instance;
916 uint32_t h = MIN (w, max_h);
921 if (!self->display || self->w != w || self->h != h) {
922 if (self->display) cairo_surface_destroy(self->display);
923 self->display = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, w, h);
928 cairo_t* cr = cairo_create (self->display);
931 render_inline_full (cr, self);
933 render_inline_only_bars (cr, self);
938 cairo_surface_flush (self->display);
939 self->surf.width = cairo_image_surface_get_width (self->display);
940 self->surf.height = cairo_image_surface_get_height (self->display);
941 self->surf.stride = cairo_image_surface_get_stride (self->display);
942 self->surf.data = cairo_image_surface_get_data (self->display);
949 extension_data(const char* uri)
952 static const LV2_Inline_Display_Interface display = { render_inline };
953 if (!strcmp(uri, LV2_INLINEDISPLAY__interface)) {
960 static const LV2_Descriptor descriptor_mono = {
971 static const LV2_Descriptor descriptor_stereo = {
983 const LV2_Descriptor*
984 lv2_descriptor(uint32_t index)
988 return &descriptor_mono;
990 return &descriptor_stereo;