view arrows/abufsink.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 672052bd81f8
children
line wrap: on
line source
% abufsink - output arrow using sink object
%
% abufsink :: 
%    sink(C,R) ~'signal sink'
% -> arrow({[[N,L]]]},{},empty).
%
% abufsink :: 
%    sink(C,R) ~'signal sink'
%    [[M]->[N]] ~'array of indices into input to select samples to send'
% -> arrow({[[N,L]]]},{},empty).
%
% This unit will accept vectors of any size and send them to an audio output
% device or destination.
%
function o=abufsink(sink,window)
	if nargin<2, window=[]; end
	ch=channels(sink);
	if isempty(window)
		o=arr(@rshp)*asink(sink);
	else
		o=arr(@wnd)*asink(sink);
	end

	function y=rshp(x), y=reshape(x,ch,[]); end
	function y=wnd(x), y=reshape(x(window,:),ch,[]); end
end