annotate dsp/synth/srdata.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 9e7be347b3a0
children
rev   line source
samer@34 1 function x=srdata(gen,s0,varargin)
samer@34 2 % srdata - Signal as a sequence of blocks from signal generator object
samer@34 3 %
samer@34 4 % srdata ::
samer@34 5 % gen(A,B{1:N}) ~'signal generator object',
samer@34 6 % A ~'initial state',
samer@34 7 % seq(B{1} ~'sequence of 1st param values',
samer@34 8 % ...
samer@34 9 % seq(B{N} ~'sequence of Nst param values',
samer@34 10 % -> seq([[1,_]]).
samer@34 11 %
samer@34 12 % The main point of this construct is to maintain state
samer@34 13 % between calls to the block method of the signal generator, and
samer@34 14 % also to supply the generator with a sequence of parameter
samer@34 15 % values.
samer@34 16
samer@36 17 x=mapaccum(@blockgen,s0,zip(varargin{:}));
samer@34 18
samer@34 19 function [y,state]=blockgen(theta,state)
samer@34 20 % this is weird - for some reason Matlab crashes if I call block
samer@34 21 % directly from here, but is ok if I go via the non-nested bblock
samer@34 22 [y,state]=bblock(gen,state,theta);
samer@34 23 end
samer@34 24 end
samer@34 25
samer@34 26 function [y,s]=bblock(gen,s,theta)
samer@34 27 [y,s]=block_sr(gen,s,theta{:});
samer@34 28 end
samer@34 29