-
Notifications
You must be signed in to change notification settings - Fork 4
/
DlgCalWizVol.cpp
201 lines (149 loc) · 4.68 KB
/
DlgCalWizVol.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
// DlgCalWizVol.cpp : implementation file
//
#include "stdafx.h"
#include "audtest.h"
#include "audtedoc.h"
#include "audtevw.h"
#include "Generat.h"
#include "DlgCalWizVol.h"
#include "OpRecord.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define TIMER_ID 0x123196
/////////////////////////////////////////////////////////////////////////////
// CDlgCalWizVol
IMPLEMENT_DYNAMIC(CDlgCalWizVol, CPropertySheet)
CDlgCalWizVol::CDlgCalWizVol(CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(IDS_CALIBRATION, pParentWnd, iSelectPage)
{
AddPage( &m_dlgBegin);
AddPage( &m_dlgEnd);
SetWizardMode();
m_dwReferID = 0; // set to nobody
}
CDlgCalWizVol::~CDlgCalWizVol()
{
}
BEGIN_MESSAGE_MAP(CDlgCalWizVol, CPropertySheet)
//{{AFX_MSG_MAP(CDlgCalWizVol)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgCalWizVol message handlers
/////////////////////////////////////////////////////////////////////////////
// CDlgCalWizVolBegin property page
IMPLEMENT_DYNCREATE(CDlgCalWizVolBegin, CPropertyPage)
CDlgCalWizVolBegin::CDlgCalWizVolBegin() : CPropertyPage(CDlgCalWizVolBegin::IDD)
{
//{{AFX_DATA_INIT(CDlgCalWizVolBegin)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CDlgCalWizVolBegin::~CDlgCalWizVolBegin()
{
}
void CDlgCalWizVolBegin::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgCalWizVolBegin)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgCalWizVolBegin, CPropertyPage)
//{{AFX_MSG_MAP(CDlgCalWizVolBegin)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgCalWizVolBegin message handlers
/////////////////////////////////////////////////////////////////////////////
// CDlgCalWizVolEnd dialog
IMPLEMENT_DYNCREATE(CDlgCalWizVolEnd, CPropertyPage)
CDlgCalWizVolEnd::CDlgCalWizVolEnd() : CPropertyPage(CDlgCalWizVolEnd::IDD)
{
//{{AFX_DATA_INIT(CDlgCalWizVolEnd)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CDlgCalWizVolEnd::~CDlgCalWizVolEnd()
{
}
void CDlgCalWizVolEnd::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgCalWizVolEnd)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgCalWizVolEnd, CPropertyPage)
//{{AFX_MSG_MAP(CDlgCalWizVolEnd)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgCalWizVolEnd message handlers
BOOL CDlgCalWizVolBegin::OnSetActive()
{
CPropertySheet *cwnd = (CPropertySheet *)GetParent();
cwnd->SetWizardButtons( PSWIZB_NEXT | PSWIZB_BACK);
return CPropertyPage::OnSetActive();
}
BOOL CDlgCalWizVolEnd::OnSetActive()
{
CPropertySheet *cwnd = (CPropertySheet *)GetParent();
cwnd->SetWizardButtons( PSWIZB_DISABLEDFINISH );
{
CWnd *pwnd;
pwnd = cwnd->GetDlgItem( IDCANCEL);
if ( pwnd)
{
pwnd->EnableWindow( FALSE);
}
}
SetTimer( TIMER_ID, 250, NULL); // 250 milliseconds
return CPropertyPage::OnSetActive();
}
void CDlgCalWizVolEnd::OnTimer(UINT_PTR nIDEvent)
{
CDlgCalWizVol *cwnd = (CDlgCalWizVol *)GetParent();
CAudtestView *pView; // the parent view
if ( ! CAudtestApp::GetIsWorking() )
{
CNamed *pcgen;
CNamed *pcout = NULL;
KillTimer( nIDEvent);
pView = (CAudtestView *)cwnd->GetView();
pcgen = ((CAudtestDoc *)pView->GetDocument() )->GetDefaultGenerator();
if ( pcgen)
pcout = pcgen->FindByName( pcgen->GetName() + ".Pulse");
cwnd->SetWizardButtons( PSWIZB_FINISH );
if ( pcout)
cwnd->m_dwReferID = pcout->GetID(); // set it to something or other....
}
CPropertyPage::OnTimer(nIDEvent);
}
LRESULT CDlgCalWizVolBegin::OnWizardNext()
{
CDlgCalWizVol *cwnd = (CDlgCalWizVol *)GetParent();
CAudtestView *pView; // the parent view
COpCode *cop;
CNamed *pcgen;
// we can have up to 3 volumes to set
// output volume
// wave out volume
// wave input volume
// query the mixer to see which volumes we can adjust?
// then adjust output volume until clipping, back off
// then adjust input volume to be the right amplitude, back off
pView = (CAudtestView *)cwnd->GetView();
pcgen = ((CAudtestDoc *)pView->GetDocument() )->GetDefaultGenerator();
cop = new COpMsrTime( pcgen, pView);
pView->SetCurrentOperation( cop);
if ( cop->QueueAndDo()) // failed
pView->SetCurrentOperation( NULL); // reset
return CPropertyPage::OnWizardNext();
}