annotate toolboxes/MIRtoolbox1.3.2/MIRToolbox/isamir.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function b = isamir(x,class)
wolffd@0 2
wolffd@0 3 if isempty(x) || isnumeric(x)
wolffd@0 4 b = 0;
wolffd@0 5 return
wolffd@0 6 end
wolffd@0 7
wolffd@0 8 if iscell(x)
wolffd@0 9 x = x{1};
wolffd@0 10 end
wolffd@0 11
wolffd@0 12 if isa(x,class)
wolffd@0 13 b = 1;
wolffd@0 14 return
wolffd@0 15 elseif ischar(x) && strcmpi(class,'miraudio')
wolffd@0 16 b = 1;
wolffd@0 17 return
wolffd@0 18 elseif not(isa(x,'mirdesign'))
wolffd@0 19 b = 0;
wolffd@0 20 return
wolffd@0 21 end
wolffd@0 22
wolffd@0 23 type = get(x,'Type');
wolffd@0 24 if iscell(type)
wolffd@0 25 type = type{1};
wolffd@0 26 end
wolffd@0 27 types = lineage(type);
wolffd@0 28 b = 0;
wolffd@0 29 i = 0;
wolffd@0 30 while not(b) && i<length(types)
wolffd@0 31 i = i+1;
wolffd@0 32 if strcmpi(types(i),class)
wolffd@0 33 b = 1;
wolffd@0 34 end
wolffd@0 35 end
wolffd@0 36
wolffd@0 37
wolffd@0 38 function types = lineage(class)
wolffd@0 39 switch class
wolffd@0 40 case {'miraudio','mirenvelope'}
wolffd@0 41 parent = 'mirtemporal';
wolffd@0 42 case {'mirautocor','mircepstrum','mirchromagram','mirhisto',...
wolffd@0 43 'mirkeysom','mirkeystrength','mirmatrix','mirmfcc',...
wolffd@0 44 'mirscalar','mirsimatrix','mirspectrum',...
wolffd@0 45 'mirtemporal','mirtonalcentroid'}
wolffd@0 46 parent = 'mirdata';
wolffd@0 47 otherwise
wolffd@0 48 parent = '';
wolffd@0 49 end
wolffd@0 50
wolffd@0 51 if isempty(parent)
wolffd@0 52 types = {class};
wolffd@0 53 else
wolffd@0 54 parents = lineage(parent);
wolffd@0 55 types = {class parents{:}};
wolffd@0 56 end