mirror of
https://github.com/alexkay/spek.git
synced 2025-04-21 02:47:37 +03:00
Spectral density ruler
This commit is contained in:
parent
a741fb0d22
commit
025d0bbe1e
@ -93,7 +93,7 @@ namespace Spek {
|
||||
if (pos == Position.TOP) {
|
||||
cr.move_to (p - w / 2, -GAP - h);
|
||||
} else if (pos == Position.RIGHT){
|
||||
cr.move_to (w + GAP, p + h / 2);
|
||||
cr.move_to (GAP, p + h / 2);
|
||||
} else if (pos == Position.BOTTOM) {
|
||||
cr.move_to (p - w / 2, GAP + h);
|
||||
} else if (pos == Position.LEFT){
|
||||
|
@ -36,7 +36,7 @@ namespace Spek {
|
||||
|
||||
private const int LPAD = 60;
|
||||
private const int TPAD = 60;
|
||||
private const int RPAD = 60;
|
||||
private const int RPAD = 80;
|
||||
private const int BPAD = 40;
|
||||
private const int GAP = 10;
|
||||
private const int RULER = 10;
|
||||
@ -181,11 +181,13 @@ namespace Spek {
|
||||
var duration_seconds = (int) pipeline.duration;
|
||||
var time_ruler = new Ruler (
|
||||
Ruler.Position.BOTTOM,
|
||||
// TODO: i18n
|
||||
"00:00",
|
||||
{1, 2, 5, 10, 20, 30, 1*60, 2*60, 5*60, 10*60, 20*60, 30*60},
|
||||
duration_seconds,
|
||||
1.5,
|
||||
unit => (w - LPAD - RPAD) * unit / duration_seconds,
|
||||
// TODO: i18n
|
||||
unit => "%d:%02d".printf (unit / 60, unit % 60));
|
||||
cr.translate (LPAD, h - BPAD);
|
||||
time_ruler.draw (cr, layout);
|
||||
@ -195,7 +197,7 @@ namespace Spek {
|
||||
var freq = pipeline.sample_rate / 2;
|
||||
var rate_ruler = new Ruler (
|
||||
Ruler.Position.LEFT,
|
||||
"00 kHz",
|
||||
_("00 kHz"),
|
||||
{1000, 2000, 5000, 10000, 20000},
|
||||
freq,
|
||||
3.0,
|
||||
@ -238,6 +240,27 @@ namespace Spek {
|
||||
cr.set_source_surface (palette, 0, 0);
|
||||
cr.paint ();
|
||||
cr.identity_matrix ();
|
||||
|
||||
// Prepare to draw the ruler.
|
||||
cr.set_source_rgb (1, 1, 1);
|
||||
cr.set_line_width (1);
|
||||
cr.set_antialias (Antialias.NONE);
|
||||
layout.set_font_description (FontDescription.from_string (
|
||||
"Sans " + (8 * FONT_SCALE).to_string ()));
|
||||
layout.set_width (-1);
|
||||
|
||||
// Spectral density.
|
||||
var density_ruler = new Ruler (
|
||||
Ruler.Position.RIGHT,
|
||||
_("-00 dB"),
|
||||
{1, 2, 5, 10, 20, 50},
|
||||
-THRESHOLD,
|
||||
3.0,
|
||||
unit => -(h - TPAD - BPAD) * unit / THRESHOLD,
|
||||
unit => _("%d dB").printf (unit + THRESHOLD));
|
||||
cr.translate (w - RPAD + GAP + RULER, TPAD);
|
||||
density_ruler.draw (cr, layout);
|
||||
cr.identity_matrix ();
|
||||
}
|
||||
|
||||
private void put_pixel (ImageSurface surface, int x, int y, uint32 color) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user