xue@0: /* xue@0: Harmonic Visualiser xue@0: xue@0: An audio file viewer and editor. xue@0: Centre for Digital Music, Queen Mary, University of London. xue@0: This file copyright 2011 Wen Xue. xue@0: xue@0: This program is free software; you can redistribute it and/or xue@0: modify it under the terms of the GNU General Public License as xue@0: published by the Free Software Foundation; either version 2 of the xue@0: License, or (at your option) any later version. xue@0: */ xue@0: //--------------------------------------------------------------------------- xue@0: #ifndef WaveViewH xue@0: #define WaveViewH xue@0: //--------------------------------------------------------------------------- xue@0: /* xue@0: WaveView.cpp implements a VCL component for visualizing linear PCM xue@0: waveform audio contents and user interactions through this GUI. xue@0: */ xue@0: xue@0: xue@0: #include "AudioPac.h" xue@0: #include "QuickSpec.h" xue@0: #include "fft.h" xue@0: xue@0: #define C4 261.6255653005986346778499935233 xue@0: xue@0: #define ITEMXZOOMIN_TAG 11 xue@0: #define ITEMXZOOMOUT_TAG 12 xue@0: #define ITEMXZOOMRESTORE_TAG 13 xue@0: #define ITEMYZOOMIN_TAG 14 xue@0: #define ITEMYZOOMRESTORE_TAG 15 xue@0: xue@0: xue@0: #define WV2_STRINGS_1 "%s\n\n%s: %d (%.3fsec)\n%s: %d (%.3fsec)\n%s: %d (%.3fsec)\n\n%s: %.1fhz\n%s: %.1fhz\n%s: %.1fhz\n\n%s: %d (%.3fsec)\n\n%s: %d\n%s: %dbit\n" xue@0: #define WV2_STRINGS_Amplitude_rms "Amplitude(rms)" xue@0: #define WV2_STRINGS_Average "Average" xue@0: #define WV2_STRINGS_Bits_per_sample "Bits per sample" xue@0: #define WV2_STRINGS_Extract "Extract" xue@0: #define WV2_STRINGS_Frequency "Frequency" xue@0: #define WV2_STRINGS_From "From" xue@0: #define WV2_STRINGS_Maximum "Maximum" xue@0: #define WV2_STRINGS_Minimum "Minimum" xue@0: #define WV2_STRINGS_Play "Play" xue@0: #define WV2_STRINGS_Properties "Properties..." xue@0: #define WV2_STRINGS_Properties_current_audio "Properties: current audio" xue@0: #define WV2_STRINGS_Properties_selection "Properties: selection" xue@0: #define WV2_STRINGS_Samples "Samples" xue@0: #define WV2_STRINGS_Samples_per_second "Samples per second" xue@0: #define WV2_STRINGS_Size "Size" xue@0: #define WV2_STRINGS_Stop_playback "Stop playback" xue@0: #define WV2_STRINGS_Time "Time" xue@0: #define WV2_STRINGS_To "To" xue@0: #define WV2_STRINGS_Total_time "Total time" xue@0: #define WV2_STRINGS_X_zoom "X zoom" xue@0: #define WV2_STRINGS_X_zoom_all "X zoom all" xue@0: #define WV2_STRINGS_X_zoom_in "X zoom in" xue@0: #define WV2_STRINGS_X_zoom_out "X zoom out" xue@0: #define WV2_STRINGS_Y_zoom "Y zoom" xue@0: #define WV2_STRINGS_Y_zoom_all "Y zoom all" xue@0: #define WV2_STRINGS_Y_zoom_in "Y zoom in" xue@0: #define WV2_STRINGS_Y_zoom_out "Y zoom out" xue@0: xue@0: #define WV2_VSELECT 1 xue@0: #define WV2_HSELECT 2 xue@0: #define WV2_AMP 4 xue@0: #define WV2_LEFT 1 xue@0: #define WV2_TOP 2 xue@0: #define WV2_RIGHT 4 xue@0: #define WV2_BOTTOM 8 xue@0: xue@0: #define WV2_MAX_CHANNEL 16 xue@0: #define WV2_MIN_LOG_FREQ 0.0001 xue@0: #define WV2_LOG_FREQ(f) (((f)>=WV2_MIN_LOG_FREQ)?(f):WV2_MIN_LOG_FREQ) xue@0: xue@0: #define wopIdle -1 xue@0: #define wopDrag 0 xue@0: #define wopSelect 1 xue@0: #define wopReselect 2 xue@0: //--------------------------------------------------------------------------- xue@0: typedef void __fastcall (__closure *TWaveViewCustomPaintEvent)(TObject* Sender, bool &Done); xue@0: typedef void __fastcall (__closure *TWaveViewCustomPropertyEvent)(TObject* Sender, bool ShowPropSel); xue@0: typedef int __fastcall (__closure *TWaveViewCustomInfoEvent)(TObject* Sender); xue@0: struct TWaveViewObject; xue@0: typedef void __fastcall (__closure *TWaveViewDrawObjectEvent)(TObject* Sender, TWaveViewObject& Obj); xue@0: typedef void __fastcall (__closure *TWaveViewMousePointerEvent)(TObject* Sender, int PaneIndex, int t, double f); xue@0: typedef void __fastcall (__closure* TWaveViewMouseLocalDataEvent)(TObject* Sender, void* Data0, void* DataP, void* DataN, int Count, int bytespersample, int t, double f, int Down); xue@0: typedef void __fastcall (__closure* TWaveViewGetIntervalEvent)(TObject* Sender, int& st, int& en, bool option); xue@0: typedef void __fastcall (__closure* TWaveViewGetOpModeEvent)(TObject* Sender, TShiftState Shift, int& OpMode); xue@0: xue@0: struct TWaveViewRulerSetting xue@0: { xue@0: TColor FrontColor; xue@0: TColor BackColor; xue@0: TColor UnitTickColor; xue@0: TColor TickColor; xue@0: TColor GridColor; xue@0: int UnitTickSize; xue@0: int TickSize; xue@0: TFont* UnitFont; xue@0: bool pre_drawing; xue@0: }; xue@0: xue@0: struct TWaveViewSelection xue@0: { xue@0: int StartPos; xue@0: int EndPos; xue@0: double StartDigiFreq; xue@0: double EndDigiFreq; xue@0: bool __fastcall operator!=(const TWaveViewSelection& WS) xue@0: { xue@0: return StartPos!=WS.StartPos || EndPos!=WS.EndPos || StartDigiFreq!=WS.StartDigiFreq || EndDigiFreq!=WS.EndDigiFreq; xue@0: } xue@0: }; xue@0: xue@0: typedef enum xue@0: { xue@0: selOuter=0, xue@0: selLeft=1, xue@0: selTopLeft=3, xue@0: selTop=2, xue@0: selTopRight=6, xue@0: selRight=4, xue@0: selBottomRight=12, xue@0: selBottom=8, xue@0: selBottomLeft=9, xue@0: selInner=15, xue@0: selNone=0 xue@0: } TWaveViewSelHitTest; xue@0: xue@0: typedef enum xue@0: { xue@0: wvfNone, xue@0: wvfPass, xue@0: wvfStop xue@0: } TWaveViewPlaybackFilter; xue@0: xue@0: typedef enum xue@0: { xue@0: wvpStereo, xue@0: wvpSwap, xue@0: wvpLeft, xue@0: wvpRight xue@0: } TWaveViewStereoMode; xue@0: xue@0: typedef enum xue@0: { xue@0: wvtPitchScale, xue@0: wvtPlayNote xue@0: } enumWaveViewTools; xue@0: xue@0: typedef Set TWaveViewTools; xue@0: xue@0: /* xue@0: TWaveViewObject implement a class to describe visual objects (tags) drawn onto the xue@0: visual display of a WaveView. They can respond to keyboard and mouse events. xue@0: xue@0: Rect xue@0: Position of object inside the WaveView. This is automatically updated each time xue@0: the contents of the WaveView is drawn. Keyboard and mouse events are enabled when xue@0: the mouse pointer falls inside the area spectifies by Rect. xue@0: xue@0: Id xue@0: Identifier. xue@0: xue@0: Tag[4], ShortTag[8] xue@0: Integer descriptors. By default ShortTag[0] describes the type of the tag. xue@0: xue@0: Buffer xue@0: Assiciated binary data. xue@0: xue@0: Options xue@0: Binary options. So far only one option wvoNoMouseFocus is available. Object xue@0: with this option set do not capture mouse movements or respond to events. xue@0: xue@0: DrawObjects xue@0: Pointer to method responsible to draw the object and set Rect accordingly. xue@0: xue@0: OnClick, OnDblClick, OnMouseDown, OnMouseMove, OnMouseUp, OnMouseWheel xue@0: Mouse event entries: pointers to methods responding to various mouse events. xue@0: xue@0: OnKeyDown xue@0: Keyboard event entry: pointers to method responding to key-down event. xue@0: */ xue@0: #define wvoNoMouseFocus 1 xue@0: struct TWaveViewObject xue@0: { xue@0: TRect Rect; xue@0: int Id; xue@0: union xue@0: { xue@0: int Tag[4]; xue@0: __int16 ShortTag[8]; xue@0: }; xue@0: void* Buffer; xue@0: int Options; xue@0: TWaveViewDrawObjectEvent DrawObject; xue@0: TNotifyEvent OnClick; xue@0: TNotifyEvent OnDblClick; xue@0: TMouseEvent OnMouseDown; xue@0: TMouseMoveEvent OnMouseMove; xue@0: TMouseEvent OnMouseUp; xue@0: TMouseWheelEvent OnMouseWheel; xue@0: TKeyEvent OnKeyDown; xue@0: }; xue@0: xue@0: AnsiString SemitoneToPitch(double f); xue@0: xue@0: /* xue@0: TWaveViewObjects maintains a list of TWaveViewObject pointers assicated with the xue@0: WaveView. xue@0: */ xue@0: class TWaveViewObjects xue@0: { xue@0: public: xue@0: int Capacity; xue@0: int Count; xue@0: TWaveViewObject* Items; xue@0: TWaveViewObjects(){Capacity=0; Count=0; Items=0;} xue@0: ~TWaveViewObjects(){free(Items);} xue@0: void Add(TWaveViewObject AnItem) xue@0: { xue@0: if (Count==Capacity) xue@0: { xue@0: Items=(TWaveViewObject*)realloc(Items, sizeof(TWaveViewObject)*(Capacity+50)); xue@0: Capacity+=50; xue@0: } xue@0: Items[Count]=AnItem; xue@0: Count++; xue@0: } xue@0: void Delete(int index) xue@0: { xue@0: memmove(&Items[index], &Items[index+1], sizeof(TWaveViewObject)*(Count-index-1)); xue@0: Count--; xue@0: } xue@0: }; xue@0: xue@0: /* xue@0: TWaveViewPanes mains a list of drawing panes the WaveView uses to draw waveforms, xue@0: spectrograms, or other contents. The drawing panes are orginized into a matrix xue@0: of Y rows and X columns and occupies most of the WaveView. The pane with indices xue@0: (x,y) in this matrix is given the pane index y*X+x. xue@0: xue@0: xue@0: public variables/properties xue@0: xue@0: readwrite FX xue@0: Number of columns. xue@0: xue@0: readonly Channel[i] xue@0: Channel index of the i-th pane. xue@0: xue@0: readonly Count xue@0: Number of panes. xue@0: xue@0: readonly HasFreqAxis[i] xue@0: True is the i-th pane has frequency axis (e.g. spectrogram pane), false if not. xue@0: xue@0: readwrite Margin xue@0: Margin between adjacent panes, in pixels. xue@0: xue@0: readwrite MarginOut xue@0: Margins between panes and boundary of client area, i.e. ClientRect, in pixels. xue@0: xue@0: readonly Type[i] xue@0: Pane type (waveform, spectrogram, etc.) of the i-th pane. xue@0: xue@0: readwrite Rect[i] xue@0: The rectangualr area of the i-th pane. xue@0: xue@0: readwrite Content[i] xue@0: The content of the i-th pane, equals Type[i]*WV2_MAX_CHANNEL+Channel[i]. xue@0: xue@0: readwrite YScale[i] xue@0: The scale for y-axis of the i-th pane. 0 for linear scale, 1 for log scale. xue@0: xue@0: readwrite Rulers[i] xue@0: The set of axes of the i-th pane. Set WV2_HSELECT for time axis, WV2_VSELECT for xue@0: frequency axis, WV2_AMP for magnitude axis. xue@0: xue@0: xue@0: public methods xue@0: xue@0: WaveViewPanes, ~WaveViewPanes xue@0: Default constructor and destructor. xue@0: xue@0: int CreatePanes(TRect ARect, int X, int Y, bool erase=true) xue@0: Set the number of columns to X, number of rows to Y, and client area to ARect. xue@0: Clear the current pane contents if erase is set. Returns X*Y is successful, 0 xue@0: if not. xue@0: xue@0: bool FreqAxis(int type) xue@0: Returns true if the queried pane type has frequency axis, false if not. xue@0: xue@0: int ResizePanes(TRect ARect) xue@0: Resize to client area to ARect. Returns 0. xue@0: */ xue@0: class TWaveViewPanes xue@0: { xue@0: int FY; xue@0: int FCapacity; xue@0: int FCount; xue@0: int FMargin; xue@0: TRect FMarginOut; xue@0: TRect ClientRect; xue@0: protected: xue@0: void __fastcall SetMargin(int AMargin); xue@0: void __fastcall SetMarginOut(TRect AMarginOut); xue@0: public: xue@0: int FX; xue@0: __property int Channel[int index]={read=GetChannel}; xue@0: __property int Count={read=FCount}; xue@0: __property bool HasFreqAxis[int index]={read=GetHasFreqAxis}; xue@0: __property int Margin={read=FMargin, write=SetMargin}; xue@0: __property TRect MarginOut={read=FMarginOut, write=FMarginOut}; xue@0: __property int Type[int index]={read=GetType}; xue@0: TRect* Rect; xue@0: int* Content; xue@0: int* YScale; //0:linear, 1:log xue@0: int* Rulers; xue@0: TWaveViewPanes() xue@0: { xue@0: FCapacity=50; xue@0: FCount=0; xue@0: Rect=new TRect[FCapacity]; xue@0: Content=new int[FCapacity]; xue@0: YScale=new int[FCapacity]; xue@0: Rulers=new int[FCapacity]; xue@0: memset(Content, 0xFF, sizeof(int)*FCapacity); xue@0: FMargin=4; xue@0: FMarginOut=TRect(5, 5, 5, 5); xue@0: } xue@0: ~TWaveViewPanes() xue@0: { xue@0: delete[] Rect; xue@0: delete[] Content; xue@0: delete[] YScale; xue@0: delete[] Rulers; xue@0: } xue@0: int CreatePanes(TRect ARect, int X, int Y, bool erase=true) xue@0: { xue@0: if (X*Y>FCapacity) return 0; xue@0: FCount=X*Y; xue@0: if (erase) xue@0: memset(Content, 0xFF, sizeof(int)*FCapacity), xue@0: memset(YScale, 0, sizeof(int)*FCapacity), xue@0: memset(Rulers, 0, sizeof(int)*FCapacity); xue@0: else xue@0: memset(&Content[FCount], 0xFF, sizeof(int)*(FCapacity-FCount)), xue@0: memset(&YScale[FCount], 0, sizeof(int)*(FCapacity-FCount)), xue@0: memset(&Rulers[FCount], 0, sizeof(int)*(FCapacity-FCount)); xue@0: xue@0: double XX=(ARect.Width()-FMarginOut.left-FMarginOut.right+FMargin)*1.0/X, xue@0: YY=(ARect.Height()-FMarginOut.top-FMarginOut.bottom+FMargin)*1.0/Y; xue@0: for (int y=0; y=FCount) xue@0: return 0; xue@0: memmove(&Items[Index], &Items[Index+1], sizeof(TWaveViewSelection)*(FCount-1-Index)); xue@0: FCount--; xue@0: if (Focus==Index) Focus=FCount-1; xue@0: else if (Focus>Index) xue@0: Focus--; xue@0: return 1; xue@0: } xue@0: int __fastcall GetStartPos() xue@0: { xue@0: if (FCount>0) xue@0: return Items[Focus].StartPos; xue@0: else return -1; xue@0: } xue@0: int __fastcall GetEndPos() xue@0: { xue@0: if (FCount>0) xue@0: return Items[Focus].EndPos; xue@0: else return -1; xue@0: } xue@0: int __fastcall GetLength() xue@0: { xue@0: if (FCount>0) xue@0: return Items[Focus].EndPos-Items[Focus].StartPos; xue@0: else return -1; xue@0: } xue@0: double __fastcall GetStartDigiFreq() xue@0: { xue@0: if (FCount>0) xue@0: return Items[Focus].StartDigiFreq; xue@0: else return -1; xue@0: } xue@0: double __fastcall GetEndDigiFreq() xue@0: { xue@0: if (FCount>0) xue@0: return Items[Focus].EndDigiFreq; xue@0: else return -1; xue@0: } xue@0: TWaveViewSelection operator[](int index) xue@0: { xue@0: if (index>=0 && index* __fastcall GetSpec(int Channel, int fr); xue@0: virtual TQuickSpectrogram* __fastcall GetSpectrogram(int Channel); xue@0: virtual double __fastcall GetSpecWindowParamD(int Index); xue@0: DYNAMIC void __fastcall KeyDown(Word &Key, TShiftState Shift); xue@0: DYNAMIC void __fastcall KeyUp(Word &Key, TShiftState Shift); xue@0: DYNAMIC void __fastcall MouseCursor(TShiftState Shift, int X, int Y); xue@0: DYNAMIC void __fastcall MouseDown(TMouseButton Button, TShiftState Shift, int X, int Y); xue@0: DYNAMIC void __fastcall MouseLocalData(int X, int Y, int Down); xue@0: DYNAMIC void __fastcall MouseMove(TShiftState Shift, int X, int Y); xue@0: DYNAMIC void __fastcall MousePointer(TShiftState Shift, int X, int Y); xue@0: DYNAMIC void __fastcall MouseUp(TMouseButton Button, TShiftState Shift, int X, int Y); xue@0: DYNAMIC void __fastcall MouseWheelHandler(TMessage& Msg); xue@0: virtual void __fastcall Paint(); xue@0: DYNAMIC void __fastcall Resize(); xue@0: xue@0: virtual void __fastcall PageChange(bool updatescrollbar=true); xue@0: xue@0: virtual void __fastcall ScrollBarChange(TObject* Sender); xue@0: xue@0: virtual void __fastcall SetAutoExtractMode(bool AnAutoExtractMode); xue@0: virtual void __fastcall SetAutoSpecAmp(bool AnAutoSpecAmp); xue@0: virtual void __fastcall SetAxisColor(TColor AnAxisColor); xue@0: virtual void __fastcall SetBackColor(TColor ABackColor); xue@0: virtual void __fastcall SetCaption(AnsiString ACaption); xue@0: virtual void __fastcall SetClickFocus(bool AClickFocus); xue@0: virtual void __fastcall SetData(int index, void* AData); xue@0: virtual void __fastcall SetDefaultPopupMenu(bool ADefaultPopupMenu); xue@0: virtual void __fastcall SetEndPos(int AnEndPos); xue@0: virtual void __fastcall SetExtractMode(int AnExtractMode); xue@0: virtual void __fastcall SetForceHamming(bool AForceHamming); xue@0: virtual void __fastcall SetMultiSelect(bool AMultiSelect); xue@0: virtual void __fastcall SetPitchScalePart(int APart); xue@0: virtual void __fastcall SetPlaybackFilter(TWaveViewPlaybackFilter APlaybackFilter); xue@0: virtual void __fastcall SetSamplesPerSec(int ASamplesPerSec); xue@0: virtual void __fastcall SetScrollBar(TScrollBar* AScrollBar); xue@0: virtual void __fastcall SetSelectedAreaColorX(TColor ASelectedAreaColorX); xue@0: virtual void __fastcall SetSelectedFrameColorX(TColor ASelectedFrameColorX); xue@0: virtual void __fastcall SetSelectingFrameColorX(TColor ASelectingFrameColorX); xue@0: virtual void __fastcall SetSelectMode(int ASelectMode); xue@0: virtual void __fastcall SetSpecOffst(int ASpecOffst); xue@0: virtual void __fastcall SetSpecRes(int ASpecRes); xue@0: virtual void __fastcall SetSpecWindowParamD(int Index, double AParamD); xue@0: virtual void __fastcall SetSpecWindowType(WindowType ASpecWindowType); xue@0: virtual void __fastcall SetSpecAmp(double AnAmp); xue@0: virtual void __fastcall SetStartPos(int AStartPos); xue@0: virtual void __fastcall SetTools(TWaveViewTools ATools); xue@0: virtual void __fastcall SetWaveAudio(TWaveAudio* AWaveAudio); xue@0: virtual void __fastcall SetWaveBackColor(TColor AWaveBackColor); xue@0: virtual void __fastcall SetWaveColor(TColor AWaveColor); xue@0: virtual void __fastcall SetYZoomRate(double AYZoomRate); xue@0: xue@0: virtual void __fastcall WaveViewAudioChange(TObject* Sender); xue@0: virtual void __fastcall WaveViewHitTest(int X, int Y); xue@0: virtual void __fastcall WaveViewSectionPlaybackDone(TObject* Sender); xue@0: virtual void __fastcall WaveViewSectionPlaybackProg(TObject* Sender, double Progress); xue@0: xue@0: public: xue@0: __property Canvas; xue@0: xue@0: __property TWaveViewSelection CurrentRange={read=GetCurrentRange}; xue@0: __property TWaveViewSelections* Selections={read=FSelections, write=FSelections}; xue@0: xue@0: __property AnsiString AccessFCaption={read=FCaption, write=FCaption}; xue@0: __property AnsiString Caption={read=FCaption, write=SetCaption}; xue@0: xue@0: __property int CalculateFrameCount={read=FCalculateFrameCount}; xue@0: xue@0: __property bool DefaultPropertyItems={read=FDefaultPropertyItems, write=FDefaultPropertyItems}; xue@0: __property bool ForceHamming={read=FForceHamming, write=SetForceHamming}; xue@0: __property bool Playing={read=GetPlaying}; xue@0: __property bool PlayNoteInSemitone={read=FPlayNoteInSemitone, write=FPlayNoteInSemitone}; xue@0: __property bool ShowInfo={read=FShowInfo, write=FShowInfo}; xue@0: __property bool ShowPaneInfo={read=FShowPaneInfo, write=FShowPaneInfo}; xue@0: xue@0: __property void* Data[int Channel]={read=GetData, write=SetData}; xue@0: __property __int16* Data16[int Channel]={read=GetData16}; xue@0: __property __pint24 Data24[int Channel]={read=GetData24}; xue@0: __property char* Data8[int Channel]={read=GetData8}; xue@0: xue@0: __property double CurrentAmplitude={read=GetCurrentAmplitude}; xue@0: __property int CurrentChannel={read=GetCurrentChannel}; xue@0: __property double CurrentDigiFreq={read=GetCurrentDigiFreq}; xue@0: __property int CurrentPane={read=FCurrentPane}; xue@0: __property __int16 CurrentSample16={read=GetCurrentSample16}; xue@0: __property int CurrentSampleInPixel={read=GetCurrentSampleInPixel}; xue@0: __property int CurrentTime={read=GetCurrentTimeEx}; xue@0: __property int CurrentX={read=FX}; xue@0: __property int CurrentY={read=FY}; xue@0: __property double EndDigiFreq={read=FEndDigiFreq, write=FEndDigiFreq}; xue@0: __property double SpecAmp={read=FSpecAmp, write=SetSpecAmp}; xue@0: __property double StartDigiFreq={read=FStartDigiFreq, write=FStartDigiFreq}; xue@0: __property double YZoomRate={read=FYZoomRate,write=SetYZoomRate}; xue@0: xue@0: __property QSPEC_FORMAT* A[int Channel][int fr]={read=GetA}; xue@0: __property int BytesPerSample={read=FBytesPerSample}; xue@0: __property int Channels={read=FChannels, write=FChannels}; xue@0: __property int EndPos={read=FEndPos, write=SetEndPos}; xue@0: __property int ExtractMode={read=FExtractMode, write=SetExtractMode}; xue@0: __property int LastX={read=FLastX}; xue@0: __property int LastY={read=FLastY}; xue@0: __property int Length={read=FLength, write=FLength}; xue@0: __property int OpMode={read=FOpMode}; xue@0: __property QSPEC_FORMAT* Ph[int Channel][int fr]={read=GetPh}; xue@0: __property TAlign RulerAlignX={read=FRulerAlignX, write=FRulerAlignX}; xue@0: __property TAlign RulerAlignY={read=FRulerAlignY, write=FRulerAlignY}; xue@0: __property int RulerUnitAmp={read=FRulerUnitAmp, write=FRulerUnitAmp}; xue@0: __property int RulerUnitFreq={read=FRulerUnitFreq, write=FRulerUnitFreq}; xue@0: __property int RulerUnitTime={read=FRulerUnitTime, write=FRulerUnitTime}; xue@0: __property int SectionEndPos={read=FSectionEndPos, write=FSectionEndPos}; xue@0: __property int SectionStartPos={read=FSectionStartPos, write=FSectionStartPos}; xue@0: __property int SelectMode={read=FSelectMode, write=SetSelectMode}; xue@0: __property bool ShowCursorText={read=FShowCursorText, write=FShowCursorText}; xue@0: __property cmplx* Spec[int Channel][int fr]={read=GetSpec}; xue@0: __property TQuickSpectrogram* Spectrogram[int Channel]={read=GetSpectrogram}; xue@0: __property int SpecOffst={read=FSpecOffst, write=SetSpecOffst}; xue@0: __property int SpecRes={read=FSpecRes, write=SetSpecRes}; xue@0: __property double SpecWindowParamD[int Index]={read=GetSpecWindowParamD, write=SetSpecWindowParamD}; xue@0: __property int StartPane={read=FStartPane}; xue@0: __property int StartPos={read=FStartPos, write=SetStartPos}; xue@0: __property int StartSel={read=FStartSel}; xue@0: __property int StartSelX={read=FStartSelX}; xue@0: __property int StartSelY={read=FStartSelY}; xue@0: __property TWaveViewStereoMode StereoMode={read=FStereoMode, write=FStereoMode}; xue@0: xue@0: __property TColor CursorColorBright={read=FCursorColorBright, write=FCursorColorBright}; xue@0: __property TColor CursorColorDim={read=FCursorColorDim, write=FCursorColorDim}; xue@0: __property TColor InfoColor0={read=FInfoColor0, write=FInfoColor0}; xue@0: __property TColor InfoColor1={read=FInfoColor1, write=FInfoColor1}; xue@0: __property TColor InfoColor2={read=FInfoColor2, write=FInfoColor2}; xue@0: xue@0: __property WindowType SpecWindowType={read=FSpecWindowType, write=SetSpecWindowType}; xue@0: xue@0: xue@0: public: xue@0: __fastcall TWaveView(TComponent* Owner, bool usex=false, bool usep=false); xue@0: __fastcall ~TWaveView(); xue@0: xue@0: void ClearSpectrogram(int index); xue@0: void ClearSpectrograms(); xue@0: void __fastcall DefaultShowProperty(bool selection); xue@0: virtual void __fastcall DoExtract(TObject* Sender); xue@0: virtual void __fastcall UndoExtract(TObject* Sender); xue@0: xue@0: virtual void __fastcall ItemExtractClick(TObject* Sender); xue@0: virtual void __fastcall ItemPlayClick(TObject* Sender); xue@0: virtual void __fastcall ItemPropertyClick(TObject* Sender); xue@0: virtual void __fastcall ItemXZoomClick(TObject* Sender); xue@0: virtual void __fastcall ItemYZoomClick(TObject* Sender); xue@0: xue@0: void __fastcall CheckWaveOutDevCaps(TObject* Sender); xue@0: void __fastcall ClearExtra(int AnExtra); xue@0: void __fastcall ClearSelections(TObject* Sender); xue@0: int __fastcall CreatePanes(int X, int Y); xue@0: void __fastcall DrawBitmap(TObject*); xue@0: void __fastcall DrawCaption(AnsiString ACaption); xue@0: void __fastcall DrawCursor(int PaneIndex, int X, int Y); xue@0: void __fastcall DrawInfo(); xue@0: void __fastcall DrawPane(int Channel, int Type, int YScale, int Rulers, TCanvas* Canv, TRect& Rect); xue@0: void __fastcall DrawPaneInfo(int Channel, int Type, int YScale, TCanvas* Canv, TRect& Rect); xue@0: void __fastcall DrawPanes(int Type=-1); xue@0: void __fastcall DrawPitchScale(int Type, TCanvas* Canv, TRect& Rect, int yscale); xue@0: void __fastcall DrawPlaybackCursor(int Position, TCanvas* Canv, TRect& Rect, int PaneType); xue@0: void __fastcall DrawSelection(int Type, TCanvas* Canv, TRect& Rect, int yscale, int Index, TColor FrameColorX); xue@0: void __fastcall DrawSelections(int Type, TCanvas* Canv, TRect& Rect, int yscale); xue@0: void __fastcall DrawSemitones(int start, int end, TCanvas* Canv, TRect& Rect, int yscale); xue@0: void __fastcall DrawSpectrogramX(int channel, TWaveViewSelection Sel, int yscale, TCanvas* ACanvas, TRect ARect, double amp=1, bool forceresample=false, bool basic=false, int SpecStyle=1); xue@0: void __fastcall DrawWaveForm(int channel, TCanvas* ACanvas, TRect, int, int, double amp=1, bool basic=false); xue@0: void __fastcall ExtDataChange(TObject* Sender); xue@0: void __fastcall ExtDataChange(TObject* Sender, int Channel, int From, int To); xue@0: TRect __fastcall ExtraBounds(int AnExtra); xue@0: TRect __fastcall ExtraInvBounds(int AnExtra); xue@0: void __fastcall FocusSelection(int Index); xue@0: void __fastcall FreeData(int Count); xue@0: void __fastcall FreeInternalBitmaps(int Count); xue@0: void __fastcall FreeSpectrograms(); xue@0: double __fastcall FromAmplitudeToPixel(int PaneIndex, double Amplitude); xue@0: double __fastcall FromPixelToAmplitude(int PaneIndex, double Y); xue@0: double __fastcall FromDigiFreqToPixel(int PaneIndex, double DigiFreq); xue@0: double __fastcall FromDigiFreqToPixel(double DigiFreq, double AStartDigiFreq, double AnEndDigiFreq, int Y1, int Y2, int YScale); xue@0: double __fastcall FromPixelToDigiFreq(int PaneIndex, double Y); xue@0: void __fastcall FromPixelToDigiFreq(int Scale, double* DigiFreq, int Count, double AStartDigiFreq, double AnEndDigiFreq); xue@0: double __fastcall FromPixelToSample(int PaneIndex, double X); xue@0: void __fastcall FromPixelToSample(double* Sample, int Count, int AStartPos, int AnEndPos); xue@0: double __fastcall FromPixelToSample(double X, int AStartPos, int AnEndPos, int X1, int X2); xue@0: double __fastcall FromSampleToPixel(int PaneIndex, double Pos); xue@0: double __fastcall FromSampleToPixel(double Pos, int X1, int X2); xue@0: xue@0: double __fastcall GetFMask(double* mask, int t, TWaveViewPlaybackFilter Filter); xue@0: virtual void __fastcall GetObjectAtPointer(int X, int Y); xue@0: virtual void __fastcall GetOpMode(Word Key, TMouseButton Button, TShiftState Shift); xue@0: bool __fastcall GetPlaying(); xue@0: bool __fastcall GetSpectroCalc(int startpos=-1, int endpos=-1, int Offst=-1, int Res=-1); xue@0: void __fastcall InvalidateBasic(int channel, int basic); xue@0: void __fastcall InvalidateBasics(int channel); xue@0: void __fastcall PausePlayback(TObject* Sender); xue@0: void __fastcall Post(int Mode=0); xue@0: void __fastcall RemoveSelection(int Index); xue@0: void __fastcall RePinExtra(int AnExtra); xue@0: void __fastcall Retrieve(int Mode=0, int from=0, int length=0); xue@0: int __fastcall SelectionAtPos(int Pos, double DigiFreq); xue@0: void __fastcall SetArea(int AStartPos, int AnEndPos, double AStartDigiFreq, double AnEndDigiFreq); xue@0: void __fastcall SetContent(int index, int channel, int type); xue@0: void __fastcall SetContent(int X, int Y, int channel, int type); xue@0: void __fastcall SetCursorTF(int PaneIndex, int t, double digif); xue@0: void __fastcall SetRulers(int PaneIndex, int Rulers); xue@0: void __fastcall SetRulerUnit(int ARulerUnitTime, int ARulerUnitFreq, int ARulerUnitAmp); xue@0: void __fastcall SetSelection(int Start, int End, double VStart, double VEnd); xue@0: void __fastcall SetStartAndEndDigiFreq(double AStartDigiFreq, double AnEndDigiFreq); xue@0: void __fastcall SetStartAndEndPos(int AStartPos, int AnEndPos); xue@0: void __fastcall SetYScale(int index, int yscale); xue@0: void StartDrag(int X, int Y); xue@0: void __fastcall StartPlayback(TObject* Sender); xue@0: void __fastcall TFFilter(int channel, bool pass, bool wholelength=false); xue@0: virtual void __fastcall UpdateScrollBar(TObject* Sender); xue@0: void __fastcall Zoom(int X, double Rate); xue@0: void __fastcall ZoomF(double Y, double Rate, int yscale); xue@0: void __fastcall ZoomY(double Rate); xue@0: xue@0: __published: xue@0: __property Align; xue@0: __property Anchors; xue@0: __property bool AutoCaption={read=FAutoCaption, write=FAutoCaption}; xue@0: __property bool AutoExtractMode={read=FAutoExtractMode, write=SetAutoExtractMode}; xue@0: __property bool AutoSpecAmp={read=FAutoSpecAmp, write=SetAutoSpecAmp}; xue@0: __property TColor AxisColor={read=FAxisColor,write=SetAxisColor}; xue@0: __property TColor BackColor={read=FBackColor,write=SetBackColor}; xue@0: __property bool ClickFocus={read=FClickFocus, write=SetClickFocus}; xue@0: __property bool DefaultPopupMenu={read=FDefaultPopupMenu, write=SetDefaultPopupMenu, default=true}; xue@0: __property DoubleBuffered; xue@0: __property bool MultiSelect={read=FMultiSelect, write=SetMultiSelect}; xue@0: __property OnResize; xue@0: __property int PitchScalePart={read=FPitchScalePart, write=SetPitchScalePart}; xue@0: __property TWaveViewPlaybackFilter PlaybackFilter={read=FPlaybackFilter, write=SetPlaybackFilter}; xue@0: __property PopupMenu; xue@0: __property bool ProgressCursor={read=FProgressCursor, write=FProgressCursor, default=true}; xue@0: __property int SamplesPerSec={read=FSamplesPerSec, write=SetSamplesPerSec}; xue@0: __property TScrollBar* ScrollBar={read=FScrollBar,write=SetScrollBar}; xue@0: __property TColor SelectedAreaColorX={read=FSelectedAreaColorX, write=SetSelectedAreaColorX}; xue@0: __property TColor SelectedFrameColorX={read=FSelectedFrameColorX, write=SetSelectedFrameColorX}; xue@0: __property TColor SelectingFrameColorX={read=FSelectingFrameColorX, write=SetSelectingFrameColorX}; xue@0: __property int SelectionBorderWidth={read=FSelectionBorderWidth, write=FSelectionBorderWidth}; xue@0: __property bool LocalDataTimeGrid={read=FLocalDataTimeGrid, write=FLocalDataTimeGrid, default=true}; xue@0: __property TWaveViewTools Tools={read=FTools, write=SetTools}; xue@0: __property Visible; xue@0: __property TWaveAudio* WaveAudio={read=FWaveAudio, write=SetWaveAudio}; xue@0: __property TColor WaveBackColor={read=FWaveBackColor, write=SetWaveBackColor}; xue@0: __property TColor WaveColor={read=FWaveColor,write=SetWaveColor}; xue@0: xue@0: __property TWaveViewCustomInfoEvent CustomCursorText={read=FCustomCursorText, write=FCustomCursorText}; xue@0: __property TNotifyEvent CustomItemExtractClick={read=FCustomItemExtractClick, write=FCustomItemExtractClick}; xue@0: __property TWaveViewCustomInfoEvent CustomInfo={read=FCustomInfo, write=FCustomInfo}; xue@0: __property TWaveViewCustomInfoEvent CustomPaneInfo={read=FCustomPaneInfo, write=FCustomPaneInfo}; xue@0: __property TWaveViewCustomPropertyEvent CustomProperty={read=FCustomProperty, write=FCustomProperty}; xue@0: __property TNotifyEvent CustomXZoomClick={read=FCustomXZoomClick, write=FCustomXZoomClick}; xue@0: __property TNotifyEvent CustomYZoomClick={read=FCustomYZoomClick, write=FCustomYZoomClick}; xue@0: __property TWaveViewCustomPaintEvent OnCustomPaint={read=FOnCustomPaint, write=FOnCustomPaint}; xue@0: __property TWaveViewGetIntervalEvent OnGetPlaybackStartAndEndPos={read=FOnGetPlaybackStartAndEndPos, write=FOnGetPlaybackStartAndEndPos}; xue@0: __property TWaveViewGetOpModeEvent OnGetOpMode={read=FOnGetOpMode, write=FOnGetOpMode}; xue@0: __property TNotifyEvent OnInfoDblClick={read=FOnInfoDblClick, write=FOnInfoDblClick}; xue@0: __property OnKeyDown; xue@0: __property OnKeyPress; xue@0: __property OnKeyUp; xue@0: __property OnDblClick; xue@0: __property OnMouseDown; xue@0: __property OnMouseMove; xue@0: __property OnMouseWheel xue@0: ; xue@0: __property TWaveViewMouseLocalDataEvent OnMouseLocalData={read=FOnMouseLocalData, write=FOnMouseLocalData}; xue@0: __property TWaveViewMousePointerEvent OnMousePointer={read=FOnMousePointer, write=FOnMousePointer}; xue@0: __property OnMouseUp; xue@0: __property TNotifyEvent BeforePlayback={read=FBeforePlayback, write=FBeforePlayback}; xue@0: __property TNotifyEvent OnPageChange={read=FOnPageChange,write=FOnPageChange}; xue@0: __property TNotifyEvent OnPaint={read=FOnPaint, write=FOnPaint}; xue@0: __property TNotifyEvent OnPlaybackDone={read=FOnPlaybackDone,write=FOnPlaybackDone}; xue@0: __property TNotifyEvent OnPlaybackStart={read=FOnPlaybackStart, write=FOnPlaybackStart}; xue@0: __property TNotifyEvent OnSelectedChange={read=FOnSelectedChange,write=FOnSelectedChange}; xue@0: __property TNotifyEvent OnScaleChange={read=FOnScaleChange,write=FOnScaleChange}; xue@0: }; xue@0: //--------------------------------------------------------------------------- xue@0: #endif