ReactOS 0.4.15-dev-7958-gcd0bb1a
sndblst.c File Reference
#include <stdarg.h>
#include <windef.h>
#include <winuser.h>
#include <sndtypes.h>
#include <mmddk.h>
#include <mmebuddy.h>
#include <mment4.h>
#include <mmebuddy_debug.h>
Include dependency graph for sndblst.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 

Functions

MMRESULT GetSoundBlasterDeviceCapabilities (IN PSOUND_DEVICE SoundDevice, IN DWORD DeviceId, OUT PVOID Capabilities, IN DWORD CapabilitiesSize)
 
BOOLEAN FoundDevice (UCHAR DeviceType, PWSTR DevicePath)
 
LONG APIENTRY DriverProc (DWORD DriverId, HANDLE DriverHandle, UINT Message, LONG Parameter1, LONG Parameter2)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 

Variables

PWSTR SBWaveOutDeviceName = L"ROS Sound Blaster Wave Out"
 
PWSTR SBWaveInDeviceName = L"ROS Sound Blaster Wave In"
 
PWSTR SBMidiOutDeviceName = L"ROS Sound Blaster Midi Out"
 
PWSTR SBMidiInDeviceName = L"ROS Sound Blaster Midi In"
 
PWSTR SBAuxDeviceName = L"ROS Sound Blaster Aux"
 
PWSTR SBMixerDeviceName = L"ROS Sound Blaster Mixer"
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 16 of file sndblst.c.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 17 of file sndblst.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 15 of file sndblst.c.

Function Documentation

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 243 of file sndblst.c.

247{
248 switch ( fdwReason )
249 {
250 case DLL_PROCESS_ATTACH :
251 SND_TRACE(L"DLL_PROCESS_ATTACH\n");
252 break;
253 case DLL_PROCESS_DETACH :
254 SND_TRACE(L"DLL_PROCESS_DETACH\n");
255 break;
256 case DLL_THREAD_ATTACH :
257 SND_TRACE(L"DLL_THREAD_ATTACH\n");
258 break;
259 case DLL_THREAD_DETACH :
260 SND_TRACE(L"DLL_THREAD_DETACH\n");
261 break;
262 }
263
264 return TRUE;
265}
#define TRUE
Definition: types.h:120
#define DLL_THREAD_DETACH
Definition: compat.h:133
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define DLL_THREAD_ATTACH
Definition: compat.h:132
#define SND_TRACE(...)
#define L(x)
Definition: ntvdm.h:50

◆ DriverProc()

LONG APIENTRY DriverProc ( DWORD  DriverId,
HANDLE  DriverHandle,
UINT  Message,
LONG  Parameter1,
LONG  Parameter2 
)

Definition at line 150 of file sndblst.c.

156{
158
159 switch ( Message )
160 {
161 case DRV_LOAD :
162 {
163 SND_TRACE(L"DRV_LOAD\n");
164
166
167 if ( ! MMSUCCESS(Result) )
168 return 0L;
169
171 0,
173
174 if ( ! MMSUCCESS(Result) )
175 {
177
179
180 return 0L;
181 }
182
183/*
184 PSOUND_DEVICE snd;
185 GetSoundDevice(WAVE_OUT_DEVICE_TYPE, 0, &snd);
186 GetSoundDevice(AUX_DEVICE_TYPE, 0, &snd);
187 GetSoundDevice(AUX_DEVICE_TYPE, 1, &snd);
188 GetSoundDevice(AUX_DEVICE_TYPE, 2, &snd);
189*/
190
191 SND_TRACE(L"Initialisation complete\n");
192
193 return 1L;
194 }
195
196 case DRV_FREE :
197 {
198 SND_TRACE(L"DRV_FREE\n");
199
200 /* TODO: Clean up the path names! */
202
204
205 SND_TRACE(L"Unfreed memory blocks: %d\n",
207
208 return 1L;
209 }
210
211 case DRV_ENABLE :
212 case DRV_DISABLE :
213 {
214 SND_TRACE(L"DRV_ENABLE / DRV_DISABLE\n");
215 return 1L;
216 }
217
218 case DRV_OPEN :
219 case DRV_CLOSE :
220 {
221 SND_TRACE(L"DRV_OPEN / DRV_CLOSE\n");
222 return 1L;
223 }
224
225 case DRV_QUERYCONFIGURE :
226 {
227 SND_TRACE(L"DRV_QUERYCONFIGURE");
228 return 0L;
229 }
230 case DRV_CONFIGURE :
231 return DRVCNF_OK;
232
233 default :
234 SND_TRACE(L"Unhandled message %d\n", Message);
235 return DefDriverProc(DriverId,
237 Message,
238 Parameter1,
239 Parameter2);
240 }
241}
static NDIS_HANDLE DriverHandle
BOOLEAN FoundDevice(UCHAR DeviceType, PWSTR DevicePath)
Definition: sndblst.c:111
LRESULT WINAPI DefDriverProc(DWORD_PTR dwDriverIdentifier, HDRVR hDrv, UINT Msg, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:554
static const WCHAR Message[]
Definition: register.c:74
#define DRV_LOAD(x)
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
MMRESULT EnumerateNt4ServiceSoundDevices(IN LPWSTR ServiceName, IN MMDEVICE_TYPE DeviceType, IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc)
Definition: detect.c:26
#define DRV_CLOSE
Definition: mmsystem.h:122
UINT MMRESULT
Definition: mmsystem.h:962
#define DRV_QUERYCONFIGURE
Definition: mmsystem.h:126
#define DRV_ENABLE
Definition: mmsystem.h:120
#define DRV_CONFIGURE
Definition: mmsystem.h:125
#define DRV_OPEN
Definition: mmsystem.h:121
#define DRVCNF_OK
Definition: mmsystem.h:134
#define DRV_FREE
Definition: mmsystem.h:124
#define DRV_DISABLE
Definition: mmsystem.h:123
VOID CleanupEntrypointMutexes()
Definition: reentrancy.c:56
MMRESULT InitEntrypointMutexes()
Definition: reentrancy.c:21
VOID UnlistAllSoundDevices()
Definition: devicelist.c:270
UINT GetMemoryAllocationCount()
Definition: utility.c:58
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

◆ FoundDevice()

BOOLEAN FoundDevice ( UCHAR  DeviceType,
PWSTR  DevicePath 
)

Definition at line 111 of file sndblst.c.

114{
116 PSOUND_DEVICE SoundDevice = NULL;
117 MMFUNCTION_TABLE FuncTable;
118 PWSTR PathCopy;
119
120 SND_TRACE(L"(Callback) Found device: %wS\n", DevicePath);
121
122 PathCopy = AllocateWideString(wcslen(DevicePath));
123
124 if ( ! PathCopy )
125 return FALSE;
126
127 CopyWideString(PathCopy, DevicePath);
128
129 Result = ListSoundDevice(DeviceType, (PVOID) PathCopy, &SoundDevice);
130
131 if ( ! MMSUCCESS(Result) )
132 return FALSE;
133
134 /* Set up our function table */
135 ZeroMemory(&FuncTable, sizeof(MMFUNCTION_TABLE));
139 FuncTable.Open = OpenNt4SoundDevice;
140 FuncTable.Close = CloseNt4SoundDevice;
142 //FuncTable.SubmitWaveHeaderToDevice = SubmitWaveHeaderToDevice;
143
144 SetSoundDeviceFunctionTable(SoundDevice, &FuncTable);
145
146 return TRUE;
147}
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
MMRESULT GetSoundBlasterDeviceCapabilities(IN PSOUND_DEVICE SoundDevice, IN DWORD DeviceId, OUT PVOID Capabilities, IN DWORD CapabilitiesSize)
Definition: sndblst.c:42
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
DeviceType
Definition: mmdrv.h:42
MMRESULT ListSoundDevice(IN MMDEVICE_TYPE DeviceType, IN PVOID Identifier OPTIONAL, OUT PSOUND_DEVICE *SoundDevice OPTIONAL)
Definition: devicelist.c:131
MMRESULT WriteFileEx_Committer(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID OffsetPtr, IN DWORD Length, IN PSOUND_OVERLAPPED Overlap, IN LPOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine)
Definition: streaming.c:264
MMRESULT SetSoundDeviceFunctionTable(IN PSOUND_DEVICE SoundDevice, IN PMMFUNCTION_TABLE FunctionTable)
Definition: functiontable.c:21
#define AllocateWideString(string_length)
Definition: mmebuddy.h:33
#define CopyWideString(dest, source)
Definition: mmebuddy.h:39
MMRESULT OpenNt4SoundDevice(IN PSOUND_DEVICE SoundDevice, OUT PVOID *Handle)
Definition: control.c:52
MMRESULT QueryNt4WaveDeviceFormatSupport(IN PSOUND_DEVICE SoundDevice, IN LPWAVEFORMATEX Format, IN DWORD FormatSize)
Definition: control.c:154
MMRESULT CloseNt4SoundDevice(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID Handle)
Definition: control.c:65
MMRESULT SetNt4WaveDeviceFormat(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN DWORD DeviceId, IN LPWAVEFORMATEX Format, IN DWORD FormatSize)
Definition: control.c:199
MMOPEN_FUNC Open
Definition: mmebuddy.h:204
MMCLOSE_FUNC Close
Definition: mmebuddy.h:205
MMGETCAPS_FUNC GetCapabilities
Definition: mmebuddy.h:197
MMWAVEQUERYFORMATSUPPORT_FUNC QueryWaveFormatSupport
Definition: mmebuddy.h:207
WAVE_COMMIT_FUNC CommitWaveBuffer
Definition: mmebuddy.h:212
MMWAVESETFORMAT_FUNC SetWaveFormat
Definition: mmebuddy.h:208
uint16_t * PWSTR
Definition: typedefs.h:56
#define ZeroMemory
Definition: winbase.h:1712

Referenced by DriverProc().

◆ GetSoundBlasterDeviceCapabilities()

MMRESULT GetSoundBlasterDeviceCapabilities ( IN PSOUND_DEVICE  SoundDevice,
IN DWORD  DeviceId,
OUT PVOID  Capabilities,
IN DWORD  CapabilitiesSize 
)

Definition at line 42 of file sndblst.c.

47{
50
51 SND_ASSERT( SoundDevice );
53
54 SND_TRACE(L"Sndblst - GetSoundBlasterDeviceCapabilities\n");
55
56 Result = GetSoundDeviceType(SoundDevice, &DeviceType);
58
59 /* Use the default method of obtaining device capabilities */
62 CapabilitiesSize);
63
64 if ( ! MMSUCCESS(Result) )
65 return Result;
66
67 /* Inject the appropriate device name */
68 switch ( DeviceType )
69 {
71 {
74 break;
75 }
77 {
80 break;
81 }
83 {
86 break;
87 }
89 {
92 break;
93 }
94 case AUX_DEVICE_TYPE :
95 {
98 break;
99 }
100 case MIXER_DEVICE_TYPE :
101 {
104 break;
105 }
106 }
107
108 return MMSYSERR_NOERROR;
109}
PWSTR SBMidiOutDeviceName
Definition: sndblst.c:35
PWSTR SBMidiInDeviceName
Definition: sndblst.c:36
PWSTR SBWaveOutDeviceName
Definition: sndblst.c:33
PWSTR SBMixerDeviceName
Definition: sndblst.c:38
PWSTR SBWaveInDeviceName
Definition: sndblst.c:34
PWSTR SBAuxDeviceName
Definition: sndblst.c:37
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
#define SND_ASSERT(condition)
MMRESULT GetNt4SoundDeviceCapabilities(IN PSOUND_DEVICE SoundDevice, OUT PVOID Capabilities, IN DWORD CapabilitiesSize)
Definition: control.c:80
MIXERCAPSA * LPMIXERCAPS
Definition: mmsystem.h:2823
WAVEINCAPSA * LPWAVEINCAPS
Definition: mmsystem.h:2819
MIDIINCAPSA * LPMIDIINCAPS
Definition: mmsystem.h:2821
AUXCAPSA * LPAUXCAPS
Definition: mmsystem.h:2822
WAVEOUTCAPSA * LPWAVEOUTCAPS
Definition: mmsystem.h:2818
MIDIOUTCAPSA * LPMIDIOUTCAPS
Definition: mmsystem.h:2820
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
@ MIXER_DEVICE_TYPE
Definition: sndtypes.h:33
@ MIDI_OUT_DEVICE_TYPE
Definition: sndtypes.h:31
@ WAVE_IN_DEVICE_TYPE
Definition: sndtypes.h:28
@ AUX_DEVICE_TYPE
Definition: sndtypes.h:32
@ WAVE_OUT_DEVICE_TYPE
Definition: sndtypes.h:29
@ MIDI_IN_DEVICE_TYPE
Definition: sndtypes.h:30
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1192
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1138
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1114
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1217
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1050
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1028

Referenced by FoundDevice().

Variable Documentation

◆ SBAuxDeviceName

PWSTR SBAuxDeviceName = L"ROS Sound Blaster Aux"

Definition at line 37 of file sndblst.c.

Referenced by GetSoundBlasterDeviceCapabilities().

◆ SBMidiInDeviceName

PWSTR SBMidiInDeviceName = L"ROS Sound Blaster Midi In"

Definition at line 36 of file sndblst.c.

Referenced by GetSoundBlasterDeviceCapabilities().

◆ SBMidiOutDeviceName

PWSTR SBMidiOutDeviceName = L"ROS Sound Blaster Midi Out"

Definition at line 35 of file sndblst.c.

Referenced by GetSoundBlasterDeviceCapabilities().

◆ SBMixerDeviceName

PWSTR SBMixerDeviceName = L"ROS Sound Blaster Mixer"

Definition at line 38 of file sndblst.c.

Referenced by GetSoundBlasterDeviceCapabilities().

◆ SBWaveInDeviceName

PWSTR SBWaveInDeviceName = L"ROS Sound Blaster Wave In"

Definition at line 34 of file sndblst.c.

Referenced by GetSoundBlasterDeviceCapabilities().

◆ SBWaveOutDeviceName

PWSTR SBWaveOutDeviceName = L"ROS Sound Blaster Wave Out"

Definition at line 33 of file sndblst.c.

Referenced by GetSoundBlasterDeviceCapabilities().