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

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function b = isamir(x,class)
Daniel@0 2
Daniel@0 3 if isempty(x) || isnumeric(x)
Daniel@0 4 b = 0;
Daniel@0 5 return
Daniel@0 6 end
Daniel@0 7
Daniel@0 8 if iscell(x)
Daniel@0 9 x = x{1};
Daniel@0 10 end
Daniel@0 11
Daniel@0 12 if isa(x,class)
Daniel@0 13 b = 1;
Daniel@0 14 return
Daniel@0 15 elseif ischar(x) && strcmpi(class,'miraudio')
Daniel@0 16 b = 1;
Daniel@0 17 return
Daniel@0 18 elseif not(isa(x,'mirdesign'))
Daniel@0 19 b = 0;
Daniel@0 20 return
Daniel@0 21 end
Daniel@0 22
Daniel@0 23 type = get(x,'Type');
Daniel@0 24 if iscell(type)
Daniel@0 25 type = type{1};
Daniel@0 26 end
Daniel@0 27 types = lineage(type);
Daniel@0 28 b = 0;
Daniel@0 29 i = 0;
Daniel@0 30 while not(b) && i<length(types)
Daniel@0 31 i = i+1;
Daniel@0 32 if strcmpi(types(i),class)
Daniel@0 33 b = 1;
Daniel@0 34 end
Daniel@0 35 end
Daniel@0 36
Daniel@0 37
Daniel@0 38 function types = lineage(class)
Daniel@0 39 switch class
Daniel@0 40 case {'miraudio','mirenvelope'}
Daniel@0 41 parent = 'mirtemporal';
Daniel@0 42 case {'mirautocor','mircepstrum','mirchromagram','mirhisto',...
Daniel@0 43 'mirkeysom','mirkeystrength','mirmatrix','mirmfcc',...
Daniel@0 44 'mirscalar','mirsimatrix','mirspectrum',...
Daniel@0 45 'mirtemporal','mirtonalcentroid'}
Daniel@0 46 parent = 'mirdata';
Daniel@0 47 otherwise
Daniel@0 48 parent = '';
Daniel@0 49 end
Daniel@0 50
Daniel@0 51 if isempty(parent)
Daniel@0 52 types = {class};
Daniel@0 53 else
Daniel@0 54 parents = lineage(parent);
Daniel@0 55 types = {class parents{:}};
Daniel@0 56 end