form_32kFirCoeffCal.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:21k
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * form_32kFirCoeffCal.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * 32k FIR coefficient calibration source
- *
- * Author:
- * -------
- * Andy Ueng (mtk00490)
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * $Revision$
- * $Modtime$
- * $Log$
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include <vcl.h>
- #include <math.h>
- #include <IniFiles.hpp>
- //#include "freqz.h"
- //#include "psdoptions.h"
- //#include "firls.h"
- #pragma hdrstop
- #include "form_32kFirCoeffCal.h"
- #include "form_FirResponse.h"
- #include "sp_coef_cal.h"
- #include "melody_coef_cal32.h"
- #include "meta_utils.h"
- // misc
- #ifndef _MISC_AUDIO_H_
- #include "misc_audio.h"
- #endif
- #include "math_utils.h"
- #include "man_dll.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- Tfrm32kFirCoefCal *frm32kFirCoefCal;
- //---------------------------------------------------------------------------
- __fastcall Tfrm32kFirCoefCal::Tfrm32kFirCoefCal(TComponent* Owner)
- : TForm(Owner)
- {
- int i;
- // initialization
- Fs = 32000.0;
- DigitalScale = 0.5;
- // isTRCLoadOk = false;
- isOrgCurvePlot = false;
- isWantedCurvePlot = false;
- isCompensateCurvePlot = false;
- LogFloor = pow(10, -10);
- pi = 3.1416;
- lblVertical[0] = lblVertical0;
- lblVertical[1] = lblVertical1;
- lblVertical[2] = lblVertical2;
- lblVertical[3] = lblVertical3;
- lblVertical[4] = lblVertical4;
- lblVertical[5] = lblVertical5;
- lblVertical[6] = lblVertical6;
- lblVertical[7] = lblVertical7;
- lblVertical[8] = lblVertical8;
- lblHorizotal[0] = lblh0Hz;
- lblHorizotal[1] = lblh2000Hz;
- lblHorizotal[2] = lblh4000Hz;
- lblHorizotal[3] = lblh6000Hz;
- lblHorizotal[4] = lblh8000Hz;
- lblHorizotal[5] = lblh10000Hz;
- lblHorizotal[6] = lblh12000Hz;
- lblHorizotal[7] = lblh14000Hz;
- lblHorizotal[8] = lblh16000Hz;
-
- lblHz[ 0] = lbl0Hz; edtHzdB[ 0] = edt0HzdB;
- lblHz[ 1] = lbl60Hz; edtHzdB[ 1] = edt60HzdB;
- lblHz[ 2] = lbl170Hz; edtHzdB[ 2] = edt170HzdB;
- lblHz[ 3] = lbl310Hz; edtHzdB[ 3] = edt310HzdB;
- lblHz[ 4] = lbl600Hz; edtHzdB[ 4] = edt600HzdB;
- lblHz[ 5] = lbl800Hz; edtHzdB[ 5] = edt800HzdB;
- lblHz[ 6] = lbl1000Hz; edtHzdB[ 6] = edt1000HzdB;
- lblHz[ 7] = lbl2000Hz; edtHzdB[ 7] = edt2000HzdB;
- lblHz[ 8] = lbl3000Hz; edtHzdB[ 8] = edt3000HzdB;
- lblHz[ 9] = lbl4000Hz; edtHzdB[ 9] = edt4000HzdB;
- lblHz[10] = lbl5000Hz; edtHzdB[10] = edt5000HzdB;
- lblHz[11] = lbl6000Hz; edtHzdB[11] = edt6000HzdB;
- lblHz[12] = lbl7000Hz; edtHzdB[12] = edt7000HzdB;
- lblHz[13] = lbl8000Hz; edtHzdB[13] = edt8000HzdB;
- lblHz[14] = lbl9000Hz; edtHzdB[14] = edt9000HzdB;
- lblHz[15] = lbl10000Hz; edtHzdB[15] = edt10000HzdB;
- lblHz[16] = lbl11000Hz; edtHzdB[16] = edt11000HzdB;
- lblHz[17] = lbl12000Hz; edtHzdB[17] = edt12000HzdB;
- lblHz[18] = lbl13000Hz; edtHzdB[18] = edt13000HzdB;
- lblHz[19] = lbl14000Hz; edtHzdB[19] = edt14000HzdB;
- lblHz[20] = lbl15000Hz; edtHzdB[20] = edt15000HzdB;
- lblHz[21] = lbl16000Hz; edtHzdB[21] = edt16000HzdB;
- vDistance = 40;
- vScale = 10;
- hDistance = imAudioCal->Width / MELODY_HORIZONTAL_LABEL_NUM;
- hScale = 2000;
- //hInScale2 = 50;
- vStart = 10;
- hStart = 0;
- //hStart2 = hOutScale1*log10(100*9/hInScale1);
-
- // PlotGrid(0, 16000, -3, 5);
- // PlotBoundaryCurve();
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm32kFirCoefCal::btnSetupOutputFileClick(
- TObject *Sender)
- {
- bool ok = SaveDialog->Execute();
- if( !ok )
- {
- sbAudioCal->Panels->Items[0]->Text = (AnsiString) " Setup FIR file fail";
- Application->MessageBox( "Execution Failure : Setup FIR file", "FAILURE", MB_OK );
- return;
- }
- stOutputFileName->Caption = SaveDialog->FileName;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm32kFirCoefCal::edtdBCheck(TObject *Sender)
- {
- double data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " character is not valid ";
- text = edit->Text;
- if( !IsValidMagdB( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
-
- mSel.MagdB[edit->Tag] = atof(edit->Text.c_str());
- mSel.Mag[edit->Tag] = pow(10.0, mSel.MagdB[edit->Tag]/20.0);
- MELODY_COEF_CAL_Object.getInterpolateFreq( 100.0, 100.0, 16000.0, &xi );
- MELODY_COEF_CAL_Object.interp1( &mSel, &xi ); // output xi.Mag
- PlotCurve(PLOT_MELODY_GRID | PLOT_MELODY_ORG_CURVE);
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm32kFirCoefCal::btnRunClick(TObject *Sender)
- {
- AFT_RESULT ret;
- //static bool isMfileDllLoaded = false;
- //static bool isFirstConnectMatlab = true;
- //static bool result = false;
- double min_y, max_y;
- int i;
- // check Matlab license.dat
- // if( !SP_COEF_CAL_Object.CheckLicenseDat() )
- // {
- // sbAudioCal->Panels->Items[0]->Text = (AnsiString) " Please put Matlab license.dat under the same folder as Meta2.exe";
- // Application->MessageBox( "Please put Matlab license.dat under the same folder as Meta2.exe" , "ERROR", MB_OK );
- // return;
- // }
- // connect with Matlab check
- //if( isFirstConnectMatlab )
- //{
- // isFirstConnectMatlab = false;
- // sbAudioCal->Panels->Items[0]->Text = (AnsiString) " Connect with Matlab progressing";
- // result = SP_COEF_CAL_Object.CheckEngineExist();
- //}
- // if( result == false )
- // {
- // sbAudioCal->Panels->Items[0]->Text = (AnsiString) " Connect with Matlab fail";
- // Application->MessageBox( " Connect with Matlab fail" , "ERROR", MB_OK );
- // return;
- // }
- // if( isMfileDllLoaded == false )
- // {
- //
- // if( DllMan->LoadMfilesDllFunctions( this->Handle ) == false )
- // {
- //
- // return;
- // }
- // isMfileDllLoaded = true;
- // }
- for(i=0; i<TOTAL_SEL_MELODY_FREQ_NUM; i++ )
- {
- getHzFromStr( lblHz[i]->Caption, mSel.Hz[i]);
- mSel.MagdB[i] = atof(edtHzdB[i]->Text.c_str());
- mSel.Mag[i] = pow(10.0, mSel.MagdB[i]/20.0);
- }
- MELODY_COEF_CAL_Object.getInterpolateFreq( 100.0, 100.0, 16000.0, &xi );
- MELODY_COEF_CAL_Object.interp1( &mSel, &xi ); // output xi.Mag
- GetMinMaxY( &xi, &min_y, &max_y );
- PlotGrid( 0, 16000, min_y-2, max_y+2);
- PlotOrgCurve( xi.Hz, xi.MagdB ); // fig 1
- ret = MELODY_COEF_CAL_Object.firls( 24, 32000, &xi, &B);
- if( ret )
- {
- char str[256];
- strcpy( str, MELODY_COEF_CAL_Object.Get_ErrorString( ret ) );
- Application->MessageBox( str, "Fail", MB_OK );
- return;
- }
- for(i=0; i<TOTAL_MELODY_SAMPLE_NUM; i++ )
- {
- H.Hz[i] = xi.Hz[i];
- }
- ret = MELODY_COEF_CAL_Object.freqz( &B, 1, TOTAL_MELODY_SAMPLE_NUM, 32000, &H);
- if( ret )
- {
- char str[256];
- strcpy( str, MELODY_COEF_CAL_Object.Get_ErrorString( ret ) );
- Application->MessageBox( str, "Fail", MB_OK );
- return;
- }
- PlotFreqzCurve( H.Hz, H.MagdB ); // fig 1
- // 2nd run
- MaxOfDoubleArray( B.Mag, MELODY_FIR_TAPS, &Bmax );
- for( i=0; i<MELODY_FIR_TAPS; i++ )
- {
- Bnorm.Mag[i] = B.Mag[i] / Bmax;
- BB.Mag[i] = Round_double( Bnorm.Mag[i]*MELODY_FIR_COEFF_SCALE );
- }
- for(i=0; i<TOTAL_MELODY_SAMPLE_NUM; i++ )
- {
- HH.Hz[i] = xi.Hz[i];
- }
- ret = MELODY_COEF_CAL_Object.freqz( &BB, 1, TOTAL_MELODY_SAMPLE_NUM, 32000, &HH);
- if( ret )
- {
- char str[256];
- strcpy( str, MELODY_COEF_CAL_Object.Get_ErrorString( ret ) );
- Application->MessageBox( str, "Fail", MB_OK );
- return;
- }
- // plot fig2
- // 3rd run
- Bsum = SumOfDoubleArray( B.Mag, MELODY_FIR_TAPS );
- for( i=0; i<MELODY_FIR_TAPS; i++ )
- {
- Bsf.Mag[i] = Bnorm.Mag[i];
- BBsum.Mag[i] = Round_double( Bsf.Mag[i]*MELODY_FIR_COEFF_SCALE*DigitalScale );
- }
- for(i=0; i<TOTAL_MELODY_SAMPLE_NUM; i++ )
- {
- HHH.Hz[i] = xi.Hz[i];
- }
- ret = MELODY_COEF_CAL_Object.freqz( &BBsum, 1, TOTAL_MELODY_SAMPLE_NUM, 32000, &HHH);
- if( ret )
- {
- char str[256];
- strcpy( str, MELODY_COEF_CAL_Object.Get_ErrorString( ret ) );
- Application->MessageBox( str, "Fail", MB_OK );
- return;
- }
- if( ! MELODY_COEF_CAL_Object.REQ_Write_FIR_File(stOutputFileName->Caption.c_str(), &BBsum) )
- {
- sbAudioCal->Panels->Items[0]->Text = (AnsiString) " Write melody FIR coefficient to file fail";
- Application->MessageBox( "Write melody FIR coefficient to file fail" , "FAIL", MB_OK );
- return;
- }
- sbAudioCal->Panels->Items[0]->Text = (AnsiString) " Run successfully";
- }
- //==============================================================================
- int Tfrm32kFirCoefCal::MapToCoordinatesX( double Hz )
- {
- return (hStart + Hz/hScale*hDistance );
- }
- //--------------------------------------------------------------------------
- int Tfrm32kFirCoefCal::MapToCoordinatesY( double dB )
- {
- return ( (vStart - dB ) /vScale*vDistance );
- }
- //==============================================================================
- void Tfrm32kFirCoefCal::PlotCurve( int plot_mask )
- {
- // plot grid
- double min_y, max_y;
- if( plot_mask & PLOT_MELODY_GRID )
- {
- GetMinMaxY( &xi, &min_y, &max_y );
- if( min_y == max_y )
- {
- PlotGrid(0, 16000, -3, 5);
- }
- else
- {
- PlotGrid( 0, 16000, min_y-2, max_y+2);
- }
- }
- // plot original curve
- if( plot_mask & PLOT_MELODY_ORG_CURVE )
- {
- PlotOrgCurve( xi.Hz, xi.MagdB ); // fig 1
- }
- // plot FREQZ curve
- if( plot_mask & PLOT_MELODY_FREQZ_CURVE )
- {
- PlotFreqzCurve( H.Hz, H.MagdB ); // fig 1
- }
- }
- //---------------------------------------------------------------------------
- void Tfrm32kFirCoefCal::PlotGrid(int min_x, int max_x, int min_y, int max_y)
- {
- int i;
- double range;
- ClearImage();
- // set pen color & style
- imAudioCal->Canvas->Pen->Color = clBlack;
- imAudioCal->Canvas->Pen->Width = 1;
- imAudioCal->Canvas->Pen->Style = psDot;
-
- // plot horizotal grid & label
- vStart = max_y;
- vDistance = imAudioCal->Height / 9;
- vScale = (max_y - min_y)/9 + 1;
- if( vScale < 1)
- {
- vScale = 1;
- }
- for(i=0; i<MELODY_VERTICAL_LABEL_NUM; i++)
- {
- lblVertical[i]->Top = imAudioCal->Top + i*vDistance - 5;
- lblVertical[i]->Left = imAudioCal->Left - 20;
- lblVertical[i]->Caption = IntToStr( max_y - i*vScale );
- imAudioCal->Canvas->MoveTo( 1, i*vDistance );
- imAudioCal->Canvas->LineTo( 1 + imAudioCal->Width, i*vDistance );
- }
- // plot vertical grid & label
- for( i=0; i<MELODY_HORIZONTAL_LABEL_NUM; i++ )
- {
- lblHorizotal[i]->Left = imAudioCal->Left + i*hDistance - 10;
- lblHorizotal[i]->Top = imAudioCal->Top + imAudioCal->Height + 5;
- imAudioCal->Canvas->MoveTo( i*hDistance, 1 );
- imAudioCal->Canvas->LineTo( i*hDistance, imAudioCal->Height );
- }
- }
- //------------------------------------------------------------------------
- void Tfrm32kFirCoefCal::GetMinMaxY( sMelodyInterpolate *p_MelodyInterpolate, double *p_min_y, double *p_max_y )
- {
- *p_min_y = 1000000.0;
- *p_max_y = -1000000.0;
- for( int i=0; i<TOTAL_MELODY_SAMPLE_NUM; i++ )
- {
- if( *(p_MelodyInterpolate->MagdB+i) < *p_min_y )
- {
- *p_min_y = *(p_MelodyInterpolate->MagdB+i);
- }
- if( *(p_MelodyInterpolate->MagdB+i) > *p_max_y )
- {
- *p_max_y = *(p_MelodyInterpolate->MagdB+i);
- }
- }
- }
- //---------------------------------------------------------------------------
- void Tfrm32kFirCoefCal::PlotOrgCurve( double *p_xi, double *p_yi)
- {
- // set pen color & style
- imAudioCal->Canvas->Pen->Color = clBlue;
- imAudioCal->Canvas->Pen->Width = 1;
- imAudioCal->Canvas->Pen->Style = psSolid;
- imAudioCal->Canvas->MoveTo( MapToCoordinatesX(p_xi[0]), MapToCoordinatesY(p_yi[0]) );
- for( int i=1; i<TOTAL_MELODY_SAMPLE_NUM; i++ )
- {
- imAudioCal->Canvas->LineTo( MapToCoordinatesX(p_xi[i]), MapToCoordinatesY(p_yi[i]) );
- }
- }
- //---------------------------------------------------------------------------
- void Tfrm32kFirCoefCal::PlotFreqzCurve( double *p_xi, double *p_yi)
- {
- // set pen color & style
- imAudioCal->Canvas->Pen->Color = clRed;
- imAudioCal->Canvas->Pen->Width = 1;
- imAudioCal->Canvas->Pen->Style = psDot;
- imAudioCal->Canvas->MoveTo( MapToCoordinatesX(p_xi[0]), MapToCoordinatesY(p_yi[0]) );
- for( int i=1; i<TOTAL_MELODY_SAMPLE_NUM; i++ )
- {
- imAudioCal->Canvas->LineTo( MapToCoordinatesX(p_xi[i]), MapToCoordinatesY(p_yi[i]) );
- }
- }
- //---------------------------------------------------------------------------
- void Tfrm32kFirCoefCal::ClearImage( void )
- {
- imAudioCal->Canvas->Brush->Color = clWhite;
- imAudioCal->Canvas->Brush->Style = bsSolid;
- imAudioCal->Canvas->FillRect(Rect(0,0,imAudioCal->Width,imAudioCal->Height));
- }
- //==============================================================================
- bool Tfrm32kFirCoefCal::read_32k_Melody_FIR_setup(
- AnsiString asSetupFile,
- AnsiString asExeName
- )
- {
- AnsiString asPath;
- TIniFile *ini;
- if ( getPathFromStr(asExeName, asPath) &&
- withPath( asPath) &&
- !withPath( asSetupFile)
- )
- {
- asSetupFile = asPath + asSetupFile;
- }
- try
- {
- ini = new TIniFile( asSetupFile );
- if(ini == NULL) return false;
- stOutputFileName->Caption = ini->ReadString("32k Melody FIR Tunning","Output file name", "");
- delete ini;
- ini = NULL;
- return true;
- }
- catch (...)
- {
- AnsiString as_warning_msg;
- as_warning_msg = " Melody FIR tunning : read setup file : " + asSetupFile + " error ";
- Application->MessageBox( as_warning_msg.c_str(), "Warning", MB_OK );
- return false;
- }
- }
- //---------------------------------------------------------------------------
- bool Tfrm32kFirCoefCal::write_32k_Melody_FIR_setup(
- AnsiString asSetupFile,
- AnsiString asExeName
- )
- {
- AnsiString asPath;
- TIniFile *ini;
- if ( getPathFromStr(asExeName, asPath) &&
- withPath( asPath) &&
- !withPath( asSetupFile)
- )
- {
- asSetupFile = asPath + asSetupFile;
- }
- try
- {
- ini = new TIniFile( asSetupFile );
- if(ini == NULL) return false;
- ini->WriteString("32k Melody FIR Tunning","Output file name", stOutputFileName->Caption );
- delete ini;
- ini = NULL;
- return true;
- }
- catch (...)
- {
- AnsiString as_warning_msg;
- as_warning_msg = " Melody FIR tunning : write setup file : " + asSetupFile + " error ";
- Application->MessageBox( as_warning_msg.c_str(), "Warning", MB_OK );
- return false;
- }
- }
- //==============================================================================
- //---------------------------------------------------------------------------
- void Tfrm32kFirCoefCal::ShowHintLabel( TControl *sender, char* hint )
- {
- TPoint pt0 = this->ClientOrigin;
- TPoint pt1 = sender->ClientOrigin;
- lblHint->Left = (pt1.x-pt0.x-30);
- lblHint->Top = (pt1.y-pt0.y)+sender->Height+3;
- lblHint->Caption = hint;
- lblHint->Visible = true;
- HintTimer->Enabled = true;
- }
- //=============================================================================
- void __fastcall Tfrm32kFirCoefCal::FormShow(TObject *Sender)
- {
- static bool init = true;
- if( init )
- {
- init = false;
- read_32k_Melody_FIR_setup( "MF_setup.txt", Application->ExeName );
- for(int i=0; i<MELODY_EDIT_HZ_DB_NUM; i++)
- {
- edtdBCheck( edtHzdB[i] );
- getHzFromStr( lblHz[i]->Caption, mSel.Hz[i]);
- mSel.Mag[i] = pow(10.0, mSel.MagdB[i]/20.0);
- }
- MELODY_COEF_CAL_Object.getInterpolateFreq( 100.0, 100.0, 16000.0, &xi );
- MELODY_COEF_CAL_Object.interp1( &mSel, &xi ); // output xi.Mag
- //GetMinMaxY( &xi, &min_y, &max_y );
- //PlotGrid( 0, 16000, min_y, max_y);
- //PlotOrgCurve( xi.Hz, xi.MagdB ); // fig 1
- PlotCurve(PLOT_MELODY_GRID | PLOT_MELODY_ORG_CURVE);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm32kFirCoefCal::FormClose(TObject *Sender,
- TCloseAction &Action)
- {
- write_32k_Melody_FIR_setup( "MF_setup.txt", Application->ExeName );
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm32kFirCoefCal::HintTimerTimer(TObject *Sender)
- {
- HintTimer->Enabled = false;
- lblHint->Visible = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm32kFirCoefCal::edtDigitalScaleCheck(TObject *Sender)
- {
- AnsiString text;
- float data;
- int band;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = "value shall be 0 ~ 1.0";
- text = edit->Text;
- if( !IsValidDigitalScale( text, data ) )
- {
- edit->Text = 0;
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- DigitalScale = data;
- }
- //---------------------------------------------------------------------------