Mercurial > hg > ishara
view signals/@siglzcat/construct.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | 289445d368a7 |
children |
line wrap: on
line source
function s=construct(sig) fs=rate(sig.head); ch=channels(sig.head); sc=construct(sig.head); sx=sig.tail; s.start = @start; s.stop = @stop; s.dispose = @dispose; s.reader = @reader; function start, sc.start(); end function stop, sc.stop(); end function dispose, sc.dispose(); end function r=reader(n) rc=sc.reader(n); r = @next; function [x,rem]=next [x,rem]=rc(); while rem>0 && ~isempty(sx) % current signal exhausted, try next sc.dispose(); [sig2,sx]=sx(); fs=unify_rates(fs,rate(sig2)); if isinf(fs), error('sigcat:Signal sampling rate mismatch'); end ch=unify_channels(ch,channels(sig2)); if isinf(ch), error('sigcat:Signal channels count mismatch'); end sc=construct(sig2); [x(:,end-rem+1:end),rem]=sigreadn(sc,rem); rc=sc.reader(n); end end end end