ReactOS  0.4.14-dev-1007-g90d795b
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_ATTACH
Definition: compat.h:121
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define DLL_THREAD_DETACH
Definition: compat.h:122
#define DLL_PROCESS_DETACH
Definition: compat.h:119
static const WCHAR L[]
Definition: oid.c:1250
#define SND_TRACE(...)

◆ 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,
172  FoundDevice);
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,
236  DriverHandle,
237  Message,
238  Parameter1,
239  Parameter2);
240  }
241 }
#define DRV_DISABLE
Definition: mmsystem.h:123
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
BOOLEAN FoundDevice(UCHAR DeviceType, PWSTR DevicePath)
Definition: sndblst.c:111
UINT MMRESULT
Definition: mmsystem.h:962
#define DRV_CLOSE
Definition: mmsystem.h:122
VOID CleanupEntrypointMutexes(VOID)
#define DRVCNF_OK
Definition: mmsystem.h:134
#define DRV_QUERYCONFIGURE
Definition: mmsystem.h:126
#define DRV_OPEN
Definition: mmsystem.h:121
_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:426
#define DRV_LOAD(x)
#define DRV_CONFIGURE
Definition: mmsystem.h:125
#define DRV_FREE
Definition: mmsystem.h:124
CHAR Message[80]
Definition: alive.c:5
UINT GetMemoryAllocationCount(VOID)
static const WCHAR L[]
Definition: oid.c:1250
VOID UnlistAllSoundDevices(VOID)
#define DRV_ENABLE
Definition: mmsystem.h:120
MMRESULT InitEntrypointMutexes(VOID)
MMRESULT EnumerateNt4ServiceSoundDevices(IN LPWSTR ServiceName, IN MMDEVICE_TYPE DeviceType, IN SOUND_DEVICE_DETECTED_PROC SoundDeviceDetectedProc)
Definition: detect.c:26
LRESULT WINAPI DefDriverProc(DWORD_PTR dwDriverIdentifier, HDRVR hDrv, UINT Msg, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:554
#define SND_TRACE(...)

◆ 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 }
MMRESULT QueryNt4WaveDeviceFormatSupport(IN PSOUND_DEVICE SoundDevice, IN LPWAVEFORMATEX Format, IN DWORD FormatSize)
Definition: control.c:154
MMRESULT SetNt4WaveDeviceFormat(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN DWORD DeviceId, IN LPWAVEFORMATEX Format, IN DWORD FormatSize)
Definition: control.c:199
MMRESULT ListSoundDevice(IN MMDEVICE_TYPE DeviceType, IN PVOID Identifier OPTIONAL, OUT PSOUND_DEVICE *SoundDevice OPTIONAL)
Definition: devicelist.c:131
#define TRUE
Definition: types.h:120
MMRESULT SetSoundDeviceFunctionTable(IN PSOUND_DEVICE SoundDevice, IN PMMFUNCTION_TABLE FunctionTable)
Definition: functiontable.c:21
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
uint16_t * PWSTR
Definition: typedefs.h:55
DeviceType
Definition: mmdrv.h:41
MMRESULT OpenNt4SoundDevice(IN PSOUND_DEVICE SoundDevice, OUT PVOID *Handle)
Definition: control.c:52
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:238
#define ZeroMemory
Definition: winbase.h:1642
UINT MMRESULT
Definition: mmsystem.h:962
#define CopyWideString(dest, source)
Definition: mmebuddy.h:39
MMCLOSE_FUNC Close
Definition: mmebuddy.h:206
WAVE_COMMIT_FUNC CommitWaveBuffer
Definition: mmebuddy.h:213
MMWAVEQUERYFORMATSUPPORT_FUNC QueryWaveFormatSupport
Definition: mmebuddy.h:208
MMGETCAPS_FUNC GetCapabilities
Definition: mmebuddy.h:198
#define AllocateWideString(string_length)
Definition: mmebuddy.h:33
smooth NULL
Definition: ftsmooth.c:416
_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:426
static const WCHAR L[]
Definition: oid.c:1250
MMRESULT GetSoundBlasterDeviceCapabilities(IN PSOUND_DEVICE SoundDevice, IN DWORD DeviceId, OUT PVOID Capabilities, IN DWORD CapabilitiesSize)
Definition: sndblst.c:42
MMOPEN_FUNC Open
Definition: mmebuddy.h:205
MMWAVESETFORMAT_FUNC SetWaveFormat
Definition: mmebuddy.h:209
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
MMRESULT CloseNt4SoundDevice(IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance, IN PVOID Handle)
Definition: control.c:65
#define SND_TRACE(...)

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  }
76  case WAVE_IN_DEVICE_TYPE :
77  {
78  LPWAVEINCAPS WaveInCaps = (LPWAVEINCAPS) Capabilities;
80  break;
81  }
83  {
86  break;
87  }
88  case MIDI_IN_DEVICE_TYPE :
89  {
90  LPMIDIINCAPS MidiInCaps = (LPMIDIINCAPS) Capabilities;
92  break;
93  }
94  case AUX_DEVICE_TYPE :
95  {
96  LPAUXCAPS AuxCaps = (LPAUXCAPS) Capabilities;
98  break;
99  }
100  case MIXER_DEVICE_TYPE :
101  {
102  LPMIXERCAPS MixerCaps = (LPMIXERCAPS) Capabilities;
104  break;
105  }
106  }
107 
108  return MMSYSERR_NOERROR;
109 }
MIDIINCAPSA * LPMIDIINCAPS
Definition: mmsystem.h:2821
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1217
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1050
#define MMSUCCESS(result)
Definition: mmebuddy.h:80
DeviceType
Definition: mmdrv.h:41
PWSTR SBMidiInDeviceName
Definition: sndblst.c:36
PWSTR SBMixerDeviceName
Definition: sndblst.c:38
UINT MMRESULT
Definition: mmsystem.h:962
#define CopyWideString(dest, source)
Definition: mmebuddy.h:39
MIDIOUTCAPSA * LPMIDIOUTCAPS
Definition: mmsystem.h:2820
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1114
WAVEINCAPSA * LPWAVEINCAPS
Definition: mmsystem.h:2819
UCHAR MMDEVICE_TYPE
Definition: mmebuddy.h:88
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
MIXERCAPSA * LPMIXERCAPS
Definition: mmsystem.h:2823
#define SND_ASSERT(condition)
_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:426
WAVEOUTCAPSA * LPWAVEOUTCAPS
Definition: mmsystem.h:2818
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
PWSTR SBWaveInDeviceName
Definition: sndblst.c:34
static const WCHAR L[]
Definition: oid.c:1250
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1138
AUXCAPSA * LPAUXCAPS
Definition: mmsystem.h:2822
PWSTR SBMidiOutDeviceName
Definition: sndblst.c:35
MMRESULT GetSoundDeviceType(IN PSOUND_DEVICE SoundDevice, OUT PMMDEVICE_TYPE DeviceType)
Definition: devicelist.c:346
PWSTR SBWaveOutDeviceName
Definition: sndblst.c:33
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1028
CHAR szPname[MAXPNAMELEN]
Definition: mmsystem.h:1192
MMRESULT GetNt4SoundDeviceCapabilities(IN PSOUND_DEVICE SoundDevice, OUT PVOID Capabilities, IN DWORD CapabilitiesSize)
Definition: control.c:80
#define SND_TRACE(...)
PWSTR SBAuxDeviceName
Definition: sndblst.c:37

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().