samer@0: function s=construct(sig) samer@0: sc=construct(sig.sinks{1}); samer@0: sx=sig.sinks(2:end); samer@0: samer@0: s.start = @start; samer@0: s.stop = @stop; samer@0: s.dispose = @dispose; samer@0: s.writer = @writer; samer@0: samer@0: function start, sc.start(); end samer@0: function stop, sc.stop(); end samer@0: function dispose, sc.dispose(); end samer@0: samer@0: function r=writer(n) samer@0: rc=sc.writer(n); samer@0: r = @next; samer@0: function rem=next(x) samer@0: rem=rc(x); samer@0: while rem>0 && ~isempty(sx) % current signal exhausted, try next samer@0: sc.dispose(); samer@0: sc=construct(sx{1}); sx=sx(2:end); samer@0: rem=sinkwriten(sc,n,x(end-rem+1:end)); samer@0: rc=sc.writer(n); samer@0: end samer@0: end samer@0: end samer@0: end