annotate WaveView.h @ 1:f3fd4e19cec0 tip

first binary upload
author wenx <xue.wen@eecs.qmul.ac.uk>
date Wed, 10 Aug 2011 14:56:28 +0100
parents a6a46af64546
children
rev   line source
xue@0 1 /*
xue@0 2 Harmonic Visualiser
xue@0 3
xue@0 4 An audio file viewer and editor.
xue@0 5 Centre for Digital Music, Queen Mary, University of London.
xue@0 6 This file copyright 2011 Wen Xue.
xue@0 7
xue@0 8 This program is free software; you can redistribute it and/or
xue@0 9 modify it under the terms of the GNU General Public License as
xue@0 10 published by the Free Software Foundation; either version 2 of the
xue@0 11 License, or (at your option) any later version.
xue@0 12 */
xue@0 13 //---------------------------------------------------------------------------
xue@0 14 #ifndef WaveViewH
xue@0 15 #define WaveViewH
xue@0 16 //---------------------------------------------------------------------------
xue@0 17 /*
xue@0 18 WaveView.cpp implements a VCL component for visualizing linear PCM
xue@0 19 waveform audio contents and user interactions through this GUI.
xue@0 20 */
xue@0 21
xue@0 22
xue@0 23 #include "AudioPac.h"
xue@0 24 #include "QuickSpec.h"
xue@0 25 #include "fft.h"
xue@0 26
xue@0 27 #define C4 261.6255653005986346778499935233
xue@0 28
xue@0 29 #define ITEMXZOOMIN_TAG 11
xue@0 30 #define ITEMXZOOMOUT_TAG 12
xue@0 31 #define ITEMXZOOMRESTORE_TAG 13
xue@0 32 #define ITEMYZOOMIN_TAG 14
xue@0 33 #define ITEMYZOOMRESTORE_TAG 15
xue@0 34
xue@0 35
xue@0 36 #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 37 #define WV2_STRINGS_Amplitude_rms "Amplitude(rms)"
xue@0 38 #define WV2_STRINGS_Average "Average"
xue@0 39 #define WV2_STRINGS_Bits_per_sample "Bits per sample"
xue@0 40 #define WV2_STRINGS_Extract "Extract"
xue@0 41 #define WV2_STRINGS_Frequency "Frequency"
xue@0 42 #define WV2_STRINGS_From "From"
xue@0 43 #define WV2_STRINGS_Maximum "Maximum"
xue@0 44 #define WV2_STRINGS_Minimum "Minimum"
xue@0 45 #define WV2_STRINGS_Play "Play"
xue@0 46 #define WV2_STRINGS_Properties "Properties..."
xue@0 47 #define WV2_STRINGS_Properties_current_audio "Properties: current audio"
xue@0 48 #define WV2_STRINGS_Properties_selection "Properties: selection"
xue@0 49 #define WV2_STRINGS_Samples "Samples"
xue@0 50 #define WV2_STRINGS_Samples_per_second "Samples per second"
xue@0 51 #define WV2_STRINGS_Size "Size"
xue@0 52 #define WV2_STRINGS_Stop_playback "Stop playback"
xue@0 53 #define WV2_STRINGS_Time "Time"
xue@0 54 #define WV2_STRINGS_To "To"
xue@0 55 #define WV2_STRINGS_Total_time "Total time"
xue@0 56 #define WV2_STRINGS_X_zoom "X zoom"
xue@0 57 #define WV2_STRINGS_X_zoom_all "X zoom all"
xue@0 58 #define WV2_STRINGS_X_zoom_in "X zoom in"
xue@0 59 #define WV2_STRINGS_X_zoom_out "X zoom out"
xue@0 60 #define WV2_STRINGS_Y_zoom "Y zoom"
xue@0 61 #define WV2_STRINGS_Y_zoom_all "Y zoom all"
xue@0 62 #define WV2_STRINGS_Y_zoom_in "Y zoom in"
xue@0 63 #define WV2_STRINGS_Y_zoom_out "Y zoom out"
xue@0 64
xue@0 65 #define WV2_VSELECT 1
xue@0 66 #define WV2_HSELECT 2
xue@0 67 #define WV2_AMP 4
xue@0 68 #define WV2_LEFT 1
xue@0 69 #define WV2_TOP 2
xue@0 70 #define WV2_RIGHT 4
xue@0 71 #define WV2_BOTTOM 8
xue@0 72
xue@0 73 #define WV2_MAX_CHANNEL 16
xue@0 74 #define WV2_MIN_LOG_FREQ 0.0001
xue@0 75 #define WV2_LOG_FREQ(f) (((f)>=WV2_MIN_LOG_FREQ)?(f):WV2_MIN_LOG_FREQ)
xue@0 76
xue@0 77 #define wopIdle -1
xue@0 78 #define wopDrag 0
xue@0 79 #define wopSelect 1
xue@0 80 #define wopReselect 2
xue@0 81 //---------------------------------------------------------------------------
xue@0 82 typedef void __fastcall (__closure *TWaveViewCustomPaintEvent)(TObject* Sender, bool &Done);
xue@0 83 typedef void __fastcall (__closure *TWaveViewCustomPropertyEvent)(TObject* Sender, bool ShowPropSel);
xue@0 84 typedef int __fastcall (__closure *TWaveViewCustomInfoEvent)(TObject* Sender);
xue@0 85 struct TWaveViewObject;
xue@0 86 typedef void __fastcall (__closure *TWaveViewDrawObjectEvent)(TObject* Sender, TWaveViewObject& Obj);
xue@0 87 typedef void __fastcall (__closure *TWaveViewMousePointerEvent)(TObject* Sender, int PaneIndex, int t, double f);
xue@0 88 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 89 typedef void __fastcall (__closure* TWaveViewGetIntervalEvent)(TObject* Sender, int& st, int& en, bool option);
xue@0 90 typedef void __fastcall (__closure* TWaveViewGetOpModeEvent)(TObject* Sender, TShiftState Shift, int& OpMode);
xue@0 91
xue@0 92 struct TWaveViewRulerSetting
xue@0 93 {
xue@0 94 TColor FrontColor;
xue@0 95 TColor BackColor;
xue@0 96 TColor UnitTickColor;
xue@0 97 TColor TickColor;
xue@0 98 TColor GridColor;
xue@0 99 int UnitTickSize;
xue@0 100 int TickSize;
xue@0 101 TFont* UnitFont;
xue@0 102 bool pre_drawing;
xue@0 103 };
xue@0 104
xue@0 105 struct TWaveViewSelection
xue@0 106 {
xue@0 107 int StartPos;
xue@0 108 int EndPos;
xue@0 109 double StartDigiFreq;
xue@0 110 double EndDigiFreq;
xue@0 111 bool __fastcall operator!=(const TWaveViewSelection& WS)
xue@0 112 {
xue@0 113 return StartPos!=WS.StartPos || EndPos!=WS.EndPos || StartDigiFreq!=WS.StartDigiFreq || EndDigiFreq!=WS.EndDigiFreq;
xue@0 114 }
xue@0 115 };
xue@0 116
xue@0 117 typedef enum
xue@0 118 {
xue@0 119 selOuter=0,
xue@0 120 selLeft=1,
xue@0 121 selTopLeft=3,
xue@0 122 selTop=2,
xue@0 123 selTopRight=6,
xue@0 124 selRight=4,
xue@0 125 selBottomRight=12,
xue@0 126 selBottom=8,
xue@0 127 selBottomLeft=9,
xue@0 128 selInner=15,
xue@0 129 selNone=0
xue@0 130 } TWaveViewSelHitTest;
xue@0 131
xue@0 132 typedef enum
xue@0 133 {
xue@0 134 wvfNone,
xue@0 135 wvfPass,
xue@0 136 wvfStop
xue@0 137 } TWaveViewPlaybackFilter;
xue@0 138
xue@0 139 typedef enum
xue@0 140 {
xue@0 141 wvpStereo,
xue@0 142 wvpSwap,
xue@0 143 wvpLeft,
xue@0 144 wvpRight
xue@0 145 } TWaveViewStereoMode;
xue@0 146
xue@0 147 typedef enum
xue@0 148 {
xue@0 149 wvtPitchScale,
xue@0 150 wvtPlayNote
xue@0 151 } enumWaveViewTools;
xue@0 152
xue@0 153 typedef Set <enumWaveViewTools, wvtPitchScale, wvtPlayNote> TWaveViewTools;
xue@0 154
xue@0 155 /*
xue@0 156 TWaveViewObject implement a class to describe visual objects (tags) drawn onto the
xue@0 157 visual display of a WaveView. They can respond to keyboard and mouse events.
xue@0 158
xue@0 159 Rect
xue@0 160 Position of object inside the WaveView. This is automatically updated each time
xue@0 161 the contents of the WaveView is drawn. Keyboard and mouse events are enabled when
xue@0 162 the mouse pointer falls inside the area spectifies by Rect.
xue@0 163
xue@0 164 Id
xue@0 165 Identifier.
xue@0 166
xue@0 167 Tag[4], ShortTag[8]
xue@0 168 Integer descriptors. By default ShortTag[0] describes the type of the tag.
xue@0 169
xue@0 170 Buffer
xue@0 171 Assiciated binary data.
xue@0 172
xue@0 173 Options
xue@0 174 Binary options. So far only one option wvoNoMouseFocus is available. Object
xue@0 175 with this option set do not capture mouse movements or respond to events.
xue@0 176
xue@0 177 DrawObjects
xue@0 178 Pointer to method responsible to draw the object and set Rect accordingly.
xue@0 179
xue@0 180 OnClick, OnDblClick, OnMouseDown, OnMouseMove, OnMouseUp, OnMouseWheel
xue@0 181 Mouse event entries: pointers to methods responding to various mouse events.
xue@0 182
xue@0 183 OnKeyDown
xue@0 184 Keyboard event entry: pointers to method responding to key-down event.
xue@0 185 */
xue@0 186 #define wvoNoMouseFocus 1
xue@0 187 struct TWaveViewObject
xue@0 188 {
xue@0 189 TRect Rect;
xue@0 190 int Id;
xue@0 191 union
xue@0 192 {
xue@0 193 int Tag[4];
xue@0 194 __int16 ShortTag[8];
xue@0 195 };
xue@0 196 void* Buffer;
xue@0 197 int Options;
xue@0 198 TWaveViewDrawObjectEvent DrawObject;
xue@0 199 TNotifyEvent OnClick;
xue@0 200 TNotifyEvent OnDblClick;
xue@0 201 TMouseEvent OnMouseDown;
xue@0 202 TMouseMoveEvent OnMouseMove;
xue@0 203 TMouseEvent OnMouseUp;
xue@0 204 TMouseWheelEvent OnMouseWheel;
xue@0 205 TKeyEvent OnKeyDown;
xue@0 206 };
xue@0 207
xue@0 208 AnsiString SemitoneToPitch(double f);
xue@0 209
xue@0 210 /*
xue@0 211 TWaveViewObjects maintains a list of TWaveViewObject pointers assicated with the
xue@0 212 WaveView.
xue@0 213 */
xue@0 214 class TWaveViewObjects
xue@0 215 {
xue@0 216 public:
xue@0 217 int Capacity;
xue@0 218 int Count;
xue@0 219 TWaveViewObject* Items;
xue@0 220 TWaveViewObjects(){Capacity=0; Count=0; Items=0;}
xue@0 221 ~TWaveViewObjects(){free(Items);}
xue@0 222 void Add(TWaveViewObject AnItem)
xue@0 223 {
xue@0 224 if (Count==Capacity)
xue@0 225 {
xue@0 226 Items=(TWaveViewObject*)realloc(Items, sizeof(TWaveViewObject)*(Capacity+50));
xue@0 227 Capacity+=50;
xue@0 228 }
xue@0 229 Items[Count]=AnItem;
xue@0 230 Count++;
xue@0 231 }
xue@0 232 void Delete(int index)
xue@0 233 {
xue@0 234 memmove(&Items[index], &Items[index+1], sizeof(TWaveViewObject)*(Count-index-1));
xue@0 235 Count--;
xue@0 236 }
xue@0 237 };
xue@0 238
xue@0 239 /*
xue@0 240 TWaveViewPanes mains a list of drawing panes the WaveView uses to draw waveforms,
xue@0 241 spectrograms, or other contents. The drawing panes are orginized into a matrix
xue@0 242 of Y rows and X columns and occupies most of the WaveView. The pane with indices
xue@0 243 (x,y) in this matrix is given the pane index y*X+x.
xue@0 244
xue@0 245
xue@0 246 public variables/properties
xue@0 247
xue@0 248 readwrite FX
xue@0 249 Number of columns.
xue@0 250
xue@0 251 readonly Channel[i]
xue@0 252 Channel index of the i-th pane.
xue@0 253
xue@0 254 readonly Count
xue@0 255 Number of panes.
xue@0 256
xue@0 257 readonly HasFreqAxis[i]
xue@0 258 True is the i-th pane has frequency axis (e.g. spectrogram pane), false if not.
xue@0 259
xue@0 260 readwrite Margin
xue@0 261 Margin between adjacent panes, in pixels.
xue@0 262
xue@0 263 readwrite MarginOut
xue@0 264 Margins between panes and boundary of client area, i.e. ClientRect, in pixels.
xue@0 265
xue@0 266 readonly Type[i]
xue@0 267 Pane type (waveform, spectrogram, etc.) of the i-th pane.
xue@0 268
xue@0 269 readwrite Rect[i]
xue@0 270 The rectangualr area of the i-th pane.
xue@0 271
xue@0 272 readwrite Content[i]
xue@0 273 The content of the i-th pane, equals Type[i]*WV2_MAX_CHANNEL+Channel[i].
xue@0 274
xue@0 275 readwrite YScale[i]
xue@0 276 The scale for y-axis of the i-th pane. 0 for linear scale, 1 for log scale.
xue@0 277
xue@0 278 readwrite Rulers[i]
xue@0 279 The set of axes of the i-th pane. Set WV2_HSELECT for time axis, WV2_VSELECT for
xue@0 280 frequency axis, WV2_AMP for magnitude axis.
xue@0 281
xue@0 282
xue@0 283 public methods
xue@0 284
xue@0 285 WaveViewPanes, ~WaveViewPanes
xue@0 286 Default constructor and destructor.
xue@0 287
xue@0 288 int CreatePanes(TRect ARect, int X, int Y, bool erase=true)
xue@0 289 Set the number of columns to X, number of rows to Y, and client area to ARect.
xue@0 290 Clear the current pane contents if erase is set. Returns X*Y is successful, 0
xue@0 291 if not.
xue@0 292
xue@0 293 bool FreqAxis(int type)
xue@0 294 Returns true if the queried pane type has frequency axis, false if not.
xue@0 295
xue@0 296 int ResizePanes(TRect ARect)
xue@0 297 Resize to client area to ARect. Returns 0.
xue@0 298 */
xue@0 299 class TWaveViewPanes
xue@0 300 {
xue@0 301 int FY;
xue@0 302 int FCapacity;
xue@0 303 int FCount;
xue@0 304 int FMargin;
xue@0 305 TRect FMarginOut;
xue@0 306 TRect ClientRect;
xue@0 307 protected:
xue@0 308 void __fastcall SetMargin(int AMargin);
xue@0 309 void __fastcall SetMarginOut(TRect AMarginOut);
xue@0 310 public:
xue@0 311 int FX;
xue@0 312 __property int Channel[int index]={read=GetChannel};
xue@0 313 __property int Count={read=FCount};
xue@0 314 __property bool HasFreqAxis[int index]={read=GetHasFreqAxis};
xue@0 315 __property int Margin={read=FMargin, write=SetMargin};
xue@0 316 __property TRect MarginOut={read=FMarginOut, write=FMarginOut};
xue@0 317 __property int Type[int index]={read=GetType};
xue@0 318 TRect* Rect;
xue@0 319 int* Content;
xue@0 320 int* YScale; //0:linear, 1:log
xue@0 321 int* Rulers;
xue@0 322 TWaveViewPanes()
xue@0 323 {
xue@0 324 FCapacity=50;
xue@0 325 FCount=0;
xue@0 326 Rect=new TRect[FCapacity];
xue@0 327 Content=new int[FCapacity];
xue@0 328 YScale=new int[FCapacity];
xue@0 329 Rulers=new int[FCapacity];
xue@0 330 memset(Content, 0xFF, sizeof(int)*FCapacity);
xue@0 331 FMargin=4;
xue@0 332 FMarginOut=TRect(5, 5, 5, 5);
xue@0 333 }
xue@0 334 ~TWaveViewPanes()
xue@0 335 {
xue@0 336 delete[] Rect;
xue@0 337 delete[] Content;
xue@0 338 delete[] YScale;
xue@0 339 delete[] Rulers;
xue@0 340 }
xue@0 341 int CreatePanes(TRect ARect, int X, int Y, bool erase=true)
xue@0 342 {
xue@0 343 if (X*Y>FCapacity) return 0;
xue@0 344 FCount=X*Y;
xue@0 345 if (erase)
xue@0 346 memset(Content, 0xFF, sizeof(int)*FCapacity),
xue@0 347 memset(YScale, 0, sizeof(int)*FCapacity),
xue@0 348 memset(Rulers, 0, sizeof(int)*FCapacity);
xue@0 349 else
xue@0 350 memset(&Content[FCount], 0xFF, sizeof(int)*(FCapacity-FCount)),
xue@0 351 memset(&YScale[FCount], 0, sizeof(int)*(FCapacity-FCount)),
xue@0 352 memset(&Rulers[FCount], 0, sizeof(int)*(FCapacity-FCount));
xue@0 353
xue@0 354 double XX=(ARect.Width()-FMarginOut.left-FMarginOut.right+FMargin)*1.0/X,
xue@0 355 YY=(ARect.Height()-FMarginOut.top-FMarginOut.bottom+FMargin)*1.0/Y;
xue@0 356 for (int y=0; y<Y; y++)
xue@0 357 {
xue@0 358 for (int x=0; x<X; x++)
xue@0 359 {
xue@0 360 int ind=y*X+x;
xue@0 361 Rect[ind].left=ARect.left+MarginOut.left+XX*x;
xue@0 362 Rect[ind].right=ARect.left+MarginOut.left+XX*(x+1)-FMargin;
xue@0 363 Rect[ind].top=ARect.top+MarginOut.top+YY*y;
xue@0 364 Rect[ind].bottom=ARect.top+MarginOut.top+YY*(y+1)-FMargin;
xue@0 365 }
xue@0 366 }
xue@0 367 ClientRect=ARect;
xue@0 368 FX=X, FY=Y;
xue@0 369 return FCount;
xue@0 370 }
xue@0 371 static bool __fastcall FreqAxis(int type)
xue@0 372 {
xue@0 373 if (type==0) return false;
xue@0 374 else return true;
xue@0 375 }
xue@0 376 private:
xue@0 377 int __fastcall GetChannel(int index)
xue@0 378 {
xue@0 379 return Content[index]%WV2_MAX_CHANNEL;
xue@0 380 }
xue@0 381 bool __fastcall GetHasFreqAxis(int index)
xue@0 382 {
xue@0 383 int AType=Content[index]/WV2_MAX_CHANNEL;
xue@0 384 return FreqAxis(AType);
xue@0 385 }
xue@0 386 int __fastcall GetType(int index)
xue@0 387 {
xue@0 388 return Content[index]/WV2_MAX_CHANNEL;
xue@0 389 }
xue@0 390 public:
xue@0 391 int ResizePanes(TRect ARect)
xue@0 392 {
xue@0 393 if (FX==0 || FY==0) return 0;
xue@0 394 double XX=(ARect.Width()-FMarginOut.left-FMarginOut.right+FMargin)*1.0/FX,
xue@0 395 YY=(ARect.Height()-FMarginOut.top-FMarginOut.bottom+FMargin)*1.0/FY;
xue@0 396 for (int y=0; y<FY; y++)
xue@0 397 {
xue@0 398 for (int x=0; x<FX; x++)
xue@0 399 {
xue@0 400 int ind=y*FX+x;
xue@0 401 Rect[ind].left=ARect.left+MarginOut.left+XX*x;
xue@0 402 Rect[ind].right=ARect.left+MarginOut.left+XX*(x+1)-FMargin;
xue@0 403 Rect[ind].top=ARect.top+MarginOut.top+YY*y;
xue@0 404 Rect[ind].bottom=ARect.top+MarginOut.top+YY*(y+1)-FMargin;
xue@0 405 }
xue@0 406 }
xue@0 407 ClientRect=ARect;
xue@0 408 return 0;
xue@0 409 }
xue@0 410 };
xue@0 411
xue@0 412 /*
xue@0 413 TWaveViewSelections maintains a list of time-frequency selections (or a binary
xue@0 414 T-F mask).
xue@0 415
xue@0 416
xue@0 417 public variables and properties
xue@0 418
xue@0 419 readwrite Capacity
xue@0 420 Number of selections the currently allocated buffer can hold.
xue@0 421
xue@0 422 readwrite FCount
xue@0 423 readonly Count
xue@0 424 Number of selections.
xue@0 425
xue@0 426 readwrite Focus
xue@0 427 Index to the currently active ("focused") selection.
xue@0 428
xue@0 429 readonly StartPos
xue@0 430 Start of the duration of the focused selection, in samples.
xue@0 431
xue@0 432 readonly EndPos
xue@0 433 End of the duration of the focused selection, in samples.
xue@0 434
xue@0 435 readonly Length
xue@0 436 Duration of the focused selection, in samples.
xue@0 437
xue@0 438 readonly StartDigiFreq
xue@0 439 Lower frequency bound of the focused selection, 1=sampling frequency.
xue@0 440
xue@0 441 readonly EndDigiFreq
xue@0 442 Upper frequency bound of the focused selection, 1=sampling frequency.
xue@0 443
xue@0 444 readwrite Items
xue@0 445 The list of selections.
xue@0 446
xue@0 447
xue@0 448 methods
xue@0 449
xue@0 450 TWaveViewSelections, ~TWaveViewSelections
xue@0 451 Default constructor and destructor.
xue@0 452
xue@0 453 void Add(TWaveViewSelection& ASelection)
xue@0 454 Adds new selection to list.
xue@0 455
xue@0 456 void Clear()
xue@0 457 Clears list.
xue@0 458
xue@0 459 Delete(int Index)
xue@0 460 Delete the index-th selection. Returns 1 if successful, 0 if not.
xue@0 461
xue@0 462 operator[i]
xue@0 463 Return the i-th selection.
xue@0 464
xue@0 465 */
xue@0 466 class TWaveViewSelections
xue@0 467 {
xue@0 468 public:
xue@0 469 int Capacity;
xue@0 470 int FCount;
xue@0 471 int Focus;
xue@0 472 __property int Count={read=FCount};
xue@0 473 __property int StartPos={read=GetStartPos};
xue@0 474 __property int EndPos={read=GetEndPos};
xue@0 475 __property int Length={read=GetLength};
xue@0 476 __property double StartDigiFreq={read=GetStartDigiFreq};
xue@0 477 __property double EndDigiFreq={read=GetEndDigiFreq};
xue@0 478 TWaveViewSelection* Items;
xue@0 479 TWaveViewSelections()
xue@0 480 {
xue@0 481 Capacity=100;
xue@0 482 FCount=0;
xue@0 483 Focus=0;
xue@0 484 Items=new TWaveViewSelection[Capacity];
xue@0 485 }
xue@0 486 ~TWaveViewSelections()
xue@0 487 {
xue@0 488 delete[] Items;
xue@0 489 }
xue@0 490 void Add(TWaveViewSelection& ASelection)
xue@0 491 {
xue@0 492 if (FCount==Capacity)
xue@0 493 {
xue@0 494 int OldCapacity=Capacity;
xue@0 495 Capacity+=50;
xue@0 496 TWaveViewSelection* NewItems=new TWaveViewSelection[Capacity];
xue@0 497 memcpy(NewItems, Items, sizeof(TWaveViewSelection)*OldCapacity);
xue@0 498 delete[] Items;
xue@0 499 Items=NewItems;
xue@0 500 }
xue@0 501 Items[FCount]=ASelection;
xue@0 502 Focus=FCount;
xue@0 503 FCount++;
xue@0 504 }
xue@0 505 void Clear()
xue@0 506 {
xue@0 507 FCount=0;
xue@0 508 Focus=0;
xue@0 509 }
xue@0 510 Delete(int Index)
xue@0 511 {
xue@0 512 if (Index<0 || Index>=FCount)
xue@0 513 return 0;
xue@0 514 memmove(&Items[Index], &Items[Index+1], sizeof(TWaveViewSelection)*(FCount-1-Index));
xue@0 515 FCount--;
xue@0 516 if (Focus==Index) Focus=FCount-1;
xue@0 517 else if (Focus>Index)
xue@0 518 Focus--;
xue@0 519 return 1;
xue@0 520 }
xue@0 521 int __fastcall GetStartPos()
xue@0 522 {
xue@0 523 if (FCount>0)
xue@0 524 return Items[Focus].StartPos;
xue@0 525 else return -1;
xue@0 526 }
xue@0 527 int __fastcall GetEndPos()
xue@0 528 {
xue@0 529 if (FCount>0)
xue@0 530 return Items[Focus].EndPos;
xue@0 531 else return -1;
xue@0 532 }
xue@0 533 int __fastcall GetLength()
xue@0 534 {
xue@0 535 if (FCount>0)
xue@0 536 return Items[Focus].EndPos-Items[Focus].StartPos;
xue@0 537 else return -1;
xue@0 538 }
xue@0 539 double __fastcall GetStartDigiFreq()
xue@0 540 {
xue@0 541 if (FCount>0)
xue@0 542 return Items[Focus].StartDigiFreq;
xue@0 543 else return -1;
xue@0 544 }
xue@0 545 double __fastcall GetEndDigiFreq()
xue@0 546 {
xue@0 547 if (FCount>0)
xue@0 548 return Items[Focus].EndDigiFreq;
xue@0 549 else return -1;
xue@0 550 }
xue@0 551 TWaveViewSelection operator[](int index)
xue@0 552 {
xue@0 553 if (index>=0 && index<FCount) return Items[index];
xue@0 554 else
xue@0 555 {
xue@0 556 TWaveViewSelection wvs={0, 0, 0, 0};
xue@0 557 return wvs;
xue@0 558 }
xue@0 559 }
xue@0 560 };
xue@0 561
xue@0 562 /*
xue@0 563 Component TWaveView
xue@0 564
xue@0 565 WaveView is a CustomControl used to display waveform audio and handling user
xue@0 566 interactions with the display. Use a TWaveView object at design time or create
xue@0 567 the object with new keyword.
xue@0 568
xue@0 569
xue@0 570 Published Properties:
xue@0 571
xue@0 572 readwrite Align (inherited)
xue@0 573 readwrite Anchors (inherited)
xue@0 574 readwrite AutoExtractMode
xue@0 575 readwrite AutoSpecAmp
xue@0 576 readwrite AxisColor
xue@0 577 readwrite BackColor
xue@0 578 readwrite ClickFocus
xue@0 579 readwrite DefaultPopupMenu
xue@0 580 readwrite DoubleBuffered (inherited)
xue@0 581 readwrite LocalDataTimeGrid
xue@0 582 readwrite MultiSelect
xue@0 583 readwrite PitchScalePart
xue@0 584 readwrite PlaybackFilter
xue@0 585 readwrite PopupMenu (inherited)
xue@0 586 readwrite ProgressCursor
xue@0 587 readwrite SamplesPerSec
xue@0 588 readwrite ScrollBar
xue@0 589 readwrite SelectedAreaColorX
xue@0 590 readwrite SelectedFrameColorX
xue@0 591 readwrite SelectingFrameColorX
xue@0 592 readwrite SelectionBorderWidth
xue@0 593 readwrite Tools
xue@0 594 readwrite Visible (inherited)
xue@0 595 readwrite WaveAudio
xue@0 596 readwrite WaveBackColor
xue@0 597 readwrite WaveColor
xue@0 598
xue@0 599
xue@0 600 AutoExtractMode
xue@0 601 ExtractMode controls what type of zoom (time, frequency, time and frequency)
xue@0 602 when a zoom-to-selection operation is invoked. If AutoExtractMode is set,
xue@0 603 ExtractMode is automatically linked to SelectMode, i.e. if SelectMode is
xue@0 604 time-select, then automatically set ExtractMode to time-zoom.
xue@0 605
xue@0 606 AutoSpecAmp
xue@0 607 Set to automatically adjust spectrogram brightness so that the brightest
xue@0 608 points in display stays at constant brightness.
xue@0 609
xue@0 610 AxisColor, BackColor, WaveBackColor and WaveColor
xue@0 611 Use these properties to change the colors of the WaveView.
xue@0 612
xue@0 613 ClickFocus
xue@0 614 Set to pass mouse and keyboard focus to the WaveView whenever it is clicked.
xue@0 615
xue@0 616 DefaultPopupMenu and PopupMenu
xue@0 617 WaveView provides some basic operations with a default PopupMenu. User can
xue@0 618 inspect or play the wave through these operations. Anyway, user may not want
xue@0 619 the popupmenu in his design. A DefaultPopupMenu property is used for this
xue@0 620 instance. If DefaultPopupMenu is set to true, the menu is used. If it is
xue@0 621 set to false, the default menu is not used, and user can assign another
xue@0 622 popupmenu to the WaveView through the PopupMenu property. The operations
xue@0 623 associated with the default popupmenu are also available through a group
xue@0 624 of methods that are declared public in TWaveView class. See Public Methods
xue@0 625 for details.
xue@0 626
xue@0 627 LocalDataTimeGrid
xue@0 628 WaveView invokes MouseLocalData event as the mouse pointer is moved inside
xue@0 629 the display panes, supplying the time at mouse pointer as an argument. If
xue@0 630 LocalDataTimeGrid is set, the time argument provided is aligned to the
xue@0 631 nearest spectrogram frame centre.
xue@0 632
xue@0 633 MultiSelect
xue@0 634 Set to entre multiple selection mode in which the user can made multiple
xue@0 635 time-frequency selections.
xue@0 636
xue@0 637 PitchScalePart
xue@0 638 WaveView draws a set of harmonic frequency markers aligned to the position
xue@0 639 of the mouse pointer if Tools contains wvtPitchScale. PitchScalePart specifies
xue@0 640 the partial index associated with the frequency at mouse pointer.
xue@0 641
xue@0 642 PlaybackFilter
xue@0 643 Specifies the type of filter (pass, stop, none) to use for playback.
xue@0 644
xue@0 645 ProgressCursor
xue@0 646 Set to show a playback cursor during playback.
xue@0 647
xue@0 648 SamplesPerSec
xue@0 649 Sampling rate used by the WaveView.
xue@0 650
xue@0 651 ScrollBar
xue@0 652 WaveView doesn't implement a scrollbar. To provide a WaveView object
xue@0 653 with a scrollbar, simply use a normal ScrollBar and assign it to the
xue@0 654 WaveView object through the ScrollBar property. The WaveView will use
xue@0 655 the scrollbar automatically.
xue@0 656
xue@0 657 SelectedAreaColorX, SelectedFrameColorX, SelectingFrameColorX
xue@0 658 Use these properties to change the xor colour masks for drawing the
xue@0 659 time-frequency selections.
xue@0 660
xue@0 661 Tools
xue@0 662 Additional tools the WaveView comes with, including wvtPitchScale for drawing
xue@0 663 a set of harmonic frequency marks aligned to the position of teh mouse pointer,
xue@0 664 and wvtPlayNote for playing a note pitched at the mouse pointer when the
xue@0 665 mouse is clicked with Shift key held down.
xue@0 666
xue@0 667 WaveAudio
xue@0 668 Use this property to associate a WaveAudio object to WaveView. If 0 is
xue@0 669 written to WaveAudio property, the WaveView displays nothing.
xue@0 670
xue@0 671
xue@0 672 Public Properties
xue@0 673
xue@0 674 readonly A[][]
xue@0 675 readwrite AccessFCaption
xue@0 676 readonly BytesPerSample
xue@0 677 readonly CalculateFrameCount
xue@0 678 readonly Canvas (inherited)
xue@0 679 readwrite Caption (inherited)
xue@0 680 readwrite Channels
xue@0 681 readonly CurrentAmplitude
xue@0 682 readonly CurrentChannel
xue@0 683 readonly CurrentDigiFreq
xue@0 684 readonly CurrentPane
xue@0 685 readonly CurrentRange
xue@0 686 readonly CurrentSample16
xue@0 687 readonly CurrentSampleInPixel
xue@0 688 readonly CurrentTime
xue@0 689 readonly CurrentX
xue@0 690 readonly CurrentY
xue@0 691 readwrite CursorColorBright
xue@0 692 readwrite CursorColorDim
xue@0 693 readwrite Data[]
xue@0 694 readonly Data8[]
xue@0 695 readonly Data16[]
xue@0 696 readonly Data24[]
xue@0 697 readwrite DefaultPropertyItems
xue@0 698 readwrite EndDigiFreq
xue@0 699 readwrite EndPos
xue@0 700 readwrite ExtractMode
xue@0 701 readwrite ForceHamming
xue@0 702 readwrite InfoColor0
xue@0 703 readwrite InfoColor1
xue@0 704 readwrite InfoColor2
xue@0 705 readonly LastX
xue@0 706 readonly LastY
xue@0 707 readwrite Length
xue@0 708 readonly OpMode
xue@0 709 readonly Ph[][]
xue@0 710 readonly Playing
xue@0 711 readwrite PlayNoteInSemitone
xue@0 712 readwrite RulerAlignX
xue@0 713 readwrite RulerAlignY
xue@0 714 readwrite RulerUnitAmp
xue@0 715 readwrite RulerUnitFreq
xue@0 716 readwrite RulerUnitTime
xue@0 717 readwrite SectionEndPos
xue@0 718 readwrite SectionStartPos
xue@0 719 readwrite Selections
xue@0 720 readwrite SelectMode
xue@0 721 readwrite ShowCursotText
xue@0 722 readwrite ShowInfo
xue@0 723 readwrite ShowPaneInfo
xue@0 724 readonly Spec[][]
xue@0 725 readwrite SpecAmp
xue@0 726 readwrite SpecOffst
xue@0 727 readwrite SpecRes
xue@0 728 readonly Spectrogram[]
xue@0 729 readwrite SpecWindowParamD[]
xue@0 730 readwrite SpecWindowType
xue@0 731 readwrite StartDigiFreq
xue@0 732 readonly StartPane
xue@0 733 readwrite StartPos
xue@0 734 readonly StartSel
xue@0 735 readonly StartSelX
xue@0 736 readonly StartSelY
xue@0 737 readwrite StereoMode
xue@0 738 readwrite YZoomRate
xue@0 739
xue@0 740
xue@0 741 A[ch][fr]
xue@0 742 Amplitude spectrum of channel ch and frame fr.
xue@0 743
xue@0 744 AccessFCaption
xue@0 745 Provides direct access to FCaption without invoking SetCaption(...).
xue@0 746
xue@0 747 BytesPerSample
xue@0 748 Bytes used for each waveform sample (8, 16 or 24).
xue@0 749
xue@0 750 Channels
xue@0 751 Number of channels.
xue@0 752
xue@0 753 CurrentAmplitude
xue@0 754 Reading on amplitude axis at the mouse pointer in waveform display.
xue@0 755
xue@0 756 CurrentChannel
xue@0 757 Channel index of data displayed in CurrentPane.
xue@0 758
xue@0 759 CurrentDigiFreq
xue@0 760 Reading on frequency axis at the mouse pointer in spectrogram display.
xue@0 761
xue@0 762 CurrentPane
xue@0 763 Index of the display pane that currently containins the mouse pointer.
xue@0 764
xue@0 765 CurrentRange
xue@0 766 Time-frequency scope of the current display.
xue@0 767
xue@0 768 CurrentSample16
xue@0 769 Sample value of CurrentChannel at CurrentTime.
xue@0 770
xue@0 771 CurrentSampleInPixel
xue@0 772 The display Y-coordinate corresponding to CurrentSample16.
xue@0 773
xue@0 774 CurrentTime
xue@0 775 Reading on time axis at the mouse pointer.
xue@0 776
xue@0 777 CurrentX
xue@0 778 X-coordinate of mouse pointer.
xue@0 779
xue@0 780 CurrentY
xue@0 781 Y-coordinate of mouse pointer.
xue@0 782
xue@0 783 CursorColorBright
xue@0 784 Colour used to draw ruler cursor in on dim background.
xue@0 785
xue@0 786 CursorColorDim
xue@0 787 Colour used to draw ruler cursor in on bright background.
xue@0 788
xue@0 789 Data[ch], Data8[ch], Data16[ch], Data24[ch]
xue@0 790 Data buffer of channel ch in void*, __int8*, __int16* and __pint24.
xue@0 791
xue@0 792 DefaultPropertyItems
xue@0 793 Set to show default list of properties when Properties menu item from the
xue@0 794 default popup menu is invoked.
xue@0 795
xue@0 796 EndDigiFreq and StartDigiFreq
xue@0 797 Upper and lower bounds of the currently displayed frequency range (1=sampling
xue@0 798 frequency). Write these properties to change the display range and trigger
xue@0 799 an OnPageChange event.
xue@0 800
xue@0 801 EndPos and StartPos
xue@0 802 End and starting positions of currently displayed duration, in samples.
xue@0 803 Write these properties to change the display range and trigger an OnPageChange
xue@0 804 event.
xue@0 805
xue@0 806 ExtractMode
xue@0 807 Specifies the type of zooming (time, frequency, time and frequency) to
xue@0 808 perform when zoom-to-selection operation is invoked.
xue@0 809
xue@0 810 ForceHamming
xue@0 811 Set to force Hamming windowing for audio playback via playback filter.
xue@0 812
xue@0 813 InfoColor0, InfoColor1, InfoColor2
xue@0 814 Colours used to draw the internal (info) tags if ShowInfo is set.
xue@0 815
xue@0 816 LastX, LastY
xue@0 817 The X and Y coordinates recorded at the last mouse down, move and up event.
xue@0 818 They are identical to X and Y upon calling MouseMove() and MoveUp(), and
xue@0 819 after calling MouseDown().
xue@0 820
xue@0 821 Length
xue@0 822 Length of the audio content the WaveView currently holds, in samples.
xue@0 823
xue@0 824 OpMode
xue@0 825 The current operation mode (idle, dragging, selecting, reselecting, or other
xue@0 826 user-defined modes).
xue@0 827
xue@0 828 Ph[ch][fr]
xue@0 829 Phase spectrum of channel ch and frame fr.
xue@0 830
xue@0 831 Playing
xue@0 832 Set if playback is in progress, cleared if not.
xue@0 833
xue@0 834 PlayNoteInSemitone
xue@0 835 Set to adjust note playback using wvtPlayNote tool to pitch at the nearst
xue@0 836 well-tempered semitone (A4=440Hz) from CurrentDigiFreq.
xue@0 837
xue@0 838 RulerAlignX, RulerAlignY
xue@0 839 Alignments of X and Y axes.
xue@0 840
xue@0 841 RulerUnitAmp
xue@0 842 Display unit for amplitude axis. 0=relative(-1 to +1), 1=absolute.
xue@0 843
xue@0 844 RulerUnitFreq
xue@0 845 Display unit for frequency axis. 0=hz, 1=bin (when using linear frequency
xue@0 846 scale) or semitones (when using log frequency scale).
xue@0 847
xue@0 848 RulerUnitTime
xue@0 849 Display unit for time axis. 0=samples, 1=seconds.
xue@0 850
xue@0 851 SectionEndPos, SectionStartPos
xue@0 852 End and starting points of the playback duration.
xue@0 853
xue@0 854 Selections
xue@0 855 Current time-frequency selections.
xue@0 856
xue@0 857 SelectMode
xue@0 858 Specifies mode (time, frequency or time-and-frequency) for normal selections.
xue@0 859
xue@0 860 ShowCursotText
xue@0 861 Set to display cursor text.
xue@0 862
xue@0 863 ShowInfo
xue@0 864 Set to display basic info tags (number of channels, sampling rate, bytes
xue@0 865 per sample, duration, display range).
xue@0 866
xue@0 867 ShowPaneInfo
xue@0 868 Set to display pane info.
xue@0 869
xue@0 870 Spec[ch][fr]
xue@0 871 Complex spectrum of channel ch at frame fr.
xue@0 872
xue@0 873 SpecAmp
xue@0 874 Spectral display amplification, for adjusting the spectrogram brightness.
xue@0 875
xue@0 876 SpecOffst
xue@0 877 Time offst between ajcent frame centres.
xue@0 878
xue@0 879 SpecRes
xue@0 880 Window size for spectrogram computation.
xue@0 881
xue@0 882 Spectrogram[ch]
xue@0 883 Spectrogram of channal ch.
xue@0 884
xue@0 885 SpecWindowParamD[], SpecWindowType
xue@0 886 Window type and optional parameter list of window function.
xue@0 887
xue@0 888 StartPane
xue@0 889 Index to display pane in which a mouse key was last pressed down in the WaveView.
xue@0 890
xue@0 891 StartSel
xue@0 892 Reading of time axis the last time a mouse key was pressed down in the WaveView.
xue@0 893
xue@0 894 StartSelX, StartSelY
xue@0 895 X and Y coordinates that last time a mouse key was pressed down in the WaveView.
xue@0 896
xue@0 897 StereoMode
xue@0 898 Stereo playback mode (normal, swap-channel, left channel or right channel).
xue@0 899
xue@0 900 YZoomRate
xue@0 901 Amplitude display amplification.
xue@0 902
xue@0 903
xue@0 904 Public variables
xue@0 905
xue@0 906 PBPR
xue@0 907 Playbuffer pointer. Position from which to load the next playback buffer.
xue@0 908
xue@0 909 DisableMouseWheelZoom
xue@0 910 Set to disable time and frequency zooming by mouse wheeling.
xue@0 911
xue@0 912 maxv_specamp
xue@0 913 Product of the maximal spectal amplitude in current display range and SpecAmp.
xue@0 914 This is kept constant if AutoSpecAmp is set.
xue@0 915
xue@0 916 FSpectrogram[WV2_MAX_CHANNEL]
xue@0 917 Spectrograms of the channels.
xue@0 918
xue@0 919 FPanes
xue@0 920 List of display panes.
xue@0 921
xue@0 922 FObjects
xue@0 923 List of WaveView objects.
xue@0 924
xue@0 925 InfoRectCount, InfoRect[]
xue@0 926 Number of info tags, their display areas
xue@0 927
xue@0 928 InfoRectAtPointer
xue@0 929 Index to the info tag at mouse pointer.
xue@0 930
xue@0 931 ObjectAtPointer
xue@0 932 Pointer to WaveView object at mouse pointer.
xue@0 933
xue@0 934 StartObject
xue@0 935 If a mouse key is pressed down with the mouse pointer at a WaveView object
xue@0 936 whose OnMouseDown event is set, then StartObject is set to that object
xue@0 937 and cleared after the next MouseUp event.
xue@0 938
xue@0 939 DefaultRulerSetting[4]
xue@0 940 Default settings for drawing the axes.
xue@0 941
xue@0 942 DefaultPaneInfoFont
xue@0 943 Default font for displaying pane info.
xue@0 944
xue@0 945 DefaultInfoFont
xue@0 946 Default font for displaying info tags.
xue@0 947
xue@0 948 InfoLeft, InfoTop
xue@0 949 Top-left coordinates to draw info tags.
xue@0 950
xue@0 951 AutoScroll
xue@0 952 Set to enable automatic scrolling when playback proceeds beyond current
xue@0 953 display range, clear to disable it.
xue@0 954
xue@0 955 ForceOLA
xue@0 956 When filling the playback buffers, WaveView chooses whether or not using
xue@0 957 overlap-add of adjacent frames according to the playback filter. If ForceOLA
xue@0 958 is set then overlap-add is unconditionally enforced the next time a block
xue@0 959 buffer is filled.
xue@0 960
xue@0 961 LoopPlay
xue@0 962 Set to enable looped playback, clear to disable it.
xue@0 963
xue@0 964 LoopMode
xue@0 965 Specifies the loop range in looped playback. 0=no looping, 1=looping the
xue@0 966 current display range, 2=looping the current active selection.
xue@0 967
xue@0 968 Basic0[WV2_MAX_CHANNEL], Basic1[WV2_MAX_CHANNEL]
xue@0 969 Internal bitmaps for storing the raw waveform and spectrogram images.
xue@0 970
xue@0 971
xue@0 972 Public Methods
xue@0 973
xue@0 974 TWaveView, ~TWaveView()
xue@0 975 Default constructor and destructor.
xue@0 976
xue@0 977 CheckWaveOutDevCaps
xue@0 978 Checks if WaveOut device is ready and enable/disable playback menu accordingly.
xue@0 979
xue@0 980 ClearSelections
xue@0 981 Empty current list of time-frequency selections.
xue@0 982
xue@0 983 ClearSpectrogram, ClearSpectrograms
xue@0 984 Free buffered spectrogram data.
xue@0 985
xue@0 986 CreatePanes(X, Y)
xue@0 987 Creates X columns times Y rows of display panes.
xue@0 988
xue@0 989 DefaultShowProperty
xue@0 990 Display a message box to show basic properties of the audio content.
xue@0 991
xue@0 992 DoExtract, UndoExtract
xue@0 993 Zoom-to-selction operation, undo the last zoom-to-selectino operation.
xue@0 994
xue@0 995 DrawBitmap(Sender)
xue@0 996 Draws a bitmap (TBitmap*)Sender in the WaveView.
xue@0 997
xue@0 998 DrawCaption
xue@0 999 Draws a caption on the top-right of the WaveView.
xue@0 1000
xue@0 1001 DrawCursor(PaneIndex, X, Y)
xue@0 1002 Draws the mouse cursors in display pane PaneIndex given pointer coordinates.
xue@0 1003
xue@0 1004 DrawInfo
xue@0 1005 Draws info tags and update their active areas.
xue@0 1006
xue@0 1007 DrawPane
xue@0 1008 Draws a display pane.
xue@0 1009
xue@0 1010 DrawPaneInfo
xue@0 1011 Draws the pane info.
xue@0 1012
xue@0 1013 DrawPanes
xue@0 1014 Draws display panes.
xue@0 1015
xue@0 1016 DrawPitchScale
xue@0 1017 Draws a set of harmonic frequency marks aligned to the current mouse pointer.
xue@0 1018
xue@0 1019 DrawPlaybackCursor
xue@0 1020 Draws the playback cursor which marks the current playback position.
xue@0 1021
xue@0 1022 DrawSelection, DrawSelections
xue@0 1023 Draw the current time-frequency selections.
xue@0 1024
xue@0 1025 DrawSemitones
xue@0 1026 Draws a set of frequency grids marking whole well-tempered semitones.
xue@0 1027
xue@0 1028 DrawSpectrogramX
xue@0 1029 Draws the spectrogram.
xue@0 1030
xue@0 1031 DrawWaveForm
xue@0 1032 Draws the waveform.
xue@0 1033
xue@0 1034 ExtDataChange
xue@0 1035 Invoked to notify a change to the data buffer committed by the caller so
xue@0 1036 that WaveView can update its display.
xue@0 1037
xue@0 1038 FocusSelection
xue@0 1039 Puts the focus to a specific selection in multiple selection mode.
xue@0 1040
xue@0 1041 FreeData
xue@0 1042 Frees internal waveform audio buffer(s).
xue@0 1043
xue@0 1044 FreeInternalBitmaps
xue@0 1045 Frees Basic0[] and Basic1[] which stores raw waveform and spectrogram images.
xue@0 1046
xue@0 1047 FreeSpectrograms
xue@0 1048 Frees internal spectrogram buffers (unlike ClearSpectrogram, which frees
xue@0 1049 buffer data held in the buffers).
xue@0 1050
xue@0 1051 FromAmplitudeToPixel, FromPixelToAmplitude, FromDigiFreqToPixel,
xue@0 1052 FromPixelToDigiFreq, FromPixelToSample, FromSampleToPixel
xue@0 1053 Conversion routines between screen coordinates and time-amplitude locations
xue@0 1054 on the displayed waveform of time-frequency locations of the spectrogram.
xue@0 1055
xue@0 1056 GetFMask
xue@0 1057 Obtain the frequency mask at certain time (snapshot of CurrentSelections).
xue@0 1058
xue@0 1059 GetObjectAtPointer
xue@0 1060 Obtain the object at given coordinates and set ObjectToPointer variable.
xue@0 1061
xue@0 1062 GetOpMode
xue@0 1063 Obtain OpMode given specific keyboard and mouse status and set OpMode property.
xue@0 1064
xue@0 1065 InvalidateBasic, InvalidateBasics
xue@0 1066 Discard stored raw waveform and/or spectrogram images.
xue@0 1067
xue@0 1068 ItemExtractClick, ItemPlayClick, ItemPropertyClick,
xue@0 1069 ItemXZoomClick, ItemYZoomClick
xue@0 1070 Calling these methods do the same as clicking on the dufault popupmenu items
xue@0 1071 excpet for the Sender argument. The Sender argument has its importance in
xue@0 1072 ItemXZoomClick and ItemYZoomClick methods. If user wishes to use his own
xue@0 1073 popupmenu, it is recommended to assign these methods to the menu. Before
xue@0 1074 assigning ItemXZoomClick and ItemYZoomClick, be sure to fill the Tag property
xue@0 1075 of the Sender. Valid Tag values are: ITEMXZOOMIN_TAG(11), ITEMXZOOMOUT_TAG(12),
xue@0 1076 ITEMXZOOMRESTORE_TAG(13), ITEMYZOOMIN_TAG(14), and ITEMYZOOMRESTORE_TAG(15).
xue@0 1077
xue@0 1078 PausePlayback, StartPlayback
xue@0 1079 Stops and starts audio playback.
xue@0 1080
xue@0 1081 Post
xue@0 1082 Sends local waveform data to the associated WaveAudio object.
xue@0 1083
xue@0 1084 RemoveSelection
xue@0 1085 Removes a time-frequency selection.
xue@0 1086
xue@0 1087 Retrieve
xue@0 1088 Read waveform data from the associated WaveAudio object into local buffer.
xue@0 1089
xue@0 1090 SelectionAtPos
xue@0 1091 Returns index to the time-frequency selection at specified time and frequency.
xue@0 1092
xue@0 1093 SetArea
xue@0 1094 Sets the four variables specifying the display range in one command.
xue@0 1095
xue@0 1096 SetContent
xue@0 1097 Specifies what to display in each display pane.
xue@0 1098
xue@0 1099 SetCursorTF
xue@0 1100 Sends mouse pointer to the position corresponding to given time and frequency.
xue@0 1101
xue@0 1102 SetRulers
xue@0 1103 Specifies what axes to display in each display pane.
xue@0 1104
xue@0 1105 SetRulerUnit
xue@0 1106 Specifies the unit used for displaying each axes.
xue@0 1107
xue@0 1108 SetSelection
xue@0 1109 Make a new time-frequency selection.
xue@0 1110
xue@0 1111 SetStartAndEndDigiFreq, SetStartAndEndPos
xue@0 1112 Sets the frequency/time range of display.
xue@0 1113
xue@0 1114 SetYScale
xue@0 1115 Sets the display amplification of waveform amplitude.
xue@0 1116
xue@0 1117 StartDrag
xue@0 1118 Simulates the start of a mouse dragging operation at specified coordinates.
xue@0 1119
xue@0 1120 TFFilter
xue@0 1121 Applies time-frequency filtering using a binary mask specified by CurrentSelections.
xue@0 1122
xue@0 1123 UpdateScrollBar
xue@0 1124 Updates the associated scrollbar.
xue@0 1125
xue@0 1126 Zoom, ZoomF, ZoomY
xue@0 1127 Time/magnitude/frequeny zooming operations.
xue@0 1128
xue@0 1129
xue@0 1130 Events
xue@0 1131
xue@0 1132 CustomCursorText
xue@0 1133 Triggered before drawing cursor texts for the user to fill in customized texts.
xue@0 1134
xue@0 1135 CustomItemExtractClick
xue@0 1136 Customized handler of the Extract menu item of the default popup menu.
xue@0 1137
xue@0 1138 CustomInfo
xue@0 1139 Triggered before drawing into tags for the user to fill in customized texts.
xue@0 1140
xue@0 1141 CustompaneInfo
xue@0 1142 Triggered before drawing pane into for the user to fill in customized texts.
xue@0 1143
xue@0 1144 CustomProperty
xue@0 1145 Customized handler of the Properties menu item of the default popup menu.
xue@0 1146
xue@0 1147 CustomXZoomClick, CustomYZoomClick
xue@0 1148 Customized handlers of the XZoom and YZoom menu items of the default popum menu.
xue@0 1149
xue@0 1150 OnCustomPaint
xue@0 1151 Customized painting routine of the WaveView.
xue@0 1152
xue@0 1153 OnGetPlaybackStartAndEndPos
xue@0 1154 Triggered before starting playback to allow user decide what duration to play.
xue@0 1155
xue@0 1156 OnGetOpMode
xue@0 1157 Triggered when querying operation mode to allow non-default mode settings and
xue@0 1158 user-defined modes.
xue@0 1159
xue@0 1160 OnInfoDblClick
xue@0 1161 Triggered when a info tag is double-clicked.
xue@0 1162
xue@0 1163 OnResize (inherited)
xue@0 1164 OnKeyDown (inherited)
xue@0 1165 OnKeyPress (inherited)
xue@0 1166 OnKeyUp (inherited)
xue@0 1167 OnDblClick (inherited)
xue@0 1168 OnMouseDown (inherited)
xue@0 1169 OnMousemove (inherited)
xue@0 1170 OnMouseUp (inherited)
xue@0 1171 OnMouseWheel (inherited)
xue@0 1172
xue@0 1173 OnMouseLocalData
xue@0 1174 Triggered when moving mouse pointer inside display pane, supplying the caller
xue@0 1175 with the time at mouse pointer and data buffers near the time.
xue@0 1176
xue@0 1177 OnMousePointer
xue@0 1178 Triggered when pressing left mouse key and when moving mouse pointer with
xue@0 1179 left mouse key down.
xue@0 1180
xue@0 1181 BeforePlayback
xue@0 1182 Triggered before playback starts.
xue@0 1183
xue@0 1184 OnPageChange
xue@0 1185 Triggered when the display duration is changed.
xue@0 1186
xue@0 1187 OnPaint
xue@0 1188 Triggered after painting the WaveView.
xue@0 1189
xue@0 1190 OnPlaybackDone
xue@0 1191 Triggered when playback finishes.
xue@0 1192
xue@0 1193 OnPlaybackStart
xue@0 1194 Triggered when playback starts.
xue@0 1195
xue@0 1196 OnSelectedChange
xue@0 1197 Triggered when the selection focus switches.
xue@0 1198
xue@0 1199 OnScaleChange
xue@0 1200 Triggered when YZoomRate changes.
xue@0 1201
xue@0 1202 Current version Wen Xue 2011/7
xue@0 1203 First version Wen Xue 2003/3
xue@0 1204 */
xue@0 1205 class PACKAGE TWaveView : public TCustomControl
xue@0 1206 {
xue@0 1207 friend void FeedFFTBuffers(int Id, cdouble* &w, cdouble* &x, double* &win, int* &hbi, void* Parent);
xue@0 1208 friend void TFFilter(TWaveView*, int, TWaveViewSelections*, bool, bool);
xue@0 1209 private:
xue@0 1210 TWaveAudio* FWaveAudio;
xue@0 1211 TDataAudio* FSection;
xue@0 1212 TWaveViewSelections* FSelections;
xue@0 1213
xue@0 1214 TPopupMenu* FMenu;
xue@0 1215 TScrollBar* FScrollBar;
xue@0 1216
xue@0 1217 TNotifyEvent FBeforePlayback;
xue@0 1218 TNotifyEvent FCustomItemExtractClick;
xue@0 1219 TNotifyEvent FCustomXZoomClick;
xue@0 1220 TNotifyEvent FCustomYZoomClick;
xue@0 1221 TNotifyEvent FOnInfoDblClick;
xue@0 1222 TNotifyEvent FOnPageChange;
xue@0 1223 TNotifyEvent FOnPaint;
xue@0 1224 TNotifyEvent FOnPlaybackDone;
xue@0 1225 TNotifyEvent FOnPlaybackStart;
xue@0 1226 TNotifyEvent FOnScaleChange;
xue@0 1227 TNotifyEvent FOnSelectedChange;
xue@0 1228
xue@0 1229 TWaveViewGetIntervalEvent FOnGetPlaybackStartAndEndPos;
xue@0 1230 TWaveViewGetOpModeEvent FOnGetOpMode;
xue@0 1231 TWaveViewMouseLocalDataEvent FOnMouseLocalData;
xue@0 1232 TWaveViewMousePointerEvent FOnMousePointer;
xue@0 1233
xue@0 1234 TWaveViewCustomInfoEvent FCustomCursorText;
xue@0 1235 TWaveViewCustomPaintEvent FOnCustomPaint;
xue@0 1236 TWaveViewCustomInfoEvent FCustomPaneInfo;
xue@0 1237 TWaveViewCustomInfoEvent FCustomInfo;
xue@0 1238 TWaveViewCustomPropertyEvent FCustomProperty;
xue@0 1239 TWaveViewSelHitTest FSelHitTest;
xue@0 1240
xue@0 1241 TColor FAxisColor;
xue@0 1242 TColor FBackColor;
xue@0 1243 TColor FCursorColorDim;
xue@0 1244 TColor FCursorColorBright;
xue@0 1245 TColor FInfoColor0;
xue@0 1246 TColor FInfoColor1;
xue@0 1247 TColor FInfoColor2;
xue@0 1248 TColor FWaveBackColor;
xue@0 1249 TColor FWaveColor; TColor FWaveColor2;
xue@0 1250 TColor FSelectedAreaColorX;
xue@0 1251 TColor FSelectedFrameColorX;
xue@0 1252 TColor FSelectingFrameColorX;
xue@0 1253
xue@0 1254 AnsiString FCaption;
xue@0 1255
xue@0 1256 TAlign FRulerAlignX;
xue@0 1257 TAlign FRulerAlignY;
xue@0 1258
xue@0 1259 #define WV2_FONT_NUMBER 6
xue@0 1260 TFont* FFonts[WV2_FONT_NUMBER];
xue@0 1261
xue@0 1262 bool FAutoCaption;
xue@0 1263 bool FAutoExtractMode;
xue@0 1264 bool FAutoSpecAmp;
xue@0 1265 bool FClickFocus;
xue@0 1266 bool FDefaultPopupMenu;
xue@0 1267 bool FDefaultPropertyItems;
xue@0 1268 bool FForceHamming;
xue@0 1269 bool FLocalDataOn;
xue@0 1270 bool FMultiSelect;
xue@0 1271 bool FPlayNoteInSemitone;
xue@0 1272 bool FProgressCursor;
xue@0 1273
xue@0 1274 bool FShowCursor;
xue@0 1275 bool FShowCursorText;
xue@0 1276 bool FShowInfo;
xue@0 1277 bool FShowPaneInfo;
xue@0 1278 bool FLocalDataTimeGrid;
xue@0 1279
xue@0 1280 double FCurrentDigiFreq1;
xue@0 1281 double FCurrentDigiFreq2;
xue@0 1282 double FCurrentTime1;
xue@0 1283 double FCurrentTime2;
xue@0 1284 double FSpecAmp;
xue@0 1285 double FEndDigiFreq;
xue@0 1286 double FStartDigiFreq;
xue@0 1287 double FVStartSel;
xue@0 1288 double FVStartSelR;
xue@0 1289 double FYZoomRate;
xue@0 1290 double prevk;
xue@0 1291 TWaveViewSelHitTest FStartSelHitTest;
xue@0 1292
xue@0 1293 double* PlayBuffer0;
xue@0 1294 double* PlayBuffer1;
xue@0 1295 int PBPA;
xue@0 1296 int PBPW;
xue@0 1297
xue@0 1298 int FBlockSize;
xue@0 1299 int FBytesPerSample;
xue@0 1300 int FCalculateFrameCount;
xue@0 1301 int FChannels;
xue@0 1302 int FCurrentPane;
xue@0 1303 int FEndPos;
xue@0 1304 int FExtractMode;
xue@0 1305 int FLength;
xue@0 1306 int FOpMode;
xue@0 1307 int FPitchScalePart;
xue@0 1308 int FRulerUnitAmp;
xue@0 1309 int FRulerUnitFreq;
xue@0 1310 int FRulerUnitTime;
xue@0 1311 int FSamplesPerSec;
xue@0 1312 int FSectionBlocks;
xue@0 1313 int FSectionProgress;
xue@0 1314 int FSectionStartPos;
xue@0 1315 int FSectionEndPos;
xue@0 1316 int FSelectionBorderWidth;
xue@0 1317 int FSelectMode;
xue@0 1318 int FSpecOffst;
xue@0 1319 int FSpecRes;
xue@0 1320 int FStartPane;
xue@0 1321 int FStartPos;
xue@0 1322 int FStartSel;
xue@0 1323 int FStartSelR;
xue@0 1324 int FStartSelX;
xue@0 1325 int FStartSelY;
xue@0 1326 TWaveViewSelection FStartSelSel;
xue@0 1327 TWaveViewStereoMode FStereoMode;
xue@0 1328
xue@0 1329 int FLastFocus;
xue@0 1330 int FX;
xue@0 1331 int FY;
xue@0 1332 TShiftState FLastShiftState;
xue@0 1333 int FLastX;
xue@0 1334 int FLastY;
xue@0 1335
xue@0 1336
xue@0 1337 int FX1;
xue@0 1338 int FX2;
xue@0 1339
xue@0 1340 //FFT Buffers
xue@0 1341 cdouble* fw;
xue@0 1342 cdouble* fx;
xue@0 1343 //playback windows
xue@0 1344 double* fw1;
xue@0 1345 double* fw2;
xue@0 1346 double* ifw1;
xue@0 1347 double* fw2_fw1;
xue@0 1348 //analysis window function
xue@0 1349 double* fwin;
xue@0 1350 double* famp;
xue@0 1351 double* loopframe0;
xue@0 1352 double* loopframe1;
xue@0 1353 int* fhbi;
xue@0 1354
xue@0 1355 void* FData[WV2_MAX_CHANNEL];
xue@0 1356
xue@0 1357 WindowType FSpecWindowType;
xue@0 1358 double FSpecWindowParamD[5];
xue@0 1359 int FSpecWindowParamI[5];
xue@0 1360
xue@0 1361 TWaveViewPlaybackFilter FPlaybackFilter;
xue@0 1362 TWaveViewTools FTools;
xue@0 1363
xue@0 1364 public:
xue@0 1365 int PBPR;
xue@0 1366 bool DisableMouseWheelZoom;
xue@0 1367 double maxv_specamp;
xue@0 1368
xue@0 1369 TQuickSpectrogram* FSpectrogram[WV2_MAX_CHANNEL];
xue@0 1370 TWaveViewPanes FPanes;
xue@0 1371 TWaveViewObjects FObjects;
xue@0 1372 #define WV2_INFORECTCOUNT 10
xue@0 1373 int InfoRectCount;
xue@0 1374 int InfoRectAtPointer;
xue@0 1375 TRect InfoRect[WV2_INFORECTCOUNT];
xue@0 1376 TWaveViewObject* ObjectAtPointer;
xue@0 1377 TWaveViewObject* StartObject;
xue@0 1378
xue@0 1379 TMenuItem* ItemExtract;
xue@0 1380 TMenuItem* ItemPlay;
xue@0 1381 TMenuItem* ItemProperty;
xue@0 1382 TMenuItem* ItemSeparator1;
xue@0 1383 TMenuItem* ItemSeparator2;
xue@0 1384 TMenuItem* ItemXZoomRestore;
xue@0 1385 TMenuItem* ItemYZoomRestore;
xue@0 1386
xue@0 1387 TWaveViewSelection UndoExtractSelection;
xue@0 1388
xue@0 1389 TWaveViewRulerSetting DefaultRulerSetting[4];
xue@0 1390 TFont* DefaultPaneInfoFont;
xue@0 1391 TFont* DefaultInfoFont;
xue@0 1392
xue@0 1393 int TimeStamp1;
xue@0 1394 int TimeStamp2;
xue@0 1395 int InfoLeft;
xue@0 1396 int InfoTop;
xue@0 1397 bool AutoScroll;
xue@0 1398 bool ForceOLA;
xue@0 1399 bool LoopPlay;
xue@0 1400 int LoopMode;
xue@0 1401
xue@0 1402 Graphics::TBitmap* Basic0[WV2_MAX_CHANNEL];
xue@0 1403 struct sBasic0Settings {int X; int Y; int Start; int End; double YZR;
xue@0 1404 bool __fastcall operator!=(const sBasic0Settings& BS){return X!=BS.X || Y!=BS.Y || Start!=BS.Start || End!=BS.End || YZR!=BS.YZR;}
xue@0 1405 } Basic0Settings[WV2_MAX_CHANNEL];
xue@0 1406 Graphics::TBitmap* Basic1[WV2_MAX_CHANNEL];
xue@0 1407 struct sBasic1Settings {int X; int Y; TWaveViewSelection Sel; double amp; int yscale; int specstyle;
xue@0 1408 bool __fastcall operator!=(const sBasic1Settings& BS){return X!=BS.X || Y!=BS.Y || Sel!=BS.Sel || amp!=BS.amp || yscale!=BS.yscale || specstyle!=BS.specstyle;}
xue@0 1409 } Basic1Settings[WV2_MAX_CHANNEL];
xue@0 1410
xue@0 1411 private:
xue@0 1412 int CalculateSpectrogramX(int channel, double* xx, int dX, bool interpolate);
xue@0 1413 TCursor __fastcall ControlCursorAtPos(int X, int Y);
xue@0 1414 int __fastcall FillBlock(void* Block);
xue@0 1415 void __fastcall FMenuPopup(TObject*);
xue@0 1416 QSPEC_FORMAT __fastcall SampleSpectrogramX(int channel, Graphics::TBitmap* ABmp, double* xx, double* yy, int dX, int dY, double amp, bool interpolate);
xue@0 1417 QSPEC_FORMAT __fastcall SamplePeakSpectrogramX(int yscale, int channel, double AStartDigiFreq, double AnEndDigiFreq, Graphics::TBitmap* ABmp, double* xx, int dX, int dY, double amp);
xue@0 1418 QSPEC_FORMAT __fastcall SampleSinuSpectrogramX(int yscale, int channel, double AStartDigiFreq, double AnEndDigiFreq, Graphics::TBitmap* ABmp, double* xx, int dX, int dY, double amp);
xue@0 1419 TWaveViewSelHitTest __fastcall SelHitTest(int X, int Y);
xue@0 1420 void __fastcall SetAutomaticSpecAmp(int channel, double* xx, double AStartDigiFreq, double AnEndDigiFreq, int dX, int dY);
xue@0 1421
xue@0 1422 protected:
xue@0 1423 DYNAMIC void __fastcall Click(void);
xue@0 1424 DYNAMIC void __fastcall DblClick(void);
xue@0 1425 virtual QSPEC_FORMAT* __fastcall GetA(int Channel, int fr);
xue@0 1426 virtual double __fastcall GetCurrentAmplitude();
xue@0 1427 virtual int __fastcall GetCurrentChannel();
xue@0 1428 virtual double __fastcall GetCurrentDigiFreq();
xue@0 1429 virtual __int16 __fastcall GetCurrentSample16();
xue@0 1430 virtual int __fastcall GetCurrentSampleInPixel();
xue@0 1431 virtual int __fastcall GetCurrentTimeEx();
xue@0 1432 virtual TWaveViewSelection __fastcall GetCurrentRange();
xue@0 1433 virtual void* __fastcall GetData(int Channel);
xue@0 1434 virtual __int16* __fastcall GetData16(int Channel);
xue@0 1435 virtual __pint24 __fastcall GetData24(int Channel);
xue@0 1436 virtual char* __fastcall GetData8(int Channel);
xue@0 1437 virtual QSPEC_FORMAT* __fastcall GetPh(int Channel, int fr);
xue@0 1438 virtual cmplx<QSPEC_FORMAT>* __fastcall GetSpec(int Channel, int fr);
xue@0 1439 virtual TQuickSpectrogram* __fastcall GetSpectrogram(int Channel);
xue@0 1440 virtual double __fastcall GetSpecWindowParamD(int Index);
xue@0 1441 DYNAMIC void __fastcall KeyDown(Word &Key, TShiftState Shift);
xue@0 1442 DYNAMIC void __fastcall KeyUp(Word &Key, TShiftState Shift);
xue@0 1443 DYNAMIC void __fastcall MouseCursor(TShiftState Shift, int X, int Y);
xue@0 1444 DYNAMIC void __fastcall MouseDown(TMouseButton Button, TShiftState Shift, int X, int Y);
xue@0 1445 DYNAMIC void __fastcall MouseLocalData(int X, int Y, int Down);
xue@0 1446 DYNAMIC void __fastcall MouseMove(TShiftState Shift, int X, int Y);
xue@0 1447 DYNAMIC void __fastcall MousePointer(TShiftState Shift, int X, int Y);
xue@0 1448 DYNAMIC void __fastcall MouseUp(TMouseButton Button, TShiftState Shift, int X, int Y);
xue@0 1449 DYNAMIC void __fastcall MouseWheelHandler(TMessage& Msg);
xue@0 1450 virtual void __fastcall Paint();
xue@0 1451 DYNAMIC void __fastcall Resize();
xue@0 1452
xue@0 1453 virtual void __fastcall PageChange(bool updatescrollbar=true);
xue@0 1454
xue@0 1455 virtual void __fastcall ScrollBarChange(TObject* Sender);
xue@0 1456
xue@0 1457 virtual void __fastcall SetAutoExtractMode(bool AnAutoExtractMode);
xue@0 1458 virtual void __fastcall SetAutoSpecAmp(bool AnAutoSpecAmp);
xue@0 1459 virtual void __fastcall SetAxisColor(TColor AnAxisColor);
xue@0 1460 virtual void __fastcall SetBackColor(TColor ABackColor);
xue@0 1461 virtual void __fastcall SetCaption(AnsiString ACaption);
xue@0 1462 virtual void __fastcall SetClickFocus(bool AClickFocus);
xue@0 1463 virtual void __fastcall SetData(int index, void* AData);
xue@0 1464 virtual void __fastcall SetDefaultPopupMenu(bool ADefaultPopupMenu);
xue@0 1465 virtual void __fastcall SetEndPos(int AnEndPos);
xue@0 1466 virtual void __fastcall SetExtractMode(int AnExtractMode);
xue@0 1467 virtual void __fastcall SetForceHamming(bool AForceHamming);
xue@0 1468 virtual void __fastcall SetMultiSelect(bool AMultiSelect);
xue@0 1469 virtual void __fastcall SetPitchScalePart(int APart);
xue@0 1470 virtual void __fastcall SetPlaybackFilter(TWaveViewPlaybackFilter APlaybackFilter);
xue@0 1471 virtual void __fastcall SetSamplesPerSec(int ASamplesPerSec);
xue@0 1472 virtual void __fastcall SetScrollBar(TScrollBar* AScrollBar);
xue@0 1473 virtual void __fastcall SetSelectedAreaColorX(TColor ASelectedAreaColorX);
xue@0 1474 virtual void __fastcall SetSelectedFrameColorX(TColor ASelectedFrameColorX);
xue@0 1475 virtual void __fastcall SetSelectingFrameColorX(TColor ASelectingFrameColorX);
xue@0 1476 virtual void __fastcall SetSelectMode(int ASelectMode);
xue@0 1477 virtual void __fastcall SetSpecOffst(int ASpecOffst);
xue@0 1478 virtual void __fastcall SetSpecRes(int ASpecRes);
xue@0 1479 virtual void __fastcall SetSpecWindowParamD(int Index, double AParamD);
xue@0 1480 virtual void __fastcall SetSpecWindowType(WindowType ASpecWindowType);
xue@0 1481 virtual void __fastcall SetSpecAmp(double AnAmp);
xue@0 1482 virtual void __fastcall SetStartPos(int AStartPos);
xue@0 1483 virtual void __fastcall SetTools(TWaveViewTools ATools);
xue@0 1484 virtual void __fastcall SetWaveAudio(TWaveAudio* AWaveAudio);
xue@0 1485 virtual void __fastcall SetWaveBackColor(TColor AWaveBackColor);
xue@0 1486 virtual void __fastcall SetWaveColor(TColor AWaveColor);
xue@0 1487 virtual void __fastcall SetYZoomRate(double AYZoomRate);
xue@0 1488
xue@0 1489 virtual void __fastcall WaveViewAudioChange(TObject* Sender);
xue@0 1490 virtual void __fastcall WaveViewHitTest(int X, int Y);
xue@0 1491 virtual void __fastcall WaveViewSectionPlaybackDone(TObject* Sender);
xue@0 1492 virtual void __fastcall WaveViewSectionPlaybackProg(TObject* Sender, double Progress);
xue@0 1493
xue@0 1494 public:
xue@0 1495 __property Canvas;
xue@0 1496
xue@0 1497 __property TWaveViewSelection CurrentRange={read=GetCurrentRange};
xue@0 1498 __property TWaveViewSelections* Selections={read=FSelections, write=FSelections};
xue@0 1499
xue@0 1500 __property AnsiString AccessFCaption={read=FCaption, write=FCaption};
xue@0 1501 __property AnsiString Caption={read=FCaption, write=SetCaption};
xue@0 1502
xue@0 1503 __property int CalculateFrameCount={read=FCalculateFrameCount};
xue@0 1504
xue@0 1505 __property bool DefaultPropertyItems={read=FDefaultPropertyItems, write=FDefaultPropertyItems};
xue@0 1506 __property bool ForceHamming={read=FForceHamming, write=SetForceHamming};
xue@0 1507 __property bool Playing={read=GetPlaying};
xue@0 1508 __property bool PlayNoteInSemitone={read=FPlayNoteInSemitone, write=FPlayNoteInSemitone};
xue@0 1509 __property bool ShowInfo={read=FShowInfo, write=FShowInfo};
xue@0 1510 __property bool ShowPaneInfo={read=FShowPaneInfo, write=FShowPaneInfo};
xue@0 1511
xue@0 1512 __property void* Data[int Channel]={read=GetData, write=SetData};
xue@0 1513 __property __int16* Data16[int Channel]={read=GetData16};
xue@0 1514 __property __pint24 Data24[int Channel]={read=GetData24};
xue@0 1515 __property char* Data8[int Channel]={read=GetData8};
xue@0 1516
xue@0 1517 __property double CurrentAmplitude={read=GetCurrentAmplitude};
xue@0 1518 __property int CurrentChannel={read=GetCurrentChannel};
xue@0 1519 __property double CurrentDigiFreq={read=GetCurrentDigiFreq};
xue@0 1520 __property int CurrentPane={read=FCurrentPane};
xue@0 1521 __property __int16 CurrentSample16={read=GetCurrentSample16};
xue@0 1522 __property int CurrentSampleInPixel={read=GetCurrentSampleInPixel};
xue@0 1523 __property int CurrentTime={read=GetCurrentTimeEx};
xue@0 1524 __property int CurrentX={read=FX};
xue@0 1525 __property int CurrentY={read=FY};
xue@0 1526 __property double EndDigiFreq={read=FEndDigiFreq, write=FEndDigiFreq};
xue@0 1527 __property double SpecAmp={read=FSpecAmp, write=SetSpecAmp};
xue@0 1528 __property double StartDigiFreq={read=FStartDigiFreq, write=FStartDigiFreq};
xue@0 1529 __property double YZoomRate={read=FYZoomRate,write=SetYZoomRate};
xue@0 1530
xue@0 1531 __property QSPEC_FORMAT* A[int Channel][int fr]={read=GetA};
xue@0 1532 __property int BytesPerSample={read=FBytesPerSample};
xue@0 1533 __property int Channels={read=FChannels, write=FChannels};
xue@0 1534 __property int EndPos={read=FEndPos, write=SetEndPos};
xue@0 1535 __property int ExtractMode={read=FExtractMode, write=SetExtractMode};
xue@0 1536 __property int LastX={read=FLastX};
xue@0 1537 __property int LastY={read=FLastY};
xue@0 1538 __property int Length={read=FLength, write=FLength};
xue@0 1539 __property int OpMode={read=FOpMode};
xue@0 1540 __property QSPEC_FORMAT* Ph[int Channel][int fr]={read=GetPh};
xue@0 1541 __property TAlign RulerAlignX={read=FRulerAlignX, write=FRulerAlignX};
xue@0 1542 __property TAlign RulerAlignY={read=FRulerAlignY, write=FRulerAlignY};
xue@0 1543 __property int RulerUnitAmp={read=FRulerUnitAmp, write=FRulerUnitAmp};
xue@0 1544 __property int RulerUnitFreq={read=FRulerUnitFreq, write=FRulerUnitFreq};
xue@0 1545 __property int RulerUnitTime={read=FRulerUnitTime, write=FRulerUnitTime};
xue@0 1546 __property int SectionEndPos={read=FSectionEndPos, write=FSectionEndPos};
xue@0 1547 __property int SectionStartPos={read=FSectionStartPos, write=FSectionStartPos};
xue@0 1548 __property int SelectMode={read=FSelectMode, write=SetSelectMode};
xue@0 1549 __property bool ShowCursorText={read=FShowCursorText, write=FShowCursorText};
xue@0 1550 __property cmplx<QSPEC_FORMAT>* Spec[int Channel][int fr]={read=GetSpec};
xue@0 1551 __property TQuickSpectrogram* Spectrogram[int Channel]={read=GetSpectrogram};
xue@0 1552 __property int SpecOffst={read=FSpecOffst, write=SetSpecOffst};
xue@0 1553 __property int SpecRes={read=FSpecRes, write=SetSpecRes};
xue@0 1554 __property double SpecWindowParamD[int Index]={read=GetSpecWindowParamD, write=SetSpecWindowParamD};
xue@0 1555 __property int StartPane={read=FStartPane};
xue@0 1556 __property int StartPos={read=FStartPos, write=SetStartPos};
xue@0 1557 __property int StartSel={read=FStartSel};
xue@0 1558 __property int StartSelX={read=FStartSelX};
xue@0 1559 __property int StartSelY={read=FStartSelY};
xue@0 1560 __property TWaveViewStereoMode StereoMode={read=FStereoMode, write=FStereoMode};
xue@0 1561
xue@0 1562 __property TColor CursorColorBright={read=FCursorColorBright, write=FCursorColorBright};
xue@0 1563 __property TColor CursorColorDim={read=FCursorColorDim, write=FCursorColorDim};
xue@0 1564 __property TColor InfoColor0={read=FInfoColor0, write=FInfoColor0};
xue@0 1565 __property TColor InfoColor1={read=FInfoColor1, write=FInfoColor1};
xue@0 1566 __property TColor InfoColor2={read=FInfoColor2, write=FInfoColor2};
xue@0 1567
xue@0 1568 __property WindowType SpecWindowType={read=FSpecWindowType, write=SetSpecWindowType};
xue@0 1569
xue@0 1570
xue@0 1571 public:
xue@0 1572 __fastcall TWaveView(TComponent* Owner, bool usex=false, bool usep=false);
xue@0 1573 __fastcall ~TWaveView();
xue@0 1574
xue@0 1575 void ClearSpectrogram(int index);
xue@0 1576 void ClearSpectrograms();
xue@0 1577 void __fastcall DefaultShowProperty(bool selection);
xue@0 1578 virtual void __fastcall DoExtract(TObject* Sender);
xue@0 1579 virtual void __fastcall UndoExtract(TObject* Sender);
xue@0 1580
xue@0 1581 virtual void __fastcall ItemExtractClick(TObject* Sender);
xue@0 1582 virtual void __fastcall ItemPlayClick(TObject* Sender);
xue@0 1583 virtual void __fastcall ItemPropertyClick(TObject* Sender);
xue@0 1584 virtual void __fastcall ItemXZoomClick(TObject* Sender);
xue@0 1585 virtual void __fastcall ItemYZoomClick(TObject* Sender);
xue@0 1586
xue@0 1587 void __fastcall CheckWaveOutDevCaps(TObject* Sender);
xue@0 1588 void __fastcall ClearExtra(int AnExtra);
xue@0 1589 void __fastcall ClearSelections(TObject* Sender);
xue@0 1590 int __fastcall CreatePanes(int X, int Y);
xue@0 1591 void __fastcall DrawBitmap(TObject*);
xue@0 1592 void __fastcall DrawCaption(AnsiString ACaption);
xue@0 1593 void __fastcall DrawCursor(int PaneIndex, int X, int Y);
xue@0 1594 void __fastcall DrawInfo();
xue@0 1595 void __fastcall DrawPane(int Channel, int Type, int YScale, int Rulers, TCanvas* Canv, TRect& Rect);
xue@0 1596 void __fastcall DrawPaneInfo(int Channel, int Type, int YScale, TCanvas* Canv, TRect& Rect);
xue@0 1597 void __fastcall DrawPanes(int Type=-1);
xue@0 1598 void __fastcall DrawPitchScale(int Type, TCanvas* Canv, TRect& Rect, int yscale);
xue@0 1599 void __fastcall DrawPlaybackCursor(int Position, TCanvas* Canv, TRect& Rect, int PaneType);
xue@0 1600 void __fastcall DrawSelection(int Type, TCanvas* Canv, TRect& Rect, int yscale, int Index, TColor FrameColorX);
xue@0 1601 void __fastcall DrawSelections(int Type, TCanvas* Canv, TRect& Rect, int yscale);
xue@0 1602 void __fastcall DrawSemitones(int start, int end, TCanvas* Canv, TRect& Rect, int yscale);
xue@0 1603 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 1604 void __fastcall DrawWaveForm(int channel, TCanvas* ACanvas, TRect, int, int, double amp=1, bool basic=false);
xue@0 1605 void __fastcall ExtDataChange(TObject* Sender);
xue@0 1606 void __fastcall ExtDataChange(TObject* Sender, int Channel, int From, int To);
xue@0 1607 TRect __fastcall ExtraBounds(int AnExtra);
xue@0 1608 TRect __fastcall ExtraInvBounds(int AnExtra);
xue@0 1609 void __fastcall FocusSelection(int Index);
xue@0 1610 void __fastcall FreeData(int Count);
xue@0 1611 void __fastcall FreeInternalBitmaps(int Count);
xue@0 1612 void __fastcall FreeSpectrograms();
xue@0 1613 double __fastcall FromAmplitudeToPixel(int PaneIndex, double Amplitude);
xue@0 1614 double __fastcall FromPixelToAmplitude(int PaneIndex, double Y);
xue@0 1615 double __fastcall FromDigiFreqToPixel(int PaneIndex, double DigiFreq);
xue@0 1616 double __fastcall FromDigiFreqToPixel(double DigiFreq, double AStartDigiFreq, double AnEndDigiFreq, int Y1, int Y2, int YScale);
xue@0 1617 double __fastcall FromPixelToDigiFreq(int PaneIndex, double Y);
xue@0 1618 void __fastcall FromPixelToDigiFreq(int Scale, double* DigiFreq, int Count, double AStartDigiFreq, double AnEndDigiFreq);
xue@0 1619 double __fastcall FromPixelToSample(int PaneIndex, double X);
xue@0 1620 void __fastcall FromPixelToSample(double* Sample, int Count, int AStartPos, int AnEndPos);
xue@0 1621 double __fastcall FromPixelToSample(double X, int AStartPos, int AnEndPos, int X1, int X2);
xue@0 1622 double __fastcall FromSampleToPixel(int PaneIndex, double Pos);
xue@0 1623 double __fastcall FromSampleToPixel(double Pos, int X1, int X2);
xue@0 1624
xue@0 1625 double __fastcall GetFMask(double* mask, int t, TWaveViewPlaybackFilter Filter);
xue@0 1626 virtual void __fastcall GetObjectAtPointer(int X, int Y);
xue@0 1627 virtual void __fastcall GetOpMode(Word Key, TMouseButton Button, TShiftState Shift);
xue@0 1628 bool __fastcall GetPlaying();
xue@0 1629 bool __fastcall GetSpectroCalc(int startpos=-1, int endpos=-1, int Offst=-1, int Res=-1);
xue@0 1630 void __fastcall InvalidateBasic(int channel, int basic);
xue@0 1631 void __fastcall InvalidateBasics(int channel);
xue@0 1632 void __fastcall PausePlayback(TObject* Sender);
xue@0 1633 void __fastcall Post(int Mode=0);
xue@0 1634 void __fastcall RemoveSelection(int Index);
xue@0 1635 void __fastcall RePinExtra(int AnExtra);
xue@0 1636 void __fastcall Retrieve(int Mode=0, int from=0, int length=0);
xue@0 1637 int __fastcall SelectionAtPos(int Pos, double DigiFreq);
xue@0 1638 void __fastcall SetArea(int AStartPos, int AnEndPos, double AStartDigiFreq, double AnEndDigiFreq);
xue@0 1639 void __fastcall SetContent(int index, int channel, int type);
xue@0 1640 void __fastcall SetContent(int X, int Y, int channel, int type);
xue@0 1641 void __fastcall SetCursorTF(int PaneIndex, int t, double digif);
xue@0 1642 void __fastcall SetRulers(int PaneIndex, int Rulers);
xue@0 1643 void __fastcall SetRulerUnit(int ARulerUnitTime, int ARulerUnitFreq, int ARulerUnitAmp);
xue@0 1644 void __fastcall SetSelection(int Start, int End, double VStart, double VEnd);
xue@0 1645 void __fastcall SetStartAndEndDigiFreq(double AStartDigiFreq, double AnEndDigiFreq);
xue@0 1646 void __fastcall SetStartAndEndPos(int AStartPos, int AnEndPos);
xue@0 1647 void __fastcall SetYScale(int index, int yscale);
xue@0 1648 void StartDrag(int X, int Y);
xue@0 1649 void __fastcall StartPlayback(TObject* Sender);
xue@0 1650 void __fastcall TFFilter(int channel, bool pass, bool wholelength=false);
xue@0 1651 virtual void __fastcall UpdateScrollBar(TObject* Sender);
xue@0 1652 void __fastcall Zoom(int X, double Rate);
xue@0 1653 void __fastcall ZoomF(double Y, double Rate, int yscale);
xue@0 1654 void __fastcall ZoomY(double Rate);
xue@0 1655
xue@0 1656 __published:
xue@0 1657 __property Align;
xue@0 1658 __property Anchors;
xue@0 1659 __property bool AutoCaption={read=FAutoCaption, write=FAutoCaption};
xue@0 1660 __property bool AutoExtractMode={read=FAutoExtractMode, write=SetAutoExtractMode};
xue@0 1661 __property bool AutoSpecAmp={read=FAutoSpecAmp, write=SetAutoSpecAmp};
xue@0 1662 __property TColor AxisColor={read=FAxisColor,write=SetAxisColor};
xue@0 1663 __property TColor BackColor={read=FBackColor,write=SetBackColor};
xue@0 1664 __property bool ClickFocus={read=FClickFocus, write=SetClickFocus};
xue@0 1665 __property bool DefaultPopupMenu={read=FDefaultPopupMenu, write=SetDefaultPopupMenu, default=true};
xue@0 1666 __property DoubleBuffered;
xue@0 1667 __property bool MultiSelect={read=FMultiSelect, write=SetMultiSelect};
xue@0 1668 __property OnResize;
xue@0 1669 __property int PitchScalePart={read=FPitchScalePart, write=SetPitchScalePart};
xue@0 1670 __property TWaveViewPlaybackFilter PlaybackFilter={read=FPlaybackFilter, write=SetPlaybackFilter};
xue@0 1671 __property PopupMenu;
xue@0 1672 __property bool ProgressCursor={read=FProgressCursor, write=FProgressCursor, default=true};
xue@0 1673 __property int SamplesPerSec={read=FSamplesPerSec, write=SetSamplesPerSec};
xue@0 1674 __property TScrollBar* ScrollBar={read=FScrollBar,write=SetScrollBar};
xue@0 1675 __property TColor SelectedAreaColorX={read=FSelectedAreaColorX, write=SetSelectedAreaColorX};
xue@0 1676 __property TColor SelectedFrameColorX={read=FSelectedFrameColorX, write=SetSelectedFrameColorX};
xue@0 1677 __property TColor SelectingFrameColorX={read=FSelectingFrameColorX, write=SetSelectingFrameColorX};
xue@0 1678 __property int SelectionBorderWidth={read=FSelectionBorderWidth, write=FSelectionBorderWidth};
xue@0 1679 __property bool LocalDataTimeGrid={read=FLocalDataTimeGrid, write=FLocalDataTimeGrid, default=true};
xue@0 1680 __property TWaveViewTools Tools={read=FTools, write=SetTools};
xue@0 1681 __property Visible;
xue@0 1682 __property TWaveAudio* WaveAudio={read=FWaveAudio, write=SetWaveAudio};
xue@0 1683 __property TColor WaveBackColor={read=FWaveBackColor, write=SetWaveBackColor};
xue@0 1684 __property TColor WaveColor={read=FWaveColor,write=SetWaveColor};
xue@0 1685
xue@0 1686 __property TWaveViewCustomInfoEvent CustomCursorText={read=FCustomCursorText, write=FCustomCursorText};
xue@0 1687 __property TNotifyEvent CustomItemExtractClick={read=FCustomItemExtractClick, write=FCustomItemExtractClick};
xue@0 1688 __property TWaveViewCustomInfoEvent CustomInfo={read=FCustomInfo, write=FCustomInfo};
xue@0 1689 __property TWaveViewCustomInfoEvent CustomPaneInfo={read=FCustomPaneInfo, write=FCustomPaneInfo};
xue@0 1690 __property TWaveViewCustomPropertyEvent CustomProperty={read=FCustomProperty, write=FCustomProperty};
xue@0 1691 __property TNotifyEvent CustomXZoomClick={read=FCustomXZoomClick, write=FCustomXZoomClick};
xue@0 1692 __property TNotifyEvent CustomYZoomClick={read=FCustomYZoomClick, write=FCustomYZoomClick};
xue@0 1693 __property TWaveViewCustomPaintEvent OnCustomPaint={read=FOnCustomPaint, write=FOnCustomPaint};
xue@0 1694 __property TWaveViewGetIntervalEvent OnGetPlaybackStartAndEndPos={read=FOnGetPlaybackStartAndEndPos, write=FOnGetPlaybackStartAndEndPos};
xue@0 1695 __property TWaveViewGetOpModeEvent OnGetOpMode={read=FOnGetOpMode, write=FOnGetOpMode};
xue@0 1696 __property TNotifyEvent OnInfoDblClick={read=FOnInfoDblClick, write=FOnInfoDblClick};
xue@0 1697 __property OnKeyDown;
xue@0 1698 __property OnKeyPress;
xue@0 1699 __property OnKeyUp;
xue@0 1700 __property OnDblClick;
xue@0 1701 __property OnMouseDown;
xue@0 1702 __property OnMouseMove;
xue@0 1703 __property OnMouseWheel
xue@0 1704 ;
xue@0 1705 __property TWaveViewMouseLocalDataEvent OnMouseLocalData={read=FOnMouseLocalData, write=FOnMouseLocalData};
xue@0 1706 __property TWaveViewMousePointerEvent OnMousePointer={read=FOnMousePointer, write=FOnMousePointer};
xue@0 1707 __property OnMouseUp;
xue@0 1708 __property TNotifyEvent BeforePlayback={read=FBeforePlayback, write=FBeforePlayback};
xue@0 1709 __property TNotifyEvent OnPageChange={read=FOnPageChange,write=FOnPageChange};
xue@0 1710 __property TNotifyEvent OnPaint={read=FOnPaint, write=FOnPaint};
xue@0 1711 __property TNotifyEvent OnPlaybackDone={read=FOnPlaybackDone,write=FOnPlaybackDone};
xue@0 1712 __property TNotifyEvent OnPlaybackStart={read=FOnPlaybackStart, write=FOnPlaybackStart};
xue@0 1713 __property TNotifyEvent OnSelectedChange={read=FOnSelectedChange,write=FOnSelectedChange};
xue@0 1714 __property TNotifyEvent OnScaleChange={read=FOnScaleChange,write=FOnScaleChange};
xue@0 1715 };
xue@0 1716 //---------------------------------------------------------------------------
xue@0 1717 #endif