function varargout = rafiigui(varargin)
% RAFIIGUI M-file for rafiigui.fig
%      RAFIIGUI, by itself, creates a new RAFIIGUI or raises the existing
%      singleton*.
%
%      H = RAFIIGUI returns the handle to a new RAFIIGUI or the handle to
%      the existing singleton*.
%
%      RAFIIGUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in RAFIIGUI.M with the given input arguments.
%
%      RAFIIGUI('Property','Value',...) creates a new RAFIIGUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before rafiigui_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to rafiigui_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help rafiigui

% Last Modified by GUIDE v2.5 22-May-2014 21:46:24

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @rafiigui_OpeningFcn, ...
                   'gui_OutputFcn',  @rafiigui_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before rafiigui is made visible.
function rafiigui_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to rafiigui (see VARARGIN)

% Choose default command line output for rafiigui
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes rafiigui wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = rafiigui_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)



origindelay=str2double(get(handles.korigin,'String'));
gOrigin=str2double(get(handles.g1,'String'));
m=str2double(get(handles.m,'String'));
fc=str2double(get(handles.fc,'String'));
wet=str2double(get(handles.drywet,'String'));
fvz=str2double(get(handles.Fvz,'String'));
gap1=str2double(get(handles.g7,'String'));
gap2=str2double(get(handles.g8,'String'));
implength=str2double(get(handles.implength,'String'));

x=handles.x;
handles.p=fvz;
%% dital reverberator - Pardo, Rafii
clc
set(handles.info,'String','Počíta sa impulzná odozva');
drawnow;

implength=implength*fvz;
%% fir filter, prvotne odrazy

a(1)=1;

b(419)=0.68;               
b(631)=0.644;
b(757)=0.587;
b(907)=0.540;
b(1117)=0.498;
b(1327)=0.465;
b(1549)=0.413;
b(1871)=0.371;
b(2161)=0.324;
b(2459)=0.281;
b(2659)=0.217;
b(2857)=0.181;
b(3037)=0.180;

early=tf(b,a);
%% definicia prvkov neskorej reverberacie

%%comb1
k=round(origindelay*1.5);

set(handles.k1,'String',k);

T60=k*((log10(0.001))/log10(gOrigin));

b=zeros(1,k+1);
a=zeros(1,k+1);

b(1)=0;
b(k+1)=1;
a(1)=1;
a(k+1)=-gOrigin;

comb1=tf(b,a);

%%comb2
k=round(origindelay*1.42);
g=10^((k*log10(0.001))/T60);

set(handles.k2,'String',k);
set(handles.g2,'String',num2str(g,3));

b=zeros(1,k+1);
a=zeros(1,k+1);

b(1)=0;
b(k+1)=1;
a(1)=1;
a(k+1)=-g;

comb2=tf(b,a);

%%comb3
k=round(origindelay*1.34);
g=10^((k*log10(0.001))/T60);

set(handles.k3,'String',k);
set(handles.g3,'String',num2str(g,3));

b=zeros(1,k+1);
a=zeros(1,k+1);

b(1)=0;
b(k+1)=1;
a(1)=1;
a(k+1)=-g;

comb3=tf(b,a);

%%comb4
k=round(origindelay*1.26);
g=10^((k*log10(0.001))/T60);

set(handles.k4,'String',k);
set(handles.g4,'String',num2str(g,3));

b=zeros(1,k+1);
a=zeros(1,k+1);

b(1)=0;
b(k+1)=1;
a(1)=1;
a(k+1)=-g;

comb4=tf(b,a);

%%comb5
k=round(origindelay*1.16);
g=10^((k*log10(0.001))/T60);

set(handles.k5,'String',k);
set(handles.g5,'String',num2str(g,3));

b=zeros(1,k+1);
a=zeros(1,k+1);

b(1)=0;
b(k+1)=1;
a(1)=1;
a(k+1)=-g;

comb5=tf(b,a);

%%comb6
k=round(origindelay*1.07);
g=10^((k*log10(0.001))/T60);

set(handles.k6,'String',k);
set(handles.g6,'String',num2str(g,3));

b=zeros(1,k+1);
a=zeros(1,k+1);

b(1)=0;
b(k+1)=1;
a(1)=1;
a(k+1)=-g;

comb6=tf(b,a);

%%definicia all pass parametrov
da=1327;

%%alpassleft
        
k=da+round(m/2);              

set(handles.k7,'String',k);

b=zeros(1,k+1);
a=zeros(1,k+1);

b(1)=gap1;
b(k+1)=1;
a(1)=1;
a(k+1)=gap1;

APleft=tf(b,a);

%%alpassright
          
k=da-round(m/2);              

set(handles.k8,'String',k);

b=zeros(1,k+1);
a=zeros(1,k+1);

b(1)=gap2;
b(k+1)=1;
a(1)=1;
a(k+1)=gap2;

APright=tf(b,a);

%%Lowpassleft
fc=fc/fvz;
g=2-cos(2*pi*fc)-sqrt(((cos(2*pi*fc)-2)^2)-1);             

b=[1-g 0];
a=[1 -g];

LPleft=tf(b,a);

%%Lowpassright

g=2-cos(2*pi*fc)-sqrt(((cos(2*pi*fc)-2)^2)-1);             

b=[1-g 0];
a=[1 -g];

LPright=tf(b,a);

%%dry/wet
dry=1-wet;

%% zjednodušenie štruktúry

% paralelna kombinacia hrebenovych filtrov
combparallel=comb1-comb2+comb3-comb4+comb5-comb6;
disp('paralelna kombinacia hrebenovych filtrov hotova');

% seriova kombinacia v oboch kanaloch
allpassleft=APleft*LPleft*wet;
allpassright=APright*LPright*wet;
disp('seriova kombinacia alpass filtrov hotova');

% seriove zapojeni zjednodusenych hrebenovych filtrov a lavej, respektive pravej vetvy s
% fazovacim clanok a dolnou priepustnostou
wholeleft=early*combparallel*allpassleft;
disp('celkova prenosova funcia laveho kanala');
[IRb,IRa]=tfdata(wholeleft);
IRb=IRb{1,1};
IRa=IRa{1,1};

wholeright=early*combparallel*allpassright;
disp('celkova prenosova funcia praveho kanala');
[IRbb,IRaa]=tfdata(wholeright);
IRbb=IRbb{1,1};
IRaa=IRaa{1,1};

%celkove impulzne odozvy laveho a praveho kanalu
IRleft=impz(IRb,IRa,implength);
IRright=impz(IRbb,IRaa,implength);

%% filtrovanie

% ak je signal stereo upravi sa na mono
if size(x,2)~=1 
xcombin=0.5*x(:,1)+0.5*x(:,2);
elseif size(x,2)==1
    xcombin=x;
end

%ziskanie laveho a praveho kanalu sterea
yl=conv(xcombin,IRleft);
yr=conv(xcombin,IRright);

% kombinacia dry a wet signalu
if dry==1
    y=x;
elseif size(x,2)==2
y(:,1)=vektorplus(yl',(dry*x(:,1))');
y(:,2)=vektorplus(yr',(dry*x(:,2))');
elseif size(x,2)==1
y(:,1)=vektorplus(yl',dry*x'); 
y(:,2)=vektorplus(yr',dry*x');
end

%odstrani nuly
I=find(abs(y(:,1))>10^(-5),1,'last');
y=y(1:I,:);

handles.y=y;

IR(:,1)=IRleft;
IR(:,2)=IRright;
%% zobrazenie impulznej odozvy praveho kanalu
n=1:length(IR);

plot(handles.impz,n/fvz,IR);
h=title(handles.impz,'\bfImpulzná odozva reverberátoru');

xlabel(handles.impz,'{{\itt}} (s) \rightarrow')
ylabel(handles.impz,'\ith(-) \rightarrow')
hold off

%% spektra vstupneho a vystupneho signalu + reverberatoru

Nd=length(IRleft);
I=fft(IRleft)/Nd;                                        %výpočet DFT signálu y o délce Nd pomocí FFT, výsledek dělen Nd
I=I(1:(length(I)/2));
n=(1:length(I));

plot(handles.freqz,n/Nd*fvz,abs(I));
h=title(handles.freqz,'\bf Kmitočtová charakteristika reverberátoru');
xlabel(handles.freqz,'{{\itf}} (Hz) \rightarrow')
ylabel(handles.freqz,'Modul (-) \rightarrow')
set(handles.freqz,'xlim',[20 20000])
hold off

%% zobrazenie vstupneho signalu

n=(1:length(x));

plot(handles.input,n/fvz,x);
h=title(handles.input,'\bfVstupný signál');
xlabel(handles.input,'{{\itt}} (s) \rightarrow')
ylabel(handles.input,'\its(-) \rightarrow')
hold off


%% zobrazenie vystupneho signalu
n=(1:length(y));

plot(n/fvz,y);
h=title('\bfVýstupny signál');
xlabel('{{\itt}} (s) \rightarrow')
ylabel('\its(-) \rightarrow')
hold off

[RT,EDT,C7,C50,C80,D50,H,itdg,BR,HFR,Ts,IACCE,EKdelta] = objective(IR,fvz)

EK=max(EKdelta);

set(handles.RT,'String',num2str(RT,3));
set(handles.EDT,'String',num2str(EDT,3));
set(handles.BR,'String',num2str(BR,3));
set(handles.HFR,'String',num2str(HFR,3));
set(handles.C7,'String',num2str(C7,3));
set(handles.C50,'String',num2str(C50,3));
set(handles.C80,'String',num2str(C80,3));
set(handles.H,'String',num2str(H,3));
set(handles.ts,'String',num2str(Ts,3));
set(handles.D50,'String',num2str(D50,3));
set(handles.ITDG,'String',num2str(itdg,3));
set(handles.IACCE,'String',num2str(IACCE,3));
set(handles.EK,'String',num2str(EK,3));

set(handles.info,'String','Impulzná odozva vypočítaná');
guidata(hObject, handles);
function delay_Callback(hObject, eventdata, handles)
% hObject    handle to delay (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of delay as text
%        str2double(get(hObject,'String')) returns contents of delay as a double


% --- Executes during object creation, after setting all properties.
function delay_CreateFcn(hObject, eventdata, handles)
% hObject    handle to delay (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function zosilenie_Callback(hObject, eventdata, handles)
% hObject    handle to zosilenie (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of zosilenie as text
%        str2double(get(hObject,'String')) returns contents of zosilenie as a double


% --- Executes during object creation, after setting all properties.
function zosilenie_CreateFcn(hObject, eventdata, handles)
% hObject    handle to zosilenie (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function delayap_Callback(hObject, eventdata, handles)
% hObject    handle to fc (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of fc as text
%        str2double(get(hObject,'String')) returns contents of fc as a double


% --- Executes during object creation, after setting all properties.
function delayap_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fc (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function fc_Callback(hObject, eventdata, handles)
% hObject    handle to fc (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of fc as text
%        str2double(get(hObject,'String')) returns contents of fc as a double


% --- Executes during object creation, after setting all properties.
function fc_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fc (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function wet_Callback(hObject, eventdata, handles)
% hObject    handle to wet (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of wet as text
%        str2double(get(hObject,'String')) returns contents of wet as a double


% --- Executes during object creation, after setting all properties.
function wet_CreateFcn(hObject, eventdata, handles)
% hObject    handle to wet (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function fvz_Callback(hObject, eventdata, handles)
% hObject    handle to fvz (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of fvz as text
%        str2double(get(hObject,'String')) returns contents of fvz as a double


% --- Executes during object creation, after setting all properties.
function fvz_CreateFcn(hObject, eventdata, handles)
% hObject    handle to fvz (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

function k2_Callback(hObject, eventdata, handles)
% hObject    handle to k2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of k2 as text
%        str2double(get(hObject,'String')) returns contents of k2 as a double


% --- Executes during object creation, after setting all properties.
function k2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k3_Callback(hObject, eventdata, handles)
% hObject    handle to k3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of k3 as text
%        str2double(get(hObject,'String')) returns contents of k3 as a double


% --- Executes during object creation, after setting all properties.
function k3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k4_Callback(hObject, eventdata, handles)
% hObject    handle to k4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of k4 as text
%        str2double(get(hObject,'String')) returns contents of k4 as a double


% --- Executes during object creation, after setting all properties.
function k4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k5_Callback(hObject, eventdata, handles)
% hObject    handle to k5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of k5 as text
%        str2double(get(hObject,'String')) returns contents of k5 as a double


% --- Executes during object creation, after setting all properties.
function k5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k6_Callback(hObject, eventdata, handles)
% hObject    handle to k6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of k6 as text
%        str2double(get(hObject,'String')) returns contents of k6 as a double


% --- Executes during object creation, after setting all properties.
function k6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g2_Callback(hObject, eventdata, handles)
% hObject    handle to g2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of g2 as text
%        str2double(get(hObject,'String')) returns contents of g2 as a double


% --- Executes during object creation, after setting all properties.
function g2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g3_Callback(hObject, eventdata, handles)
% hObject    handle to g3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of g3 as text
%        str2double(get(hObject,'String')) returns contents of g3 as a double


% --- Executes during object creation, after setting all properties.
function g3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g4_Callback(hObject, eventdata, handles)
% hObject    handle to g4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of g4 as text
%        str2double(get(hObject,'String')) returns contents of g4 as a double


% --- Executes during object creation, after setting all properties.
function g4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g5_Callback(hObject, eventdata, handles)
% hObject    handle to g5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of g5 as text
%        str2double(get(hObject,'String')) returns contents of g5 as a double


% --- Executes during object creation, after setting all properties.
function g5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g6_Callback(hObject, eventdata, handles)
% hObject    handle to g6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of g6 as text
%        str2double(get(hObject,'String')) returns contents of g6 as a double


% --- Executes during object creation, after setting all properties.
function g6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g7_Callback(hObject, eventdata, handles)
% hObject    handle to g7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of g7 as text
%        str2double(get(hObject,'String')) returns contents of g7 as a double


% --- Executes during object creation, after setting all properties.
function g7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g8_Callback(hObject, eventdata, handles)
% hObject    handle to g8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of g8 as text
%        str2double(get(hObject,'String')) returns contents of g8 as a double


% --- Executes during object creation, after setting all properties.
function g8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k7_Callback(hObject, eventdata, handles)
% hObject    handle to k7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of k7 as text
%        str2double(get(hObject,'String')) returns contents of k7 as a double


% --- Executes during object creation, after setting all properties.
function k7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k8_Callback(hObject, eventdata, handles)
% hObject    handle to k8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of k8 as text
%        str2double(get(hObject,'String')) returns contents of k8 as a double


% --- Executes during object creation, after setting all properties.
function k8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
x=handles.x;
p=handles.p;
sound(x,p)

% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
y=handles.y;
p=handles.p;
sound(y,p)


function implength_Callback(hObject, eventdata, handles)
% hObject    handle to implength (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of implength as text
%        str2double(get(hObject,'String')) returns contents of implength as a double


% --- Executes during object creation, after setting all properties.
function implength_CreateFcn(hObject, eventdata, handles)
% hObject    handle to implength (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function Fvz_Callback(hObject, eventdata, handles)
% hObject    handle to Fvz (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of Fvz as text
%        str2double(get(hObject,'String')) returns contents of Fvz as a double


% --- Executes during object creation, after setting all properties.
function Fvz_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Fvz (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function korigin_Callback(hObject, eventdata, handles)
% hObject    handle to korigin (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of korigin as text
%        str2double(get(hObject,'String')) returns contents of korigin as a double


% --- Executes during object creation, after setting all properties.
function korigin_CreateFcn(hObject, eventdata, handles)
% hObject    handle to korigin (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function m_Callback(hObject, eventdata, handles)
% hObject    handle to m (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of m as text
%        str2double(get(hObject,'String')) returns contents of m as a double


% --- Executes during object creation, after setting all properties.
function m_CreateFcn(hObject, eventdata, handles)
% hObject    handle to m (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function drywet_Callback(hObject, eventdata, handles)
% hObject    handle to drywet (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of drywet as text
%        str2double(get(hObject,'String')) returns contents of drywet as a double


% --- Executes during object creation, after setting all properties.
function drywet_CreateFcn(hObject, eventdata, handles)
% hObject    handle to drywet (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function g1_Callback(hObject, eventdata, handles)
% hObject    handle to g1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of g1 as text
%        str2double(get(hObject,'String')) returns contents of g1 as a double


% --- Executes during object creation, after setting all properties.
function g1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to g1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function EDT_Callback(hObject, eventdata, handles)
% hObject    handle to EDT (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of EDT as text
%        str2double(get(hObject,'String')) returns contents of EDT as a double


% --- Executes during object creation, after setting all properties.
function EDT_CreateFcn(hObject, eventdata, handles)
% hObject    handle to EDT (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function RT_Callback(hObject, eventdata, handles)
% hObject    handle to RT (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of RT as text
%        str2double(get(hObject,'String')) returns contents of RT as a double


% --- Executes during object creation, after setting all properties.
function RT_CreateFcn(hObject, eventdata, handles)
% hObject    handle to RT (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function BR_Callback(hObject, eventdata, handles)
% hObject    handle to BR (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of BR as text
%        str2double(get(hObject,'String')) returns contents of BR as a double


% --- Executes during object creation, after setting all properties.
function BR_CreateFcn(hObject, eventdata, handles)
% hObject    handle to BR (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function HFR_Callback(hObject, eventdata, handles)
% hObject    handle to HFR (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of HFR as text
%        str2double(get(hObject,'String')) returns contents of HFR as a double


% --- Executes during object creation, after setting all properties.
function HFR_CreateFcn(hObject, eventdata, handles)
% hObject    handle to HFR (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function C50_Callback(hObject, eventdata, handles)
% hObject    handle to C50 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of C50 as text
%        str2double(get(hObject,'String')) returns contents of C50 as a double


% --- Executes during object creation, after setting all properties.
function C50_CreateFcn(hObject, eventdata, handles)
% hObject    handle to C50 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function C7_Callback(hObject, eventdata, handles)
% hObject    handle to C7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of C7 as text
%        str2double(get(hObject,'String')) returns contents of C7 as a double


% --- Executes during object creation, after setting all properties.
function C7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to C7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function C80_Callback(hObject, eventdata, handles)
% hObject    handle to C80 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of C80 as text
%        str2double(get(hObject,'String')) returns contents of C80 as a double


% --- Executes during object creation, after setting all properties.
function C80_CreateFcn(hObject, eventdata, handles)
% hObject    handle to C80 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function H_Callback(hObject, eventdata, handles)
% hObject    handle to H (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of H as text
%        str2double(get(hObject,'String')) returns contents of H as a double


% --- Executes during object creation, after setting all properties.
function H_CreateFcn(hObject, eventdata, handles)
% hObject    handle to H (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function ITDG_Callback(hObject, eventdata, handles)
% hObject    handle to ITDG (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of ITDG as text
%        str2double(get(hObject,'String')) returns contents of ITDG as a double


% --- Executes during object creation, after setting all properties.
function ITDG_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ITDG (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function D50_Callback(hObject, eventdata, handles)
% hObject    handle to D50 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of D50 as text
%        str2double(get(hObject,'String')) returns contents of D50 as a double


% --- Executes during object creation, after setting all properties.
function D50_CreateFcn(hObject, eventdata, handles)
% hObject    handle to D50 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function IACCE_Callback(hObject, eventdata, handles)
% hObject    handle to IACCE (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of IACCE as text
%        str2double(get(hObject,'String')) returns contents of IACCE as a double


% --- Executes during object creation, after setting all properties.
function IACCE_CreateFcn(hObject, eventdata, handles)
% hObject    handle to IACCE (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function EK_Callback(hObject, eventdata, handles)
% hObject    handle to EK (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of EK as text
%        str2double(get(hObject,'String')) returns contents of EK as a double


% --- Executes during object creation, after setting all properties.
function EK_CreateFcn(hObject, eventdata, handles)
% hObject    handle to EK (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function k1_Callback(hObject, eventdata, handles)
% hObject    handle to k1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of k1 as text
%        str2double(get(hObject,'String')) returns contents of k1 as a double


% --- Executes during object creation, after setting all properties.
function k1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to k1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function ts_Callback(hObject, eventdata, handles)
% hObject    handle to ts (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of ts as text
%        str2double(get(hObject,'String')) returns contents of ts as a double


% --- Executes during object creation, after setting all properties.
function ts_CreateFcn(hObject, eventdata, handles)
% hObject    handle to ts (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

[filename pathname]=uigetfile({'*.wav'},'Vyber súbor na reverberáciu');
fullpathname=strcat(pathname, filename)

x=wavread(fullpathname);

handles.x=x;

set(handles.info,'String','Súbor načítaný');

guidata(hObject, handles);



function edit41_Callback(hObject, eventdata, handles)
% hObject    handle to implength (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of implength as text
%        str2double(get(hObject,'String')) returns contents of implength as a double


% --- Executes during object creation, after setting all properties.
function edit41_CreateFcn(hObject, eventdata, handles)
% hObject    handle to implength (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


