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