spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit c7e088496f3c89f55ea49feea1a3510d3a920a41
parent acb3097f4b0ff78d861db8e0c036f75749a448f5
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Mon, 17 May 2010 09:38:12 +1000

Query the sample rate

Diffstat:
Msrc/spek-source.vala | 15++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/spek-source.vala b/src/spek-source.vala @@ -27,7 +27,8 @@ namespace Spek { public int threshold { get; construct; } // TODO: file a bug, cannot s/set/construct/ public Callback callback {get; set; } - public int64 duration { get; private set; } + public int64 duration { get; private set; default = 0; } + public int rate { get; private set; default = 0; } public delegate void Callback (int sample, float[] values); @@ -79,6 +80,18 @@ namespace Spek { pipeline.get_state (null, null, -1); } + // Get the sample rate. + var caps = pad.get_caps (); + for (int i = 0; i < caps.get_size (); i++) { + var structure = caps.get_structure (i); + int rate; + if (structure.get_int ("rate", out rate) && rate > 0) { + this.rate = rate; + break; + } + } + + // Get the duration. // TODO: replace with Pad.query_duration when bgo#617260 is fixed var query = new Query.duration (Format.TIME); pad.query (query);