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
|
xue@0
|
15 #ifndef Unit1H
|
xue@0
|
16 #define Unit1H
|
xue@0
|
17 //---------------------------------------------------------------------------
|
xue@0
|
18 /*
|
xue@0
|
19 Unit1.cpp implements the main window of HV.
|
xue@0
|
20 */
|
xue@0
|
21
|
xue@0
|
22 #include <Classes.hpp>
|
xue@0
|
23 #include <Controls.hpp>
|
xue@0
|
24 #include <StdCtrls.hpp>
|
xue@0
|
25 #include <Forms.hpp>
|
xue@0
|
26 #include <ComCtrls.hpp>
|
xue@0
|
27 #include <ExtCtrls.hpp>
|
xue@0
|
28 #include <Menus.hpp>
|
xue@0
|
29 #include <ToolWin.hpp>
|
xue@0
|
30 #include <Dialogs.hpp>
|
xue@0
|
31 #include <ActnList.hpp>
|
xue@0
|
32 #include <Buttons.hpp>
|
xue@0
|
33 #include <ImgList.hpp>
|
xue@0
|
34 #include "AudioPac.h"
|
xue@0
|
35 #include "WaveView.h"
|
xue@0
|
36 #include "Navigator.h"
|
xue@0
|
37
|
xue@0
|
38 #include "hs.h"
|
xue@0
|
39 #include "EventBoxUnit.h"
|
xue@0
|
40 #include "procedures.h"
|
xue@0
|
41 #include <Grids.hpp>
|
xue@0
|
42
|
xue@0
|
43 #define wopHS 16
|
xue@0
|
44 #define wopCrop 17
|
xue@0
|
45 #define wopSample 18
|
xue@0
|
46 #define wopEdit 32
|
xue@0
|
47
|
xue@0
|
48 //---------------------------------------------------------------------------
|
xue@0
|
49 const MaxRecents=10;
|
xue@0
|
50 const MaxPartialsPerCR=32;
|
xue@0
|
51 enum objshorttag0 {stNULL, stAtom, stFreqDelimiter, stFloater, stDUMMY, stOnset};
|
xue@0
|
52 //if ShortTag[0]==stAtom, then ShortTag[1]=channel, [2]=m+1, [3]=0, Tag[2]=fr
|
xue@0
|
53
|
xue@0
|
54 class TForm1 : public TForm
|
xue@0
|
55 {
|
xue@0
|
56 __published: // IDE-managed Components
|
xue@0
|
57 TMainMenu *MainMenu1;
|
xue@0
|
58 TCoolBar *CoolBar1;
|
xue@0
|
59 TStatusBar *StatusBar1;
|
xue@0
|
60 TMenuItem *File1;
|
xue@0
|
61 TMenuItem *Open1;
|
xue@0
|
62 TMenuItem *Exit1;
|
xue@0
|
63 TPanel *PanelButtons;
|
xue@0
|
64 TShape *PanelRightButton;
|
xue@0
|
65 TImageList *ImageList1;
|
xue@0
|
66 TOpenDialog *OpenDialog1;
|
xue@0
|
67 TToolBar *ToolBarFile;
|
xue@0
|
68 TSpeedButton *SpeedButtonOpen;
|
xue@0
|
69 TMenuItem *Project1;
|
xue@0
|
70 TMenuItem *Backup1;
|
xue@0
|
71 TToolBar *ToolBarMode;
|
xue@0
|
72 TSpeedButton *SpeedButtonS;
|
xue@0
|
73 TToolButton *ToolButton2;
|
xue@0
|
74 TSpeedButton *SpeedButtonT;
|
xue@0
|
75 TSpeedButton *SpeedButtonF;
|
xue@0
|
76 TSpeedButton *SpeedButtonM;
|
xue@0
|
77 TPanel *BackPanel;
|
xue@0
|
78 TPanel *PanelMain;
|
xue@0
|
79 TPanel *PanelRight;
|
xue@0
|
80 TPanel *PanelNavigator;
|
xue@0
|
81 TSplitter *Splitter1;
|
xue@0
|
82 TPanel *PanelRightBack;
|
xue@0
|
83 TSplitter *Splitter2;
|
xue@0
|
84 TPageControl *PageControl1;
|
xue@0
|
85 TTabSheet *TabSheet1;
|
xue@0
|
86 TTabSheet *TabSheet2;
|
xue@0
|
87 TRadioGroup *PlaybackFilterRadio;
|
xue@0
|
88 TRadioGroup *PlayChannelRadio;
|
xue@0
|
89 TRadioGroup *DisplayChannelRadio;
|
xue@0
|
90 TRadioGroup *PanesRadio;
|
xue@0
|
91 TStaticText *StaticText1;
|
xue@0
|
92 TPopupMenu *NavigatorPopup;
|
xue@0
|
93 TMenuItem *Waveform1;
|
xue@0
|
94 TMenuItem *Spectrogram1;
|
xue@0
|
95 TToolButton *ToolButton4;
|
xue@0
|
96 TToolButton *ToolButton3;
|
xue@0
|
97 TSpeedButton *SpeedButtonSelect;
|
xue@0
|
98 TGroupBox *GroupBox1;
|
xue@0
|
99 TCheckBox *LogFreqCheck;
|
xue@0
|
100 TCheckBox *FreqLineCheck;
|
xue@0
|
101 TPopupMenu *WaveView1PopupMenu;
|
xue@0
|
102 TMenuItem *ZoomToSelection1;
|
xue@0
|
103 TMenuItem *UndoZoom1;
|
xue@0
|
104 TMenuItem *N2;
|
xue@0
|
105 TMenuItem *Restore1;
|
xue@0
|
106 TMenuItem *TimeZoom1;
|
xue@0
|
107 TMenuItem *FrequencyZoom1;
|
xue@0
|
108 TMenuItem *AmplitudeZoom1;
|
xue@0
|
109 TMenuItem *SpectrogramBrightness1;
|
xue@0
|
110 TMenuItem *Play1;
|
xue@0
|
111 TSpeedButton *SpeedButtonExit;
|
xue@0
|
112 TMenuItem *Help1;
|
xue@0
|
113 TMenuItem *Save1;
|
xue@0
|
114 TMenuItem *Saveas1;
|
xue@0
|
115 TSpeedButton *SpeedButtonSave;
|
xue@0
|
116 TMenuItem *N3;
|
xue@0
|
117 TMenuItem *Cut1;
|
xue@0
|
118 TMenuItem *Extract1;
|
xue@0
|
119 TMenuItem *Editorpanel1;
|
xue@0
|
120 TMenuItem *Amplify1;
|
xue@0
|
121 TMenuItem *AM1;
|
xue@0
|
122 TMenuItem *FM1;
|
xue@0
|
123 TMenuItem *Timestretching1;
|
xue@0
|
124 TMenuItem *Pitchshifting1;
|
xue@0
|
125 TMenuItem *DeFM1;
|
xue@0
|
126 TMenuItem *View1;
|
xue@0
|
127 TMenuItem *Events1;
|
xue@0
|
128 TTabSheet *TabSheet5;
|
xue@0
|
129 TLabel *Label1;
|
xue@0
|
130 TEdit *HSDelmEdit1;
|
xue@0
|
131 TEdit *HSDelpEdit1;
|
xue@0
|
132 TLabel *Label2;
|
xue@0
|
133 TLabel *Label3;
|
xue@0
|
134 TEdit *HSMaxpEdit1;
|
xue@0
|
135 TLabel *Label4;
|
xue@0
|
136 TEdit *HSMaxBEdit1;
|
xue@0
|
137 TListBox *PartialSelectCombo;
|
xue@0
|
138 TLabel *Label5;
|
xue@0
|
139 TEdit *HSMinF0Edit1;
|
xue@0
|
140 TLabel *Label6;
|
xue@0
|
141 TLabel *Label7;
|
xue@0
|
142 TEdit *HSMaxF0Edit1;
|
xue@0
|
143 TLabel *Label8;
|
xue@0
|
144 TSaveDialog *SaveDialog1;
|
xue@0
|
145 TMenuItem *N6;
|
xue@0
|
146 TMenuItem *Vibratowizard1;
|
xue@0
|
147 TToolButton *ToolButton1;
|
xue@0
|
148 TSpeedButton *SpeedButtonRecord;
|
xue@0
|
149 TMenuItem *Close1;
|
xue@0
|
150 TCheckBox *AutoScrollCheck;
|
xue@0
|
151 TRadioGroup *PlayFromRadio;
|
xue@0
|
152 TRadioGroup *PlayUntilRadio;
|
xue@0
|
153 TCheckBox *LoopCheck;
|
xue@0
|
154 TTabSheet *TabSheet6;
|
xue@0
|
155 TCheckBox *MouseWheelZoom;
|
xue@0
|
156 TPanel *PanelWaveView;
|
xue@0
|
157 TScrollBar *ScrollBar1;
|
xue@0
|
158 TSplitter *Splitter3;
|
xue@0
|
159 TPanel *PanelGrid;
|
xue@0
|
160 TShape *PanelRightButton2;
|
xue@0
|
161 TPageControl *PageControl2;
|
xue@0
|
162 TTabSheet *AmpTab;
|
xue@0
|
163 TStringGrid *AmpGrid;
|
xue@0
|
164 TTabSheet *ArcTab;
|
xue@0
|
165 TStringGrid *PhaseGrid;
|
xue@0
|
166 TCheckBox *MBCheck;
|
xue@0
|
167 TEdit *FormatEdit;
|
xue@0
|
168 TMenuItem *Sourcefilter1;
|
xue@0
|
169 TTabSheet *QPkTab;
|
xue@0
|
170 TStringGrid *QPkGrid;
|
xue@0
|
171 TToolBar *ToolBar1;
|
xue@0
|
172 TComboBox *WindowTypeCombo;
|
xue@0
|
173 TComboBox *WindowSizeCombo;
|
xue@0
|
174 TComboBox *PlayFilterCombo;
|
xue@0
|
175 TPopupMenu *PopupMenu1;
|
xue@0
|
176 TSpeedButton *SpeedButtonCursorText;
|
xue@0
|
177 TSpeedButton *SpeedButtonPaneInfo;
|
xue@0
|
178 TSpeedButton *SpeedButtonPlay;
|
xue@0
|
179 TToolBar *ToolBarAudio;
|
xue@0
|
180 TGroupBox *FadeInGroup;
|
xue@0
|
181 TLabel *FadeInLabel;
|
xue@0
|
182 TCheckBox *FadeInCheck;
|
xue@0
|
183 TComboBox *FadeInCombo;
|
xue@0
|
184 TMenuItem *Recent00;
|
xue@0
|
185 TMenuItem *Recent11;
|
xue@0
|
186 TMenuItem *Retrieve1;
|
xue@0
|
187 TMenuItem *N1;
|
xue@0
|
188 TMenuItem *Spectrogram2;
|
xue@0
|
189 void __fastcall PanelRightButtonMouseUp(TObject *Sender,
|
xue@0
|
190 TMouseButton Button, TShiftState Shift, int X, int Y);
|
xue@0
|
191 void __fastcall Open1Click(TObject *Sender);
|
xue@0
|
192 void __fastcall Exit1Click(TObject *Sender);
|
xue@0
|
193 void __fastcall Backup1Click(TObject *Sender);
|
xue@0
|
194 void __fastcall SpeedButtonTClick(TObject *Sender);
|
xue@0
|
195 void __fastcall SpeedButtonFClick(TObject *Sender);
|
xue@0
|
196 void __fastcall SpeedButtonMClick(TObject *Sender);
|
xue@0
|
197 void __fastcall LogFreqCheckClick(TObject *Sender);
|
xue@0
|
198 void __fastcall WindowSizeComboChange(TObject *Sender);
|
xue@0
|
199 void __fastcall WindowTypeComboChange(TObject *Sender);
|
xue@0
|
200 void __fastcall WaveView1PopupMenuPopup(TObject *Sender);
|
xue@0
|
201 void __fastcall ZoomToSelection1Click(TObject *Sender);
|
xue@0
|
202 void __fastcall UndoZoom1Click(TObject *Sender);
|
xue@0
|
203 void __fastcall Play1Click(TObject *Sender);
|
xue@0
|
204 void __fastcall SpectrogramBrightness1Click(TObject *Sender);
|
xue@0
|
205 void __fastcall SpeedButtonSClick(TObject *Sender);
|
xue@0
|
206 void __fastcall AmplitudeZoom1Click(TObject *Sender);
|
xue@0
|
207 void __fastcall Extract1Click(TObject *Sender);
|
xue@0
|
208 void __fastcall FadeInCheckClick(TObject *Sender);
|
xue@0
|
209 void __fastcall Cut1Click(TObject *Sender);
|
xue@0
|
210 void __fastcall Amplify1Click(TObject *Sender);
|
xue@0
|
211 void __fastcall Events1Click(TObject *Sender);
|
xue@0
|
212 void __fastcall SpeedButtonSaveClick(TObject *Sender);
|
xue@0
|
213 void __fastcall TimeZoom1Click(TObject *Sender);
|
xue@0
|
214 void __fastcall FrequencyZoom1Click(TObject *Sender);
|
xue@0
|
215 void __fastcall Vibratowizard1Click(TObject *Sender);
|
xue@0
|
216 void __fastcall Recent11Click(TObject *Sender);
|
xue@0
|
217 void __fastcall SpeedButtonRecordClick(TObject *Sender);
|
xue@0
|
218 void __fastcall Close1Click(TObject *Sender);
|
xue@0
|
219 void __fastcall AutoScrollCheckClick(TObject *Sender);
|
xue@0
|
220 void __fastcall LoopCheckClick(TObject *Sender);
|
xue@0
|
221 void __fastcall PlayUntilRadioClick(TObject *Sender);
|
xue@0
|
222 void __fastcall MouseWheelZoomClick(TObject *Sender);
|
xue@0
|
223 void __fastcall AmpGridDblClick(TObject *Sender);
|
xue@0
|
224 void __fastcall Sourcefilter1Click(TObject *Sender);
|
xue@0
|
225 void __fastcall PlayFilterComboSelect(TObject *Sender);
|
xue@0
|
226 void __fastcall PlaybackFilterRadioClick(TObject *Sender);
|
xue@0
|
227 void __fastcall Retrieve1Click(TObject *Sender);
|
xue@0
|
228 private: // User declarations
|
xue@0
|
229 bool SpectrogramView;
|
xue@0
|
230 int fcalculatespcount;
|
xue@0
|
231 TSpeedButton* NavButton;
|
xue@0
|
232 Graphics::TBitmap* BitmapPlay;
|
xue@0
|
233 Graphics::TBitmap* BitmapStop;
|
xue@0
|
234 Graphics::TBitmap* BitmapSpectrogram;
|
xue@0
|
235 Graphics::TBitmap* BitmapWaveform;
|
xue@0
|
236 Graphics::TBitmap* BitmapRecord;
|
xue@0
|
237 Graphics::TBitmap* BitmapTimeSelect;
|
xue@0
|
238 Graphics::TBitmap* BitmapFreqSelect;
|
xue@0
|
239 Graphics::TBitmap* BitmapMultiSelect;
|
xue@0
|
240 Graphics::TBitmap* BitmapHSSelect;
|
xue@0
|
241 Graphics::TBitmap* BitmapCursorText;
|
xue@0
|
242 Graphics::TBitmap* BitmapPaneInfo;
|
xue@0
|
243 Graphics::TBitmap* BitmapRecording;
|
xue@0
|
244 AnsiString ExePath;
|
xue@0
|
245 AnsiString IniFileName;
|
xue@0
|
246 AnsiString TmpOutFileName;
|
xue@0
|
247 AnsiString TmpInFileName;
|
xue@0
|
248 int GridSourcePane;
|
xue@0
|
249 public: // User declarations
|
xue@0
|
250
|
xue@0
|
251 THS* HS;
|
xue@0
|
252 TWaveAudio* WaveAudio1;
|
xue@0
|
253 TWaveAudio* WaveAudio2;
|
xue@0
|
254 TWaveView* WaveView1;
|
xue@0
|
255 TNavigator* Navigator1;
|
xue@0
|
256
|
xue@0
|
257 double f1;
|
xue@0
|
258 double f2;
|
xue@0
|
259 int edfr;
|
xue@0
|
260 int anccount;
|
xue@0
|
261 int* ancps;
|
xue@0
|
262 int* ancfrs;
|
xue@0
|
263 double* ancfs;
|
xue@0
|
264 double* ancts;
|
xue@0
|
265 TMenuItem* Recents[MaxRecents];
|
xue@0
|
266
|
xue@0
|
267 struct ost {int count, wid, offst, *xfr; int** pitches; double** f0s;} onset;
|
xue@0
|
268
|
xue@0
|
269 __fastcall TForm1(TComponent* Owner);
|
xue@0
|
270 __fastcall ~TForm1();
|
xue@0
|
271
|
xue@0
|
272 void __fastcall AddHSObject(THS* aHS);
|
xue@0
|
273 void __fastcall NavButtonClick(TObject*);
|
xue@0
|
274 void __fastcall PostWaveViewData(double* data, int Channel, int StartPos, int EndPos, bool fadein, int W);
|
xue@0
|
275 void __fastcall PostWaveViewData(__int16* data, int Channel, int StartPos, int EndPos, bool fadein, int W);
|
xue@0
|
276 void __fastcall PostWaveViewData(__int16* data, int Channel, int StartPos, int EndPos);
|
xue@0
|
277 void Initialize();
|
xue@0
|
278 void PrepareNMSettings(NMSettings* settings);
|
xue@0
|
279 void RecentFile(AnsiString);
|
xue@0
|
280 void SetGridContents();
|
xue@0
|
281 void SetWaveViewContents();
|
xue@0
|
282 void ShowPanel(TPanel* APanel, bool Hide);
|
xue@0
|
283
|
xue@0
|
284 void __fastcall ApplicationIdle(TObject*, bool&);
|
xue@0
|
285 void __fastcall CropEventStart(TObject*, TShiftState);
|
xue@0
|
286 void __fastcall CropEventEnd(TObject*, TShiftState);
|
xue@0
|
287 void __fastcall GetTargetAudio(int& targettype, int& channel, int& from, int& to, double*& target, __int16*& before);
|
xue@0
|
288 void __fastcall Navigator1AreaChange(TObject*);
|
xue@0
|
289 void __fastcall Navigator1Background(TObject*);
|
xue@0
|
290 void __fastcall WaveAudio1Load(TObject*);
|
xue@0
|
291 void __fastcall WaveAudio2InAddBuffer(TObject*);
|
xue@0
|
292 void __fastcall WaveView1AfterPaint(TObject*);
|
xue@0
|
293 void __fastcall WaveView1BeforePlayback(TObject*);
|
xue@0
|
294 int __fastcall WaveView1CustomPaneInfo(TObject*);
|
xue@0
|
295 int __fastcall WaveView1CustomInfo(TObject*);
|
xue@0
|
296 void __fastcall WaveView1DrawFreqLimiter(TObject*, TWaveViewObject&);
|
xue@0
|
297 void __fastcall WaveView1DrawObject(TObject*, TWaveViewObject&);
|
xue@0
|
298 void __fastcall WaveView1DrawAtom(TObject*, TWaveViewObject&);
|
xue@0
|
299 void __fastcall WaveView1InfoDblClick(TObject*);
|
xue@0
|
300 void __fastcall WaveView1KeyPress(TObject* Sender, char &Key);
|
xue@0
|
301 void __fastcall WaveView1MouseDown(TObject* Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
|
xue@0
|
302 void __fastcall WaveView1MouseMove(TObject* Sender, TShiftState Shift, int X, int Y);
|
xue@0
|
303 void __fastcall WaveView1MousePointer(TObject* Sender, int Pane, int t, double f);
|
xue@0
|
304 void __fastcall WaveView1MouseUp(TObject* Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
|
xue@0
|
305 void __fastcall WaveView1MouseWheel(TObject* Sender, TShiftState Shift, int WheelDelta, const TPoint& MousePos, bool& Handled);
|
xue@0
|
306 void __fastcall WaveView1ObjectClick(TObject*);
|
xue@0
|
307 void __fastcall WaveView1ObjectDblClick(TObject*);
|
xue@0
|
308 void __fastcall WaveView1ObjectEnter(TObject*);
|
xue@0
|
309 void __fastcall WaveView1ObjectMouseWheel(TObject* Sender, TShiftState Shift, int WheelDelta, const TPoint& MousePos, bool& Handled);
|
xue@0
|
310 void __fastcall WaveView1OpMode(TObject* Sender, TShiftState Shift, int& OpMode);
|
xue@0
|
311 void __fastcall WaveView1ParKeyDown(TObject*, Word &Key, TShiftState Shift);
|
xue@0
|
312 void __fastcall WaveView1ParMouseDown(TObject* Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
|
xue@0
|
313 void __fastcall WaveView1ParMouseMove(TObject* Sender, TShiftState Shift, int X, int Y);
|
xue@0
|
314 void __fastcall WaveView1ParMouseUp(TObject* Sender, TMouseButton Button, TShiftState Shift, int X, int Y);
|
xue@0
|
315 void __fastcall WaveView1ParMouseWheel(TObject* Sender, TShiftState Shift, int WheelDelta, const TPoint& MousePos, bool& Handled);
|
xue@0
|
316 void __fastcall WaveView1PlaybackDone(TObject*);
|
xue@0
|
317 void __fastcall WaveView1PlaybackStart(TObject*);
|
xue@0
|
318 void __fastcall WaveView1PlaybackStartAndEndPos(TObject*, int&, int&, bool);
|
xue@0
|
319
|
xue@0
|
320
|
xue@0
|
321 };
|
xue@0
|
322
|
xue@0
|
323
|
xue@0
|
324
|
xue@0
|
325
|
xue@0
|
326 //---------------------------------------------------------------------------
|
xue@0
|
327 extern PACKAGE TForm1 *Form1;
|
xue@0
|
328 //---------------------------------------------------------------------------
|
xue@0
|
329 #endif
|