diff --git a/applications/Hardware/FrontendControl/ita_aurelio_control.m b/applications/Hardware/FrontendControl/ita_aurelio_control.m
index cb13c42fa3b85f52361ef5706765e4e75de20112..4195af4f476c2700a948fe14f533fe0dce150b11 100644
--- a/applications/Hardware/FrontendControl/ita_aurelio_control.m
+++ b/applications/Hardware/FrontendControl/ita_aurelio_control.m
@@ -13,33 +13,19 @@ function varargout = ita_aurelio_control(varargin)
% doc ita_robocontrol
%
-% This file is part of the application RoboAurelioModulITAControl for the ITA-Toolbox. All rights reserved.
+% This file is part of the application FrontendControl for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
%
% Author: Pascal Dietrich - pdi@akustik.rwth-aachen.de
+% reworked: Jan Richter - jri@akustik.rwth-aachen.de
%% persistent
-persistent oldSettings last_input last_AmpHighPower last_Amplifier last_AmpBridgeMode last_AmpLowImpedanceMode last_Amp26dBu last_AmpAC last_AmpMono
+% persistent oldSettings last_input last_AmpHighPower last_Amplifier last_AmpBridgeMode last_AmpLowImpedanceMode last_Amp26dBu last_AmpAC last_AmpMono
+persistent settings presets presetNames currentPresetIndex;
% force_init = false;
-if isempty(last_input)
- % force_init = true;
- last_input = 'xlr';
- last_AmpHighPower = false;
- last_Amplifier = true;
- last_AmpBridgeMode = false;
- last_AmpLowImpedanceMode = false;
- last_Amp26dBu = false;
- last_AmpAC = false;
- last_AmpMono = false;
- oldSettings.ch(1).inputrange = 6;
- oldSettings.ch(2).inputrange = 6;
- oldSettings.ch(1).inputfeed = 'none';
- oldSettings.ch(2).inputfeed = 'none';
- oldSettings.ch(1).inputselect = 'xlr';
- oldSettings.ch(2).inputselect = 'xlr';
-
- oldSettings.amp_gain = -20;
+if isempty(settings)
+ settings = getInitSettings();
end
if nargin == 0
@@ -47,20 +33,38 @@ if nargin == 0
end
%% init
-sArgs = struct('channel',1:2,'groundLift',true,'inputCouplingAC',true,'feed',oldSettings.ch(1).inputfeed,'inputrange',[],...
- 'input',last_input,'mode','norm','securityMode',false,'init',false,'samplingRate',ita_preferences('samplingRate'),'outputvolume',[],...
- 'AmpHighPower',last_AmpHighPower,'AmpLowPower',false,'Amplifier',last_Amplifier,'NoAmplifier',false,'AmpBridgeMode',last_AmpBridgeMode,'AmpLowImpedanceMode',last_AmpLowImpedanceMode,...
- 'Amp26dBu',last_Amp26dBu,'Amp06dBu',false , 'NoGroundLift', false, 'AmpAC', last_AmpAC, 'AmpMono', last_AmpMono, 'getSettings',false,'reset',false);
+sArgs = getArgsFromSettings(settings);
%% parse
[sArgs] = ita_parse_arguments(sArgs,varargin);
ch_number = ita_angle2str( sArgs.channel - 1, 2); %zero indexing for channel numbering
if sArgs.getSettings
- varargout{1} = oldSettings;
+ varargout{1} = settings;
+ varargout{2} = presetNames;
+ varargout{3} = currentPresetIndex;
+ if ~isempty(presets)
+ presetChanged = ~isequal(presets{currentPresetIndex},settings);
+ else
+ presetChanged = 1;
+ end
+ varargout{4} = presetChanged;
return;
end
+
+if sArgs.savePreset
+ presetIndex = length(presetNames) + 1;
+ presets{presetIndex} = settings;
+ presetNames{presetIndex} = sArgs.presetName;
+ currentPresetIndex = presetIndex;
+end
+
+
+if sArgs.getPresets
+
+end
+
if sArgs.reset
clear all
ita_aurelio_control('init');
@@ -74,26 +78,56 @@ end
if sArgs.Amp06dBu
sArgs.Amp26dBu = false;
end
+
+if sArgs.Amp26dBu == false
+ sArgs.Amp06dBu = true;
+end
+
if sArgs.NoAmplifier
sArgs.Amplifier = false;
end
+
+if sArgs.Amplifier
+ sArgs.NoAmplifier = false;
+end
+
if sArgs.AmpLowPower
sArgs.AmpHighPower = false;
end
+
+if sArgs.AmpHighPower
+ sArgs.AmpLowPower = false;
+end
+
if sArgs.NoGroundLift
sArgs.groundLift = false;
- % sArgs.feed = 'none';
+end
+
+if sArgs.groundLift
+ sArgs.NoGroundLift = false;
+end
+
+settings = setSettingsFromArgs(sArgs,settings);
+
+if sArgs.setPreset
+ % find the preset with the given name
+ for index = 1:length(presetNames)
+ if strcmp(presetNames{index},sArgs.presetName)
+ currentPresetIndex = index;
+ settings = presets{index};
+ end
+ end
end
%% write back to persistents
-last_input = sArgs.input;
-last_AmpHighPower = sArgs.AmpHighPower;
-last_Amplifier = sArgs.Amplifier;
-last_AmpBridgeMode = sArgs.AmpBridgeMode;
-last_AmpLowImpedanceMode = sArgs.AmpLowImpedanceMode;
-last_Amp26dBu = sArgs.Amp26dBu;
-last_AmpAC = sArgs.AmpAC;
-last_AmpMono = sArgs.AmpMono;
+% last_input = sArgs.input;
+% last_AmpHighPower = sArgs.AmpHighPower;
+% last_Amplifier = sArgs.Amplifier;
+% last_AmpBridgeMode = sArgs.AmpBridgeMode;
+% last_AmpLowImpedanceMode = sArgs.AmpLowImpedanceMode;
+% last_Amp26dBu = sArgs.Amp26dBu;
+% last_AmpAC = sArgs.AmpAC;
+% last_AmpMono = sArgs.AmpMono;
%% INIT device
if sArgs.init
@@ -104,24 +138,29 @@ if sArgs.init
end
%% range
-if ~isempty( sArgs.inputrange )
- sArgs.inputrange = min( max(sArgs.inputrange,-34) , 56);
- par_number = '02';
- par_value = round((- sArgs.inputrange + 56)/10); %round to nearest possible
- for idx = 1:numel(sArgs.channel)
- oldSettings.ch(sArgs.channel(idx)).inputrange = 56 - (par_value * 10);
- end
- if sArgs.securityMode
- par_value = par_value + 40;
+% if ~isempty( sArgs.inputrange )
+
+ for index = 1:length(sArgs.channel)
+ sArgs.inputrange = min( max(settings.ch(sArgs.channel(index)).inputrange,-34) , 56);
+ par_number = '02';
+ par_value = round((- sArgs.inputrange + 56)/10); %round to nearest possible
+% for idx = 1:numel(sArgs.channel)
+% disp(idx)
+% 56 - (par_value * 10)
+% settings.ch(sArgs.channel(idx)).inputrange = 56 - (par_value * 10);
+% encd
+ if sArgs.securityMode
+ par_value = par_value + 40;
+ end
+ par_value = ita_angle2str(par_value,2);
+ send_sysex(par_number, par_value, ita_angle2str(sArgs.channel(index)-1,2)); %send to device
end
- par_value = ita_angle2str(par_value,2);
- send_sysex(par_number, par_value, ch_number); %send to device
-end
+% end
%% input select -- routing control -- HUHU old values needed
-if ~isempty(sArgs.input)
+% if ~isempty(sArgs.input)
par_number = '01';
- switch lower(sArgs.mode)
+ switch lower(settings.mode)
case 'norm' %normal mode
Mode = '0000';
case 'imp' %impedance measurement
@@ -156,79 +195,31 @@ if ~isempty(sArgs.input)
ita_verbose_info('Careful, channel swapping is activated.',0)
end
- switch lower(sArgs.input)
- case 'xlr'
- IS = '11';
- case 'lemo'
- IS = '01';
- sArgs.feed = 'pol';
- case 'gnd'
- IS = '00';
- case 'bnc'
- IS = '10';
- otherwise
- error(['input select unknown: ' sArgs.input])
- end
+ % get input selection
+ IS = getCommandFromInputSelect(settings.ch(1).inputselect);
par_value = dec2hex( bin2dec( [IS ChSwp Mode ] ) );
- send_sysex(par_number, par_value, ch_number); %send to device
+ send_sysex(par_number, par_value, ita_angle2str(0,2));
- for iCh = 1:numel(sArgs.channel)
- oldSettings.ch(sArgs.channel(iCh)).inputselect = lower(sArgs.input);
- end
-end
+ IS = getCommandFromInputSelect(settings.ch(2).inputselect);
+ par_value2 = dec2hex( bin2dec( [IS ChSwp Mode ] ) );
+ send_sysex(par_number, par_value2, ita_angle2str(1,2)); %send to device
+
+% end
%% coupling and feed control
-if ~isempty( sArgs.feed )
- par_number = '00';
- Wait = '0'; %wait for relays to switch later
- Lem28 = '0'; %switch 14 to 28Volts, Pin7 is then grounded
- Phan = '0';
- Feed = '0';
- ICP = '0';
- Glift = num2str(sArgs.groundLift);
- AC = num2str(sArgs.inputCouplingAC);
+% if ~isempty( sArgs.feed )
+ for index = 1:length(sArgs.channel)
+ rS = getCommandFromFeedSelect(sArgs,sArgs.channel(index),settings);
+
+ par_value = dec2hex( bin2dec ( ['0' rS.Wait rS.Lem28 rS.Phan rS.Feed rS.ICP rS.Glift rS.AC] ));
+ send_sysex(rS.par_number, par_value, ita_angle2str(sArgs.channel(index)-1,2)); % send final sysex
+ end
- switch lower(sArgs.feed)
- case 'pha'
- Phan = '1';
- AC = '1'; %block DC from preamp inputs
- case 'pol'
- Feed = '1';
- AC = '1'; %block DC from preamp inputs
- case {'icp','iepe'}
- ICP = '1';
- Feed = '1';
- AC = '1';
- case 'p+p'
- Phan = '1';
- Feed = '1';
- AC = '1';
- case 'all'
- Phan = '1';
- Feed = '1';
- ICP = '1';
- AC = '1';
- case 'ccx'
- Phan = '0';
- Feed = '0';
- ICP = '0';
- AC = '0';
- Glift = '1';
- case {0 ,'none','off'}
- %
- otherwise
- error('feed wrong')
- end
- par_value = dec2hex( bin2dec ( ['0' Wait Lem28 Phan Feed ICP Glift AC] ));
- send_sysex(par_number, par_value, ch_number); % send final sysex
- for iCh = 1:numel(sArgs.channel)
- oldSettings.ch(sArgs.channel(iCh)).inputfeed = lower(sArgs.feed);
- end
-end
+% end
%% sampling rate
-if sArgs.samplingRate
+% if sArgs.samplingRate
par_number = '03';
if isnatural(sArgs.samplingRate / 48000)
@@ -257,27 +248,27 @@ if sArgs.samplingRate
send_sysex(par_number, par_value, []); % send final sysex
ita_preferences('samplingRate',sArgs.samplingRate); % also initializes playrec
-end
+% end
%% analog output control - Parameter 05
-HiPow = num2str(sArgs.AmpHighPower);
-AmpOn = num2str(sArgs.Amplifier);
-Bridge = num2str(sArgs.AmpBridgeMode);
-LoImp = num2str(sArgs.AmpLowImpedanceMode);
-dBu26 = num2str(sArgs.Amp26dBu);
-AC = num2str(sArgs.AmpAC);
-mono = num2str(sArgs.AmpMono);
+HiPow = num2str(settings.AmpHighPower);
+AmpOn = num2str(settings.Amplifier);
+Bridge = num2str(settings.ampBridgeMode);
+LoImp = num2str(settings.ampLowImpedanceMode);
+dBu26 = num2str(settings.Amp26dBu);
+AC = num2str(settings.ampAC);
+mono = num2str(settings.ampMono);
par_number = '05';
par_value = dec2hex(bin2dec(['0' HiPow AmpOn Bridge LoImp dBu26 AC mono])); % 0dB attenuation
send_sysex(par_number, par_value, ch_number); %send to device
-if sArgs.Amp06dBu
- oldSettings.amp_gain = -20;
-elseif sArgs.Amp26dBu
- oldSettings.amp_gain = 0;
+if settings.Amp26dBu
+ settings.amp_gain = 0;
+else
+ settings.amp_gain = -20;
end
@@ -295,6 +286,9 @@ end
%% ********************** send sysex ************************************
function send_sysex(par_number, par_value, ch_number)
+
+% disp([par_number par_value ch_number])
+%
if ~isempty(ch_number) && numel(str2num(ch_number)) >= 2
ch_number = '7F';
end
@@ -320,3 +314,140 @@ sysex = [hex2dec('F0') hex2dec('70') complete_sysex hex2dec('F7')]; %pre- post-
ita_midi(sysex,ita_preferences('out_midi_DeviceID'));
end
+
+
+%% get settings
+
+function settings = getInitSettings()
+
+ settings.AmpHighPower = false;
+ settings.Amplifier = true;
+ settings.ampBridgeMode = false;
+ settings.ampLowImpedanceMode = false;
+ settings.Amp26dBu = false;
+ settings.ampAC = false;
+ settings.ampMono = false;
+ settings.samplingRate = ita_preferences('samplingRate');
+ settings.mode = 'norm';
+ settings.groundLift = true;
+ settings.inputCouplingAC = true;
+ settings.ch(1).inputrange = 6;
+ settings.ch(2).inputrange = 6;
+ settings.ch(1).inputfeed = 'none';
+ settings.ch(2).inputfeed = 'none';
+ settings.ch(1).inputselect = 'xlr';
+ settings.ch(2).inputselect = 'xlr';
+
+% settings.amp_gain = -20;
+
+end
+
+function sArgs = getArgsFromSettings(settings)
+
+sArgs = struct('input',[],'feed',[],'inputrange',[],'channel',1:2,'groundLift',settings.groundLift,'inputCouplingAC',settings.inputCouplingAC,...
+ 'mode',settings.mode,'securityMode',false,'init',false,'samplingRate',settings.samplingRate,'outputvolume',[],...
+ 'AmpHighPower',settings.AmpHighPower,'AmpLowPower',false,'Amplifier',settings.Amplifier,'NoAmplifier',false,'AmpBridgeMode',settings.ampBridgeMode,'AmpLowImpedanceMode',settings.ampLowImpedanceMode,...
+ 'Amp26dBu',settings.Amp26dBu,'Amp06dBu',false , 'NoGroundLift', false, 'AmpAC', settings.ampAC, 'AmpMono', settings.ampMono, 'getSettings',false,'reset',false,'setPreset',false,'getPresets',false,'savePreset',false,'presetName','');
+
+
+end
+
+function settings = setSettingsFromArgs(sArgs,settings)
+
+ settings.AmpHighPower = sArgs.AmpHighPower;
+ settings.Amplifier = sArgs.Amplifier;
+ settings.ampBridgeMode = sArgs.AmpBridgeMode;
+ settings.ampLowImpedanceMode = sArgs.AmpLowImpedanceMode;
+ settings.Amp26dBu = sArgs.Amp26dBu;
+ settings.ampAC = sArgs.AmpAC;
+ settings.ampMono = sArgs.AmpMono;
+ settings.samplingRate = sArgs.samplingRate;
+ settings.mode = sArgs.mode;
+ settings.groundLift = sArgs.groundLift;
+ settings.inputCouplingAC = sArgs.inputCouplingAC;
+
+ for index = 1:length(sArgs.channel)
+ if ~isempty(sArgs.inputrange)
+ settings.ch(sArgs.channel(index)).inputrange = sArgs.inputrange;
+ end
+ if ~isempty(sArgs.feed)
+ settings.ch(sArgs.channel(index)).inputfeed = sArgs.feed;
+ end
+ if ~isempty(sArgs.input)
+ settings.ch(sArgs.channel(index)).inputselect = sArgs.input;
+ end
+ end
+end
+
+% input selection
+function IS = getCommandFromInputSelect(in)
+
+ switch lower(in)
+ case 'xlr'
+ IS = '11';
+ case 'lemo'
+ IS = '01';
+ sArgs.feed = 'pol';
+ case 'gnd'
+ IS = '00';
+ case 'bnc'
+ IS = '10';
+ otherwise
+ %JRI error
+ disp(['input select unknown'])
+ end
+
+end
+
+function returnStruct = getCommandFromFeedSelect(sArgs,channel,settings)
+ par_number = '00';
+ Wait = '0'; %wait for relays to switch later
+ Lem28 = '0'; %switch 14 to 28Volts, Pin7 is then grounded
+ Phan = '0';
+ Feed = '0';
+ ICP = '0';
+ Glift = num2str(settings.groundLift);
+ AC = num2str(settings.inputCouplingAC);
+
+ switch lower(settings.ch(channel).inputfeed)
+ case 'pha'
+ Phan = '1';
+ AC = '1'; %block DC from preamp inputs
+ case 'pol'
+ Feed = '1';
+ AC = '1'; %block DC from preamp inputs
+ case {'icp','iepe'}
+ ICP = '1';
+ Feed = '1';
+ AC = '1';
+ case 'p+p'
+ Phan = '1';
+ Feed = '1';
+ AC = '1';
+ case 'all'
+ Phan = '1';
+ Feed = '1';
+ ICP = '1';
+ AC = '1';
+ case 'ccx'
+ Phan = '0';
+ Feed = '0';
+ ICP = '0';
+ AC = '0';
+ Glift = '1';
+ case {0 ,'none','off'}
+ %
+ otherwise
+ error('feed wrong')
+ end
+
+ returnStruct.par_number = par_number;
+ returnStruct.Wait = Wait;
+ returnStruct.Lem28 = Lem28;
+ returnStruct.Phan = Phan;
+ returnStruct.Feed = Feed;
+ returnStruct.ICP = ICP;
+ returnStruct.Glift = Glift;
+ returnStruct.AC = AC;
+end
+
diff --git a/applications/Hardware/FrontendControl/ita_aurelio_control_new.m b/applications/Hardware/FrontendControl/ita_aurelio_control_new.m
deleted file mode 100644
index 096c655cb9e4988c3b871b44028c64565eb23c46..0000000000000000000000000000000000000000
--- a/applications/Hardware/FrontendControl/ita_aurelio_control_new.m
+++ /dev/null
@@ -1,453 +0,0 @@
-function varargout = ita_aurelio_control_new(varargin)
-%ITA_AURELIO_CONTROL - Send Settings to Aurelio 2014 Frontend
-% This function sends Midi Sysex Commands to the Aurelio High Precision
-% Frontend (Swen Mueller, Immetro, Rio de Janiero, Brazil).
-%
-% Syntax: ita_aurelio_control(options)
-% 'init' (false): set the frontend to last know values
-% 'range' (0): inputRange as double, will round to nearest possible
-% 'samplingRate' (ita_preferences), 32000, 44100 or 48000 multiplied by 1x, 2x, or 4x.
-% 'coupling'
-%
-% Reference page in Help browser
-% doc ita_robocontrol
-
-%
-% This file is part of the application FrontendControl for the ITA-Toolbox. All rights reserved.
-% You can find the license for this m-file in the application folder.
-%
-
-% Author: Pascal Dietrich - pdi@akustik.rwth-aachen.de
-% reworked: Jan Richter - jri@akustik.rwth-aachen.de
-
-%% persistent
-% persistent oldSettings last_input last_AmpHighPower last_Amplifier last_AmpBridgeMode last_AmpLowImpedanceMode last_Amp26dBu last_AmpAC last_AmpMono
-persistent settings presets presetNames currentPresetIndex;
-% force_init = false;
-if isempty(settings)
- settings = getInitSettings();
-end
-
-if nargin == 0
- ita_aureliocontrol_gui_new();
-end
-
-%% init
-sArgs = getArgsFromSettings(settings);
-
-%% parse
-[sArgs] = ita_parse_arguments(sArgs,varargin);
-ch_number = ita_angle2str( sArgs.channel - 1, 2); %zero indexing for channel numbering
-
-if sArgs.getSettings
- varargout{1} = settings;
- varargout{2} = presetNames;
- varargout{3} = currentPresetIndex;
- if ~isempty(presets)
- presetChanged = ~isequal(presets{currentPresetIndex},settings);
- else
- presetChanged = 1;
- end
- varargout{4} = presetChanged;
- return;
-end
-
-
-if sArgs.savePreset
- presetIndex = length(presetNames) + 1;
- presets{presetIndex} = settings;
- presetNames{presetIndex} = sArgs.presetName;
- currentPresetIndex = presetIndex;
-end
-
-
-if sArgs.getPresets
-
-end
-
-if sArgs.reset
- clear all
- ita_aurelio_control('init');
- if nargout == 1
- varargout{1} = [];
- end
- return;
-end
-
-%% inverse parameters
-if sArgs.Amp06dBu
- sArgs.Amp26dBu = false;
-end
-
-if sArgs.Amp26dBu == false
- sArgs.Amp06dBu = true;
-end
-
-if sArgs.NoAmplifier
- sArgs.Amplifier = false;
-end
-
-if sArgs.Amplifier
- sArgs.NoAmplifier = false;
-end
-
-if sArgs.AmpLowPower
- sArgs.AmpHighPower = false;
-end
-
-if sArgs.AmpHighPower
- sArgs.AmpLowPower = false;
-end
-
-if sArgs.NoGroundLift
- sArgs.groundLift = false;
-end
-
-if sArgs.groundLift
- sArgs.NoGroundLift = false;
-end
-
-settings = setSettingsFromArgs(sArgs,settings);
-
-if sArgs.setPreset
- % find the preset with the given name
- for index = 1:length(presetNames)
- if strcmp(presetNames{index},sArgs.presetName)
- currentPresetIndex = index;
- settings = presets{index};
- end
- end
-end
-
-%% write back to persistents
-% last_input = sArgs.input;
-% last_AmpHighPower = sArgs.AmpHighPower;
-% last_Amplifier = sArgs.Amplifier;
-% last_AmpBridgeMode = sArgs.AmpBridgeMode;
-% last_AmpLowImpedanceMode = sArgs.AmpLowImpedanceMode;
-% last_Amp26dBu = sArgs.Amp26dBu;
-% last_AmpAC = sArgs.AmpAC;
-% last_AmpMono = sArgs.AmpMono;
-
-%% INIT device
-if sArgs.init
- % go thru all stages
- clear
- ita_aurelio_control_new('input','XLR','inputrange',6,'feed',0 , 'samplingRate',ita_preferences('samplingRate'));
- return
-end
-
-%% range
-% if ~isempty( sArgs.inputrange )
-
- for index = 1:length(sArgs.channel)
- sArgs.inputrange = min( max(settings.ch(sArgs.channel(index)).inputrange,-34) , 56);
- par_number = '02';
- par_value = round((- sArgs.inputrange + 56)/10); %round to nearest possible
-% for idx = 1:numel(sArgs.channel)
-% disp(idx)
-% 56 - (par_value * 10)
-% settings.ch(sArgs.channel(idx)).inputrange = 56 - (par_value * 10);
-% encd
- if sArgs.securityMode
- par_value = par_value + 40;
- end
- par_value = ita_angle2str(par_value,2);
- send_sysex(par_number, par_value, ita_angle2str(sArgs.channel(index)-1,2)); %send to device
- end
-% end
-
-%% input select -- routing control -- HUHU old values needed
-% if ~isempty(sArgs.input)
- par_number = '01';
- switch lower(settings.mode)
- case 'norm' %normal mode
- Mode = '0000';
- case 'imp' %impedance measurement
- Mode = '0001';
- sArgs.feed = false;
- % ChSwp = '1'; % pdi: oct 2012: for some reason
- % this is not required anymore ???!!!
- case {'impref','iref'}
- Mode = '0010';
- sArgs.feed = false;
- case {'bncref','bref'}
- Mode = '0100';
- sArgs.input = 'gnd';
- sArgs.feed = false;
- case {'ampref','aref'}
- Mode = '0101';
- sArgs.input = 'gnd';
- sArgs.feed = false;
- case {'xlrref','xref','lineref'}
- Mode = '0011';
- sArgs.feed = false;
- case 'specialref'
- Mode = ['010' num2str(~ch_number) ];
- sArgs.input = 'gnd';
- otherwise
- error('argument not correct for ''input''')
- end
-
- if ~exist('ChSwp','var')
- ChSwp = '0'; %funny channel swapping for crazy people. take care, dude!
- else
- ita_verbose_info('Careful, channel swapping is activated.',0)
- end
-
- % get input selection
- IS = getCommandFromInputSelect(settings.ch(1).inputselect);
- par_value = dec2hex( bin2dec( [IS ChSwp Mode ] ) );
- send_sysex(par_number, par_value, ita_angle2str(0,2));
-
- IS = getCommandFromInputSelect(settings.ch(2).inputselect);
- par_value2 = dec2hex( bin2dec( [IS ChSwp Mode ] ) );
- send_sysex(par_number, par_value2, ita_angle2str(1,2)); %send to device
-
-% end
-
-%% coupling and feed control
-% if ~isempty( sArgs.feed )
- for index = 1:length(sArgs.channel)
- rS = getCommandFromFeedSelect(sArgs,sArgs.channel(index),settings);
-
- par_value = dec2hex( bin2dec ( ['0' rS.Wait rS.Lem28 rS.Phan rS.Feed rS.ICP rS.Glift rS.AC] ));
- send_sysex(rS.par_number, par_value, ita_angle2str(sArgs.channel(index)-1,2)); % send final sysex
- end
-
-
-% end
-
-%% sampling rate
-% if sArgs.samplingRate
- par_number = '03';
-
- if isnatural(sArgs.samplingRate / 48000)
- modifier = (sArgs.samplingRate / 48000);
- base_rate = 2;
- elseif isnatural(sArgs.samplingRate / 44100)
- modifier = sArgs.samplingRate / 44100;
- base_rate = 1;
- elseif isnatural(sArgs.samplingRate / 32000)
- modifier = sArgs.samplingRate / 32000;
- base_rate = 0;
- else
- error('sampling rate not supported.')
- end
- switch modifier
- case 1
- modifier = 0;
- case 2
- modifier = 1;
- case 4
- modifier = 2;
- otherwise
- error('sampling rate not supported.')
- end
- par_value = dec2hex(modifier*4 + base_rate);
- send_sysex(par_number, par_value, []); % send final sysex
-
- ita_preferences('samplingRate',sArgs.samplingRate); % also initializes playrec
-% end
-
-
-
-%% analog output control - Parameter 05
-HiPow = num2str(settings.AmpHighPower);
-AmpOn = num2str(settings.Amplifier);
-Bridge = num2str(settings.ampBridgeMode);
-LoImp = num2str(settings.ampLowImpedanceMode);
-dBu26 = num2str(settings.Amp26dBu);
-AC = num2str(settings.ampAC);
-mono = num2str(settings.ampMono);
-
-par_number = '05';
-par_value = dec2hex(bin2dec(['0' HiPow AmpOn Bridge LoImp dBu26 AC mono])); % 0dB attenuation
-send_sysex(par_number, par_value, ch_number); %send to device
-
-if settings.Amp26dBu
- settings.amp_gain = 0;
-else
- settings.amp_gain = -20;
-end
-
-
-%% output volume - Parameter 06
-% if ~isempty( sArgs.outputvolume )
-% par_number = '06';
-% par_value = '7F'; % 0dB attenuation
-% send_sysex(par_number, '0', []); %send to device
-% end
-
-
-
-
-end
-
-%% ********************** send sysex ************************************
-function send_sysex(par_number, par_value, ch_number)
-
-% disp([par_number par_value ch_number])
-%
-% if ~isempty(ch_number) && numel(str2num(ch_number)) >= 2
-% ch_number = '7F';
-% end
-% %build complete sysex
-% sys_hex = {};
-% sys_hex{numel(sys_hex)+1} = par_number; % hex
-% sys_hex{numel(sys_hex)+1} = par_value; % hex
-% if ~isempty(ch_number)
-% sys_hex{numel(sys_hex)+1} = ch_number; % hex
-% end
-%
-% for idx = 1:numel(sys_hex)
-% sys_dec(idx) = hex2dec( sys_hex{idx} );
-% end
-%
-% % generate checksum
-% checksum = sum(sys_dec);
-% checksum = bin2dec(num2str(mod(str2double(dec2bin(checksum)), 10000000)));
-% complete_sysex = [sys_dec checksum];
-%
-% %send sysex
-% sysex = [hex2dec('F0') hex2dec('70') complete_sysex hex2dec('F7')]; %pre- post- ampel
-% ita_midi(sysex,ita_preferences('out_midi_DeviceID'));
-
-end
-
-
-%% get settings
-
-function settings = getInitSettings()
-
- settings.AmpHighPower = false;
- settings.Amplifier = true;
- settings.ampBridgeMode = false;
- settings.ampLowImpedanceMode = false;
- settings.Amp26dBu = false;
- settings.ampAC = false;
- settings.ampMono = false;
- settings.samplingRate = ita_preferences('samplingRate');
- settings.mode = 'norm';
- settings.groundLift = true;
- settings.inputCouplingAC = true;
- settings.ch(1).inputrange = 6;
- settings.ch(2).inputrange = 6;
- settings.ch(1).inputfeed = 'none';
- settings.ch(2).inputfeed = 'none';
- settings.ch(1).inputselect = 'xlr';
- settings.ch(2).inputselect = 'xlr';
-
-% settings.amp_gain = -20;
-
-end
-
-function sArgs = getArgsFromSettings(settings)
-
-sArgs = struct('input',[],'feed',[],'inputrange',[],'channel',1:2,'groundLift',settings.groundLift,'inputCouplingAC',settings.inputCouplingAC,...
- 'mode',settings.mode,'securityMode',false,'init',false,'samplingRate',settings.samplingRate,'outputvolume',[],...
- 'AmpHighPower',settings.AmpHighPower,'AmpLowPower',false,'Amplifier',settings.Amplifier,'NoAmplifier',false,'AmpBridgeMode',settings.ampBridgeMode,'AmpLowImpedanceMode',settings.ampLowImpedanceMode,...
- 'Amp26dBu',settings.Amp26dBu,'Amp06dBu',false , 'NoGroundLift', false, 'AmpAC', settings.ampAC, 'AmpMono', settings.ampMono, 'getSettings',false,'reset',false,'setPreset',false,'getPresets',false,'savePreset',false,'presetName','');
-
-
-end
-
-function settings = setSettingsFromArgs(sArgs,settings)
-
- settings.AmpHighPower = sArgs.AmpHighPower;
- settings.Amplifier = sArgs.Amplifier;
- settings.ampBridgeMode = sArgs.AmpBridgeMode;
- settings.ampLowImpedanceMode = sArgs.AmpLowImpedanceMode;
- settings.Amp26dBu = sArgs.Amp26dBu;
- settings.ampAC = sArgs.AmpAC;
- settings.ampMono = sArgs.AmpMono;
- settings.samplingRate = sArgs.samplingRate;
- settings.mode = sArgs.mode;
- settings.groundLift = sArgs.groundLift;
- settings.inputCouplingAC = sArgs.inputCouplingAC;
-
- for index = 1:length(sArgs.channel)
- if ~isempty(sArgs.inputrange)
- settings.ch(sArgs.channel(index)).inputrange = sArgs.inputrange;
- end
- if ~isempty(sArgs.feed)
- settings.ch(sArgs.channel(index)).inputfeed = sArgs.feed;
- end
- if ~isempty(sArgs.input)
- settings.ch(sArgs.channel(index)).inputselect = sArgs.input;
- end
- end
-end
-
-% input selection
-function IS = getCommandFromInputSelect(in)
-
- switch lower(in)
- case 'xlr'
- IS = '11';
- case 'lemo'
- IS = '01';
- sArgs.feed = 'pol';
- case 'gnd'
- IS = '00';
- case 'bnc'
- IS = '10';
- otherwise
- %JRI error
- disp(['input select unknown'])
- end
-
-end
-
-function returnStruct = getCommandFromFeedSelect(sArgs,channel,settings)
- par_number = '00';
- Wait = '0'; %wait for relays to switch later
- Lem28 = '0'; %switch 14 to 28Volts, Pin7 is then grounded
- Phan = '0';
- Feed = '0';
- ICP = '0';
- Glift = num2str(settings.groundLift);
- AC = num2str(settings.inputCouplingAC);
-
- switch lower(settings.ch(channel).inputfeed)
- case 'pha'
- Phan = '1';
- AC = '1'; %block DC from preamp inputs
- case 'pol'
- Feed = '1';
- AC = '1'; %block DC from preamp inputs
- case {'icp','iepe'}
- ICP = '1';
- Feed = '1';
- AC = '1';
- case 'p+p'
- Phan = '1';
- Feed = '1';
- AC = '1';
- case 'all'
- Phan = '1';
- Feed = '1';
- ICP = '1';
- AC = '1';
- case 'ccx'
- Phan = '0';
- Feed = '0';
- ICP = '0';
- AC = '0';
- Glift = '1';
- case {0 ,'none','off'}
- %
- otherwise
- error('feed wrong')
- end
-
- returnStruct.par_number = par_number;
- returnStruct.Wait = Wait;
- returnStruct.Lem28 = Lem28;
- returnStruct.Phan = Phan;
- returnStruct.Feed = Feed;
- returnStruct.ICP = ICP;
- returnStruct.Glift = Glift;
- returnStruct.AC = AC;
-end
-
diff --git a/applications/Hardware/FrontendControl/ita_aurelio_control_old.m b/applications/Hardware/FrontendControl/ita_aurelio_control_old.m
new file mode 100644
index 0000000000000000000000000000000000000000..cb13c42fa3b85f52361ef5706765e4e75de20112
--- /dev/null
+++ b/applications/Hardware/FrontendControl/ita_aurelio_control_old.m
@@ -0,0 +1,322 @@
+function varargout = ita_aurelio_control(varargin)
+%ITA_AURELIO_CONTROL - Send Settings to Aurelio 2014 Frontend
+% This function sends Midi Sysex Commands to the Aurelio High Precision
+% Frontend (Swen Mueller, Immetro, Rio de Janiero, Brazil).
+%
+% Syntax: ita_aurelio_control(options)
+% 'init' (false): set the frontend to last know values
+% 'range' (0): inputRange as double, will round to nearest possible
+% 'samplingRate' (ita_preferences), 32000, 44100 or 48000 multiplied by 1x, 2x, or 4x.
+% 'coupling'
+%
+% Reference page in Help browser
+% doc ita_robocontrol
+
+%
+% This file is part of the application RoboAurelioModulITAControl for the ITA-Toolbox. All rights reserved.
+% You can find the license for this m-file in the application folder.
+%
+
+% Author: Pascal Dietrich - pdi@akustik.rwth-aachen.de
+
+%% persistent
+persistent oldSettings last_input last_AmpHighPower last_Amplifier last_AmpBridgeMode last_AmpLowImpedanceMode last_Amp26dBu last_AmpAC last_AmpMono
+% force_init = false;
+if isempty(last_input)
+ % force_init = true;
+ last_input = 'xlr';
+ last_AmpHighPower = false;
+ last_Amplifier = true;
+ last_AmpBridgeMode = false;
+ last_AmpLowImpedanceMode = false;
+ last_Amp26dBu = false;
+ last_AmpAC = false;
+ last_AmpMono = false;
+ oldSettings.ch(1).inputrange = 6;
+ oldSettings.ch(2).inputrange = 6;
+ oldSettings.ch(1).inputfeed = 'none';
+ oldSettings.ch(2).inputfeed = 'none';
+ oldSettings.ch(1).inputselect = 'xlr';
+ oldSettings.ch(2).inputselect = 'xlr';
+
+ oldSettings.amp_gain = -20;
+end
+
+if nargin == 0
+ ita_aureliocontrol_gui();
+end
+
+%% init
+sArgs = struct('channel',1:2,'groundLift',true,'inputCouplingAC',true,'feed',oldSettings.ch(1).inputfeed,'inputrange',[],...
+ 'input',last_input,'mode','norm','securityMode',false,'init',false,'samplingRate',ita_preferences('samplingRate'),'outputvolume',[],...
+ 'AmpHighPower',last_AmpHighPower,'AmpLowPower',false,'Amplifier',last_Amplifier,'NoAmplifier',false,'AmpBridgeMode',last_AmpBridgeMode,'AmpLowImpedanceMode',last_AmpLowImpedanceMode,...
+ 'Amp26dBu',last_Amp26dBu,'Amp06dBu',false , 'NoGroundLift', false, 'AmpAC', last_AmpAC, 'AmpMono', last_AmpMono, 'getSettings',false,'reset',false);
+
+%% parse
+[sArgs] = ita_parse_arguments(sArgs,varargin);
+ch_number = ita_angle2str( sArgs.channel - 1, 2); %zero indexing for channel numbering
+
+if sArgs.getSettings
+ varargout{1} = oldSettings;
+ return;
+end
+
+if sArgs.reset
+ clear all
+ ita_aurelio_control('init');
+ if nargout == 1
+ varargout{1} = [];
+ end
+ return;
+end
+
+%% inverse parameters
+if sArgs.Amp06dBu
+ sArgs.Amp26dBu = false;
+end
+if sArgs.NoAmplifier
+ sArgs.Amplifier = false;
+end
+if sArgs.AmpLowPower
+ sArgs.AmpHighPower = false;
+end
+if sArgs.NoGroundLift
+ sArgs.groundLift = false;
+ % sArgs.feed = 'none';
+end
+
+%% write back to persistents
+last_input = sArgs.input;
+last_AmpHighPower = sArgs.AmpHighPower;
+last_Amplifier = sArgs.Amplifier;
+last_AmpBridgeMode = sArgs.AmpBridgeMode;
+last_AmpLowImpedanceMode = sArgs.AmpLowImpedanceMode;
+last_Amp26dBu = sArgs.Amp26dBu;
+last_AmpAC = sArgs.AmpAC;
+last_AmpMono = sArgs.AmpMono;
+
+%% INIT device
+if sArgs.init
+ % go thru all stages
+ clear
+ ita_aurelio_control('input','XLR','inputrange',6,'feed',0 , 'samplingRate',ita_preferences('samplingRate'));
+ return
+end
+
+%% range
+if ~isempty( sArgs.inputrange )
+ sArgs.inputrange = min( max(sArgs.inputrange,-34) , 56);
+ par_number = '02';
+ par_value = round((- sArgs.inputrange + 56)/10); %round to nearest possible
+ for idx = 1:numel(sArgs.channel)
+ oldSettings.ch(sArgs.channel(idx)).inputrange = 56 - (par_value * 10);
+ end
+ if sArgs.securityMode
+ par_value = par_value + 40;
+ end
+ par_value = ita_angle2str(par_value,2);
+ send_sysex(par_number, par_value, ch_number); %send to device
+end
+
+%% input select -- routing control -- HUHU old values needed
+if ~isempty(sArgs.input)
+ par_number = '01';
+ switch lower(sArgs.mode)
+ case 'norm' %normal mode
+ Mode = '0000';
+ case 'imp' %impedance measurement
+ Mode = '0001';
+ sArgs.feed = false;
+ % ChSwp = '1'; % pdi: oct 2012: for some reason
+ % this is not required anymore ???!!!
+ case {'impref','iref'}
+ Mode = '0010';
+ sArgs.feed = false;
+ case {'bncref','bref'}
+ Mode = '0100';
+ sArgs.input = 'gnd';
+ sArgs.feed = false;
+ case {'ampref','aref'}
+ Mode = '0101';
+ sArgs.input = 'gnd';
+ sArgs.feed = false;
+ case {'xlrref','xref','lineref'}
+ Mode = '0011';
+ sArgs.feed = false;
+ case 'specialref'
+ Mode = ['010' num2str(~ch_number) ];
+ sArgs.input = 'gnd';
+ otherwise
+ error('argument not correct for ''input''')
+ end
+
+ if ~exist('ChSwp','var')
+ ChSwp = '0'; %funny channel swapping for crazy people. take care, dude!
+ else
+ ita_verbose_info('Careful, channel swapping is activated.',0)
+ end
+
+ switch lower(sArgs.input)
+ case 'xlr'
+ IS = '11';
+ case 'lemo'
+ IS = '01';
+ sArgs.feed = 'pol';
+ case 'gnd'
+ IS = '00';
+ case 'bnc'
+ IS = '10';
+ otherwise
+ error(['input select unknown: ' sArgs.input])
+ end
+ par_value = dec2hex( bin2dec( [IS ChSwp Mode ] ) );
+ send_sysex(par_number, par_value, ch_number); %send to device
+
+ for iCh = 1:numel(sArgs.channel)
+ oldSettings.ch(sArgs.channel(iCh)).inputselect = lower(sArgs.input);
+ end
+end
+
+%% coupling and feed control
+if ~isempty( sArgs.feed )
+ par_number = '00';
+ Wait = '0'; %wait for relays to switch later
+ Lem28 = '0'; %switch 14 to 28Volts, Pin7 is then grounded
+ Phan = '0';
+ Feed = '0';
+ ICP = '0';
+ Glift = num2str(sArgs.groundLift);
+ AC = num2str(sArgs.inputCouplingAC);
+
+ switch lower(sArgs.feed)
+ case 'pha'
+ Phan = '1';
+ AC = '1'; %block DC from preamp inputs
+ case 'pol'
+ Feed = '1';
+ AC = '1'; %block DC from preamp inputs
+ case {'icp','iepe'}
+ ICP = '1';
+ Feed = '1';
+ AC = '1';
+ case 'p+p'
+ Phan = '1';
+ Feed = '1';
+ AC = '1';
+ case 'all'
+ Phan = '1';
+ Feed = '1';
+ ICP = '1';
+ AC = '1';
+ case 'ccx'
+ Phan = '0';
+ Feed = '0';
+ ICP = '0';
+ AC = '0';
+ Glift = '1';
+ case {0 ,'none','off'}
+ %
+ otherwise
+ error('feed wrong')
+ end
+ par_value = dec2hex( bin2dec ( ['0' Wait Lem28 Phan Feed ICP Glift AC] ));
+ send_sysex(par_number, par_value, ch_number); % send final sysex
+
+ for iCh = 1:numel(sArgs.channel)
+ oldSettings.ch(sArgs.channel(iCh)).inputfeed = lower(sArgs.feed);
+ end
+end
+
+%% sampling rate
+if sArgs.samplingRate
+ par_number = '03';
+
+ if isnatural(sArgs.samplingRate / 48000)
+ modifier = (sArgs.samplingRate / 48000);
+ base_rate = 2;
+ elseif isnatural(sArgs.samplingRate / 44100)
+ modifier = sArgs.samplingRate / 44100;
+ base_rate = 1;
+ elseif isnatural(sArgs.samplingRate / 32000)
+ modifier = sArgs.samplingRate / 32000;
+ base_rate = 0;
+ else
+ error('sampling rate not supported.')
+ end
+ switch modifier
+ case 1
+ modifier = 0;
+ case 2
+ modifier = 1;
+ case 4
+ modifier = 2;
+ otherwise
+ error('sampling rate not supported.')
+ end
+ par_value = dec2hex(modifier*4 + base_rate);
+ send_sysex(par_number, par_value, []); % send final sysex
+
+ ita_preferences('samplingRate',sArgs.samplingRate); % also initializes playrec
+end
+
+
+
+%% analog output control - Parameter 05
+HiPow = num2str(sArgs.AmpHighPower);
+AmpOn = num2str(sArgs.Amplifier);
+Bridge = num2str(sArgs.AmpBridgeMode);
+LoImp = num2str(sArgs.AmpLowImpedanceMode);
+dBu26 = num2str(sArgs.Amp26dBu);
+AC = num2str(sArgs.AmpAC);
+mono = num2str(sArgs.AmpMono);
+
+par_number = '05';
+par_value = dec2hex(bin2dec(['0' HiPow AmpOn Bridge LoImp dBu26 AC mono])); % 0dB attenuation
+send_sysex(par_number, par_value, ch_number); %send to device
+
+if sArgs.Amp06dBu
+ oldSettings.amp_gain = -20;
+elseif sArgs.Amp26dBu
+ oldSettings.amp_gain = 0;
+end
+
+
+%% output volume - Parameter 06
+% if ~isempty( sArgs.outputvolume )
+% par_number = '06';
+% par_value = '7F'; % 0dB attenuation
+% send_sysex(par_number, '0', []); %send to device
+% end
+
+
+
+
+end
+
+%% ********************** send sysex ************************************
+function send_sysex(par_number, par_value, ch_number)
+if ~isempty(ch_number) && numel(str2num(ch_number)) >= 2
+ ch_number = '7F';
+end
+%build complete sysex
+sys_hex = {};
+sys_hex{numel(sys_hex)+1} = par_number; % hex
+sys_hex{numel(sys_hex)+1} = par_value; % hex
+if ~isempty(ch_number)
+ sys_hex{numel(sys_hex)+1} = ch_number; % hex
+end
+
+for idx = 1:numel(sys_hex)
+ sys_dec(idx) = hex2dec( sys_hex{idx} );
+end
+
+% generate checksum
+checksum = sum(sys_dec);
+checksum = bin2dec(num2str(mod(str2double(dec2bin(checksum)), 10000000)));
+complete_sysex = [sys_dec checksum];
+
+%send sysex
+sysex = [hex2dec('F0') hex2dec('70') complete_sysex hex2dec('F7')]; %pre- post- ampel
+ita_midi(sysex,ita_preferences('out_midi_DeviceID'));
+
+end
diff --git a/applications/Hardware/FrontendControl/ita_aureliocontrol_gui.m b/applications/Hardware/FrontendControl/ita_aureliocontrol_gui.m
index 528e2dc20ee57aa3670cd3411e4a3ba2f3cb7429..334f2ad57a9cd4984b95c5a0ec8640b4494a2411 100644
--- a/applications/Hardware/FrontendControl/ita_aureliocontrol_gui.m
+++ b/applications/Hardware/FrontendControl/ita_aureliocontrol_gui.m
@@ -1,12 +1,12 @@
function ita_aureliocontrol_gui(varargin)
-% ITA_AURELIOCONTROL_GUI - gui for aurelio remote control
+% ita_aureliocontrol_gui - gui for aurelio remote control
%
% This file is part of the application RoboAurelioModulITAControl for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
%
-oldSettings = ita_aurelio_control('getSettings');
+[currentSettings, presetNames, currentPresetNumber,presetChanged] = ita_aurelio_control('getSettings');
persistent hFigure
%% nice gui settings
@@ -14,7 +14,7 @@ gui_bg_color = [0.8 0.8 0.8];
if nargin == 0
width = 440;
- height = 540;
+ height = 640;
mpos = get(0,'Monitor'); %try to position in the middle of the screen
w_position = (mpos(1,length(mpos)-1)/2)-(width/2);
@@ -59,6 +59,8 @@ ver_space = 0.5;
button_height = 1.5;
button_width = 20;
+button_space = 0.125;
+lower_space = 0.25;
for ch_idx = 1:2
%% FEED
@@ -66,7 +68,8 @@ for ch_idx = 1:2
nameStr = {'NONE','Pol','Pha','P+P','icp','all'};
nButtons = length(nameStr);
- InputFeed{ch_idx}.Size = [button_width+1 (nButtons+1) * (button_height)];
+
+ InputFeed{ch_idx}.Size = [button_width+1 (nButtons+1) * (button_height+button_space)];
InputFeed{ch_idx}.Position = [hor_start ver_start InputFeed{ch_idx}.Size];
InputFeed{ch_idx}.h = uibuttongroup(...
'Parent',hFigure,...
@@ -80,8 +83,9 @@ for ch_idx = 1:2
'SelectedObject',[],...
'SelectionChangeFcn',@InputFeedCallback,...
'OldSelectedObject',[]);
+
- position = [0 0 button_width button_height];
+ position = [lower_space button_space button_width button_height];
for button_idx = 1:nButtons
InputFeed{ch_idx}.hButton(button_idx) = uicontrol(...
'Parent',InputFeed{ch_idx}.h,...
@@ -92,15 +96,15 @@ for ch_idx = 1:2
'String',nameStr{button_idx},...
'Style','togglebutton',...
'UserData',userdata,...
- 'Value',strcmpi(nameStr{button_idx},oldSettings.ch(ch_idx).inputfeed),...
+ 'Value',strcmpi(nameStr{button_idx},currentSettings.ch(ch_idx).inputfeed),...
'Tag','togglebuttonNorm');
- position = position + [0 button_height 0 0];
+ position = position + [0 button_height+button_space 0 0];
end
%% INPUT SELECT
nameStr = {'Lemo','XLR','gnd','BNC'};
nButtons = length(nameStr);
- InputSelect{ch_idx}.Size = [button_width+1 (nButtons+1) * (button_height)];
+ InputSelect{ch_idx}.Size = [button_width+1 (nButtons+1) * (button_height+button_space)];
InputSelect{ch_idx}.Position = [InputFeed{ch_idx}.Position(1) InputFeed{ch_idx}.Position(2)+ InputFeed{ch_idx}.Position(4)+ver_space InputSelect{ch_idx}.Size];
InputSelect{ch_idx}.h = uibuttongroup(...
'Parent',hFigure,...
@@ -115,7 +119,7 @@ for ch_idx = 1:2
'SelectionChangeFcn',@InputSelectCallback,...
'OldSelectedObject',[]);
- position = [0 0 button_width button_height];
+ position = [lower_space button_space button_width button_height];
for button_idx = 1:nButtons
InputSelect{ch_idx}.hButton(button_idx) = uicontrol(...
'Parent',InputSelect{ch_idx}.h,...
@@ -125,9 +129,9 @@ for ch_idx = 1:2
'String',nameStr{button_idx},...
'UserData',userdata,...
'Style','togglebutton',...
- 'Value',strcmpi(nameStr{button_idx},oldSettings.ch(ch_idx).inputselect),...
+ 'Value',strcmpi(nameStr{button_idx},currentSettings.ch(ch_idx).inputselect),...
'Tag','togglebuttonNorm');
- position = position + [0 button_height 0 0];
+ position = position + [0 button_height+button_space 0 0];
end
%% INPUT RANGE
@@ -135,7 +139,7 @@ for ch_idx = 1:2
nameStr = cellstr(num2str(inputRange_vec'));
nButtons = length(nameStr);
- InputRange{ch_idx}.Size = [button_width+1 (nButtons+1) * (button_height)];
+ InputRange{ch_idx}.Size = [button_width+1 (nButtons+1) * (button_height+button_space)];
InputRange{ch_idx}.Position = [InputSelect{ch_idx}.Position(1) InputSelect{ch_idx}.Position(2)+ InputSelect{ch_idx}.Position(4)+ver_space InputRange{ch_idx}.Size];
InputRange{ch_idx}.h = uibuttongroup(...
'Parent',hFigure,...
@@ -150,7 +154,7 @@ for ch_idx = 1:2
'SelectionChangeFcn',@InputRangeCallback,...
'OldSelectedObject',[]);
- position = [0 0 button_width button_height];
+ position = [lower_space button_space button_width button_height];
for button_idx = 1:nButtons
InputRange{ch_idx}.hButton(button_idx) = uicontrol(...
'Parent',InputRange{ch_idx}.h,...
@@ -161,9 +165,9 @@ for ch_idx = 1:2
'BackgroundColor',[0.1 0.9 0.1],...
'UserData',userdata,...
'Style','togglebutton',...
- 'Value',oldSettings.ch(ch_idx).inputrange == inputRange_vec(button_idx),...
+ 'Value',currentSettings.ch(ch_idx).inputrange == inputRange_vec(button_idx),...
'Tag','togglebuttonNorm');
- position = position + [0 button_height 0 0];
+ position = position + [0 button_height+button_space 0 0];
end
hor_start = hor_start + button_width + hor_space;
@@ -192,7 +196,7 @@ argCell{ele} = {'mode','norm'};
%% generate modebuttons
InputFeed = InputFeed(1);
nButtons = length(nameStr);
-InputFeed{1}.Size = [button_width+1 (nButtons+1) * (button_height)];
+InputFeed{1}.Size = [button_width+1 (nButtons+1) * (button_height+button_space)];
InputFeed{1}.Position = [hor_start+1 ver_start InputFeed{1}.Size];
InputFeed{1}.h = uibuttongroup(...
'Parent',hFigure,...
@@ -204,9 +208,10 @@ InputFeed{1}.h = uibuttongroup(...
'Position',InputFeed{1}.Position,...
'BackgroundColor',gui_bg_color,...
'SelectedObject',[],...
- 'OldSelectedObject',[]);
+ 'OldSelectedObject',[], ...
+ 'SelectionChangeFcn',@modePushButtonCallback);
ch_idx = 1;
-position = [0 0 button_width button_height];
+position = [lower_space button_space button_width button_height];
for button_idx = 1:nButtons
userdata = argCell{button_idx};
ControlButton{ch_idx}.hButton(button_idx) = uicontrol(...
@@ -215,12 +220,11 @@ for button_idx = 1:nButtons
'FontSize',10,...
'Position',position,...
'String',nameStr{button_idx},...
- 'Style','pushbutton',...
- 'Callback',@modePushButtonCallback,...
+ 'Style','togglebutton',...
'UserData',userdata,...
- 'Value',0,...
+ 'Value',strcmpi(currentSettings.mode,argCell{button_idx}{2}),...
'Tag','');
- position = position + [0 button_height 0 0];
+ position = position + [0 button_height+button_space 0 0];
end
@@ -230,39 +234,44 @@ argCell = {};
ele = 1;
nameStr{ele} = {'Init'};
argCell{ele} = {'init'};
+tooltip{ele} = {'Reinitialize the Aurelio'};
% ele = ele + 1;
% nameStr{ele} = {['Reset']};
% argCell{ele} = {'Reset'};
ele = ele + 1;
-nameStr{ele} = {'Amplifier'};
+nameStr{ele} = {'Use Amplifier'};
argCell{ele} = {'Amplifier'};
+tooltip{ele} = {'Turn the amplifier on'};
ele = ele + 1;
-nameStr{ele} = {'NoAmplifier'};
-argCell{ele} = {'NoAmplifier'};
-ele = ele + 1;
-nameStr{ele} = {'Amp26dBu'};
+% nameStr{ele} = {'NoAmplifier'};
+% argCell{ele} = {'NoAmplifier'};
+% ele = ele + 1;
+nameStr{ele} = {'Amp +20dB'};
argCell{ele} = {'Amp26dBu'};
+tooltip{ele} = {'Amp + 20 dB'};
ele = ele + 1;
-nameStr{ele} = {'Amp06dBu'};
-argCell{ele} = {'Amp06dBu'};
-ele = ele + 1;
+% nameStr{ele} = {'Amp06dBu'};
+% argCell{ele} = {'Amp06dBu'};
+% ele = ele + 1;
nameStr{ele} = {'AmpHighPower'};
argCell{ele} = {'AmpHighPower'};
+tooltip{ele} = {'Activate High power Amp'};
ele = ele + 1;
-nameStr{ele} = {'AmpLowPower'};
-argCell{ele} = {'AmpLowPower'};
-ele = ele + 1;
+% nameStr{ele} = {'AmpLowPower'};
+% argCell{ele} = {'AmpLowPower'};
+% ele = ele + 1;
nameStr{ele} = {'GroundLift'};
-argCell{ele} = {'GroundLift'};
-ele = ele + 1;
-nameStr{ele} = {'NoGroundLift'};
-argCell{ele} = {'NoGroundLift'};
+argCell{ele} = {'groundLift'};
+tooltip{ele} = {'Use ground lift'};
+% ele = ele + 1;
+% nameStr{ele} = {'NoGroundLift'};
+% argCell{ele} = {'NoGroundLift'};
%% controlbuttons (push)
nButtons = length(nameStr);
-InputFeed{1}.Size = [button_width+1 (nButtons+1) * (button_height)];
+InputFeed{1}.Size = [button_width+1 (nButtons+1) * (button_height+button_space)];
InputFeed{1}.Position = [InputFeed{1}.Position(1) InputFeed{1}.Position(2)+ InputFeed{1}.Position(4)+ver_space InputFeed{1}.Size];
% InputFeed{ch_idx}.Position = [hor_start ver_start InputFeed{ch_idx}.Size];
InputFeed{1}.h = uipanel(...
@@ -276,8 +285,10 @@ InputFeed{1}.h = uipanel(...
'BackgroundColor',gui_bg_color);
-position = [0 0 button_width button_height];
-for button_idx = 1:length(nameStr)
+position = [lower_space button_space button_width button_height];
+
+% checkboxes
+for button_idx = 2:length(nameStr)
userdata = argCell{button_idx};
ControlButton{ch_idx}.hButton(button_idx) = uicontrol(...
'Units','characters',...
@@ -285,36 +296,62 @@ for button_idx = 1:length(nameStr)
'FontSize',10,...
'Position',[position],...
'String',nameStr{button_idx},...
- 'Style','pushbutton',...
- 'Callback',@controlPushButtonCallback,...
+ 'Style','checkbox',...
+ 'Callback',@controlCheckboxCallback,...
'UserData',userdata,...
- 'Value',0,...
- 'Tag','');
- position = position + [0 button_height 0 0];
+ 'Value',currentSettings.(argCell{button_idx}{1}),...
+ 'Tag','', ...
+ 'Tooltip',tooltip{button_idx}{1});
+ position = position + [0 button_height+button_space 0 0];
end
+% init button
+userdata = argCell{1};
+ControlButton{ch_idx}.hButton(1) = uicontrol(...
+ 'Units','characters',...
+ 'Parent',InputFeed{1}.h,...
+ 'FontSize',10,...
+ 'Position',[position],...
+ 'String',nameStr{1},...
+ 'Style','pushbutton',...
+ 'Callback',@controlPushButtonCallback,...
+ 'UserData',userdata,...
+ 'Value',0,...
+ 'Tag','');
+position = position + [0 button_height+button_space 0 0];
+
%% sampling rate
nameStr = {};
argCell = {};
ele = 1;
-nameStr{ele} = {'96000'};
-argCell{ele} = {96000};
+nameStr{ele} = {'44100'};
+argCell{ele} = {44100};
+ele = ele + 1;
+nameStr{ele} = {'48000'};
+argCell{ele} = {48000};
ele = ele + 1;
nameStr{ele} = {'88200'};
argCell{ele} = {88200};
ele = ele + 1;
-nameStr{ele} = {'48000'};
-argCell{ele} = {48000};
+nameStr{ele} = {'96000'};
+argCell{ele} = {96000};
ele = ele + 1;
-nameStr{ele} = {'44100'};
-argCell{ele} = {44100};
+samplingValue = 0;
+for index = 1:length(nameStr)
+ if argCell{index}{1} == currentSettings.samplingRate
+ samplingValue = index;
+ end
+end
+
+
+nameStr = {'44100','48000','88200','96000'};
%% controlbuttons (push)
-nButtons = length(nameStr);
+nButtons = 1;
-InputFeed{1}.Size = [button_width+1 (nButtons+1) * (button_height)];
+InputFeed{1}.Size = [button_width+1 (nButtons+1) * (button_height+button_space)];
InputFeed{1}.Position = [InputFeed{1}.Position(1) InputFeed{1}.Position(2)+ InputFeed{1}.Position(4)+ver_space InputFeed{1}.Size];
% InputFeed{ch_idx}.Position = [hor_start ver_start InputFeed{ch_idx}.Size];
InputFeed{1}.h = uipanel(...
@@ -324,32 +361,86 @@ InputFeed{1}.h = uipanel(...
'Title','SamplingRate',...
'Tag','Mode',...
'Clipping','on',...
- 'Position',InputFeed{ch_idx}.Position,...
+ 'Position',InputFeed{1}.Position,...
'BackgroundColor',gui_bg_color);
+position = [lower_space button_space button_width button_height];
+ControlButton{1}.hButton(1) = uicontrol(...
+ 'Units','characters',...
+ 'Parent',InputFeed{1}.h,...
+ 'FontSize',10,...
+ 'Position',position,...
+ 'String',nameStr,...
+ 'Style','popupmenu',...
+ 'Callback',@samplingRateButtonCallback,...
+ 'UserData',[],...
+ 'Value',samplingValue,...
+ 'Tag','');
+position = position + [0 button_height+button_space 0 0];
-position = [0 0 button_width button_height];
-for button_idx = 1:length(nameStr)
- userdata = argCell{button_idx};
- ControlButton{ch_idx}.hButton(button_idx) = uicontrol(...
+
+
+%% presets
+nButtons = 2;
+
+
+% to get it up top to align with InputRange box, get its position and size
+inputHeight = InputRange{1}.Position(2) + InputRange{1}.Size(2);
+
+
+InputFeed{1}.Size = [button_width+1 (nButtons+1) * (button_height+button_space)];
+InputFeed{1}.Position = [InputFeed{1}.Position(1) inputHeight - InputFeed{1}.Size(2) InputFeed{1}.Size];
+% InputFeed{ch_idx}.Position = [hor_start ver_start InputFeed{ch_idx}.Size];
+InputFeed{1}.h = uipanel(...
+ 'Parent',hFigure,...
+ 'Units','characters',...
+ 'FontSize',10,...
+ 'Title','Settings Presets',...
+ 'Tag','Mode',...
+ 'Clipping','on',...
+ 'Position',InputFeed{1}.Position,...
+ 'BackgroundColor',gui_bg_color);
+
+position = [lower_space button_space button_width button_height];
+PresetButton{1}.hButton(1) = uicontrol(...
'Units','characters',...
'Parent',InputFeed{1}.h,...
'FontSize',10,...
- 'Position',position,...
- 'String',nameStr{button_idx},...
+ 'Position',[position],...
+ 'String','Save',...
'Style','pushbutton',...
- 'Callback',@samplingRateButtonCallback,...
+ 'Callback',@presetSaveCallback,...
'UserData',userdata,...
- 'Value',0,...
'Tag','');
- position = position + [0 button_height 0 0];
+position = position + [0 button_height+button_space 0 0];
+
+names = presetNames;
+
+if ~presetChanged
+ popupValue = currentPresetNumber;
+else
+ currentSettings = {'currentSettings'};
+ names = [presetNames currentSettings];
+ popupValue = length(names);
end
+PresetMenu{ch_idx}.hButton(1) = uicontrol(...
+ 'Units','characters',...
+ 'Parent',InputFeed{1}.h,...
+ 'FontSize',10,...
+ 'Position',position,...
+ 'String',names,...
+ 'Style','popupmenu',...
+ 'Callback',@presetMenuCallback,...
+ 'UserData',[],...
+ 'Value',popupValue,...
+ 'Tag','');
+
%% callback functions
function modePushButtonCallback(h,event)
- userdata = getfield(get(h),'UserData');
+ userdata = getfield(get(event.NewValue),'UserData');
argCell = userdata;
if ~isempty(argCell)
ita_aurelio_control(argCell{:});
@@ -378,11 +469,37 @@ end
end
end
+ function controlCheckboxCallback(h,event)
+ argCell = getfield(get(h),'UserData');
+ if ~isempty(argCell)
+ if strfind(argCell{1},'davolume')
+ a = ita_modulita_control('getSettings');
+ davolume = a.davolume;
+ if strfind(argCell{1},'--')
+ davolume = davolume - 1;
+ else
+ davolume = davolume + 1;
+ end
+ ita_aurelio_control('davolume',davolume);
+ % set(event.NewValue,'UserData',argCell);
+ else
+ argCell{end+1} = get(h,'Value');
+ ita_aurelio_control(argCell{:});
+ ita_aureliocontrol_gui('init');
+ end
+ end
+
+ end
+
function samplingRateButtonCallback(h,event)
- argCell = getfield(get(h),'UserData');
+ value = get(h,'Value');
+ strings = get(h,'String');
+
+ argCell{1} = str2num(strings{value});
if ~isempty(argCell)
ita_aurelio_control('samplingRate',argCell{1});
+ ita_aureliocontrol_gui('init');
end
end
@@ -391,6 +508,7 @@ end
userdata = getfield(get(event.NewValue),'UserData');
inputselect = getfield(get(event.NewValue),'String');
ita_aurelio_control('channel',userdata.ch,'input',inputselect);
+ ita_aureliocontrol_gui('init');
end
@@ -398,6 +516,7 @@ end
userdata = getfield(get(event.NewValue),'UserData');
inputfeed = getfield(get(event.NewValue),'String');
ita_aurelio_control('channel',userdata.ch,'feed',inputfeed);
+ ita_aureliocontrol_gui('init');
end
@@ -406,6 +525,56 @@ end
value = getfield(get(event.NewValue),'String');
inputrange = str2num(value); %#ok
ita_aurelio_control('channel',userdata.ch,'inputrange',inputrange);
+ ita_aureliocontrol_gui('init');
end
+
+ function presetMenuCallback(h,event)
+ value = get(h,'Value');
+ strings = get(h,'String');
+
+ if value <= length(strings)
+ ita_aurelio_control('setPreset',1,'presetName',strings{value});
+ ita_aureliocontrol_gui('init');
+ end
+
+ end
+
+
+ function presetSaveCallback(h,event)
+
+ isValidName = 0;
+ abort = 0;
+ inputString = 'Please give a preset name';
+ while ~isValidName
+ newTitle = inputdlg(inputString,'New Preset');
+ if ~isempty(newTitle)
+ if ~isempty(newTitle{1})
+ isValidName = 1;
+ % check if the name is already in use
+ for index = 1:length(presetNames)
+ if strcmp(newTitle{1},presetNames{index})
+ isValidName = 0;
+ inputString = 'Name already in use:';
+ end
+ end
+ else
+ % ok but no name
+ isValidName = 0;
+ inputString = 'Name was empty. Please give a name:';
+ end
+ else
+ % abort case
+ abort = 1;
+ isValidName = 1;
+ end
+ end
+
+ if ~abort
+ ita_aurelio_control('savePreset',1,'presetName',newTitle{1});
+ ita_aureliocontrol_gui('init');
+ end
+ end
+
+
end
\ No newline at end of file
diff --git a/applications/Hardware/FrontendControl/ita_aureliocontrol_gui_new.m b/applications/Hardware/FrontendControl/ita_aureliocontrol_gui_old.m
similarity index 56%
rename from applications/Hardware/FrontendControl/ita_aureliocontrol_gui_new.m
rename to applications/Hardware/FrontendControl/ita_aureliocontrol_gui_old.m
index 03abd11f70b9de7a67dac3fb34dcc32c484c2e41..528e2dc20ee57aa3670cd3411e4a3ba2f3cb7429 100644
--- a/applications/Hardware/FrontendControl/ita_aureliocontrol_gui_new.m
+++ b/applications/Hardware/FrontendControl/ita_aureliocontrol_gui_old.m
@@ -1,12 +1,12 @@
-function ita_aureliocontrol_gui_new(varargin)
-% ita_aureliocontrol_gui_new - gui for aurelio remote control
+function ita_aureliocontrol_gui(varargin)
+% ITA_AURELIOCONTROL_GUI - gui for aurelio remote control
%
% This file is part of the application RoboAurelioModulITAControl for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
%
-[currentSettings, presetNames, currentPresetNumber,presetChanged] = ita_aurelio_control_new('getSettings');
+oldSettings = ita_aurelio_control('getSettings');
persistent hFigure
%% nice gui settings
@@ -14,7 +14,7 @@ gui_bg_color = [0.8 0.8 0.8];
if nargin == 0
width = 440;
- height = 640;
+ height = 540;
mpos = get(0,'Monitor'); %try to position in the middle of the screen
w_position = (mpos(1,length(mpos)-1)/2)-(width/2);
@@ -59,8 +59,6 @@ ver_space = 0.5;
button_height = 1.5;
button_width = 20;
-button_space = 0.125;
-lower_space = 0.25;
for ch_idx = 1:2
%% FEED
@@ -68,8 +66,7 @@ for ch_idx = 1:2
nameStr = {'NONE','Pol','Pha','P+P','icp','all'};
nButtons = length(nameStr);
-
- InputFeed{ch_idx}.Size = [button_width+1 (nButtons+1) * (button_height+button_space)];
+ InputFeed{ch_idx}.Size = [button_width+1 (nButtons+1) * (button_height)];
InputFeed{ch_idx}.Position = [hor_start ver_start InputFeed{ch_idx}.Size];
InputFeed{ch_idx}.h = uibuttongroup(...
'Parent',hFigure,...
@@ -83,9 +80,8 @@ for ch_idx = 1:2
'SelectedObject',[],...
'SelectionChangeFcn',@InputFeedCallback,...
'OldSelectedObject',[]);
-
- position = [lower_space button_space button_width button_height];
+ position = [0 0 button_width button_height];
for button_idx = 1:nButtons
InputFeed{ch_idx}.hButton(button_idx) = uicontrol(...
'Parent',InputFeed{ch_idx}.h,...
@@ -96,15 +92,15 @@ for ch_idx = 1:2
'String',nameStr{button_idx},...
'Style','togglebutton',...
'UserData',userdata,...
- 'Value',strcmpi(nameStr{button_idx},currentSettings.ch(ch_idx).inputfeed),...
+ 'Value',strcmpi(nameStr{button_idx},oldSettings.ch(ch_idx).inputfeed),...
'Tag','togglebuttonNorm');
- position = position + [0 button_height+button_space 0 0];
+ position = position + [0 button_height 0 0];
end
%% INPUT SELECT
nameStr = {'Lemo','XLR','gnd','BNC'};
nButtons = length(nameStr);
- InputSelect{ch_idx}.Size = [button_width+1 (nButtons+1) * (button_height+button_space)];
+ InputSelect{ch_idx}.Size = [button_width+1 (nButtons+1) * (button_height)];
InputSelect{ch_idx}.Position = [InputFeed{ch_idx}.Position(1) InputFeed{ch_idx}.Position(2)+ InputFeed{ch_idx}.Position(4)+ver_space InputSelect{ch_idx}.Size];
InputSelect{ch_idx}.h = uibuttongroup(...
'Parent',hFigure,...
@@ -119,7 +115,7 @@ for ch_idx = 1:2
'SelectionChangeFcn',@InputSelectCallback,...
'OldSelectedObject',[]);
- position = [lower_space button_space button_width button_height];
+ position = [0 0 button_width button_height];
for button_idx = 1:nButtons
InputSelect{ch_idx}.hButton(button_idx) = uicontrol(...
'Parent',InputSelect{ch_idx}.h,...
@@ -129,9 +125,9 @@ for ch_idx = 1:2
'String',nameStr{button_idx},...
'UserData',userdata,...
'Style','togglebutton',...
- 'Value',strcmpi(nameStr{button_idx},currentSettings.ch(ch_idx).inputselect),...
+ 'Value',strcmpi(nameStr{button_idx},oldSettings.ch(ch_idx).inputselect),...
'Tag','togglebuttonNorm');
- position = position + [0 button_height+button_space 0 0];
+ position = position + [0 button_height 0 0];
end
%% INPUT RANGE
@@ -139,7 +135,7 @@ for ch_idx = 1:2
nameStr = cellstr(num2str(inputRange_vec'));
nButtons = length(nameStr);
- InputRange{ch_idx}.Size = [button_width+1 (nButtons+1) * (button_height+button_space)];
+ InputRange{ch_idx}.Size = [button_width+1 (nButtons+1) * (button_height)];
InputRange{ch_idx}.Position = [InputSelect{ch_idx}.Position(1) InputSelect{ch_idx}.Position(2)+ InputSelect{ch_idx}.Position(4)+ver_space InputRange{ch_idx}.Size];
InputRange{ch_idx}.h = uibuttongroup(...
'Parent',hFigure,...
@@ -154,7 +150,7 @@ for ch_idx = 1:2
'SelectionChangeFcn',@InputRangeCallback,...
'OldSelectedObject',[]);
- position = [lower_space button_space button_width button_height];
+ position = [0 0 button_width button_height];
for button_idx = 1:nButtons
InputRange{ch_idx}.hButton(button_idx) = uicontrol(...
'Parent',InputRange{ch_idx}.h,...
@@ -165,9 +161,9 @@ for ch_idx = 1:2
'BackgroundColor',[0.1 0.9 0.1],...
'UserData',userdata,...
'Style','togglebutton',...
- 'Value',currentSettings.ch(ch_idx).inputrange == inputRange_vec(button_idx),...
+ 'Value',oldSettings.ch(ch_idx).inputrange == inputRange_vec(button_idx),...
'Tag','togglebuttonNorm');
- position = position + [0 button_height+button_space 0 0];
+ position = position + [0 button_height 0 0];
end
hor_start = hor_start + button_width + hor_space;
@@ -196,7 +192,7 @@ argCell{ele} = {'mode','norm'};
%% generate modebuttons
InputFeed = InputFeed(1);
nButtons = length(nameStr);
-InputFeed{1}.Size = [button_width+1 (nButtons+1) * (button_height+button_space)];
+InputFeed{1}.Size = [button_width+1 (nButtons+1) * (button_height)];
InputFeed{1}.Position = [hor_start+1 ver_start InputFeed{1}.Size];
InputFeed{1}.h = uibuttongroup(...
'Parent',hFigure,...
@@ -208,10 +204,9 @@ InputFeed{1}.h = uibuttongroup(...
'Position',InputFeed{1}.Position,...
'BackgroundColor',gui_bg_color,...
'SelectedObject',[],...
- 'OldSelectedObject',[], ...
- 'SelectionChangeFcn',@modePushButtonCallback);
+ 'OldSelectedObject',[]);
ch_idx = 1;
-position = [lower_space button_space button_width button_height];
+position = [0 0 button_width button_height];
for button_idx = 1:nButtons
userdata = argCell{button_idx};
ControlButton{ch_idx}.hButton(button_idx) = uicontrol(...
@@ -220,11 +215,12 @@ for button_idx = 1:nButtons
'FontSize',10,...
'Position',position,...
'String',nameStr{button_idx},...
- 'Style','togglebutton',...
+ 'Style','pushbutton',...
+ 'Callback',@modePushButtonCallback,...
'UserData',userdata,...
- 'Value',strcmpi(currentSettings.mode,argCell{button_idx}{2}),...
+ 'Value',0,...
'Tag','');
- position = position + [0 button_height+button_space 0 0];
+ position = position + [0 button_height 0 0];
end
@@ -234,44 +230,39 @@ argCell = {};
ele = 1;
nameStr{ele} = {'Init'};
argCell{ele} = {'init'};
-tooltip{ele} = {'Reinitialize the Aurelio'};
% ele = ele + 1;
% nameStr{ele} = {['Reset']};
% argCell{ele} = {'Reset'};
ele = ele + 1;
-nameStr{ele} = {'Use Amplifier'};
+nameStr{ele} = {'Amplifier'};
argCell{ele} = {'Amplifier'};
-tooltip{ele} = {'Turn the amplifier on'};
ele = ele + 1;
-% nameStr{ele} = {'NoAmplifier'};
-% argCell{ele} = {'NoAmplifier'};
-% ele = ele + 1;
-nameStr{ele} = {'Amp +20dB'};
+nameStr{ele} = {'NoAmplifier'};
+argCell{ele} = {'NoAmplifier'};
+ele = ele + 1;
+nameStr{ele} = {'Amp26dBu'};
argCell{ele} = {'Amp26dBu'};
-tooltip{ele} = {'Amp + 20 dB'};
ele = ele + 1;
-% nameStr{ele} = {'Amp06dBu'};
-% argCell{ele} = {'Amp06dBu'};
-% ele = ele + 1;
+nameStr{ele} = {'Amp06dBu'};
+argCell{ele} = {'Amp06dBu'};
+ele = ele + 1;
nameStr{ele} = {'AmpHighPower'};
argCell{ele} = {'AmpHighPower'};
-tooltip{ele} = {'Activate High power Amp'};
ele = ele + 1;
-% nameStr{ele} = {'AmpLowPower'};
-% argCell{ele} = {'AmpLowPower'};
-% ele = ele + 1;
+nameStr{ele} = {'AmpLowPower'};
+argCell{ele} = {'AmpLowPower'};
+ele = ele + 1;
nameStr{ele} = {'GroundLift'};
-argCell{ele} = {'groundLift'};
-tooltip{ele} = {'Use ground lift'};
-% ele = ele + 1;
-% nameStr{ele} = {'NoGroundLift'};
-% argCell{ele} = {'NoGroundLift'};
+argCell{ele} = {'GroundLift'};
+ele = ele + 1;
+nameStr{ele} = {'NoGroundLift'};
+argCell{ele} = {'NoGroundLift'};
%% controlbuttons (push)
nButtons = length(nameStr);
-InputFeed{1}.Size = [button_width+1 (nButtons+1) * (button_height+button_space)];
+InputFeed{1}.Size = [button_width+1 (nButtons+1) * (button_height)];
InputFeed{1}.Position = [InputFeed{1}.Position(1) InputFeed{1}.Position(2)+ InputFeed{1}.Position(4)+ver_space InputFeed{1}.Size];
% InputFeed{ch_idx}.Position = [hor_start ver_start InputFeed{ch_idx}.Size];
InputFeed{1}.h = uipanel(...
@@ -285,10 +276,8 @@ InputFeed{1}.h = uipanel(...
'BackgroundColor',gui_bg_color);
-position = [lower_space button_space button_width button_height];
-
-% checkboxes
-for button_idx = 2:length(nameStr)
+position = [0 0 button_width button_height];
+for button_idx = 1:length(nameStr)
userdata = argCell{button_idx};
ControlButton{ch_idx}.hButton(button_idx) = uicontrol(...
'Units','characters',...
@@ -296,62 +285,36 @@ for button_idx = 2:length(nameStr)
'FontSize',10,...
'Position',[position],...
'String',nameStr{button_idx},...
- 'Style','checkbox',...
- 'Callback',@controlCheckboxCallback,...
+ 'Style','pushbutton',...
+ 'Callback',@controlPushButtonCallback,...
'UserData',userdata,...
- 'Value',currentSettings.(argCell{button_idx}{1}),...
- 'Tag','', ...
- 'Tooltip',tooltip{button_idx}{1});
- position = position + [0 button_height+button_space 0 0];
+ 'Value',0,...
+ 'Tag','');
+ position = position + [0 button_height 0 0];
end
-% init button
-userdata = argCell{1};
-ControlButton{ch_idx}.hButton(1) = uicontrol(...
- 'Units','characters',...
- 'Parent',InputFeed{1}.h,...
- 'FontSize',10,...
- 'Position',[position],...
- 'String',nameStr{1},...
- 'Style','pushbutton',...
- 'Callback',@controlPushButtonCallback,...
- 'UserData',userdata,...
- 'Value',0,...
- 'Tag','');
-position = position + [0 button_height+button_space 0 0];
-
%% sampling rate
nameStr = {};
argCell = {};
ele = 1;
-nameStr{ele} = {'44100'};
-argCell{ele} = {44100};
-ele = ele + 1;
-nameStr{ele} = {'48000'};
-argCell{ele} = {48000};
+nameStr{ele} = {'96000'};
+argCell{ele} = {96000};
ele = ele + 1;
nameStr{ele} = {'88200'};
argCell{ele} = {88200};
ele = ele + 1;
-nameStr{ele} = {'96000'};
-argCell{ele} = {96000};
+nameStr{ele} = {'48000'};
+argCell{ele} = {48000};
ele = ele + 1;
+nameStr{ele} = {'44100'};
+argCell{ele} = {44100};
-samplingValue = 0;
-for index = 1:length(nameStr)
- if argCell{index}{1} == currentSettings.samplingRate
- samplingValue = index;
- end
-end
-
-
-nameStr = {'44100','48000','88200','96000'};
%% controlbuttons (push)
-nButtons = 1;
+nButtons = length(nameStr);
-InputFeed{1}.Size = [button_width+1 (nButtons+1) * (button_height+button_space)];
+InputFeed{1}.Size = [button_width+1 (nButtons+1) * (button_height)];
InputFeed{1}.Position = [InputFeed{1}.Position(1) InputFeed{1}.Position(2)+ InputFeed{1}.Position(4)+ver_space InputFeed{1}.Size];
% InputFeed{ch_idx}.Position = [hor_start ver_start InputFeed{ch_idx}.Size];
InputFeed{1}.h = uipanel(...
@@ -361,90 +324,36 @@ InputFeed{1}.h = uipanel(...
'Title','SamplingRate',...
'Tag','Mode',...
'Clipping','on',...
- 'Position',InputFeed{1}.Position,...
+ 'Position',InputFeed{ch_idx}.Position,...
'BackgroundColor',gui_bg_color);
-position = [lower_space button_space button_width button_height];
-ControlButton{1}.hButton(1) = uicontrol(...
- 'Units','characters',...
- 'Parent',InputFeed{1}.h,...
- 'FontSize',10,...
- 'Position',position,...
- 'String',nameStr,...
- 'Style','popupmenu',...
- 'Callback',@samplingRateButtonCallback,...
- 'UserData',[],...
- 'Value',samplingValue,...
- 'Tag','');
-position = position + [0 button_height+button_space 0 0];
-
-
-
-%% presets
-nButtons = 2;
-
-
-% to get it up top to align with InputRange box, get its position and size
-inputHeight = InputRange{1}.Position(2) + InputRange{1}.Size(2);
-
-
-InputFeed{1}.Size = [button_width+1 (nButtons+1) * (button_height+button_space)];
-InputFeed{1}.Position = [InputFeed{1}.Position(1) inputHeight - InputFeed{1}.Size(2) InputFeed{1}.Size];
-% InputFeed{ch_idx}.Position = [hor_start ver_start InputFeed{ch_idx}.Size];
-InputFeed{1}.h = uipanel(...
- 'Parent',hFigure,...
- 'Units','characters',...
- 'FontSize',10,...
- 'Title','Settings Presets',...
- 'Tag','Mode',...
- 'Clipping','on',...
- 'Position',InputFeed{1}.Position,...
- 'BackgroundColor',gui_bg_color);
-position = [lower_space button_space button_width button_height];
-PresetButton{1}.hButton(1) = uicontrol(...
+position = [0 0 button_width button_height];
+for button_idx = 1:length(nameStr)
+ userdata = argCell{button_idx};
+ ControlButton{ch_idx}.hButton(button_idx) = uicontrol(...
'Units','characters',...
'Parent',InputFeed{1}.h,...
'FontSize',10,...
- 'Position',[position],...
- 'String','Save',...
+ 'Position',position,...
+ 'String',nameStr{button_idx},...
'Style','pushbutton',...
- 'Callback',@presetSaveCallback,...
+ 'Callback',@samplingRateButtonCallback,...
'UserData',userdata,...
+ 'Value',0,...
'Tag','');
-position = position + [0 button_height+button_space 0 0];
-
-names = presetNames;
-
-if ~presetChanged
- popupValue = currentPresetNumber;
-else
- currentSettings = {'currentSettings'};
- names = [presetNames currentSettings];
- popupValue = length(names);
+ position = position + [0 button_height 0 0];
end
-PresetMenu{ch_idx}.hButton(1) = uicontrol(...
- 'Units','characters',...
- 'Parent',InputFeed{1}.h,...
- 'FontSize',10,...
- 'Position',position,...
- 'String',names,...
- 'Style','popupmenu',...
- 'Callback',@presetMenuCallback,...
- 'UserData',[],...
- 'Value',popupValue,...
- 'Tag','');
-
%% callback functions
function modePushButtonCallback(h,event)
- userdata = getfield(get(event.NewValue),'UserData');
+ userdata = getfield(get(h),'UserData');
argCell = userdata;
if ~isempty(argCell)
- ita_aurelio_control_new(argCell{:});
- ita_aureliocontrol_gui_new('init');
+ ita_aurelio_control(argCell{:});
+ ita_aureliocontrol_gui('init');
end
end
@@ -460,46 +369,20 @@ PresetMenu{ch_idx}.hButton(1) = uicontrol(...
else
davolume = davolume + 1;
end
- ita_aurelio_control_new('davolume',davolume);
+ ita_aurelio_control('davolume',davolume);
% set(event.NewValue,'UserData',argCell);
else
- ita_aurelio_control_new(argCell{:});
- ita_aureliocontrol_gui_new('init');
+ ita_aurelio_control(argCell{:});
+ ita_aureliocontrol_gui('init');
end
end
end
- function controlCheckboxCallback(h,event)
- argCell = getfield(get(h),'UserData');
- if ~isempty(argCell)
- if strfind(argCell{1},'davolume')
- a = ita_modulita_control('getSettings');
- davolume = a.davolume;
- if strfind(argCell{1},'--')
- davolume = davolume - 1;
- else
- davolume = davolume + 1;
- end
- ita_aurelio_control_new('davolume',davolume);
- % set(event.NewValue,'UserData',argCell);
- else
- argCell{end+1} = get(h,'Value');
- ita_aurelio_control_new(argCell{:});
- ita_aureliocontrol_gui_new('init');
- end
- end
-
- end
-
function samplingRateButtonCallback(h,event)
- value = get(h,'Value');
- strings = get(h,'String');
-
- argCell{1} = str2num(strings{value});
+ argCell = getfield(get(h),'UserData');
if ~isempty(argCell)
- ita_aurelio_control_new('samplingRate',argCell{1});
- ita_aureliocontrol_gui_new('init');
+ ita_aurelio_control('samplingRate',argCell{1});
end
end
@@ -507,16 +390,14 @@ PresetMenu{ch_idx}.hButton(1) = uicontrol(...
function InputSelectCallback(h,event)
userdata = getfield(get(event.NewValue),'UserData');
inputselect = getfield(get(event.NewValue),'String');
- ita_aurelio_control_new('channel',userdata.ch,'input',inputselect);
- ita_aureliocontrol_gui_new('init');
+ ita_aurelio_control('channel',userdata.ch,'input',inputselect);
end
function InputFeedCallback(h,event)
userdata = getfield(get(event.NewValue),'UserData');
inputfeed = getfield(get(event.NewValue),'String');
- ita_aurelio_control_new('channel',userdata.ch,'feed',inputfeed);
- ita_aureliocontrol_gui_new('init');
+ ita_aurelio_control('channel',userdata.ch,'feed',inputfeed);
end
@@ -524,57 +405,7 @@ PresetMenu{ch_idx}.hButton(1) = uicontrol(...
userdata = getfield(get(event.NewValue),'UserData');
value = getfield(get(event.NewValue),'String');
inputrange = str2num(value); %#ok
- ita_aurelio_control_new('channel',userdata.ch,'inputrange',inputrange);
- ita_aureliocontrol_gui_new('init');
+ ita_aurelio_control('channel',userdata.ch,'inputrange',inputrange);
end
-
- function presetMenuCallback(h,event)
- value = get(h,'Value');
- strings = get(h,'String');
-
- if value <= length(strings)
- ita_aurelio_control_new('setPreset',1,'presetName',strings{value});
- ita_aureliocontrol_gui_new('init');
- end
-
- end
-
-
- function presetSaveCallback(h,event)
-
- isValidName = 0;
- abort = 0;
- inputString = 'Please give a preset name';
- while ~isValidName
- newTitle = inputdlg(inputString,'New Preset');
- if ~isempty(newTitle)
- if ~isempty(newTitle{1})
- isValidName = 1;
- % check if the name is already in use
- for index = 1:length(presetNames)
- if strcmp(newTitle{1},presetNames{index})
- isValidName = 0;
- inputString = 'Name already in use:';
- end
- end
- else
- % ok but no name
- isValidName = 0;
- inputString = 'Name was empty. Please give a name:';
- end
- else
- % abort case
- abort = 1;
- isValidName = 1;
- end
- end
-
- if ~abort
- ita_aurelio_control_new('savePreset',1,'presetName',newTitle{1});
- ita_aureliocontrol_gui_new('init');
- end
- end
-
-
end
\ No newline at end of file