Changeset 3099 for trunk/src/dsound/DSOUND.CPP
- Timestamp:
- Mar 13, 2000, 1:47:54 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dsound/DSOUND.CPP
r1744 r3099 1 /* $Id: DSOUND.CPP,v 1. 6 1999-11-14 22:12:14 hughExp $ */1 /* $Id: DSOUND.CPP,v 1.7 2000-03-13 12:47:44 sandervl Exp $ */ 2 2 3 3 /* 4 4 * DirectSound exported APIs 5 5 * 6 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl) 6 * Copyright 1998 Sander van Leeuwen 7 * Copyright 2000 Michal Necasek 7 8 * 8 9 * Project Odin Software License can be found in LICENSE.TXT … … 15 16 #include <os2win.h> 16 17 #include <stdlib.h> 18 #include <stdio.h> 17 19 #include <string.h> 18 20 19 21 #define INITGUID 22 #define ICOM_CINTERFACE 1 23 #define CINTERFACE 20 24 #include <dsound.h> 25 21 26 #include "os2dsound.h" 22 27 23 28 #include <misc.h> 29 30 OS2IDirectSound *DS = NULL; 24 31 25 32 //****************************************************************************** … … 29 36 IUnknown *pUnkOuter) 30 37 { 31 OS2IDirectSound *newsound = new OS2IDirectSound(lpGUID); 32 HRESULT rc; 33 34 dprintf(("DirectSoundCreate %X %X %X\n", lpGUID, ppDS, pUnkOuter)); 35 if(newsound == NULL) 36 return(DSERR_OUTOFMEMORY); 37 38 rc = newsound->GetLastError(); 39 if(rc != DS_OK) { 40 *ppDS = NULL; 41 delete newsound; 42 } 43 else 44 *ppDS = (LPDIRECTSOUND)newsound; 45 return(rc); 46 } 38 OS2IDirectSound *newsound; 39 HRESULT rc; 40 41 dprintf(("DSOUND:DirectSoundCreate %X %X %X\n", lpGUID, ppDS, pUnkOuter)); 42 43 if (OS2IDirectSound::fDSExists) { 44 *ppDS = (LPDIRECTSOUND)DS; 45 DS->Vtbl.AddRef(DS); 46 return DS_OK; 47 } 48 49 newsound = new OS2IDirectSound(lpGUID); 50 51 if (newsound == NULL) 52 return DSERR_OUTOFMEMORY; 53 54 rc = newsound->GetLastError(); 55 if(rc != DS_OK) { 56 *ppDS = NULL; 57 delete newsound; 58 } 59 else { 60 *ppDS = (LPDIRECTSOUND)newsound; 61 newsound->Vtbl.AddRef(newsound); 62 DS = newsound; 63 } 64 return rc; 65 } 66 67 //****************************************************************************** 68 //****************************************************************************** 69 HRESULT WIN32API OS2DirectSoundCaptureCreate(const GUID *lpGUID, 70 LPDIRECTSOUNDCAPTURE * ppDS, 71 IUnknown *pUnkOuter) 72 { 73 return DSERR_OUTOFMEMORY; 74 } 75 76 //****************************************************************************** 77 //****************************************************************************** 78 HRESULT WIN32API OS2DirectSoundCaptureEnumerateA(LPDSENUMCALLBACKA lpCallback, 79 LPVOID lpContext) 80 { 81 dprintf(("DSOUND:DirectSoundCaptureEnumerateA\n")); 82 83 lpCallback(NULL, "DART DirectSoundCapture for OS/2", 84 "DirectSoundCapture/2 v0.1", lpContext); 85 return DS_OK; 86 } 87 88 //****************************************************************************** 89 //****************************************************************************** 90 HRESULT WIN32API OS2DirectSoundCaptureEnumerateW(LPDSENUMCALLBACKW lpCallback, 91 LPVOID lpContext) 92 { 93 dprintf(("DSOUND:DirectSoundCaptureEnumerateW\n")); 94 95 lpCallback(NULL, (LPWSTR)L"DART DirectSoundCapture for OS/2", 96 (LPWSTR)L"DirectSoundCapture/2 v0.1", lpContext); 97 return DS_OK; 98 } 99 47 100 //****************************************************************************** 48 101 //****************************************************************************** … … 50 103 LPVOID lpContext) 51 104 { 52 dprintf(("DirectSoundEnumerateA\n")); 53 54 lpCallback(NULL, "DART DirectSound for OS/2", "DirectSound/2 v0.1", 55 lpContext); 56 return(DS_OK); 57 } 58 //****************************************************************************** 59 //****************************************************************************** 105 dprintf(("DSOUND:DirectSoundEnumerateA\n")); 106 107 lpCallback(NULL, "DART DirectSound for OS/2", "DirectSound/2 v0.5", 108 lpContext); 109 return DS_OK; 110 } 111 112 //****************************************************************************** 113 //****************************************************************************** 114 HRESULT WIN32API OS2DirectSoundEnumerateW(LPDSENUMCALLBACKW lpCallback, 115 LPVOID lpContext) 116 { 117 dprintf(("DSOUND:DirectSoundEnumerateW\n")); 118 119 lpCallback(NULL, (LPWSTR)L"DART DirectSound for OS/2", (LPWSTR)L"DirectSound/2 v0.5", 120 lpContext); 121 return DS_OK; 122 } 123 124 //****************************************************************************** 125 //****************************************************************************** 126 127 128 /******************************************************************************* 129 * DirectSound ClassFactory 130 * 131 */ 132 133 typedef struct 134 { 135 /* IUnknown fields */ 136 ICOM_VTABLE(IClassFactory) *lpvtbl; 137 DWORD ref; 138 } IClassFactoryImpl; 139 140 static HRESULT WINAPI 141 DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) 142 { 143 ICOM_THIS(IClassFactoryImpl,iface); 144 char buf[80]; 145 146 if (HIWORD(riid)) 147 WINE_StringFromCLSID(riid,buf); 148 else 149 sprintf(buf,"<guid-0x%04x>",LOWORD(riid)); 150 dprintf(("DSOUND:DSCF_QueryInterface(%p)->(%s,%p),stub!\n",This,buf,ppobj)); 151 return E_NOINTERFACE; 152 } 153 154 static ULONG WINAPI 155 DSCF_AddRef(LPCLASSFACTORY iface) 156 { 157 ICOM_THIS(IClassFactoryImpl,iface); 158 return ++(This->ref); 159 } 160 161 static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface) 162 { 163 ICOM_THIS(IClassFactoryImpl,iface); 164 /* static class, won't be freed */ 165 return --(This->ref); 166 } 167 168 static HRESULT WINAPI DSCF_CreateInstance( LPCLASSFACTORY iface, 169 LPUNKNOWN pOuter, 170 REFIID riid, 171 LPVOID *ppobj) 172 { 173 ICOM_THIS(IClassFactoryImpl,iface); 174 LPGUID lpGUID; 175 lpGUID = (LPGUID) riid; 176 177 dprintf(("DSOUND:DSCF_CreateInstance\n")); 178 if( lpGUID && (*lpGUID == IID_IDirectSound )) { 179 return OS2DirectSoundCreate(lpGUID,(LPDIRECTSOUND*)ppobj,pOuter); 180 } 181 return E_NOINTERFACE; 182 } 183 184 static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) 185 { 186 ICOM_THIS(IClassFactoryImpl,iface); 187 dprintf(("DSOUND:DSCF_LockServer(%p)->(%d),stub!\n",This,dolock)); 188 return S_OK; 189 } 190 191 static ICOM_VTABLE(IClassFactory) DSCF_Vtbl = 192 { 193 DSCF_QueryInterface, 194 DSCF_AddRef, 195 DSCF_Release, 196 DSCF_CreateInstance, 197 DSCF_LockServer 198 }; 199 200 static IClassFactoryImpl DSOUND_CF = {&DSCF_Vtbl, 1 }; 201 202 203 HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, 204 REFIID riid, 205 LPVOID *ppv) 206 { 207 char buf[80],xbuf[80]; 208 209 if (HIWORD(rclsid)) 210 WINE_StringFromCLSID(rclsid,xbuf); 211 else 212 sprintf(xbuf,"<guid-0x%04x>",LOWORD(rclsid)); 213 if (HIWORD(riid)) 214 WINE_StringFromCLSID(riid,buf); 215 else 216 sprintf(buf,"<guid-0x%04x>",LOWORD(riid)); 217 WINE_StringFromCLSID(riid,xbuf); 218 219 dprintf(("DSOUND:(%p,%p,%p)\n", xbuf, buf, ppv)); 220 if (!memcmp(riid,&IID_IClassFactory,sizeof(IID_IClassFactory))) 221 { 222 *ppv = (LPVOID)&DSOUND_CF; 223 DSOUND_CF.lpvtbl->AddRef((IClassFactory*)&DSOUND_CF); 224 return S_OK; 225 } 226 dprintf(("DSOUND: (%p,%p,%p): no interface found.\n", xbuf, buf, ppv)); 227 return E_NOINTERFACE; 228 } 229 230 231 /******************************************************************************* 232 * DllCanUnloadNow Determines whether the DLL is in use. 233 * 234 * RETURNS 235 * Success: S_OK 236 * Failure: S_FALSE 237 */ 238 HRESULT WINAPI DllCanUnloadNow(void) 239 { 240 dprintf(("DSOUND:DllCanUnloadNow(void) stub\n")); 241 return S_FALSE; 242 }//****************************************************************************** 243
Note:
See TracChangeset
for help on using the changeset viewer.