//{$O+,F+,R-,S-,D-,L-,I-}
unit grafiti4;
interface
uses //dos,graph,crt,printer,
common,friend,grafiti0,disco2,grafiti1,porto,fft,
 grafiti3;
function atan(x,y:real):real;
function arcSin(x:real):real;
function arccos(x:real):real;
 var                                              kuk,znak : AnsiChar;
                                                   lancuch : shortstring;
zmsDone,esc,count_cp_bool,filtrOn,osc_to_scr,spectr_to_scr,
           filtr_to_scr,cpstr_to_scr,rev_to_scr,ret_to_scr,
     res_to_scr,fullStop,new_osc,light,freez,clr,only,sing,
     krok,synchro,cpstrBlue,PgUp,PgDn,zms,overlap,newCoord,
   logik,lock,zmRes,moovie,grafika,s_ax,timeDomain,hiFiltr,
  double_side_cpstr_filtr,hiss,auto_freq,freqDomain,marker,
                  pSlide,Change_Insert,ins,art_nat,retriev : boolean;
                                                  lancuch1 : shortString;
                                             stretch,resol : byte;
                                              t5,ymin,ymax : realType;
                           virt_vect,tmp_virt_vect,old_obs : TdbArr;
       lba_pktow,tp,tk,lba_pktow_na_okno,lba_pktow_na_jump,
                                      buzz,F0,df,powerLost : real;
                      HeapPosPointer,osc,lba_probek_na_osc :longWord;
                          px,kx,w_p_s,window_size,barJ,jot : longint;
     bit,topY,heightLightBuff,min,max,bottomY,leftB,rightB,
              spktr_as,biez_koniec,barL,barM,nr_osc,scr_nr : word;
                        pulLight,asy,dy,dyn,dys,error_code : integer;
                                                  ImgPoint : pointer;
                                               mark,unmark : pointer;
                                    lancuch0,lancuch2,cynk : pathStr;
                                                     barNr : byte;
                                               reIns,ImIns : TdbArr;
                                             F0Fix,wsp_pix : real;

const pi2 = 6.283185307;

procedure grafik1;
procedure oscylogram(var w_p_s:longint);
procedure podswietlenie;
procedure Wykres_Wag_Okna;
procedure Clean(puh:integer;overlap:boolean);
procedure maly_oscylogram;
procedure sygn_wazony_wykres;
procedure sig_we_graph;
procedure ret_gr1(freq_interval:real);
procedure ret_gr2;
procedure kolor_spectr(scr_nr_as:integer;
    var freq_interval,pixY,pix1Y,pix_as,pix_as1:real;var delta:realType;
    interp:boolean;poz:byte;numDat:word;minlev,maxlev:real);
function tryb(logik:boolean):ExtStr;
procedure wykres_spectrum_mom(var freq_interval:real;
 cpstr,fft_rev,retriev:boolean;var idx:integer);
procedure cpstr_gr1(cpstr:boolean;var cursPoz:integer;info:DirStr);
procedure cpstr_gr2(idx:integer;color1,color2:byte);
procedure rev_gr1(var freq_interval:real);
procedure rev_gr2;

implementation

var filtrBar : boolean; ii:integer;

function atan(x,y:real):real;
  var alfa,eps:real;
  begin
   alfa:=abs(y);                                 {y dzielone przez jakiekol-}
   if alfa >0 then while alfa<1 do alfa:=alfa*10;{wiek x nie moze przekroczyc}
   alfa:=alfa/1.7e38;                            { zakresu real}
   if alfa<3e-39 then alfa:=3e-39;
   if abs(x)>alfa then
   begin
    alfa:= arctan(abs(y/x));
    if x>0 then
     if y>=0 then atan:=alfa
     else         atan:=-alfa
    else
     if y>0 then atan:=pi-alfa
     else
      if y=0 then atan:=0
      else atan:=-pi+alfa
   end{x<>0}
  else
   if y=0 then atan:=0
   else
    if y>0 then atan:=pi/2
    else atan:=-pi/2
  end;{atan}


function arcSin(x:real):real;
{
oblicza arcSin w radianach
}
 begin
  if x=0 then arcSin:=0
  else
   if x>=1 then arcSin:=pi/2
   else
    if x<=-1 then arcSin:=-pi/2
    else arcSin:=atan(1,x/sqrt(1-sqr(x)))
 end;{arcSin}

function arccos(x:real):real;
{
oblicza arcCos w radianach
}
 begin
  if x=0 then arcCos:=pi/2
  else
   if x>=1 then arcCos:=0
   else
    if x<=-1 then arcCos:=pi
    else arcCos:=atan(x/sqrt(1-sqr(x)),1)
 end;{arcCos}

procedure grafik1;
 begin
  grcolor := 10;     {zmienna okreslajaca kolor wykresow (dekl. w Graffiti)}
  if not grmode then
   begin
//    set_scr_res(resol);               {przywraca i precyzuje tryb graficzny}
    win_map_init;
   end;{if}
  logik:=moovie;
 end;{grafik1}

procedure oscylogram(var w_p_s:longint);
 begin
//  getFillSettings(flst);
  if (HeapPosPointer+biez_koniec>osc) or zmRes or PgUp or PgDn or (scr_nr<1)
   or (pulLight<1)
  then
  begin
   win_init(11);
   with grstat do moveWindow(winXmin,winXmax,winYmin,winYmax,0,40,true);
   if grafika and fullStop then {zatrzymac ekran do popatrzenia}
    begin
     grColor:=14;{yellow} lancuch:='    Nacisnij spacje aby kotynuowac    ';
     with grstat do
      win_x_y_title(lancuch,'x',winYmin+18-ypmax-65,0,5{magenta},true);
     //write(cons,#7); znak:='@';
//     repeat while keyPressed do znak:=ReadKey until znak=' ';
  //   puc;
    end;
   if synchro then clr_win;
   s_ax:=true; config_show:=true;
   if not PgDn then w_p_s:=HeapPosPointer
   else w_p_s:=HeapPosPointer-lba_probek_na_osc+count;
   if w_p_s<0 then w_p_s:=0;
   grcolor:=10;
   win_init(13); clr_win;           {ustawienie i wyczysczenie okienka nr 13}
   tp:=1000*w_p_s/rate;                            {czas poczatkowy}
   tk:=1000*(w_p_s+lba_probek_na_osc-1)/rate;         {czas koncowy}
   scale_win(0,bit,tp,tk);                 {(arg. sa wartosci xw,yw:min|max)}
   grcolor:=4; {red;}
   dr_lab_y_ax_rev(true,false);
//   with grstat do Rectangle(xpmin,winYmin,winXmax,winYmax);
   dr_lab_x_ax_top(1,true,false);
   grColor:=12{lightred};lancuch:=' oscylogram ';
   with grstat do
    win_x_y_title(lancuch,'x',winymin+18-ypmax-25,0,7{lightGray},true);
   grcolor:=10;
   //setFillStyle(solidFill,lightRed);
   with grstat do     {bar wskazujacy % do konca sygnalu}
//    bar(getMaxX-2,winMap[13,3],getMaxX,round(winMap[13,3]+HeapPosPointer*wsp_pix));
   Heap_line_plot_v(tref,w_p_s,lba_danych,bufor,lba_probek_na_osc,
                    error_code);
   if not zmRes then
   begin
    inc(nr_osc);                  {okno spectrum bedzie modyfikowane razem}
    new_osc:=true;                {z oknem oscylogramu!                   }
   end;
   if not PgDn then
    begin                                          {zaczac wyswietlanie od}
     dyS:=round(topY);  scr_nr:=1; pulLight:=1;    {poczatku ekranu }
    end
   else
    begin
     scr_nr:=(HeapPosPointer-w_p_s) div jumpNbrSamples+1;
     pulLight:=scr_nr;
     dys:= round((pulLight-1)*lba_pktow_na_jump+topY);
    end;
   osc:=w_p_s+lba_probek_na_osc;
   with grstat do
   begin
//    window_size:=ImageSize(xpmin,ypmin,xpmax,ypmin+round(lba_pktow_na_okno));
    if window_size<=heightLightBuff then
     begin
//      GetImage(xpmin,ypmin,xpmax,ypmin+round(lba_pktow_na_okno),ImgPoint^);
      Light:=true
     end
    else light:=false;
   end;{with}
  end;{if}
  zmRes:=false;PgUp:=false; PgDn:=false;
//  with flst do setFillStyle(pattern,color);
 end;{oscylogram}

procedure podswietlenie;
 begin
 win_init(13);
 dyn:= round((pulLight-1)*lba_pktow_na_jump+topY);
 with grstat do
  begin
//   if Light and not new_osc then putImage(xpmin,dys,ImgPoint^,CopyPut); {stary}
   if biez_koniec<=count then
    lba_pktow:=biez_koniec*((grstat.ypmax-grstat.ypmin)/lba_probek_na_osc)
    else lba_pktow:=lba_pktow_na_okno;
//   window_size:=ImageSize(xpmin,dyn,xpmax,dyn+round(lba_pktow_na_okno));
   if Window_Size<=heightLightBuff then
    begin
//     GetImage(xpmin,dyn,xpmax,dyn+round(lba_pktow),ImgPoint^); {aktualny}
//     PutImage(xpmin,dyn,ImgPoint^,notPut);                     {podswietlany}
     light:=true
    end
    else light:=false;
  end;{with}
  dys:=dyn;
  new_osc:=false;
 end;{podswietlenie}

procedure Wykres_Wag_Okna;
 var ymin,ymax:realtype;
             i:integer;
 begin
  with GrStat do
   begin
    grColor:=4{red};
    ypmin:=dyn;                                  {Wymiary okienka pomn. o 1}
    ypmax:=dyn+round(lba_pktow);                 {gdy ma byc wykr. gruba l.}
//    SetViewPort(xpmin,ypmin,xpmax,ypmax,true);
    f_min_max(windowWeights,count-1,ymin,ymax);  if winNbr=0 then ymin:=0;
    scale_win(ymin,ymax,ypmin,ypmax);
    if biez_koniec<count then
     begin
      jot:=count-biez_koniec-1;
      for i:=0 to biez_koniec do
       begin
        virt_vect[i]:=windowWeights[jot];
        inc(jot)
       end;{for}
      line_plot_v(virt_vect,biez_koniec-1);
     end
    else
     line_plot_v(windowWeights,count-1);
   end;{with}
 end;{Wykres_Wag_Okna}

procedure Clean(puh:integer;overlap:boolean);
 begin
  win_init(12);                      {przekroj spectrum i oscylogram okienka}
  if not overlap or clr then
   begin                             {czyscic poprzednie okienko}
    grstat.winymin:=grstat.ypmin-4;
    if grstat.winymin<0 then grstat.winymin:=0;
    if synchro then MoveWindow(leftB,rightB,topY,bottomY,0,dY,false)
               else MoveWindow(leftB,rightB,topY,bottomY,0,asy,false);
    if not FiltrBar or krok or clr then clr_win;
    win_Init(12);
   end;{if}
  grstat.winymin:=grstat.ypmin-4;
  if grstat.winymin<0 then grstat.winymin:=0;
  if synchro then
   begin
    dy:=round(dyn+lba_pktow/2-topY-grstat.winymin+TopY)+5+puh; {ruch synchr}
    MoveWindow(leftB,rightB,topY,bottomY,0,dY,false)
   end
  else
   begin
    asy:=spktr_as-1-grstat.winymin+topY+5;
    MoveWindow(leftB,rightB,topY,bottomY,0,asy,false);
   end;
  if not overlap or clr then
  if (freez and not (only or clr or sing or cpstrBlue)) and
      not filtrBar or krok or clr then clr_win;
  filtrBar:=false;                                {czyscic aktualne okno o }
  clr:=false; cpstrBlue:=false;                   {ile nie ma zamrozenia w }
 end;{clean}                                      {trybie sing}

procedure maly_oscylogram;
 begin
  yi:=xr;
  convert(gain,yi,count,ymin,ymax);
  rate:=rate/1000;                                {skalowanie osi czasu w ms}
  if pSlide then
   begin ii:=0{black};
   //ClearDevice;
   grColor:=15{white};
//    SetColor(white);
end
  else ii:=7{lightGray};
  win_init(12);                   {przekroj spectrum i oscylogram okienka}
  scale_win((-count+HeapPosPointer/1+biez_koniec)/rate,
            (-1+HeapPosPointer/1+biez_koniec)/rate,ymin,ymax);
  rate:=rate*1000;
  if not overlap then
   begin
    clean(0,overlap);
//    with grstat do rectangle(winxmin,winymin,winxmax,winymax);
    dr_lab_x_ax_top(1,false,false);
    with grstat do begin ywmin:=ymin*1000; ywmax:=ymax*1000 end;{with}
    dr_lab_y_ax_rev(false,false);
    with grstat do
   begin ywmin:=ymin; ywmax:=ymax; sfy:=(ypmax-ypmin)/(ywmax-ywmin) end;{with}
    if not  Change_Insert then
     begin
     line_plot_h(yi,0,0,count-1,grColor,grColor,false,true);
     lancuch:='sygnal pierwotny;                   czas w miliSekundach';
     win_x_y_title(lancuch,'x',8,0,ii,true);
     lancuch:='MiliWolty';
     win_x_y_title(lancuch,'y',12,0,ii,true);
     if not pSlide then
      begin
       grcolor:=14{yellow};
       str(heightLightBuff,lancuch1); str(window_size,lancuch2);
       lancuch:='             do podsw. potrz. '+lancuch2+
                 ' bajtow, a zarez. '+lancuch1;
       win_x_y_title(lancuch,'x',20,0,7{lightGray},true);
      end;{not slide}
    end;{if not Change_Insert}
   end;{not overlap}
  if not  Change_Insert then
  if krok then
   begin
    ii:=count-biez_koniec;
    px:=HeapPosPointer+biez_koniec-count;
    kx:=HeapPosPointer+biez_koniec-1;
    pause_curs(krok,1,rate,count,t5,ii,1000/rate,xr,px,kx,cIdx,fIdx,mark,unmark,
     lock,sing,ins,Change_Insert,art_nat,patternPath);
   end;{ifkrok}
 end;{maly_oscylogram}

procedure sygn_wazony_wykres;
 begin
  if pSlide then
   begin
    ii:=0{black};
//    ClearDevice;
     grColor:= 15{white};
     //SetColor(white);
    clean(0,overlap);
//    with grstat do rectangle(winxmin,winymin,winxmax,winymax);
    dr_lab_x_ax_top(1,false,false);
    with grstat do begin ywmin:=ymin*1000; ywmax:=ymax*1000 end;{with}
    dr_lab_y_ax_rev(false,false);
    grColor:=15{White}
   end
  else begin ii:=7{lightGray}; grColor:=12{lightred} end;
  f_min_max(xr,count-1,ymin,ymax);
  scale_win(HeapPosPointer/rate,(HeapPosPointer+count-1)/rate,ymin,ymax);
  line_plot_h(xr,0,0,count-1,grColor,grColor,count_cp_bool,true);
  delete(lancuch1,1,11);
  lancuch:='sygnal wazony '+lancuch1;
  win_x_y_title(lancuch,'x',20,-140,ii,true);
 end;{sygn_wazony_wykres}


  procedure line_mark(idx:real);
  {pozycja poczatkowa kursora pionowego w ruchomym oknie}
  var zmp:longint; i:byte;
  begin
   with grstat do
    begin
     zmp:=round(xpmin+(idx-px)*(xpmax-xpmin)/(kx-px));
//     i:=getColor;setColor(cyan);
//     line(zmp,ypmin+4,zmp,ypmax+20);
//     setColor(i);
    end
  end;{line_mark}

 procedure bar0;
  begin
   with grstat do
    begin
//     getFillSettings(flst);
     filtrBar:=true;
//     setFillStyle(solidFill,yellow);
//     bar(xpmin,ypmax+13,xpmax,ypmax+19); {kasowac poprzednie bary}
//     with flst do setFillStyle(pattern,color);
    end;{grafika}
  end;

 procedure bar1(j,l,m:word);
  begin               {symetryczne podkreslenie srodkowe}
   with grstat do if grafika and moovie and Filtr_to_scr then
    begin
//     getFillSettings(flst);
     if j>kx then j:=kx;  {nie wylazic poza okienko!}
     if l>m then l:=m;
     if j<0 then j:=0; if l<0 then l:=0;
//     setFillStyle(solidFill,red);
//     bar(round(xpmin+(j-px)*(xpMax-xpMin)/(kx-px)),ypmax+14,round(xpmin+l*(xpMax-xpMin)/m),ypmax+18);
//     with flst do setFillStyle(pattern,color);
    end;{with}
  end;{bar1}

procedure bar2(j,l,m:word);
 begin
//  getFillSettings(flst);
  with grstat do
   begin                        {podkreslenia skrajne}
    if j>kx then j:=kx;         {nie wylazic poza okno}
//    setFillStyle(solidFill,red);
//    bar(round(xpmin-1),ypmax+14,round(xpmin+(j-px)*(xpMax-xpMin)/(kx-px)),ypmax+18);
    if count_cp_bool then
     begin
      if m<(count-1) then                           {nie wylazic poza okno!}
      m:=count-1;
      if j<count-m then j:=count-m;
//      bar(round(xpmin+(count-j)*(xpMax-xpMin)/m),ypmax+14,round(xpMax),ypMax+18);
    end
   end;
//  with flst do setFillStyle(pattern,color);
 end;{bar2}

procedure bar3(j:word);
 begin         {bary skrajne dolno i gornoprzepustowe na caly wykres}
//  getFillSettings(flst);
  if j>kx then j:=kx;                           {nie wylazic poza okno}
  if j<px then j:=px;
//  setFillStyle(solidFill,red);
  with grstat do
  if hiFiltr then
//   bar(round(xpmin-1),ypmax+14,round(xpmin+(j-px)*(xpMax-xpMin)/(kx-px)),ypmax+18)
//  else bar(round(xpmin+(j-px)*(xpMax-xpMin)/(kx-px)),ypmax+14,round(xpMax),ypmax+18);
//  with flst do setFillStyle(pattern,color);
 end;{bar3}

 procedure buzz_hiss_com;
  var zmpl : dirStr;
  begin
   if filtrOn then
    begin
     str(buzz:5:3,lancuch2);
     if hiss then lancuch2:=lancuch2+' - szum'
     else lancuch2:=lancuch2+' - ton';
     lancuch2:='szum/ton '+lancuch2;
//     ii:=getColor; setColor(yellow);
//     getFillSettings(flst); setFillStyle(solidFill,blue);
     with Grstat do
      begin
//       bar(winxMax-length(lancuch2)*8-8,winYmin+6,winXmax-4,winYmin+18);
//       outTextXY(winXmax-length(lancuch2)*8-4,winYmin+10,lancuch2);
      end;
//     setColor(ii);
    end;
//   with flst do setFillStyle(pattern,color);
  end;{buzz_hiss_com}


 procedure grafik2(var virt_vect:array of double;var px,kx:longint;py,ky:word;
  interv,sky:real; numDat:word;xtit,ytit:pathStr; subtit:string;zms,overlap,
  newCoord:boolean;barJ,barL,barM:word;barNr:byte;
  idx:word;kolor1,kolor2:byte;count_cp,hiFiltr:boolean);
  {
  sky - skala Y; mnoznik dotyczacy tylko opisu skali Y
  px, kx - pocz. i koniec wsp. x ma znaczenie dla opisu wspolrzednych tylko
  py, ky - indeksy, zakres danych, ktory ma byc wykorzystany do skalowania Y
           wspolpracuje TYLKO z line_plot_h ze wzgledu na zabezpieczenie tam
           przed przesterowaniem y1 !!!
  px, kx, py, ky odnosza sie do indeksow skladnikow wektorow analiz a nie do
           wspolrzednych ekranu
  overlap  - nie kasowac poprzedniego wykresu
  newCoord - dac nowy opis wspolrzednych
  kolor1,kolor2 - kolor pierwszej i drugiej czesci wykresu
  barNr    - podkreslenie czesci przepuszczanej jesli in [1..3] w przeciwnym
             razie podkreslenia nie bedzie.
  zms      - zmienic skale
  zmsDone  - wykonano zmiane skali
  stretch  - rozciagnac wspolrzedna x
  }
 var wspSkal:dirStr; i:integer; lancuch:shortString; temp:realType;
 begin
  if (stretch>1) and not count_cp then                                  {lupa}
   begin
    i:=(numDat+1) div (2*stretch);
    if i<1 then i:=1;
    numDat:=2*i-1;
    if (idx>i) and (idx<cp-i) then
     begin
      px:=idx-i; kx:=idx+i-1
     end
    else
     if idx<=i then
      begin
       px:=0; kx:=2*i-1
      end
     else
      begin
       px:=cp-2*i; kx:=cp-1
      end
   end;{lupa}
  for i:=1 to 80 do lancuch[i]:=' ';
  if filtrOn and not (esc or krok) then overlap:=true;
  if zms or esc then
   begin
    if not krok then zmsDone:=true;
    ymin:=virt_vect[py]; ymax:=ymin;
    for i:=py to ky do
    begin
     temp:=virt_vect[i];
     if ymin>temp then ymin:=temp;
     if ymax<temp then ymax:=temp;
    end{for};
    i:=0;
    if (ymax-ymin<=10) and (sky=1) and (ymax>ymin) then
      repeat dec(i); sky:=10*sky until (ymax-ymin)*sky>=10;
    if (ymax-ymin>=100) and (sky=1) then
      repeat inc(i); sky:=sky/10 until (ymax-ymin)*sky<=100;
   end;
//  SetWriteMode(0);
  clean(0,overlap);
  scale_win(px,kx, ymin,ymax);
   begin
//    if pSlide then
  //   begin ClearDevice; setColor(LightGray); grColor:=white end
   // else begin setColor(cyan); grColor:=cyan end;
//    with grstat do rectangle(winxmin,winymin,winxmax,winymax);
    dr_lab_x_ax_top(interv,false,false);
    with grstat do begin ywmin:=ymin*sky; ywmax:=ymax*sky end;{with}
    dr_lab_y_ax_rev(false,false);
    if pSlide then
     begin
      grColor:=15{white};
//      setFillStyle(1,1{blue});
//      setColor(yellow)
     end
    else
     begin
      grColor:=9{lightBlue};
//      setFillStyle(1,red);
     end;
    if zms or esc then
     begin
      str(i:1,wspskal);
      if wspskal<>'0' then with grstat do
       begin
//        bar(winxmin+1,winymin+1,winxMin+24+length(wspskal)*8+1,winYmin+14);
//        outTextXY(winxmin+25,winYmin+2,wspskal);
//        outTextXY(winxmin+1,winYmin+6,'*10');
       end
     end;
    with grstat do begin ywmin:=ymin; ywmax:=ymax end;{with}
   end;{if}
  lancuch[0]:=#60;
  if filtrOn and not (only or sing) then
   begin
    win_x_y_title(lancuch,'x',8,0,0{black},true);
    win_x_y_title(lancuch,'x',20,0,0{black},true);
   end;
  if pSlide then i:=0{black} else i:=7{lightGray};
  lancuch:=ytit; win_x_y_title(lancuch,'y',10,0,i,true);
  lancuch:=xtit; win_x_y_title(lancuch,'x',8,0,i,true);
  if pSlide then begin kolor1:=15{white}; kolor2:=kolor1 end
  else
   if (not filtrOn) or not(barNr in [1..3]) then kolor2:=kolor1
   else if not hiFiltr then
    begin i:=kolor1; kolor1:=kolor2; kolor2:=i end;
  line_plot_h(virt_vect,px,idx,kx,kolor1,kolor2,count_cp,hiFiltr);
  if not pSlide then
   begin
    grcolor:=0{black};
    str(virt_vect[idx]:1:1,lancuch);
    lancuch:=lancuch+' '+subtit;
    str(idx,subtit);
    lancuch:=' Punkt['+subtit+']='+lancuch;
    str(F0:1:0,subtit);
    lancuch:=lancuch+' F0='+subtit;
    win_x_y_title(lancuch,'x',20,0,7{lightgray},true);
//    setColor(red);
    if filtrOn then
     begin
      if barNr in [1..3] then bar0;                  {kasowac poprzednie bary}
      case barNr of
       1:bar1(barJ,barL,barM);
       2:bar2(barJ,barL,barM);
       3:bar3(barJ);
      end {case}
     end{if}
   end;{if slide}
 end;{grafik2}

procedure sig_we_graph;
 begin
     sygn_wazony_wykres;
     ii:=count-biez_koniec;
     px:=HeapPosPointer+biez_koniec-count;
     kx:=HeapPosPointer+biez_koniec-1;
     pause_curs(krok,1,rate,count,t5,ii,1000/rate,xr,px,kx,cIdx,fIdx,mark,
     unmark,lock,sing,ins,Change_Insert,art_nat,patternPath);
    end;{sig_we_graph}

procedure local_graph(var virt_vect:array of double;numDat:word;lancuch:string;farbe,
   kom:byte;interval:real; var Idx1,Idx2:integer);
   begin
    if grafika and moovie then
     begin
      px:=0; kx:=numDat;
      grafik2(virt_vect,px,kx,0,numDat,interval,1,numDat,lancuch,
      lancuch1,lancuch2,zms,overlap,newCoord,barJ,barL,barM,0,
      Idx1,farbe,farbe,count_cp_bool,true);
      if marker or not (spectr_to_scr and rev_to_scr and cpstr_to_scr) then
       line_mark(Idx1);
      if krok then
       begin
        pause_curs(krok,kom,rate,count,fcpstr,insPunct,df,virt_vect,px,kx,
         Idx1,Idx2,mark,unmark,lock,sing,ins,Change_Insert,art_nat,
         patternPath);
       end;
     end;
   end{local_graph};

procedure ret_gr1(freq_interval:real);
    begin
     if Hifiltr then barNr:=1 else barNr:=2;
     lancuch1:='[mV]';
     local_graph(virt_vect,jot-1,'specTR.ODZYSK. Z CEPSTRUM - rms           '+
                 'Czest. w [Hz]',12{lightRed},4,freq_interval,fIdx,cIdx);

     local_graph(xr,jot-1,       'specTR.ODZYSK. Z CEPSTRUM - cz. rzeczyw.  '+
                 'Czest. w [Hz]',10{lightGreen},4,freq_interval,fIdx,cIdx);

     local_graph(yi,jot-1,       'specTR.ODZYSK. Z CEPSTRUM - cz. urojona   '+
                 'Czest. w [Hz]',14{yellow},4,freq_interval,fIdx,cIdx);
    end;{ret_gr1}

procedure ret_gr2;
 begin
  if double_side_cpstr_filtr then
    if count_cp_bool then
     if Hifiltr then barNr:=2
     else barNr:=1
    else barNr:=3
   else barNr:=3;
  if filtrOn then
   begin
    str(fcpstr:1:1,lancuch2);
    lancuch2:= descr(filtrOn,' f^iltr')+'='+lancuch2+'[Hz]';
   end
  else lancuch2:='';
  lancuch1:='ampl. norm.';
  if filtrOn then        {46 znakow.....................................}
   local_graph(xr,count-1,'SYGNAL PIERWOTNY PO FILTRACJI CEPSTRALNEJ     '+
    ' Czas w [ms]',13{lightmagenta},1,1000/rate,cIdx,fIdx)
  else
   local_graph(xr,count-1,'SYGNAL PIERWOTNY odzysk z cepstrum, nie filtr.'+
    ' Czas w [ms]',13{lightmagenta},1,1000/rate,cIdx,fIdx)
 end;{ret_gr2}

procedure kolor_spectr(scr_nr_as:integer;
    var freq_interval,pixY,pix1Y,pix_as,pix_as1:real;var delta:realType;
    interp:boolean;poz:byte;numDat:word;minlev,maxlev:real);
 begin
  if pSlide then exit;
  win_init(11); grColor:=15;
//  with grstat do setViewPort(winxmin,winymin,winxmax,winymax,false);
  with grstat do
   begin
    if synchro then scale_win(0,(numDat)-1,tp,tk)
    else scale_win(0,(numDat)-1,(scr_nr_as)*(bottomY-topY)*jump,
                   (scr_nr_as+1)*(bottomY-topY)*jump);
    if  moovie or s_ax then
     begin
      if s_ax then dr_lab_X_ax_top(freq_interval,true,false);
      dr_lab_Y_ax_rev(true,false);
      s_ax:=false;
     end;
    pixY:=(dyn+lba_pktow/2-topY)/sfy;                    {ruch synchroniczny}
    pix_as:=(spktr_as+1)/sfy;                            {ruch asynchron.   }
   end;{with grstat}
  if synchro then
     begin
     if interp then
      begin
       Interpol(old_obs,virt_vect,pix1y,pixy,numDat-1,lba_probek_na_osc,minlev,
       maxlev,delta,poz,
      1.1*(grstat.xpMax-grstat.xpMin)/(grstat.winMap[11,4]-grstat.winMap[11,3]));
       old_obs:=virt_vect;
      end;{if interp}
      pix_plot_h_v(virt_vect,numDat-1,pixY,minlev,maxLev,delta,12,poz,true);
     end {if synchro}
  else
     pix_plot_h_v(virt_vect,numDat-1,pix_as,minlev,maxLev,delta,12,poz,true);
  pix1Y:=pixY; pix_as1:=pix_as;lancuch:='CZAS w MILISEKUNDACH';
  win_x_y_title(lancuch,'y',10,0,7{lightgray},true);
 end;{kolor_spectr}

function tryb(logik:boolean):extStr;
 begin
  if logik then tryb:=' tak ' else tryb:=' nie '
 end;{tryb}

procedure wykres_spectrum_mom(var freq_interval:real;
 cpstr,fft_rev,retriev:boolean;var idx:integer);
 var crP:integer; NotChangeColor:boolean;

 begin
  if filtrOn then
   begin
    barJ:=fIdx; {uprzedzic okreslenie barj}
    if count_cp_bool then begin barl:=count-barj; barm:=count-1 end
    else begin barl:=cp; barm:=cp end;
   end;
  if count_cp_bool then jot:=count-1 else jot:=cp;
  lancuch1:=' FFT - moc                           Czestotliwosc w [Hz]';
  if filtrOn then
   begin
    str(fcpstr:1:1,lancuch);
    lancuch:='czest. gran'+descr(filtrOn,' f^iltru')+'='+lancuch+' [Hz]';
   end
  else lancuch:='';
  freq_interval:=df;
  idx:=fIdx;
  if not Hifiltr or cpstr and filtrOn then barNr:=2 else barNr:=1;
  if cpstr then barNr:=0;
  if filtrOn then
   begin
    if not cpstr then NotChangeColor:=not Hifiltr else NotChangeColor:=true;
    if not cpstr then crp:=idx else crp:=jot;
   end
  else begin NotChangeColor:=true; crp:=jot end;
  px:=0; kx:=jot;
  grafik2(virt_vect,px,kx,0,jot,freq_interval,1,jot,lancuch1,' decybele',
    lancuch,zms,overlap,newCoord,barJ,barL,barM,barNr,
    idx,11{lightcyan},12{lightred},count_cp_bool,NotChangeColor);
  if cpstr_to_scr or rev_to_scr then barNr:=0;
  line_mark(idx);
  if krok then
   begin
    pause_curs(krok,2,rate,count,fCpstr,insPunct,df,virt_vect,px,kx,idx,
     cIdx,mark,unmark,lock,sing,ins,Change_Insert,art_nat,patternPath);
    if not sing then
     begin
      modul_npdBrms(xr,yi,virt_vect,angle,count,false,true);             {obliczyc RMS}
      if filtrOn then
       begin
        str(fcpstr:1:1,lancuch);
        lancuch:=', czest. gran.='+lancuch+'[Hz]'+
         descr(filtr_to_scr,'f^iltr')+tryb(filtrOn);
       end
      else lancuch:='';
      px:=0; kx:=jot;
      grafik2(virt_vect,px,kx,0,jot,freq_interval,1,jot,
       ' FFT - modul RMS                     Czestotliwosc w [Hz]','[mV]',
       lancuch,zms,overlap,newCoord,barJ,barL,barM,barNr,idx,
       10{lightgreen},12{lightRed},count_cp_bool,NotChangeColor);
      line_mark(idx);
      if krok then
       begin
        pause_curs(krok,4,rate,count,fCpstr,insPunct,df,virt_vect,px,kx,
         idx,cIdx,mark,unmark,lock,sing,ins,Change_Insert,art_nat,patternPath);
        if krok then
         begin
          if filtrOn then
           begin
            str(fcpstr:1:1,lancuch);
            lancuch:=descr(filtr_to_scr,'f^iltr')+tryb(filtrOn)+
            ', czest. gran.='+lancuch+' [Hz]';
           end
          else lancuch:='';
          px:=0; kx:=jot;
          grafik2(xr,px,kx,0,jot,freq_interval,1,jot,
            ' FFT - czesc rzeczyw.                Czestotliwosc w [Hz]',
            '[mV]',lancuch,zms,overlap,newCoord,barJ,barL,barM,barNr,
            idx,2{green},12{lightRed},count_cp_bool,NotChangeColor);
          line_mark(idx);
          pause_curs(krok,4,rate,count,fCpstr,insPunct,df,xr,px,kx,idx,
           cIdx,mark,unmark,lock,sing,ins,Change_Insert,art_nat,patternPath);
          if krok then
           begin
            if filtrOn then
             begin
             str(fcpstr:1:1,lancuch);
             lancuch:=descr(filtr_to_scr,'f^iltr')+tryb(filtrOn)+
               ', czestotl. gran.='+lancuch+' [Hz]';
             end
            else lancuch:='';
            px:=0; kx:=jot;
            grafik2(yi,px,kx,0,jot,freq_interval,1,jot,
             ' FFT - czesc urojona                     Czestotl. w [Hz]',
             '[mV]',lancuch,zms,overlap,newCoord,barJ,barL,barM,barNr,
             idx,14{yellow},12{lightRed},count_cp_bool,NotChangeColor);
            line_mark(idx);
            pause_curs(krok,4,rate,count,fCpstr,insPunct,df,yi,px,kx,idx,
             cIdx,mark,unmark,lock,sing,ins,Change_Insert,art_nat,patternPath);
            if krok then
             begin
              for ii:=0 to count-1 do  virt_vect[ii]:=atan(xr[ii],yi[ii]);
              if filtrOn then
               begin
                str(fcpstr:1:1,lancuch);
                lancuch:=descr(filtr_to_scr,'f^iltr')+tryb(filtrOn)
                 +', czestotl. gran.='+lancuch+' [Hz]';
               end
              else lancuch:='';
              px:=0; kx:=jot;
              grafik2(virt_vect,px,kx,0,jot,freq_interval,1,jot,
               ' FFT - faza po transf. prostej FFT          Czest. w [Hz]',
               ' radiany',lancuch,zms,overlap,newCoord,barJ,barL,barM,barNr,
               idx,15{white},12{lightRed},count_cp_bool,NotChangeColor);
              line_mark(idx);
              pause_curs(krok,4,rate,count,fCpstr,insPunct,df,virt_vect,px,kx,
               idx,cIdx,mark,unmark,lock,sing,ins,Change_Insert,art_nat,
               patternPath);
              if krok then {obliczyc xr na podstawie fazy i rms}
               begin
                for ii:=0 to count-1 do
          virt_vect[ii]:=sqrt(sqr(xr[ii])+sqr(yi[ii]))*cos(virt_vect[ii]);
                lancuch2:='Czesc rzeczyw.uzysk.z fazy i z mod.';
                if filtrOn then
                 begin
                  str(fcpstr:1:1,lancuch);
                  lancuch:=descr(filtr_to_scr,'f^iltr')+tryb(filtrOn)
                   + ', czestotl. gran.='+lancuch+' [Hz]';
                 end
                else lancuch:='';
                px:=0; kx:=crp;
                grafik2(virt_vect,px,kx,0,jot,freq_interval,1,jot,
                 ' Czesc rzecz.odzsk z fazy i z modulu        Czest. w [Hz]',
                 ' ',lancuch,zms,overlap,newCoord,barJ,barL,barM,barNr,
                 idx,2{green},12{lightRed},count_cp_bool,NotChangeColor);
                line_mark(idx);
                pause_curs(krok,4,rate,count,fCpstr,insPunct,df,virt_vect,px,
                 kx,idx,cIdx,mark,unmark,lock,sing,ins,Change_Insert,
                 art_nat,patternPath);
                if krok and fft_rev and not(retriev or cpstr or FileOpen or sing)
                then xr:=virt_vect;
               end;{krok xr tryg}
             end{krok faza}
           end;{krok yi}
         end;{krok xr}
      end;{rms}
      modul_npdBrms(xr,yi,virt_vect,angle,count,false,false);        {powrot do decybeli}
     end;{if not sing}
   end;{if krok}
 end;{wykres_spectr_moment}

procedure cpstr_gr1(cpstr:boolean;var cursPoz:integer;info:DirStr);
 var crP:integer; NotChangeColor:boolean;
 begin
  if krok then
   begin
    if filtrOn then
     begin
      barJ:=fIdx; {uprzedzic okreslenie barj}
      if count_cp_bool then begin barl:=count-barj; barm:=count-1 end
      else begin barl:=cp; barm:=cp end;
     end;
    if count_cp_bool then jot:=count-1 else jot:=cp;
    lancuch1:=info+'                      Czestotliwosc w [Hz]';
    if filtrOn then
     begin
      str(fcpstr:1:1,lancuch);
      lancuch:='czest. gran'+descr(filtrOn,' f^iltru')+'='+lancuch+' [Hz]';
     end
    else lancuch:='';
    cursPoz:=fIdx;
    if not Hifiltr or cpstr and filtrOn then barNr:=2 else barNr:=1;
    if cpstr_to_scr or rev_to_scr and not filtrOn then barNr:=0;
    if filtrOn then
     begin
      if not cpstr then NotChangeColor:=not Hifiltr else NotChangeColor:=true;
      if not cpstr then crp:=fIdx else crp:=jot;
     end
    else begin NotChangeColor:=true; crp:=jot end;
    px:=0; kx:=jot;
    grafik2(virt_vect,px,kx,0,jot,df,1,jot,lancuch1,' RADIANY ',
      lancuch,zms,overlap,newCoord,barJ,barL,barM,barNr,
      fIdx,11{lightcyan},12{lightred},count_cp_bool,NotChangeColor);
    if cpstr_to_scr or rev_to_scr then barNr:=0;
    line_mark(fIdx);
    pause_curs(krok,4,rate,count,fCpstr,insPunct,df,virt_vect, px,kx,fIdx,
     cIdx,mark,unmark,lock,sing,ins,Change_Insert,art_nat,patternPath);
   end;{if krok}
 end;{cpstr_gr1}

procedure cpstr_gr2(idx:integer; color1,color2:byte);
 var logik1,logik2,logik3:boolean; {bufory dla zms, overlap, newCoord}
{
double_side_cpstr_filtr - przebarwienie srodkowe wykresu
barNr - numer baru pokazujacego co przepuszcza filtr
}
 begin
  str(virt_vect[0]:1:1,lancuch2);
  if filtrOn then
   begin
    str(fcpstr:1:1,lancuch);
    lancuch:=';'+ descr(filtr_to_scr,' f^iltr')+'='+lancuch+'[Hz]';
   end
  else lancuch:='';
  lancuch2:='zero='+lancuch2+lancuch;
  logik1:=zms; logik2:=overlap; logik3:=newCoord;
  if fcpstr=0 then
   begin
    fcpstr:=rate/jot;
    cIdx:=jot; fIdx:=round(count/jot)
   end;
  if double_side_cpstr_filtr then
   if cIdx>cp then begin fcpstr:=rate/cp; fIdx:=2; cIdx:=cp end
   else
  else if cIdx>count-1 then
   begin
    cIdx:=count-1; fcpstr:=rate/cIdx;
    fIdx:=round(count/cIdx)
   end;
  barJ:=cIdx;                                      {bar sie spoznia, a wiec}
   if double_side_cpstr_filtr then                 {uprzedzic jego okreslenie}
    if count_cp_bool then begin barl:=count-barj; barm:=count-1 end
    else begin barl:=cp; barm:=cp end
   else begin barl:=count-barj; barm:=count-1 end;
  if double_side_cpstr_filtr then
   if count_cp_bool then jot:=count-1 else jot:=cp
  else jot:=count-1;                             {barJ,barL,barM }
  if double_side_cpstr_filtr then
   if count_cp_bool then
    if Hifiltr then barNr:=2
    else barNr:=1
   else barNr:=3
  else barNr:=3;
  px:=0; kx:=jot;
  grafik2(virt_vect,px,kx,1,jot,1000/rate,1,jot,
   ' MODUL CEPSTRUM                     Okres w milisekundach','nepery',
   lancuch2,zms,overlap,newCoord,barJ,barL,barM,barNr,cIdx,color1,color2,
   double_side_cpstr_filtr and count_cp_bool,hiFiltr);
  if filtrOn then buzz_hiss_com;
//  setViewPort(0,0,GetMaxX,GetMaxY,false);
  if marker and not (auto_freq or filtrOn) then line_Mark(cIdx)
  else
   begin
    line_mark(fIdx);
//    setColor(lightGreen);
    with grstat do
//     outTextXY(round(xpmin+(fIdx-px)*(xpmax-xpmin)/(kx-px))-4,winYmin+4,kuk);
   end;
  if krok and not Change_Insert then
   begin
    pause_curs(krok,3,rate,count,fCpstr,insPunct,1000/rate,virt_vect, px,kx,
     cIdx,fIdx,mark,unmark,lock,sing,ins,Change_Insert,art_nat,patternPath);
    if krok and not Change_Insert then
     if not sing then
      begin
       if fcpstr=0 then cIdx:=jot;
       px:=0; kx:=jot;
       grafik2(xr,px,kx,1,jot,1000/rate,1,jot,'Okres w [ms]',' ',
        ' cepstrum - czesc rzeczywista ',
        zms,overlap, newCoord,barJ,barL,barM,barNr,cIdx,2{green},
        12{lightRed},double_side_cpstr_filtr and count_cp_bool,hiFiltr);
       line_mark(cIdx);
       pause_curs(krok,3,rate,count,fCpstr,insPunct,1000/rate,xr, px,kx,cIdx,
        fIdx,mark,unmark,lock,sing,ins,Change_Insert,art_nat,patternPath);
       if krok and not Change_Insert then
        begin
         if fcpstr=0 then cIdx:=jot;
         px:=0; kx:=jot;
         grafik2(yi,px,kx,1,jot,1000/rate,1,jot,'Okres w [ms] ',' ',
          ' cepstrum - czesc urojona ',
          zms,overlap,newCoord,barJ,barL,barM,barNr,cIdx,14{yellow},12{lightRed},
          double_side_cpstr_filtr and count_cp_bool,hiFiltr);
         line_Mark(cIdx);
         pause_curs(krok,3,rate,count,fCpstr,insPunct,1000/rate,yi, px,kx,
          cIdx,fIdx,mark,unmark,lock,sing,ins,Change_Insert,art_nat,patternPath);
        end;{krok}
      end{if not sing}
   end;{if krok}
   zms:=logik1; overlap:=logik2; newCoord:=logik3;
 end;{cpstr_gr2}

procedure rev_gr1(var freq_interval:real);
  var int_marker:boolean;
  begin
   if count_cp_bool then jot:=count-1 else jot:=cp;
   if count_cp_bool then if Hifiltr then barNr:=2 else barNr:=1
   else barNr:=3;
   int_marker:=marker or not spectr_to_scr or not auto_freq;
   if filtrOn then
    begin
     str(fcpstr:1:1,lancuch);
     lancuch:='czest. gran'+descr(filtrOn,' f^iltru')+'='+lancuch+' [Hz]';
     if HiFiltr then      lancuch1:=' specT.PO GORNOP.FILTR.CEPSTR.'
     else                 lancuch1:=' specT.PO DOLNOP.FILTR.CEPSTR.'
    end
   else
    begin lancuch:='';
     lancuch1:=' SPKTRUM ODZYSKANE Z CEPSTRUM '
    end;
   px:=0; kx:=jot;
   grafik2(virt_vect,px,kx,0,jot,freq_interval,1,jot,lancuch1+
    '-modul  Czestotliwosc w [Hz]','decybele',lancuch,zms,
    overlap,newCoord,barJ,barL,barM,barNr,fIdx,
    5{magenta},5{magenta},count_cp_bool,true);
   if int_marker then line_mark(fIdx);
   if krok then
    begin
     pause_curs(krok,4,rate,count,fcpstr,insPunct,df,virt_vect, px,kx,fIdx,
     cIdx,mark,unmark,lock,sing,ins,Change_Insert,art_nat,patternPath);
     if krok then
      if not sing then
       begin
        px:=0; kx:=jot;
        grafik2(xr,px,kx,0,jot,freq_interval,1,jot,lancuch1+
         '- czesc rzecz. Czest. w [Hz]',' [mV]',lancuch,zms,overlap,
         newCoord,barJ,barL,barM,barNr,fIdx,2{green},
         12{lightRed},count_cp_bool,true);
        line_mark(fIdx);
        pause_curs(krok,4,rate,count,fcpstr,insPunct,df,xr,px,kx,fIdx,cIdx,
        mark,unmark,lock,sing,ins,Change_Insert,art_nat,patternPath);
        if krok then
         begin
          px:=0; kx:=jot;
          grafik2(yi,px,kx,0,jot,freq_interval,1,jot,lancuch1+
           '        Czestotliwosc w [Hz]',' radiany',
           '; faza '+lancuch,zms,overlap,newCoord,barJ,barL,
           barM,barNr,fIdx,14{yellow},12{lightRed},count_cp_bool,
           true);
          line_mark(fIdx);
          pause_curs(krok,4,rate,count,fcpstr,insPunct,df,yi,px,kx,fIdx,cIdx,
          mark,unmark,lock,sing,ins,Change_Insert,art_nat,patternPath);
         end;{krok, yi}
       end;{not sing}
      end;{krok}
 end;{rev_gr1}

procedure rev_gr2;
var tim:real;
 begin
  if cpstr_to_scr then
   if count_cp_bool then if Hifiltr then barNr:=2 else barNr:=1
   else barNr:=3;

  if filtrOn then
   begin
    str(fcpstr:1:1,lancuch);
    lancuch:=descr(filtrOn,'f^iltr')+tryb(filtrOn)+', czest. gran. filtr='+
           lancuch;
     if HiFiltr then     lancuch1:='SYGNAL PO ZWYKL. FILTR. GORNOP.     '
     else                lancuch1:='SYGNAL PO ZWYKL. FILTR. DOLNOP.     '
   end
  else begin lancuch:='';lancuch1:='SYGNAL ODZSK.ZE SPKTR.PO TRNSF.ODWR.' end;
  if fcpstr=0 then
   begin
    tim:=jot; fcpstr:=rate/jot; fIdx:=round(count/jot); cIdx:=jot
   end
  else tim:=cIdx;
  if tim>count then
   begin tim:=count; fcpstr:=rate/count; fIdx:=1; cIdx:=count
  end;
  barJ:=round(tim);                                 {bar sie spoznia, a wiec}
  barL:=count-barJ;                               {uprzedzic okreslenie}
  barM:=count-1;                                  {barJ,barL,barM }
  
  px:=round(HeapPosPointer*(1000/rate));
  kx:=round((HeapPosPointer+count-1)*(1000/rate));
  grafik2(xr,px,kx,0,count-1,1,1000,count-1,lancuch1+'      czas w milisek',
    'norm.',lancuch,zms,overlap,newCoord,barJ,barL,barM,barNr,
    cIdx,15{white},12{lightRed},false,true);
  if marker or not spectr_to_scr then line_Mark(fIdx);
  if krok then
   begin
    pause_curs(krok,1,rate,count,t5,ii,1000/rate,xr,px,kx,cIdx,fIdx,
     mark,unmark,lock,sing,ins,Change_Insert,art_nat,patternPath);
    if krok and not sing then
     begin
      px:=round(HeapPosPointer*(1000/rate));
      kx:=round((HeapPosPointer+count-1)*(1000/rate));
      grafik2(yi,px,kx,0,count-1,1,1000,count-1,lancuch1+
       '      czas w milisek','norm.','czesc urojona '+lancuch,zms,overlap,
       newCoord,barJ,barL,barM,barNr,cIdx,14{yellow},12{lightRed},false,true);
      lIne_mark(fIdx);
      pause_curs(krok,4,rate,count,fcpstr,insPunct,df,yi,px,kx,cIdx,fIdx,mark,
       unmark,lock,sing,ins,Change_Insert,art_nat,patternPath);
     end{krok, czesc urojona}
   end;{krok}
 end; {rev_gr2}

begin
 setLength(old_obs,count div 2+1); {tablica do modulu spectrum - interpolacja}
 rate:=10000;                    {czestotliwosc probkowania sygnalu}
 PgUp:=false;                    {atualny punkt na poczatek ekranu}
 PgDn:=false;                    {aktualny punkt na koniec ekranu}
 fullStop:=false;                {zatrzymac analizy po zapelnieniu ekranu}
 new_osc:=false;                 {kreslic nowy oscylogram (duzy, z prawej)}
 light:=false;
 freez:=false;                   {zamrozic ruch automatyczny (ster. reczne)}
 clr:=false;
 only:=false;
 sing:=false;
 synchro:=false;                 {synchronizacja kolor. spectr. z ruchem okna}
 krok:=false;                    {wykonanie krokowe, ster. reczne}
 zms:=false;                     {zmienic skale w ruchomym oknie}
 zmsDone:=false;                 {wykonanie zmiany skali ruchomego okna}
 overlap:=false;                 {nakladanie ruchomych okien}
 newCoord:=false;
 count_cp_bool:=false;           {wykres dwustr. spktr (tylko ruch. okno)}
 filtr_to_scr:=false;            {filtr, efekty na ekran}
 filtrOn:=false;                 {wlaczony filtr (wycinanie odcinka)}
 barJ:=0;                        {bar podkresl. pasmo przepuszczane, koniec}
 barL:=0;                        {j.w., symetria}
 barM:=1;                        {j.w., lba skladnikow wektora}
 barNr:=0;                       {j.w., rodzaj podkreslenia}
 filtrBar:=false;
 s_ax:=true;
 w_p_s:=0;
 powerLost:=0;                   {autom. przestr., minimalna strata mocy}
 double_side_cpstr_filtr:=false; {srodkowe przebarwienie cepstrum}
 F0Fix:=300;
 Change_Insert:=false;
 ins:=false;
 stretch:=1;                     {powiekszenie skali x}
 px:=0;                          {poczatek wyswietlanego wycinka (indeks)}
 kx:=count div 2;                {koniec wysw. wycinka (indeks)}
 pSlide:= false;                 {slajd na drukarke (kolory czarno biale)}
 kuk:=#0;                        {przebieg w Auto_Tun}
 wsp_pix:=0;                     // współczynnik dla określenia baru określającego wykonanie analiz;
end.