Mercurial > hg > ishara
view signals/@sigarray/sigarray.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
classdef sigarray < signal properties (GetAccess=private, SetAccess=immutable) fs array end methods function s=sigarray(array,rate) if nargin<2, rate=nan; end s.array=array; s.fs=rate; end function s=tostring(sig) s=sprintf('sigarray(<%dx%d>)',size(sig.array,1),size(sig.array,2)); end function c=channels(s), c=size(s.array,1); end function c=rate(s), c=s.fs; end function s=construct(sig) array=sig.array; ch=size(array,1); length=size(array,2); pos=0; s.start = @nop; s.stop = @nop; s.dispose = @nop; s.reader = @reader; function r=reader(n) r = @next; CHUNK = 1:uint32(n); function [x,rem]=next if pos+n<=length x=array(:,pos+CHUNK); rem=0; pos=pos+n; else rem=n-(length-pos); x=[array(:,pos+1:end),zeros(ch,rem)]; pos=length; end end end end end end