[76dce7]: blockproc / blockpanel.m Maximize Restore History

Download this file

blockpanel.m    61 lines (50 with data), 1.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function p = blockpanel(params)
%BLOCKPANEL Control panel
% Usage: blockpanel(params)
%
% Input parameters:
% params: Cell-array of parameters specifications.
%
% Output parameters:
% p : Control panel Java object
%
% `blockpanel(params)` creates a Java object containing GUI for changing
% parameters during the playback. `params` should be a cell-array, whose
% elements are another cell array of the followong format:
%
% {'var','label',minVal,maxVal,defVal,valCount}
%
% Example:
%
% params = {
% {'G','Gain',-20,20,0,21}
% }
%
if nargin<1
error('%s: Too few input parameters.',upper(mfilename));
end
if ~iscell(params)
error('%s: Input should be cell array.',upper(mfilename));
end
if ~iscell(params{1})
params = {params};
end
try
p = javaObject('net.sourceforge.ltfat.ContFrame');
catch% err
error(['%s: Could not load net.sourceforge.ltfat.ContFrame. It is not ',...
'compiled or it is not in Matlab classpath. In the latter case, ',...
'ltfatstart should do the trick.'],upper(mfilename));
end
paramList = javaObject('java.util.LinkedList');
for ii = 1:numel(params)
param = params{ii};
paramListEl = javaObject('java.util.LinkedList');
for jj=1:numel(param)
javaMethod('add',paramListEl,param{jj});
end
javaMethod('add',paramList,paramListEl);
end
javaMethod('addControlElements',p,paramList);
% Give the object time to inilialize properly.
pause(0.1);