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 VibratoDemoUnitH
|
xue@0
|
15 #define VibratoDemoUnitH
|
xue@0
|
16 //---------------------------------------------------------------------------
|
xue@0
|
17 /*
|
xue@0
|
18 VibratoDemoUnit implements the Vibrato analysis and synthesis demo GUI
|
xue@0
|
19 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 <ExtCtrls.hpp>
|
xue@0
|
27 #include "AudioPac.h"
|
xue@0
|
28 #include "WaveView.h"
|
xue@0
|
29 #include "EventBoxUnit.h"
|
xue@0
|
30 #include "SUThread.h"
|
xue@0
|
31 #include <ComCtrls.hpp>
|
xue@0
|
32 #include <Dialogs.hpp>
|
xue@0
|
33 #include "vibrato.h"
|
xue@0
|
34 //---------------------------------------------------------------------------
|
xue@0
|
35
|
xue@0
|
36
|
xue@0
|
37 class TSUThread;
|
xue@0
|
38 const ThreadCaps=1024;
|
xue@0
|
39
|
xue@0
|
40 class TVibratoDemoForm : public TForm
|
xue@0
|
41 {
|
xue@0
|
42 __published: // IDE-managed Components
|
xue@0
|
43 TPanel *Panel1;
|
xue@0
|
44 TPanel *Panel2;
|
xue@0
|
45 TSplitter *Splitter1;
|
xue@0
|
46 TSplitter *Splitter2;
|
xue@0
|
47 TPanel *Panel3;
|
xue@0
|
48 TPanel *Panel4;
|
xue@0
|
49 TPanel *Panel5;
|
xue@0
|
50 TSplitter *Splitter3;
|
xue@0
|
51 TPanel *Panel8;
|
xue@0
|
52 TPanel *Panel7;
|
xue@0
|
53 TImage *Image1;
|
xue@0
|
54 TPanel *Panel6;
|
xue@0
|
55 TImage *Image2;
|
xue@0
|
56 TSplitter *Splitter4;
|
xue@0
|
57 TPanel *Panel9;
|
xue@0
|
58 TSplitter *Splitter5;
|
xue@0
|
59 TImage *Image0;
|
xue@0
|
60 TSplitter *Splitter6;
|
xue@0
|
61 TPanel *Panel10;
|
xue@0
|
62 TPageControl *PageControl1;
|
xue@0
|
63 TTabSheet *ModOverSheet;
|
xue@0
|
64 TTabSheet *ModCycleSheet;
|
xue@0
|
65 TLabel *Label1;
|
xue@0
|
66 TEdit *RegEdit;
|
xue@0
|
67 TLabel *Label2;
|
xue@0
|
68 TEdit *RateEdit;
|
xue@0
|
69 TLabel *Label3;
|
xue@0
|
70 TEdit *CycleRateEdit;
|
xue@0
|
71 TLabel *Label4;
|
xue@0
|
72 TEdit *CycleDurationEdit;
|
xue@0
|
73 TPanel *Panel11;
|
xue@0
|
74 TImage *MImage1;
|
xue@0
|
75 TLabel *Label5;
|
xue@0
|
76 TEdit *CycleExtentEdit;
|
xue@0
|
77 TLabel *Label6;
|
xue@0
|
78 TEdit *CycleAvgPDEdit;
|
xue@0
|
79 TEdit *CyclePitchEdit;
|
xue@0
|
80 TPanel *Panel12;
|
xue@0
|
81 TImage *MImage2;
|
xue@0
|
82 TTabSheet *AmpOverSheet;
|
xue@0
|
83 TPanel *Panel13;
|
xue@0
|
84 TImage *AImage1;
|
xue@0
|
85 TTabSheet *AmpCycleSheet;
|
xue@0
|
86 TPanel *Panel14;
|
xue@0
|
87 TImage *AImage2;
|
xue@0
|
88 TCheckBox *PeakMarksCheck;
|
xue@0
|
89 TButton *RegButton;
|
xue@0
|
90 TPanel *Panel15;
|
xue@0
|
91 TImage *AImage3;
|
xue@0
|
92 TPanel *Panel16;
|
xue@0
|
93 TImage *AImage4;
|
xue@0
|
94 TLabel *Label7;
|
xue@0
|
95 TLabel *Label8;
|
xue@0
|
96 TLabel *Label9;
|
xue@0
|
97 TLabel *Label10;
|
xue@0
|
98 TLabel *Label11;
|
xue@0
|
99 TLabel *Label12;
|
xue@0
|
100 TLabel *Label13;
|
xue@0
|
101 TLabel *Label14;
|
xue@0
|
102 TEdit *DurationEdit;
|
xue@0
|
103 TSaveDialog *SaveDialog1;
|
xue@0
|
104 TListBox *ListBox1;
|
xue@0
|
105 TEdit *FEdit;
|
xue@0
|
106 TComboBox *FScaleCombo;
|
xue@0
|
107 TEdit *ThetaEdit;
|
xue@0
|
108 TButton *Button1;
|
xue@0
|
109 TCheckBox *ResidueCheck;
|
xue@0
|
110 TCheckBox *SFCheck;
|
xue@0
|
111 TCheckBox *MACheck;
|
xue@0
|
112 TLabel *Label15;
|
xue@0
|
113 void __fastcall Image1MouseMove(TObject *Sender, TShiftState Shift,
|
xue@0
|
114 int X, int Y);
|
xue@0
|
115 void __fastcall Image2MouseMove(TObject *Sender, TShiftState Shift,
|
xue@0
|
116 int X, int Y);
|
xue@0
|
117 void __fastcall SFCheckClick(TObject *Sender);
|
xue@0
|
118 void __fastcall RegButtonClick(TObject *Sender);
|
xue@0
|
119 void __fastcall AImage3MouseMove(TObject *Sender, TShiftState Shift,
|
xue@0
|
120 int X, int Y);
|
xue@0
|
121 void __fastcall MImage1MouseMove(TObject *Sender, TShiftState Shift,
|
xue@0
|
122 int X, int Y);
|
xue@0
|
123 void __fastcall Image2DblClick(TObject *Sender);
|
xue@0
|
124 void __fastcall AImage1MouseDown(TObject *Sender, TMouseButton Button,
|
xue@0
|
125 TShiftState Shift, int X, int Y);
|
xue@0
|
126 void __fastcall AImage1MouseUp(TObject *Sender, TMouseButton Button,
|
xue@0
|
127 TShiftState Shift, int X, int Y);
|
xue@0
|
128 void __fastcall CycleRateEditMouseMove(TObject *Sender,
|
xue@0
|
129 TShiftState Shift, int X, int Y);
|
xue@0
|
130 void __fastcall PageControl1Change(TObject *Sender);
|
xue@0
|
131 void __fastcall Panel4Resize(TObject *Sender);
|
xue@0
|
132 void __fastcall Panel8Resize(TObject *Sender);
|
xue@0
|
133 void __fastcall Panel1Resize(TObject *Sender);
|
xue@0
|
134 void __fastcall AmpOverSheetResize(TObject *Sender);
|
xue@0
|
135 void __fastcall AmpCycleSheetResize(TObject *Sender);
|
xue@0
|
136 void __fastcall ListBox1Click(TObject *Sender);
|
xue@0
|
137 void __fastcall Button1Click(TObject *Sender);
|
xue@0
|
138 void __fastcall Panel9Resize(TObject *Sender);
|
xue@0
|
139 void __fastcall Panel7Resize(TObject *Sender);
|
xue@0
|
140 private: // User declarations
|
xue@0
|
141 public: // User declarations
|
xue@0
|
142 __fastcall TVibratoDemoForm(TComponent* Owner);
|
xue@0
|
143 __fastcall ~TVibratoDemoForm();
|
xue@0
|
144
|
xue@0
|
145 bool ForceUpdate;
|
xue@0
|
146
|
xue@0
|
147 TSUThread* SUThread;
|
xue@0
|
148 int pThread;
|
xue@0
|
149 TSUThread* ThreadList[ThreadCaps];
|
xue@0
|
150
|
xue@0
|
151 void __fastcall SUTerminate(TObject* Sender);
|
xue@0
|
152 DYNAMIC void __fastcall MouseWheelHandler(TMessage& Msg);
|
xue@0
|
153 void __fastcall Image1MouseWheel(TObject* Sender, TShiftState Shift, int WheelDelta, const TPoint &MousePos, bool &Handled);
|
xue@0
|
154 void __fastcall Image2MouseWheel(TObject* Sender, TShiftState Shift, int WheelDelta, const TPoint &MousePos, bool &Handled);
|
xue@0
|
155 void __fastcall AImage3MouseWheel(TObject* Sender, TShiftState Shift, int WheelDelta, const TPoint &MousePos, bool &Handled);
|
xue@0
|
156 void __fastcall AImage4MouseWheel(TObject* Sender, TShiftState Shift, int WheelDelta, const TPoint &MousePos, bool &Handled);
|
xue@0
|
157 void __fastcall MImage1MouseWheel(TObject* Sender, TShiftState Shift, int WheelDelta, const TPoint &MousePos, bool &Handled);
|
xue@0
|
158 void __fastcall RateEditMouseWheel(TObject* Sender, TShiftState Shift, int WheelDelta, const TPoint &MousePos, bool &Handled);
|
xue@0
|
159 void __fastcall DurationEditMouseWheel(TObject* Sender, TShiftState Shift, int WheelDelta, const TPoint &MousePos, bool &Handled);
|
xue@0
|
160 void __fastcall PitchEditMouseWheel(TObject* Sender, TShiftState Shift, int WheelDelta, const TPoint &MousePos, bool &Handled);
|
xue@0
|
161
|
xue@0
|
162 int StartPos;
|
xue@0
|
163 TWaveAudio* WaveAudio1;
|
xue@0
|
164 TWaveView* WaveView1;
|
xue@0
|
165 TWaveAudio* WaveAudio2;
|
xue@0
|
166 TWaveView* WaveView2;
|
xue@0
|
167
|
xue@0
|
168 TVo V;
|
xue@0
|
169
|
xue@0
|
170 THS* HS;
|
xue@0
|
171 double f_c, f_ex;
|
xue@0
|
172 double* peaky;
|
xue@0
|
173 double* cyclefrs;
|
xue@0
|
174 double* cyclefs;
|
xue@0
|
175 int cyclefrcount;
|
xue@0
|
176 int CurrentModCycle;
|
xue@0
|
177 double CurrentModCycleStart;
|
xue@0
|
178 double CurrentModCycleEnd;
|
xue@0
|
179 int CurrentPartial;
|
xue@0
|
180 int CurrentK;
|
xue@0
|
181 int CurrentC;
|
xue@0
|
182 double FXX[64];
|
xue@0
|
183 double NAF[4096];
|
xue@0
|
184 int SX[128]; //size related to number of partials
|
xue@0
|
185 int SXcycle[128];
|
xue@0
|
186 int KX1[64]; //size related to number of frames per cycle
|
xue@0
|
187 int KX2[64];
|
xue@0
|
188 int CX1[128]; //size related to number of cycles
|
xue@0
|
189 int CX2[128];
|
xue@0
|
190 int CY1[128];
|
xue@0
|
191 int CY2[128];
|
xue@0
|
192 int SXc;
|
xue@0
|
193 int SXcyclec;
|
xue@0
|
194 int FirstStartDrag;
|
xue@0
|
195 int StartDrag;
|
xue@0
|
196
|
xue@0
|
197 __int16* datain;
|
xue@0
|
198
|
xue@0
|
199 void Copydata();
|
xue@0
|
200 void DrawModulator();
|
xue@0
|
201 void __fastcall ExternalInput();
|
xue@0
|
202 void FindNote();
|
xue@0
|
203 void Reset();
|
xue@0
|
204 void __fastcall SaveV();
|
xue@0
|
205 void __fastcall S_U(bool sf=false);
|
xue@0
|
206 void Synthesize();
|
xue@0
|
207 void UpdateDisplay(bool f0=true, bool f0s=true, bool f0d=true, bool sf=true);
|
xue@0
|
208 int __fastcall WaveView1CustomInfo(TObject*);
|
xue@0
|
209 void __fastcall WaveView1OpMode(TObject* Sender, TShiftState Shift, int& OpMode);
|
xue@0
|
210 };
|
xue@0
|
211 //---------------------------------------------------------------------------
|
xue@0
|
212 extern PACKAGE TVibratoDemoForm *VibratoDemoForm;
|
xue@0
|
213 //---------------------------------------------------------------------------
|
xue@0
|
214 #endif
|