classdef sigconst < signal
	properties (GetAccess=private, SetAccess=immutable)
		val
		fs
	end
	methods
		function s=sigconst(val,rate)
			if nargin<2, rate=nan; end
			s.val=reshape(val,size(val,1),1);
			s.fs=rate;
		end

		function s=tostring(sig), s=sprintf('sigconst(%s)',mat2str(sig.val)); end
		function c=channels(s), c=size(s.val,1); end
		function c=rate(s), c=s.fs; end
		function s=construct(sig)
			s.start   = @nop;
			s.stop    = @nop;
			s.dispose = @nop;
			s.reader = @reader;

			function r=reader(n)
				r = @next;
				buf=repmat(sig.val,1,double(n));
				function [x,rem]=next, x=buf; rem=0; end
			end
		end
	end
end
