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