[SNDVOL32] Add the ability to select the record mode by using the /r option and selec...
[reactos.git] / base / applications / sndvol32 / sndvol32.h
1 #ifndef __SNDVOL32_H
2 #define __SNDVOL32_H
3
4 #include <stdarg.h>
5
6 #include <windef.h>
7 #include <winbase.h>
8 #include <wingdi.h>
9 #include <winuser.h>
10 #include <mmsystem.h>
11 #include <commctrl.h>
12 #include <tchar.h>
13 #include <assert.h>
14
15 #include "resources.h"
16
17 #define VOLUME_STEPS 500
18 #define VOLUME_TICKS 5
19 #define VOLUME_PAGE_SIZE 100
20 #define BALANCE_STEPS 64
21 #define BALANCE_TICKS 1
22 #define BALANCE_PAGE_SIZE 12
23
24 typedef enum _WINDOW_MODE
25 {
26 NORMAL_MODE,
27 SMALL_MODE,
28 TRAY_MODE
29 } WINDOW_MODE, *PWINDOW_MODE;
30
31 typedef struct _MIXER_WINDOW
32 {
33 HWND hWnd;
34 HWND hStatusBar;
35 struct _SND_MIXER *Mixer;
36 UINT SelectedLine;
37 UINT WindowCount;
38 HWND *Window;
39
40 WINDOW_MODE Mode;
41 UINT MixerId;
42 RECT rect;
43 HFONT hFont;
44 } MIXER_WINDOW, *PMIXER_WINDOW;
45
46 extern HINSTANCE hAppInstance;
47 extern ATOM MainWindowClass;
48 extern HWND hMainWnd;
49 extern HANDLE hAppHeap;
50
51 #define SZ_APP_CLASS TEXT("Volume Control")
52
53 ULONG DbgPrint(PCH , ...);
54 #define DPRINT DbgPrint("SNDVOL32: %s:%i: ", __FILE__, __LINE__); DbgPrint
55
56
57 /*
58 * MIXER
59 */
60
61 typedef struct _SND_MIXER_CONNECTION
62 {
63 struct _SND_MIXER_CONNECTION *Next;
64 MIXERLINE Info;
65 LPMIXERCONTROL Controls;
66 UINT DisplayControls;
67 } SND_MIXER_CONNECTION, *PSND_MIXER_CONNECTION;
68
69
70 typedef struct _SND_MIXER_DESTINATION
71 {
72 struct _SND_MIXER_DESTINATION *Next;
73 MIXERLINE Info;
74 LPMIXERCONTROL Controls;
75 UINT DisplayControls;
76 PSND_MIXER_CONNECTION Connections;
77 } SND_MIXER_DESTINATION, *PSND_MIXER_DESTINATION;
78
79 typedef struct _SND_MIXER
80 {
81 UINT MixersCount;
82 HWND hWndNotification;
83 UINT MixerId;
84 HMIXER hmx;
85 MIXERCAPS Caps;
86 PSND_MIXER_DESTINATION Lines;
87 } SND_MIXER, *PSND_MIXER;
88
89 typedef struct _PREFERENCES_CONTEXT
90 {
91 PMIXER_WINDOW MixerWindow;
92 PSND_MIXER Mixer;
93 HWND hwndDlg;
94
95 UINT Selected;
96 DWORD SelectedLine;
97 DWORD PlaybackID;
98 DWORD RecordingID;
99 UINT OtherLines;
100 TCHAR DeviceName[128];
101
102 DWORD Count;
103 DWORD tmp;
104 } PREFERENCES_CONTEXT, *PPREFERENCES_CONTEXT;
105
106 typedef struct
107 {
108 WCHAR LineName[MIXER_LONG_NAME_CHARS];
109 UINT SliderPos;
110 BOOL bVertical;
111 BOOL bSwitch;
112
113 }SET_VOLUME_CONTEXT, *PSET_VOLUME_CONTEXT;
114
115 /* NOTE: do NOT modify SNDVOL_REG_LINESTATE for binary compatibility with XP! */
116 typedef struct _SNDVOL_REG_LINESTATE
117 {
118 DWORD Flags;
119 WCHAR LineName[MIXER_LONG_NAME_CHARS];
120 } SNDVOL_REG_LINESTATE, *PSNDVOL_REG_LINESTATE;
121
122
123 typedef BOOL (CALLBACK *PFNSNDMIXENUMLINES)(PSND_MIXER Mixer, LPMIXERLINE Line, UINT DisplayControls, PVOID Context);
124 typedef BOOL (CALLBACK *PFNSNDMIXENUMCONNECTIONS)(PSND_MIXER Mixer, DWORD LineID, LPMIXERLINE Line, PVOID Context);
125 typedef BOOL (CALLBACK *PFNSNDMIXENUMPRODUCTS)(PSND_MIXER Mixer, UINT Id, LPCTSTR ProductName, PVOID Context);
126
127 PSND_MIXER SndMixerCreate(HWND hWndNotification, UINT MixerId);
128 VOID SndMixerDestroy(PSND_MIXER Mixer);
129 VOID SndMixerClose(PSND_MIXER Mixer);
130 BOOL SndMixerSelect(PSND_MIXER Mixer, UINT MixerId);
131 UINT SndMixerGetSelection(PSND_MIXER Mixer);
132 INT SndMixerSetVolumeControlDetails(PSND_MIXER Mixer, DWORD dwControlID, DWORD cbDetails, LPVOID paDetails);
133 INT SndMixerGetVolumeControlDetails(PSND_MIXER Mixer, DWORD dwControlID, DWORD cbDetails, LPVOID paDetails);
134 INT SndMixerGetProductName(PSND_MIXER Mixer, LPTSTR lpBuffer, UINT uSize);
135 INT SndMixerGetLineName(PSND_MIXER Mixer, DWORD LineID, LPTSTR lpBuffer, UINT uSize, BOOL LongName);
136 BOOL SndMixerEnumProducts(PSND_MIXER Mixer, PFNSNDMIXENUMPRODUCTS EnumProc, PVOID Context);
137 INT SndMixerGetDestinationCount(PSND_MIXER Mixer);
138 BOOL SndMixerEnumLines(PSND_MIXER Mixer, PFNSNDMIXENUMLINES EnumProc, PVOID Context);
139 BOOL SndMixerEnumConnections(PSND_MIXER Mixer, DWORD LineID, PFNSNDMIXENUMCONNECTIONS EnumProc, PVOID Context);
140 BOOL SndMixerIsDisplayControl(PSND_MIXER Mixer, LPMIXERCONTROL Control);
141 BOOL SndMixerQueryControls(PSND_MIXER Mixer, PUINT DisplayControls, LPMIXERLINE LineInfo, LPMIXERCONTROL *Controls);
142
143 /*
144 * dialog.c
145 */
146 VOID LoadDialogCtrls(PPREFERENCES_CONTEXT PrefContext);
147 VOID UpdateDialogLineSliderControl(PPREFERENCES_CONTEXT PrefContext, LPMIXERLINE Line, DWORD dwControlID, DWORD DialogID, DWORD Position);
148 VOID UpdateDialogLineSwitchControl(PPREFERENCES_CONTEXT PrefContext, LPMIXERLINE Line, LONG fValue);
149
150 /*
151 * MISC
152 */
153
154 extern HKEY hAppSettingsKey;
155
156 BOOL
157 InitAppConfig(VOID);
158
159 VOID
160 CloseAppConfig(VOID);
161
162 INT
163 AllocAndLoadString(OUT LPWSTR *lpTarget,
164 IN HINSTANCE hInst,
165 IN UINT uID);
166
167 DWORD
168 LoadAndFormatString(IN HINSTANCE hInstance,
169 IN UINT uID,
170 OUT LPWSTR *lpTarget,
171 ...);
172
173 BOOL
174 ReadLineConfig(IN LPTSTR szDeviceName,
175 IN LPTSTR szLineName,
176 IN LPTSTR szControlName,
177 OUT DWORD *Flags);
178
179 BOOL
180 WriteLineConfig(IN LPTSTR szDeviceName,
181 IN LPTSTR szLineName,
182 IN PSNDVOL_REG_LINESTATE LineState,
183 IN DWORD cbSize);
184
185 /* tray.c */
186
187 INT_PTR
188 CALLBACK
189 TrayDlgProc(
190 HWND hwndDlg,
191 UINT uMsg,
192 WPARAM wParam,
193 LPARAM lParam);
194
195 #endif /* __SNDVOL32_H */