Commit e7b72605 authored by Jaromír Mikeš's avatar Jaromír Mikeš

Imported Upstream version 20131206

parent 39956a88
2013-12-06 (0.2.0) Robin Gareus <robin@gareus.org>
* add tuna.lv2
* include gitversion.mak in dist-tarball
2013-11-19 (0.2.0) Robin Gareus <robin@gareus.org>
* include list of plugins & version with dist
* augment and submodules (see plugin.list)
......
#!/usr/bin/make
-include gitversion.mak
export RW=../robtk/
###############################################################################
VERSION ?=$(shell date +%Y%m%d)
SUBDIRS = balance.lv2 convoLV2 nodelay.lv2 xfade.lv2 \
midifilter.lv2 meters.lv2 sisco.lv2
midifilter.lv2 meters.lv2 sisco.lv2 tuna.lv2
all clean install uninstall: submodule_check $(SUBDIRS)
$(SUBDIRS)::
$(MAKE) -C $@ $(MAKECMDGOALS) RW=../robtk/
$(MAKE) -C $@ $(MAKECMDGOALS)
###############################################################################
......
export balance_VERSION=0.4.3
export convoLV2_VERSION=0.2.2
export meters_VERSION=0.7.1
export midifilter_VERSION=0.2.0
export nodelay_VERSION=0.1.2
export robtk_VERSION=0.1.1-5
export sisco_VERSION=0.5-8
export tuna_VERSION=0.2-2
export xfade_VERSION=0.1.1
......@@ -223,7 +223,7 @@ ifneq ($(BUILDGTK), no)
lv2ttl/$(LV2NAME).lv2.ttl.in >> $(BUILDDIR)$(LV2NAME).ttl
endif
$(BUILDDIR)$(LV2NAME)$(LIB_EXT): src/meters.cc $(DSPDEPS) src/ebulv2.cc src/uris.h src/goniometerlv2.c src/goniometer.h src/spectrumlv2.c Makefile
$(BUILDDIR)$(LV2NAME)$(LIB_EXT): src/meters.cc $(DSPDEPS) src/ebulv2.cc src/uris.h src/goniometerlv2.c src/goniometer.h src/spectrumlv2.c src/spectr.c Makefile
@mkdir -p $(BUILDDIR)
$(CXX) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) \
-o $(BUILDDIR)$(LV2NAME)$(LIB_EXT) src/$(LV2NAME).cc $(DSPSRC) \
......
......@@ -10,14 +10,15 @@ It includes needle style meters (mono and stereo variants)
* IEC 60268-10 Type IIa / BBC
* IEC 60268-10 Type IIb / EBU
* IEC 60268-17 / VU
* 30 Band 1/3 octave spectrum analyzer IEC 61260
* Digital True-Peak Meter (4x Oversampling), Type II rise-time, 13.3dB/s falloff.
and the following stereo plugins
* Stereo Phase Correlation Meter (Needle Display)
* EBU R128 Meter with Histogram and History
* Stereo Phase Correlation Meter (Needle Display)
* Digital True-Peak Meter (4x Oversampling)
* Goniometer (Stereo Phase Scope)
* 31 Band Spectrum-Analyzer
Currently the plugins come in both Gtk and openGL variants (both
versions are installed in parallel).
......@@ -31,6 +32,7 @@ Should be pretty much self-explanatory. A few notes:
* click + drag on the calibration-screw allows to modify the reference
level of the needle meters
* shift + click on the calibration-screw resets to default
* ctrl + click on meters with scalable GUI resets the window-size to 100%
* clicking anywhere on the bar-graph meters resets the peak-hold
Install
......@@ -42,6 +44,7 @@ gtk+2.0, libpango, libcairo and openGL (sometimes called: glu, glx, mesa).
```bash
git clone git://github.com/x42/meters.lv2.git
cd meters.lv2
make submodules
make
sudo make install PREFIX=/usr
......
This diff is collapsed.
......@@ -192,14 +192,6 @@ static inline float fast_log10 (const float val)
return fast_log2(val) * 0.301029996f;
}
static inline float coef_to_db (const float val) {
if (val == 0) return -INFINITY;
#if 1
return 20.0 * log10f(val);
#else
return 20.0 * fast_log10(val);
#endif
}
static float radar_deflect(const float v, const float r) {
......@@ -549,7 +541,7 @@ static bool expose_event(RobWidget* handle, cairo_t* cr, cairo_rectangle_t *ev)
redraw_part |= 1;
}
}
ui->fasttracked[0] = ui->fasttracked[1] = ui->fasttracked[2] = ui->fasttracked[4] = ui->fasttracked[3] = false;
ui->fasttracked[0] = ui->fasttracked[1] = ui->fasttracked[2] = ui->fasttracked[3] = ui->fasttracked[4] = false;
ui->fasthist = false;
ui->fastradar = -1;
......@@ -613,7 +605,7 @@ static bool expose_event(RobWidget* handle, cairo_t* cr, cairo_rectangle_t *ev)
/* true-peak val */
ui->prev_lvl[4] = ui->tp;
sprintf(buf, "%+5.1f", coef_to_db(ui->tp));
sprintf(buf, "%+5.1f", ui->tp);
write_text(cr, buf, FONT(FONT_M09), COORD_TP_X+65, COORD_ML_Y+5, 0, 7, c_wht);
write_text(cr, "dBTP", FONT(FONT_M09), COORD_TP_X+65, COORD_ML_Y+19, 0, 7, c_wht);
}
......@@ -953,7 +945,7 @@ static void invalidate_changed(EBUrUI* ui, int what) {
if (what == -1) {
queue_draw(ui->m0);
ui->fasttracked[0] = ui->fasttracked[1] = ui->fasttracked[2] = ui->fasttracked[3] = true;
ui->fasttracked[0] = ui->fasttracked[1] = ui->fasttracked[2] = ui->fasttracked[3] = ui->fasttracked[4] = true;
ui->fasthist = true;
return;
}
......@@ -968,14 +960,12 @@ static void invalidate_changed(EBUrUI* ui, int what) {
}
}
if (what == 0 && !ui->fasttracked[4]) {
if (what == 0 && !ui->fasttracked[4] && robtk_cbtn_get_active(ui->cbx_truepeak)) {
// true peak display
if (rintf(ui->tp * 10.0f) != rintf(ui->prev_lvl[4] * 10.0f)) {
ui->fasttracked[4] = true;
if (robtk_cbtn_get_active(ui->cbx_truepeak)) {
queue_tiny_area(ui->m0, COORD_TP_X, COORD_ML_Y, 75, 38); // top left side
//queue_tiny_area(ui->m0, COORD_TP_X+10, COORD_ML_Y+25, 40, 30); // top left side tab
}
queue_tiny_area(ui->m0, COORD_TP_X, COORD_ML_Y, 75, 38); // top left side
//queue_tiny_area(ui->m0, COORD_TP_X+10, COORD_ML_Y+25, 40, 30); // top left side tab
}
}
......@@ -1295,7 +1285,7 @@ instantiate(
robtk_spin_label_width(ui->spn_radartime, 32.0, -1);
int row = 0; // left side
rob_table_attach((ui->cbx_box), GLB_W(ui->lbl_ringinfo), 0, 2, row, row+1, 3, 0);
rob_table_attach((ui->cbx_box), GLB_W(ui->lbl_ringinfo), 0, 2, row, row+1, 3, 0, RTK_EXANDF, RTK_SHRINK);
row++;
rob_table_attach_defaults(ui->cbx_box, robtk_sep_widget(ui->sep_h0), 0, 2, row, row+1);
row++;
......@@ -1323,14 +1313,14 @@ instantiate(
row++;
rob_table_attach_defaults(ui->cbx_box, robtk_sep_widget(ui->sep_h1), 3, 5, row, row+1);
row++;
rob_table_attach(ui->cbx_box, GLB_W(ui->lbl_radarinfo), 3, 4, row, row+1, 3, 0);
rob_table_attach(ui->cbx_box, GSP_W(ui->spn_radartime), 4, 5, row, row+1, 3, 0);
rob_table_attach(ui->cbx_box, GLB_W(ui->lbl_radarinfo), 3, 4, row, row+1, 3, 0, RTK_EXANDF, RTK_SHRINK);
rob_table_attach(ui->cbx_box, GSP_W(ui->spn_radartime), 4, 5, row, row+1, 3, 0, RTK_EXANDF, RTK_SHRINK);
row++;
rob_table_attach_defaults(ui->cbx_box, GBT_W(ui->cbx_autoreset), 3, 4, row, row+1);
rob_table_attach(ui->cbx_box, GPB_W(ui->btn_reset), 4, 5, row, row+1, 3, 1);
rob_table_attach(ui->cbx_box, GPB_W(ui->btn_reset), 4, 5, row, row+1, 3, 1, RTK_EXANDF, RTK_EXANDF);
row++;
rob_table_attach_defaults(ui->cbx_box, GBT_W(ui->cbx_transport), 3, 4, row, row+1);
rob_table_attach(ui->cbx_box, GBT_W(ui->btn_start), 4, 5, row, row+1, 3, 1);
rob_table_attach(ui->cbx_box, GBT_W(ui->btn_start), 4, 5, row, row+1, 3, 1, RTK_EXANDF, RTK_EXANDF);
row++;
rob_table_attach_defaults(ui->cbx_box, GRB_W(ui->cbx_hist_mom) , 3, 4, row, row+1);
rob_table_attach_defaults(ui->cbx_box, GRB_W(ui->cbx_hist_short), 4, 5, row, row+1);
......
......@@ -1197,44 +1197,44 @@ instantiate(
/* layout */
int row = 0;
rob_table_attach((ui->c_tbl), robtk_sep_widget(ui->sep_h0), 0, 5, row, row+1, 0, 4);
rob_table_attach((ui->c_tbl), robtk_sep_widget(ui->sep_h0), 0, 5, row, row+1, 0, 4, RTK_EXANDF, RTK_SHRINK);
row++;
rob_table_attach_defaults((ui->c_tbl), robtk_scale_widget(ui->fader), 0, 5, row, row+1);
row++;
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_gattack) , 0, 1, row, row+1, 4, 0);
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_gattack) , 0, 1, row, row+1, 4, 0, RTK_SHRINK, RTK_SHRINK);
rob_table_attach_defaults((ui->c_tbl), GED_W(ui->spn_gattack) , 1, 2, row, row+1);
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_gdecay) , 3, 4, row, row+1, 4, 0);
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_gdecay) , 3, 4, row, row+1, 4, 0, RTK_SHRINK, RTK_SHRINK);
rob_table_attach_defaults((ui->c_tbl), GED_W(ui->spn_gdecay) , 4, 5, row, row+1);
row++;
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_gtarget) , 0, 1, row, row+1, 4, 0);
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_gtarget) , 0, 1, row, row+1, 4, 0, RTK_SHRINK, RTK_SHRINK);
rob_table_attach_defaults((ui->c_tbl), GED_W(ui->spn_gtarget) , 1, 2, row, row+1);
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_grms) , 3, 4, row, row+1, 4, 0);
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_grms) , 3, 4, row, row+1, 4, 0, RTK_SHRINK, RTK_SHRINK);
rob_table_attach_defaults((ui->c_tbl), GED_W(ui->spn_grms) , 4, 5, row, row+1);
row++;
rob_table_attach((ui->c_tbl), robtk_sep_widget(ui->sep_h1), 0, 5, row, row+1, 0, 4);
rob_table_attach((ui->c_tbl), robtk_sep_widget(ui->sep_h1), 0, 5, row, row+1, 0, 4, RTK_EXANDF, RTK_SHRINK);
row++;
rob_table_attach((ui->c_tbl), robtk_sep_widget(ui->sep_v0), 2, 3, row, row+3, 6, 0);
rob_table_attach((ui->c_tbl), robtk_sep_widget(ui->sep_v0), 2, 3, row, row+3, 6, 0, RTK_SHRINK, RTK_FILL);
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_src_fact) , 0, 1, row, row+1, 4, 0);
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_src_fact) , 0, 1, row, row+1, 4, 0, RTK_SHRINK, RTK_SHRINK);
rob_table_attach_defaults((ui->c_tbl), GSP_W(ui->spn_src_fact), 1, 2, row, row+1);
rob_table_attach((ui->c_tbl), GBT_W(ui->cbn_xfade) , 3, 4, row, row+1, 4, 0);
rob_table_attach((ui->c_tbl), GBT_W(ui->cbn_xfade) , 3, 4, row, row+1, 4, 0, RTK_SHRINK, RTK_SHRINK);
rob_table_attach_defaults((ui->c_tbl), GED_W(ui->spn_alpha) , 4, 5, row, row+1);
row++;
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_psize) , 0, 1, row, row+1, 4, 0);
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_psize) , 0, 1, row, row+1, 4, 0, RTK_SHRINK, RTK_SHRINK);
rob_table_attach_defaults((ui->c_tbl), GSP_W(ui->spn_psize) , 1, 2, row, row+1);
row++;
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_vfreq) , 0, 1, row, row+1, 4, 0);
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_vfreq) , 0, 1, row, row+1, 4, 0, RTK_SHRINK, RTK_SHRINK);
rob_table_attach_defaults((ui->c_tbl), GSP_W(ui->spn_vfreq) , 1, 2, row, row+1);
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_compress) , 3, 4, row, row+1, 4, 0);
rob_table_attach((ui->c_tbl), GLB_W(ui->lbl_compress) , 3, 4, row, row+1, 4, 0, RTK_SHRINK, RTK_SHRINK);
rob_table_attach_defaults((ui->c_tbl), GED_W(ui->spn_compress), 4, 5, row, row+1);
/* button box packing */
......
......@@ -65,7 +65,12 @@ mtr:goniometer@URI_SUFFIX@
lv2:binary <@LV2NAME@@LIB_EXT@> ;
rdfs:seeAlso <@LV2NAME@.ttl> .
mtr:spectrum@URI_SUFFIX@
mtr:spectr30mono@URI_SUFFIX@
a lv2:Plugin ;
lv2:binary <@LV2NAME@@LIB_EXT@> ;
rdfs:seeAlso <@LV2NAME@.ttl> .
mtr:spectr30stereo@URI_SUFFIX@
a lv2:Plugin ;
lv2:binary <@LV2NAME@@LIB_EXT@> ;
rdfs:seeAlso <@LV2NAME@.ttl> .
......
This diff is collapsed.
......@@ -53,7 +53,7 @@ static void ebu_reset(LV2meter* self) {
self->integration_time = 0;
self->hist_maxM = 0;
self->hist_maxS = 0;
self->tp_max = 0;
self->tp_max = -INFINITY;
}
static void ebu_integrate(LV2meter* self, bool on) {
......@@ -176,7 +176,7 @@ ebur128_instantiate(
self->integration_time = 0;
self->hist_maxM = 0;
self->hist_maxS = 0;
self->tp_max = 0;
self->tp_max = -INFINITY;
self->ebu = new Ebu_r128_proc();
self->ebu->init (2, rate);
......@@ -215,6 +215,11 @@ ebur128_connect_port(LV2_Handle instance, uint32_t port, void* data)
}
}
static inline float coef_to_db (const float val) {
if (val == 0) return -INFINITY;
return 20.0 * log10f(val);
}
#define DEBUG_FORGE(VAR,NAME) \
static uint32_t max_cap##VAR = 0; \
if (self->notify->atom.size > max_cap##VAR) { \
......@@ -346,10 +351,10 @@ ebur128_run(LV2_Handle instance, uint32_t n_samples)
if (self->dbtp_enable) {
const float tp0 = self->mtr[0]->read();
const float tp1 = self->mtr[1]->read();
const float tp = tp0 > tp1 ? tp0 : tp1;
const float tp = coef_to_db(tp0 > tp1 ? tp0 : tp1);
if (tp > self->tp_max) self->tp_max = tp;
} else {
self->tp_max = 0;
self->tp_max = -INFINITY;
}
if (self->radar_resync >= 0) {
......
......@@ -498,7 +498,7 @@ lv2_descriptor(uint32_t index)
case 10: return &descriptorCor;
case 11: return &descriptorEBUr128;
case 12: return &descriptorGoniometer;
case 13: return &descriptorSpectrum;
case 13: return &descriptorSpectrum1;
case 14: return &descriptor14;
case 15: return &descriptor15;
case 16: return &descriptor16;
......@@ -512,7 +512,7 @@ lv2_descriptor(uint32_t index)
case 24: return &descriptor24;
case 25: return &descriptor25;
case 26: return &descriptorGoniometerGtk;
case 27: return &descriptorSpectrumGtk;
case 27: return &descriptorSpectrum1Gtk;
case 28: return &descriptorCorGtk;
case 29: return &descriptor29;
case 30: return &descriptor30;
......@@ -529,6 +529,8 @@ lv2_descriptor(uint32_t index)
case 41: return &descriptor41;
case 42: return &descriptor42;
case 43: return &descriptor43;
case 44: return &descriptorSpectrum2;
case 45: return &descriptorSpectrum2Gtk;
default: return NULL;
}
}
/* Bandpass filter
*
* Copyright (C) 2013 Robin Gareus <robin@gareus.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
#include <assert.h>
#if __cplusplus >= 201103L || defined __APPLE__
# include <complex>
# define csqrt(XX) std::sqrt(XX)
# define creal(XX) std::real(XX)
# define cimag(XX) std::imag(XX)
# define _I ((complex_t)(1i))
typedef std::complex<double> complex_t;
#else
# include <complex.h>
# define _I I
typedef _Complex double complex_t;
#endif
enum filterCoeff {a0 = 0, a1, a2, b0, b1, b2};
enum filterState {z1 = 0, z2};
#define NODENORMAL (1e-12)
struct Filter {
double W[6];
double z[2];
};
struct FilterBank {
struct Filter f[6];
uint32_t filter_stages;
bool ac;
};
static inline double
proc_one(struct Filter * const f, const double in)
{
const double w = in - f->W[a1]*f->z[z1] - f->W[a2]*f->z[z2];
const double out = f->W[b0]*w + f->W[b1]*f->z[z1] + f->W[b2]*f->z[z2];
f->z[z2] = f->z[z1];
f->z[z1] = w;
return out;
}
static inline float
bandpass_process(struct FilterBank * const fb, float in)
{
fb->ac = !fb->ac;
double out = in + ((fb->ac) ? NODENORMAL : -NODENORMAL);
for (uint32_t i = 0; i < fb->filter_stages; ++i) {
out = proc_one(&fb->f[i], out);
}
return out;
}
static void
bandpass_setup(struct FilterBank *fb,
double rate,
double freq,
double band,
int order
) {
/* must be an even number for the algorithm below */
fb->filter_stages = order;
assert (order > 0 && (order%2) == 0);
assert (band > 0);
for (uint32_t i = 0; i < fb->filter_stages; ++i) {
fb->f[i].z[z1] = fb->f[i].z[z2] = 0;
}
const double _wc = 2. * M_PI * freq / rate;
const double _ww = 2. * M_PI * band / rate;
double wl = _wc - (_ww / 2.);
double wu = _wc + (_ww / 2.);
if (wu > M_PI - 1e-9) {
/* limit band to below nyquist */
wu = M_PI - 1e-9;
fprintf(stderr, "spectr.lv2: band f:%9.2fHz (%.2fHz -> %.2fHz) exceeds nysquist (%.0f/2)\n",
freq, freq-band/2, freq+band/2, rate);
fprintf(stderr, "spectr.lv2: shifted to f:%.2fHz (%.2fHz -> %.2fHz)\n",
rate * (wu + wl) *.25 / M_PI,
rate * wl * .5 / M_PI,
rate * wu * .5 / M_PI);
}
if (wl < 1e-9) {
/* this is just for completeness, it cannot happen with spectr.lv2 */
wl = 1e-9;
fprintf(stderr, "spectr.lv2: band f:%9.2fHz (%.2fHz -> %.2fHz) contains sub-bass frequencies\n",
freq, freq-band/2, freq+band/2);
fprintf(stderr, "spectr.lv2: shifted to f:%.2fHz (%.2fHz -> %.2fHz)\n",
rate * (wu + wl) *.25 / M_PI,
rate * wl * .5 / M_PI,
rate * wu * .5 / M_PI);
}
wu *= .5; wl *= .5;
assert (wu > wl);
const double c_a = cos (wu + wl) / cos (wu - wl);
const double c_b = 1. / tan (wu - wl);
const double w = 2. * atan (sqrt (tan (wu) * tan(wl)));
const double c_a2 = c_a * c_a;
const double c_b2 = c_b * c_b;
const double ab_2 = 2. * c_a * c_b;
/* bilinear transform coefficients into z-domain */
for (uint32_t i = 0; i < fb->filter_stages / 2; ++i) {
const double omega = M_PI_2 + (2 * i + 1) * M_PI / (2. * (double)fb->filter_stages);
complex_t p = cos (omega) + _I * sin (omega);
const complex_t c = (1. + p) / (1. - p);
const complex_t d = 2 * (c_b - 1) * c + 2 * (1 + c_b);
complex_t v;
v = (4 * (c_b2 * (c_a2 - 1) + 1)) * c;
v += 8 * (c_b2 * (c_a2 - 1) - 1);
v *= c;
v += 4 * (c_b2 * (c_a2 - 1) + 1);
v = csqrt (v);
const complex_t u0 = ab_2 + creal(-v) + ab_2 * creal(c) + _I * (cimag(-v) + ab_2 * cimag(c));
const complex_t u1 = ab_2 + creal( v) + ab_2 * creal(c) + _I * (cimag( v) + ab_2 * cimag(c));
#define ASSIGN_BP(FLT, PC, odd) \
{ \
const complex_t P = PC; \
(FLT).W[a0] = 1.; \
(FLT).W[a1] = -2 * creal(P); \
(FLT).W[a2] = creal(P) * creal(P) + cimag(P) * cimag(P); \
(FLT).W[b0] = 1.; \
(FLT).W[b1] = (odd) ? -2. : 2.; \
(FLT).W[b2] = 1.; \
}
ASSIGN_BP(fb->f[2*i], u0/d, 0);
ASSIGN_BP(fb->f[2*i+1], u1/d, 1);
#undef ASSIGN_BP
}
/* normalize */
const double cos_w = cos (-w);
const double sin_w = sin (-w);
const double cos_w2 = cos (-2. * w);
const double sin_w2 = sin (-2. * w);
complex_t ch = 1;
complex_t cb = 1;
for (uint32_t i = 0; i < fb->filter_stages; ++i) {
ch *= ((1 + fb->f[i].W[b1] * cos_w) + cos_w2)
+ _I * ((fb->f[i].W[b1] * sin_w) + sin_w2);
cb *= ((1 + fb->f[i].W[a1] * cos_w) + fb->f[i].W[a2] * cos_w2)
+ _I * ((fb->f[i].W[a1] * sin_w) + fb->f[i].W[a2] * sin_w2);
}
const complex_t scale = cb / ch;
fb->f[0].W[b0] *= creal(scale);
fb->f[0].W[b1] *= creal(scale);
fb->f[0].W[b2] *= creal(scale);
#ifdef DEBUG_SPECTR
printf("SCALE (%g, %g)\n", creal(scale), cimag(scale));
for (uint32_t i = 0; i < fb->filter_stages; ++i) {
struct Filter *flt = &fb->f[i];
printf("%d: %g %g %g %+g %+g %+g\n", i,
flt->W[a0], flt->W[a1], flt->W[a2],
flt->W[b0], flt->W[b1], flt->W[b2]);
}
#endif
}
This diff is collapsed.
......@@ -6,3 +6,4 @@ git://github.com/x42/nodelay.lv2
git://github.com/x42/sisco.lv2
git://github.com/x42/robtk
git://github.com/x42/xfade.lv2
git://github.com/x42/tuna.lv2
balance.lv2 v0.4.3
convoLV2 v0.2.2
meters.lv2 v0.7.0
meters.lv2 v0.7.1
midifilter.lv2 v0.2.0
nodelay.lv2 v0.1.2
robtk v0.1.0
sisco.lv2 v0.4
robtk v0.1.1-5-g68d9384
sisco.lv2 v0.5
tuna.lv2 v0.2
xfade.lv2 v0.1.1
......@@ -24,6 +24,11 @@
//#define DEBUG_VBOX
//#define DEBUG_TABLE
#define RTK_SHRINK 0
#define RTK_EXPAND 1
#define RTK_FILL 2
#define RTK_EXANDF 3
struct rob_container {
bool homogeneous;
bool expand;
......@@ -38,6 +43,8 @@ struct rob_table_child {
int bottom;
int xpadding;
int ypadding;
int expand_x;
int expand_y;
};
struct rob_table_field {
......@@ -162,7 +169,8 @@ static void rcontainer_clear_bg(RobWidget* rw, cairo_t* cr, cairo_rectangle_t *e
event.x = ev->x - c->area.x; \
event.y = ev->y - c->area.y; \
event.state = ev->state; \
event.direction = ev->direction;
event.direction = ev->direction; \
event.button = ev->button;
static RobWidget* rcontainer_mousedown(RobWidget* handle, RobTkBtnEvent *ev) {
RobWidget * rw = (RobWidget*)handle;
......@@ -239,6 +247,11 @@ static bool rcontainer_expose_event(RobWidget* rw, cairo_t* cr, cairo_rectangle_
cairo_save(cr);
cairo_translate(cr, c->area.x, c->area.y);
c->expose_event(c, cr, &event);
#if 0 // VISUAL LAYOUT DEBUG -- NB. expose_event may or may not alter event
cairo_rectangle(cr, event.x, event.y, event.width, event.height);
cairo_set_source_rgba(cr, rand()/(float)RAND_MAX, rand()/(float)RAND_MAX, rand()/(float)RAND_MAX, 0.5);
cairo_fill(cr);
#endif
cairo_restore(cr);
}
if (rw->resized) {
......@@ -309,7 +322,7 @@ static void rhbox_size_allocate(RobWidget* rw, int w, int h) {
int padding = ((struct rob_container*)rw->self)->padding;
bool expand = ((struct rob_container*)rw->self)->expand;
if (w < rw->area.width) {
printf(" !!! hbox packing error\n");
printf(" !!! hbox packing error alloc:%d, widget:%.1f\n", w, rw->area.width);
w = rw->area.width;
}
float xtra_space = 0;
......@@ -488,7 +501,7 @@ static void rvbox_size_allocate(RobWidget* rw, int w, int h) {
int padding = ((struct rob_container*)rw->self)->padding;
bool expand = ((struct rob_container*)rw->self)->expand;
if (h < rw->area.height) {
printf(" !!! vbox packing error %d vs %.1f\n", h, rw->area.height);
printf(" !!! vbox packing error alloc:%d, widget:%.1f\n", h, rw->area.height);
h = rw->area.height;
}
float xtra_space = 0;
......@@ -662,18 +675,24 @@ rtable_size_request(RobWidget* rw, int *w, int *h) {
#ifdef DEBUG_TABLE
printf("widget %d wants (%d x %d) x-span:%d y-span: %d\n", i, cw, ch, (tc->right - tc->left), (tc->bottom - tc->top));
#endif
int curw = 0, curh = 0;
for (int span_x = tc->left; span_x < tc->right; ++span_x) {
curw += rt->cols[span_x].req_w;
}
for (int span_y = tc->top; span_y < tc->bottom; ++span_y) {
curh += rt->rows[span_y].req_h;
}
for (int span_x = tc->left; span_x < tc->right; ++span_x) {
rt->cols[span_x].req_w = MAX(rt->cols[span_x].req_w, cw / (tc->right - tc->left)); // XXX
rt->cols[span_x].req_w += ceil(MAX(0, cw - curw) / (float)(tc->right - tc->left));
rt->cols[span_x].req_h = MAX(rt->cols[span_x].req_h, ch); // unused -- homog
if (can_expand) {
if (can_expand && (tc->expand_x & RTK_EXPAND)) {
rt->cols[span_x].is_expandable_x = TRUE;
}
}
for (int span_y = tc->top; span_y < tc->bottom; ++span_y) {
rt->rows[span_y].req_w = MAX(rt->rows[span_y].req_w, cw); // unused -- homog
rt->rows[span_y].req_h = MAX(rt->rows[span_y].req_h, ch / (tc->bottom - tc->top)); // XXX
if (can_expand) {
rt->rows[span_y].req_h += ceil(MAX(0, ch - curh) / (float)(tc->bottom - tc->top));
if (can_expand && (tc->expand_y & RTK_EXPAND)) {
rt->rows[span_y].is_expandable_y = TRUE;
}
}
......@@ -816,32 +835,29 @@ static void rtable_size_allocate(RobWidget* rw, int w, int h) {
if (rt->rows[tri].req_h != 0 && rt->rows[tri].is_expandable_y) xpandy++;
}
c->size_allocate(c,
cw + floorf(xtra_width * xpandy),
cw + floorf(xtra_width * xpandx),
ch + floorf(xtra_height * xpandy));
#if 0
/* or rather assume child swallowed it all */
//c->area.width = cw + xtra_width * (tc->right - tc->left);
//c->area.height = ch + xtra_height * (tc->bottom - tc->top);
#endif
cw = c->area.width;
ch = c->area.height;
}
/* distribute evenly over span */
ch /= (tc->bottom - tc->top);
cw /= (tc->right - tc->left);
for (int span_y = tc->top; span_y < tc->bottom; ++span_y) {
rt->rows[span_y].acq_h = MAX(rt->rows[span_y].acq_h, ch + xtra_height * xpandy);
}
for (int span_x = tc->left; span_x < tc->right; ++span_x) {
rt->cols[span_x].acq_w = MAX(rt->cols[span_x].acq_w, cw + xtra_width * xpandx);
}
} else {
ch /= (tc->bottom - tc->top);
cw /= (tc->right - tc->left);
for (int span_y = tc->top; span_y < tc->bottom; ++span_y) {
rt->rows[span_y].acq_h = MAX(rt->rows[span_y].acq_h, ch);
}
for (int span_x = tc->left; span_x < tc->right; ++span_x) {
rt->cols[span_x].acq_w = MAX(rt->cols[span_x].acq_w, cw);
}
int curw = 0, curh = 0;
for (int span_x = tc->left; span_x < tc->right; ++span_x) {
curw += rt->cols[span_x].acq_w;
}
for (int span_y = tc->top; span_y < tc->bottom; ++span_y) {
curh += rt->rows[span_y].acq_h;
}
for (int span_y = tc->top; span_y < tc->bottom; ++span_y) {
rt->rows[span_y].acq_h += ceil(MAX(0, ch - curh) / (tc->bottom - tc->top));
}
for (int span_x = tc->left; span_x < tc->right; ++span_x) {
rt->cols[span_x].acq_w += ceil(MAX(0, cw - curw) / (float)(tc->right - tc->left));
}
#ifdef DEBUG_TABLE
dump_tbl_acq(rt);
......@@ -878,14 +894,18 @@ static void rtable_size_allocate(RobWidget* rw, int w, int h) {
#ifdef DEBUG_TABLE
printf("TABLECHILD %d avail %dx%d at %d+%d (wsize: %.1fx%.1f)\n", i, cw, ch, cx, cy, c->area.width, c->area.height);
#endif
#if 1
if (c->size_allocate) {
c->size_allocate(c, cw, ch);
int aw = c->area.width;
int ah = c->area.height;
if (tc->expand_x & RTK_FILL) aw = MAX(cw,aw);
if (tc->expand_y & RTK_FILL) ah = MAX(ch,ah);
c->size_allocate(c, aw, ah);
#ifdef DEBUG_TABLE