forked from ozsun88/SynchronousAudioRouter
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigui.h
More file actions
184 lines (153 loc) · 5.01 KB
/
configui.h
File metadata and controls
184 lines (153 loc) · 5.01 KB
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
// SynchronousAudioRouter
// Copyright (C) 2015 Mackenzie Straight
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SynchronousAudioRouter. If not, see <http://www.gnu.org/licenses/>.
#ifndef _SAR_ASIO_CONFIGUI_H
#define _SAR_ASIO_CONFIGUI_H
#include "config.h"
#include "tinyasio.h"
namespace Sar {
struct PropertySheetPage: public PROPSHEETPAGE
{
PropertySheetPage();
protected:
virtual INT_PTR dialogProc(
HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) = 0;
void changed();
HWND _hwnd;
private:
static INT_PTR CALLBACK dialogProcStub(
HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
};
struct PropertyDialog: public PROPSHEETHEADER
{
PropertyDialog();
void addPage(std::shared_ptr<PropertySheetPage> page);
INT_PTR show(HWND parent = nullptr);
private:
std::vector<std::shared_ptr<PropertySheetPage>> _pages;
std::vector<HPROPSHEETPAGE> _pageHandles;
};
struct SimpleDialog
{
SimpleDialog(LPCTSTR templateName);
INT_PTR show(HWND parent = nullptr);
protected:
virtual INT_PTR dialogProc(
HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) = 0;
HWND _hwnd;
private:
static INT_PTR CALLBACK dialogProcStub(
HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
LPCTSTR _templateName;
};
struct EndpointsPropertySheetPage: public PropertySheetPage
{
EndpointsPropertySheetPage(DriverConfig& config);
protected:
virtual INT_PTR dialogProc(
HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) override;
private:
void initControls();
void refreshHardwareInterfaceList();
void refreshEndpointList();
void updateEnabled();
void onHardwareInterfaceChanged();
void onConfigureHardwareInterface();
void onAddEndpoint();
void onRemoveEndpoint();
DriverConfig& _config;
std::vector<AsioDriver> _drivers;
HWND _hardwareInterfaceDropdown;
HWND _hardwareInterfaceConfigButton;
HWND _listView;
HWND _addButton;
HWND _removeButton;
void initEpDialogControls();
void updateEpDialogConfig();
INT_PTR epDialogProc(
HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
static INT_PTR CALLBACK epDialogProcStub(
HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
HWND _epDialog;
HWND _epDialogName;
HWND _epDialogType;
HWND _epDialogChannelCount;
EndpointConfig _epDialogConfig;
};
struct ApplicationsPropertySheetPage: public PropertySheetPage
{
ApplicationsPropertySheetPage(DriverConfig& config);
protected:
virtual INT_PTR dialogProc(
HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) override;
private:
void initControls();
void refreshControls();
void refreshApplicationList();
void updateEnabled();
void onOpenApplication();
void onAddApplication();
void onRemoveApplication();
DriverConfig& _config;
HWND _enableRouting;
HWND _listView;
HWND _addButton;
HWND _removeButton;
};
struct ApplicationConfigDialog: public SimpleDialog
{
ApplicationConfigDialog(
DriverConfig& driverConfig, ApplicationConfig config);
const ApplicationConfig& config() { return _config; }
protected:
virtual INT_PTR dialogProc(
HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) override;
private:
void initControls();
void initEndpointDropdown(HWND control, EndpointType type);
void refreshControls();
void refreshEndpointDropdown(HWND control, EDataFlow dataFlow, ERole role);
int indexOfEndpoint(const std::string& id);
std::string endpointAtIndex(EDataFlow dataFlow, int index);
void updateConfig();
void updateDefaultEndpoint(HWND control, EDataFlow dataFlow, ERole role);
void onRunningApplicationsClicked();
void onBrowseClicked();
DriverConfig& _driverConfig;
ApplicationConfig _config;
HWND _name;
HWND _path;
HWND _useRegularExpressions;
HWND _runningApplicationsButton;
HWND _browseButton;
HWND _playbackSystem;
HWND _playbackCommunications;
HWND _playbackMultimedia;
HWND _recordingSystem;
HWND _recordingCommunications;
HWND _recordingMultimedia;
};
struct ConfigurationPropertyDialog: public PropertyDialog
{
ConfigurationPropertyDialog(DriverConfig& config);
DriverConfig newConfig() { return _newConfig; }
private:
DriverConfig& _originalConfig;
DriverConfig _newConfig;
std::shared_ptr<EndpointsPropertySheetPage> _endpoints;
std::shared_ptr<ApplicationsPropertySheetPage> _applications;
};
} // namespace Sar
#endif // _SAR_ASIO_CONFIGUI_H