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